Fixing formatting, mistargets, and terminology

Fixing:

    - Standardizing on formatting:
        CLI Example:    -> CLI Example::
        Usage::         -> CLI Example::

    - Making sure all function names match their examples

    - Other minor formatting issues
This commit is contained in:
blast_hardcheese 2012-05-06 03:37:03 -07:00
parent 40c7c62f06
commit 22e731e1a6
18 changed files with 42 additions and 43 deletions

View File

@ -331,7 +331,7 @@ def list_upgrades():
List all available package upgrades.
CLI Example::
salt '*' pkg.check_update
salt '*' pkg.list_upgrades
'''
r = _get_upgradable()
return r

View File

@ -40,7 +40,7 @@ def recv(files, dest):
def get_file(path, dest, env='base'):
'''
Used to get a single file from the salt master
CLI Example::
salt '*' cp.get_file salt://path/to/file /minion/dest
@ -76,7 +76,7 @@ def get_dir(path, dest, env='base'):
'''
Used to recursively copy a directory from the salt master
CLI Example:
CLI Example::
salt '*' cp.get_dir salt://path/to/dir/ /minion/dest
'''
@ -128,7 +128,7 @@ def cache_dir(path, env='base'):
Download and cache everything under a directory from the master
CLI Example::
salt '*' cp.cache_dir salt://path/to/dir
'''
client = salt.fileclient.get_file_client(__opts__)

View File

@ -385,7 +385,7 @@ def sed(path, before, after, limit='', backup='.bak', options='-r -e',
Forward slashes and single quotes will be escaped automatically in the
``before`` and ``after`` patterns.
Usage::
CLI Example::
salt '*' file.sed /etc/httpd/httpd.conf 'LogLevel warn' 'LogLevel info'
@ -426,7 +426,7 @@ def uncomment(path, regex, char='#', backup='.bak'):
**WARNING:** each time ``sed``/``comment``/``uncomment`` is called will
overwrite this backup
Usage::
CLI Example::
salt '*' file.uncomment /etc/hosts.deny 'ALL: PARANOID'
@ -463,7 +463,7 @@ def comment(path, regex, char='#', backup='.bak'):
``uncomment`` is called. Meaning the backup will only be useful
after the first invocation.
Usage::
CLI Example::
salt '*' file.comment /etc/modules pcspkr
@ -486,7 +486,7 @@ def contains(path, text, limit='', escape=False):
'''
Return True if the file at ``path`` contains ``text``
Usage::
CLI Example::
salt '*' file.contains /etc/crontab 'mymaintenance.sh'
@ -513,7 +513,7 @@ def append(path, *args):
'''
Append text to the end of a file
Usage::
CLI Example::
salt '*' file.append /etc/motd \\
"With all thine offerings thou shalt offer salt."\\
@ -540,7 +540,7 @@ def touch(name, atime=None, mtime=None):
mtime:
Last modification in Unix epoch time
Usage::
CLI Example::
salt '*' file.touch /var/log/emptyfile
.. versionadded:: 0.9.5

View File

@ -40,7 +40,7 @@ def get_disabled():
CLI Example::
salt '*' service.get_enabled
salt '*' service.get_disabled
'''
ret = set()
lines = __salt__['cmd.run']('rc-update -v show').strip().split('\n')
@ -60,7 +60,7 @@ def get_all():
CLI Example::
salt '*' service.get_enabled
salt '*' service.get_all
'''
return sorted(get_enabled() + get_disabled())
@ -154,6 +154,6 @@ def disabled(name):
CLI Example::
salt '*' service.enabled <service name>
salt '*' service.disabled <service name>
'''
return name in get_disabled()

View File

@ -99,7 +99,7 @@ def freemem():
CLI Example::
salt '*' virt.freemem
salt '*' hyper.freemem
'''
conn = __get_conn()
mem = conn.getInfo()[1]
@ -119,7 +119,7 @@ def freecpu():
CLI Example::
salt '*' virt.freemem
salt '*' hyper.freecpu
'''
conn = __get_conn()
cpus = conn.getInfo()[2]
@ -136,7 +136,7 @@ def list_virts():
CLI Example::
salt '*' virt.list_virts
salt '*' hyper.list_virts
'''
# Expand to include down vms
conn = __get_conn()
@ -158,7 +158,7 @@ def virt_info():
CLI Example::
salt '*' virt.vm_info
salt '*' hyper.virt_info
'''
info = {}
for vm_ in list_virts():
@ -181,7 +181,7 @@ def hyper_info():
CLI Example::
salt '*' virt.node_info
salt '*' hyper.hyper_info
'''
conn = __get_conn()
raw = conn.getInfo()
@ -331,7 +331,7 @@ def init(
CLI Example:
salt node1 webserver 2 2048 salt://fedora/f16.img:virt /srv/vm/images
salt '*' hyper.init webserver 2 2048 salt://fedora/f16.img:virt /srv/vm/images
'''
vmdir = os.path.join(storage_dir, name)
if not os.path.exists(vmdir):
@ -424,7 +424,7 @@ def get_disks(name):
CLI Example::
salt '*' virt.get_disks <vm name>
salt '*' hyper.get_disks <vm name>
'''
disks = {}
doc = minidom.parse(StringIO.StringIO(get_conf(name)))
@ -457,7 +457,7 @@ def get_conf(name):
CLI Example::
salt '*' virt.get_conf <vm name>
salt '*' hyper.get_conf <vm name>
'''
dom = _get_dom(name)
return dom.XMLDesc(0)

