repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
saltstack/salt
salt/modules/systemd_service.py
_systemctl_status
def _systemctl_status(name): ''' Helper function which leverages __context__ to keep from running 'systemctl status' more than once. ''' contextkey = 'systemd._systemctl_status.%s' % name if contextkey in __context__: return __context__[contextkey] __context__[contextkey] = __salt__[...
python
def _systemctl_status(name): ''' Helper function which leverages __context__ to keep from running 'systemctl status' more than once. ''' contextkey = 'systemd._systemctl_status.%s' % name if contextkey in __context__: return __context__[contextkey] __context__[contextkey] = __salt__[...
[ "def", "_systemctl_status", "(", "name", ")", ":", "contextkey", "=", "'systemd._systemctl_status.%s'", "%", "name", "if", "contextkey", "in", "__context__", ":", "return", "__context__", "[", "contextkey", "]", "__context__", "[", "contextkey", "]", "=", "__salt_...
Helper function which leverages __context__ to keep from running 'systemctl status' more than once.
[ "Helper", "function", "which", "leverages", "__context__", "to", "keep", "from", "running", "systemctl", "status", "more", "than", "once", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L349-L363
train
saltstack/salt
salt/modules/systemd_service.py
_sysv_enabled
def _sysv_enabled(name, root): ''' A System-V style service is assumed disabled if the "startup" symlink (starts with "S") to its script is found in /etc/init.d in the current runlevel. ''' # Find exact match (disambiguate matches like "S01anacron" for cron) rc = _root('/etc/rc{}.d/S*{}'.for...
python
def _sysv_enabled(name, root): ''' A System-V style service is assumed disabled if the "startup" symlink (starts with "S") to its script is found in /etc/init.d in the current runlevel. ''' # Find exact match (disambiguate matches like "S01anacron" for cron) rc = _root('/etc/rc{}.d/S*{}'.for...
[ "def", "_sysv_enabled", "(", "name", ",", "root", ")", ":", "# Find exact match (disambiguate matches like \"S01anacron\" for cron)", "rc", "=", "_root", "(", "'/etc/rc{}.d/S*{}'", ".", "format", "(", "_runlevel", "(", ")", ",", "name", ")", ",", "root", ")", "for...
A System-V style service is assumed disabled if the "startup" symlink (starts with "S") to its script is found in /etc/init.d in the current runlevel.
[ "A", "System", "-", "V", "style", "service", "is", "assumed", "disabled", "if", "the", "startup", "symlink", "(", "starts", "with", "S", ")", "to", "its", "script", "is", "found", "in", "/", "etc", "/", "init", ".", "d", "in", "the", "current", "runl...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L366-L377
train
saltstack/salt
salt/modules/systemd_service.py
_untracked_custom_unit_found
def _untracked_custom_unit_found(name, root=None): ''' If the passed service name is not available, but a unit file exist in /etc/systemd/system, return True. Otherwise, return False. ''' system = _root('/etc/systemd/system', root) unit_path = os.path.join(system, _canonical_unit_name(name)) ...
python
def _untracked_custom_unit_found(name, root=None): ''' If the passed service name is not available, but a unit file exist in /etc/systemd/system, return True. Otherwise, return False. ''' system = _root('/etc/systemd/system', root) unit_path = os.path.join(system, _canonical_unit_name(name)) ...
[ "def", "_untracked_custom_unit_found", "(", "name", ",", "root", "=", "None", ")", ":", "system", "=", "_root", "(", "'/etc/systemd/system'", ",", "root", ")", "unit_path", "=", "os", ".", "path", ".", "join", "(", "system", ",", "_canonical_unit_name", "(",...
If the passed service name is not available, but a unit file exist in /etc/systemd/system, return True. Otherwise, return False.
[ "If", "the", "passed", "service", "name", "is", "not", "available", "but", "a", "unit", "file", "exist", "in", "/", "etc", "/", "systemd", "/", "system", "return", "True", ".", "Otherwise", "return", "False", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L380-L387
train
saltstack/salt
salt/modules/systemd_service.py
systemctl_reload
def systemctl_reload(): ''' .. versionadded:: 0.15.0 Reloads systemctl, an action needed whenever unit files are updated. CLI Example: .. code-block:: bash salt '*' service.systemctl_reload ''' out = __salt__['cmd.run_all']( _systemctl_cmd('--system daemon-reload'), ...
python
def systemctl_reload(): ''' .. versionadded:: 0.15.0 Reloads systemctl, an action needed whenever unit files are updated. CLI Example: .. code-block:: bash salt '*' service.systemctl_reload ''' out = __salt__['cmd.run_all']( _systemctl_cmd('--system daemon-reload'), ...
[ "def", "systemctl_reload", "(", ")", ":", "out", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "_systemctl_cmd", "(", "'--system daemon-reload'", ")", ",", "python_shell", "=", "False", ",", "redirect_stderr", "=", "True", ")", "if", "out", "[", "'retcode'"...
.. versionadded:: 0.15.0 Reloads systemctl, an action needed whenever unit files are updated. CLI Example: .. code-block:: bash salt '*' service.systemctl_reload
[ "..", "versionadded", "::", "0", ".", "15", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L399-L420
train
saltstack/salt
salt/modules/systemd_service.py
get_running
def get_running(): ''' Return a list of all running services, so far as systemd is concerned CLI Example: .. code-block:: bash salt '*' service.get_running ''' ret = set() # Get running systemd units out = __salt__['cmd.run']( _systemctl_cmd('--full --no-legend --no-pa...
python
def get_running(): ''' Return a list of all running services, so far as systemd is concerned CLI Example: .. code-block:: bash salt '*' service.get_running ''' ret = set() # Get running systemd units out = __salt__['cmd.run']( _systemctl_cmd('--full --no-legend --no-pa...
[ "def", "get_running", "(", ")", ":", "ret", "=", "set", "(", ")", "# Get running systemd units", "out", "=", "__salt__", "[", "'cmd.run'", "]", "(", "_systemctl_cmd", "(", "'--full --no-legend --no-pager'", ")", ",", "python_shell", "=", "False", ",", "ignore_re...
Return a list of all running services, so far as systemd is concerned CLI Example: .. code-block:: bash salt '*' service.get_running
[ "Return", "a", "list", "of", "all", "running", "services", "so", "far", "as", "systemd", "is", "concerned" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L423-L458
train
saltstack/salt
salt/modules/systemd_service.py
get_static
def get_static(root=None): ''' .. versionadded:: 2015.8.5 Return a list of all static services root Enable/disable/mask unit files in the specified root directory CLI Example: .. code-block:: bash salt '*' service.get_static ''' ret = set() # Get static systemd u...
python
def get_static(root=None): ''' .. versionadded:: 2015.8.5 Return a list of all static services root Enable/disable/mask unit files in the specified root directory CLI Example: .. code-block:: bash salt '*' service.get_static ''' ret = set() # Get static systemd u...
[ "def", "get_static", "(", "root", "=", "None", ")", ":", "ret", "=", "set", "(", ")", "# Get static systemd units. Can't use --state=static here because it's", "# not present until systemd 216.", "out", "=", "__salt__", "[", "'cmd.run'", "]", "(", "_systemctl_cmd", "(",...
.. versionadded:: 2015.8.5 Return a list of all static services root Enable/disable/mask unit files in the specified root directory CLI Example: .. code-block:: bash salt '*' service.get_static
[ "..", "versionadded", "::", "2015", ".", "8", ".", "5" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L547-L586
train
saltstack/salt
salt/modules/systemd_service.py
get_all
def get_all(root=None): ''' Return a list of all available services root Enable/disable/mask unit files in the specified root directory CLI Example: .. code-block:: bash salt '*' service.get_all ''' ret = _get_systemd_services(root) ret.update(set(_get_sysv_services(r...
python
def get_all(root=None): ''' Return a list of all available services root Enable/disable/mask unit files in the specified root directory CLI Example: .. code-block:: bash salt '*' service.get_all ''' ret = _get_systemd_services(root) ret.update(set(_get_sysv_services(r...
[ "def", "get_all", "(", "root", "=", "None", ")", ":", "ret", "=", "_get_systemd_services", "(", "root", ")", "ret", ".", "update", "(", "set", "(", "_get_sysv_services", "(", "root", ",", "systemd_services", "=", "ret", ")", ")", ")", "return", "sorted",...
Return a list of all available services root Enable/disable/mask unit files in the specified root directory CLI Example: .. code-block:: bash salt '*' service.get_all
[ "Return", "a", "list", "of", "all", "available", "services" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L589-L604
train
saltstack/salt
salt/modules/systemd_service.py
unmask_
def unmask_(name, runtime=False, root=None): ''' .. versionadded:: 2015.5.0 .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function from the ``salt-minion`` daemon's control group. This i...
python
def unmask_(name, runtime=False, root=None): ''' .. versionadded:: 2015.5.0 .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function from the ``salt-minion`` daemon's control group. This i...
[ "def", "unmask_", "(", "name", ",", "runtime", "=", "False", ",", "root", "=", "None", ")", ":", "_check_for_unit_changes", "(", "name", ")", "if", "not", "masked", "(", "name", ",", "runtime", ",", "root", "=", "root", ")", ":", "log", ".", "debug",...
.. versionadded:: 2015.5.0 .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function from the ``salt-minion`` daemon's control group. This is done to avoid a race condition in cases where t...
[ "..", "versionadded", "::", "2015", ".", "5", ".", "0", "..", "versionchanged", "::", "2015", ".", "8", ".", "12", "2016", ".", "3", ".", "3", "2016", ".", "11", ".", "0", "On", "minions", "running", "systemd", ">", "=", "205", "systemd", "-", "r...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L641-L693
train
saltstack/salt
salt/modules/systemd_service.py
mask
def mask(name, runtime=False, root=None): ''' .. versionadded:: 2015.5.0 .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function from the ``salt-minion`` daemon's control group. This is d...
python
def mask(name, runtime=False, root=None): ''' .. versionadded:: 2015.5.0 .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function from the ``salt-minion`` daemon's control group. This is d...
[ "def", "mask", "(", "name", ",", "runtime", "=", "False", ",", "root", "=", "None", ")", ":", "_check_for_unit_changes", "(", "name", ")", "cmd", "=", "'mask --runtime'", "if", "runtime", "else", "'mask'", "out", "=", "__salt__", "[", "'cmd.run_all'", "]",...
.. versionadded:: 2015.5.0 .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function from the ``salt-minion`` daemon's control group. This is done to avoid a race condition in cases where t...
[ "..", "versionadded", "::", "2015", ".", "5", ".", "0", "..", "versionchanged", "::", "2015", ".", "8", ".", "12", "2016", ".", "3", ".", "3", "2016", ".", "11", ".", "0", "On", "minions", "running", "systemd", ">", "=", "205", "systemd", "-", "r...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L696-L741
train
saltstack/salt
salt/modules/systemd_service.py
masked
def masked(name, runtime=False, root=None): ''' .. versionadded:: 2015.8.0 .. versionchanged:: 2015.8.5 The return data for this function has changed. If the service is masked, the return value will now be the output of the ``systemctl is-enabled`` command (so that a persistent mask ...
python
def masked(name, runtime=False, root=None): ''' .. versionadded:: 2015.8.0 .. versionchanged:: 2015.8.5 The return data for this function has changed. If the service is masked, the return value will now be the output of the ``systemctl is-enabled`` command (so that a persistent mask ...
[ "def", "masked", "(", "name", ",", "runtime", "=", "False", ",", "root", "=", "None", ")", ":", "_check_for_unit_changes", "(", "name", ")", "root_dir", "=", "_root", "(", "'/run'", "if", "runtime", "else", "'/etc'", ",", "root", ")", "link_path", "=", ...
.. versionadded:: 2015.8.0 .. versionchanged:: 2015.8.5 The return data for this function has changed. If the service is masked, the return value will now be the output of the ``systemctl is-enabled`` command (so that a persistent mask can be distinguished from a runtime mask). If th...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0", "..", "versionchanged", "::", "2015", ".", "8", ".", "5", "The", "return", "data", "for", "this", "function", "has", "changed", ".", "If", "the", "service", "is", "masked", "the", "return", "value...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L744-L805
train
saltstack/salt
salt/modules/systemd_service.py
stop
def stop(name, no_block=False): ''' .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function from the ``salt-minion`` daemon's control group. This is done to avoid a race condition in cases wh...
python
def stop(name, no_block=False): ''' .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function from the ``salt-minion`` daemon's control group. This is done to avoid a race condition in cases wh...
[ "def", "stop", "(", "name", ",", "no_block", "=", "False", ")", ":", "_check_for_unit_changes", "(", "name", ")", "# Using cmd.run_all instead of cmd.retcode here to make unit tests easier", "return", "__salt__", "[", "'cmd.run_all'", "]", "(", "_systemctl_cmd", "(", "'...
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function from the ``salt-minion`` daemon's control group. This is done to avoid a race condition in cases where the ``salt-minion`` service is r...
[ "..", "versionchanged", "::", "2015", ".", "8", ".", "12", "2016", ".", "3", ".", "3", "2016", ".", "11", ".", "0", "On", "minions", "running", "systemd", ">", "=", "205", "systemd", "-", "run", "(", "1", ")", "_", "is", "now", "used", "to", "i...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L864-L894
train
saltstack/salt
salt/modules/systemd_service.py
restart
def restart(name, no_block=False, unmask=False, unmask_runtime=False): ''' .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function from the ``salt-minion`` daemon's control group. This is don...
python
def restart(name, no_block=False, unmask=False, unmask_runtime=False): ''' .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function from the ``salt-minion`` daemon's control group. This is don...
[ "def", "restart", "(", "name", ",", "no_block", "=", "False", ",", "unmask", "=", "False", ",", "unmask_runtime", "=", "False", ")", ":", "_check_for_unit_changes", "(", "name", ")", "_check_unmask", "(", "name", ",", "unmask", ",", "unmask_runtime", ")", ...
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function from the ``salt-minion`` daemon's control group. This is done to avoid a race condition in cases where the ``salt-minion`` service is r...
[ "..", "versionchanged", "::", "2015", ".", "8", ".", "12", "2016", ".", "3", ".", "3", "2016", ".", "11", ".", "0", "On", "minions", "running", "systemd", ">", "=", "205", "systemd", "-", "run", "(", "1", ")", "_", "is", "now", "used", "to", "i...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L897-L950
train
saltstack/salt
salt/modules/systemd_service.py
status
def status(name, sig=None): # pylint: disable=unused-argument ''' Return the status for a service via systemd. If the name contains globbing, a dict mapping service name to True/False values is returned. .. versionchanged:: 2018.3.0 The service name can now be a glob (e.g. ``salt*``) ...
python
def status(name, sig=None): # pylint: disable=unused-argument ''' Return the status for a service via systemd. If the name contains globbing, a dict mapping service name to True/False values is returned. .. versionchanged:: 2018.3.0 The service name can now be a glob (e.g. ``salt*``) ...
[ "def", "status", "(", "name", ",", "sig", "=", "None", ")", ":", "# pylint: disable=unused-argument", "contains_globbing", "=", "bool", "(", "re", ".", "search", "(", "r'\\*|\\?|\\[.+\\]'", ",", "name", ")", ")", "if", "contains_globbing", ":", "services", "="...
Return the status for a service via systemd. If the name contains globbing, a dict mapping service name to True/False values is returned. .. versionchanged:: 2018.3.0 The service name can now be a glob (e.g. ``salt*``) Args: name (str): The name of the service to check sig (str...
[ "Return", "the", "status", "for", "a", "service", "via", "systemd", ".", "If", "the", "name", "contains", "globbing", "a", "dict", "mapping", "service", "name", "to", "True", "/", "False", "values", "is", "returned", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L1070-L1107
train
saltstack/salt
salt/modules/systemd_service.py
enable
def enable(name, no_block=False, unmask=False, unmask_runtime=False, root=None, **kwargs): # pylint: disable=unused-argument ''' .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function fr...
python
def enable(name, no_block=False, unmask=False, unmask_runtime=False, root=None, **kwargs): # pylint: disable=unused-argument ''' .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function fr...
[ "def", "enable", "(", "name", ",", "no_block", "=", "False", ",", "unmask", "=", "False", ",", "unmask_runtime", "=", "False", ",", "root", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "_check_for_unit_changes", "(", "...
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function from the ``salt-minion`` daemon's control group. This is done to avoid a race condition in cases where the ``salt-minion`` service is r...
[ "..", "versionchanged", "::", "2015", ".", "8", ".", "12", "2016", ".", "3", ".", "3", "2016", ".", "11", ".", "0", "On", "minions", "running", "systemd", ">", "=", "205", "systemd", "-", "run", "(", "1", ")", "_", "is", "now", "used", "to", "i...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L1112-L1184
train
saltstack/salt
salt/modules/systemd_service.py
disable
def disable(name, no_block=False, root=None, **kwargs): # pylint: disable=unused-argument ''' .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function from the ``salt-minion`` daemon's contro...
python
def disable(name, no_block=False, root=None, **kwargs): # pylint: disable=unused-argument ''' .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function from the ``salt-minion`` daemon's contro...
[ "def", "disable", "(", "name", ",", "no_block", "=", "False", ",", "root", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "_check_for_unit_changes", "(", "name", ")", "if", "name", "in", "_get_sysv_services", "(", "root", ...
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function from the ``salt-minion`` daemon's control group. This is done to avoid a race condition in cases where the ``salt-minion`` service is r...
[ "..", "versionchanged", "::", "2015", ".", "8", ".", "12", "2016", ".", "3", ".", "3", "2016", ".", "11", ".", "0", "On", "minions", "running", "systemd", ">", "=", "205", "systemd", "-", "run", "(", "1", ")", "_", "is", "now", "used", "to", "i...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L1189-L1237
train
saltstack/salt
salt/modules/systemd_service.py
enabled
def enabled(name, root=None, **kwargs): # pylint: disable=unused-argument ''' Return if the named service is enabled to start on boot root Enable/disable/mask unit files in the specified root directory CLI Example: .. code-block:: bash salt '*' service.enabled <service name> ...
python
def enabled(name, root=None, **kwargs): # pylint: disable=unused-argument ''' Return if the named service is enabled to start on boot root Enable/disable/mask unit files in the specified root directory CLI Example: .. code-block:: bash salt '*' service.enabled <service name> ...
[ "def", "enabled", "(", "name", ",", "root", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "# Try 'systemctl is-enabled' first, then look for a symlink created by", "# systemctl (older systemd releases did not support using is-enabled to", "# c...
Return if the named service is enabled to start on boot root Enable/disable/mask unit files in the specified root directory CLI Example: .. code-block:: bash salt '*' service.enabled <service name>
[ "Return", "if", "the", "named", "service", "is", "enabled", "to", "start", "on", "boot" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L1242-L1276
train
saltstack/salt
salt/modules/systemd_service.py
show
def show(name, root=None): ''' .. versionadded:: 2014.7.0 Show properties of one or more units/jobs or the manager root Enable/disable/mask unit files in the specified root directory CLI Example: salt '*' service.show <service name> ''' ret = {} out = __salt__['cmd.ru...
python
def show(name, root=None): ''' .. versionadded:: 2014.7.0 Show properties of one or more units/jobs or the manager root Enable/disable/mask unit files in the specified root directory CLI Example: salt '*' service.show <service name> ''' ret = {} out = __salt__['cmd.ru...
[ "def", "show", "(", "name", ",", "root", "=", "None", ")", ":", "ret", "=", "{", "}", "out", "=", "__salt__", "[", "'cmd.run'", "]", "(", "_systemctl_cmd", "(", "'show'", ",", "name", ",", "root", "=", "root", ")", ",", "python_shell", "=", "False"...
.. versionadded:: 2014.7.0 Show properties of one or more units/jobs or the manager root Enable/disable/mask unit files in the specified root directory CLI Example: salt '*' service.show <service name>
[ "..", "versionadded", "::", "2014", ".", "7", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L1295-L1326
train
saltstack/salt
salt/modules/systemd_service.py
execs
def execs(root=None): ''' .. versionadded:: 2014.7.0 Return a list of all files specified as ``ExecStart`` for all services. root Enable/disable/mask unit files in the specified root directory CLI Example: salt '*' service.execs ''' ret = {} for service in get_all(roo...
python
def execs(root=None): ''' .. versionadded:: 2014.7.0 Return a list of all files specified as ``ExecStart`` for all services. root Enable/disable/mask unit files in the specified root directory CLI Example: salt '*' service.execs ''' ret = {} for service in get_all(roo...
[ "def", "execs", "(", "root", "=", "None", ")", ":", "ret", "=", "{", "}", "for", "service", "in", "get_all", "(", "root", "=", "root", ")", ":", "data", "=", "show", "(", "service", ",", "root", "=", "root", ")", "if", "'ExecStart'", "not", "in",...
.. versionadded:: 2014.7.0 Return a list of all files specified as ``ExecStart`` for all services. root Enable/disable/mask unit files in the specified root directory CLI Example: salt '*' service.execs
[ "..", "versionadded", "::", "2014", ".", "7", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L1329-L1348
train
saltstack/salt
salt/states/virt.py
keys
def keys(name, basepath='/etc/pki', **kwargs): ''' Manage libvirt keys. name The name variable used to track the execution basepath Defaults to ``/etc/pki``, this is the root location used for libvirt keys on the hypervisor The following parameters are optional: c...
python
def keys(name, basepath='/etc/pki', **kwargs): ''' Manage libvirt keys. name The name variable used to track the execution basepath Defaults to ``/etc/pki``, this is the root location used for libvirt keys on the hypervisor The following parameters are optional: c...
[ "def", "keys", "(", "name", ",", "basepath", "=", "'/etc/pki'", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "# Grab all ...
Manage libvirt keys. name The name variable used to track the execution basepath Defaults to ``/etc/pki``, this is the root location used for libvirt keys on the hypervisor The following parameters are optional: country The country that the certificate should ...
[ "Manage", "libvirt", "keys", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L51-L145
train
saltstack/salt
salt/states/virt.py
_virt_call
def _virt_call(domain, function, section, comment, connection=None, username=None, password=None, **kwargs): ''' Helper to call the virt functions. Wildcards supported. :param domain: :param function: :param section: :param comment: :return: ''' ret = {'name': domain,...
python
def _virt_call(domain, function, section, comment, connection=None, username=None, password=None, **kwargs): ''' Helper to call the virt functions. Wildcards supported. :param domain: :param function: :param section: :param comment: :return: ''' ret = {'name': domain,...
[ "def", "_virt_call", "(", "domain", ",", "function", ",", "section", ",", "comment", ",", "connection", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "domai...
Helper to call the virt functions. Wildcards supported. :param domain: :param function: :param section: :param comment: :return:
[ "Helper", "to", "call", "the", "virt", "functions", ".", "Wildcards", "supported", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L148-L184
train
saltstack/salt
salt/states/virt.py
stopped
def stopped(name, connection=None, username=None, password=None): ''' Stops a VM by shutting it down nicely. .. versionadded:: 2016.3.0 :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults ...
python
def stopped(name, connection=None, username=None, password=None): ''' Stops a VM by shutting it down nicely. .. versionadded:: 2016.3.0 :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults ...
[ "def", "stopped", "(", "name", ",", "connection", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ")", ":", "return", "_virt_call", "(", "name", ",", "'shutdown'", ",", "'stopped'", ",", "\"Machine has been shut down\"", ",", "connec...
Stops a VM by shutting it down nicely. .. versionadded:: 2016.3.0 :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param password: password to connect w...
[ "Stops", "a", "VM", "by", "shutting", "it", "down", "nicely", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L187-L210
train
saltstack/salt
salt/states/virt.py
powered_off
def powered_off(name, connection=None, username=None, password=None): ''' Stops a VM by power off. .. versionadded:: 2016.3.0 :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults ....
python
def powered_off(name, connection=None, username=None, password=None): ''' Stops a VM by power off. .. versionadded:: 2016.3.0 :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults ....
[ "def", "powered_off", "(", "name", ",", "connection", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ")", ":", "return", "_virt_call", "(", "name", ",", "'stop'", ",", "'unpowered'", ",", "'Machine has been powered off'", ",", "conn...
Stops a VM by power off. .. versionadded:: 2016.3.0 :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param password: password to connect with, overridin...
[ "Stops", "a", "VM", "by", "power", "off", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L213-L236
train
saltstack/salt
salt/states/virt.py
running
def running(name, cpu=None, mem=None, image=None, vm_type=None, disk_profile=None, disks=None, nic_profile=None, interfaces=None, graphics=None, loader=None, seed=True, install...
python
def running(name, cpu=None, mem=None, image=None, vm_type=None, disk_profile=None, disks=None, nic_profile=None, interfaces=None, graphics=None, loader=None, seed=True, install...
[ "def", "running", "(", "name", ",", "cpu", "=", "None", ",", "mem", "=", "None", ",", "image", "=", "None", ",", "vm_type", "=", "None", ",", "disk_profile", "=", "None", ",", "disks", "=", "None", ",", "nic_profile", "=", "None", ",", "interfaces", ...
Starts an existing guest, or defines and starts a new VM with specified arguments. .. versionadded:: 2016.3.0 :param name: name of the virtual machine to run :param cpu: number of CPUs for the virtual machine to create :param mem: amount of memory in MiB for the new virtual machine :param image: d...
[ "Starts", "an", "existing", "guest", "or", "defines", "and", "starts", "a", "new", "VM", "with", "specified", "arguments", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L239-L481
train
saltstack/salt
salt/states/virt.py
snapshot
def snapshot(name, suffix=None, connection=None, username=None, password=None): ''' Takes a snapshot of a particular VM or by a UNIX-style wildcard. .. versionadded:: 2016.3.0 :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: userna...
python
def snapshot(name, suffix=None, connection=None, username=None, password=None): ''' Takes a snapshot of a particular VM or by a UNIX-style wildcard. .. versionadded:: 2016.3.0 :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: userna...
[ "def", "snapshot", "(", "name", ",", "suffix", "=", "None", ",", "connection", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ")", ":", "return", "_virt_call", "(", "name", ",", "'snapshot'", ",", "'saved'", ",", "'Snapshot has ...
Takes a snapshot of a particular VM or by a UNIX-style wildcard. .. versionadded:: 2016.3.0 :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param passw...
[ "Takes", "a", "snapshot", "of", "a", "particular", "VM", "or", "by", "a", "UNIX", "-", "style", "wildcard", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L484-L512
train
saltstack/salt
salt/states/virt.py
rebooted
def rebooted(name, connection=None, username=None, password=None): ''' Reboots VMs .. versionadded:: 2016.3.0 :param name: :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults ...
python
def rebooted(name, connection=None, username=None, password=None): ''' Reboots VMs .. versionadded:: 2016.3.0 :param name: :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults ...
[ "def", "rebooted", "(", "name", ",", "connection", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ")", ":", "return", "_virt_call", "(", "name", ",", "'reboot'", ",", "'rebooted'", ",", "\"Machine has been rebooted\"", ",", "connect...
Reboots VMs .. versionadded:: 2016.3.0 :param name: :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param password: password to connect with, over...
[ "Reboots", "VMs" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L516-L536
train
saltstack/salt
salt/states/virt.py
reverted
def reverted(name, snapshot=None, cleanup=False): # pylint: disable=redefined-outer-name ''' .. deprecated:: 2016.3.0 Reverts to the particular snapshot. .. versionadded:: 2016.3.0 .. code-block:: yaml domain_name: virt.reverted: - cleanup: True domain_nam...
python
def reverted(name, snapshot=None, cleanup=False): # pylint: disable=redefined-outer-name ''' .. deprecated:: 2016.3.0 Reverts to the particular snapshot. .. versionadded:: 2016.3.0 .. code-block:: yaml domain_name: virt.reverted: - cleanup: True domain_nam...
[ "def", "reverted", "(", "name", ",", "snapshot", "=", "None", ",", "cleanup", "=", "False", ")", ":", "# pylint: disable=redefined-outer-name", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "False", ",", "...
.. deprecated:: 2016.3.0 Reverts to the particular snapshot. .. versionadded:: 2016.3.0 .. code-block:: yaml domain_name: virt.reverted: - cleanup: True domain_name_1: virt.reverted: - snapshot: snapshot_name - cleanup: False
[ "..", "deprecated", "::", "2016", ".", "3", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L580-L636
train
saltstack/salt
salt/states/virt.py
network_running
def network_running(name, bridge, forward, vport=None, tag=None, autostart=True, connection=None, username=None, password=None): ''' Defines and starts ...
python
def network_running(name, bridge, forward, vport=None, tag=None, autostart=True, connection=None, username=None, password=None): ''' Defines and starts ...
[ "def", "network_running", "(", "name", ",", "bridge", ",", "forward", ",", "vport", "=", "None", ",", "tag", "=", "None", ",", "autostart", "=", "True", ",", "connection", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ")", ...
Defines and starts a new network with specified arguments. :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param password: password to connect with, overrid...
[ "Defines", "and", "starts", "a", "new", "network", "with", "specified", "arguments", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L639-L709
train
saltstack/salt
salt/states/virt.py
pool_running
def pool_running(name, ptype=None, target=None, permissions=None, source=None, transient=False, autostart=True, connection=None, username=None, password=None): '''...
python
def pool_running(name, ptype=None, target=None, permissions=None, source=None, transient=False, autostart=True, connection=None, username=None, password=None): '''...
[ "def", "pool_running", "(", "name", ",", "ptype", "=", "None", ",", "target", "=", "None", ",", "permissions", "=", "None", ",", "source", "=", "None", ",", "transient", "=", "False", ",", "autostart", "=", "True", ",", "connection", "=", "None", ",", ...
Defines and starts a new pool with specified arguments. .. versionadded:: 2019.2.0 :param ptype: libvirt pool type :param target: full path to the target device or folder. (Default: ``None``) :param permissions: target permissions. See the **Permissions definition** section of the :py:func:`vi...
[ "Defines", "and", "starts", "a", "new", "pool", "with", "specified", "arguments", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L712-L826
train
saltstack/salt
salt/modules/runit.py
status
def status(name, sig=None): ''' Return ``True`` if service is running name the service's name sig signature to identify with ps CLI Example: .. code-block:: bash salt '*' runit.status <service name> ''' if sig: # usual way to do by others (debian_serv...
python
def status(name, sig=None): ''' Return ``True`` if service is running name the service's name sig signature to identify with ps CLI Example: .. code-block:: bash salt '*' runit.status <service name> ''' if sig: # usual way to do by others (debian_serv...
[ "def", "status", "(", "name", ",", "sig", "=", "None", ")", ":", "if", "sig", ":", "# usual way to do by others (debian_service, netbsdservice).", "# XXX probably does not work here (check 'runsv sshd' instead of 'sshd' ?)", "return", "bool", "(", "__salt__", "[", "'status.pi...
Return ``True`` if service is running name the service's name sig signature to identify with ps CLI Example: .. code-block:: bash salt '*' runit.status <service name>
[ "Return", "True", "if", "service", "is", "running" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L206-L240
train
saltstack/salt
salt/modules/runit.py
_is_svc
def _is_svc(svc_path): ''' Return ``True`` if directory <svc_path> is really a service: file <svc_path>/run exists and is executable svc_path the (absolute) directory to check for compatibility ''' run_file = os.path.join(svc_path, 'run') if (os.path.exists(svc_path) and os...
python
def _is_svc(svc_path): ''' Return ``True`` if directory <svc_path> is really a service: file <svc_path>/run exists and is executable svc_path the (absolute) directory to check for compatibility ''' run_file = os.path.join(svc_path, 'run') if (os.path.exists(svc_path) and os...
[ "def", "_is_svc", "(", "svc_path", ")", ":", "run_file", "=", "os", ".", "path", ".", "join", "(", "svc_path", ",", "'run'", ")", "if", "(", "os", ".", "path", ".", "exists", "(", "svc_path", ")", "and", "os", ".", "path", ".", "exists", "(", "ru...
Return ``True`` if directory <svc_path> is really a service: file <svc_path>/run exists and is executable svc_path the (absolute) directory to check for compatibility
[ "Return", "True", "if", "directory", "<svc_path", ">", "is", "really", "a", "service", ":", "file", "<svc_path", ">", "/", "run", "exists", "and", "is", "executable" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L243-L256
train
saltstack/salt
salt/modules/runit.py
status_autostart
def status_autostart(name): ''' Return ``True`` if service <name> is autostarted by sv (file $service_folder/down does not exist) NB: return ``False`` if the service is not enabled. name the service's name CLI Example: .. code-block:: bash salt '*' runit.status_autostart ...
python
def status_autostart(name): ''' Return ``True`` if service <name> is autostarted by sv (file $service_folder/down does not exist) NB: return ``False`` if the service is not enabled. name the service's name CLI Example: .. code-block:: bash salt '*' runit.status_autostart ...
[ "def", "status_autostart", "(", "name", ")", ":", "return", "not", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join", "(", "_service_path", "(", "name", ")", ",", "'down'", ")", ")" ]
Return ``True`` if service <name> is autostarted by sv (file $service_folder/down does not exist) NB: return ``False`` if the service is not enabled. name the service's name CLI Example: .. code-block:: bash salt '*' runit.status_autostart <service name>
[ "Return", "True", "if", "service", "<name", ">", "is", "autostarted", "by", "sv", "(", "file", "$service_folder", "/", "down", "does", "not", "exist", ")", "NB", ":", "return", "False", "if", "the", "service", "is", "not", "enabled", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L259-L274
train
saltstack/salt
salt/modules/runit.py
get_svc_broken_path
def get_svc_broken_path(name='*'): ''' Return list of broken path(s) in SERVICE_DIR that match ``name`` A path is broken if it is a broken symlink or can not be a runit service name a glob for service name. default is '*' CLI Example: .. code-block:: bash salt '*' runit.get_...
python
def get_svc_broken_path(name='*'): ''' Return list of broken path(s) in SERVICE_DIR that match ``name`` A path is broken if it is a broken symlink or can not be a runit service name a glob for service name. default is '*' CLI Example: .. code-block:: bash salt '*' runit.get_...
[ "def", "get_svc_broken_path", "(", "name", "=", "'*'", ")", ":", "if", "not", "SERVICE_DIR", ":", "raise", "CommandExecutionError", "(", "'Could not find service directory.'", ")", "ret", "=", "set", "(", ")", "for", "el", "in", "glob", ".", "glob", "(", "os...
Return list of broken path(s) in SERVICE_DIR that match ``name`` A path is broken if it is a broken symlink or can not be a runit service name a glob for service name. default is '*' CLI Example: .. code-block:: bash salt '*' runit.get_svc_broken_path <service name>
[ "Return", "list", "of", "broken", "path", "(", "s", ")", "in", "SERVICE_DIR", "that", "match", "name" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L277-L300
train
saltstack/salt
salt/modules/runit.py
add_svc_avail_path
def add_svc_avail_path(path): ''' Add a path that may contain available services. Return ``True`` if added (or already present), ``False`` on error. path directory to add to AVAIL_SVR_DIRS ''' if os.path.exists(path): if path not in AVAIL_SVR_DIRS: AVAIL_SVR_DIRS.app...
python
def add_svc_avail_path(path): ''' Add a path that may contain available services. Return ``True`` if added (or already present), ``False`` on error. path directory to add to AVAIL_SVR_DIRS ''' if os.path.exists(path): if path not in AVAIL_SVR_DIRS: AVAIL_SVR_DIRS.app...
[ "def", "add_svc_avail_path", "(", "path", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "if", "path", "not", "in", "AVAIL_SVR_DIRS", ":", "AVAIL_SVR_DIRS", ".", "append", "(", "path", ")", "return", "True", "return", "False" ]
Add a path that may contain available services. Return ``True`` if added (or already present), ``False`` on error. path directory to add to AVAIL_SVR_DIRS
[ "Add", "a", "path", "that", "may", "contain", "available", "services", ".", "Return", "True", "if", "added", "(", "or", "already", "present", ")", "False", "on", "error", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L310-L322
train
saltstack/salt
salt/modules/runit.py
_get_svc_path
def _get_svc_path(name='*', status=None): ''' Return a list of paths to services with ``name`` that have the specified ``status`` name a glob for service name. default is '*' status None : all services (no filter, default choice) 'DISABLED' : available service(s) that is ...
python
def _get_svc_path(name='*', status=None): ''' Return a list of paths to services with ``name`` that have the specified ``status`` name a glob for service name. default is '*' status None : all services (no filter, default choice) 'DISABLED' : available service(s) that is ...
[ "def", "_get_svc_path", "(", "name", "=", "'*'", ",", "status", "=", "None", ")", ":", "# This is the core routine to work with services, called by many", "# other functions of this module.", "#", "# The name of a service is the \"apparent\" folder's name that contains its", "# \"run...
Return a list of paths to services with ``name`` that have the specified ``status`` name a glob for service name. default is '*' status None : all services (no filter, default choice) 'DISABLED' : available service(s) that is not enabled 'ENABLED' : enabled service (whet...
[ "Return", "a", "list", "of", "paths", "to", "services", "with", "name", "that", "have", "the", "specified", "status" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L325-L374
train
saltstack/salt
salt/modules/runit.py
_get_svc_list
def _get_svc_list(name='*', status=None): ''' Return list of services that have the specified service ``status`` name a glob for service name. default is '*' status None : all services (no filter, default choice) 'DISABLED' : available service that is not enabled ...
python
def _get_svc_list(name='*', status=None): ''' Return list of services that have the specified service ``status`` name a glob for service name. default is '*' status None : all services (no filter, default choice) 'DISABLED' : available service that is not enabled ...
[ "def", "_get_svc_list", "(", "name", "=", "'*'", ",", "status", "=", "None", ")", ":", "return", "sorted", "(", "[", "os", ".", "path", ".", "basename", "(", "el", ")", "for", "el", "in", "_get_svc_path", "(", "name", ",", "status", ")", "]", ")" ]
Return list of services that have the specified service ``status`` name a glob for service name. default is '*' status None : all services (no filter, default choice) 'DISABLED' : available service that is not enabled 'ENABLED' : enabled service (whether started on boot ...
[ "Return", "list", "of", "services", "that", "have", "the", "specified", "service", "status" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L377-L389
train
saltstack/salt
salt/modules/runit.py
get_svc_alias
def get_svc_alias(): ''' Returns the list of service's name that are aliased and their alias path(s) ''' ret = {} for d in AVAIL_SVR_DIRS: for el in glob.glob(os.path.join(d, '*')): if not os.path.islink(el): continue psvc = os.readlink(el) ...
python
def get_svc_alias(): ''' Returns the list of service's name that are aliased and their alias path(s) ''' ret = {} for d in AVAIL_SVR_DIRS: for el in glob.glob(os.path.join(d, '*')): if not os.path.islink(el): continue psvc = os.readlink(el) ...
[ "def", "get_svc_alias", "(", ")", ":", "ret", "=", "{", "}", "for", "d", "in", "AVAIL_SVR_DIRS", ":", "for", "el", "in", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "d", ",", "'*'", ")", ")", ":", "if", "not", "os", ".", "p...
Returns the list of service's name that are aliased and their alias path(s)
[ "Returns", "the", "list", "of", "service", "s", "name", "that", "are", "aliased", "and", "their", "alias", "path", "(", "s", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L392-L409
train
saltstack/salt
salt/modules/runit.py
show
def show(name): ''' Show properties of one or more units/jobs or the manager name the service's name CLI Example: salt '*' service.show <service name> ''' ret = {} ret['enabled'] = False ret['disabled'] = True ret['running'] = False ret['service_path'] = None ...
python
def show(name): ''' Show properties of one or more units/jobs or the manager name the service's name CLI Example: salt '*' service.show <service name> ''' ret = {} ret['enabled'] = False ret['disabled'] = True ret['running'] = False ret['service_path'] = None ...
[ "def", "show", "(", "name", ")", ":", "ret", "=", "{", "}", "ret", "[", "'enabled'", "]", "=", "False", "ret", "[", "'disabled'", "]", "=", "True", "ret", "[", "'running'", "]", "=", "False", "ret", "[", "'service_path'", "]", "=", "None", "ret", ...
Show properties of one or more units/jobs or the manager name the service's name CLI Example: salt '*' service.show <service name>
[ "Show", "properties", "of", "one", "or", "more", "units", "/", "jobs", "or", "the", "manager" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L520-L553
train
saltstack/salt
salt/modules/runit.py
enable
def enable(name, start=False, **kwargs): ''' Start service ``name`` at boot. Returns ``True`` if operation is successful name the service's name start : False If ``True``, start the service once enabled. CLI Example: .. code-block:: bash salt '*' service.enable <...
python
def enable(name, start=False, **kwargs): ''' Start service ``name`` at boot. Returns ``True`` if operation is successful name the service's name start : False If ``True``, start the service once enabled. CLI Example: .. code-block:: bash salt '*' service.enable <...
[ "def", "enable", "(", "name", ",", "start", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# non-existent service", "if", "not", "available", "(", "name", ")", ":", "return", "False", "# if service is aliased, refuse to enable it", "alias", "=", "get_svc_alia...
Start service ``name`` at boot. Returns ``True`` if operation is successful name the service's name start : False If ``True``, start the service once enabled. CLI Example: .. code-block:: bash salt '*' service.enable <name> [start=True]
[ "Start", "service", "name", "at", "boot", ".", "Returns", "True", "if", "operation", "is", "successful" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L556-L648
train
saltstack/salt
salt/modules/runit.py
disable
def disable(name, stop=False, **kwargs): ''' Don't start service ``name`` at boot Returns ``True`` if operation is successful name the service's name stop if True, also stops the service CLI Example: .. code-block:: bash salt '*' service.disable <name> [stop=True...
python
def disable(name, stop=False, **kwargs): ''' Don't start service ``name`` at boot Returns ``True`` if operation is successful name the service's name stop if True, also stops the service CLI Example: .. code-block:: bash salt '*' service.disable <name> [stop=True...
[ "def", "disable", "(", "name", ",", "stop", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# non-existent as registrered service", "if", "not", "enabled", "(", "name", ")", ":", "return", "False", "# down_file: file that prevent sv autostart", "svc_realpath", "...
Don't start service ``name`` at boot Returns ``True`` if operation is successful name the service's name stop if True, also stops the service CLI Example: .. code-block:: bash salt '*' service.disable <name> [stop=True]
[ "Don", "t", "start", "service", "name", "at", "boot", "Returns", "True", "if", "operation", "is", "successful" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L651-L687
train
saltstack/salt
salt/modules/runit.py
remove
def remove(name): ''' Remove the service <name> from system. Returns ``True`` if operation is successful. The service will be also stopped. name the service's name CLI Example: .. code-block:: bash salt '*' service.remove <name> ''' if not enabled(name): ...
python
def remove(name): ''' Remove the service <name> from system. Returns ``True`` if operation is successful. The service will be also stopped. name the service's name CLI Example: .. code-block:: bash salt '*' service.remove <name> ''' if not enabled(name): ...
[ "def", "remove", "(", "name", ")", ":", "if", "not", "enabled", "(", "name", ")", ":", "return", "False", "svc_path", "=", "_service_path", "(", "name", ")", "if", "not", "os", ".", "path", ".", "islink", "(", "svc_path", ")", ":", "log", ".", "err...
Remove the service <name> from system. Returns ``True`` if operation is successful. The service will be also stopped. name the service's name CLI Example: .. code-block:: bash salt '*' service.remove <name>
[ "Remove", "the", "service", "<name", ">", "from", "system", ".", "Returns", "True", "if", "operation", "is", "successful", ".", "The", "service", "will", "be", "also", "stopped", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L690-L722
train
saltstack/salt
salt/pillar/s3.py
ext_pillar
def ext_pillar(minion_id, pillar, # pylint: disable=W0613 bucket, key=None, keyid=None, verify_ssl=True, location=None, multiple_env=False, environment='base', prefix='', ...
python
def ext_pillar(minion_id, pillar, # pylint: disable=W0613 bucket, key=None, keyid=None, verify_ssl=True, location=None, multiple_env=False, environment='base', prefix='', ...
[ "def", "ext_pillar", "(", "minion_id", ",", "pillar", ",", "# pylint: disable=W0613", "bucket", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "verify_ssl", "=", "True", ",", "location", "=", "None", ",", "multiple_env", "=", "False", ",", "envir...
Execute a command and read the output as YAML
[ "Execute", "a", "command", "and", "read", "the", "output", "as", "YAML" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/s3.py#L129-L189
train
saltstack/salt
salt/pillar/s3.py
_init
def _init(creds, bucket, multiple_env, environment, prefix, s3_cache_expire): ''' Connect to S3 and download the metadata for each file in all buckets specified and cache the data to disk. ''' cache_file = _get_buckets_cache_filename(bucket, prefix) exp = time.time() - s3_cache_expire # ch...
python
def _init(creds, bucket, multiple_env, environment, prefix, s3_cache_expire): ''' Connect to S3 and download the metadata for each file in all buckets specified and cache the data to disk. ''' cache_file = _get_buckets_cache_filename(bucket, prefix) exp = time.time() - s3_cache_expire # ch...
[ "def", "_init", "(", "creds", ",", "bucket", ",", "multiple_env", ",", "environment", ",", "prefix", ",", "s3_cache_expire", ")", ":", "cache_file", "=", "_get_buckets_cache_filename", "(", "bucket", ",", "prefix", ")", "exp", "=", "time", ".", "time", "(", ...
Connect to S3 and download the metadata for each file in all buckets specified and cache the data to disk.
[ "Connect", "to", "S3", "and", "download", "the", "metadata", "for", "each", "file", "in", "all", "buckets", "specified", "and", "cache", "the", "data", "to", "disk", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/s3.py#L192-L225
train
saltstack/salt
salt/pillar/s3.py
_get_cache_dir
def _get_cache_dir(): ''' Get pillar cache directory. Initialize it if it does not exist. ''' cache_dir = os.path.join(__opts__['cachedir'], 'pillar_s3fs') if not os.path.isdir(cache_dir): log.debug('Initializing S3 Pillar Cache') os.makedirs(cache_dir) return cache_dir
python
def _get_cache_dir(): ''' Get pillar cache directory. Initialize it if it does not exist. ''' cache_dir = os.path.join(__opts__['cachedir'], 'pillar_s3fs') if not os.path.isdir(cache_dir): log.debug('Initializing S3 Pillar Cache') os.makedirs(cache_dir) return cache_dir
[ "def", "_get_cache_dir", "(", ")", ":", "cache_dir", "=", "os", ".", "path", ".", "join", "(", "__opts__", "[", "'cachedir'", "]", ",", "'pillar_s3fs'", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "cache_dir", ")", ":", "log", ".", "debug...
Get pillar cache directory. Initialize it if it does not exist.
[ "Get", "pillar", "cache", "directory", ".", "Initialize", "it", "if", "it", "does", "not", "exist", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/s3.py#L228-L239
train
saltstack/salt
salt/pillar/s3.py
_get_buckets_cache_filename
def _get_buckets_cache_filename(bucket, prefix): ''' Return the filename of the cache for bucket contents. Create the path if it does not exist. ''' cache_dir = _get_cache_dir() if not os.path.exists(cache_dir): os.makedirs(cache_dir) return os.path.join(cache_dir, '{0}-{1}-files.c...
python
def _get_buckets_cache_filename(bucket, prefix): ''' Return the filename of the cache for bucket contents. Create the path if it does not exist. ''' cache_dir = _get_cache_dir() if not os.path.exists(cache_dir): os.makedirs(cache_dir) return os.path.join(cache_dir, '{0}-{1}-files.c...
[ "def", "_get_buckets_cache_filename", "(", "bucket", ",", "prefix", ")", ":", "cache_dir", "=", "_get_cache_dir", "(", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "cache_dir", ")", ":", "os", ".", "makedirs", "(", "cache_dir", ")", "return", ...
Return the filename of the cache for bucket contents. Create the path if it does not exist.
[ "Return", "the", "filename", "of", "the", "cache", "for", "bucket", "contents", ".", "Create", "the", "path", "if", "it", "does", "not", "exist", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/s3.py#L256-L266
train
saltstack/salt
salt/pillar/s3.py
_refresh_buckets_cache_file
def _refresh_buckets_cache_file(creds, cache_file, multiple_env, environment, prefix): ''' Retrieve the content of all buckets and cache the metadata to the buckets cache file ''' # helper s3 query function def __get_s3_meta(): return __utils__['s3.query']( key=creds.key, ...
python
def _refresh_buckets_cache_file(creds, cache_file, multiple_env, environment, prefix): ''' Retrieve the content of all buckets and cache the metadata to the buckets cache file ''' # helper s3 query function def __get_s3_meta(): return __utils__['s3.query']( key=creds.key, ...
[ "def", "_refresh_buckets_cache_file", "(", "creds", ",", "cache_file", ",", "multiple_env", ",", "environment", ",", "prefix", ")", ":", "# helper s3 query function", "def", "__get_s3_meta", "(", ")", ":", "return", "__utils__", "[", "'s3.query'", "]", "(", "key",...
Retrieve the content of all buckets and cache the metadata to the buckets cache file
[ "Retrieve", "the", "content", "of", "all", "buckets", "and", "cache", "the", "metadata", "to", "the", "buckets", "cache", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/s3.py#L269-L349
train
saltstack/salt
salt/pillar/s3.py
_read_buckets_cache_file
def _read_buckets_cache_file(cache_file): ''' Return the contents of the buckets cache file ''' log.debug('Reading buckets cache file') with salt.utils.files.fopen(cache_file, 'rb') as fp_: data = pickle.load(fp_) return data
python
def _read_buckets_cache_file(cache_file): ''' Return the contents of the buckets cache file ''' log.debug('Reading buckets cache file') with salt.utils.files.fopen(cache_file, 'rb') as fp_: data = pickle.load(fp_) return data
[ "def", "_read_buckets_cache_file", "(", "cache_file", ")", ":", "log", ".", "debug", "(", "'Reading buckets cache file'", ")", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "cache_file", ",", "'rb'", ")", "as", "fp_", ":", "data", "=", "pi...
Return the contents of the buckets cache file
[ "Return", "the", "contents", "of", "the", "buckets", "cache", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/s3.py#L352-L362
train
saltstack/salt
salt/pillar/s3.py
_find_files
def _find_files(metadata): ''' Looks for all the files in the S3 bucket cache metadata ''' ret = {} for bucket, data in six.iteritems(metadata): if bucket not in ret: ret[bucket] = [] # grab the paths from the metadata filePaths = [k['Key'] for k in data] ...
python
def _find_files(metadata): ''' Looks for all the files in the S3 bucket cache metadata ''' ret = {} for bucket, data in six.iteritems(metadata): if bucket not in ret: ret[bucket] = [] # grab the paths from the metadata filePaths = [k['Key'] for k in data] ...
[ "def", "_find_files", "(", "metadata", ")", ":", "ret", "=", "{", "}", "for", "bucket", ",", "data", "in", "six", ".", "iteritems", "(", "metadata", ")", ":", "if", "bucket", "not", "in", "ret", ":", "ret", "[", "bucket", "]", "=", "[", "]", "# g...
Looks for all the files in the S3 bucket cache metadata
[ "Looks", "for", "all", "the", "files", "in", "the", "S3", "bucket", "cache", "metadata" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/s3.py#L365-L381
train
saltstack/salt
salt/pillar/s3.py
_get_file_from_s3
def _get_file_from_s3(creds, metadata, saltenv, bucket, path, cached_file_path): ''' Checks the local cache for the file, if it's old or missing go grab the file from S3 and update the cache ''' # check the local cache... if os.path.isfile(cached_file_path): file_m...
python
def _get_file_from_s3(creds, metadata, saltenv, bucket, path, cached_file_path): ''' Checks the local cache for the file, if it's old or missing go grab the file from S3 and update the cache ''' # check the local cache... if os.path.isfile(cached_file_path): file_m...
[ "def", "_get_file_from_s3", "(", "creds", ",", "metadata", ",", "saltenv", ",", "bucket", ",", "path", ",", "cached_file_path", ")", ":", "# check the local cache...", "if", "os", ".", "path", ".", "isfile", "(", "cached_file_path", ")", ":", "file_meta", "=",...
Checks the local cache for the file, if it's old or missing go grab the file from S3 and update the cache
[ "Checks", "the", "local", "cache", "for", "the", "file", "if", "it", "s", "old", "or", "missing", "go", "grab", "the", "file", "from", "S3", "and", "update", "the", "cache" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/s3.py#L398-L432
train
saltstack/salt
salt/modules/logadm.py
_arg2opt
def _arg2opt(arg): ''' Turn a pass argument into the correct option ''' res = [o for o, a in option_toggles.items() if a == arg] res += [o for o, a in option_flags.items() if a == arg] return res[0] if res else None
python
def _arg2opt(arg): ''' Turn a pass argument into the correct option ''' res = [o for o, a in option_toggles.items() if a == arg] res += [o for o, a in option_flags.items() if a == arg] return res[0] if res else None
[ "def", "_arg2opt", "(", "arg", ")", ":", "res", "=", "[", "o", "for", "o", ",", "a", "in", "option_toggles", ".", "items", "(", ")", "if", "a", "==", "arg", "]", "res", "+=", "[", "o", "for", "o", ",", "a", "in", "option_flags", ".", "items", ...
Turn a pass argument into the correct option
[ "Turn", "a", "pass", "argument", "into", "the", "correct", "option" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L61-L67
train
saltstack/salt
salt/modules/logadm.py
_parse_conf
def _parse_conf(conf_file=default_conf): ''' Parse a logadm configuration file. ''' ret = {} with salt.utils.files.fopen(conf_file, 'r') as ifile: for line in ifile: line = salt.utils.stringutils.to_unicode(line).strip() if not line: continue ...
python
def _parse_conf(conf_file=default_conf): ''' Parse a logadm configuration file. ''' ret = {} with salt.utils.files.fopen(conf_file, 'r') as ifile: for line in ifile: line = salt.utils.stringutils.to_unicode(line).strip() if not line: continue ...
[ "def", "_parse_conf", "(", "conf_file", "=", "default_conf", ")", ":", "ret", "=", "{", "}", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "conf_file", ",", "'r'", ")", "as", "ifile", ":", "for", "line", "in", "ifile", ":", "line", ...
Parse a logadm configuration file.
[ "Parse", "a", "logadm", "configuration", "file", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L70-L84
train
saltstack/salt
salt/modules/logadm.py
_parse_options
def _parse_options(entry, options, include_unset=True): ''' Parse a logadm options string ''' log_cfg = {} options = shlex.split(options) if not options: return None ## identifier is entry or log? if entry.startswith('/'): log_cfg['log_file'] = entry else: lo...
python
def _parse_options(entry, options, include_unset=True): ''' Parse a logadm options string ''' log_cfg = {} options = shlex.split(options) if not options: return None ## identifier is entry or log? if entry.startswith('/'): log_cfg['log_file'] = entry else: lo...
[ "def", "_parse_options", "(", "entry", ",", "options", ",", "include_unset", "=", "True", ")", ":", "log_cfg", "=", "{", "}", "options", "=", "shlex", ".", "split", "(", "options", ")", "if", "not", "options", ":", "return", "None", "## identifier is entry...
Parse a logadm options string
[ "Parse", "a", "logadm", "options", "string" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L87-L152
train
saltstack/salt
salt/modules/logadm.py
show_conf
def show_conf(conf_file=default_conf, name=None): ''' Show configuration conf_file : string path to logadm.conf, defaults to /etc/logadm.conf name : string optional show only a single entry CLI Example: .. code-block:: bash salt '*' logadm.show_conf salt '*' l...
python
def show_conf(conf_file=default_conf, name=None): ''' Show configuration conf_file : string path to logadm.conf, defaults to /etc/logadm.conf name : string optional show only a single entry CLI Example: .. code-block:: bash salt '*' logadm.show_conf salt '*' l...
[ "def", "show_conf", "(", "conf_file", "=", "default_conf", ",", "name", "=", "None", ")", ":", "cfg", "=", "_parse_conf", "(", "conf_file", ")", "# filter", "if", "name", "and", "name", "in", "cfg", ":", "return", "{", "name", ":", "cfg", "[", "name", ...
Show configuration conf_file : string path to logadm.conf, defaults to /etc/logadm.conf name : string optional show only a single entry CLI Example: .. code-block:: bash salt '*' logadm.show_conf salt '*' logadm.show_conf name=/var/log/syslog
[ "Show", "configuration" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L155-L179
train
saltstack/salt
salt/modules/logadm.py
list_conf
def list_conf(conf_file=default_conf, log_file=None, include_unset=False): ''' Show parsed configuration .. versionadded:: 2018.3.0 conf_file : string path to logadm.conf, defaults to /etc/logadm.conf log_file : string optional show only one log file include_unset : boolean ...
python
def list_conf(conf_file=default_conf, log_file=None, include_unset=False): ''' Show parsed configuration .. versionadded:: 2018.3.0 conf_file : string path to logadm.conf, defaults to /etc/logadm.conf log_file : string optional show only one log file include_unset : boolean ...
[ "def", "list_conf", "(", "conf_file", "=", "default_conf", ",", "log_file", "=", "None", ",", "include_unset", "=", "False", ")", ":", "cfg", "=", "_parse_conf", "(", "conf_file", ")", "cfg_parsed", "=", "{", "}", "## parse all options", "for", "entry", "in"...
Show parsed configuration .. versionadded:: 2018.3.0 conf_file : string path to logadm.conf, defaults to /etc/logadm.conf log_file : string optional show only one log file include_unset : boolean include unset flags in output CLI Example: .. code-block:: bash ...
[ "Show", "parsed", "configuration" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L182-L217
train
saltstack/salt
salt/modules/logadm.py
show_args
def show_args(): ''' Show which arguments map to which flags and options. .. versionadded:: 2018.3.0 CLI Example: .. code-block:: bash salt '*' logadm.show_args ''' mapping = {'flags': {}, 'options': {}} for flag, arg in option_toggles.items(): mapping['flags'][flag] ...
python
def show_args(): ''' Show which arguments map to which flags and options. .. versionadded:: 2018.3.0 CLI Example: .. code-block:: bash salt '*' logadm.show_args ''' mapping = {'flags': {}, 'options': {}} for flag, arg in option_toggles.items(): mapping['flags'][flag] ...
[ "def", "show_args", "(", ")", ":", "mapping", "=", "{", "'flags'", ":", "{", "}", ",", "'options'", ":", "{", "}", "}", "for", "flag", ",", "arg", "in", "option_toggles", ".", "items", "(", ")", ":", "mapping", "[", "'flags'", "]", "[", "flag", "...
Show which arguments map to which flags and options. .. versionadded:: 2018.3.0 CLI Example: .. code-block:: bash salt '*' logadm.show_args
[ "Show", "which", "arguments", "map", "to", "which", "flags", "and", "options", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L221-L239
train
saltstack/salt
salt/modules/logadm.py
rotate
def rotate(name, pattern=None, conf_file=default_conf, **kwargs): ''' Set up pattern for logging. name : string alias for entryname pattern : string alias for log_file conf_file : string optional path to alternative configuration file kwargs : boolean|string|int ...
python
def rotate(name, pattern=None, conf_file=default_conf, **kwargs): ''' Set up pattern for logging. name : string alias for entryname pattern : string alias for log_file conf_file : string optional path to alternative configuration file kwargs : boolean|string|int ...
[ "def", "rotate", "(", "name", ",", "pattern", "=", "None", ",", "conf_file", "=", "default_conf", ",", "*", "*", "kwargs", ")", ":", "## cleanup kwargs", "kwargs", "=", "salt", ".", "utils", ".", "args", ".", "clean_kwargs", "(", "*", "*", "kwargs", ")...
Set up pattern for logging. name : string alias for entryname pattern : string alias for log_file conf_file : string optional path to alternative configuration file kwargs : boolean|string|int optional additional flags and parameters .. note:: ``name`` and `...
[ "Set", "up", "pattern", "for", "logging", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L242-L323
train
saltstack/salt
salt/modules/logadm.py
remove
def remove(name, conf_file=default_conf): ''' Remove log pattern from logadm CLI Example: .. code-block:: bash salt '*' logadm.remove myapplog ''' command = "logadm -f {0} -r {1}".format(conf_file, name) result = __salt__['cmd.run_all'](command, python_shell=False) if result['re...
python
def remove(name, conf_file=default_conf): ''' Remove log pattern from logadm CLI Example: .. code-block:: bash salt '*' logadm.remove myapplog ''' command = "logadm -f {0} -r {1}".format(conf_file, name) result = __salt__['cmd.run_all'](command, python_shell=False) if result['re...
[ "def", "remove", "(", "name", ",", "conf_file", "=", "default_conf", ")", ":", "command", "=", "\"logadm -f {0} -r {1}\"", ".", "format", "(", "conf_file", ",", "name", ")", "result", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "command", ",", "python_s...
Remove log pattern from logadm CLI Example: .. code-block:: bash salt '*' logadm.remove myapplog
[ "Remove", "log", "pattern", "from", "logadm" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L326-L343
train
saltstack/salt
salt/utils/locales.py
get_encodings
def get_encodings(): ''' return a list of string encodings to try ''' encodings = [__salt_system_encoding__] try: sys_enc = sys.getdefaultencoding() except ValueError: # system encoding is nonstandard or malformed sys_enc = None if sys_enc and sys_enc not in encodings: ...
python
def get_encodings(): ''' return a list of string encodings to try ''' encodings = [__salt_system_encoding__] try: sys_enc = sys.getdefaultencoding() except ValueError: # system encoding is nonstandard or malformed sys_enc = None if sys_enc and sys_enc not in encodings: ...
[ "def", "get_encodings", "(", ")", ":", "encodings", "=", "[", "__salt_system_encoding__", "]", "try", ":", "sys_enc", "=", "sys", ".", "getdefaultencoding", "(", ")", "except", "ValueError", ":", "# system encoding is nonstandard or malformed", "sys_enc", "=", "None...
return a list of string encodings to try
[ "return", "a", "list", "of", "string", "encodings", "to", "try" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/locales.py#L16-L33
train
saltstack/salt
salt/utils/locales.py
split_locale
def split_locale(loc): ''' Split a locale specifier. The general format is language[_territory][.codeset][@modifier] [charmap] For example: ca_ES.UTF-8@valencia UTF-8 ''' def split(st, char): ''' Split a string `st` once by `char`; always return a two-element list ...
python
def split_locale(loc): ''' Split a locale specifier. The general format is language[_territory][.codeset][@modifier] [charmap] For example: ca_ES.UTF-8@valencia UTF-8 ''' def split(st, char): ''' Split a string `st` once by `char`; always return a two-element list ...
[ "def", "split_locale", "(", "loc", ")", ":", "def", "split", "(", "st", ",", "char", ")", ":", "'''\n Split a string `st` once by `char`; always return a two-element list\n even if the second element is empty.\n '''", "split_st", "=", "st", ".", "split", ...
Split a locale specifier. The general format is language[_territory][.codeset][@modifier] [charmap] For example: ca_ES.UTF-8@valencia UTF-8
[ "Split", "a", "locale", "specifier", ".", "The", "general", "format", "is" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/locales.py#L58-L83
train
saltstack/salt
salt/utils/locales.py
join_locale
def join_locale(comps): ''' Join a locale specifier split in the format returned by split_locale. ''' loc = comps['language'] if comps.get('territory'): loc += '_' + comps['territory'] if comps.get('codeset'): loc += '.' + comps['codeset'] if comps.get('modifier'): lo...
python
def join_locale(comps): ''' Join a locale specifier split in the format returned by split_locale. ''' loc = comps['language'] if comps.get('territory'): loc += '_' + comps['territory'] if comps.get('codeset'): loc += '.' + comps['codeset'] if comps.get('modifier'): lo...
[ "def", "join_locale", "(", "comps", ")", ":", "loc", "=", "comps", "[", "'language'", "]", "if", "comps", ".", "get", "(", "'territory'", ")", ":", "loc", "+=", "'_'", "+", "comps", "[", "'territory'", "]", "if", "comps", ".", "get", "(", "'codeset'"...
Join a locale specifier split in the format returned by split_locale.
[ "Join", "a", "locale", "specifier", "split", "in", "the", "format", "returned", "by", "split_locale", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/locales.py#L86-L99
train
saltstack/salt
salt/utils/locales.py
normalize_locale
def normalize_locale(loc): ''' Format a locale specifier according to the format returned by `locale -a`. ''' comps = split_locale(loc) comps['territory'] = comps['territory'].upper() comps['codeset'] = comps['codeset'].lower().replace('-', '') comps['charmap'] = '' return join_locale(co...
python
def normalize_locale(loc): ''' Format a locale specifier according to the format returned by `locale -a`. ''' comps = split_locale(loc) comps['territory'] = comps['territory'].upper() comps['codeset'] = comps['codeset'].lower().replace('-', '') comps['charmap'] = '' return join_locale(co...
[ "def", "normalize_locale", "(", "loc", ")", ":", "comps", "=", "split_locale", "(", "loc", ")", "comps", "[", "'territory'", "]", "=", "comps", "[", "'territory'", "]", ".", "upper", "(", ")", "comps", "[", "'codeset'", "]", "=", "comps", "[", "'codese...
Format a locale specifier according to the format returned by `locale -a`.
[ "Format", "a", "locale", "specifier", "according", "to", "the", "format", "returned", "by", "locale", "-", "a", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/locales.py#L102-L110
train
saltstack/salt
salt/returners/mongo_return.py
_remove_dots
def _remove_dots(src): ''' Remove dots from the given data structure ''' output = {} for key, val in six.iteritems(src): if isinstance(val, dict): val = _remove_dots(val) output[key.replace('.', '-')] = val return output
python
def _remove_dots(src): ''' Remove dots from the given data structure ''' output = {} for key, val in six.iteritems(src): if isinstance(val, dict): val = _remove_dots(val) output[key.replace('.', '-')] = val return output
[ "def", "_remove_dots", "(", "src", ")", ":", "output", "=", "{", "}", "for", "key", ",", "val", "in", "six", ".", "iteritems", "(", "src", ")", ":", "if", "isinstance", "(", "val", ",", "dict", ")", ":", "val", "=", "_remove_dots", "(", "val", ")...
Remove dots from the given data structure
[ "Remove", "dots", "from", "the", "given", "data", "structure" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mongo_return.py#L96-L105
train
saltstack/salt
salt/returners/mongo_return.py
_get_conn
def _get_conn(ret): ''' Return a mongodb connection object ''' _options = _get_options(ret) host = _options.get('host') port = _options.get('port') db_ = _options.get('db') user = _options.get('user') password = _options.get('password') indexes = _options.get('indexes', False) ...
python
def _get_conn(ret): ''' Return a mongodb connection object ''' _options = _get_options(ret) host = _options.get('host') port = _options.get('port') db_ = _options.get('db') user = _options.get('user') password = _options.get('password') indexes = _options.get('indexes', False) ...
[ "def", "_get_conn", "(", "ret", ")", ":", "_options", "=", "_get_options", "(", "ret", ")", "host", "=", "_options", ".", "get", "(", "'host'", ")", "port", "=", "_options", ".", "get", "(", "'port'", ")", "db_", "=", "_options", ".", "get", "(", "...
Return a mongodb connection object
[ "Return", "a", "mongodb", "connection", "object" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mongo_return.py#L127-L165
train
saltstack/salt
salt/returners/mongo_return.py
get_jid
def get_jid(jid): ''' Return the return information associated with a jid ''' conn, mdb = _get_conn(ret=None) ret = {} rdata = mdb.saltReturns.find({'jid': jid}, {'_id': 0}) if rdata: for data in rdata: minion = data['minion'] # return data in the format {<min...
python
def get_jid(jid): ''' Return the return information associated with a jid ''' conn, mdb = _get_conn(ret=None) ret = {} rdata = mdb.saltReturns.find({'jid': jid}, {'_id': 0}) if rdata: for data in rdata: minion = data['minion'] # return data in the format {<min...
[ "def", "get_jid", "(", "jid", ")", ":", "conn", ",", "mdb", "=", "_get_conn", "(", "ret", "=", "None", ")", "ret", "=", "{", "}", "rdata", "=", "mdb", ".", "saltReturns", ".", "find", "(", "{", "'jid'", ":", "jid", "}", ",", "{", "'_id'", ":", ...
Return the return information associated with a jid
[ "Return", "the", "return", "information", "associated", "with", "a", "jid" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mongo_return.py#L203-L215
train
saltstack/salt
salt/returners/mongo_return.py
get_fun
def get_fun(fun): ''' Return the most recent jobs that have executed the named function ''' conn, mdb = _get_conn(ret=None) ret = {} rdata = mdb.saltReturns.find_one({'fun': fun}, {'_id': 0}) if rdata: ret = rdata return ret
python
def get_fun(fun): ''' Return the most recent jobs that have executed the named function ''' conn, mdb = _get_conn(ret=None) ret = {} rdata = mdb.saltReturns.find_one({'fun': fun}, {'_id': 0}) if rdata: ret = rdata return ret
[ "def", "get_fun", "(", "fun", ")", ":", "conn", ",", "mdb", "=", "_get_conn", "(", "ret", "=", "None", ")", "ret", "=", "{", "}", "rdata", "=", "mdb", ".", "saltReturns", ".", "find_one", "(", "{", "'fun'", ":", "fun", "}", ",", "{", "'_id'", "...
Return the most recent jobs that have executed the named function
[ "Return", "the", "most", "recent", "jobs", "that", "have", "executed", "the", "named", "function" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mongo_return.py#L218-L227
train
saltstack/salt
salt/modules/acme.py
_cert_file
def _cert_file(name, cert_type): ''' Return expected path of a Let's Encrypt live cert ''' return os.path.join(LE_LIVE, name, '{0}.pem'.format(cert_type))
python
def _cert_file(name, cert_type): ''' Return expected path of a Let's Encrypt live cert ''' return os.path.join(LE_LIVE, name, '{0}.pem'.format(cert_type))
[ "def", "_cert_file", "(", "name", ",", "cert_type", ")", ":", "return", "os", ".", "path", ".", "join", "(", "LE_LIVE", ",", "name", ",", "'{0}.pem'", ".", "format", "(", "cert_type", ")", ")" ]
Return expected path of a Let's Encrypt live cert
[ "Return", "expected", "path", "of", "a", "Let", "s", "Encrypt", "live", "cert" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/acme.py#L64-L68
train
saltstack/salt
salt/modules/acme.py
_expires
def _expires(name): ''' Return the expiry date of a cert :return datetime object of expiry date ''' cert_file = _cert_file(name, 'cert') # Use the salt module if available if 'tls.cert_info' in __salt__: expiry = __salt__['tls.cert_info'](cert_file)['not_after'] # Cobble it toge...
python
def _expires(name): ''' Return the expiry date of a cert :return datetime object of expiry date ''' cert_file = _cert_file(name, 'cert') # Use the salt module if available if 'tls.cert_info' in __salt__: expiry = __salt__['tls.cert_info'](cert_file)['not_after'] # Cobble it toge...
[ "def", "_expires", "(", "name", ")", ":", "cert_file", "=", "_cert_file", "(", "name", ",", "'cert'", ")", "# Use the salt module if available", "if", "'tls.cert_info'", "in", "__salt__", ":", "expiry", "=", "__salt__", "[", "'tls.cert_info'", "]", "(", "cert_fi...
Return the expiry date of a cert :return datetime object of expiry date
[ "Return", "the", "expiry", "date", "of", "a", "cert" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/acme.py#L71-L89
train
saltstack/salt
salt/modules/acme.py
_renew_by
def _renew_by(name, window=None): ''' Date before a certificate should be renewed :param name: Common Name of the certificate (DNS name of certificate) :param window: days before expiry date to renew :return datetime object of first renewal date ''' expiry = _expires(name) if window is ...
python
def _renew_by(name, window=None): ''' Date before a certificate should be renewed :param name: Common Name of the certificate (DNS name of certificate) :param window: days before expiry date to renew :return datetime object of first renewal date ''' expiry = _expires(name) if window is ...
[ "def", "_renew_by", "(", "name", ",", "window", "=", "None", ")", ":", "expiry", "=", "_expires", "(", "name", ")", "if", "window", "is", "not", "None", ":", "expiry", "=", "expiry", "-", "datetime", ".", "timedelta", "(", "days", "=", "window", ")",...
Date before a certificate should be renewed :param name: Common Name of the certificate (DNS name of certificate) :param window: days before expiry date to renew :return datetime object of first renewal date
[ "Date", "before", "a", "certificate", "should", "be", "renewed" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/acme.py#L92-L104
train
saltstack/salt
salt/modules/acme.py
cert
def cert(name, aliases=None, email=None, webroot=None, test_cert=False, renew=None, keysize=None, server=None, owner='root', group='root', mode='0640', certname=None, preferred_challenges=None, tls_sni_0...
python
def cert(name, aliases=None, email=None, webroot=None, test_cert=False, renew=None, keysize=None, server=None, owner='root', group='root', mode='0640', certname=None, preferred_challenges=None, tls_sni_0...
[ "def", "cert", "(", "name", ",", "aliases", "=", "None", ",", "email", "=", "None", ",", "webroot", "=", "None", ",", "test_cert", "=", "False", ",", "renew", "=", "None", ",", "keysize", "=", "None", ",", "server", "=", "None", ",", "owner", "=", ...
Obtain/renew a certificate from an ACME CA, probably Let's Encrypt. :param name: Common Name of the certificate (DNS name of certificate) :param aliases: subjectAltNames (Additional DNS names on certificate) :param email: e-mail address for interaction with ACME provider :param webroot: True or a full ...
[ "Obtain", "/", "renew", "a", "certificate", "from", "an", "ACME", "CA", "probably", "Let", "s", "Encrypt", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/acme.py#L107-L258
train
saltstack/salt
salt/modules/acme.py
info
def info(name): ''' Return information about a certificate .. note:: Will output tls.cert_info if that's available, or OpenSSL text if not :param name: CommonName of cert CLI example: .. code-block:: bash salt 'gitlab.example.com' acme.info dev.example.com ''' cert_f...
python
def info(name): ''' Return information about a certificate .. note:: Will output tls.cert_info if that's available, or OpenSSL text if not :param name: CommonName of cert CLI example: .. code-block:: bash salt 'gitlab.example.com' acme.info dev.example.com ''' cert_f...
[ "def", "info", "(", "name", ")", ":", "cert_file", "=", "_cert_file", "(", "name", ",", "'cert'", ")", "# Use the salt module if available", "if", "'tls.cert_info'", "in", "__salt__", ":", "cert_info", "=", "__salt__", "[", "'tls.cert_info'", "]", "(", "cert_fil...
Return information about a certificate .. note:: Will output tls.cert_info if that's available, or OpenSSL text if not :param name: CommonName of cert CLI example: .. code-block:: bash salt 'gitlab.example.com' acme.info dev.example.com
[ "Return", "information", "about", "a", "certificate" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/acme.py#L274-L300
train
saltstack/salt
salt/modules/acme.py
needs_renewal
def needs_renewal(name, window=None): ''' Check if a certificate needs renewal :param name: CommonName of cert :param window: Window in days to renew earlier or True/force to just return True Code example: .. code-block:: python if __salt__['acme.needs_renewal']('dev.example.com'): ...
python
def needs_renewal(name, window=None): ''' Check if a certificate needs renewal :param name: CommonName of cert :param window: Window in days to renew earlier or True/force to just return True Code example: .. code-block:: python if __salt__['acme.needs_renewal']('dev.example.com'): ...
[ "def", "needs_renewal", "(", "name", ",", "window", "=", "None", ")", ":", "if", "window", "is", "not", "None", "and", "window", "in", "(", "'force'", ",", "'Force'", ",", "True", ")", ":", "return", "True", "return", "_renew_by", "(", "name", ",", "...
Check if a certificate needs renewal :param name: CommonName of cert :param window: Window in days to renew earlier or True/force to just return True Code example: .. code-block:: python if __salt__['acme.needs_renewal']('dev.example.com'): __salt__['acme.cert']('dev.example.com'...
[ "Check", "if", "a", "certificate", "needs", "renewal" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/acme.py#L344-L363
train
saltstack/salt
salt/modules/drbd.py
_analyse_overview_field
def _analyse_overview_field(content): ''' Split the field in drbd-overview ''' if "(" in content: # Output like "Connected(2*)" or "UpToDate(2*)" return content.split("(")[0], content.split("(")[0] elif "/" in content: # Output like "Primar/Second" or "UpToDa/UpToDa" ...
python
def _analyse_overview_field(content): ''' Split the field in drbd-overview ''' if "(" in content: # Output like "Connected(2*)" or "UpToDate(2*)" return content.split("(")[0], content.split("(")[0] elif "/" in content: # Output like "Primar/Second" or "UpToDa/UpToDa" ...
[ "def", "_analyse_overview_field", "(", "content", ")", ":", "if", "\"(\"", "in", "content", ":", "# Output like \"Connected(2*)\" or \"UpToDate(2*)\"", "return", "content", ".", "split", "(", "\"(\"", ")", "[", "0", "]", ",", "content", ".", "split", "(", "\"(\"...
Split the field in drbd-overview
[ "Split", "the", "field", "in", "drbd", "-", "overview" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L13-L24
train
saltstack/salt
salt/modules/drbd.py
_count_spaces_startswith
def _count_spaces_startswith(line): ''' Count the number of spaces before the first character ''' if line.split('#')[0].strip() == "": return None spaces = 0 for i in line: if i.isspace(): spaces += 1 else: return spaces
python
def _count_spaces_startswith(line): ''' Count the number of spaces before the first character ''' if line.split('#')[0].strip() == "": return None spaces = 0 for i in line: if i.isspace(): spaces += 1 else: return spaces
[ "def", "_count_spaces_startswith", "(", "line", ")", ":", "if", "line", ".", "split", "(", "'#'", ")", "[", "0", "]", ".", "strip", "(", ")", "==", "\"\"", ":", "return", "None", "spaces", "=", "0", "for", "i", "in", "line", ":", "if", "i", ".", ...
Count the number of spaces before the first character
[ "Count", "the", "number", "of", "spaces", "before", "the", "first", "character" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L27-L39
train
saltstack/salt
salt/modules/drbd.py
_analyse_status_type
def _analyse_status_type(line): ''' Figure out the sections in drbdadm status ''' spaces = _count_spaces_startswith(line) if spaces is None: return '' switch = { 0: 'RESOURCE', 2: {' disk:': 'LOCALDISK', ' role:': 'PEERNODE', ' connection:': 'PEERNODE'}, 4: {' p...
python
def _analyse_status_type(line): ''' Figure out the sections in drbdadm status ''' spaces = _count_spaces_startswith(line) if spaces is None: return '' switch = { 0: 'RESOURCE', 2: {' disk:': 'LOCALDISK', ' role:': 'PEERNODE', ' connection:': 'PEERNODE'}, 4: {' p...
[ "def", "_analyse_status_type", "(", "line", ")", ":", "spaces", "=", "_count_spaces_startswith", "(", "line", ")", "if", "spaces", "is", "None", ":", "return", "''", "switch", "=", "{", "0", ":", "'RESOURCE'", ",", "2", ":", "{", "' disk:'", ":", "'LOCAL...
Figure out the sections in drbdadm status
[ "Figure", "out", "the", "sections", "in", "drbdadm", "status" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L42-L67
train
saltstack/salt
salt/modules/drbd.py
_add_res
def _add_res(line): ''' Analyse the line of local resource of ``drbdadm status`` ''' global resource fields = line.strip().split() if resource: ret.append(resource) resource = {} resource["resource name"] = fields[0] resource["local role"] = fields[1].split(":")[1] ...
python
def _add_res(line): ''' Analyse the line of local resource of ``drbdadm status`` ''' global resource fields = line.strip().split() if resource: ret.append(resource) resource = {} resource["resource name"] = fields[0] resource["local role"] = fields[1].split(":")[1] ...
[ "def", "_add_res", "(", "line", ")", ":", "global", "resource", "fields", "=", "line", ".", "strip", "(", ")", ".", "split", "(", ")", "if", "resource", ":", "ret", ".", "append", "(", "resource", ")", "resource", "=", "{", "}", "resource", "[", "\...
Analyse the line of local resource of ``drbdadm status``
[ "Analyse", "the", "line", "of", "local", "resource", "of", "drbdadm", "status" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L70-L84
train
saltstack/salt
salt/modules/drbd.py
_add_volume
def _add_volume(line): ''' Analyse the line of volumes of ``drbdadm status`` ''' section = _analyse_status_type(line) fields = line.strip().split() volume = {} for field in fields: volume[field.split(':')[0]] = field.split(':')[1] if section == 'LOCALDISK': resource['lo...
python
def _add_volume(line): ''' Analyse the line of volumes of ``drbdadm status`` ''' section = _analyse_status_type(line) fields = line.strip().split() volume = {} for field in fields: volume[field.split(':')[0]] = field.split(':')[1] if section == 'LOCALDISK': resource['lo...
[ "def", "_add_volume", "(", "line", ")", ":", "section", "=", "_analyse_status_type", "(", "line", ")", "fields", "=", "line", ".", "strip", "(", ")", ".", "split", "(", ")", "volume", "=", "{", "}", "for", "field", "in", "fields", ":", "volume", "[",...
Analyse the line of volumes of ``drbdadm status``
[ "Analyse", "the", "line", "of", "volumes", "of", "drbdadm", "status" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L87-L102
train
saltstack/salt
salt/modules/drbd.py
_add_peernode
def _add_peernode(line): ''' Analyse the line of peer nodes of ``drbdadm status`` ''' global lastpnodevolumes fields = line.strip().split() peernode = {} peernode["peernode name"] = fields[0] #Could be role or connection: peernode[fields[1].split(":")[0]] = fields[1].split(":")[1] ...
python
def _add_peernode(line): ''' Analyse the line of peer nodes of ``drbdadm status`` ''' global lastpnodevolumes fields = line.strip().split() peernode = {} peernode["peernode name"] = fields[0] #Could be role or connection: peernode[fields[1].split(":")[0]] = fields[1].split(":")[1] ...
[ "def", "_add_peernode", "(", "line", ")", ":", "global", "lastpnodevolumes", "fields", "=", "line", ".", "strip", "(", ")", ".", "split", "(", ")", "peernode", "=", "{", "}", "peernode", "[", "\"peernode name\"", "]", "=", "fields", "[", "0", "]", "#Co...
Analyse the line of peer nodes of ``drbdadm status``
[ "Analyse", "the", "line", "of", "peer", "nodes", "of", "drbdadm", "status" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L105-L119
train
saltstack/salt
salt/modules/drbd.py
_line_parser
def _line_parser(line): ''' Call action for different lines ''' section = _analyse_status_type(line) fields = line.strip().split() switch = { '': _empty, 'RESOURCE': _add_res, 'PEERNODE': _add_peernode, 'LOCALDISK': _add_volume, 'PEERDISK': _add_volume, ...
python
def _line_parser(line): ''' Call action for different lines ''' section = _analyse_status_type(line) fields = line.strip().split() switch = { '': _empty, 'RESOURCE': _add_res, 'PEERNODE': _add_peernode, 'LOCALDISK': _add_volume, 'PEERDISK': _add_volume, ...
[ "def", "_line_parser", "(", "line", ")", ":", "section", "=", "_analyse_status_type", "(", "line", ")", "fields", "=", "line", ".", "strip", "(", ")", ".", "split", "(", ")", "switch", "=", "{", "''", ":", "_empty", ",", "'RESOURCE'", ":", "_add_res", ...
Call action for different lines
[ "Call", "action", "for", "different", "lines" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L137-L154
train
saltstack/salt
salt/modules/drbd.py
overview
def overview(): ''' Show status of the DRBD devices, support two nodes only. drbd-overview is removed since drbd-utils-9.6.0, use status instead. CLI Example: .. code-block:: bash salt '*' drbd.overview ''' cmd = 'drbd-overview' for line in __salt__['cmd.run'](cmd).splitli...
python
def overview(): ''' Show status of the DRBD devices, support two nodes only. drbd-overview is removed since drbd-utils-9.6.0, use status instead. CLI Example: .. code-block:: bash salt '*' drbd.overview ''' cmd = 'drbd-overview' for line in __salt__['cmd.run'](cmd).splitli...
[ "def", "overview", "(", ")", ":", "cmd", "=", "'drbd-overview'", "for", "line", "in", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ")", ".", "splitlines", "(", ")", ":", "ret", "=", "{", "}", "fields", "=", "line", ".", "strip", "(", ")", ".", ...
Show status of the DRBD devices, support two nodes only. drbd-overview is removed since drbd-utils-9.6.0, use status instead. CLI Example: .. code-block:: bash salt '*' drbd.overview
[ "Show", "status", "of", "the", "DRBD", "devices", "support", "two", "nodes", "only", ".", "drbd", "-", "overview", "is", "removed", "since", "drbd", "-", "utils", "-", "9", ".", "6", ".", "0", "use", "status", "instead", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L157-L228
train
saltstack/salt
salt/modules/drbd.py
status
def status(name='all'): ''' Using drbdadm to show status of the DRBD devices, available in the latest drbd9. Support multiple nodes, multiple volumes. :type name: str :param name: Resource name. :return: drbd status of resource. :rtype: list(dict(res)) CLI Example: .....
python
def status(name='all'): ''' Using drbdadm to show status of the DRBD devices, available in the latest drbd9. Support multiple nodes, multiple volumes. :type name: str :param name: Resource name. :return: drbd status of resource. :rtype: list(dict(res)) CLI Example: .....
[ "def", "status", "(", "name", "=", "'all'", ")", ":", "# Initialize for multiple times test cases", "global", "ret", "global", "resource", "ret", "=", "[", "]", "resource", "=", "{", "}", "cmd", "=", "[", "'drbdadm'", ",", "'status'", "]", "cmd", ".", "app...
Using drbdadm to show status of the DRBD devices, available in the latest drbd9. Support multiple nodes, multiple volumes. :type name: str :param name: Resource name. :return: drbd status of resource. :rtype: list(dict(res)) CLI Example: .. code-block:: bash salt '*'...
[ "Using", "drbdadm", "to", "show", "status", "of", "the", "DRBD", "devices", "available", "in", "the", "latest", "drbd9", ".", "Support", "multiple", "nodes", "multiple", "volumes", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L237-L283
train
saltstack/salt
salt/modules/rdp.py
_parse_return_code_powershell
def _parse_return_code_powershell(string): ''' return from the input string the return code of the powershell command ''' regex = re.search(r'ReturnValue\s*: (\d*)', string) if not regex: return (False, 'Could not parse PowerShell return code.') else: return int(regex.group(1))
python
def _parse_return_code_powershell(string): ''' return from the input string the return code of the powershell command ''' regex = re.search(r'ReturnValue\s*: (\d*)', string) if not regex: return (False, 'Could not parse PowerShell return code.') else: return int(regex.group(1))
[ "def", "_parse_return_code_powershell", "(", "string", ")", ":", "regex", "=", "re", ".", "search", "(", "r'ReturnValue\\s*: (\\d*)'", ",", "string", ")", "if", "not", "regex", ":", "return", "(", "False", ",", "'Could not parse PowerShell return code.'", ")", "el...
return from the input string the return code of the powershell command
[ "return", "from", "the", "input", "string", "the", "return", "code", "of", "the", "powershell", "command" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rdp.py#L34-L43
train
saltstack/salt
salt/modules/rdp.py
_psrdp
def _psrdp(cmd): ''' Create a Win32_TerminalServiceSetting WMI Object as $RDP and execute the command cmd returns the STDOUT of the command ''' rdp = ('$RDP = Get-WmiObject -Class Win32_TerminalServiceSetting ' '-Namespace root\\CIMV2\\TerminalServices -Computer . ' '-Authentic...
python
def _psrdp(cmd): ''' Create a Win32_TerminalServiceSetting WMI Object as $RDP and execute the command cmd returns the STDOUT of the command ''' rdp = ('$RDP = Get-WmiObject -Class Win32_TerminalServiceSetting ' '-Namespace root\\CIMV2\\TerminalServices -Computer . ' '-Authentic...
[ "def", "_psrdp", "(", "cmd", ")", ":", "rdp", "=", "(", "'$RDP = Get-WmiObject -Class Win32_TerminalServiceSetting '", "'-Namespace root\\\\CIMV2\\\\TerminalServices -Computer . '", "'-Authentication 6 -ErrorAction Stop'", ")", "return", "__salt__", "[", "'cmd.run'", "]", "(", ...
Create a Win32_TerminalServiceSetting WMI Object as $RDP and execute the command cmd returns the STDOUT of the command
[ "Create", "a", "Win32_TerminalServiceSetting", "WMI", "Object", "as", "$RDP", "and", "execute", "the", "command", "cmd", "returns", "the", "STDOUT", "of", "the", "command" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rdp.py#L46-L55
train
saltstack/salt
salt/modules/rdp.py
list_sessions
def list_sessions(logged_in_users_only=False): ''' List information about the sessions. .. versionadded:: 2016.11.0 :param logged_in_users_only: If True, only return sessions with users logged in. :return: A list containing dictionaries of session information. CLI Example: .. code-block:...
python
def list_sessions(logged_in_users_only=False): ''' List information about the sessions. .. versionadded:: 2016.11.0 :param logged_in_users_only: If True, only return sessions with users logged in. :return: A list containing dictionaries of session information. CLI Example: .. code-block:...
[ "def", "list_sessions", "(", "logged_in_users_only", "=", "False", ")", ":", "ret", "=", "list", "(", ")", "server", "=", "win32ts", ".", "WTS_CURRENT_SERVER_HANDLE", "protocols", "=", "{", "win32ts", ".", "WTS_PROTOCOL_TYPE_CONSOLE", ":", "'console'", ",", "win...
List information about the sessions. .. versionadded:: 2016.11.0 :param logged_in_users_only: If True, only return sessions with users logged in. :return: A list containing dictionaries of session information. CLI Example: .. code-block:: bash salt '*' rdp.list_sessions
[ "List", "information", "about", "the", "sessions", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rdp.py#L104-L151
train
saltstack/salt
salt/modules/rdp.py
get_session
def get_session(session_id): ''' Get information about a session. .. versionadded:: 2016.11.0 :param session_id: The numeric Id of the session. :return: A dictionary of session information. CLI Example: .. code-block:: bash salt '*' rdp.get_session session_id salt '*' r...
python
def get_session(session_id): ''' Get information about a session. .. versionadded:: 2016.11.0 :param session_id: The numeric Id of the session. :return: A dictionary of session information. CLI Example: .. code-block:: bash salt '*' rdp.get_session session_id salt '*' r...
[ "def", "get_session", "(", "session_id", ")", ":", "ret", "=", "dict", "(", ")", "sessions", "=", "list_sessions", "(", ")", "session", "=", "[", "item", "for", "item", "in", "sessions", "if", "item", "[", "'session_id'", "]", "==", "session_id", "]", ...
Get information about a session. .. versionadded:: 2016.11.0 :param session_id: The numeric Id of the session. :return: A dictionary of session information. CLI Example: .. code-block:: bash salt '*' rdp.get_session session_id salt '*' rdp.get_session 99
[ "Get", "information", "about", "a", "session", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rdp.py#L155-L181
train
saltstack/salt
salt/modules/rdp.py
disconnect_session
def disconnect_session(session_id): ''' Disconnect a session. .. versionadded:: 2016.11.0 :param session_id: The numeric Id of the session. :return: A boolean representing whether the disconnect succeeded. CLI Example: .. code-block:: bash salt '*' rdp.disconnect_session session...
python
def disconnect_session(session_id): ''' Disconnect a session. .. versionadded:: 2016.11.0 :param session_id: The numeric Id of the session. :return: A boolean representing whether the disconnect succeeded. CLI Example: .. code-block:: bash salt '*' rdp.disconnect_session session...
[ "def", "disconnect_session", "(", "session_id", ")", ":", "try", ":", "win32ts", ".", "WTSDisconnectSession", "(", "win32ts", ".", "WTS_CURRENT_SERVER_HANDLE", ",", "session_id", ",", "True", ")", "except", "PyWinError", "as", "error", ":", "_LOG", ".", "error",...
Disconnect a session. .. versionadded:: 2016.11.0 :param session_id: The numeric Id of the session. :return: A boolean representing whether the disconnect succeeded. CLI Example: .. code-block:: bash salt '*' rdp.disconnect_session session_id salt '*' rdp.disconnect_session 99
[ "Disconnect", "a", "session", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rdp.py#L185-L207
train
saltstack/salt
salt/modules/rdp.py
logoff_session
def logoff_session(session_id): ''' Initiate the logoff of a session. .. versionadded:: 2016.11.0 :param session_id: The numeric Id of the session. :return: A boolean representing whether the logoff succeeded. CLI Example: .. code-block:: bash salt '*' rdp.logoff_session session...
python
def logoff_session(session_id): ''' Initiate the logoff of a session. .. versionadded:: 2016.11.0 :param session_id: The numeric Id of the session. :return: A boolean representing whether the logoff succeeded. CLI Example: .. code-block:: bash salt '*' rdp.logoff_session session...
[ "def", "logoff_session", "(", "session_id", ")", ":", "try", ":", "win32ts", ".", "WTSLogoffSession", "(", "win32ts", ".", "WTS_CURRENT_SERVER_HANDLE", ",", "session_id", ",", "True", ")", "except", "PyWinError", "as", "error", ":", "_LOG", ".", "error", "(", ...
Initiate the logoff of a session. .. versionadded:: 2016.11.0 :param session_id: The numeric Id of the session. :return: A boolean representing whether the logoff succeeded. CLI Example: .. code-block:: bash salt '*' rdp.logoff_session session_id salt '*' rdp.logoff_session 99
[ "Initiate", "the", "logoff", "of", "a", "session", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rdp.py#L211-L233
train
saltstack/salt
salt/runners/fileserver.py
envs
def envs(backend=None, sources=False): ''' Return the available fileserver environments. If no backend is provided, then the environments for all configured backends will be returned. backend Narrow fileserver backends to a subset of the enabled ones. .. versionchanged:: 2015.5.0 ...
python
def envs(backend=None, sources=False): ''' Return the available fileserver environments. If no backend is provided, then the environments for all configured backends will be returned. backend Narrow fileserver backends to a subset of the enabled ones. .. versionchanged:: 2015.5.0 ...
[ "def", "envs", "(", "backend", "=", "None", ",", "sources", "=", "False", ")", ":", "fileserver", "=", "salt", ".", "fileserver", ".", "Fileserver", "(", "__opts__", ")", "return", "sorted", "(", "fileserver", ".", "envs", "(", "back", "=", "backend", ...
Return the available fileserver environments. If no backend is provided, then the environments for all configured backends will be returned. backend Narrow fileserver backends to a subset of the enabled ones. .. versionchanged:: 2015.5.0 If all passed backends start with a minus si...
[ "Return", "the", "available", "fileserver", "environments", ".", "If", "no", "backend", "is", "provided", "then", "the", "environments", "for", "all", "configured", "backends", "will", "be", "returned", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L11-L39
train
saltstack/salt
salt/runners/fileserver.py
clear_file_list_cache
def clear_file_list_cache(saltenv=None, backend=None): ''' .. versionadded:: 2016.11.0 The Salt fileserver caches the files/directories/symlinks for each fileserver backend and environment as they are requested. This is done to help the fileserver scale better. Without this caching, when hundre...
python
def clear_file_list_cache(saltenv=None, backend=None): ''' .. versionadded:: 2016.11.0 The Salt fileserver caches the files/directories/symlinks for each fileserver backend and environment as they are requested. This is done to help the fileserver scale better. Without this caching, when hundre...
[ "def", "clear_file_list_cache", "(", "saltenv", "=", "None", ",", "backend", "=", "None", ")", ":", "fileserver", "=", "salt", ".", "fileserver", ".", "Fileserver", "(", "__opts__", ")", "load", "=", "{", "'saltenv'", ":", "saltenv", ",", "'fsbackend'", ":...
.. versionadded:: 2016.11.0 The Salt fileserver caches the files/directories/symlinks for each fileserver backend and environment as they are requested. This is done to help the fileserver scale better. Without this caching, when hundreds/thousands of minions simultaneously ask the master what files ar...
[ "..", "versionadded", "::", "2016", ".", "11", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L42-L147
train
saltstack/salt
salt/runners/fileserver.py
file_list
def file_list(saltenv='base', backend=None): ''' Return a list of files from the salt fileserver saltenv : base The salt fileserver environment to be listed backend Narrow fileserver backends to a subset of the enabled ones. If all passed backends start with a minus sign (``-``...
python
def file_list(saltenv='base', backend=None): ''' Return a list of files from the salt fileserver saltenv : base The salt fileserver environment to be listed backend Narrow fileserver backends to a subset of the enabled ones. If all passed backends start with a minus sign (``-``...
[ "def", "file_list", "(", "saltenv", "=", "'base'", ",", "backend", "=", "None", ")", ":", "fileserver", "=", "salt", ".", "fileserver", ".", "Fileserver", "(", "__opts__", ")", "load", "=", "{", "'saltenv'", ":", "saltenv", ",", "'fsbackend'", ":", "back...
Return a list of files from the salt fileserver saltenv : base The salt fileserver environment to be listed backend Narrow fileserver backends to a subset of the enabled ones. If all passed backends start with a minus sign (``-``), then these backends will be excluded from the ...
[ "Return", "a", "list", "of", "files", "from", "the", "salt", "fileserver" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L150-L193
train
saltstack/salt
salt/runners/fileserver.py
symlink_list
def symlink_list(saltenv='base', backend=None): ''' Return a list of symlinked files and dirs saltenv : base The salt fileserver environment to be listed backend Narrow fileserver backends to a subset of the enabled ones. If all passed backends start with a minus sign (``-``), ...
python
def symlink_list(saltenv='base', backend=None): ''' Return a list of symlinked files and dirs saltenv : base The salt fileserver environment to be listed backend Narrow fileserver backends to a subset of the enabled ones. If all passed backends start with a minus sign (``-``), ...
[ "def", "symlink_list", "(", "saltenv", "=", "'base'", ",", "backend", "=", "None", ")", ":", "fileserver", "=", "salt", ".", "fileserver", ".", "Fileserver", "(", "__opts__", ")", "load", "=", "{", "'saltenv'", ":", "saltenv", ",", "'fsbackend'", ":", "b...
Return a list of symlinked files and dirs saltenv : base The salt fileserver environment to be listed backend Narrow fileserver backends to a subset of the enabled ones. If all passed backends start with a minus sign (``-``), then these backends will be excluded from the enable...
[ "Return", "a", "list", "of", "symlinked", "files", "and", "dirs" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L196-L239
train
saltstack/salt
salt/runners/fileserver.py
dir_list
def dir_list(saltenv='base', backend=None): ''' Return a list of directories in the given environment saltenv : base The salt fileserver environment to be listed backend Narrow fileserver backends to a subset of the enabled ones. If all passed backends start with a minus sign (...
python
def dir_list(saltenv='base', backend=None): ''' Return a list of directories in the given environment saltenv : base The salt fileserver environment to be listed backend Narrow fileserver backends to a subset of the enabled ones. If all passed backends start with a minus sign (...
[ "def", "dir_list", "(", "saltenv", "=", "'base'", ",", "backend", "=", "None", ")", ":", "fileserver", "=", "salt", ".", "fileserver", ".", "Fileserver", "(", "__opts__", ")", "load", "=", "{", "'saltenv'", ":", "saltenv", ",", "'fsbackend'", ":", "backe...
Return a list of directories in the given environment saltenv : base The salt fileserver environment to be listed backend Narrow fileserver backends to a subset of the enabled ones. If all passed backends start with a minus sign (``-``), then these backends will be excluded fro...
[ "Return", "a", "list", "of", "directories", "in", "the", "given", "environment" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L242-L285
train
saltstack/salt
salt/runners/fileserver.py
empty_dir_list
def empty_dir_list(saltenv='base', backend=None): ''' .. versionadded:: 2015.5.0 Return a list of empty directories in the given environment saltenv : base The salt fileserver environment to be listed backend Narrow fileserver backends to a subset of the enabled ones. If all ...
python
def empty_dir_list(saltenv='base', backend=None): ''' .. versionadded:: 2015.5.0 Return a list of empty directories in the given environment saltenv : base The salt fileserver environment to be listed backend Narrow fileserver backends to a subset of the enabled ones. If all ...
[ "def", "empty_dir_list", "(", "saltenv", "=", "'base'", ",", "backend", "=", "None", ")", ":", "fileserver", "=", "salt", ".", "fileserver", ".", "Fileserver", "(", "__opts__", ")", "load", "=", "{", "'saltenv'", ":", "saltenv", ",", "'fsbackend'", ":", ...
.. versionadded:: 2015.5.0 Return a list of empty directories in the given environment saltenv : base The salt fileserver environment to be listed backend Narrow fileserver backends to a subset of the enabled ones. If all passed backends start with a minus sign (``-``), then these...
[ "..", "versionadded", "::", "2015", ".", "5", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L288-L322
train
saltstack/salt
salt/runners/fileserver.py
update
def update(backend=None): ''' Update the fileserver cache. If no backend is provided, then the cache for all configured backends will be updated. backend Narrow fileserver backends to a subset of the enabled ones. .. versionchanged:: 2015.5.0 If all passed backends start wi...
python
def update(backend=None): ''' Update the fileserver cache. If no backend is provided, then the cache for all configured backends will be updated. backend Narrow fileserver backends to a subset of the enabled ones. .. versionchanged:: 2015.5.0 If all passed backends start wi...
[ "def", "update", "(", "backend", "=", "None", ")", ":", "fileserver", "=", "salt", ".", "fileserver", ".", "Fileserver", "(", "__opts__", ")", "fileserver", ".", "update", "(", "back", "=", "backend", ")", "return", "True" ]
Update the fileserver cache. If no backend is provided, then the cache for all configured backends will be updated. backend Narrow fileserver backends to a subset of the enabled ones. .. versionchanged:: 2015.5.0 If all passed backends start with a minus sign (``-``), then these ...
[ "Update", "the", "fileserver", "cache", ".", "If", "no", "backend", "is", "provided", "then", "the", "cache", "for", "all", "configured", "backends", "will", "be", "updated", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L325-L353
train
saltstack/salt
salt/runners/fileserver.py
clear_cache
def clear_cache(backend=None): ''' .. versionadded:: 2015.5.0 Clear the fileserver cache from VCS fileserver backends (:mod:`git <salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn <salt.fileserver.svnfs>`). Executing this runner with no arguments will clear the cache for all ...
python
def clear_cache(backend=None): ''' .. versionadded:: 2015.5.0 Clear the fileserver cache from VCS fileserver backends (:mod:`git <salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn <salt.fileserver.svnfs>`). Executing this runner with no arguments will clear the cache for all ...
[ "def", "clear_cache", "(", "backend", "=", "None", ")", ":", "fileserver", "=", "salt", ".", "fileserver", ".", "Fileserver", "(", "__opts__", ")", "cleared", ",", "errors", "=", "fileserver", ".", "clear_cache", "(", "back", "=", "backend", ")", "ret", ...
.. versionadded:: 2015.5.0 Clear the fileserver cache from VCS fileserver backends (:mod:`git <salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn <salt.fileserver.svnfs>`). Executing this runner with no arguments will clear the cache for all enabled VCS fileserver backends, but this ...
[ "..", "versionadded", "::", "2015", ".", "5", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L356-L391
train
saltstack/salt
salt/runners/fileserver.py
clear_lock
def clear_lock(backend=None, remote=None): ''' .. versionadded:: 2015.5.0 Clear the fileserver update lock from VCS fileserver backends (:mod:`git <salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn <salt.fileserver.svnfs>`). This should only need to be done if a fileserver up...
python
def clear_lock(backend=None, remote=None): ''' .. versionadded:: 2015.5.0 Clear the fileserver update lock from VCS fileserver backends (:mod:`git <salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn <salt.fileserver.svnfs>`). This should only need to be done if a fileserver up...
[ "def", "clear_lock", "(", "backend", "=", "None", ",", "remote", "=", "None", ")", ":", "fileserver", "=", "salt", ".", "fileserver", ".", "Fileserver", "(", "__opts__", ")", "cleared", ",", "errors", "=", "fileserver", ".", "clear_lock", "(", "back", "=...
.. versionadded:: 2015.5.0 Clear the fileserver update lock from VCS fileserver backends (:mod:`git <salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn <salt.fileserver.svnfs>`). This should only need to be done if a fileserver update was interrupted and a remote is not updating (gene...
[ "..", "versionadded", "::", "2015", ".", "5", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L394-L432
train
saltstack/salt
salt/runners/fileserver.py
lock
def lock(backend=None, remote=None): ''' .. versionadded:: 2015.5.0 Set a fileserver update lock for VCS fileserver backends (:mod:`git <salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn <salt.fileserver.svnfs>`). .. note:: This will only operate on enabled backends...
python
def lock(backend=None, remote=None): ''' .. versionadded:: 2015.5.0 Set a fileserver update lock for VCS fileserver backends (:mod:`git <salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn <salt.fileserver.svnfs>`). .. note:: This will only operate on enabled backends...
[ "def", "lock", "(", "backend", "=", "None", ",", "remote", "=", "None", ")", ":", "fileserver", "=", "salt", ".", "fileserver", ".", "Fileserver", "(", "__opts__", ")", "locked", ",", "errors", "=", "fileserver", ".", "lock", "(", "back", "=", "backend...
.. versionadded:: 2015.5.0 Set a fileserver update lock for VCS fileserver backends (:mod:`git <salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn <salt.fileserver.svnfs>`). .. note:: This will only operate on enabled backends (those configured in :conf_master:`files...
[ "..", "versionadded", "::", "2015", ".", "5", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L435-L474
train
saltstack/salt
salt/key.py
KeyCLI.run
def run(self): ''' Run the logic for saltkey ''' self._update_opts() cmd = self.opts['fun'] veri = None ret = None try: if cmd in ('accept', 'reject', 'delete'): ret = self._run_cmd('name_match') if not isinstan...
python
def run(self): ''' Run the logic for saltkey ''' self._update_opts() cmd = self.opts['fun'] veri = None ret = None try: if cmd in ('accept', 'reject', 'delete'): ret = self._run_cmd('name_match') if not isinstan...
[ "def", "run", "(", "self", ")", ":", "self", ".", "_update_opts", "(", ")", "cmd", "=", "self", ".", "opts", "[", "'fun'", "]", "veri", "=", "None", "ret", "=", "None", "try", ":", "if", "cmd", "in", "(", "'accept'", ",", "'reject'", ",", "'delet...
Run the logic for saltkey
[ "Run", "the", "logic", "for", "saltkey" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L228-L284
train
saltstack/salt
salt/key.py
Key._check_minions_directories
def _check_minions_directories(self): ''' Return the minion keys directory paths ''' minions_accepted = os.path.join(self.opts['pki_dir'], self.ACC) minions_pre = os.path.join(self.opts['pki_dir'], self.PEND) minions_rejected = os.path.join(self.opts['pki_dir'], ...
python
def _check_minions_directories(self): ''' Return the minion keys directory paths ''' minions_accepted = os.path.join(self.opts['pki_dir'], self.ACC) minions_pre = os.path.join(self.opts['pki_dir'], self.PEND) minions_rejected = os.path.join(self.opts['pki_dir'], ...
[ "def", "_check_minions_directories", "(", "self", ")", ":", "minions_accepted", "=", "os", ".", "path", ".", "join", "(", "self", ".", "opts", "[", "'pki_dir'", "]", ",", "self", ".", "ACC", ")", "minions_pre", "=", "os", ".", "path", ".", "join", "(",...
Return the minion keys directory paths
[ "Return", "the", "minion", "keys", "directory", "paths" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L314-L325
train
saltstack/salt
salt/key.py
Key.gen_keys
def gen_keys(self, keydir=None, keyname=None, keysize=None, user=None): ''' Generate minion RSA public keypair ''' keydir, keyname, keysize, user = self._get_key_attrs(keydir, keyname, keysize, user) salt.crypt.gen_keys...
python
def gen_keys(self, keydir=None, keyname=None, keysize=None, user=None): ''' Generate minion RSA public keypair ''' keydir, keyname, keysize, user = self._get_key_attrs(keydir, keyname, keysize, user) salt.crypt.gen_keys...
[ "def", "gen_keys", "(", "self", ",", "keydir", "=", "None", ",", "keyname", "=", "None", ",", "keysize", "=", "None", ",", "user", "=", "None", ")", ":", "keydir", ",", "keyname", ",", "keysize", ",", "user", "=", "self", ".", "_get_key_attrs", "(", ...
Generate minion RSA public keypair
[ "Generate", "minion", "RSA", "public", "keypair" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L343-L350
train
saltstack/salt
salt/key.py
Key.gen_signature
def gen_signature(self, privkey, pubkey, sig_path): ''' Generate master public-key-signature ''' return salt.crypt.gen_signature(privkey, pubkey, sig_path, self.passphr...
python
def gen_signature(self, privkey, pubkey, sig_path): ''' Generate master public-key-signature ''' return salt.crypt.gen_signature(privkey, pubkey, sig_path, self.passphr...
[ "def", "gen_signature", "(", "self", ",", "privkey", ",", "pubkey", ",", "sig_path", ")", ":", "return", "salt", ".", "crypt", ".", "gen_signature", "(", "privkey", ",", "pubkey", ",", "sig_path", ",", "self", ".", "passphrase", ")" ]
Generate master public-key-signature
[ "Generate", "master", "public", "-", "key", "-", "signature" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L352-L359
train
saltstack/salt
salt/key.py
Key.gen_keys_signature
def gen_keys_signature(self, priv, pub, signature_path, auto_create=False, keysize=None): ''' Generate master public-key-signature ''' # check given pub-key if pub: if not os.path.isfile(pub): return 'Public-key {0} does not exist'.format(pub) ...
python
def gen_keys_signature(self, priv, pub, signature_path, auto_create=False, keysize=None): ''' Generate master public-key-signature ''' # check given pub-key if pub: if not os.path.isfile(pub): return 'Public-key {0} does not exist'.format(pub) ...
[ "def", "gen_keys_signature", "(", "self", ",", "priv", ",", "pub", ",", "signature_path", ",", "auto_create", "=", "False", ",", "keysize", "=", "None", ")", ":", "# check given pub-key", "if", "pub", ":", "if", "not", "os", ".", "path", ".", "isfile", "...
Generate master public-key-signature
[ "Generate", "master", "public", "-", "key", "-", "signature" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L361-L416
train