repository_name stringclasses 316
values | func_path_in_repository stringlengths 6 223 | func_name stringlengths 1 134 | language stringclasses 1
value | func_code_string stringlengths 57 65.5k | func_documentation_string stringlengths 1 46.3k | split_name stringclasses 1
value | func_code_url stringlengths 91 315 | called_functions listlengths 1 156 ⌀ | enclosing_scope stringlengths 2 1.48M |
|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/systemd_service.py | _check_available | python | def _check_available(name):
'''
Returns boolean telling whether or not the named service is available
'''
_status = _systemctl_status(name)
sd_version = salt.utils.systemd.version(__context__)
if sd_version is not None and sd_version >= 231:
# systemd 231 changed the output of "systemctl... | Returns boolean telling whether or not the named service is available | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L95-L125 | [
"def split(orig, sep=None):\n '''\n Generator function for iterating through large strings, particularly useful\n as a replacement for str.splitlines().\n\n See http://stackoverflow.com/a/3865367\n '''\n exp = re.compile(r'\\s+' if sep is None else re.escape(sep))\n pos = 0\n length = len(or... | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | _check_for_unit_changes | python | def _check_for_unit_changes(name):
'''
Check for modified/updated unit files, and run a daemon-reload if any are
found.
'''
contextkey = 'systemd._check_for_unit_changes.{0}'.format(name)
if contextkey not in __context__:
if _untracked_custom_unit_found(name) or _unit_file_changed(name):... | Check for modified/updated unit files, and run a daemon-reload if any are
found. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L128-L138 | [
"def _untracked_custom_unit_found(name, root=None):\n '''\n If the passed service name is not available, but a unit file exist in\n /etc/systemd/system, return True. Otherwise, return False.\n '''\n system = _root('/etc/systemd/system', root)\n unit_path = os.path.join(system, _canonical_unit_name... | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | _check_unmask | python | def _check_unmask(name, unmask, unmask_runtime, root=None):
'''
Common code for conditionally removing masks before making changes to a
service's state.
'''
if unmask:
unmask_(name, runtime=False, root=root)
if unmask_runtime:
unmask_(name, runtime=True, root=root) | Common code for conditionally removing masks before making changes to a
service's state. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L141-L149 | [
"def unmask_(name, runtime=False, root=None):\n '''\n .. versionadded:: 2015.5.0\n .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0\n On minions running systemd>=205, `systemd-run(1)`_ is now used to\n isolate commands run by this function from the ``salt-minion`` daemon's\n control gr... | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | _clear_context | python | def _clear_context():
'''
Remove context
'''
# Using list() here because modifying a dictionary during iteration will
# raise a RuntimeError.
for key in list(__context__):
try:
if key.startswith('systemd._systemctl_status.'):
__context__.pop(key)
excep... | Remove context | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L152-L163 | null | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | _default_runlevel | python | def _default_runlevel():
'''
Try to figure out the default runlevel. It is kept in
/etc/init/rc-sysinit.conf, but can be overridden with entries
in /etc/inittab, or via the kernel command-line at boot
'''
# Try to get the "main" default. If this fails, throw up our
# hands and just guess "... | Try to figure out the default runlevel. It is kept in
/etc/init/rc-sysinit.conf, but can be overridden with entries
in /etc/inittab, or via the kernel command-line at boot | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L166-L208 | null | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | _get_systemd_services | python | def _get_systemd_services(root):
'''
Use os.listdir() to get all the unit files
'''
ret = set()
for path in SYSTEM_CONFIG_PATHS + (LOCAL_CONFIG_PATH,):
# Make sure user has access to the path, and if the path is a
# link it's likely that another entry in SYSTEM_CONFIG_PATHS
#... | Use os.listdir() to get all the unit files | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L211-L229 | [
"def _root(path, root):\n '''\n Relocate an absolute path to a new root directory.\n '''\n if root:\n return os.path.join(root, os.path.relpath(path, os.path.sep))\n else:\n return path\n"
] | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | _get_sysv_services | python | def _get_sysv_services(root, systemd_services=None):
'''
Use os.listdir() and os.access() to get all the initscripts
'''
initscript_path = _root(INITSCRIPT_PATH, root)
try:
sysv_services = os.listdir(initscript_path)
except OSError as exc:
if exc.errno == errno.ENOENT:
... | Use os.listdir() and os.access() to get all the initscripts | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L232-L269 | [
"def _root(path, root):\n '''\n Relocate an absolute path to a new root directory.\n '''\n if root:\n return os.path.join(root, os.path.relpath(path, os.path.sep))\n else:\n return path\n",
"def _get_systemd_services(root):\n '''\n Use os.listdir() to get all the unit files\n ... | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | _get_service_exec | python | def _get_service_exec():
'''
Returns the path to the sysv service manager (either update-rc.d or
chkconfig)
'''
contextkey = 'systemd._get_service_exec'
if contextkey not in __context__:
executables = ('update-rc.d', 'chkconfig')
for executable in executables:
service... | Returns the path to the sysv service manager (either update-rc.d or
chkconfig) | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L272-L291 | null | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | _runlevel | python | def _runlevel():
'''
Return the current runlevel
'''
contextkey = 'systemd._runlevel'
if contextkey in __context__:
return __context__[contextkey]
out = __salt__['cmd.run']('runlevel', python_shell=False, ignore_retcode=True)
try:
ret = out.split()[1]
except IndexError:
... | Return the current runlevel | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L294-L308 | [
"def _default_runlevel():\n '''\n Try to figure out the default runlevel. It is kept in\n /etc/init/rc-sysinit.conf, but can be overridden with entries\n in /etc/inittab, or via the kernel command-line at boot\n '''\n # Try to get the \"main\" default. If this fails, throw up our\n # hands an... | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | _strip_scope | python | def _strip_scope(msg):
'''
Strip unnecessary message about running the command with --scope from
stderr so that we can raise an exception with the remaining stderr text.
'''
ret = []
for line in msg.splitlines():
if not line.endswith('.scope'):
ret.append(line)
return '\n... | Strip unnecessary message about running the command with --scope from
stderr so that we can raise an exception with the remaining stderr text. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L311-L320 | null | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | _systemctl_cmd | python | def _systemctl_cmd(action, name=None, systemd_scope=False, no_block=False,
root=None):
'''
Build a systemctl command line. Treat unit names without one
of the valid suffixes as a service.
'''
ret = []
if systemd_scope \
and salt.utils.systemd.has_scope(__context__)... | Build a systemctl command line. Treat unit names without one
of the valid suffixes as a service. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L323-L346 | [
"def has_scope(context=None):\n '''\n Scopes were introduced in systemd 205, this function returns a boolean\n which is true when the minion is systemd-booted and running systemd>=205.\n '''\n if not booted(context):\n return False\n _sd_version = version(context)\n if _sd_version is Non... | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | _systemctl_status | 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__[... | Helper function which leverages __context__ to keep from running 'systemctl
status' more than once. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L349-L363 | null | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | _sysv_enabled | 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... | 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. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L366-L377 | [
"def _root(path, root):\n '''\n Relocate an absolute path to a new root directory.\n '''\n if root:\n return os.path.join(root, os.path.relpath(path, os.path.sep))\n else:\n return path\n",
"def _runlevel():\n '''\n Return the current runlevel\n '''\n contextkey = 'systemd... | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | _untracked_custom_unit_found | 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))
... | If the passed service name is not available, but a unit file exist in
/etc/systemd/system, return True. Otherwise, return False. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L380-L387 | null | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | systemctl_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'),
... | .. versionadded:: 0.15.0
Reloads systemctl, an action needed whenever unit files are updated.
CLI Example:
.. code-block:: bash
salt '*' service.systemctl_reload | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L399-L420 | [
"def _clear_context():\n '''\n Remove context\n '''\n # Using list() here because modifying a dictionary during iteration will\n # raise a RuntimeError.\n for key in list(__context__):\n try:\n if key.startswith('systemd._systemctl_status.'):\n __context__.pop(key)... | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | get_running | 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... | Return a list of all running services, so far as systemd is concerned
CLI Example:
.. code-block:: bash
salt '*' service.get_running | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L423-L458 | [
"def split(orig, sep=None):\n '''\n Generator function for iterating through large strings, particularly useful\n as a replacement for str.splitlines().\n\n See http://stackoverflow.com/a/3865367\n '''\n exp = re.compile(r'\\s+' if sep is None else re.escape(sep))\n pos = 0\n length = len(or... | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | get_static | 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... | .. 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L547-L586 | [
"def split(orig, sep=None):\n '''\n Generator function for iterating through large strings, particularly useful\n as a replacement for str.splitlines().\n\n See http://stackoverflow.com/a/3865367\n '''\n exp = re.compile(r'\\s+' if sep is None else re.escape(sep))\n pos = 0\n length = len(or... | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | get_all | 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... | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L589-L604 | [
"def _get_systemd_services(root):\n '''\n Use os.listdir() to get all the unit files\n '''\n ret = set()\n for path in SYSTEM_CONFIG_PATHS + (LOCAL_CONFIG_PATH,):\n # Make sure user has access to the path, and if the path is a\n # link it's likely that another entry in SYSTEM_CONFIG_PAT... | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | unmask_ | 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... | .. 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L641-L693 | [
"def masked(name, runtime=False, root=None):\n '''\n .. versionadded:: 2015.8.0\n .. versionchanged:: 2015.8.5\n The return data for this function has changed. If the service is\n masked, the return value will now be the output of the ``systemctl\n is-enabled`` command (so that a persi... | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | mask | 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... | .. 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L696-L741 | [
"def _check_for_unit_changes(name):\n '''\n Check for modified/updated unit files, and run a daemon-reload if any are\n found.\n '''\n contextkey = 'systemd._check_for_unit_changes.{0}'.format(name)\n if contextkey not in __context__:\n if _untracked_custom_unit_found(name) or _unit_file_ch... | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | masked | 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 ... | .. 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L744-L805 | [
"def _root(path, root):\n '''\n Relocate an absolute path to a new root directory.\n '''\n if root:\n return os.path.join(root, os.path.relpath(path, os.path.sep))\n else:\n return path\n",
"def _canonical_unit_name(name):\n '''\n Build a canonical unit name treating unit names ... | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | stop | 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... | .. 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L864-L894 | [
"def _check_for_unit_changes(name):\n '''\n Check for modified/updated unit files, and run a daemon-reload if any are\n found.\n '''\n contextkey = 'systemd._check_for_unit_changes.{0}'.format(name)\n if contextkey not in __context__:\n if _untracked_custom_unit_found(name) or _unit_file_ch... | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | restart | 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... | .. 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L897-L950 | [
"def _check_for_unit_changes(name):\n '''\n Check for modified/updated unit files, and run a daemon-reload if any are\n found.\n '''\n contextkey = 'systemd._check_for_unit_changes.{0}'.format(name)\n if contextkey not in __context__:\n if _untracked_custom_unit_found(name) or _unit_file_ch... | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | status | 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*``)
... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L1070-L1107 | [
"def get_all(root=None):\n '''\n Return a list of all available services\n\n root\n Enable/disable/mask unit files in the specified root directory\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' service.get_all\n '''\n ret = _get_systemd_services(root)\n ret.update(set(_... | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | enable | 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... | .. 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L1112-L1184 | [
"def has_scope(context=None):\n '''\n Scopes were introduced in systemd 205, this function returns a boolean\n which is true when the minion is systemd-booted and running systemd>=205.\n '''\n if not booted(context):\n return False\n _sd_version = version(context)\n if _sd_version is Non... | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | disable | 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... | .. 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L1189-L1237 | [
"def has_scope(context=None):\n '''\n Scopes were introduced in systemd 205, this function returns a boolean\n which is true when the minion is systemd-booted and running systemd>=205.\n '''\n if not booted(context):\n return False\n _sd_version = version(context)\n if _sd_version is Non... | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | enabled | 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>
... | 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> | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L1242-L1276 | [
"def _root(path, root):\n '''\n Relocate an absolute path to a new root directory.\n '''\n if root:\n return os.path.join(root, os.path.relpath(path, os.path.sep))\n else:\n return path\n",
"def _get_sysv_services(root, systemd_services=None):\n '''\n Use os.listdir() and os.acc... | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | show | 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... | .. 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> | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L1295-L1326 | [
"def split(orig, sep=None):\n '''\n Generator function for iterating through large strings, particularly useful\n as a replacement for str.splitlines().\n\n See http://stackoverflow.com/a/3865367\n '''\n exp = re.compile(r'\\s+' if sep is None else re.escape(sep))\n pos = 0\n length = len(or... | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/modules/systemd_service.py | execs | 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... | .. 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L1329-L1348 | [
"def show(name, root=None):\n '''\n .. versionadded:: 2014.7.0\n\n Show properties of one or more units/jobs or the manager\n\n root\n Enable/disable/mask unit files in the specified root directory\n\n CLI Example:\n\n salt '*' service.show <service name>\n '''\n ret = {}\n out... | # -*- coding: utf-8 -*-
'''
Provides the service module for systemd
.. versionadded:: 0.10.0
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here... |
saltstack/salt | salt/states/virt.py | keys | 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... | 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 ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L51-L145 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as ... | # -*- coding: utf-8 -*-
'''
Manage virt
===========
For the key certificate this state uses the external pillar in the master to call
for the generation and signing of certificates for systems running libvirt:
.. code-block:: yaml
libvirt_keys:
virt.keys
'''
# Import Python libs
from __future__ import abs... |
saltstack/salt | salt/states/virt.py | _virt_call | 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,... | Helper to call the virt functions. Wildcards supported.
:param domain:
:param function:
:param section:
:param comment:
:return: | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L148-L184 | null | # -*- coding: utf-8 -*-
'''
Manage virt
===========
For the key certificate this state uses the external pillar in the master to call
for the generation and signing of certificates for systems running libvirt:
.. code-block:: yaml
libvirt_keys:
virt.keys
'''
# Import Python libs
from __future__ import abs... |
saltstack/salt | salt/states/virt.py | stopped | 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
... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L187-L210 | [
"def _virt_call(domain, function, section, comment,\n connection=None, username=None, password=None, **kwargs):\n '''\n Helper to call the virt functions. Wildcards supported.\n\n :param domain:\n :param function:\n :param section:\n :param comment:\n :return:\n '''\n ret = ... | # -*- coding: utf-8 -*-
'''
Manage virt
===========
For the key certificate this state uses the external pillar in the master to call
for the generation and signing of certificates for systems running libvirt:
.. code-block:: yaml
libvirt_keys:
virt.keys
'''
# Import Python libs
from __future__ import abs... |
saltstack/salt | salt/states/virt.py | powered_off | 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
.... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L213-L236 | [
"def _virt_call(domain, function, section, comment,\n connection=None, username=None, password=None, **kwargs):\n '''\n Helper to call the virt functions. Wildcards supported.\n\n :param domain:\n :param function:\n :param section:\n :param comment:\n :return:\n '''\n ret = ... | # -*- coding: utf-8 -*-
'''
Manage virt
===========
For the key certificate this state uses the external pillar in the master to call
for the generation and signing of certificates for systems running libvirt:
.. code-block:: yaml
libvirt_keys:
virt.keys
'''
# Import Python libs
from __future__ import abs... |
saltstack/salt | salt/states/virt.py | running | 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... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L239-L481 | [
"def warn_until(version,\n message,\n category=DeprecationWarning,\n stacklevel=None,\n _version_info_=None,\n _dont_call_warnings=False):\n '''\n Helper function to raise a warning, by default, a ``DeprecationWarning``,\n until the prov... | # -*- coding: utf-8 -*-
'''
Manage virt
===========
For the key certificate this state uses the external pillar in the master to call
for the generation and signing of certificates for systems running libvirt:
.. code-block:: yaml
libvirt_keys:
virt.keys
'''
# Import Python libs
from __future__ import abs... |
saltstack/salt | salt/states/virt.py | snapshot | 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... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L484-L512 | [
"def _virt_call(domain, function, section, comment,\n connection=None, username=None, password=None, **kwargs):\n '''\n Helper to call the virt functions. Wildcards supported.\n\n :param domain:\n :param function:\n :param section:\n :param comment:\n :return:\n '''\n ret = ... | # -*- coding: utf-8 -*-
'''
Manage virt
===========
For the key certificate this state uses the external pillar in the master to call
for the generation and signing of certificates for systems running libvirt:
.. code-block:: yaml
libvirt_keys:
virt.keys
'''
# Import Python libs
from __future__ import abs... |
saltstack/salt | salt/states/virt.py | rebooted | 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
... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L516-L536 | [
"def _virt_call(domain, function, section, comment,\n connection=None, username=None, password=None, **kwargs):\n '''\n Helper to call the virt functions. Wildcards supported.\n\n :param domain:\n :param function:\n :param section:\n :param comment:\n :return:\n '''\n ret = ... | # -*- coding: utf-8 -*-
'''
Manage virt
===========
For the key certificate this state uses the external pillar in the master to call
for the generation and signing of certificates for systems running libvirt:
.. code-block:: yaml
libvirt_keys:
virt.keys
'''
# Import Python libs
from __future__ import abs... |
saltstack/salt | salt/states/virt.py | reverted | 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... | .. 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L580-L636 | null | # -*- coding: utf-8 -*-
'''
Manage virt
===========
For the key certificate this state uses the external pillar in the master to call
for the generation and signing of certificates for systems running libvirt:
.. code-block:: yaml
libvirt_keys:
virt.keys
'''
# Import Python libs
from __future__ import abs... |
saltstack/salt | salt/states/virt.py | network_running | python | def network_running(name,
bridge,
forward,
vport=None,
tag=None,
autostart=True,
connection=None,
username=None,
password=None):
'''
Defines and starts ... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L639-L709 | null | # -*- coding: utf-8 -*-
'''
Manage virt
===========
For the key certificate this state uses the external pillar in the master to call
for the generation and signing of certificates for systems running libvirt:
.. code-block:: yaml
libvirt_keys:
virt.keys
'''
# Import Python libs
from __future__ import abs... |
saltstack/salt | salt/states/virt.py | pool_running | python | def pool_running(name,
ptype=None,
target=None,
permissions=None,
source=None,
transient=False,
autostart=True,
connection=None,
username=None,
password=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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L712-L826 | null | # -*- coding: utf-8 -*-
'''
Manage virt
===========
For the key certificate this state uses the external pillar in the master to call
for the generation and signing of certificates for systems running libvirt:
.. code-block:: yaml
libvirt_keys:
virt.keys
'''
# Import Python libs
from __future__ import abs... |
saltstack/salt | salt/modules/runit.py | status | 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... | 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> | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L206-L240 | [
"def _service_path(name):\n '''\n Return SERVICE_DIR+name if possible\n\n name\n the service's name to work on\n '''\n if not SERVICE_DIR:\n raise CommandExecutionError('Could not find service directory.')\n return os.path.join(SERVICE_DIR, name)\n"
] | # -*- coding: utf-8 -*-
'''
runit service module
(http://smarden.org/runit)
This module is compatible with the :mod:`service <salt.states.service>` states,
so it can be used to maintain services using the ``provider`` argument:
.. code-block:: yaml
myservice:
service:
- running
- provider: ... |
saltstack/salt | salt/modules/runit.py | _is_svc | 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... | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L243-L256 | null | # -*- coding: utf-8 -*-
'''
runit service module
(http://smarden.org/runit)
This module is compatible with the :mod:`service <salt.states.service>` states,
so it can be used to maintain services using the ``provider`` argument:
.. code-block:: yaml
myservice:
service:
- running
- provider: ... |
saltstack/salt | salt/modules/runit.py | 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 ... | 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> | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L259-L274 | [
"def _service_path(name):\n '''\n Return SERVICE_DIR+name if possible\n\n name\n the service's name to work on\n '''\n if not SERVICE_DIR:\n raise CommandExecutionError('Could not find service directory.')\n return os.path.join(SERVICE_DIR, name)\n"
] | # -*- coding: utf-8 -*-
'''
runit service module
(http://smarden.org/runit)
This module is compatible with the :mod:`service <salt.states.service>` states,
so it can be used to maintain services using the ``provider`` argument:
.. code-block:: yaml
myservice:
service:
- running
- provider: ... |
saltstack/salt | salt/modules/runit.py | get_svc_broken_path | 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_... | 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> | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L277-L300 | null | # -*- coding: utf-8 -*-
'''
runit service module
(http://smarden.org/runit)
This module is compatible with the :mod:`service <salt.states.service>` states,
so it can be used to maintain services using the ``provider`` argument:
.. code-block:: yaml
myservice:
service:
- running
- provider: ... |
saltstack/salt | salt/modules/runit.py | add_svc_avail_path | 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... | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L310-L322 | null | # -*- coding: utf-8 -*-
'''
runit service module
(http://smarden.org/runit)
This module is compatible with the :mod:`service <salt.states.service>` states,
so it can be used to maintain services using the ``provider`` argument:
.. code-block:: yaml
myservice:
service:
- running
- provider: ... |
saltstack/salt | salt/modules/runit.py | _get_svc_path | 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 ... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L325-L374 | null | # -*- coding: utf-8 -*-
'''
runit service module
(http://smarden.org/runit)
This module is compatible with the :mod:`service <salt.states.service>` states,
so it can be used to maintain services using the ``provider`` argument:
.. code-block:: yaml
myservice:
service:
- running
- provider: ... |
saltstack/salt | salt/modules/runit.py | _get_svc_list | 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
... | 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 ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L377-L389 | [
"def _get_svc_path(name='*', status=None):\n '''\n Return a list of paths to services with ``name`` that have the specified ``status``\n\n name\n a glob for service name. default is '*'\n\n status\n None : all services (no filter, default choice)\n 'DISABLED' : available servi... | # -*- coding: utf-8 -*-
'''
runit service module
(http://smarden.org/runit)
This module is compatible with the :mod:`service <salt.states.service>` states,
so it can be used to maintain services using the ``provider`` argument:
.. code-block:: yaml
myservice:
service:
- running
- provider: ... |
saltstack/salt | salt/modules/runit.py | get_svc_alias | 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)
... | Returns the list of service's name that are aliased and their alias path(s) | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L392-L409 | null | # -*- coding: utf-8 -*-
'''
runit service module
(http://smarden.org/runit)
This module is compatible with the :mod:`service <salt.states.service>` states,
so it can be used to maintain services using the ``provider`` argument:
.. code-block:: yaml
myservice:
service:
- running
- provider: ... |
saltstack/salt | salt/modules/runit.py | show | 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
... | Show properties of one or more units/jobs or the manager
name
the service's name
CLI Example:
salt '*' service.show <service name> | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L520-L553 | [
"def status(name, sig=None):\n '''\n Return ``True`` if service is running\n\n name\n the service's name\n\n sig\n signature to identify with ps\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' runit.status <service name>\n '''\n if sig:\n # usual way to do ... | # -*- coding: utf-8 -*-
'''
runit service module
(http://smarden.org/runit)
This module is compatible with the :mod:`service <salt.states.service>` states,
so it can be used to maintain services using the ``provider`` argument:
.. code-block:: yaml
myservice:
service:
- running
- provider: ... |
saltstack/salt | salt/modules/runit.py | 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 <... | 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] | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L556-L648 | [
"def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ... | # -*- coding: utf-8 -*-
'''
runit service module
(http://smarden.org/runit)
This module is compatible with the :mod:`service <salt.states.service>` states,
so it can be used to maintain services using the ``provider`` argument:
.. code-block:: yaml
myservice:
service:
- running
- provider: ... |
saltstack/salt | salt/modules/runit.py | disable | 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... | 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] | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L651-L687 | [
"def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ... | # -*- coding: utf-8 -*-
'''
runit service module
(http://smarden.org/runit)
This module is compatible with the :mod:`service <salt.states.service>` states,
so it can be used to maintain services using the ``provider`` argument:
.. code-block:: yaml
myservice:
service:
- running
- provider: ... |
saltstack/salt | salt/modules/runit.py | remove | 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):
... | 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> | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L690-L722 | [
"def stop(name):\n '''\n Stop service\n\n name\n the service's name\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' runit.stop <service name>\n '''\n cmd = 'sv stop {0}'.format(_service_path(name))\n return not __salt__['cmd.retcode'](cmd)\n",
"def enabled(name):\n ... | # -*- coding: utf-8 -*-
'''
runit service module
(http://smarden.org/runit)
This module is compatible with the :mod:`service <salt.states.service>` states,
so it can be used to maintain services using the ``provider`` argument:
.. code-block:: yaml
myservice:
service:
- running
- provider: ... |
saltstack/salt | salt/pillar/s3.py | ext_pillar | 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='',
... | Execute a command and read the output as YAML | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/s3.py#L129-L189 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def _init(creds, bucket, multiple_env, environment, prefix, s3_cache_expire):\n '''\n Connect to S3 and download the metadata for each file in all buckets\n specified and cache the data to disk.\n '''\n\n cache_file = _get_buckets_cache_fi... | # -*- coding: utf-8 -*-
'''
Copy pillar data from a bucket in Amazon S3
The S3 pillar can be configured in the master config file with the following
options
.. code-block:: yaml
ext_pillar:
- s3:
bucket: my.fancy.pillar.bucket
keyid: KASKFJWAKJASJKDAJKSD
key: ksladfDLKDALSFKSD... |
saltstack/salt | salt/pillar/s3.py | _init | 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... | Connect to S3 and download the metadata for each file in all buckets
specified and cache the data to disk. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/s3.py#L192-L225 | null | # -*- coding: utf-8 -*-
'''
Copy pillar data from a bucket in Amazon S3
The S3 pillar can be configured in the master config file with the following
options
.. code-block:: yaml
ext_pillar:
- s3:
bucket: my.fancy.pillar.bucket
keyid: KASKFJWAKJASJKDAJKSD
key: ksladfDLKDALSFKSD... |
saltstack/salt | salt/pillar/s3.py | _get_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 | Get pillar cache directory. Initialize it if it does not exist. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/s3.py#L228-L239 | null | # -*- coding: utf-8 -*-
'''
Copy pillar data from a bucket in Amazon S3
The S3 pillar can be configured in the master config file with the following
options
.. code-block:: yaml
ext_pillar:
- s3:
bucket: my.fancy.pillar.bucket
keyid: KASKFJWAKJASJKDAJKSD
key: ksladfDLKDALSFKSD... |
saltstack/salt | salt/pillar/s3.py | _get_buckets_cache_filename | 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... | Return the filename of the cache for bucket contents.
Create the path if it does not exist. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/s3.py#L256-L266 | null | # -*- coding: utf-8 -*-
'''
Copy pillar data from a bucket in Amazon S3
The S3 pillar can be configured in the master config file with the following
options
.. code-block:: yaml
ext_pillar:
- s3:
bucket: my.fancy.pillar.bucket
keyid: KASKFJWAKJASJKDAJKSD
key: ksladfDLKDALSFKSD... |
saltstack/salt | salt/pillar/s3.py | _refresh_buckets_cache_file | 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,
... | Retrieve the content of all buckets and cache the metadata to the buckets
cache file | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/s3.py#L269-L349 | null | # -*- coding: utf-8 -*-
'''
Copy pillar data from a bucket in Amazon S3
The S3 pillar can be configured in the master config file with the following
options
.. code-block:: yaml
ext_pillar:
- s3:
bucket: my.fancy.pillar.bucket
keyid: KASKFJWAKJASJKDAJKSD
key: ksladfDLKDALSFKSD... |
saltstack/salt | salt/pillar/s3.py | _read_buckets_cache_file | 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 | Return the contents of the buckets cache file | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/s3.py#L352-L362 | null | # -*- coding: utf-8 -*-
'''
Copy pillar data from a bucket in Amazon S3
The S3 pillar can be configured in the master config file with the following
options
.. code-block:: yaml
ext_pillar:
- s3:
bucket: my.fancy.pillar.bucket
keyid: KASKFJWAKJASJKDAJKSD
key: ksladfDLKDALSFKSD... |
saltstack/salt | salt/pillar/s3.py | _find_files | 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]
... | Looks for all the files in the S3 bucket cache metadata | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/s3.py#L365-L381 | null | # -*- coding: utf-8 -*-
'''
Copy pillar data from a bucket in Amazon S3
The S3 pillar can be configured in the master config file with the following
options
.. code-block:: yaml
ext_pillar:
- s3:
bucket: my.fancy.pillar.bucket
keyid: KASKFJWAKJASJKDAJKSD
key: ksladfDLKDALSFKSD... |
saltstack/salt | salt/pillar/s3.py | _get_file_from_s3 | 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... | Checks the local cache for the file, if it's old or missing go grab the
file from S3 and update the cache | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/s3.py#L398-L432 | null | # -*- coding: utf-8 -*-
'''
Copy pillar data from a bucket in Amazon S3
The S3 pillar can be configured in the master config file with the following
options
.. code-block:: yaml
ext_pillar:
- s3:
bucket: my.fancy.pillar.bucket
keyid: KASKFJWAKJASJKDAJKSD
key: ksladfDLKDALSFKSD... |
saltstack/salt | salt/modules/logadm.py | _arg2opt | 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 | Turn a pass argument into the correct option | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L61-L67 | null | # -*- coding: utf-8 -*-
'''
Module for managing Solaris logadm based log rotations.
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import python libs
import logging
import shlex
try:
from shlex import quote as _quote_args # pylint: disable=E0611
except ImportError:
from pipes i... |
saltstack/salt | salt/modules/logadm.py | _parse_conf | 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
... | Parse a logadm configuration file. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L70-L84 | [
"def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ... | # -*- coding: utf-8 -*-
'''
Module for managing Solaris logadm based log rotations.
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import python libs
import logging
import shlex
try:
from shlex import quote as _quote_args # pylint: disable=E0611
except ImportError:
from pipes i... |
saltstack/salt | salt/modules/logadm.py | _parse_options | 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... | Parse a logadm options string | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L87-L152 | null | # -*- coding: utf-8 -*-
'''
Module for managing Solaris logadm based log rotations.
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import python libs
import logging
import shlex
try:
from shlex import quote as _quote_args # pylint: disable=E0611
except ImportError:
from pipes i... |
saltstack/salt | salt/modules/logadm.py | show_conf | 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... | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L155-L179 | [
"def _parse_conf(conf_file=default_conf):\n '''\n Parse a logadm configuration file.\n '''\n ret = {}\n with salt.utils.files.fopen(conf_file, 'r') as ifile:\n for line in ifile:\n line = salt.utils.stringutils.to_unicode(line).strip()\n if not line:\n cont... | # -*- coding: utf-8 -*-
'''
Module for managing Solaris logadm based log rotations.
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import python libs
import logging
import shlex
try:
from shlex import quote as _quote_args # pylint: disable=E0611
except ImportError:
from pipes i... |
saltstack/salt | salt/modules/logadm.py | list_conf | 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
... | 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
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L182-L217 | [
"def _parse_conf(conf_file=default_conf):\n '''\n Parse a logadm configuration file.\n '''\n ret = {}\n with salt.utils.files.fopen(conf_file, 'r') as ifile:\n for line in ifile:\n line = salt.utils.stringutils.to_unicode(line).strip()\n if not line:\n cont... | # -*- coding: utf-8 -*-
'''
Module for managing Solaris logadm based log rotations.
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import python libs
import logging
import shlex
try:
from shlex import quote as _quote_args # pylint: disable=E0611
except ImportError:
from pipes i... |
saltstack/salt | salt/modules/logadm.py | show_args | 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] ... | Show which arguments map to which flags and options.
.. versionadded:: 2018.3.0
CLI Example:
.. code-block:: bash
salt '*' logadm.show_args | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L221-L239 | null | # -*- coding: utf-8 -*-
'''
Module for managing Solaris logadm based log rotations.
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import python libs
import logging
import shlex
try:
from shlex import quote as _quote_args # pylint: disable=E0611
except ImportError:
from pipes i... |
saltstack/salt | salt/modules/logadm.py | rotate | 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
... | 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 `... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L242-L323 | [
"def clean_kwargs(**kwargs):\n '''\n Return a dict without any of the __pub* keys (or any other keys starting\n with a dunder) from the kwargs dict passed into the execution module\n functions. These keys are useful for tracking what was used to invoke\n the function call, but they may not be desirab... | # -*- coding: utf-8 -*-
'''
Module for managing Solaris logadm based log rotations.
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import python libs
import logging
import shlex
try:
from shlex import quote as _quote_args # pylint: disable=E0611
except ImportError:
from pipes i... |
saltstack/salt | salt/modules/logadm.py | remove | 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... | Remove log pattern from logadm
CLI Example:
.. code-block:: bash
salt '*' logadm.remove myapplog | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L326-L343 | null | # -*- coding: utf-8 -*-
'''
Module for managing Solaris logadm based log rotations.
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import python libs
import logging
import shlex
try:
from shlex import quote as _quote_args # pylint: disable=E0611
except ImportError:
from pipes i... |
saltstack/salt | salt/utils/locales.py | get_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:
... | return a list of string encodings to try | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/locales.py#L16-L33 | null | # -*- coding: utf-8 -*-
'''
the locale utils used by salt
'''
# Import Python libs
from __future__ import absolute_import, unicode_literals
import sys
# Import Salt libs
import salt.utils.versions
from salt.utils.decorators import memoize as real_memoize
@real_memoize
def sdecode(string_):
salt.utils.version... |
saltstack/salt | salt/utils/locales.py | split_locale | 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
... | Split a locale specifier. The general format is
language[_territory][.codeset][@modifier] [charmap]
For example:
ca_ES.UTF-8@valencia UTF-8 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/locales.py#L58-L83 | [
"def split(st, char):\n '''\n Split a string `st` once by `char`; always return a two-element list\n even if the second element is empty.\n '''\n split_st = st.split(char, 1)\n if len(split_st) == 1:\n split_st.append('')\n return split_st\n"
] | # -*- coding: utf-8 -*-
'''
the locale utils used by salt
'''
# Import Python libs
from __future__ import absolute_import, unicode_literals
import sys
# Import Salt libs
import salt.utils.versions
from salt.utils.decorators import memoize as real_memoize
@real_memoize
def get_encodings():
'''
return a list ... |
saltstack/salt | salt/utils/locales.py | join_locale | 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... | Join a locale specifier split in the format returned by split_locale. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/locales.py#L86-L99 | null | # -*- coding: utf-8 -*-
'''
the locale utils used by salt
'''
# Import Python libs
from __future__ import absolute_import, unicode_literals
import sys
# Import Salt libs
import salt.utils.versions
from salt.utils.decorators import memoize as real_memoize
@real_memoize
def get_encodings():
'''
return a list ... |
saltstack/salt | salt/utils/locales.py | normalize_locale | 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... | Format a locale specifier according to the format returned by `locale -a`. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/locales.py#L102-L110 | [
"def split_locale(loc):\n '''\n Split a locale specifier. The general format is\n\n language[_territory][.codeset][@modifier] [charmap]\n\n For example:\n\n ca_ES.UTF-8@valencia UTF-8\n '''\n def split(st, char):\n '''\n Split a string `st` once by `char`; always return a two-ele... | # -*- coding: utf-8 -*-
'''
the locale utils used by salt
'''
# Import Python libs
from __future__ import absolute_import, unicode_literals
import sys
# Import Salt libs
import salt.utils.versions
from salt.utils.decorators import memoize as real_memoize
@real_memoize
def get_encodings():
'''
return a list ... |
saltstack/salt | salt/returners/mongo_return.py | _remove_dots | 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 | Remove dots from the given data structure | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mongo_return.py#L96-L105 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def _remove_dots(src):\n '''\n Remove dots from the given data structure\n '''\n output = {}\n for key, val in six.iteritems(src):\n if isinstance(val, dict):\n val = _remove_dots(val)\n output[key.replace('.', '-'... | # -*- coding: utf-8 -*-
'''
Return data to a mongodb server
Required python modules: pymongo
This returner will send data from the minions to a MongoDB server. To
configure the settings for your MongoDB server, add the following lines
to the minion config files.
.. code-block:: yaml
mongo.db: <database name>
... |
saltstack/salt | salt/returners/mongo_return.py | _get_conn | 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)
... | Return a mongodb connection object | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mongo_return.py#L127-L165 | [
"def _get_options(ret):\n '''\n Get the monogo_return options from salt.\n '''\n attrs = {'host': 'host',\n 'port': 'port',\n 'db': 'db',\n 'user': 'user',\n 'password': 'password',\n 'indexes': 'indexes'}\n\n _options = salt.returners.get_r... | # -*- coding: utf-8 -*-
'''
Return data to a mongodb server
Required python modules: pymongo
This returner will send data from the minions to a MongoDB server. To
configure the settings for your MongoDB server, add the following lines
to the minion config files.
.. code-block:: yaml
mongo.db: <database name>
... |
saltstack/salt | salt/returners/mongo_return.py | get_jid | 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... | Return the return information associated with a jid | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mongo_return.py#L203-L215 | [
"def _get_conn(ret):\n '''\n Return a mongodb connection object\n '''\n _options = _get_options(ret)\n\n host = _options.get('host')\n port = _options.get('port')\n db_ = _options.get('db')\n user = _options.get('user')\n password = _options.get('password')\n indexes = _options.get('in... | # -*- coding: utf-8 -*-
'''
Return data to a mongodb server
Required python modules: pymongo
This returner will send data from the minions to a MongoDB server. To
configure the settings for your MongoDB server, add the following lines
to the minion config files.
.. code-block:: yaml
mongo.db: <database name>
... |
saltstack/salt | salt/returners/mongo_return.py | get_fun | 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 | Return the most recent jobs that have executed the named function | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mongo_return.py#L218-L227 | [
"def _get_conn(ret):\n '''\n Return a mongodb connection object\n '''\n _options = _get_options(ret)\n\n host = _options.get('host')\n port = _options.get('port')\n db_ = _options.get('db')\n user = _options.get('user')\n password = _options.get('password')\n indexes = _options.get('in... | # -*- coding: utf-8 -*-
'''
Return data to a mongodb server
Required python modules: pymongo
This returner will send data from the minions to a MongoDB server. To
configure the settings for your MongoDB server, add the following lines
to the minion config files.
.. code-block:: yaml
mongo.db: <database name>
... |
saltstack/salt | salt/modules/acme.py | _cert_file | 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)) | Return expected path of a Let's Encrypt live cert | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/acme.py#L64-L68 | null | # -*- coding: utf-8 -*-
'''
ACME / Let's Encrypt module
===========================
.. versionadded: 2016.3
This module currently looks for certbot script in the $PATH as
- certbot,
- lestsencrypt,
- certbot-auto,
- letsencrypt-auto
eventually falls back to /opt/letsencrypt/letsencrypt-auto
.. note::
Installati... |
saltstack/salt | salt/modules/acme.py | _expires | 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... | Return the expiry date of a cert
:return datetime object of expiry date | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/acme.py#L71-L89 | [
"def _cert_file(name, cert_type):\n '''\n Return expected path of a Let's Encrypt live cert\n '''\n return os.path.join(LE_LIVE, name, '{0}.pem'.format(cert_type))\n"
] | # -*- coding: utf-8 -*-
'''
ACME / Let's Encrypt module
===========================
.. versionadded: 2016.3
This module currently looks for certbot script in the $PATH as
- certbot,
- lestsencrypt,
- certbot-auto,
- letsencrypt-auto
eventually falls back to /opt/letsencrypt/letsencrypt-auto
.. note::
Installati... |
saltstack/salt | salt/modules/acme.py | _renew_by | 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 ... | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/acme.py#L92-L104 | [
"def _expires(name):\n '''\n Return the expiry date of a cert\n\n :return datetime object of expiry date\n '''\n cert_file = _cert_file(name, 'cert')\n # Use the salt module if available\n if 'tls.cert_info' in __salt__:\n expiry = __salt__['tls.cert_info'](cert_file)['not_after']\n #... | # -*- coding: utf-8 -*-
'''
ACME / Let's Encrypt module
===========================
.. versionadded: 2016.3
This module currently looks for certbot script in the $PATH as
- certbot,
- lestsencrypt,
- certbot-auto,
- letsencrypt-auto
eventually falls back to /opt/letsencrypt/letsencrypt-auto
.. note::
Installati... |
saltstack/salt | salt/modules/acme.py | cert | 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... | 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 ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/acme.py#L107-L258 | [
"def _cert_file(name, cert_type):\n '''\n Return expected path of a Let's Encrypt live cert\n '''\n return os.path.join(LE_LIVE, name, '{0}.pem'.format(cert_type))\n",
"def needs_renewal(name, window=None):\n '''\n Check if a certificate needs renewal\n\n :param name: CommonName of cert\n ... | # -*- coding: utf-8 -*-
'''
ACME / Let's Encrypt module
===========================
.. versionadded: 2016.3
This module currently looks for certbot script in the $PATH as
- certbot,
- lestsencrypt,
- certbot-auto,
- letsencrypt-auto
eventually falls back to /opt/letsencrypt/letsencrypt-auto
.. note::
Installati... |
saltstack/salt | salt/modules/acme.py | info | 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... | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/acme.py#L274-L300 | [
"def _cert_file(name, cert_type):\n '''\n Return expected path of a Let's Encrypt live cert\n '''\n return os.path.join(LE_LIVE, name, '{0}.pem'.format(cert_type))\n"
] | # -*- coding: utf-8 -*-
'''
ACME / Let's Encrypt module
===========================
.. versionadded: 2016.3
This module currently looks for certbot script in the $PATH as
- certbot,
- lestsencrypt,
- certbot-auto,
- letsencrypt-auto
eventually falls back to /opt/letsencrypt/letsencrypt-auto
.. note::
Installati... |
saltstack/salt | salt/modules/acme.py | needs_renewal | 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'):
... | 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'... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/acme.py#L344-L363 | [
"def _renew_by(name, window=None):\n '''\n Date before a certificate should be renewed\n\n :param name: Common Name of the certificate (DNS name of certificate)\n :param window: days before expiry date to renew\n :return datetime object of first renewal date\n '''\n expiry = _expires(name)\n ... | # -*- coding: utf-8 -*-
'''
ACME / Let's Encrypt module
===========================
.. versionadded: 2016.3
This module currently looks for certbot script in the $PATH as
- certbot,
- lestsencrypt,
- certbot-auto,
- letsencrypt-auto
eventually falls back to /opt/letsencrypt/letsencrypt-auto
.. note::
Installati... |
saltstack/salt | salt/modules/drbd.py | _analyse_overview_field | 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"
... | Split the field in drbd-overview | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L13-L24 | null | # -*- coding: utf-8 -*-
'''
DRBD administration module
'''
from __future__ import absolute_import, print_function, unicode_literals
import logging
from salt.ext import six
log = logging.getLogger(__name__)
def _count_spaces_startswith(line):
'''
Count the number of spaces before the first character
'''... |
saltstack/salt | salt/modules/drbd.py | _count_spaces_startswith | 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 | Count the number of spaces before the first character | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L27-L39 | null | # -*- coding: utf-8 -*-
'''
DRBD administration module
'''
from __future__ import absolute_import, print_function, unicode_literals
import logging
from salt.ext import six
log = logging.getLogger(__name__)
def _analyse_overview_field(content):
'''
Split the field in drbd-overview
'''
if "(" in conte... |
saltstack/salt | salt/modules/drbd.py | _analyse_status_type | 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... | Figure out the sections in drbdadm status | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L42-L67 | null | # -*- coding: utf-8 -*-
'''
DRBD administration module
'''
from __future__ import absolute_import, print_function, unicode_literals
import logging
from salt.ext import six
log = logging.getLogger(__name__)
def _analyse_overview_field(content):
'''
Split the field in drbd-overview
'''
if "(" in conte... |
saltstack/salt | salt/modules/drbd.py | _add_res | 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]
... | Analyse the line of local resource of ``drbdadm status`` | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L70-L84 | null | # -*- coding: utf-8 -*-
'''
DRBD administration module
'''
from __future__ import absolute_import, print_function, unicode_literals
import logging
from salt.ext import six
log = logging.getLogger(__name__)
def _analyse_overview_field(content):
'''
Split the field in drbd-overview
'''
if "(" in conte... |
saltstack/salt | salt/modules/drbd.py | _add_volume | 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... | Analyse the line of volumes of ``drbdadm status`` | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L87-L102 | null | # -*- coding: utf-8 -*-
'''
DRBD administration module
'''
from __future__ import absolute_import, print_function, unicode_literals
import logging
from salt.ext import six
log = logging.getLogger(__name__)
def _analyse_overview_field(content):
'''
Split the field in drbd-overview
'''
if "(" in conte... |
saltstack/salt | salt/modules/drbd.py | _add_peernode | 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]
... | Analyse the line of peer nodes of ``drbdadm status`` | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L105-L119 | null | # -*- coding: utf-8 -*-
'''
DRBD administration module
'''
from __future__ import absolute_import, print_function, unicode_literals
import logging
from salt.ext import six
log = logging.getLogger(__name__)
def _analyse_overview_field(content):
'''
Split the field in drbd-overview
'''
if "(" in conte... |
saltstack/salt | salt/modules/drbd.py | _line_parser | 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,
... | Call action for different lines | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L137-L154 | [
"def _analyse_status_type(line):\n '''\n Figure out the sections in drbdadm status\n '''\n spaces = _count_spaces_startswith(line)\n\n if spaces is None:\n return ''\n\n switch = {\n 0: 'RESOURCE',\n 2: {' disk:': 'LOCALDISK', ' role:': 'PEERNODE', ' connection:': 'PEERNODE'},... | # -*- coding: utf-8 -*-
'''
DRBD administration module
'''
from __future__ import absolute_import, print_function, unicode_literals
import logging
from salt.ext import six
log = logging.getLogger(__name__)
def _analyse_overview_field(content):
'''
Split the field in drbd-overview
'''
if "(" in conte... |
saltstack/salt | salt/modules/drbd.py | overview | 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... | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L157-L228 | [
"def _analyse_overview_field(content):\n '''\n Split the field in drbd-overview\n '''\n if \"(\" in content:\n # Output like \"Connected(2*)\" or \"UpToDate(2*)\"\n return content.split(\"(\")[0], content.split(\"(\")[0]\n elif \"/\" in content:\n # Output like \"Primar/Second\" ... | # -*- coding: utf-8 -*-
'''
DRBD administration module
'''
from __future__ import absolute_import, print_function, unicode_literals
import logging
from salt.ext import six
log = logging.getLogger(__name__)
def _analyse_overview_field(content):
'''
Split the field in drbd-overview
'''
if "(" in conte... |
saltstack/salt | salt/modules/drbd.py | status | 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:
..... | 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 '*'... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L237-L283 | [
"def _line_parser(line):\n '''\n Call action for different lines\n '''\n section = _analyse_status_type(line)\n fields = line.strip().split()\n\n switch = {\n '': _empty,\n 'RESOURCE': _add_res,\n 'PEERNODE': _add_peernode,\n 'LOCALDISK': _add_volume,\n 'PEERDISK... | # -*- coding: utf-8 -*-
'''
DRBD administration module
'''
from __future__ import absolute_import, print_function, unicode_literals
import logging
from salt.ext import six
log = logging.getLogger(__name__)
def _analyse_overview_field(content):
'''
Split the field in drbd-overview
'''
if "(" in conte... |
saltstack/salt | salt/modules/rdp.py | _parse_return_code_powershell | 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)) | return from the input string the return code of the powershell command | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rdp.py#L34-L43 | null | # -*- coding: utf-8 -*-
'''
Manage RDP Service on Windows servers
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging
import re
# Import Salt libs
import salt.utils.platform
from salt.utils.decorators import depends
try:
from pywintypes import error as... |
saltstack/salt | salt/modules/rdp.py | _psrdp | 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... | Create a Win32_TerminalServiceSetting WMI Object as $RDP and execute the
command cmd returns the STDOUT of the command | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rdp.py#L46-L55 | null | # -*- coding: utf-8 -*-
'''
Manage RDP Service on Windows servers
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging
import re
# Import Salt libs
import salt.utils.platform
from salt.utils.decorators import depends
try:
from pywintypes import error as... |
saltstack/salt | salt/modules/rdp.py | list_sessions | 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:... | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rdp.py#L104-L151 | null | # -*- coding: utf-8 -*-
'''
Manage RDP Service on Windows servers
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging
import re
# Import Salt libs
import salt.utils.platform
from salt.utils.decorators import depends
try:
from pywintypes import error as... |
saltstack/salt | salt/modules/rdp.py | get_session | 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... | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rdp.py#L155-L181 | null | # -*- coding: utf-8 -*-
'''
Manage RDP Service on Windows servers
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging
import re
# Import Salt libs
import salt.utils.platform
from salt.utils.decorators import depends
try:
from pywintypes import error as... |
saltstack/salt | salt/modules/rdp.py | disconnect_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... | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rdp.py#L185-L207 | null | # -*- coding: utf-8 -*-
'''
Manage RDP Service on Windows servers
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging
import re
# Import Salt libs
import salt.utils.platform
from salt.utils.decorators import depends
try:
from pywintypes import error as... |
saltstack/salt | salt/modules/rdp.py | logoff_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... | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rdp.py#L211-L233 | null | # -*- coding: utf-8 -*-
'''
Manage RDP Service on Windows servers
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging
import re
# Import Salt libs
import salt.utils.platform
from salt.utils.decorators import depends
try:
from pywintypes import error as... |
saltstack/salt | salt/runners/fileserver.py | envs | 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
... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L11-L39 | [
"def envs(self, back=None, sources=False):\n '''\n Return the environments for the named backend or all backends\n '''\n back = self.backends(back)\n ret = set()\n if sources:\n ret = {}\n for fsb in back:\n fstr = '{0}.envs'.format(fsb)\n kwargs = {'ignore_cache': True} \\... | # -*- coding: utf-8 -*-
'''
Directly manage the Salt fileserver plugins
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt libs
import salt.fileserver
def clear_file_list_cache(saltenv=None, backend=None):
'''
.. versionadded:: 2016.11.0
The Salt fileserver cache... |
saltstack/salt | salt/runners/fileserver.py | clear_file_list_cache | 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... | .. 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L42-L147 | [
"def clear_file_list_cache(self, load):\n '''\n Deletes the file_lists cache files\n '''\n if 'env' in load:\n # \"env\" is not supported; Use \"saltenv\".\n load.pop('env')\n\n saltenv = load.get('saltenv', [])\n if saltenv is not None:\n if not isinstance(saltenv, list):\n ... | # -*- coding: utf-8 -*-
'''
Directly manage the Salt fileserver plugins
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt libs
import salt.fileserver
def envs(backend=None, sources=False):
'''
Return the available fileserver environments. If no backend is provided,
... |
saltstack/salt | salt/runners/fileserver.py | file_list | 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 (``-``... | 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 ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L150-L193 | null | # -*- coding: utf-8 -*-
'''
Directly manage the Salt fileserver plugins
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt libs
import salt.fileserver
def envs(backend=None, sources=False):
'''
Return the available fileserver environments. If no backend is provided,
... |
saltstack/salt | salt/runners/fileserver.py | symlink_list | 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 (``-``), ... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L196-L239 | null | # -*- coding: utf-8 -*-
'''
Directly manage the Salt fileserver plugins
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt libs
import salt.fileserver
def envs(backend=None, sources=False):
'''
Return the available fileserver environments. If no backend is provided,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.