View File

@ -57,8 +57,9 @@ def assign(name, value):
'''
Assign a single sysctl parameter for this minion
CLI Example:
salt '*' sysctl.assign net.ipv4.ip_forward 1
CLI Example::
salt '*' sysctl.assign net.ipv4.ip_forward 1
'''
sysctl_file = '/proc/sys/{0}'.format(name.replace('.', '/'))
if not os.path.exists(sysctl_file):

View File

@ -66,7 +66,7 @@ def rm_fstab(name, config='/etc/fstab'):
CLI Example::
salt '*' /mnt/foo
salt '*' mount.rm_fstab /mnt/foo
'''
contents = fstab(config)
if name not in contents:

View File

@ -377,6 +377,3 @@ def list(prefix='', bin_env=None):
else:
packages[name]=version
return packages

View File

@ -139,7 +139,7 @@ def virtual_memory_usage():
CLI Example::
salt '*' virtual_memory_usage
salt '*' ps.virtual_memory_usage
'''
return dict(psutil.virtmem_usage()._asdict())

View File

@ -210,7 +210,7 @@ def list_groups(name):
CLI Example::
salt '*' user.groups foo
salt '*' user.list_groups foo
'''
ugrp = set()
for group in grp.getgrall():

View File

@ -29,7 +29,7 @@ def getenforce():
'''
Return the mode selinux is running in
CLE Example::
CLI Example::
salt '*' selinux.getenforce
'''

View File

@ -88,7 +88,7 @@ def sls(mods, env='base', **kwargs):
Execute a set list of state modules from an environment, default
environment is base
CLI Example:
CLI Example::
salt '*' state.sls core,edit.vim dev
'''

View File

@ -89,11 +89,11 @@ def stop(name):
def restart(name):
'''
Start the specified service with systemd
Restart the specified service with systemd
CLI Example::
salt '*' service.start <service name>
salt '*' service.restart <service name>
'''
cmd = 'systemctl restart {0}.service'.format(name)
return not __salt__['cmd.retcode'](cmd)

View File

@ -357,7 +357,7 @@ def list_groups(name):
CLI Example::
salt '*' user.groups foo
salt '*' user.list_groups foo
'''
ugrp = set()

View File

@ -543,7 +543,8 @@ def set_autostart(vm_, state='on'):
system on reboot.
CLI Example::
salt "*" virt.enable_autostart <vm name> <on | off>
salt "*" virt.set_autostart <vm name> <on | off>
'''
dom = _get_dom(vm_)

View File

@ -377,7 +377,7 @@ def sed(path, before, after, limit='', backup='.bak', options='-r -e',
Forward slashes and single quotes will be escaped automatically in the
``before`` and ``after`` patterns.
Usage::
CLI Example::
salt '*' file.sed /etc/httpd/httpd.conf 'LogLevel warn' 'LogLevel info'
@ -418,7 +418,7 @@ def uncomment(path, regex, char='#', backup='.bak'):
**WARNING:** each time ``sed``/``comment``/``uncomment`` is called will
overwrite this backup
Usage::
CLI Example::
salt '*' file.uncomment /etc/hosts.deny 'ALL: PARANOID'
@ -455,7 +455,7 @@ def comment(path, regex, char='#', backup='.bak'):
``uncomment`` is called. Meaning the backup will only be useful
after the first invocation.
Usage::
CLI Example::
salt '*' file.comment /etc/modules pcspkr
@ -478,7 +478,7 @@ def contains(path, text, limit=''):
'''
Return True if the file at ``path`` contains ``text``
Usage::
CLI Example::
salt '*' file.contains /etc/crontab 'mymaintenance.sh'
@ -498,7 +498,7 @@ def append(path, *args):
'''
Append text to the end of a file
Usage::
CLI Example::
salt '*' file.append /etc/motd \\
"With all thine offerings thou shalt offer salt."\\
@ -525,7 +525,7 @@ def touch(name, atime=None, mtime=None):
mtime:
Last modification in Unix epoch time
Usage::
CLI Example::
salt '*' file.touch /var/log/emptyfile
.. versionadded:: 0.9.5

View File

@ -75,7 +75,7 @@ def get_all():
CLI Example::
salt '*' service.get_enabled
salt '*' service.get_all
'''
return sorted(get_enabled() + get_disabled())

View File

@ -11,7 +11,7 @@ def __virtual__():
return 'user' if __grains__['kernel'] == 'Windows' else False
def add(name, uid=None, gid=None, groups=None, home=False, shell=None ):
def add(name, uid=None, gid=None, groups=None, home=False, shell=None):
'''
Add a user to the minion