id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
33,000 | saltstack/salt | salt/modules/nxos.py | show_run | def show_run(**kwargs):
'''
Shortcut to run `show running-config` on the NX-OS device.
.. code-block:: bash
salt '*' nxos.cmd show_run
'''
command = 'show running-config'
info = ''
info = show(command, **kwargs)
if isinstance(info, list):
info = info[0]
return info | python | def show_run(**kwargs):
'''
Shortcut to run `show running-config` on the NX-OS device.
.. code-block:: bash
salt '*' nxos.cmd show_run
'''
command = 'show running-config'
info = ''
info = show(command, **kwargs)
if isinstance(info, list):
info = info[0]
return info | [
"def",
"show_run",
"(",
"*",
"*",
"kwargs",
")",
":",
"command",
"=",
"'show running-config'",
"info",
"=",
"''",
"info",
"=",
"show",
"(",
"command",
",",
"*",
"*",
"kwargs",
")",
"if",
"isinstance",
"(",
"info",
",",
"list",
")",
":",
"info",
"=",
... | Shortcut to run `show running-config` on the NX-OS device.
.. code-block:: bash
salt '*' nxos.cmd show_run | [
"Shortcut",
"to",
"run",
"show",
"running",
"-",
"config",
"on",
"the",
"NX",
"-",
"OS",
"device",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L407-L420 |
33,001 | saltstack/salt | salt/modules/nxos.py | delete_config | def delete_config(lines, **kwargs):
'''
Delete one or more config lines to the switch running config.
lines
Configuration lines to remove.
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startup configuration.
... | python | def delete_config(lines, **kwargs):
'''
Delete one or more config lines to the switch running config.
lines
Configuration lines to remove.
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startup configuration.
... | [
"def",
"delete_config",
"(",
"lines",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"lines",
",",
"list",
")",
":",
"lines",
"=",
"[",
"lines",
"]",
"for",
"i",
",",
"_",
"in",
"enumerate",
"(",
"lines",
")",
":",
"lines",
"[... | Delete one or more config lines to the switch running config.
lines
Configuration lines to remove.
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startup configuration.
Default: False
.. code-block:: bash... | [
"Delete",
"one",
"or",
"more",
"config",
"lines",
"to",
"the",
"switch",
"running",
"config",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L573-L604 |
33,002 | saltstack/salt | salt/modules/nxos.py | set_password | def set_password(username,
password,
encrypted=False,
role=None,
crypt_salt=None,
algorithm='sha256',
**kwargs):
'''
Set users password on switch.
username
Username to configure
password
... | python | def set_password(username,
password,
encrypted=False,
role=None,
crypt_salt=None,
algorithm='sha256',
**kwargs):
'''
Set users password on switch.
username
Username to configure
password
... | [
"def",
"set_password",
"(",
"username",
",",
"password",
",",
"encrypted",
"=",
"False",
",",
"role",
"=",
"None",
",",
"crypt_salt",
"=",
"None",
",",
"algorithm",
"=",
"'sha256'",
",",
"*",
"*",
"kwargs",
")",
":",
"password_line",
"=",
"get_user",
"("... | Set users password on switch.
username
Username to configure
password
Password to configure for username
encrypted
Whether or not to encrypt the password
Default: False
role
Configure role for the username
Default: None
crypt_salt
Configur... | [
"Set",
"users",
"password",
"on",
"switch",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L667-L723 |
33,003 | saltstack/salt | salt/modules/nxos.py | set_role | def set_role(username, role, **kwargs):
'''
Assign role to username.
username
Username for role configuration
role
Configure role for username
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startu... | python | def set_role(username, role, **kwargs):
'''
Assign role to username.
username
Username for role configuration
role
Configure role for username
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startu... | [
"def",
"set_role",
"(",
"username",
",",
"role",
",",
"*",
"*",
"kwargs",
")",
":",
"role_line",
"=",
"'username {0} role {1}'",
".",
"format",
"(",
"username",
",",
"role",
")",
"return",
"config",
"(",
"role_line",
",",
"*",
"*",
"kwargs",
")"
] | Assign role to username.
username
Username for role configuration
role
Configure role for username
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startup configuration.
Default: False
.. code... | [
"Assign",
"role",
"to",
"username",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L726-L746 |
33,004 | saltstack/salt | salt/modules/nxos.py | unset_role | def unset_role(username, role, **kwargs):
'''
Remove role from username.
username
Username for role removal
role
Role to remove
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startup configuration... | python | def unset_role(username, role, **kwargs):
'''
Remove role from username.
username
Username for role removal
role
Role to remove
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startup configuration... | [
"def",
"unset_role",
"(",
"username",
",",
"role",
",",
"*",
"*",
"kwargs",
")",
":",
"role_line",
"=",
"'no username {0} role {1}'",
".",
"format",
"(",
"username",
",",
"role",
")",
"return",
"config",
"(",
"role_line",
",",
"*",
"*",
"kwargs",
")"
] | Remove role from username.
username
Username for role removal
role
Role to remove
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startup configuration.
Default: False
.. code-block:: bash
... | [
"Remove",
"role",
"from",
"username",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L749-L769 |
33,005 | saltstack/salt | salt/modules/nxos.py | _configure_device | def _configure_device(commands, **kwargs):
'''
Helper function to send configuration commands to the device over a
proxy minion or native minion using NX-API or SSH.
'''
if salt.utils.platform.is_proxy():
return __proxy__['nxos.proxy_config'](commands, **kwargs)
else:
return _nxa... | python | def _configure_device(commands, **kwargs):
'''
Helper function to send configuration commands to the device over a
proxy minion or native minion using NX-API or SSH.
'''
if salt.utils.platform.is_proxy():
return __proxy__['nxos.proxy_config'](commands, **kwargs)
else:
return _nxa... | [
"def",
"_configure_device",
"(",
"commands",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_proxy",
"(",
")",
":",
"return",
"__proxy__",
"[",
"'nxos.proxy_config'",
"]",
"(",
"commands",
",",
"*",
"*",
"kwargs",... | Helper function to send configuration commands to the device over a
proxy minion or native minion using NX-API or SSH. | [
"Helper",
"function",
"to",
"send",
"configuration",
"commands",
"to",
"the",
"device",
"over",
"a",
"proxy",
"minion",
"or",
"native",
"minion",
"using",
"NX",
"-",
"API",
"or",
"SSH",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L775-L783 |
33,006 | saltstack/salt | salt/modules/nxos.py | _nxapi_config | def _nxapi_config(commands, methods='cli_conf', bsb_arg=None, **kwargs):
'''
Helper function to send configuration commands using NX-API.
'''
api_kwargs = __salt__['config.get']('nxos', {})
api_kwargs.update(**kwargs)
if not isinstance(commands, list):
commands = [commands]
try:
... | python | def _nxapi_config(commands, methods='cli_conf', bsb_arg=None, **kwargs):
'''
Helper function to send configuration commands using NX-API.
'''
api_kwargs = __salt__['config.get']('nxos', {})
api_kwargs.update(**kwargs)
if not isinstance(commands, list):
commands = [commands]
try:
... | [
"def",
"_nxapi_config",
"(",
"commands",
",",
"methods",
"=",
"'cli_conf'",
",",
"bsb_arg",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"api_kwargs",
"=",
"__salt__",
"[",
"'config.get'",
"]",
"(",
"'nxos'",
",",
"{",
"}",
")",
"api_kwargs",
".",
"... | Helper function to send configuration commands using NX-API. | [
"Helper",
"function",
"to",
"send",
"configuration",
"commands",
"using",
"NX",
"-",
"API",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L786-L806 |
33,007 | saltstack/salt | salt/modules/nxos.py | _nxapi_request | def _nxapi_request(commands,
method='cli_conf',
**kwargs):
'''
Helper function to send exec and config requests over NX-API.
commands
The exec or config commands to be sent.
method: ``cli_show``
``cli_show_ascii``: Return raw test or unstructured o... | python | def _nxapi_request(commands,
method='cli_conf',
**kwargs):
'''
Helper function to send exec and config requests over NX-API.
commands
The exec or config commands to be sent.
method: ``cli_show``
``cli_show_ascii``: Return raw test or unstructured o... | [
"def",
"_nxapi_request",
"(",
"commands",
",",
"method",
"=",
"'cli_conf'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_proxy",
"(",
")",
":",
"return",
"__proxy__",
"[",
"'nxos._nxapi_request'",
"]",
"(",
"co... | Helper function to send exec and config requests over NX-API.
commands
The exec or config commands to be sent.
method: ``cli_show``
``cli_show_ascii``: Return raw test or unstructured output.
``cli_show``: Return structured output.
``cli_conf``: Send configuration commands to t... | [
"Helper",
"function",
"to",
"send",
"exec",
"and",
"config",
"requests",
"over",
"NX",
"-",
"API",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L809-L829 |
33,008 | saltstack/salt | salt/utils/gzip_util.py | compress | def compress(data, compresslevel=9):
'''
Returns the data compressed at gzip level compression.
'''
buf = BytesIO()
with open_fileobj(buf, 'wb', compresslevel) as ogz:
if six.PY3 and not isinstance(data, bytes):
data = data.encode(__salt_system_encoding__)
ogz.write(data)... | python | def compress(data, compresslevel=9):
'''
Returns the data compressed at gzip level compression.
'''
buf = BytesIO()
with open_fileobj(buf, 'wb', compresslevel) as ogz:
if six.PY3 and not isinstance(data, bytes):
data = data.encode(__salt_system_encoding__)
ogz.write(data)... | [
"def",
"compress",
"(",
"data",
",",
"compresslevel",
"=",
"9",
")",
":",
"buf",
"=",
"BytesIO",
"(",
")",
"with",
"open_fileobj",
"(",
"buf",
",",
"'wb'",
",",
"compresslevel",
")",
"as",
"ogz",
":",
"if",
"six",
".",
"PY3",
"and",
"not",
"isinstanc... | Returns the data compressed at gzip level compression. | [
"Returns",
"the",
"data",
"compressed",
"at",
"gzip",
"level",
"compression",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gzip_util.py#L54-L64 |
33,009 | saltstack/salt | salt/modules/systemd_service.py | _root | def _root(path, root):
'''
Relocate an absolute path to a new root directory.
'''
if root:
return os.path.join(root, os.path.relpath(path, os.path.sep))
else:
return path | python | def _root(path, root):
'''
Relocate an absolute path to a new root directory.
'''
if root:
return os.path.join(root, os.path.relpath(path, os.path.sep))
else:
return path | [
"def",
"_root",
"(",
"path",
",",
"root",
")",
":",
"if",
"root",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"root",
",",
"os",
".",
"path",
".",
"relpath",
"(",
"path",
",",
"os",
".",
"path",
".",
"sep",
")",
")",
"else",
":",
"ret... | Relocate an absolute path to a new root directory. | [
"Relocate",
"an",
"absolute",
"path",
"to",
"a",
"new",
"root",
"directory",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L73-L80 |
33,010 | saltstack/salt | salt/modules/systemd_service.py | _canonical_unit_name | def _canonical_unit_name(name):
'''
Build a canonical unit name treating unit names without one
of the valid suffixes as a service.
'''
if not isinstance(name, six.string_types):
name = six.text_type(name)
if any(name.endswith(suffix) for suffix in VALID_UNIT_TYPES):
return name
... | python | def _canonical_unit_name(name):
'''
Build a canonical unit name treating unit names without one
of the valid suffixes as a service.
'''
if not isinstance(name, six.string_types):
name = six.text_type(name)
if any(name.endswith(suffix) for suffix in VALID_UNIT_TYPES):
return name
... | [
"def",
"_canonical_unit_name",
"(",
"name",
")",
":",
"if",
"not",
"isinstance",
"(",
"name",
",",
"six",
".",
"string_types",
")",
":",
"name",
"=",
"six",
".",
"text_type",
"(",
"name",
")",
"if",
"any",
"(",
"name",
".",
"endswith",
"(",
"suffix",
... | Build a canonical unit name treating unit names without one
of the valid suffixes as a service. | [
"Build",
"a",
"canonical",
"unit",
"name",
"treating",
"unit",
"names",
"without",
"one",
"of",
"the",
"valid",
"suffixes",
"as",
"a",
"service",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L83-L92 |
33,011 | saltstack/salt | salt/modules/systemd_service.py | _check_available | 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... | 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... | [
"def",
"_check_available",
"(",
"name",
")",
":",
"_status",
"=",
"_systemctl_status",
"(",
"name",
")",
"sd_version",
"=",
"salt",
".",
"utils",
".",
"systemd",
".",
"version",
"(",
"__context__",
")",
"if",
"sd_version",
"is",
"not",
"None",
"and",
"sd_v... | Returns boolean telling whether or not the named service is available | [
"Returns",
"boolean",
"telling",
"whether",
"or",
"not",
"the",
"named",
"service",
"is",
"available"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L95-L125 |
33,012 | saltstack/salt | salt/modules/systemd_service.py | _check_unmask | 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) | 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) | [
"def",
"_check_unmask",
"(",
"name",
",",
"unmask",
",",
"unmask_runtime",
",",
"root",
"=",
"None",
")",
":",
"if",
"unmask",
":",
"unmask_",
"(",
"name",
",",
"runtime",
"=",
"False",
",",
"root",
"=",
"root",
")",
"if",
"unmask_runtime",
":",
"unmas... | Common code for conditionally removing masks before making changes to a
service's state. | [
"Common",
"code",
"for",
"conditionally",
"removing",
"masks",
"before",
"making",
"changes",
"to",
"a",
"service",
"s",
"state",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L141-L149 |
33,013 | saltstack/salt | salt/modules/systemd_service.py | _systemctl_cmd | 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__)... | 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__)... | [
"def",
"_systemctl_cmd",
"(",
"action",
",",
"name",
"=",
"None",
",",
"systemd_scope",
"=",
"False",
",",
"no_block",
"=",
"False",
",",
"root",
"=",
"None",
")",
":",
"ret",
"=",
"[",
"]",
"if",
"systemd_scope",
"and",
"salt",
".",
"utils",
".",
"s... | Build a systemctl command line. Treat unit names without one
of the valid suffixes as a service. | [
"Build",
"a",
"systemctl",
"command",
"line",
".",
"Treat",
"unit",
"names",
"without",
"one",
"of",
"the",
"valid",
"suffixes",
"as",
"a",
"service",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L323-L346 |
33,014 | saltstack/salt | salt/modules/systemd_service.py | get_running | def get_running():
'''
Return a list of all running services, so far as systemd is concerned
CLI Example:
.. code-block:: bash
salt '*' service.get_running
'''
ret = set()
# Get running systemd units
out = __salt__['cmd.run'](
_systemctl_cmd('--full --no-legend --no-pa... | python | def get_running():
'''
Return a list of all running services, so far as systemd is concerned
CLI Example:
.. code-block:: bash
salt '*' service.get_running
'''
ret = set()
# Get running systemd units
out = __salt__['cmd.run'](
_systemctl_cmd('--full --no-legend --no-pa... | [
"def",
"get_running",
"(",
")",
":",
"ret",
"=",
"set",
"(",
")",
"# Get running systemd units",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"_systemctl_cmd",
"(",
"'--full --no-legend --no-pager'",
")",
",",
"python_shell",
"=",
"False",
",",
"ignore_re... | Return a list of all running services, so far as systemd is concerned
CLI Example:
.. code-block:: bash
salt '*' service.get_running | [
"Return",
"a",
"list",
"of",
"all",
"running",
"services",
"so",
"far",
"as",
"systemd",
"is",
"concerned"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L423-L458 |
33,015 | saltstack/salt | salt/modules/systemd_service.py | enabled | def enabled(name, root=None, **kwargs): # pylint: disable=unused-argument
'''
Return if the named service is enabled to start on boot
root
Enable/disable/mask unit files in the specified root directory
CLI Example:
.. code-block:: bash
salt '*' service.enabled <service name>
... | python | def enabled(name, root=None, **kwargs): # pylint: disable=unused-argument
'''
Return if the named service is enabled to start on boot
root
Enable/disable/mask unit files in the specified root directory
CLI Example:
.. code-block:: bash
salt '*' service.enabled <service name>
... | [
"def",
"enabled",
"(",
"name",
",",
"root",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"# Try 'systemctl is-enabled' first, then look for a symlink created by",
"# systemctl (older systemd releases did not support using is-enabled to",
"# c... | Return if the named service is enabled to start on boot
root
Enable/disable/mask unit files in the specified root directory
CLI Example:
.. code-block:: bash
salt '*' service.enabled <service name> | [
"Return",
"if",
"the",
"named",
"service",
"is",
"enabled",
"to",
"start",
"on",
"boot"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L1242-L1276 |
33,016 | saltstack/salt | salt/states/virt.py | keys | def keys(name, basepath='/etc/pki', **kwargs):
'''
Manage libvirt keys.
name
The name variable used to track the execution
basepath
Defaults to ``/etc/pki``, this is the root location used for libvirt
keys on the hypervisor
The following parameters are optional:
c... | python | def keys(name, basepath='/etc/pki', **kwargs):
'''
Manage libvirt keys.
name
The name variable used to track the execution
basepath
Defaults to ``/etc/pki``, this is the root location used for libvirt
keys on the hypervisor
The following parameters are optional:
c... | [
"def",
"keys",
"(",
"name",
",",
"basepath",
"=",
"'/etc/pki'",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"# Grab all ... | Manage libvirt keys.
name
The name variable used to track the execution
basepath
Defaults to ``/etc/pki``, this is the root location used for libvirt
keys on the hypervisor
The following parameters are optional:
country
The country that the certificate should ... | [
"Manage",
"libvirt",
"keys",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L51-L145 |
33,017 | saltstack/salt | salt/states/virt.py | _virt_call | def _virt_call(domain, function, section, comment,
connection=None, username=None, password=None, **kwargs):
'''
Helper to call the virt functions. Wildcards supported.
:param domain:
:param function:
:param section:
:param comment:
:return:
'''
ret = {'name': domain,... | python | def _virt_call(domain, function, section, comment,
connection=None, username=None, password=None, **kwargs):
'''
Helper to call the virt functions. Wildcards supported.
:param domain:
:param function:
:param section:
:param comment:
:return:
'''
ret = {'name': domain,... | [
"def",
"_virt_call",
"(",
"domain",
",",
"function",
",",
"section",
",",
"comment",
",",
"connection",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"domai... | Helper to call the virt functions. Wildcards supported.
:param domain:
:param function:
:param section:
:param comment:
:return: | [
"Helper",
"to",
"call",
"the",
"virt",
"functions",
".",
"Wildcards",
"supported",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L148-L184 |
33,018 | saltstack/salt | salt/states/virt.py | stopped | def stopped(name, connection=None, username=None, password=None):
'''
Stops a VM by shutting it down nicely.
.. versionadded:: 2016.3.0
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: username to connect with, overriding defaults
... | python | def stopped(name, connection=None, username=None, password=None):
'''
Stops a VM by shutting it down nicely.
.. versionadded:: 2016.3.0
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: username to connect with, overriding defaults
... | [
"def",
"stopped",
"(",
"name",
",",
"connection",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"return",
"_virt_call",
"(",
"name",
",",
"'shutdown'",
",",
"'stopped'",
",",
"\"Machine has been shut down\"",
",",
"connec... | Stops a VM by shutting it down nicely.
.. versionadded:: 2016.3.0
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: username to connect with, overriding defaults
.. versionadded:: 2019.2.0
:param password: password to connect w... | [
"Stops",
"a",
"VM",
"by",
"shutting",
"it",
"down",
"nicely",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L187-L210 |
33,019 | saltstack/salt | salt/states/virt.py | powered_off | def powered_off(name, connection=None, username=None, password=None):
'''
Stops a VM by power off.
.. versionadded:: 2016.3.0
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: username to connect with, overriding defaults
.... | python | def powered_off(name, connection=None, username=None, password=None):
'''
Stops a VM by power off.
.. versionadded:: 2016.3.0
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: username to connect with, overriding defaults
.... | [
"def",
"powered_off",
"(",
"name",
",",
"connection",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"return",
"_virt_call",
"(",
"name",
",",
"'stop'",
",",
"'unpowered'",
",",
"'Machine has been powered off'",
",",
"conn... | Stops a VM by power off.
.. versionadded:: 2016.3.0
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: username to connect with, overriding defaults
.. versionadded:: 2019.2.0
:param password: password to connect with, overridin... | [
"Stops",
"a",
"VM",
"by",
"power",
"off",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L213-L236 |
33,020 | saltstack/salt | salt/states/virt.py | snapshot | def snapshot(name, suffix=None, connection=None, username=None, password=None):
'''
Takes a snapshot of a particular VM or by a UNIX-style wildcard.
.. versionadded:: 2016.3.0
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: userna... | python | def snapshot(name, suffix=None, connection=None, username=None, password=None):
'''
Takes a snapshot of a particular VM or by a UNIX-style wildcard.
.. versionadded:: 2016.3.0
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: userna... | [
"def",
"snapshot",
"(",
"name",
",",
"suffix",
"=",
"None",
",",
"connection",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"return",
"_virt_call",
"(",
"name",
",",
"'snapshot'",
",",
"'saved'",
",",
"'Snapshot has ... | Takes a snapshot of a particular VM or by a UNIX-style wildcard.
.. versionadded:: 2016.3.0
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: username to connect with, overriding defaults
.. versionadded:: 2019.2.0
:param passw... | [
"Takes",
"a",
"snapshot",
"of",
"a",
"particular",
"VM",
"or",
"by",
"a",
"UNIX",
"-",
"style",
"wildcard",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L484-L512 |
33,021 | saltstack/salt | salt/states/virt.py | network_running | def network_running(name,
bridge,
forward,
vport=None,
tag=None,
autostart=True,
connection=None,
username=None,
password=None):
'''
Defines and starts ... | python | def network_running(name,
bridge,
forward,
vport=None,
tag=None,
autostart=True,
connection=None,
username=None,
password=None):
'''
Defines and starts ... | [
"def",
"network_running",
"(",
"name",
",",
"bridge",
",",
"forward",
",",
"vport",
"=",
"None",
",",
"tag",
"=",
"None",
",",
"autostart",
"=",
"True",
",",
"connection",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
")",
... | Defines and starts a new network with specified arguments.
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: username to connect with, overriding defaults
.. versionadded:: 2019.2.0
:param password: password to connect with, overrid... | [
"Defines",
"and",
"starts",
"a",
"new",
"network",
"with",
"specified",
"arguments",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L639-L709 |
33,022 | saltstack/salt | salt/states/virt.py | pool_running | def pool_running(name,
ptype=None,
target=None,
permissions=None,
source=None,
transient=False,
autostart=True,
connection=None,
username=None,
password=None):
'''... | python | def pool_running(name,
ptype=None,
target=None,
permissions=None,
source=None,
transient=False,
autostart=True,
connection=None,
username=None,
password=None):
'''... | [
"def",
"pool_running",
"(",
"name",
",",
"ptype",
"=",
"None",
",",
"target",
"=",
"None",
",",
"permissions",
"=",
"None",
",",
"source",
"=",
"None",
",",
"transient",
"=",
"False",
",",
"autostart",
"=",
"True",
",",
"connection",
"=",
"None",
",",
... | Defines and starts a new pool with specified arguments.
.. versionadded:: 2019.2.0
:param ptype: libvirt pool type
:param target: full path to the target device or folder. (Default: ``None``)
:param permissions: target permissions. See the **Permissions definition**
section of the :py:func:`vi... | [
"Defines",
"and",
"starts",
"a",
"new",
"pool",
"with",
"specified",
"arguments",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L712-L826 |
33,023 | saltstack/salt | salt/modules/runit.py | status | def status(name, sig=None):
'''
Return ``True`` if service is running
name
the service's name
sig
signature to identify with ps
CLI Example:
.. code-block:: bash
salt '*' runit.status <service name>
'''
if sig:
# usual way to do by others (debian_serv... | python | def status(name, sig=None):
'''
Return ``True`` if service is running
name
the service's name
sig
signature to identify with ps
CLI Example:
.. code-block:: bash
salt '*' runit.status <service name>
'''
if sig:
# usual way to do by others (debian_serv... | [
"def",
"status",
"(",
"name",
",",
"sig",
"=",
"None",
")",
":",
"if",
"sig",
":",
"# usual way to do by others (debian_service, netbsdservice).",
"# XXX probably does not work here (check 'runsv sshd' instead of 'sshd' ?)",
"return",
"bool",
"(",
"__salt__",
"[",
"'status.pi... | Return ``True`` if service is running
name
the service's name
sig
signature to identify with ps
CLI Example:
.. code-block:: bash
salt '*' runit.status <service name> | [
"Return",
"True",
"if",
"service",
"is",
"running"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L206-L240 |
33,024 | saltstack/salt | salt/modules/runit.py | _get_svc_path | def _get_svc_path(name='*', status=None):
'''
Return a list of paths to services with ``name`` that have the specified ``status``
name
a glob for service name. default is '*'
status
None : all services (no filter, default choice)
'DISABLED' : available service(s) that is ... | python | def _get_svc_path(name='*', status=None):
'''
Return a list of paths to services with ``name`` that have the specified ``status``
name
a glob for service name. default is '*'
status
None : all services (no filter, default choice)
'DISABLED' : available service(s) that is ... | [
"def",
"_get_svc_path",
"(",
"name",
"=",
"'*'",
",",
"status",
"=",
"None",
")",
":",
"# This is the core routine to work with services, called by many",
"# other functions of this module.",
"#",
"# The name of a service is the \"apparent\" folder's name that contains its",
"# \"run... | Return a list of paths to services with ``name`` that have the specified ``status``
name
a glob for service name. default is '*'
status
None : all services (no filter, default choice)
'DISABLED' : available service(s) that is not enabled
'ENABLED' : enabled service (whet... | [
"Return",
"a",
"list",
"of",
"paths",
"to",
"services",
"with",
"name",
"that",
"have",
"the",
"specified",
"status"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L325-L374 |
33,025 | saltstack/salt | salt/modules/runit.py | _get_svc_list | def _get_svc_list(name='*', status=None):
'''
Return list of services that have the specified service ``status``
name
a glob for service name. default is '*'
status
None : all services (no filter, default choice)
'DISABLED' : available service that is not enabled
... | python | def _get_svc_list(name='*', status=None):
'''
Return list of services that have the specified service ``status``
name
a glob for service name. default is '*'
status
None : all services (no filter, default choice)
'DISABLED' : available service that is not enabled
... | [
"def",
"_get_svc_list",
"(",
"name",
"=",
"'*'",
",",
"status",
"=",
"None",
")",
":",
"return",
"sorted",
"(",
"[",
"os",
".",
"path",
".",
"basename",
"(",
"el",
")",
"for",
"el",
"in",
"_get_svc_path",
"(",
"name",
",",
"status",
")",
"]",
")"
] | Return list of services that have the specified service ``status``
name
a glob for service name. default is '*'
status
None : all services (no filter, default choice)
'DISABLED' : available service that is not enabled
'ENABLED' : enabled service (whether started on boot ... | [
"Return",
"list",
"of",
"services",
"that",
"have",
"the",
"specified",
"service",
"status"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L377-L389 |
33,026 | saltstack/salt | salt/modules/runit.py | enable | def enable(name, start=False, **kwargs):
'''
Start service ``name`` at boot.
Returns ``True`` if operation is successful
name
the service's name
start : False
If ``True``, start the service once enabled.
CLI Example:
.. code-block:: bash
salt '*' service.enable <... | python | def enable(name, start=False, **kwargs):
'''
Start service ``name`` at boot.
Returns ``True`` if operation is successful
name
the service's name
start : False
If ``True``, start the service once enabled.
CLI Example:
.. code-block:: bash
salt '*' service.enable <... | [
"def",
"enable",
"(",
"name",
",",
"start",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# non-existent service",
"if",
"not",
"available",
"(",
"name",
")",
":",
"return",
"False",
"# if service is aliased, refuse to enable it",
"alias",
"=",
"get_svc_alia... | Start service ``name`` at boot.
Returns ``True`` if operation is successful
name
the service's name
start : False
If ``True``, start the service once enabled.
CLI Example:
.. code-block:: bash
salt '*' service.enable <name> [start=True] | [
"Start",
"service",
"name",
"at",
"boot",
".",
"Returns",
"True",
"if",
"operation",
"is",
"successful"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L556-L648 |
33,027 | saltstack/salt | salt/modules/runit.py | disable | def disable(name, stop=False, **kwargs):
'''
Don't start service ``name`` at boot
Returns ``True`` if operation is successful
name
the service's name
stop
if True, also stops the service
CLI Example:
.. code-block:: bash
salt '*' service.disable <name> [stop=True... | python | def disable(name, stop=False, **kwargs):
'''
Don't start service ``name`` at boot
Returns ``True`` if operation is successful
name
the service's name
stop
if True, also stops the service
CLI Example:
.. code-block:: bash
salt '*' service.disable <name> [stop=True... | [
"def",
"disable",
"(",
"name",
",",
"stop",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# non-existent as registrered service",
"if",
"not",
"enabled",
"(",
"name",
")",
":",
"return",
"False",
"# down_file: file that prevent sv autostart",
"svc_realpath",
"... | Don't start service ``name`` at boot
Returns ``True`` if operation is successful
name
the service's name
stop
if True, also stops the service
CLI Example:
.. code-block:: bash
salt '*' service.disable <name> [stop=True] | [
"Don",
"t",
"start",
"service",
"name",
"at",
"boot",
"Returns",
"True",
"if",
"operation",
"is",
"successful"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L651-L687 |
33,028 | saltstack/salt | salt/pillar/s3.py | _get_cache_dir | def _get_cache_dir():
'''
Get pillar cache directory. Initialize it if it does not exist.
'''
cache_dir = os.path.join(__opts__['cachedir'], 'pillar_s3fs')
if not os.path.isdir(cache_dir):
log.debug('Initializing S3 Pillar Cache')
os.makedirs(cache_dir)
return cache_dir | python | def _get_cache_dir():
'''
Get pillar cache directory. Initialize it if it does not exist.
'''
cache_dir = os.path.join(__opts__['cachedir'], 'pillar_s3fs')
if not os.path.isdir(cache_dir):
log.debug('Initializing S3 Pillar Cache')
os.makedirs(cache_dir)
return cache_dir | [
"def",
"_get_cache_dir",
"(",
")",
":",
"cache_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'cachedir'",
"]",
",",
"'pillar_s3fs'",
")",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"cache_dir",
")",
":",
"log",
".",
"debug... | Get pillar cache directory. Initialize it if it does not exist. | [
"Get",
"pillar",
"cache",
"directory",
".",
"Initialize",
"it",
"if",
"it",
"does",
"not",
"exist",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/s3.py#L228-L239 |
33,029 | saltstack/salt | salt/modules/logadm.py | _arg2opt | def _arg2opt(arg):
'''
Turn a pass argument into the correct option
'''
res = [o for o, a in option_toggles.items() if a == arg]
res += [o for o, a in option_flags.items() if a == arg]
return res[0] if res else None | python | def _arg2opt(arg):
'''
Turn a pass argument into the correct option
'''
res = [o for o, a in option_toggles.items() if a == arg]
res += [o for o, a in option_flags.items() if a == arg]
return res[0] if res else None | [
"def",
"_arg2opt",
"(",
"arg",
")",
":",
"res",
"=",
"[",
"o",
"for",
"o",
",",
"a",
"in",
"option_toggles",
".",
"items",
"(",
")",
"if",
"a",
"==",
"arg",
"]",
"res",
"+=",
"[",
"o",
"for",
"o",
",",
"a",
"in",
"option_flags",
".",
"items",
... | Turn a pass argument into the correct option | [
"Turn",
"a",
"pass",
"argument",
"into",
"the",
"correct",
"option"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L61-L67 |
33,030 | saltstack/salt | salt/modules/logadm.py | _parse_conf | def _parse_conf(conf_file=default_conf):
'''
Parse a logadm configuration file.
'''
ret = {}
with salt.utils.files.fopen(conf_file, 'r') as ifile:
for line in ifile:
line = salt.utils.stringutils.to_unicode(line).strip()
if not line:
continue
... | python | def _parse_conf(conf_file=default_conf):
'''
Parse a logadm configuration file.
'''
ret = {}
with salt.utils.files.fopen(conf_file, 'r') as ifile:
for line in ifile:
line = salt.utils.stringutils.to_unicode(line).strip()
if not line:
continue
... | [
"def",
"_parse_conf",
"(",
"conf_file",
"=",
"default_conf",
")",
":",
"ret",
"=",
"{",
"}",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"conf_file",
",",
"'r'",
")",
"as",
"ifile",
":",
"for",
"line",
"in",
"ifile",
":",
"line",
... | Parse a logadm configuration file. | [
"Parse",
"a",
"logadm",
"configuration",
"file",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L70-L84 |
33,031 | saltstack/salt | salt/modules/logadm.py | _parse_options | def _parse_options(entry, options, include_unset=True):
'''
Parse a logadm options string
'''
log_cfg = {}
options = shlex.split(options)
if not options:
return None
## identifier is entry or log?
if entry.startswith('/'):
log_cfg['log_file'] = entry
else:
lo... | python | def _parse_options(entry, options, include_unset=True):
'''
Parse a logadm options string
'''
log_cfg = {}
options = shlex.split(options)
if not options:
return None
## identifier is entry or log?
if entry.startswith('/'):
log_cfg['log_file'] = entry
else:
lo... | [
"def",
"_parse_options",
"(",
"entry",
",",
"options",
",",
"include_unset",
"=",
"True",
")",
":",
"log_cfg",
"=",
"{",
"}",
"options",
"=",
"shlex",
".",
"split",
"(",
"options",
")",
"if",
"not",
"options",
":",
"return",
"None",
"## identifier is entry... | Parse a logadm options string | [
"Parse",
"a",
"logadm",
"options",
"string"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L87-L152 |
33,032 | saltstack/salt | salt/modules/logadm.py | list_conf | def list_conf(conf_file=default_conf, log_file=None, include_unset=False):
'''
Show parsed configuration
.. versionadded:: 2018.3.0
conf_file : string
path to logadm.conf, defaults to /etc/logadm.conf
log_file : string
optional show only one log file
include_unset : boolean
... | python | def list_conf(conf_file=default_conf, log_file=None, include_unset=False):
'''
Show parsed configuration
.. versionadded:: 2018.3.0
conf_file : string
path to logadm.conf, defaults to /etc/logadm.conf
log_file : string
optional show only one log file
include_unset : boolean
... | [
"def",
"list_conf",
"(",
"conf_file",
"=",
"default_conf",
",",
"log_file",
"=",
"None",
",",
"include_unset",
"=",
"False",
")",
":",
"cfg",
"=",
"_parse_conf",
"(",
"conf_file",
")",
"cfg_parsed",
"=",
"{",
"}",
"## parse all options",
"for",
"entry",
"in"... | Show parsed configuration
.. versionadded:: 2018.3.0
conf_file : string
path to logadm.conf, defaults to /etc/logadm.conf
log_file : string
optional show only one log file
include_unset : boolean
include unset flags in output
CLI Example:
.. code-block:: bash
... | [
"Show",
"parsed",
"configuration"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L182-L217 |
33,033 | saltstack/salt | salt/modules/logadm.py | show_args | def show_args():
'''
Show which arguments map to which flags and options.
.. versionadded:: 2018.3.0
CLI Example:
.. code-block:: bash
salt '*' logadm.show_args
'''
mapping = {'flags': {}, 'options': {}}
for flag, arg in option_toggles.items():
mapping['flags'][flag] ... | python | def show_args():
'''
Show which arguments map to which flags and options.
.. versionadded:: 2018.3.0
CLI Example:
.. code-block:: bash
salt '*' logadm.show_args
'''
mapping = {'flags': {}, 'options': {}}
for flag, arg in option_toggles.items():
mapping['flags'][flag] ... | [
"def",
"show_args",
"(",
")",
":",
"mapping",
"=",
"{",
"'flags'",
":",
"{",
"}",
",",
"'options'",
":",
"{",
"}",
"}",
"for",
"flag",
",",
"arg",
"in",
"option_toggles",
".",
"items",
"(",
")",
":",
"mapping",
"[",
"'flags'",
"]",
"[",
"flag",
"... | Show which arguments map to which flags and options.
.. versionadded:: 2018.3.0
CLI Example:
.. code-block:: bash
salt '*' logadm.show_args | [
"Show",
"which",
"arguments",
"map",
"to",
"which",
"flags",
"and",
"options",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L221-L239 |
33,034 | saltstack/salt | salt/modules/logadm.py | rotate | def rotate(name, pattern=None, conf_file=default_conf, **kwargs):
'''
Set up pattern for logging.
name : string
alias for entryname
pattern : string
alias for log_file
conf_file : string
optional path to alternative configuration file
kwargs : boolean|string|int
... | python | def rotate(name, pattern=None, conf_file=default_conf, **kwargs):
'''
Set up pattern for logging.
name : string
alias for entryname
pattern : string
alias for log_file
conf_file : string
optional path to alternative configuration file
kwargs : boolean|string|int
... | [
"def",
"rotate",
"(",
"name",
",",
"pattern",
"=",
"None",
",",
"conf_file",
"=",
"default_conf",
",",
"*",
"*",
"kwargs",
")",
":",
"## cleanup kwargs",
"kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"kwargs",
")... | Set up pattern for logging.
name : string
alias for entryname
pattern : string
alias for log_file
conf_file : string
optional path to alternative configuration file
kwargs : boolean|string|int
optional additional flags and parameters
.. note::
``name`` and `... | [
"Set",
"up",
"pattern",
"for",
"logging",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L242-L323 |
33,035 | saltstack/salt | salt/modules/logadm.py | remove | def remove(name, conf_file=default_conf):
'''
Remove log pattern from logadm
CLI Example:
.. code-block:: bash
salt '*' logadm.remove myapplog
'''
command = "logadm -f {0} -r {1}".format(conf_file, name)
result = __salt__['cmd.run_all'](command, python_shell=False)
if result['re... | python | def remove(name, conf_file=default_conf):
'''
Remove log pattern from logadm
CLI Example:
.. code-block:: bash
salt '*' logadm.remove myapplog
'''
command = "logadm -f {0} -r {1}".format(conf_file, name)
result = __salt__['cmd.run_all'](command, python_shell=False)
if result['re... | [
"def",
"remove",
"(",
"name",
",",
"conf_file",
"=",
"default_conf",
")",
":",
"command",
"=",
"\"logadm -f {0} -r {1}\"",
".",
"format",
"(",
"conf_file",
",",
"name",
")",
"result",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"command",
",",
"python_s... | Remove log pattern from logadm
CLI Example:
.. code-block:: bash
salt '*' logadm.remove myapplog | [
"Remove",
"log",
"pattern",
"from",
"logadm"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L326-L343 |
33,036 | saltstack/salt | salt/utils/locales.py | get_encodings | def get_encodings():
'''
return a list of string encodings to try
'''
encodings = [__salt_system_encoding__]
try:
sys_enc = sys.getdefaultencoding()
except ValueError: # system encoding is nonstandard or malformed
sys_enc = None
if sys_enc and sys_enc not in encodings:
... | python | def get_encodings():
'''
return a list of string encodings to try
'''
encodings = [__salt_system_encoding__]
try:
sys_enc = sys.getdefaultencoding()
except ValueError: # system encoding is nonstandard or malformed
sys_enc = None
if sys_enc and sys_enc not in encodings:
... | [
"def",
"get_encodings",
"(",
")",
":",
"encodings",
"=",
"[",
"__salt_system_encoding__",
"]",
"try",
":",
"sys_enc",
"=",
"sys",
".",
"getdefaultencoding",
"(",
")",
"except",
"ValueError",
":",
"# system encoding is nonstandard or malformed",
"sys_enc",
"=",
"None... | return a list of string encodings to try | [
"return",
"a",
"list",
"of",
"string",
"encodings",
"to",
"try"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/locales.py#L16-L33 |
33,037 | saltstack/salt | salt/utils/locales.py | split_locale | def split_locale(loc):
'''
Split a locale specifier. The general format is
language[_territory][.codeset][@modifier] [charmap]
For example:
ca_ES.UTF-8@valencia UTF-8
'''
def split(st, char):
'''
Split a string `st` once by `char`; always return a two-element list
... | python | def split_locale(loc):
'''
Split a locale specifier. The general format is
language[_territory][.codeset][@modifier] [charmap]
For example:
ca_ES.UTF-8@valencia UTF-8
'''
def split(st, char):
'''
Split a string `st` once by `char`; always return a two-element list
... | [
"def",
"split_locale",
"(",
"loc",
")",
":",
"def",
"split",
"(",
"st",
",",
"char",
")",
":",
"'''\n Split a string `st` once by `char`; always return a two-element list\n even if the second element is empty.\n '''",
"split_st",
"=",
"st",
".",
"split",
... | Split a locale specifier. The general format is
language[_territory][.codeset][@modifier] [charmap]
For example:
ca_ES.UTF-8@valencia UTF-8 | [
"Split",
"a",
"locale",
"specifier",
".",
"The",
"general",
"format",
"is"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/locales.py#L58-L83 |
33,038 | saltstack/salt | salt/utils/locales.py | join_locale | def join_locale(comps):
'''
Join a locale specifier split in the format returned by split_locale.
'''
loc = comps['language']
if comps.get('territory'):
loc += '_' + comps['territory']
if comps.get('codeset'):
loc += '.' + comps['codeset']
if comps.get('modifier'):
lo... | python | def join_locale(comps):
'''
Join a locale specifier split in the format returned by split_locale.
'''
loc = comps['language']
if comps.get('territory'):
loc += '_' + comps['territory']
if comps.get('codeset'):
loc += '.' + comps['codeset']
if comps.get('modifier'):
lo... | [
"def",
"join_locale",
"(",
"comps",
")",
":",
"loc",
"=",
"comps",
"[",
"'language'",
"]",
"if",
"comps",
".",
"get",
"(",
"'territory'",
")",
":",
"loc",
"+=",
"'_'",
"+",
"comps",
"[",
"'territory'",
"]",
"if",
"comps",
".",
"get",
"(",
"'codeset'"... | Join a locale specifier split in the format returned by split_locale. | [
"Join",
"a",
"locale",
"specifier",
"split",
"in",
"the",
"format",
"returned",
"by",
"split_locale",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/locales.py#L86-L99 |
33,039 | saltstack/salt | salt/utils/locales.py | normalize_locale | def normalize_locale(loc):
'''
Format a locale specifier according to the format returned by `locale -a`.
'''
comps = split_locale(loc)
comps['territory'] = comps['territory'].upper()
comps['codeset'] = comps['codeset'].lower().replace('-', '')
comps['charmap'] = ''
return join_locale(co... | python | def normalize_locale(loc):
'''
Format a locale specifier according to the format returned by `locale -a`.
'''
comps = split_locale(loc)
comps['territory'] = comps['territory'].upper()
comps['codeset'] = comps['codeset'].lower().replace('-', '')
comps['charmap'] = ''
return join_locale(co... | [
"def",
"normalize_locale",
"(",
"loc",
")",
":",
"comps",
"=",
"split_locale",
"(",
"loc",
")",
"comps",
"[",
"'territory'",
"]",
"=",
"comps",
"[",
"'territory'",
"]",
".",
"upper",
"(",
")",
"comps",
"[",
"'codeset'",
"]",
"=",
"comps",
"[",
"'codese... | Format a locale specifier according to the format returned by `locale -a`. | [
"Format",
"a",
"locale",
"specifier",
"according",
"to",
"the",
"format",
"returned",
"by",
"locale",
"-",
"a",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/locales.py#L102-L110 |
33,040 | saltstack/salt | salt/returners/mongo_return.py | _remove_dots | def _remove_dots(src):
'''
Remove dots from the given data structure
'''
output = {}
for key, val in six.iteritems(src):
if isinstance(val, dict):
val = _remove_dots(val)
output[key.replace('.', '-')] = val
return output | python | def _remove_dots(src):
'''
Remove dots from the given data structure
'''
output = {}
for key, val in six.iteritems(src):
if isinstance(val, dict):
val = _remove_dots(val)
output[key.replace('.', '-')] = val
return output | [
"def",
"_remove_dots",
"(",
"src",
")",
":",
"output",
"=",
"{",
"}",
"for",
"key",
",",
"val",
"in",
"six",
".",
"iteritems",
"(",
"src",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"dict",
")",
":",
"val",
"=",
"_remove_dots",
"(",
"val",
")... | Remove dots from the given data structure | [
"Remove",
"dots",
"from",
"the",
"given",
"data",
"structure"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mongo_return.py#L96-L105 |
33,041 | saltstack/salt | salt/returners/mongo_return.py | get_jid | def get_jid(jid):
'''
Return the return information associated with a jid
'''
conn, mdb = _get_conn(ret=None)
ret = {}
rdata = mdb.saltReturns.find({'jid': jid}, {'_id': 0})
if rdata:
for data in rdata:
minion = data['minion']
# return data in the format {<min... | python | def get_jid(jid):
'''
Return the return information associated with a jid
'''
conn, mdb = _get_conn(ret=None)
ret = {}
rdata = mdb.saltReturns.find({'jid': jid}, {'_id': 0})
if rdata:
for data in rdata:
minion = data['minion']
# return data in the format {<min... | [
"def",
"get_jid",
"(",
"jid",
")",
":",
"conn",
",",
"mdb",
"=",
"_get_conn",
"(",
"ret",
"=",
"None",
")",
"ret",
"=",
"{",
"}",
"rdata",
"=",
"mdb",
".",
"saltReturns",
".",
"find",
"(",
"{",
"'jid'",
":",
"jid",
"}",
",",
"{",
"'_id'",
":",
... | Return the return information associated with a jid | [
"Return",
"the",
"return",
"information",
"associated",
"with",
"a",
"jid"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mongo_return.py#L203-L215 |
33,042 | saltstack/salt | salt/returners/mongo_return.py | get_fun | def get_fun(fun):
'''
Return the most recent jobs that have executed the named function
'''
conn, mdb = _get_conn(ret=None)
ret = {}
rdata = mdb.saltReturns.find_one({'fun': fun}, {'_id': 0})
if rdata:
ret = rdata
return ret | python | def get_fun(fun):
'''
Return the most recent jobs that have executed the named function
'''
conn, mdb = _get_conn(ret=None)
ret = {}
rdata = mdb.saltReturns.find_one({'fun': fun}, {'_id': 0})
if rdata:
ret = rdata
return ret | [
"def",
"get_fun",
"(",
"fun",
")",
":",
"conn",
",",
"mdb",
"=",
"_get_conn",
"(",
"ret",
"=",
"None",
")",
"ret",
"=",
"{",
"}",
"rdata",
"=",
"mdb",
".",
"saltReturns",
".",
"find_one",
"(",
"{",
"'fun'",
":",
"fun",
"}",
",",
"{",
"'_id'",
"... | Return the most recent jobs that have executed the named function | [
"Return",
"the",
"most",
"recent",
"jobs",
"that",
"have",
"executed",
"the",
"named",
"function"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mongo_return.py#L218-L227 |
33,043 | saltstack/salt | salt/modules/acme.py | _cert_file | def _cert_file(name, cert_type):
'''
Return expected path of a Let's Encrypt live cert
'''
return os.path.join(LE_LIVE, name, '{0}.pem'.format(cert_type)) | python | def _cert_file(name, cert_type):
'''
Return expected path of a Let's Encrypt live cert
'''
return os.path.join(LE_LIVE, name, '{0}.pem'.format(cert_type)) | [
"def",
"_cert_file",
"(",
"name",
",",
"cert_type",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"LE_LIVE",
",",
"name",
",",
"'{0}.pem'",
".",
"format",
"(",
"cert_type",
")",
")"
] | Return expected path of a Let's Encrypt live cert | [
"Return",
"expected",
"path",
"of",
"a",
"Let",
"s",
"Encrypt",
"live",
"cert"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/acme.py#L64-L68 |
33,044 | saltstack/salt | salt/modules/acme.py | _expires | def _expires(name):
'''
Return the expiry date of a cert
:return datetime object of expiry date
'''
cert_file = _cert_file(name, 'cert')
# Use the salt module if available
if 'tls.cert_info' in __salt__:
expiry = __salt__['tls.cert_info'](cert_file)['not_after']
# Cobble it toge... | python | def _expires(name):
'''
Return the expiry date of a cert
:return datetime object of expiry date
'''
cert_file = _cert_file(name, 'cert')
# Use the salt module if available
if 'tls.cert_info' in __salt__:
expiry = __salt__['tls.cert_info'](cert_file)['not_after']
# Cobble it toge... | [
"def",
"_expires",
"(",
"name",
")",
":",
"cert_file",
"=",
"_cert_file",
"(",
"name",
",",
"'cert'",
")",
"# Use the salt module if available",
"if",
"'tls.cert_info'",
"in",
"__salt__",
":",
"expiry",
"=",
"__salt__",
"[",
"'tls.cert_info'",
"]",
"(",
"cert_fi... | Return the expiry date of a cert
:return datetime object of expiry date | [
"Return",
"the",
"expiry",
"date",
"of",
"a",
"cert"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/acme.py#L71-L89 |
33,045 | saltstack/salt | salt/modules/acme.py | _renew_by | def _renew_by(name, window=None):
'''
Date before a certificate should be renewed
:param name: Common Name of the certificate (DNS name of certificate)
:param window: days before expiry date to renew
:return datetime object of first renewal date
'''
expiry = _expires(name)
if window is ... | python | def _renew_by(name, window=None):
'''
Date before a certificate should be renewed
:param name: Common Name of the certificate (DNS name of certificate)
:param window: days before expiry date to renew
:return datetime object of first renewal date
'''
expiry = _expires(name)
if window is ... | [
"def",
"_renew_by",
"(",
"name",
",",
"window",
"=",
"None",
")",
":",
"expiry",
"=",
"_expires",
"(",
"name",
")",
"if",
"window",
"is",
"not",
"None",
":",
"expiry",
"=",
"expiry",
"-",
"datetime",
".",
"timedelta",
"(",
"days",
"=",
"window",
")",... | Date before a certificate should be renewed
:param name: Common Name of the certificate (DNS name of certificate)
:param window: days before expiry date to renew
:return datetime object of first renewal date | [
"Date",
"before",
"a",
"certificate",
"should",
"be",
"renewed"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/acme.py#L92-L104 |
33,046 | saltstack/salt | salt/modules/acme.py | info | def info(name):
'''
Return information about a certificate
.. note::
Will output tls.cert_info if that's available, or OpenSSL text if not
:param name: CommonName of cert
CLI example:
.. code-block:: bash
salt 'gitlab.example.com' acme.info dev.example.com
'''
cert_f... | python | def info(name):
'''
Return information about a certificate
.. note::
Will output tls.cert_info if that's available, or OpenSSL text if not
:param name: CommonName of cert
CLI example:
.. code-block:: bash
salt 'gitlab.example.com' acme.info dev.example.com
'''
cert_f... | [
"def",
"info",
"(",
"name",
")",
":",
"cert_file",
"=",
"_cert_file",
"(",
"name",
",",
"'cert'",
")",
"# Use the salt module if available",
"if",
"'tls.cert_info'",
"in",
"__salt__",
":",
"cert_info",
"=",
"__salt__",
"[",
"'tls.cert_info'",
"]",
"(",
"cert_fil... | Return information about a certificate
.. note::
Will output tls.cert_info if that's available, or OpenSSL text if not
:param name: CommonName of cert
CLI example:
.. code-block:: bash
salt 'gitlab.example.com' acme.info dev.example.com | [
"Return",
"information",
"about",
"a",
"certificate"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/acme.py#L274-L300 |
33,047 | saltstack/salt | salt/modules/acme.py | needs_renewal | def needs_renewal(name, window=None):
'''
Check if a certificate needs renewal
:param name: CommonName of cert
:param window: Window in days to renew earlier or True/force to just return True
Code example:
.. code-block:: python
if __salt__['acme.needs_renewal']('dev.example.com'):
... | python | def needs_renewal(name, window=None):
'''
Check if a certificate needs renewal
:param name: CommonName of cert
:param window: Window in days to renew earlier or True/force to just return True
Code example:
.. code-block:: python
if __salt__['acme.needs_renewal']('dev.example.com'):
... | [
"def",
"needs_renewal",
"(",
"name",
",",
"window",
"=",
"None",
")",
":",
"if",
"window",
"is",
"not",
"None",
"and",
"window",
"in",
"(",
"'force'",
",",
"'Force'",
",",
"True",
")",
":",
"return",
"True",
"return",
"_renew_by",
"(",
"name",
",",
"... | Check if a certificate needs renewal
:param name: CommonName of cert
:param window: Window in days to renew earlier or True/force to just return True
Code example:
.. code-block:: python
if __salt__['acme.needs_renewal']('dev.example.com'):
__salt__['acme.cert']('dev.example.com'... | [
"Check",
"if",
"a",
"certificate",
"needs",
"renewal"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/acme.py#L344-L363 |
33,048 | saltstack/salt | salt/modules/drbd.py | _analyse_overview_field | def _analyse_overview_field(content):
'''
Split the field in drbd-overview
'''
if "(" in content:
# Output like "Connected(2*)" or "UpToDate(2*)"
return content.split("(")[0], content.split("(")[0]
elif "/" in content:
# Output like "Primar/Second" or "UpToDa/UpToDa"
... | python | def _analyse_overview_field(content):
'''
Split the field in drbd-overview
'''
if "(" in content:
# Output like "Connected(2*)" or "UpToDate(2*)"
return content.split("(")[0], content.split("(")[0]
elif "/" in content:
# Output like "Primar/Second" or "UpToDa/UpToDa"
... | [
"def",
"_analyse_overview_field",
"(",
"content",
")",
":",
"if",
"\"(\"",
"in",
"content",
":",
"# Output like \"Connected(2*)\" or \"UpToDate(2*)\"",
"return",
"content",
".",
"split",
"(",
"\"(\"",
")",
"[",
"0",
"]",
",",
"content",
".",
"split",
"(",
"\"(\"... | Split the field in drbd-overview | [
"Split",
"the",
"field",
"in",
"drbd",
"-",
"overview"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L13-L24 |
33,049 | saltstack/salt | salt/modules/drbd.py | _count_spaces_startswith | def _count_spaces_startswith(line):
'''
Count the number of spaces before the first character
'''
if line.split('#')[0].strip() == "":
return None
spaces = 0
for i in line:
if i.isspace():
spaces += 1
else:
return spaces | python | def _count_spaces_startswith(line):
'''
Count the number of spaces before the first character
'''
if line.split('#')[0].strip() == "":
return None
spaces = 0
for i in line:
if i.isspace():
spaces += 1
else:
return spaces | [
"def",
"_count_spaces_startswith",
"(",
"line",
")",
":",
"if",
"line",
".",
"split",
"(",
"'#'",
")",
"[",
"0",
"]",
".",
"strip",
"(",
")",
"==",
"\"\"",
":",
"return",
"None",
"spaces",
"=",
"0",
"for",
"i",
"in",
"line",
":",
"if",
"i",
".",
... | Count the number of spaces before the first character | [
"Count",
"the",
"number",
"of",
"spaces",
"before",
"the",
"first",
"character"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L27-L39 |
33,050 | saltstack/salt | salt/modules/drbd.py | _analyse_status_type | def _analyse_status_type(line):
'''
Figure out the sections in drbdadm status
'''
spaces = _count_spaces_startswith(line)
if spaces is None:
return ''
switch = {
0: 'RESOURCE',
2: {' disk:': 'LOCALDISK', ' role:': 'PEERNODE', ' connection:': 'PEERNODE'},
4: {' p... | python | def _analyse_status_type(line):
'''
Figure out the sections in drbdadm status
'''
spaces = _count_spaces_startswith(line)
if spaces is None:
return ''
switch = {
0: 'RESOURCE',
2: {' disk:': 'LOCALDISK', ' role:': 'PEERNODE', ' connection:': 'PEERNODE'},
4: {' p... | [
"def",
"_analyse_status_type",
"(",
"line",
")",
":",
"spaces",
"=",
"_count_spaces_startswith",
"(",
"line",
")",
"if",
"spaces",
"is",
"None",
":",
"return",
"''",
"switch",
"=",
"{",
"0",
":",
"'RESOURCE'",
",",
"2",
":",
"{",
"' disk:'",
":",
"'LOCAL... | Figure out the sections in drbdadm status | [
"Figure",
"out",
"the",
"sections",
"in",
"drbdadm",
"status"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L42-L67 |
33,051 | saltstack/salt | salt/modules/drbd.py | _add_res | def _add_res(line):
'''
Analyse the line of local resource of ``drbdadm status``
'''
global resource
fields = line.strip().split()
if resource:
ret.append(resource)
resource = {}
resource["resource name"] = fields[0]
resource["local role"] = fields[1].split(":")[1]
... | python | def _add_res(line):
'''
Analyse the line of local resource of ``drbdadm status``
'''
global resource
fields = line.strip().split()
if resource:
ret.append(resource)
resource = {}
resource["resource name"] = fields[0]
resource["local role"] = fields[1].split(":")[1]
... | [
"def",
"_add_res",
"(",
"line",
")",
":",
"global",
"resource",
"fields",
"=",
"line",
".",
"strip",
"(",
")",
".",
"split",
"(",
")",
"if",
"resource",
":",
"ret",
".",
"append",
"(",
"resource",
")",
"resource",
"=",
"{",
"}",
"resource",
"[",
"\... | Analyse the line of local resource of ``drbdadm status`` | [
"Analyse",
"the",
"line",
"of",
"local",
"resource",
"of",
"drbdadm",
"status"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L70-L84 |
33,052 | saltstack/salt | salt/modules/drbd.py | _add_volume | def _add_volume(line):
'''
Analyse the line of volumes of ``drbdadm status``
'''
section = _analyse_status_type(line)
fields = line.strip().split()
volume = {}
for field in fields:
volume[field.split(':')[0]] = field.split(':')[1]
if section == 'LOCALDISK':
resource['lo... | python | def _add_volume(line):
'''
Analyse the line of volumes of ``drbdadm status``
'''
section = _analyse_status_type(line)
fields = line.strip().split()
volume = {}
for field in fields:
volume[field.split(':')[0]] = field.split(':')[1]
if section == 'LOCALDISK':
resource['lo... | [
"def",
"_add_volume",
"(",
"line",
")",
":",
"section",
"=",
"_analyse_status_type",
"(",
"line",
")",
"fields",
"=",
"line",
".",
"strip",
"(",
")",
".",
"split",
"(",
")",
"volume",
"=",
"{",
"}",
"for",
"field",
"in",
"fields",
":",
"volume",
"[",... | Analyse the line of volumes of ``drbdadm status`` | [
"Analyse",
"the",
"line",
"of",
"volumes",
"of",
"drbdadm",
"status"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L87-L102 |
33,053 | saltstack/salt | salt/modules/drbd.py | _add_peernode | def _add_peernode(line):
'''
Analyse the line of peer nodes of ``drbdadm status``
'''
global lastpnodevolumes
fields = line.strip().split()
peernode = {}
peernode["peernode name"] = fields[0]
#Could be role or connection:
peernode[fields[1].split(":")[0]] = fields[1].split(":")[1]
... | python | def _add_peernode(line):
'''
Analyse the line of peer nodes of ``drbdadm status``
'''
global lastpnodevolumes
fields = line.strip().split()
peernode = {}
peernode["peernode name"] = fields[0]
#Could be role or connection:
peernode[fields[1].split(":")[0]] = fields[1].split(":")[1]
... | [
"def",
"_add_peernode",
"(",
"line",
")",
":",
"global",
"lastpnodevolumes",
"fields",
"=",
"line",
".",
"strip",
"(",
")",
".",
"split",
"(",
")",
"peernode",
"=",
"{",
"}",
"peernode",
"[",
"\"peernode name\"",
"]",
"=",
"fields",
"[",
"0",
"]",
"#Co... | Analyse the line of peer nodes of ``drbdadm status`` | [
"Analyse",
"the",
"line",
"of",
"peer",
"nodes",
"of",
"drbdadm",
"status"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L105-L119 |
33,054 | saltstack/salt | salt/modules/drbd.py | _line_parser | def _line_parser(line):
'''
Call action for different lines
'''
section = _analyse_status_type(line)
fields = line.strip().split()
switch = {
'': _empty,
'RESOURCE': _add_res,
'PEERNODE': _add_peernode,
'LOCALDISK': _add_volume,
'PEERDISK': _add_volume,
... | python | def _line_parser(line):
'''
Call action for different lines
'''
section = _analyse_status_type(line)
fields = line.strip().split()
switch = {
'': _empty,
'RESOURCE': _add_res,
'PEERNODE': _add_peernode,
'LOCALDISK': _add_volume,
'PEERDISK': _add_volume,
... | [
"def",
"_line_parser",
"(",
"line",
")",
":",
"section",
"=",
"_analyse_status_type",
"(",
"line",
")",
"fields",
"=",
"line",
".",
"strip",
"(",
")",
".",
"split",
"(",
")",
"switch",
"=",
"{",
"''",
":",
"_empty",
",",
"'RESOURCE'",
":",
"_add_res",
... | Call action for different lines | [
"Call",
"action",
"for",
"different",
"lines"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L137-L154 |
33,055 | saltstack/salt | salt/modules/drbd.py | overview | def overview():
'''
Show status of the DRBD devices, support two nodes only.
drbd-overview is removed since drbd-utils-9.6.0,
use status instead.
CLI Example:
.. code-block:: bash
salt '*' drbd.overview
'''
cmd = 'drbd-overview'
for line in __salt__['cmd.run'](cmd).splitli... | python | def overview():
'''
Show status of the DRBD devices, support two nodes only.
drbd-overview is removed since drbd-utils-9.6.0,
use status instead.
CLI Example:
.. code-block:: bash
salt '*' drbd.overview
'''
cmd = 'drbd-overview'
for line in __salt__['cmd.run'](cmd).splitli... | [
"def",
"overview",
"(",
")",
":",
"cmd",
"=",
"'drbd-overview'",
"for",
"line",
"in",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
")",
".",
"splitlines",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"fields",
"=",
"line",
".",
"strip",
"(",
")",
".",
... | Show status of the DRBD devices, support two nodes only.
drbd-overview is removed since drbd-utils-9.6.0,
use status instead.
CLI Example:
.. code-block:: bash
salt '*' drbd.overview | [
"Show",
"status",
"of",
"the",
"DRBD",
"devices",
"support",
"two",
"nodes",
"only",
".",
"drbd",
"-",
"overview",
"is",
"removed",
"since",
"drbd",
"-",
"utils",
"-",
"9",
".",
"6",
".",
"0",
"use",
"status",
"instead",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L157-L228 |
33,056 | saltstack/salt | salt/modules/drbd.py | status | def status(name='all'):
'''
Using drbdadm to show status of the DRBD devices,
available in the latest drbd9.
Support multiple nodes, multiple volumes.
:type name: str
:param name:
Resource name.
:return: drbd status of resource.
:rtype: list(dict(res))
CLI Example:
..... | python | def status(name='all'):
'''
Using drbdadm to show status of the DRBD devices,
available in the latest drbd9.
Support multiple nodes, multiple volumes.
:type name: str
:param name:
Resource name.
:return: drbd status of resource.
:rtype: list(dict(res))
CLI Example:
..... | [
"def",
"status",
"(",
"name",
"=",
"'all'",
")",
":",
"# Initialize for multiple times test cases",
"global",
"ret",
"global",
"resource",
"ret",
"=",
"[",
"]",
"resource",
"=",
"{",
"}",
"cmd",
"=",
"[",
"'drbdadm'",
",",
"'status'",
"]",
"cmd",
".",
"app... | Using drbdadm to show status of the DRBD devices,
available in the latest drbd9.
Support multiple nodes, multiple volumes.
:type name: str
:param name:
Resource name.
:return: drbd status of resource.
:rtype: list(dict(res))
CLI Example:
.. code-block:: bash
salt '*'... | [
"Using",
"drbdadm",
"to",
"show",
"status",
"of",
"the",
"DRBD",
"devices",
"available",
"in",
"the",
"latest",
"drbd9",
".",
"Support",
"multiple",
"nodes",
"multiple",
"volumes",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L237-L283 |
33,057 | saltstack/salt | salt/modules/rdp.py | _parse_return_code_powershell | def _parse_return_code_powershell(string):
'''
return from the input string the return code of the powershell command
'''
regex = re.search(r'ReturnValue\s*: (\d*)', string)
if not regex:
return (False, 'Could not parse PowerShell return code.')
else:
return int(regex.group(1)) | python | def _parse_return_code_powershell(string):
'''
return from the input string the return code of the powershell command
'''
regex = re.search(r'ReturnValue\s*: (\d*)', string)
if not regex:
return (False, 'Could not parse PowerShell return code.')
else:
return int(regex.group(1)) | [
"def",
"_parse_return_code_powershell",
"(",
"string",
")",
":",
"regex",
"=",
"re",
".",
"search",
"(",
"r'ReturnValue\\s*: (\\d*)'",
",",
"string",
")",
"if",
"not",
"regex",
":",
"return",
"(",
"False",
",",
"'Could not parse PowerShell return code.'",
")",
"el... | return from the input string the return code of the powershell command | [
"return",
"from",
"the",
"input",
"string",
"the",
"return",
"code",
"of",
"the",
"powershell",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rdp.py#L34-L43 |
33,058 | saltstack/salt | salt/modules/rdp.py | list_sessions | def list_sessions(logged_in_users_only=False):
'''
List information about the sessions.
.. versionadded:: 2016.11.0
:param logged_in_users_only: If True, only return sessions with users logged in.
:return: A list containing dictionaries of session information.
CLI Example:
.. code-block:... | python | def list_sessions(logged_in_users_only=False):
'''
List information about the sessions.
.. versionadded:: 2016.11.0
:param logged_in_users_only: If True, only return sessions with users logged in.
:return: A list containing dictionaries of session information.
CLI Example:
.. code-block:... | [
"def",
"list_sessions",
"(",
"logged_in_users_only",
"=",
"False",
")",
":",
"ret",
"=",
"list",
"(",
")",
"server",
"=",
"win32ts",
".",
"WTS_CURRENT_SERVER_HANDLE",
"protocols",
"=",
"{",
"win32ts",
".",
"WTS_PROTOCOL_TYPE_CONSOLE",
":",
"'console'",
",",
"win... | List information about the sessions.
.. versionadded:: 2016.11.0
:param logged_in_users_only: If True, only return sessions with users logged in.
:return: A list containing dictionaries of session information.
CLI Example:
.. code-block:: bash
salt '*' rdp.list_sessions | [
"List",
"information",
"about",
"the",
"sessions",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rdp.py#L104-L151 |
33,059 | saltstack/salt | salt/modules/rdp.py | disconnect_session | def disconnect_session(session_id):
'''
Disconnect a session.
.. versionadded:: 2016.11.0
:param session_id: The numeric Id of the session.
:return: A boolean representing whether the disconnect succeeded.
CLI Example:
.. code-block:: bash
salt '*' rdp.disconnect_session session... | python | def disconnect_session(session_id):
'''
Disconnect a session.
.. versionadded:: 2016.11.0
:param session_id: The numeric Id of the session.
:return: A boolean representing whether the disconnect succeeded.
CLI Example:
.. code-block:: bash
salt '*' rdp.disconnect_session session... | [
"def",
"disconnect_session",
"(",
"session_id",
")",
":",
"try",
":",
"win32ts",
".",
"WTSDisconnectSession",
"(",
"win32ts",
".",
"WTS_CURRENT_SERVER_HANDLE",
",",
"session_id",
",",
"True",
")",
"except",
"PyWinError",
"as",
"error",
":",
"_LOG",
".",
"error",... | Disconnect a session.
.. versionadded:: 2016.11.0
:param session_id: The numeric Id of the session.
:return: A boolean representing whether the disconnect succeeded.
CLI Example:
.. code-block:: bash
salt '*' rdp.disconnect_session session_id
salt '*' rdp.disconnect_session 99 | [
"Disconnect",
"a",
"session",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rdp.py#L185-L207 |
33,060 | saltstack/salt | salt/modules/rdp.py | logoff_session | def logoff_session(session_id):
'''
Initiate the logoff of a session.
.. versionadded:: 2016.11.0
:param session_id: The numeric Id of the session.
:return: A boolean representing whether the logoff succeeded.
CLI Example:
.. code-block:: bash
salt '*' rdp.logoff_session session... | python | def logoff_session(session_id):
'''
Initiate the logoff of a session.
.. versionadded:: 2016.11.0
:param session_id: The numeric Id of the session.
:return: A boolean representing whether the logoff succeeded.
CLI Example:
.. code-block:: bash
salt '*' rdp.logoff_session session... | [
"def",
"logoff_session",
"(",
"session_id",
")",
":",
"try",
":",
"win32ts",
".",
"WTSLogoffSession",
"(",
"win32ts",
".",
"WTS_CURRENT_SERVER_HANDLE",
",",
"session_id",
",",
"True",
")",
"except",
"PyWinError",
"as",
"error",
":",
"_LOG",
".",
"error",
"(",
... | Initiate the logoff of a session.
.. versionadded:: 2016.11.0
:param session_id: The numeric Id of the session.
:return: A boolean representing whether the logoff succeeded.
CLI Example:
.. code-block:: bash
salt '*' rdp.logoff_session session_id
salt '*' rdp.logoff_session 99 | [
"Initiate",
"the",
"logoff",
"of",
"a",
"session",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rdp.py#L211-L233 |
33,061 | saltstack/salt | salt/runners/fileserver.py | envs | def envs(backend=None, sources=False):
'''
Return the available fileserver environments. If no backend is provided,
then the environments for all configured backends will be returned.
backend
Narrow fileserver backends to a subset of the enabled ones.
.. versionchanged:: 2015.5.0
... | python | def envs(backend=None, sources=False):
'''
Return the available fileserver environments. If no backend is provided,
then the environments for all configured backends will be returned.
backend
Narrow fileserver backends to a subset of the enabled ones.
.. versionchanged:: 2015.5.0
... | [
"def",
"envs",
"(",
"backend",
"=",
"None",
",",
"sources",
"=",
"False",
")",
":",
"fileserver",
"=",
"salt",
".",
"fileserver",
".",
"Fileserver",
"(",
"__opts__",
")",
"return",
"sorted",
"(",
"fileserver",
".",
"envs",
"(",
"back",
"=",
"backend",
... | Return the available fileserver environments. If no backend is provided,
then the environments for all configured backends will be returned.
backend
Narrow fileserver backends to a subset of the enabled ones.
.. versionchanged:: 2015.5.0
If all passed backends start with a minus si... | [
"Return",
"the",
"available",
"fileserver",
"environments",
".",
"If",
"no",
"backend",
"is",
"provided",
"then",
"the",
"environments",
"for",
"all",
"configured",
"backends",
"will",
"be",
"returned",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L11-L39 |
33,062 | saltstack/salt | salt/runners/fileserver.py | file_list | def file_list(saltenv='base', backend=None):
'''
Return a list of files from the salt fileserver
saltenv : base
The salt fileserver environment to be listed
backend
Narrow fileserver backends to a subset of the enabled ones. If all
passed backends start with a minus sign (``-``... | python | def file_list(saltenv='base', backend=None):
'''
Return a list of files from the salt fileserver
saltenv : base
The salt fileserver environment to be listed
backend
Narrow fileserver backends to a subset of the enabled ones. If all
passed backends start with a minus sign (``-``... | [
"def",
"file_list",
"(",
"saltenv",
"=",
"'base'",
",",
"backend",
"=",
"None",
")",
":",
"fileserver",
"=",
"salt",
".",
"fileserver",
".",
"Fileserver",
"(",
"__opts__",
")",
"load",
"=",
"{",
"'saltenv'",
":",
"saltenv",
",",
"'fsbackend'",
":",
"back... | Return a list of files from the salt fileserver
saltenv : base
The salt fileserver environment to be listed
backend
Narrow fileserver backends to a subset of the enabled ones. If all
passed backends start with a minus sign (``-``), then these backends
will be excluded from the ... | [
"Return",
"a",
"list",
"of",
"files",
"from",
"the",
"salt",
"fileserver"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L150-L193 |
33,063 | saltstack/salt | salt/runners/fileserver.py | dir_list | def dir_list(saltenv='base', backend=None):
'''
Return a list of directories in the given environment
saltenv : base
The salt fileserver environment to be listed
backend
Narrow fileserver backends to a subset of the enabled ones. If all
passed backends start with a minus sign (... | python | def dir_list(saltenv='base', backend=None):
'''
Return a list of directories in the given environment
saltenv : base
The salt fileserver environment to be listed
backend
Narrow fileserver backends to a subset of the enabled ones. If all
passed backends start with a minus sign (... | [
"def",
"dir_list",
"(",
"saltenv",
"=",
"'base'",
",",
"backend",
"=",
"None",
")",
":",
"fileserver",
"=",
"salt",
".",
"fileserver",
".",
"Fileserver",
"(",
"__opts__",
")",
"load",
"=",
"{",
"'saltenv'",
":",
"saltenv",
",",
"'fsbackend'",
":",
"backe... | Return a list of directories in the given environment
saltenv : base
The salt fileserver environment to be listed
backend
Narrow fileserver backends to a subset of the enabled ones. If all
passed backends start with a minus sign (``-``), then these backends
will be excluded fro... | [
"Return",
"a",
"list",
"of",
"directories",
"in",
"the",
"given",
"environment"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L242-L285 |
33,064 | saltstack/salt | salt/runners/fileserver.py | update | def update(backend=None):
'''
Update the fileserver cache. If no backend is provided, then the cache for
all configured backends will be updated.
backend
Narrow fileserver backends to a subset of the enabled ones.
.. versionchanged:: 2015.5.0
If all passed backends start wi... | python | def update(backend=None):
'''
Update the fileserver cache. If no backend is provided, then the cache for
all configured backends will be updated.
backend
Narrow fileserver backends to a subset of the enabled ones.
.. versionchanged:: 2015.5.0
If all passed backends start wi... | [
"def",
"update",
"(",
"backend",
"=",
"None",
")",
":",
"fileserver",
"=",
"salt",
".",
"fileserver",
".",
"Fileserver",
"(",
"__opts__",
")",
"fileserver",
".",
"update",
"(",
"back",
"=",
"backend",
")",
"return",
"True"
] | Update the fileserver cache. If no backend is provided, then the cache for
all configured backends will be updated.
backend
Narrow fileserver backends to a subset of the enabled ones.
.. versionchanged:: 2015.5.0
If all passed backends start with a minus sign (``-``), then these
... | [
"Update",
"the",
"fileserver",
"cache",
".",
"If",
"no",
"backend",
"is",
"provided",
"then",
"the",
"cache",
"for",
"all",
"configured",
"backends",
"will",
"be",
"updated",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L325-L353 |
33,065 | saltstack/salt | salt/key.py | KeyCLI.run | def run(self):
'''
Run the logic for saltkey
'''
self._update_opts()
cmd = self.opts['fun']
veri = None
ret = None
try:
if cmd in ('accept', 'reject', 'delete'):
ret = self._run_cmd('name_match')
if not isinstan... | python | def run(self):
'''
Run the logic for saltkey
'''
self._update_opts()
cmd = self.opts['fun']
veri = None
ret = None
try:
if cmd in ('accept', 'reject', 'delete'):
ret = self._run_cmd('name_match')
if not isinstan... | [
"def",
"run",
"(",
"self",
")",
":",
"self",
".",
"_update_opts",
"(",
")",
"cmd",
"=",
"self",
".",
"opts",
"[",
"'fun'",
"]",
"veri",
"=",
"None",
"ret",
"=",
"None",
"try",
":",
"if",
"cmd",
"in",
"(",
"'accept'",
",",
"'reject'",
",",
"'delet... | Run the logic for saltkey | [
"Run",
"the",
"logic",
"for",
"saltkey"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L228-L284 |
33,066 | saltstack/salt | salt/key.py | Key._check_minions_directories | def _check_minions_directories(self):
'''
Return the minion keys directory paths
'''
minions_accepted = os.path.join(self.opts['pki_dir'], self.ACC)
minions_pre = os.path.join(self.opts['pki_dir'], self.PEND)
minions_rejected = os.path.join(self.opts['pki_dir'],
... | python | def _check_minions_directories(self):
'''
Return the minion keys directory paths
'''
minions_accepted = os.path.join(self.opts['pki_dir'], self.ACC)
minions_pre = os.path.join(self.opts['pki_dir'], self.PEND)
minions_rejected = os.path.join(self.opts['pki_dir'],
... | [
"def",
"_check_minions_directories",
"(",
"self",
")",
":",
"minions_accepted",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"opts",
"[",
"'pki_dir'",
"]",
",",
"self",
".",
"ACC",
")",
"minions_pre",
"=",
"os",
".",
"path",
".",
"join",
"(",... | Return the minion keys directory paths | [
"Return",
"the",
"minion",
"keys",
"directory",
"paths"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L314-L325 |
33,067 | saltstack/salt | salt/key.py | Key.check_minion_cache | def check_minion_cache(self, preserve_minions=None):
'''
Check the minion cache to make sure that old minion data is cleared
Optionally, pass in a list of minions which should have their caches
preserved. To preserve all caches, set __opts__['preserve_minion_cache']
'''
... | python | def check_minion_cache(self, preserve_minions=None):
'''
Check the minion cache to make sure that old minion data is cleared
Optionally, pass in a list of minions which should have their caches
preserved. To preserve all caches, set __opts__['preserve_minion_cache']
'''
... | [
"def",
"check_minion_cache",
"(",
"self",
",",
"preserve_minions",
"=",
"None",
")",
":",
"if",
"preserve_minions",
"is",
"None",
":",
"preserve_minions",
"=",
"[",
"]",
"keys",
"=",
"self",
".",
"list_keys",
"(",
")",
"minions",
"=",
"[",
"]",
"for",
"k... | Check the minion cache to make sure that old minion data is cleared
Optionally, pass in a list of minions which should have their caches
preserved. To preserve all caches, set __opts__['preserve_minion_cache'] | [
"Check",
"the",
"minion",
"cache",
"to",
"make",
"sure",
"that",
"old",
"minion",
"data",
"is",
"cleared"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L418-L448 |
33,068 | saltstack/salt | salt/key.py | Key.check_master | def check_master(self):
'''
Log if the master is not running
:rtype: bool
:return: Whether or not the master is running
'''
if not os.path.exists(
os.path.join(
self.opts['sock_dir'],
'publish_pull.ipc'
... | python | def check_master(self):
'''
Log if the master is not running
:rtype: bool
:return: Whether or not the master is running
'''
if not os.path.exists(
os.path.join(
self.opts['sock_dir'],
'publish_pull.ipc'
... | [
"def",
"check_master",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"opts",
"[",
"'sock_dir'",
"]",
",",
"'publish_pull.ipc'",
")",
")",
":",
"return",
"False",
"return",... | Log if the master is not running
:rtype: bool
:return: Whether or not the master is running | [
"Log",
"if",
"the",
"master",
"is",
"not",
"running"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L450-L464 |
33,069 | saltstack/salt | salt/key.py | Key.name_match | def name_match(self, match, full=False):
'''
Accept a glob which to match the of a key and return the key's location
'''
if full:
matches = self.all_keys()
else:
matches = self.list_keys()
ret = {}
if ',' in match and isinstance(match, six.... | python | def name_match(self, match, full=False):
'''
Accept a glob which to match the of a key and return the key's location
'''
if full:
matches = self.all_keys()
else:
matches = self.list_keys()
ret = {}
if ',' in match and isinstance(match, six.... | [
"def",
"name_match",
"(",
"self",
",",
"match",
",",
"full",
"=",
"False",
")",
":",
"if",
"full",
":",
"matches",
"=",
"self",
".",
"all_keys",
"(",
")",
"else",
":",
"matches",
"=",
"self",
".",
"list_keys",
"(",
")",
"ret",
"=",
"{",
"}",
"if"... | Accept a glob which to match the of a key and return the key's location | [
"Accept",
"a",
"glob",
"which",
"to",
"match",
"the",
"of",
"a",
"key",
"and",
"return",
"the",
"key",
"s",
"location"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L466-L490 |
33,070 | saltstack/salt | salt/key.py | Key.dict_match | def dict_match(self, match_dict):
'''
Accept a dictionary of keys and return the current state of the
specified keys
'''
ret = {}
cur_keys = self.list_keys()
for status, keys in six.iteritems(match_dict):
for key in salt.utils.data.sorted_ignorecase(ke... | python | def dict_match(self, match_dict):
'''
Accept a dictionary of keys and return the current state of the
specified keys
'''
ret = {}
cur_keys = self.list_keys()
for status, keys in six.iteritems(match_dict):
for key in salt.utils.data.sorted_ignorecase(ke... | [
"def",
"dict_match",
"(",
"self",
",",
"match_dict",
")",
":",
"ret",
"=",
"{",
"}",
"cur_keys",
"=",
"self",
".",
"list_keys",
"(",
")",
"for",
"status",
",",
"keys",
"in",
"six",
".",
"iteritems",
"(",
"match_dict",
")",
":",
"for",
"key",
"in",
... | Accept a dictionary of keys and return the current state of the
specified keys | [
"Accept",
"a",
"dictionary",
"of",
"keys",
"and",
"return",
"the",
"current",
"state",
"of",
"the",
"specified",
"keys"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L492-L504 |
33,071 | saltstack/salt | salt/key.py | Key.local_keys | def local_keys(self):
'''
Return a dict of local keys
'''
ret = {'local': []}
for fn_ in salt.utils.data.sorted_ignorecase(os.listdir(self.opts['pki_dir'])):
if fn_.endswith('.pub') or fn_.endswith('.pem'):
path = os.path.join(self.opts['pki_dir'], fn_... | python | def local_keys(self):
'''
Return a dict of local keys
'''
ret = {'local': []}
for fn_ in salt.utils.data.sorted_ignorecase(os.listdir(self.opts['pki_dir'])):
if fn_.endswith('.pub') or fn_.endswith('.pem'):
path = os.path.join(self.opts['pki_dir'], fn_... | [
"def",
"local_keys",
"(",
"self",
")",
":",
"ret",
"=",
"{",
"'local'",
":",
"[",
"]",
"}",
"for",
"fn_",
"in",
"salt",
".",
"utils",
".",
"data",
".",
"sorted_ignorecase",
"(",
"os",
".",
"listdir",
"(",
"self",
".",
"opts",
"[",
"'pki_dir'",
"]",... | Return a dict of local keys | [
"Return",
"a",
"dict",
"of",
"local",
"keys"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L506-L516 |
33,072 | saltstack/salt | salt/key.py | Key.list_keys | def list_keys(self):
'''
Return a dict of managed keys and what the key status are
'''
key_dirs = self._check_minions_directories()
ret = {}
for dir_ in key_dirs:
if dir_ is None:
continue
ret[os.path.basename(dir_)] = []
... | python | def list_keys(self):
'''
Return a dict of managed keys and what the key status are
'''
key_dirs = self._check_minions_directories()
ret = {}
for dir_ in key_dirs:
if dir_ is None:
continue
ret[os.path.basename(dir_)] = []
... | [
"def",
"list_keys",
"(",
"self",
")",
":",
"key_dirs",
"=",
"self",
".",
"_check_minions_directories",
"(",
")",
"ret",
"=",
"{",
"}",
"for",
"dir_",
"in",
"key_dirs",
":",
"if",
"dir_",
"is",
"None",
":",
"continue",
"ret",
"[",
"os",
".",
"path",
"... | Return a dict of managed keys and what the key status are | [
"Return",
"a",
"dict",
"of",
"managed",
"keys",
"and",
"what",
"the",
"key",
"status",
"are"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L518-L540 |
33,073 | saltstack/salt | salt/key.py | Key.all_keys | def all_keys(self):
'''
Merge managed keys with local keys
'''
keys = self.list_keys()
keys.update(self.local_keys())
return keys | python | def all_keys(self):
'''
Merge managed keys with local keys
'''
keys = self.list_keys()
keys.update(self.local_keys())
return keys | [
"def",
"all_keys",
"(",
"self",
")",
":",
"keys",
"=",
"self",
".",
"list_keys",
"(",
")",
"keys",
".",
"update",
"(",
"self",
".",
"local_keys",
"(",
")",
")",
"return",
"keys"
] | Merge managed keys with local keys | [
"Merge",
"managed",
"keys",
"with",
"local",
"keys"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L542-L548 |
33,074 | saltstack/salt | salt/key.py | Key.list_status | def list_status(self, match):
'''
Return a dict of managed keys under a named status
'''
acc, pre, rej, den = self._check_minions_directories()
ret = {}
if match.startswith('acc'):
ret[os.path.basename(acc)] = []
for fn_ in salt.utils.data.sorted_i... | python | def list_status(self, match):
'''
Return a dict of managed keys under a named status
'''
acc, pre, rej, den = self._check_minions_directories()
ret = {}
if match.startswith('acc'):
ret[os.path.basename(acc)] = []
for fn_ in salt.utils.data.sorted_i... | [
"def",
"list_status",
"(",
"self",
",",
"match",
")",
":",
"acc",
",",
"pre",
",",
"rej",
",",
"den",
"=",
"self",
".",
"_check_minions_directories",
"(",
")",
"ret",
"=",
"{",
"}",
"if",
"match",
".",
"startswith",
"(",
"'acc'",
")",
":",
"ret",
"... | Return a dict of managed keys under a named status | [
"Return",
"a",
"dict",
"of",
"managed",
"keys",
"under",
"a",
"named",
"status"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L550-L582 |
33,075 | saltstack/salt | salt/key.py | Key.key_str | def key_str(self, match):
'''
Return the specified public key or keys based on a glob
'''
ret = {}
for status, keys in six.iteritems(self.name_match(match)):
ret[status] = {}
for key in salt.utils.data.sorted_ignorecase(keys):
path = os.pat... | python | def key_str(self, match):
'''
Return the specified public key or keys based on a glob
'''
ret = {}
for status, keys in six.iteritems(self.name_match(match)):
ret[status] = {}
for key in salt.utils.data.sorted_ignorecase(keys):
path = os.pat... | [
"def",
"key_str",
"(",
"self",
",",
"match",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"status",
",",
"keys",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"name_match",
"(",
"match",
")",
")",
":",
"ret",
"[",
"status",
"]",
"=",
"{",
"}",
"fo... | Return the specified public key or keys based on a glob | [
"Return",
"the",
"specified",
"public",
"key",
"or",
"keys",
"based",
"on",
"a",
"glob"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L584-L596 |
33,076 | saltstack/salt | salt/key.py | Key.accept | def accept(self, match=None, match_dict=None, include_rejected=False, include_denied=False):
'''
Accept public keys. If "match" is passed, it is evaluated as a glob.
Pre-gathered matches can also be passed via "match_dict".
'''
if match is not None:
matches = self.nam... | python | def accept(self, match=None, match_dict=None, include_rejected=False, include_denied=False):
'''
Accept public keys. If "match" is passed, it is evaluated as a glob.
Pre-gathered matches can also be passed via "match_dict".
'''
if match is not None:
matches = self.nam... | [
"def",
"accept",
"(",
"self",
",",
"match",
"=",
"None",
",",
"match_dict",
"=",
"None",
",",
"include_rejected",
"=",
"False",
",",
"include_denied",
"=",
"False",
")",
":",
"if",
"match",
"is",
"not",
"None",
":",
"matches",
"=",
"self",
".",
"name_m... | Accept public keys. If "match" is passed, it is evaluated as a glob.
Pre-gathered matches can also be passed via "match_dict". | [
"Accept",
"public",
"keys",
".",
"If",
"match",
"is",
"passed",
"it",
"is",
"evaluated",
"as",
"a",
"glob",
".",
"Pre",
"-",
"gathered",
"matches",
"can",
"also",
"be",
"passed",
"via",
"match_dict",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L612-L651 |
33,077 | saltstack/salt | salt/key.py | Key.accept_all | def accept_all(self):
'''
Accept all keys in pre
'''
keys = self.list_keys()
for key in keys[self.PEND]:
try:
shutil.move(
os.path.join(
self.opts['pki_dir'],
self.PEND,
... | python | def accept_all(self):
'''
Accept all keys in pre
'''
keys = self.list_keys()
for key in keys[self.PEND]:
try:
shutil.move(
os.path.join(
self.opts['pki_dir'],
self.PEND,
... | [
"def",
"accept_all",
"(",
"self",
")",
":",
"keys",
"=",
"self",
".",
"list_keys",
"(",
")",
"for",
"key",
"in",
"keys",
"[",
"self",
".",
"PEND",
"]",
":",
"try",
":",
"shutil",
".",
"move",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".... | Accept all keys in pre | [
"Accept",
"all",
"keys",
"in",
"pre"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L653-L677 |
33,078 | saltstack/salt | salt/key.py | Key.delete_key | def delete_key(self,
match=None,
match_dict=None,
preserve_minions=None,
revoke_auth=False):
'''
Delete public keys. If "match" is passed, it is evaluated as a glob.
Pre-gathered matches can also be passed via "match... | python | def delete_key(self,
match=None,
match_dict=None,
preserve_minions=None,
revoke_auth=False):
'''
Delete public keys. If "match" is passed, it is evaluated as a glob.
Pre-gathered matches can also be passed via "match... | [
"def",
"delete_key",
"(",
"self",
",",
"match",
"=",
"None",
",",
"match_dict",
"=",
"None",
",",
"preserve_minions",
"=",
"None",
",",
"revoke_auth",
"=",
"False",
")",
":",
"if",
"match",
"is",
"not",
"None",
":",
"matches",
"=",
"self",
".",
"name_m... | Delete public keys. If "match" is passed, it is evaluated as a glob.
Pre-gathered matches can also be passed via "match_dict".
To preserve the master caches of minions who are matched, set preserve_minions | [
"Delete",
"public",
"keys",
".",
"If",
"match",
"is",
"passed",
"it",
"is",
"evaluated",
"as",
"a",
"glob",
".",
"Pre",
"-",
"gathered",
"matches",
"can",
"also",
"be",
"passed",
"via",
"match_dict",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L679-L729 |
33,079 | saltstack/salt | salt/key.py | Key.delete_den | def delete_den(self):
'''
Delete all denied keys
'''
keys = self.list_keys()
for status, keys in six.iteritems(self.list_keys()):
for key in keys[self.DEN]:
try:
os.remove(os.path.join(self.opts['pki_dir'], status, key))
... | python | def delete_den(self):
'''
Delete all denied keys
'''
keys = self.list_keys()
for status, keys in six.iteritems(self.list_keys()):
for key in keys[self.DEN]:
try:
os.remove(os.path.join(self.opts['pki_dir'], status, key))
... | [
"def",
"delete_den",
"(",
"self",
")",
":",
"keys",
"=",
"self",
".",
"list_keys",
"(",
")",
"for",
"status",
",",
"keys",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"list_keys",
"(",
")",
")",
":",
"for",
"key",
"in",
"keys",
"[",
"self",
... | Delete all denied keys | [
"Delete",
"all",
"denied",
"keys"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L731-L748 |
33,080 | saltstack/salt | salt/key.py | Key.delete_all | def delete_all(self):
'''
Delete all keys
'''
for status, keys in six.iteritems(self.list_keys()):
for key in keys:
try:
os.remove(os.path.join(self.opts['pki_dir'], status, key))
eload = {'result': True,
... | python | def delete_all(self):
'''
Delete all keys
'''
for status, keys in six.iteritems(self.list_keys()):
for key in keys:
try:
os.remove(os.path.join(self.opts['pki_dir'], status, key))
eload = {'result': True,
... | [
"def",
"delete_all",
"(",
"self",
")",
":",
"for",
"status",
",",
"keys",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"list_keys",
"(",
")",
")",
":",
"for",
"key",
"in",
"keys",
":",
"try",
":",
"os",
".",
"remove",
"(",
"os",
".",
"path",
... | Delete all keys | [
"Delete",
"all",
"keys"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L750-L768 |
33,081 | saltstack/salt | salt/key.py | Key.reject_all | def reject_all(self):
'''
Reject all keys in pre
'''
keys = self.list_keys()
for key in keys[self.PEND]:
try:
shutil.move(
os.path.join(
self.opts['pki_dir'],
self.PEND,
... | python | def reject_all(self):
'''
Reject all keys in pre
'''
keys = self.list_keys()
for key in keys[self.PEND]:
try:
shutil.move(
os.path.join(
self.opts['pki_dir'],
self.PEND,
... | [
"def",
"reject_all",
"(",
"self",
")",
":",
"keys",
"=",
"self",
".",
"list_keys",
"(",
")",
"for",
"key",
"in",
"keys",
"[",
"self",
".",
"PEND",
"]",
":",
"try",
":",
"shutil",
".",
"move",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".... | Reject all keys in pre | [
"Reject",
"all",
"keys",
"in",
"pre"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L814-L841 |
33,082 | saltstack/salt | salt/key.py | Key.finger | def finger(self, match, hash_type=None):
'''
Return the fingerprint for a specified key
'''
if hash_type is None:
hash_type = __opts__['hash_type']
matches = self.name_match(match, True)
ret = {}
for status, keys in six.iteritems(matches):
... | python | def finger(self, match, hash_type=None):
'''
Return the fingerprint for a specified key
'''
if hash_type is None:
hash_type = __opts__['hash_type']
matches = self.name_match(match, True)
ret = {}
for status, keys in six.iteritems(matches):
... | [
"def",
"finger",
"(",
"self",
",",
"match",
",",
"hash_type",
"=",
"None",
")",
":",
"if",
"hash_type",
"is",
"None",
":",
"hash_type",
"=",
"__opts__",
"[",
"'hash_type'",
"]",
"matches",
"=",
"self",
".",
"name_match",
"(",
"match",
",",
"True",
")",... | Return the fingerprint for a specified key | [
"Return",
"the",
"fingerprint",
"for",
"a",
"specified",
"key"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L843-L860 |
33,083 | saltstack/salt | salt/key.py | Key.finger_all | def finger_all(self, hash_type=None):
'''
Return fingerprints for all keys
'''
if hash_type is None:
hash_type = __opts__['hash_type']
ret = {}
for status, keys in six.iteritems(self.all_keys()):
ret[status] = {}
for key in keys:
... | python | def finger_all(self, hash_type=None):
'''
Return fingerprints for all keys
'''
if hash_type is None:
hash_type = __opts__['hash_type']
ret = {}
for status, keys in six.iteritems(self.all_keys()):
ret[status] = {}
for key in keys:
... | [
"def",
"finger_all",
"(",
"self",
",",
"hash_type",
"=",
"None",
")",
":",
"if",
"hash_type",
"is",
"None",
":",
"hash_type",
"=",
"__opts__",
"[",
"'hash_type'",
"]",
"ret",
"=",
"{",
"}",
"for",
"status",
",",
"keys",
"in",
"six",
".",
"iteritems",
... | Return fingerprints for all keys | [
"Return",
"fingerprints",
"for",
"all",
"keys"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L862-L878 |
33,084 | saltstack/salt | salt/modules/tomcat.py | __catalina_home | def __catalina_home():
'''
Tomcat paths differ depending on packaging
'''
locations = ['/usr/share/tomcat*', '/opt/tomcat']
for location in locations:
folders = glob.glob(location)
if folders:
for catalina_home in folders:
if os.path.isdir(catalina_home + ... | python | def __catalina_home():
'''
Tomcat paths differ depending on packaging
'''
locations = ['/usr/share/tomcat*', '/opt/tomcat']
for location in locations:
folders = glob.glob(location)
if folders:
for catalina_home in folders:
if os.path.isdir(catalina_home + ... | [
"def",
"__catalina_home",
"(",
")",
":",
"locations",
"=",
"[",
"'/usr/share/tomcat*'",
",",
"'/opt/tomcat'",
"]",
"for",
"location",
"in",
"locations",
":",
"folders",
"=",
"glob",
".",
"glob",
"(",
"location",
")",
"if",
"folders",
":",
"for",
"catalina_ho... | Tomcat paths differ depending on packaging | [
"Tomcat",
"paths",
"differ",
"depending",
"on",
"packaging"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L119-L130 |
33,085 | saltstack/salt | salt/modules/tomcat.py | _get_credentials | def _get_credentials():
'''
Get the username and password from opts, grains, or pillar
'''
ret = {
'user': False,
'passwd': False
}
# Loop through opts, grains, and pillar
# Return the first acceptable configuration found
for item in ret:
for struct in [__opts__,... | python | def _get_credentials():
'''
Get the username and password from opts, grains, or pillar
'''
ret = {
'user': False,
'passwd': False
}
# Loop through opts, grains, and pillar
# Return the first acceptable configuration found
for item in ret:
for struct in [__opts__,... | [
"def",
"_get_credentials",
"(",
")",
":",
"ret",
"=",
"{",
"'user'",
":",
"False",
",",
"'passwd'",
":",
"False",
"}",
"# Loop through opts, grains, and pillar",
"# Return the first acceptable configuration found",
"for",
"item",
"in",
"ret",
":",
"for",
"struct",
"... | Get the username and password from opts, grains, or pillar | [
"Get",
"the",
"username",
"and",
"password",
"from",
"opts",
"grains",
"or",
"pillar"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L133-L156 |
33,086 | saltstack/salt | salt/modules/tomcat.py | _auth | def _auth(uri):
'''
returns a authentication handler.
Get user & password from grains, if are not set default to
modules.config.option
If user & pass are missing return False
'''
user, password = _get_credentials()
if user is False or password is False:
return False
basic ... | python | def _auth(uri):
'''
returns a authentication handler.
Get user & password from grains, if are not set default to
modules.config.option
If user & pass are missing return False
'''
user, password = _get_credentials()
if user is False or password is False:
return False
basic ... | [
"def",
"_auth",
"(",
"uri",
")",
":",
"user",
",",
"password",
"=",
"_get_credentials",
"(",
")",
"if",
"user",
"is",
"False",
"or",
"password",
"is",
"False",
":",
"return",
"False",
"basic",
"=",
"_HTTPBasicAuthHandler",
"(",
")",
"basic",
".",
"add_pa... | returns a authentication handler.
Get user & password from grains, if are not set default to
modules.config.option
If user & pass are missing return False | [
"returns",
"a",
"authentication",
"handler",
".",
"Get",
"user",
"&",
"password",
"from",
"grains",
"if",
"are",
"not",
"set",
"default",
"to",
"modules",
".",
"config",
".",
"option"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L159-L178 |
33,087 | saltstack/salt | salt/modules/tomcat.py | extract_war_version | def extract_war_version(war):
'''
Extract the version from the war file name. There does not seem to be a
standard for encoding the version into the `war file name`_
.. _`war file name`: https://tomcat.apache.org/tomcat-6.0-doc/deployer-howto.html
Examples:
.. code-block:: bash
/path... | python | def extract_war_version(war):
'''
Extract the version from the war file name. There does not seem to be a
standard for encoding the version into the `war file name`_
.. _`war file name`: https://tomcat.apache.org/tomcat-6.0-doc/deployer-howto.html
Examples:
.. code-block:: bash
/path... | [
"def",
"extract_war_version",
"(",
"war",
")",
":",
"basename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"war",
")",
"war_package",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"basename",
")",
"[",
"0",
"]",
"# remove '.war'",
"version",
"=",
"r... | Extract the version from the war file name. There does not seem to be a
standard for encoding the version into the `war file name`_
.. _`war file name`: https://tomcat.apache.org/tomcat-6.0-doc/deployer-howto.html
Examples:
.. code-block:: bash
/path/salt-2015.8.6.war -> 2015.8.6
/pa... | [
"Extract",
"the",
"version",
"from",
"the",
"war",
"file",
"name",
".",
"There",
"does",
"not",
"seem",
"to",
"be",
"a",
"standard",
"for",
"encoding",
"the",
"version",
"into",
"the",
"war",
"file",
"name",
"_"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L181-L198 |
33,088 | saltstack/salt | salt/modules/tomcat.py | _wget | def _wget(cmd, opts=None, url='http://localhost:8080/manager', timeout=180):
'''
A private function used to issue the command to tomcat via the manager
webapp
cmd
the command to execute
url
The URL of the server manager webapp (example:
http://localhost:8080/manager)
o... | python | def _wget(cmd, opts=None, url='http://localhost:8080/manager', timeout=180):
'''
A private function used to issue the command to tomcat via the manager
webapp
cmd
the command to execute
url
The URL of the server manager webapp (example:
http://localhost:8080/manager)
o... | [
"def",
"_wget",
"(",
"cmd",
",",
"opts",
"=",
"None",
",",
"url",
"=",
"'http://localhost:8080/manager'",
",",
"timeout",
"=",
"180",
")",
":",
"ret",
"=",
"{",
"'res'",
":",
"True",
",",
"'msg'",
":",
"[",
"]",
"}",
"# prepare authentication",
"auth",
... | A private function used to issue the command to tomcat via the manager
webapp
cmd
the command to execute
url
The URL of the server manager webapp (example:
http://localhost:8080/manager)
opts
a dict of arguments
timeout
timeout for HTTP request
Return... | [
"A",
"private",
"function",
"used",
"to",
"issue",
"the",
"command",
"to",
"tomcat",
"via",
"the",
"manager",
"webapp"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L201-L265 |
33,089 | saltstack/salt | salt/modules/tomcat.py | _simple_cmd | def _simple_cmd(cmd, app, url='http://localhost:8080/manager', timeout=180):
'''
Simple command wrapper to commands that need only a path option
'''
try:
opts = {
'path': app,
'version': ls(url)[app]['version']
}
return '\n'.join(_wget(cmd, opts, url, tim... | python | def _simple_cmd(cmd, app, url='http://localhost:8080/manager', timeout=180):
'''
Simple command wrapper to commands that need only a path option
'''
try:
opts = {
'path': app,
'version': ls(url)[app]['version']
}
return '\n'.join(_wget(cmd, opts, url, tim... | [
"def",
"_simple_cmd",
"(",
"cmd",
",",
"app",
",",
"url",
"=",
"'http://localhost:8080/manager'",
",",
"timeout",
"=",
"180",
")",
":",
"try",
":",
"opts",
"=",
"{",
"'path'",
":",
"app",
",",
"'version'",
":",
"ls",
"(",
"url",
")",
"[",
"app",
"]",... | Simple command wrapper to commands that need only a path option | [
"Simple",
"command",
"wrapper",
"to",
"commands",
"that",
"need",
"only",
"a",
"path",
"option"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L268-L280 |
33,090 | saltstack/salt | salt/modules/tomcat.py | ls | def ls(url='http://localhost:8080/manager', timeout=180):
'''
list all the deployed webapps
url : http://localhost:8080/manager
the URL of the server manager webapp
timeout : 180
timeout for HTTP request
CLI Examples:
.. code-block:: bash
salt '*' tomcat.ls
sa... | python | def ls(url='http://localhost:8080/manager', timeout=180):
'''
list all the deployed webapps
url : http://localhost:8080/manager
the URL of the server manager webapp
timeout : 180
timeout for HTTP request
CLI Examples:
.. code-block:: bash
salt '*' tomcat.ls
sa... | [
"def",
"ls",
"(",
"url",
"=",
"'http://localhost:8080/manager'",
",",
"timeout",
"=",
"180",
")",
":",
"ret",
"=",
"{",
"}",
"data",
"=",
"_wget",
"(",
"'list'",
",",
"''",
",",
"url",
",",
"timeout",
"=",
"timeout",
")",
"if",
"data",
"[",
"'res'",
... | list all the deployed webapps
url : http://localhost:8080/manager
the URL of the server manager webapp
timeout : 180
timeout for HTTP request
CLI Examples:
.. code-block:: bash
salt '*' tomcat.ls
salt '*' tomcat.ls http://localhost:8080/manager | [
"list",
"all",
"the",
"deployed",
"webapps"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L324-L358 |
33,091 | saltstack/salt | salt/modules/tomcat.py | serverinfo | def serverinfo(url='http://localhost:8080/manager', timeout=180):
'''
return details about the server
url : http://localhost:8080/manager
the URL of the server manager webapp
timeout : 180
timeout for HTTP request
CLI Examples:
.. code-block:: bash
salt '*' tomcat.ser... | python | def serverinfo(url='http://localhost:8080/manager', timeout=180):
'''
return details about the server
url : http://localhost:8080/manager
the URL of the server manager webapp
timeout : 180
timeout for HTTP request
CLI Examples:
.. code-block:: bash
salt '*' tomcat.ser... | [
"def",
"serverinfo",
"(",
"url",
"=",
"'http://localhost:8080/manager'",
",",
"timeout",
"=",
"180",
")",
":",
"data",
"=",
"_wget",
"(",
"'serverinfo'",
",",
"{",
"}",
",",
"url",
",",
"timeout",
"=",
"timeout",
")",
"if",
"data",
"[",
"'res'",
"]",
"... | return details about the server
url : http://localhost:8080/manager
the URL of the server manager webapp
timeout : 180
timeout for HTTP request
CLI Examples:
.. code-block:: bash
salt '*' tomcat.serverinfo
salt '*' tomcat.serverinfo http://localhost:8080/manager | [
"return",
"details",
"about",
"the",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L476-L503 |
33,092 | saltstack/salt | salt/modules/tomcat.py | deploy_war | def deploy_war(war,
context,
force='no',
url='http://localhost:8080/manager',
saltenv='base',
timeout=180,
temp_war_location=None,
version=True):
'''
Deploy a WAR file
war
absolute path to WAR f... | python | def deploy_war(war,
context,
force='no',
url='http://localhost:8080/manager',
saltenv='base',
timeout=180,
temp_war_location=None,
version=True):
'''
Deploy a WAR file
war
absolute path to WAR f... | [
"def",
"deploy_war",
"(",
"war",
",",
"context",
",",
"force",
"=",
"'no'",
",",
"url",
"=",
"'http://localhost:8080/manager'",
",",
"saltenv",
"=",
"'base'",
",",
"timeout",
"=",
"180",
",",
"temp_war_location",
"=",
"None",
",",
"version",
"=",
"True",
"... | Deploy a WAR file
war
absolute path to WAR file (should be accessible by the user running
tomcat) or a path supported by the salt.modules.cp.get_file function
context
the context path to deploy
force : False
set True to deploy the webapp even one is deployed in the context
... | [
"Deploy",
"a",
"WAR",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L528-L635 |
33,093 | saltstack/salt | salt/modules/tomcat.py | version | def version():
'''
Return server version from catalina.sh version
CLI Example:
.. code-block:: bash
salt '*' tomcat.version
'''
cmd = __catalina_home() + '/bin/catalina.sh version'
out = __salt__['cmd.run'](cmd).splitlines()
for line in out:
if not line:
co... | python | def version():
'''
Return server version from catalina.sh version
CLI Example:
.. code-block:: bash
salt '*' tomcat.version
'''
cmd = __catalina_home() + '/bin/catalina.sh version'
out = __salt__['cmd.run'](cmd).splitlines()
for line in out:
if not line:
co... | [
"def",
"version",
"(",
")",
":",
"cmd",
"=",
"__catalina_home",
"(",
")",
"+",
"'/bin/catalina.sh version'",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
")",
".",
"splitlines",
"(",
")",
"for",
"line",
"in",
"out",
":",
"if",
"not",
"lin... | Return server version from catalina.sh version
CLI Example:
.. code-block:: bash
salt '*' tomcat.version | [
"Return",
"server",
"version",
"from",
"catalina",
".",
"sh",
"version"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L667-L684 |
33,094 | saltstack/salt | salt/modules/tomcat.py | fullversion | def fullversion():
'''
Return all server information from catalina.sh version
CLI Example:
.. code-block:: bash
salt '*' tomcat.fullversion
'''
cmd = __catalina_home() + '/bin/catalina.sh version'
ret = {}
out = __salt__['cmd.run'](cmd).splitlines()
for line in out:
... | python | def fullversion():
'''
Return all server information from catalina.sh version
CLI Example:
.. code-block:: bash
salt '*' tomcat.fullversion
'''
cmd = __catalina_home() + '/bin/catalina.sh version'
ret = {}
out = __salt__['cmd.run'](cmd).splitlines()
for line in out:
... | [
"def",
"fullversion",
"(",
")",
":",
"cmd",
"=",
"__catalina_home",
"(",
")",
"+",
"'/bin/catalina.sh version'",
"ret",
"=",
"{",
"}",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
")",
".",
"splitlines",
"(",
")",
"for",
"line",
"in",
"ou... | Return all server information from catalina.sh version
CLI Example:
.. code-block:: bash
salt '*' tomcat.fullversion | [
"Return",
"all",
"server",
"information",
"from",
"catalina",
".",
"sh",
"version"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L687-L706 |
33,095 | saltstack/salt | salt/modules/tomcat.py | signal | def signal(signal=None):
'''
Signals catalina to start, stop, securestart, forcestop.
CLI Example:
.. code-block:: bash
salt '*' tomcat.signal start
'''
valid_signals = {'forcestop': 'stop -force',
'securestart': 'start -security',
'start': 's... | python | def signal(signal=None):
'''
Signals catalina to start, stop, securestart, forcestop.
CLI Example:
.. code-block:: bash
salt '*' tomcat.signal start
'''
valid_signals = {'forcestop': 'stop -force',
'securestart': 'start -security',
'start': 's... | [
"def",
"signal",
"(",
"signal",
"=",
"None",
")",
":",
"valid_signals",
"=",
"{",
"'forcestop'",
":",
"'stop -force'",
",",
"'securestart'",
":",
"'start -security'",
",",
"'start'",
":",
"'start'",
",",
"'stop'",
":",
"'stop'",
"}",
"if",
"signal",
"not",
... | Signals catalina to start, stop, securestart, forcestop.
CLI Example:
.. code-block:: bash
salt '*' tomcat.signal start | [
"Signals",
"catalina",
"to",
"start",
"stop",
"securestart",
"forcestop",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L709-L730 |
33,096 | saltstack/salt | salt/returners/appoptics_return.py | _get_options | def _get_options(ret=None):
'''
Get the appoptics options from salt.
'''
attrs = {
'api_token': 'api_token',
'api_url': 'api_url',
'tags': 'tags',
'sls_states': 'sls_states'
}
_options = salt.returners.get_returner_options(
__virtualname__,
ret,
... | python | def _get_options(ret=None):
'''
Get the appoptics options from salt.
'''
attrs = {
'api_token': 'api_token',
'api_url': 'api_url',
'tags': 'tags',
'sls_states': 'sls_states'
}
_options = salt.returners.get_returner_options(
__virtualname__,
ret,
... | [
"def",
"_get_options",
"(",
"ret",
"=",
"None",
")",
":",
"attrs",
"=",
"{",
"'api_token'",
":",
"'api_token'",
",",
"'api_url'",
":",
"'api_url'",
",",
"'tags'",
":",
"'tags'",
",",
"'sls_states'",
":",
"'sls_states'",
"}",
"_options",
"=",
"salt",
".",
... | Get the appoptics options from salt. | [
"Get",
"the",
"appoptics",
"options",
"from",
"salt",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/appoptics_return.py#L98-L123 |
33,097 | saltstack/salt | salt/returners/appoptics_return.py | _get_appoptics | def _get_appoptics(options):
'''
Return an appoptics connection object.
'''
conn = appoptics_metrics.connect(
options.get('api_token'),
sanitizer=appoptics_metrics.sanitize_metric_name,
hostname=options.get('api_url'))
log.info("Connected to appoptics.")
return conn | python | def _get_appoptics(options):
'''
Return an appoptics connection object.
'''
conn = appoptics_metrics.connect(
options.get('api_token'),
sanitizer=appoptics_metrics.sanitize_metric_name,
hostname=options.get('api_url'))
log.info("Connected to appoptics.")
return conn | [
"def",
"_get_appoptics",
"(",
"options",
")",
":",
"conn",
"=",
"appoptics_metrics",
".",
"connect",
"(",
"options",
".",
"get",
"(",
"'api_token'",
")",
",",
"sanitizer",
"=",
"appoptics_metrics",
".",
"sanitize_metric_name",
",",
"hostname",
"=",
"options",
... | Return an appoptics connection object. | [
"Return",
"an",
"appoptics",
"connection",
"object",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/appoptics_return.py#L126-L135 |
33,098 | saltstack/salt | salt/returners/appoptics_return.py | returner | def returner(ret):
'''
Parse the return data and return metrics to AppOptics.
For each state that's provided in the configuration, return tagged metrics for
the result of that state if it's present.
'''
options = _get_options(ret)
states_to_report = ['state.highstate']
if options.get('... | python | def returner(ret):
'''
Parse the return data and return metrics to AppOptics.
For each state that's provided in the configuration, return tagged metrics for
the result of that state if it's present.
'''
options = _get_options(ret)
states_to_report = ['state.highstate']
if options.get('... | [
"def",
"returner",
"(",
"ret",
")",
":",
"options",
"=",
"_get_options",
"(",
"ret",
")",
"states_to_report",
"=",
"[",
"'state.highstate'",
"]",
"if",
"options",
".",
"get",
"(",
"'sls_states'",
")",
":",
"states_to_report",
".",
"append",
"(",
"'state.sls'... | Parse the return data and return metrics to AppOptics.
For each state that's provided in the configuration, return tagged metrics for
the result of that state if it's present. | [
"Parse",
"the",
"return",
"data",
"and",
"return",
"metrics",
"to",
"AppOptics",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/appoptics_return.py#L186-L209 |
33,099 | saltstack/salt | salt/cli/support/intfunc.py | filetree | def filetree(collector, *paths):
'''
Add all files in the tree. If the "path" is a file,
only that file will be added.
:param path: File or directory
:return:
'''
_paths = []
# Unglob
for path in paths:
_paths += glob.glob(path)
for path in set(_paths):
if not pa... | python | def filetree(collector, *paths):
'''
Add all files in the tree. If the "path" is a file,
only that file will be added.
:param path: File or directory
:return:
'''
_paths = []
# Unglob
for path in paths:
_paths += glob.glob(path)
for path in set(_paths):
if not pa... | [
"def",
"filetree",
"(",
"collector",
",",
"*",
"paths",
")",
":",
"_paths",
"=",
"[",
"]",
"# Unglob",
"for",
"path",
"in",
"paths",
":",
"_paths",
"+=",
"glob",
".",
"glob",
"(",
"path",
")",
"for",
"path",
"in",
"set",
"(",
"_paths",
")",
":",
... | Add all files in the tree. If the "path" is a file,
only that file will be added.
:param path: File or directory
:return: | [
"Add",
"all",
"files",
"in",
"the",
"tree",
".",
"If",
"the",
"path",
"is",
"a",
"file",
"only",
"that",
"file",
"will",
"be",
"added",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/intfunc.py#L17-L53 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.