From 9b6c6697eac2f2045784781929e518faf4095dac Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Tue, 13 Nov 2018 13:24:48 -0600 Subject: [PATCH] Update docs references for states with func_alias --- salt/states/alternatives.py | 6 ++++++ salt/states/eselect.py | 10 +++++----- salt/states/etcd_mod.py | 12 +++++++----- salt/states/logrotate.py | 16 ++++++++-------- salt/states/zone.py | 8 ++++++-- 5 files changed, 32 insertions(+), 20 deletions(-) diff --git a/salt/states/alternatives.py b/salt/states/alternatives.py index 0cd01ce17a..5a6241dc0c 100644 --- a/salt/states/alternatives.py +++ b/salt/states/alternatives.py @@ -202,6 +202,12 @@ def set_(name, path): path is the location of one of the alternative target files. (e.g. /usr/bin/less) + + .. code-block:: yaml + + foo: + alternatives.set: + - path: /usr/bin/foo-2.0 ''' ret = {'name': name, 'path': path, diff --git a/salt/states/eselect.py b/salt/states/eselect.py index 13eeec5b8b..22993ade4b 100644 --- a/salt/states/eselect.py +++ b/salt/states/eselect.py @@ -5,11 +5,6 @@ Management of Gentoo configuration using eselect A state module to manage Gentoo configuration via eselect -.. code-block:: yaml - - profile: - eselect.set: - target: hardened/linux/amd64 ''' # Import Python libs @@ -44,6 +39,11 @@ def set_(name, target, module_parameter=None, action_parameter=None): action_parameter additional params passed to the defined action + .. code-block:: yaml + + profile: + eselect.set: + - target: hardened/linux/amd64 ''' ret = {'changes': {}, 'comment': '', diff --git a/salt/states/etcd_mod.py b/salt/states/etcd_mod.py index 3f826c9171..6ab7d71522 100644 --- a/salt/states/etcd_mod.py +++ b/salt/states/etcd_mod.py @@ -126,7 +126,6 @@ __virtualname__ = 'etcd' # Function aliases __func_alias__ = { 'set_': 'set', - 'rm_': 'rm' } # Import third party libs @@ -147,12 +146,13 @@ def __virtual__(): def set_(name, value, profile=None, **kwargs): ''' - Set a key in etcd and can be called as ``set``. + Set a key in etcd name The etcd key name, for example: ``/foo/bar/baz``. value The value the key should contain. + profile Optional, defaults to ``None``. Sets the etcd profile to use which has been defined in the Salt Master config. @@ -263,14 +263,16 @@ def directory(name, profile=None, **kwargs): return rtn -def rm_(name, recurse=False, profile=None, **kwargs): +def rm(name, recurse=False, profile=None, **kwargs): ''' - Deletes a key from etcd. This function is also aliased as ``rm``. + Deletes a key from etcd name The etcd key name to remove, for example ``/foo/bar/baz``. + recurse Optional, defaults to ``False``. If ``True`` performs a recursive delete. + profile Optional, defaults to ``None``. Sets the etcd profile to use which has been defined in the Salt Master config. @@ -353,7 +355,7 @@ def mod_watch(name, **kwargs): # Watch to rm etcd key if kwargs.get('sfun') in ['wait_rm_key', 'wait_rm']: - return rm_( + return rm( name, kwargs.get('profile')) diff --git a/salt/states/logrotate.py b/salt/states/logrotate.py index 08e714b5da..9ba01ccb6c 100644 --- a/salt/states/logrotate.py +++ b/salt/states/logrotate.py @@ -62,20 +62,20 @@ def set_(name, key, value, setting=None, conf_file=_DEFAULT_CONF): .. code-block:: yaml logrotate-rotate: - logrotate.set: - - key: rotate - - value: 2 + logrotate.set: + - key: rotate + - value: 2 Example of usage specifying all available arguments: .. code-block:: yaml logrotate-wtmp-rotate: - logrotate.set: - - key: /var/log/wtmp - - value: rotate - - setting: 2 - - conf_file: /etc/logrotate.conf + logrotate.set: + - key: /var/log/wtmp + - value: rotate + - setting: 2 + - conf_file: /etc/logrotate.conf ''' ret = {'name': name, 'changes': dict(), diff --git a/salt/states/zone.py b/salt/states/zone.py index 28d384a48e..5406c91895 100644 --- a/salt/states/zone.py +++ b/salt/states/zone.py @@ -127,7 +127,6 @@ log = logging.getLogger(__name__) __func_alias__ = { 'import_': 'import', - 'export_': 'export', } # Define the state's virtual name @@ -623,7 +622,7 @@ def halted(name, graceful=True): return ret -def export_(name, path, replace=False): +def export(name, path, replace=False): ''' Export a zones configuration @@ -760,6 +759,11 @@ def import_(name, path, mode='import', nodataset=False, brand_opts=None): ``install``: will import and then try to install the zone ``attach``: will import and then try to attach of the zone + .. code-block:: yaml + + omipkg1: + zone.import: + - path: /foo/bar/baz ''' ret = {'name': name, 'changes': {},