Merge pull request #11016 from cachedout/doc_string_fixes

Add CLI examples to dockerio and lxc.
This commit is contained in:
Joseph Hall 2014-03-06 15:13:13 -07:00
commit fc0b4b7564
2 changed files with 49 additions and 0 deletions

View File

@ -221,6 +221,12 @@ def _set_status(m,
def invalid(m, id=NOTSET, comment=INVALID_RESPONSE, out=None):
'''
Return invalid status
CLI Example:
.. code-block:: bash
salt '*' docker.invalid
'''
return _set_status(m, status=False, id=id, comment=comment, out=out)
@ -228,6 +234,12 @@ def invalid(m, id=NOTSET, comment=INVALID_RESPONSE, out=None):
def valid(m, id=NOTSET, comment=VALID_RESPONSE, out=None):
'''
Return valid status
CLI Example:
.. code-block:: bash
salt '*' docker.valid
'''
return _set_status(m, status=True, id=id, comment=comment, out=out)

View File

@ -157,6 +157,8 @@ def init(name,
'''
Initialize a new container.
CLI Example:
.. code-block:: bash
salt 'minion' lxc.init name [cpuset=cgroups_cpuset] \\
@ -232,6 +234,8 @@ def create(name, config=None, profile=None, options=None, **kwargs):
'''
Create a new container.
CLI Example:
.. code-block:: bash
salt 'minion' lxc.create name [config=config_file] \\
@ -332,6 +336,8 @@ def clone(name,
'''
Create a new container.
CLI Example:
.. code-block:: bash
salt 'minion' lxc.clone name ARGS
@ -354,6 +360,8 @@ def clone(name,
profile
A LXC profile (defined in config or pillar).
CLI Example:
.. code-block:: bash
salt '*' lxc.clone myclone ubuntu "snapshot=True"
@ -412,6 +420,7 @@ def list_(extra=False):
{'running': ['foo']} # normal mode
{'running': {'foo': {'info1': 'bar'}} # extra mode
CLI Example:
.. code-block:: bash
@ -497,6 +506,8 @@ def start(name, restart=False):
'''
Start the named container.
CLI Example:
.. code-block:: bash
salt '*' lxc.start name
@ -530,6 +541,8 @@ def stop(name):
'''
Stop the named container.
CLI Example:
.. code-block:: bash
salt '*' lxc.stop name
@ -562,6 +575,8 @@ def freeze(name):
'''
Freeze the named container.
CLI Example:
.. code-block:: bash
salt '*' lxc.freeze name
@ -573,6 +588,8 @@ def unfreeze(name):
'''
Unfreeze the named container.
CLI Example:
.. code-block:: bash
salt '*' lxc.unfreeze name
@ -585,6 +602,8 @@ def destroy(name, stop=True):
Destroy the named container.
WARNING: Destroys all data associated with the container.
CLI Example:
.. code-block:: bash
salt '*' lxc.destroy name [stop=(true|false)]
@ -598,6 +617,8 @@ def exists(name):
'''
Returns whether the named container exists.
CLI Example:
.. code-block:: bash
salt '*' lxc.exists name
@ -610,6 +631,8 @@ def state(name):
'''
Returns the state of a container.
CLI Example:
.. code-block:: bash
salt '*' lxc.state name
@ -636,6 +659,8 @@ def get_parameter(name, parameter):
'''
Returns the value of a cgroup parameter for a container.
CLI Example:
.. code-block:: bash
salt '*' lxc.get_parameter name parameter
@ -655,6 +680,8 @@ def set_parameter(name, parameter, value):
'''
Set the value of a cgroup parameter for a container.
CLI Example:
.. code-block:: bash
salt '*' lxc.set_parameter name parameter value
@ -674,6 +701,8 @@ def templates(templates_dir='/usr/share/lxc/templates'):
'''
Returns a list of existing templates
CLI Example:
.. code-block:: bash
salt '*' lxc.templates
@ -692,6 +721,8 @@ def info(name):
'''
Returns information about a container.
CLI Example:
.. code-block:: bash
salt '*' lxc.info name
@ -782,6 +813,8 @@ def info(name):
def set_pass(name, users, password):
'''Set the password of one or more system users inside containers
CLI Example:
.. code-block:: bash
salt '*' lxc.set_pass root foo
@ -820,6 +853,8 @@ def set_pass(name, users, password):
def update_lxc_conf(name, lxc_conf, lxc_conf_unset):
'''Edit LXC configuration options
CLI Example:
.. code-block:: bash
salt-call -lall lxc.update_lxc_conf ubuntu \
@ -916,6 +951,8 @@ def set_dns(name, dnsservers=None, searchdomains=None):
'''Update container dns configuration
and possibly also resolvonf one.
CLI Example:
.. code-block:: bash
salt-call -lall lxc.set_dns ubuntu ['8.8.8.8', '4.4.4.4']