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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
35,500 | saltstack/salt | salt/modules/varnish.py | param_show | def param_show(param=None):
'''
Show params of varnish cache
CLI Example:
.. code-block:: bash
salt '*' varnish.param_show param
'''
ret = _run_varnishadm('param.show', [param])
if ret['retcode']:
return False
else:
result = {}
for line in ret['stdout']... | python | def param_show(param=None):
'''
Show params of varnish cache
CLI Example:
.. code-block:: bash
salt '*' varnish.param_show param
'''
ret = _run_varnishadm('param.show', [param])
if ret['retcode']:
return False
else:
result = {}
for line in ret['stdout']... | [
"def",
"param_show",
"(",
"param",
"=",
"None",
")",
":",
"ret",
"=",
"_run_varnishadm",
"(",
"'param.show'",
",",
"[",
"param",
"]",
")",
"if",
"ret",
"[",
"'retcode'",
"]",
":",
"return",
"False",
"else",
":",
"result",
"=",
"{",
"}",
"for",
"line"... | Show params of varnish cache
CLI Example:
.. code-block:: bash
salt '*' varnish.param_show param | [
"Show",
"params",
"of",
"varnish",
"cache"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/varnish.py#L129-L152 |
35,501 | saltstack/salt | salt/proxy/panos.py | _strip_dirty | def _strip_dirty(xmltree):
'''
Removes dirtyID tags from the candidate config result. Palo Alto devices will make the candidate configuration with
a dirty ID after a change. This can cause unexpected results when parsing.
'''
dirty = xmltree.attrib.pop('dirtyId', None)
if dirty:
xmltree.... | python | def _strip_dirty(xmltree):
'''
Removes dirtyID tags from the candidate config result. Palo Alto devices will make the candidate configuration with
a dirty ID after a change. This can cause unexpected results when parsing.
'''
dirty = xmltree.attrib.pop('dirtyId', None)
if dirty:
xmltree.... | [
"def",
"_strip_dirty",
"(",
"xmltree",
")",
":",
"dirty",
"=",
"xmltree",
".",
"attrib",
".",
"pop",
"(",
"'dirtyId'",
",",
"None",
")",
"if",
"dirty",
":",
"xmltree",
".",
"attrib",
".",
"pop",
"(",
"'admin'",
",",
"None",
")",
"xmltree",
".",
"attr... | Removes dirtyID tags from the candidate config result. Palo Alto devices will make the candidate configuration with
a dirty ID after a change. This can cause unexpected results when parsing. | [
"Removes",
"dirtyID",
"tags",
"from",
"the",
"candidate",
"config",
"result",
".",
"Palo",
"Alto",
"devices",
"will",
"make",
"the",
"candidate",
"configuration",
"with",
"a",
"dirty",
"ID",
"after",
"a",
"change",
".",
"This",
"can",
"cause",
"unexpected",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/panos.py#L238-L251 |
35,502 | saltstack/salt | salt/proxy/panos.py | init | def init(opts):
'''
This function gets called when the proxy starts up. For
panos devices, a determination is made on the connection type
and the appropriate connection details that must be cached.
'''
if 'host' not in opts['proxy']:
log.critical('No \'host\' key found in pillar for this... | python | def init(opts):
'''
This function gets called when the proxy starts up. For
panos devices, a determination is made on the connection type
and the appropriate connection details that must be cached.
'''
if 'host' not in opts['proxy']:
log.critical('No \'host\' key found in pillar for this... | [
"def",
"init",
"(",
"opts",
")",
":",
"if",
"'host'",
"not",
"in",
"opts",
"[",
"'proxy'",
"]",
":",
"log",
".",
"critical",
"(",
"'No \\'host\\' key found in pillar for this proxy.'",
")",
"return",
"False",
"if",
"'apikey'",
"not",
"in",
"opts",
"[",
"'pro... | This function gets called when the proxy starts up. For
panos devices, a determination is made on the connection type
and the appropriate connection details that must be cached. | [
"This",
"function",
"gets",
"called",
"when",
"the",
"proxy",
"starts",
"up",
".",
"For",
"panos",
"devices",
"a",
"determination",
"is",
"made",
"on",
"the",
"connection",
"type",
"and",
"the",
"appropriate",
"connection",
"details",
"that",
"must",
"be",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/panos.py#L254-L304 |
35,503 | saltstack/salt | salt/proxy/panos.py | is_required_version | def is_required_version(required_version='0.0.0'):
'''
Because different versions of Palo Alto support different command sets, this function
will return true if the current version of Palo Alto supports the required command.
'''
if 'sw-version' in DETAILS['grains_cache']:
current_version = D... | python | def is_required_version(required_version='0.0.0'):
'''
Because different versions of Palo Alto support different command sets, this function
will return true if the current version of Palo Alto supports the required command.
'''
if 'sw-version' in DETAILS['grains_cache']:
current_version = D... | [
"def",
"is_required_version",
"(",
"required_version",
"=",
"'0.0.0'",
")",
":",
"if",
"'sw-version'",
"in",
"DETAILS",
"[",
"'grains_cache'",
"]",
":",
"current_version",
"=",
"DETAILS",
"[",
"'grains_cache'",
"]",
"[",
"'sw-version'",
"]",
"else",
":",
"# If w... | Because different versions of Palo Alto support different command sets, this function
will return true if the current version of Palo Alto supports the required command. | [
"Because",
"different",
"versions",
"of",
"Palo",
"Alto",
"support",
"different",
"command",
"sets",
"this",
"function",
"will",
"return",
"true",
"if",
"the",
"current",
"version",
"of",
"Palo",
"Alto",
"supports",
"the",
"required",
"command",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/panos.py#L397-L430 |
35,504 | saltstack/salt | salt/runners/lxc.py | find_guest | def find_guest(name, quiet=False, path=None):
'''
Returns the host for a container.
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
.. code-block:: bash
salt-run lxc.find_guest name
'''
if quiet:
log... | python | def find_guest(name, quiet=False, path=None):
'''
Returns the host for a container.
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
.. code-block:: bash
salt-run lxc.find_guest name
'''
if quiet:
log... | [
"def",
"find_guest",
"(",
"name",
",",
"quiet",
"=",
"False",
",",
"path",
"=",
"None",
")",
":",
"if",
"quiet",
":",
"log",
".",
"warning",
"(",
"\"'quiet' argument is being deprecated.\"",
"' Please migrate to --quiet'",
")",
"for",
"data",
"in",
"_list_iter",... | Returns the host for a container.
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
.. code-block:: bash
salt-run lxc.find_guest name | [
"Returns",
"the",
"host",
"for",
"a",
"container",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/lxc.py#L97-L125 |
35,505 | saltstack/salt | salt/runners/lxc.py | find_guests | def find_guests(names, path=None):
'''
Return a dict of hosts and named guests
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
'''
ret = {}
names = names.split(',')
for data in _list_iter(path=path):
host,... | python | def find_guests(names, path=None):
'''
Return a dict of hosts and named guests
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
'''
ret = {}
names = names.split(',')
for data in _list_iter(path=path):
host,... | [
"def",
"find_guests",
"(",
"names",
",",
"path",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"names",
"=",
"names",
".",
"split",
"(",
"','",
")",
"for",
"data",
"in",
"_list_iter",
"(",
"path",
"=",
"path",
")",
":",
"host",
",",
"stat",
"=",
... | Return a dict of hosts and named guests
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0 | [
"Return",
"a",
"dict",
"of",
"hosts",
"and",
"named",
"guests"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/lxc.py#L128-L150 |
35,506 | saltstack/salt | salt/runners/lxc.py | cloud_init | def cloud_init(names, host=None, quiet=False, **kwargs):
'''
Wrapper for using lxc.init in saltcloud compatibility mode
names
Name of the containers, supports a single name or a comma delimited
list of names.
host
Minion to start the container on. Required.
path
pa... | python | def cloud_init(names, host=None, quiet=False, **kwargs):
'''
Wrapper for using lxc.init in saltcloud compatibility mode
names
Name of the containers, supports a single name or a comma delimited
list of names.
host
Minion to start the container on. Required.
path
pa... | [
"def",
"cloud_init",
"(",
"names",
",",
"host",
"=",
"None",
",",
"quiet",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"quiet",
":",
"log",
".",
"warning",
"(",
"\"'quiet' argument is being deprecated. Please migrate to --quiet\"",
")",
"return",
"_... | Wrapper for using lxc.init in saltcloud compatibility mode
names
Name of the containers, supports a single name or a comma delimited
list of names.
host
Minion to start the container on. Required.
path
path to the container parent
default: /var/lib/lxc (system defa... | [
"Wrapper",
"for",
"using",
"lxc",
".",
"init",
"in",
"saltcloud",
"compatibility",
"mode"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/lxc.py#L408-L431 |
35,507 | saltstack/salt | salt/runners/lxc.py | _list_iter | def _list_iter(host=None, path=None):
'''
Return a generator iterating over hosts
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
'''
tgt = host or '*'
client = salt.client.get_local_client(__opts__['conf_file'])
f... | python | def _list_iter(host=None, path=None):
'''
Return a generator iterating over hosts
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
'''
tgt = host or '*'
client = salt.client.get_local_client(__opts__['conf_file'])
f... | [
"def",
"_list_iter",
"(",
"host",
"=",
"None",
",",
"path",
"=",
"None",
")",
":",
"tgt",
"=",
"host",
"or",
"'*'",
"client",
"=",
"salt",
".",
"client",
".",
"get_local_client",
"(",
"__opts__",
"[",
"'conf_file'",
"]",
")",
"for",
"container_info",
"... | Return a generator iterating over hosts
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0 | [
"Return",
"a",
"generator",
"iterating",
"over",
"hosts"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/lxc.py#L434-L464 |
35,508 | saltstack/salt | salt/runners/lxc.py | start | def start(name, quiet=False, path=None):
'''
Start the named container.
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
.. code-block:: bash
salt-run lxc.start name
'''
data = _do_names(name, 'start', path=pa... | python | def start(name, quiet=False, path=None):
'''
Start the named container.
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
.. code-block:: bash
salt-run lxc.start name
'''
data = _do_names(name, 'start', path=pa... | [
"def",
"start",
"(",
"name",
",",
"quiet",
"=",
"False",
",",
"path",
"=",
"None",
")",
":",
"data",
"=",
"_do_names",
"(",
"name",
",",
"'start'",
",",
"path",
"=",
"path",
")",
"if",
"data",
"and",
"not",
"quiet",
":",
"__jid_event__",
".",
"fire... | Start the named container.
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
.. code-block:: bash
salt-run lxc.start name | [
"Start",
"the",
"named",
"container",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/lxc.py#L524-L542 |
35,509 | saltstack/salt | salt/modules/selinux.py | selinux_fs_path | def selinux_fs_path():
'''
Return the location of the SELinux VFS directory
CLI Example:
.. code-block:: bash
salt '*' selinux.selinux_fs_path
'''
# systems running systemd (e.g. Fedora 15 and newer)
# have the selinux filesystem in a different location
try:
for direct... | python | def selinux_fs_path():
'''
Return the location of the SELinux VFS directory
CLI Example:
.. code-block:: bash
salt '*' selinux.selinux_fs_path
'''
# systems running systemd (e.g. Fedora 15 and newer)
# have the selinux filesystem in a different location
try:
for direct... | [
"def",
"selinux_fs_path",
"(",
")",
":",
"# systems running systemd (e.g. Fedora 15 and newer)",
"# have the selinux filesystem in a different location",
"try",
":",
"for",
"directory",
"in",
"(",
"'/sys/fs/selinux'",
",",
"'/selinux'",
")",
":",
"if",
"os",
".",
"path",
... | Return the location of the SELinux VFS directory
CLI Example:
.. code-block:: bash
salt '*' selinux.selinux_fs_path | [
"Return",
"the",
"location",
"of",
"the",
"SELinux",
"VFS",
"directory"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L62-L82 |
35,510 | saltstack/salt | salt/modules/selinux.py | getenforce | def getenforce():
'''
Return the mode selinux is running in
CLI Example:
.. code-block:: bash
salt '*' selinux.getenforce
'''
_selinux_fs_path = selinux_fs_path()
if _selinux_fs_path is None:
return 'Disabled'
try:
enforce = os.path.join(_selinux_fs_path, 'enfo... | python | def getenforce():
'''
Return the mode selinux is running in
CLI Example:
.. code-block:: bash
salt '*' selinux.getenforce
'''
_selinux_fs_path = selinux_fs_path()
if _selinux_fs_path is None:
return 'Disabled'
try:
enforce = os.path.join(_selinux_fs_path, 'enfo... | [
"def",
"getenforce",
"(",
")",
":",
"_selinux_fs_path",
"=",
"selinux_fs_path",
"(",
")",
"if",
"_selinux_fs_path",
"is",
"None",
":",
"return",
"'Disabled'",
"try",
":",
"enforce",
"=",
"os",
".",
"path",
".",
"join",
"(",
"_selinux_fs_path",
",",
"'enforce... | Return the mode selinux is running in
CLI Example:
.. code-block:: bash
salt '*' selinux.getenforce | [
"Return",
"the",
"mode",
"selinux",
"is",
"running",
"in"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L85-L106 |
35,511 | saltstack/salt | salt/modules/selinux.py | getconfig | def getconfig():
'''
Return the selinux mode from the config file
CLI Example:
.. code-block:: bash
salt '*' selinux.getconfig
'''
try:
config = '/etc/selinux/config'
with salt.utils.files.fopen(config, 'r') as _fp:
for line in _fp:
line = s... | python | def getconfig():
'''
Return the selinux mode from the config file
CLI Example:
.. code-block:: bash
salt '*' selinux.getconfig
'''
try:
config = '/etc/selinux/config'
with salt.utils.files.fopen(config, 'r') as _fp:
for line in _fp:
line = s... | [
"def",
"getconfig",
"(",
")",
":",
"try",
":",
"config",
"=",
"'/etc/selinux/config'",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"config",
",",
"'r'",
")",
"as",
"_fp",
":",
"for",
"line",
"in",
"_fp",
":",
"line",
"=",
"salt",
... | Return the selinux mode from the config file
CLI Example:
.. code-block:: bash
salt '*' selinux.getconfig | [
"Return",
"the",
"selinux",
"mode",
"from",
"the",
"config",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L109-L128 |
35,512 | saltstack/salt | salt/modules/selinux.py | setenforce | def setenforce(mode):
'''
Set the SELinux enforcing mode
CLI Example:
.. code-block:: bash
salt '*' selinux.setenforce enforcing
'''
if isinstance(mode, six.string_types):
if mode.lower() == 'enforcing':
mode = '1'
modestring = 'Enforcing'
elif ... | python | def setenforce(mode):
'''
Set the SELinux enforcing mode
CLI Example:
.. code-block:: bash
salt '*' selinux.setenforce enforcing
'''
if isinstance(mode, six.string_types):
if mode.lower() == 'enforcing':
mode = '1'
modestring = 'Enforcing'
elif ... | [
"def",
"setenforce",
"(",
"mode",
")",
":",
"if",
"isinstance",
"(",
"mode",
",",
"six",
".",
"string_types",
")",
":",
"if",
"mode",
".",
"lower",
"(",
")",
"==",
"'enforcing'",
":",
"mode",
"=",
"'1'",
"modestring",
"=",
"'Enforcing'",
"elif",
"mode"... | Set the SELinux enforcing mode
CLI Example:
.. code-block:: bash
salt '*' selinux.setenforce enforcing | [
"Set",
"the",
"SELinux",
"enforcing",
"mode"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L131-L186 |
35,513 | saltstack/salt | salt/modules/selinux.py | setsebool | def setsebool(boolean, value, persist=False):
'''
Set the value for a boolean
CLI Example:
.. code-block:: bash
salt '*' selinux.setsebool virt_use_usb off
'''
if persist:
cmd = 'setsebool -P {0} {1}'.format(boolean, value)
else:
cmd = 'setsebool {0} {1}'.format(bo... | python | def setsebool(boolean, value, persist=False):
'''
Set the value for a boolean
CLI Example:
.. code-block:: bash
salt '*' selinux.setsebool virt_use_usb off
'''
if persist:
cmd = 'setsebool -P {0} {1}'.format(boolean, value)
else:
cmd = 'setsebool {0} {1}'.format(bo... | [
"def",
"setsebool",
"(",
"boolean",
",",
"value",
",",
"persist",
"=",
"False",
")",
":",
"if",
"persist",
":",
"cmd",
"=",
"'setsebool -P {0} {1}'",
".",
"format",
"(",
"boolean",
",",
"value",
")",
"else",
":",
"cmd",
"=",
"'setsebool {0} {1}'",
".",
"... | Set the value for a boolean
CLI Example:
.. code-block:: bash
salt '*' selinux.setsebool virt_use_usb off | [
"Set",
"the",
"value",
"for",
"a",
"boolean"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L202-L216 |
35,514 | saltstack/salt | salt/modules/selinux.py | setsebools | def setsebools(pairs, persist=False):
'''
Set the value of multiple booleans
CLI Example:
.. code-block:: bash
salt '*' selinux.setsebools '{virt_use_usb: on, squid_use_tproxy: off}'
'''
if not isinstance(pairs, dict):
return {}
if persist:
cmd = 'setsebool -P '
... | python | def setsebools(pairs, persist=False):
'''
Set the value of multiple booleans
CLI Example:
.. code-block:: bash
salt '*' selinux.setsebools '{virt_use_usb: on, squid_use_tproxy: off}'
'''
if not isinstance(pairs, dict):
return {}
if persist:
cmd = 'setsebool -P '
... | [
"def",
"setsebools",
"(",
"pairs",
",",
"persist",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"pairs",
",",
"dict",
")",
":",
"return",
"{",
"}",
"if",
"persist",
":",
"cmd",
"=",
"'setsebool -P '",
"else",
":",
"cmd",
"=",
"'setsebool '",... | Set the value of multiple booleans
CLI Example:
.. code-block:: bash
salt '*' selinux.setsebools '{virt_use_usb: on, squid_use_tproxy: off}' | [
"Set",
"the",
"value",
"of",
"multiple",
"booleans"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L219-L237 |
35,515 | saltstack/salt | salt/modules/selinux.py | list_sebool | def list_sebool():
'''
Return a structure listing all of the selinux booleans on the system and
what state they are in
CLI Example:
.. code-block:: bash
salt '*' selinux.list_sebool
'''
bdata = __salt__['cmd.run']('semanage boolean -l').splitlines()
ret = {}
for line in bd... | python | def list_sebool():
'''
Return a structure listing all of the selinux booleans on the system and
what state they are in
CLI Example:
.. code-block:: bash
salt '*' selinux.list_sebool
'''
bdata = __salt__['cmd.run']('semanage boolean -l').splitlines()
ret = {}
for line in bd... | [
"def",
"list_sebool",
"(",
")",
":",
"bdata",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'semanage boolean -l'",
")",
".",
"splitlines",
"(",
")",
"ret",
"=",
"{",
"}",
"for",
"line",
"in",
"bdata",
"[",
"1",
":",
"]",
":",
"if",
"not",
"line",
... | Return a structure listing all of the selinux booleans on the system and
what state they are in
CLI Example:
.. code-block:: bash
salt '*' selinux.list_sebool | [
"Return",
"a",
"structure",
"listing",
"all",
"of",
"the",
"selinux",
"booleans",
"on",
"the",
"system",
"and",
"what",
"state",
"they",
"are",
"in"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L240-L260 |
35,516 | saltstack/salt | salt/modules/selinux.py | setsemod | def setsemod(module, state):
'''
Enable or disable an SELinux module.
CLI Example:
.. code-block:: bash
salt '*' selinux.setsemod nagios Enabled
.. versionadded:: 2016.3.0
'''
if state.lower() == 'enabled':
cmd = 'semodule -e {0}'.format(module)
elif state.lower() == ... | python | def setsemod(module, state):
'''
Enable or disable an SELinux module.
CLI Example:
.. code-block:: bash
salt '*' selinux.setsemod nagios Enabled
.. versionadded:: 2016.3.0
'''
if state.lower() == 'enabled':
cmd = 'semodule -e {0}'.format(module)
elif state.lower() == ... | [
"def",
"setsemod",
"(",
"module",
",",
"state",
")",
":",
"if",
"state",
".",
"lower",
"(",
")",
"==",
"'enabled'",
":",
"cmd",
"=",
"'semodule -e {0}'",
".",
"format",
"(",
"module",
")",
"elif",
"state",
".",
"lower",
"(",
")",
"==",
"'disabled'",
... | Enable or disable an SELinux module.
CLI Example:
.. code-block:: bash
salt '*' selinux.setsemod nagios Enabled
.. versionadded:: 2016.3.0 | [
"Enable",
"or",
"disable",
"an",
"SELinux",
"module",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L278-L294 |
35,517 | saltstack/salt | salt/modules/selinux.py | install_semod | def install_semod(module_path):
'''
Install custom SELinux module from file
CLI Example:
.. code-block:: bash
salt '*' selinux.install_semod [salt://]path/to/module.pp
.. versionadded:: 2016.11.6
'''
if module_path.find('salt://') == 0:
module_path = __salt__['cp.cache_fi... | python | def install_semod(module_path):
'''
Install custom SELinux module from file
CLI Example:
.. code-block:: bash
salt '*' selinux.install_semod [salt://]path/to/module.pp
.. versionadded:: 2016.11.6
'''
if module_path.find('salt://') == 0:
module_path = __salt__['cp.cache_fi... | [
"def",
"install_semod",
"(",
"module_path",
")",
":",
"if",
"module_path",
".",
"find",
"(",
"'salt://'",
")",
"==",
"0",
":",
"module_path",
"=",
"__salt__",
"[",
"'cp.cache_file'",
"]",
"(",
"module_path",
")",
"cmd",
"=",
"'semodule -i {0}'",
".",
"format... | Install custom SELinux module from file
CLI Example:
.. code-block:: bash
salt '*' selinux.install_semod [salt://]path/to/module.pp
.. versionadded:: 2016.11.6 | [
"Install",
"custom",
"SELinux",
"module",
"from",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L297-L312 |
35,518 | saltstack/salt | salt/modules/selinux.py | list_semod | def list_semod():
'''
Return a structure listing all of the selinux modules on the system and
what state they are in
CLI Example:
.. code-block:: bash
salt '*' selinux.list_semod
.. versionadded:: 2016.3.0
'''
helptext = __salt__['cmd.run']('semodule -h').splitlines()
sem... | python | def list_semod():
'''
Return a structure listing all of the selinux modules on the system and
what state they are in
CLI Example:
.. code-block:: bash
salt '*' selinux.list_semod
.. versionadded:: 2016.3.0
'''
helptext = __salt__['cmd.run']('semodule -h').splitlines()
sem... | [
"def",
"list_semod",
"(",
")",
":",
"helptext",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'semodule -h'",
")",
".",
"splitlines",
"(",
")",
"semodule_version",
"=",
"''",
"for",
"line",
"in",
"helptext",
":",
"if",
"line",
".",
"strip",
"(",
")",
"... | Return a structure listing all of the selinux modules on the system and
what state they are in
CLI Example:
.. code-block:: bash
salt '*' selinux.list_semod
.. versionadded:: 2016.3.0 | [
"Return",
"a",
"structure",
"listing",
"all",
"of",
"the",
"selinux",
"modules",
"on",
"the",
"system",
"and",
"what",
"state",
"they",
"are",
"in"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L331-L376 |
35,519 | saltstack/salt | salt/returners/etcd_return.py | _get_conn | def _get_conn(opts, profile=None):
'''
Establish a connection to etcd
'''
if profile is None:
profile = opts.get('etcd.returner')
path = opts.get('etcd.returner_root', '/salt/return')
return salt.utils.etcd_util.get_conn(opts, profile), path | python | def _get_conn(opts, profile=None):
'''
Establish a connection to etcd
'''
if profile is None:
profile = opts.get('etcd.returner')
path = opts.get('etcd.returner_root', '/salt/return')
return salt.utils.etcd_util.get_conn(opts, profile), path | [
"def",
"_get_conn",
"(",
"opts",
",",
"profile",
"=",
"None",
")",
":",
"if",
"profile",
"is",
"None",
":",
"profile",
"=",
"opts",
".",
"get",
"(",
"'etcd.returner'",
")",
"path",
"=",
"opts",
".",
"get",
"(",
"'etcd.returner_root'",
",",
"'/salt/return... | Establish a connection to etcd | [
"Establish",
"a",
"connection",
"to",
"etcd"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/etcd_return.py#L97-L104 |
35,520 | saltstack/salt | salt/returners/etcd_return.py | returner | def returner(ret):
'''
Return data to an etcd server or cluster
'''
write_profile = __opts__.get('etcd.returner_write_profile')
if write_profile:
ttl = __opts__.get(write_profile, {}).get('etcd.ttl')
else:
ttl = __opts__.get('etcd.ttl')
client, path = _get_conn(__opts__, wri... | python | def returner(ret):
'''
Return data to an etcd server or cluster
'''
write_profile = __opts__.get('etcd.returner_write_profile')
if write_profile:
ttl = __opts__.get(write_profile, {}).get('etcd.ttl')
else:
ttl = __opts__.get('etcd.ttl')
client, path = _get_conn(__opts__, wri... | [
"def",
"returner",
"(",
"ret",
")",
":",
"write_profile",
"=",
"__opts__",
".",
"get",
"(",
"'etcd.returner_write_profile'",
")",
"if",
"write_profile",
":",
"ttl",
"=",
"__opts__",
".",
"get",
"(",
"write_profile",
",",
"{",
"}",
")",
".",
"get",
"(",
"... | Return data to an etcd server or cluster | [
"Return",
"data",
"to",
"an",
"etcd",
"server",
"or",
"cluster"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/etcd_return.py#L107-L134 |
35,521 | saltstack/salt | salt/states/linux_acl.py | absent | def absent(name, acl_type, acl_name='', perms='', recurse=False):
'''
Ensure a Linux ACL does not exist
name
The acl path
acl_type
The type of the acl is used for, it can be 'user' or 'group'
acl_names
The user or group
perms
Remove the permissions eg.: rwx
... | python | def absent(name, acl_type, acl_name='', perms='', recurse=False):
'''
Ensure a Linux ACL does not exist
name
The acl path
acl_type
The type of the acl is used for, it can be 'user' or 'group'
acl_names
The user or group
perms
Remove the permissions eg.: rwx
... | [
"def",
"absent",
"(",
"name",
",",
"acl_type",
",",
"acl_name",
"=",
"''",
",",
"perms",
"=",
"''",
",",
"recurse",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'changes'",
":",
"{",
"}",
","... | Ensure a Linux ACL does not exist
name
The acl path
acl_type
The type of the acl is used for, it can be 'user' or 'group'
acl_names
The user or group
perms
Remove the permissions eg.: rwx
recurse
Set the permissions recursive in the path | [
"Ensure",
"a",
"Linux",
"ACL",
"does",
"not",
"exist"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/linux_acl.py#L222-L307 |
35,522 | saltstack/salt | salt/states/linux_acl.py | list_absent | def list_absent(name, acl_type, acl_names=None, recurse=False):
'''
Ensure a Linux ACL list does not exist
Takes a list of acl names and remove them from the given path
name
The acl path
acl_type
The type of the acl is used for, it can be 'user' or 'group'
acl_names
T... | python | def list_absent(name, acl_type, acl_names=None, recurse=False):
'''
Ensure a Linux ACL list does not exist
Takes a list of acl names and remove them from the given path
name
The acl path
acl_type
The type of the acl is used for, it can be 'user' or 'group'
acl_names
T... | [
"def",
"list_absent",
"(",
"name",
",",
"acl_type",
",",
"acl_names",
"=",
"None",
",",
"recurse",
"=",
"False",
")",
":",
"if",
"acl_names",
"is",
"None",
":",
"acl_names",
"=",
"[",
"]",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",... | Ensure a Linux ACL list does not exist
Takes a list of acl names and remove them from the given path
name
The acl path
acl_type
The type of the acl is used for, it can be 'user' or 'group'
acl_names
The list of users or groups
perms
Remove the permissions eg.: rw... | [
"Ensure",
"a",
"Linux",
"ACL",
"list",
"does",
"not",
"exist"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/linux_acl.py#L502-L584 |
35,523 | saltstack/salt | salt/states/boto_cognitoidentity.py | _get_object | def _get_object(objname, objtype):
'''
Helper function to retrieve objtype from pillars if objname
is string_types, used for SupportedLoginProviders and
OpenIdConnectProviderARNs.
'''
ret = None
if objname is None:
return ret
if isinstance(objname, string_types):
if objn... | python | def _get_object(objname, objtype):
'''
Helper function to retrieve objtype from pillars if objname
is string_types, used for SupportedLoginProviders and
OpenIdConnectProviderARNs.
'''
ret = None
if objname is None:
return ret
if isinstance(objname, string_types):
if objn... | [
"def",
"_get_object",
"(",
"objname",
",",
"objtype",
")",
":",
"ret",
"=",
"None",
"if",
"objname",
"is",
"None",
":",
"return",
"ret",
"if",
"isinstance",
"(",
"objname",
",",
"string_types",
")",
":",
"if",
"objname",
"in",
"__opts__",
":",
"ret",
"... | Helper function to retrieve objtype from pillars if objname
is string_types, used for SupportedLoginProviders and
OpenIdConnectProviderARNs. | [
"Helper",
"function",
"to",
"retrieve",
"objtype",
"from",
"pillars",
"if",
"objname",
"is",
"string_types",
"used",
"for",
"SupportedLoginProviders",
"and",
"OpenIdConnectProviderARNs",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_cognitoidentity.py#L66-L90 |
35,524 | saltstack/salt | salt/states/boto_cognitoidentity.py | _role_present | def _role_present(ret, IdentityPoolId, AuthenticatedRole, UnauthenticatedRole, conn_params):
'''
Helper function to set the Roles to the identity pool
'''
r = __salt__['boto_cognitoidentity.get_identity_pool_roles'](IdentityPoolName='',
Id... | python | def _role_present(ret, IdentityPoolId, AuthenticatedRole, UnauthenticatedRole, conn_params):
'''
Helper function to set the Roles to the identity pool
'''
r = __salt__['boto_cognitoidentity.get_identity_pool_roles'](IdentityPoolName='',
Id... | [
"def",
"_role_present",
"(",
"ret",
",",
"IdentityPoolId",
",",
"AuthenticatedRole",
",",
"UnauthenticatedRole",
",",
"conn_params",
")",
":",
"r",
"=",
"__salt__",
"[",
"'boto_cognitoidentity.get_identity_pool_roles'",
"]",
"(",
"IdentityPoolName",
"=",
"''",
",",
... | Helper function to set the Roles to the identity pool | [
"Helper",
"function",
"to",
"set",
"the",
"Roles",
"to",
"the",
"identity",
"pool"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_cognitoidentity.py#L93-L131 |
35,525 | saltstack/salt | salt/states/boto_cognitoidentity.py | pool_absent | def pool_absent(name, IdentityPoolName, RemoveAllMatched=False,
region=None, key=None, keyid=None, profile=None):
'''
Ensure cognito identity pool with passed properties is absent.
name
The name of the state definition.
IdentityPoolName
Name of the Cognito Identity Pool. Plea... | python | def pool_absent(name, IdentityPoolName, RemoveAllMatched=False,
region=None, key=None, keyid=None, profile=None):
'''
Ensure cognito identity pool with passed properties is absent.
name
The name of the state definition.
IdentityPoolName
Name of the Cognito Identity Pool. Plea... | [
"def",
"pool_absent",
"(",
"name",
",",
"IdentityPoolName",
",",
"RemoveAllMatched",
"=",
"False",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
... | Ensure cognito identity pool with passed properties is absent.
name
The name of the state definition.
IdentityPoolName
Name of the Cognito Identity Pool. Please note that this may
match multiple pools with the same given name, in which case,
all will be removed.
RemoveAll... | [
"Ensure",
"cognito",
"identity",
"pool",
"with",
"passed",
"properties",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_cognitoidentity.py#L282-L378 |
35,526 | saltstack/salt | salt/matchers/pcre_match.py | match | def match(tgt, opts=None):
'''
Returns true if the passed pcre regex matches
'''
if not opts:
return bool(re.match(tgt, __opts__['id']))
else:
return bool(re.match(tgt, opts['id'])) | python | def match(tgt, opts=None):
'''
Returns true if the passed pcre regex matches
'''
if not opts:
return bool(re.match(tgt, __opts__['id']))
else:
return bool(re.match(tgt, opts['id'])) | [
"def",
"match",
"(",
"tgt",
",",
"opts",
"=",
"None",
")",
":",
"if",
"not",
"opts",
":",
"return",
"bool",
"(",
"re",
".",
"match",
"(",
"tgt",
",",
"__opts__",
"[",
"'id'",
"]",
")",
")",
"else",
":",
"return",
"bool",
"(",
"re",
".",
"match"... | Returns true if the passed pcre regex matches | [
"Returns",
"true",
"if",
"the",
"passed",
"pcre",
"regex",
"matches"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/matchers/pcre_match.py#L10-L17 |
35,527 | saltstack/salt | salt/utils/minion.py | running | def running(opts):
'''
Return the running jobs on this minion
'''
ret = []
proc_dir = os.path.join(opts['cachedir'], 'proc')
if not os.path.isdir(proc_dir):
return ret
for fn_ in os.listdir(proc_dir):
path = os.path.join(proc_dir, fn_)
try:
data = _read_p... | python | def running(opts):
'''
Return the running jobs on this minion
'''
ret = []
proc_dir = os.path.join(opts['cachedir'], 'proc')
if not os.path.isdir(proc_dir):
return ret
for fn_ in os.listdir(proc_dir):
path = os.path.join(proc_dir, fn_)
try:
data = _read_p... | [
"def",
"running",
"(",
"opts",
")",
":",
"ret",
"=",
"[",
"]",
"proc_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"opts",
"[",
"'cachedir'",
"]",
",",
"'proc'",
")",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"proc_dir",
")",
":",
"r... | Return the running jobs on this minion | [
"Return",
"the",
"running",
"jobs",
"on",
"this",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minion.py#L21-L41 |
35,528 | saltstack/salt | salt/utils/minion.py | cache_jobs | def cache_jobs(opts, jid, ret):
'''
Write job information to cache
'''
serial = salt.payload.Serial(opts=opts)
fn_ = os.path.join(
opts['cachedir'],
'minion_jobs',
jid,
'return.p')
jdir = os.path.dirname(fn_)
if not os.path.isdir(jdir):
os.makedirs(jd... | python | def cache_jobs(opts, jid, ret):
'''
Write job information to cache
'''
serial = salt.payload.Serial(opts=opts)
fn_ = os.path.join(
opts['cachedir'],
'minion_jobs',
jid,
'return.p')
jdir = os.path.dirname(fn_)
if not os.path.isdir(jdir):
os.makedirs(jd... | [
"def",
"cache_jobs",
"(",
"opts",
",",
"jid",
",",
"ret",
")",
":",
"serial",
"=",
"salt",
".",
"payload",
".",
"Serial",
"(",
"opts",
"=",
"opts",
")",
"fn_",
"=",
"os",
".",
"path",
".",
"join",
"(",
"opts",
"[",
"'cachedir'",
"]",
",",
"'minio... | Write job information to cache | [
"Write",
"job",
"information",
"to",
"cache"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minion.py#L44-L59 |
35,529 | saltstack/salt | salt/utils/minion.py | _check_cmdline | def _check_cmdline(data):
'''
In some cases where there are an insane number of processes being created
on a system a PID can get recycled or assigned to a non-Salt process.
On Linux this fn checks to make sure the PID we are checking on is actually
a Salt process.
For non-Linux systems we punt... | python | def _check_cmdline(data):
'''
In some cases where there are an insane number of processes being created
on a system a PID can get recycled or assigned to a non-Salt process.
On Linux this fn checks to make sure the PID we are checking on is actually
a Salt process.
For non-Linux systems we punt... | [
"def",
"_check_cmdline",
"(",
"data",
")",
":",
"if",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_linux",
"(",
")",
":",
"return",
"True",
"pid",
"=",
"data",
".",
"get",
"(",
"'pid'",
")",
"if",
"not",
"pid",
":",
"return",
"False",
"if... | In some cases where there are an insane number of processes being created
on a system a PID can get recycled or assigned to a non-Salt process.
On Linux this fn checks to make sure the PID we are checking on is actually
a Salt process.
For non-Linux systems we punt and just return True | [
"In",
"some",
"cases",
"where",
"there",
"are",
"an",
"insane",
"number",
"of",
"processes",
"being",
"created",
"on",
"a",
"system",
"a",
"PID",
"can",
"get",
"recycled",
"or",
"assigned",
"to",
"a",
"non",
"-",
"Salt",
"process",
".",
"On",
"Linux",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minion.py#L125-L149 |
35,530 | saltstack/salt | salt/pillar/file_tree.py | _check_newline | def _check_newline(prefix, file_name, keep_newline):
'''
Return a boolean stating whether or not a file's trailing newline should be
removed. To figure this out, first check if keep_newline is a boolean and
if so, return its opposite. Otherwise, iterate over keep_newline and check
if any of the patt... | python | def _check_newline(prefix, file_name, keep_newline):
'''
Return a boolean stating whether or not a file's trailing newline should be
removed. To figure this out, first check if keep_newline is a boolean and
if so, return its opposite. Otherwise, iterate over keep_newline and check
if any of the patt... | [
"def",
"_check_newline",
"(",
"prefix",
",",
"file_name",
",",
"keep_newline",
")",
":",
"if",
"isinstance",
"(",
"keep_newline",
",",
"bool",
")",
":",
"return",
"not",
"keep_newline",
"full_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"prefix",
",",
... | Return a boolean stating whether or not a file's trailing newline should be
removed. To figure this out, first check if keep_newline is a boolean and
if so, return its opposite. Otherwise, iterate over keep_newline and check
if any of the patterns match the file path. If a match is found, return
False, ... | [
"Return",
"a",
"boolean",
"stating",
"whether",
"or",
"not",
"a",
"file",
"s",
"trailing",
"newline",
"should",
"be",
"removed",
".",
"To",
"figure",
"this",
"out",
"first",
"check",
"if",
"keep_newline",
"is",
"a",
"boolean",
"and",
"if",
"so",
"return",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/file_tree.py#L174-L192 |
35,531 | saltstack/salt | salt/pillar/file_tree.py | _construct_pillar | def _construct_pillar(top_dir,
follow_dir_links,
keep_newline=False,
render_default=None,
renderer_blacklist=None,
renderer_whitelist=None,
template=False):
'''
Construct pillar fr... | python | def _construct_pillar(top_dir,
follow_dir_links,
keep_newline=False,
render_default=None,
renderer_blacklist=None,
renderer_whitelist=None,
template=False):
'''
Construct pillar fr... | [
"def",
"_construct_pillar",
"(",
"top_dir",
",",
"follow_dir_links",
",",
"keep_newline",
"=",
"False",
",",
"render_default",
"=",
"None",
",",
"renderer_blacklist",
"=",
"None",
",",
"renderer_whitelist",
"=",
"None",
",",
"template",
"=",
"False",
")",
":",
... | Construct pillar from file tree. | [
"Construct",
"pillar",
"from",
"file",
"tree",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/file_tree.py#L195-L265 |
35,532 | saltstack/salt | salt/pillar/file_tree.py | ext_pillar | def ext_pillar(minion_id,
pillar,
root_dir=None,
follow_dir_links=False,
debug=False,
keep_newline=False,
render_default=None,
renderer_blacklist=None,
renderer_whitelist=None,
template... | python | def ext_pillar(minion_id,
pillar,
root_dir=None,
follow_dir_links=False,
debug=False,
keep_newline=False,
render_default=None,
renderer_blacklist=None,
renderer_whitelist=None,
template... | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"pillar",
",",
"root_dir",
"=",
"None",
",",
"follow_dir_links",
"=",
"False",
",",
"debug",
"=",
"False",
",",
"keep_newline",
"=",
"False",
",",
"render_default",
"=",
"None",
",",
"renderer_blacklist",
"=",
"Non... | Compile pillar data from the given ``root_dir`` specific to Nodegroup names
and Minion IDs.
If a Minion's ID is not found at ``<root_dir>/host/<minion_id>`` or if it
is not included in any Nodegroups named at
``<root_dir>/nodegroups/<node_group>``, no pillar data provided by this
pillar module will... | [
"Compile",
"pillar",
"data",
"from",
"the",
"given",
"root_dir",
"specific",
"to",
"Nodegroup",
"names",
"and",
"Minion",
"IDs",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/file_tree.py#L268-L448 |
35,533 | saltstack/salt | salt/pillar/file_tree.py | _ext_pillar | def _ext_pillar(minion_id,
root_dir,
follow_dir_links,
debug,
keep_newline,
render_default,
renderer_blacklist,
renderer_whitelist,
template):
'''
Compile pillar data for a single root... | python | def _ext_pillar(minion_id,
root_dir,
follow_dir_links,
debug,
keep_newline,
render_default,
renderer_blacklist,
renderer_whitelist,
template):
'''
Compile pillar data for a single root... | [
"def",
"_ext_pillar",
"(",
"minion_id",
",",
"root_dir",
",",
"follow_dir_links",
",",
"debug",
",",
"keep_newline",
",",
"render_default",
",",
"renderer_blacklist",
",",
"renderer_whitelist",
",",
"template",
")",
":",
"log",
".",
"debug",
"(",
"'file_tree: read... | Compile pillar data for a single root_dir for the specified minion ID | [
"Compile",
"pillar",
"data",
"for",
"a",
"single",
"root_dir",
"for",
"the",
"specified",
"minion",
"ID"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/file_tree.py#L451-L540 |
35,534 | saltstack/salt | salt/states/at.py | mod_watch | def mod_watch(name, **kwargs):
'''
The at watcher, called to invoke the watch command.
.. note::
This state exists to support special handling of the ``watch``
:ref:`requisite <requisites>`. It should not be called directly.
Parameters for this function should be set by the state b... | python | def mod_watch(name, **kwargs):
'''
The at watcher, called to invoke the watch command.
.. note::
This state exists to support special handling of the ``watch``
:ref:`requisite <requisites>`. It should not be called directly.
Parameters for this function should be set by the state b... | [
"def",
"mod_watch",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"if",
"kwargs",
"[",
"'sfun'",
"]",
"=="... | The at watcher, called to invoke the watch command.
.. note::
This state exists to support special handling of the ``watch``
:ref:`requisite <requisites>`. It should not be called directly.
Parameters for this function should be set by the state being triggered.
name
The name ... | [
"The",
"at",
"watcher",
"called",
"to",
"invoke",
"the",
"watch",
"command",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/at.py#L291-L316 |
35,535 | saltstack/salt | salt/modules/parallels.py | _normalize_args | def _normalize_args(args):
'''
Return args as a list of strings
'''
if isinstance(args, six.string_types):
return shlex.split(args)
if isinstance(args, (tuple, list)):
return [six.text_type(arg) for arg in args]
else:
return [six.text_type(args)] | python | def _normalize_args(args):
'''
Return args as a list of strings
'''
if isinstance(args, six.string_types):
return shlex.split(args)
if isinstance(args, (tuple, list)):
return [six.text_type(arg) for arg in args]
else:
return [six.text_type(args)] | [
"def",
"_normalize_args",
"(",
"args",
")",
":",
"if",
"isinstance",
"(",
"args",
",",
"six",
".",
"string_types",
")",
":",
"return",
"shlex",
".",
"split",
"(",
"args",
")",
"if",
"isinstance",
"(",
"args",
",",
"(",
"tuple",
",",
"list",
")",
")",... | Return args as a list of strings | [
"Return",
"args",
"as",
"a",
"list",
"of",
"strings"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parallels.py#L49-L59 |
35,536 | saltstack/salt | salt/modules/parallels.py | _find_guids | def _find_guids(guid_string):
'''
Return the set of GUIDs found in guid_string
:param str guid_string:
String containing zero or more GUIDs. Each GUID may or may not be
enclosed in {}
Example data (this string contains two distinct GUIDs):
PARENT_SNAPSHOT_ID ... | python | def _find_guids(guid_string):
'''
Return the set of GUIDs found in guid_string
:param str guid_string:
String containing zero or more GUIDs. Each GUID may or may not be
enclosed in {}
Example data (this string contains two distinct GUIDs):
PARENT_SNAPSHOT_ID ... | [
"def",
"_find_guids",
"(",
"guid_string",
")",
":",
"guids",
"=",
"[",
"]",
"for",
"found_guid",
"in",
"re",
".",
"finditer",
"(",
"GUID_REGEX",
",",
"guid_string",
")",
":",
"if",
"found_guid",
".",
"groups",
"(",
")",
":",
"guids",
".",
"append",
"("... | Return the set of GUIDs found in guid_string
:param str guid_string:
String containing zero or more GUIDs. Each GUID may or may not be
enclosed in {}
Example data (this string contains two distinct GUIDs):
PARENT_SNAPSHOT_ID SNAPSHOT_ID
... | [
"Return",
"the",
"set",
"of",
"GUIDs",
"found",
"in",
"guid_string"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parallels.py#L62-L80 |
35,537 | saltstack/salt | salt/modules/parallels.py | prlsrvctl | def prlsrvctl(sub_cmd, args=None, runas=None):
'''
Execute a prlsrvctl command
.. versionadded:: 2016.11.0
:param str sub_cmd:
prlsrvctl subcommand to execute
:param str args:
The arguments supplied to ``prlsrvctl <sub_cmd>``
:param str runas:
The user that the prlsrv... | python | def prlsrvctl(sub_cmd, args=None, runas=None):
'''
Execute a prlsrvctl command
.. versionadded:: 2016.11.0
:param str sub_cmd:
prlsrvctl subcommand to execute
:param str args:
The arguments supplied to ``prlsrvctl <sub_cmd>``
:param str runas:
The user that the prlsrv... | [
"def",
"prlsrvctl",
"(",
"sub_cmd",
",",
"args",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"if",
"not",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'prlsrvctl'",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'prlsrvctl utility not av... | Execute a prlsrvctl command
.. versionadded:: 2016.11.0
:param str sub_cmd:
prlsrvctl subcommand to execute
:param str args:
The arguments supplied to ``prlsrvctl <sub_cmd>``
:param str runas:
The user that the prlsrvctl command will be run as
Example:
.. code-block... | [
"Execute",
"a",
"prlsrvctl",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parallels.py#L83-L115 |
35,538 | saltstack/salt | salt/modules/parallels.py | list_vms | def list_vms(name=None, info=False, all=False, args=None, runas=None, template=False):
'''
List information about the VMs
:param str name:
Name/ID of VM to list
.. versionchanged:: 2016.11.0
No longer implies ``info=True``
:param str info:
List extra information
... | python | def list_vms(name=None, info=False, all=False, args=None, runas=None, template=False):
'''
List information about the VMs
:param str name:
Name/ID of VM to list
.. versionchanged:: 2016.11.0
No longer implies ``info=True``
:param str info:
List extra information
... | [
"def",
"list_vms",
"(",
"name",
"=",
"None",
",",
"info",
"=",
"False",
",",
"all",
"=",
"False",
",",
"args",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"template",
"=",
"False",
")",
":",
"# Construct argument list",
"if",
"args",
"is",
"None",
"... | List information about the VMs
:param str name:
Name/ID of VM to list
.. versionchanged:: 2016.11.0
No longer implies ``info=True``
:param str info:
List extra information
:param bool all:
List all non-template VMs
:param tuple args:
Additional a... | [
"List",
"information",
"about",
"the",
"VMs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parallels.py#L151-L205 |
35,539 | saltstack/salt | salt/modules/parallels.py | clone | def clone(name, new_name, linked=False, template=False, runas=None):
'''
Clone a VM
.. versionadded:: 2016.11.0
:param str name:
Name/ID of VM to clone
:param str new_name:
Name of the new VM
:param bool linked:
Create a linked virtual machine.
:param bool templa... | python | def clone(name, new_name, linked=False, template=False, runas=None):
'''
Clone a VM
.. versionadded:: 2016.11.0
:param str name:
Name/ID of VM to clone
:param str new_name:
Name of the new VM
:param bool linked:
Create a linked virtual machine.
:param bool templa... | [
"def",
"clone",
"(",
"name",
",",
"new_name",
",",
"linked",
"=",
"False",
",",
"template",
"=",
"False",
",",
"runas",
"=",
"None",
")",
":",
"args",
"=",
"[",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"name",
")",
",",
"'--name'",
... | Clone a VM
.. versionadded:: 2016.11.0
:param str name:
Name/ID of VM to clone
:param str new_name:
Name of the new VM
:param bool linked:
Create a linked virtual machine.
:param bool template:
Create a virtual machine template instead of a real virtual machine.
... | [
"Clone",
"a",
"VM"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parallels.py#L208-L241 |
35,540 | saltstack/salt | salt/modules/parallels.py | delete | def delete(name, runas=None):
'''
Delete a VM
.. versionadded:: 2016.11.0
:param str name:
Name/ID of VM to clone
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.exec macvm 'find /etc/paths.d' ru... | python | def delete(name, runas=None):
'''
Delete a VM
.. versionadded:: 2016.11.0
:param str name:
Name/ID of VM to clone
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.exec macvm 'find /etc/paths.d' ru... | [
"def",
"delete",
"(",
"name",
",",
"runas",
"=",
"None",
")",
":",
"return",
"prlctl",
"(",
"'delete'",
",",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"name",
")",
",",
"runas",
"=",
"runas",
")"
] | Delete a VM
.. versionadded:: 2016.11.0
:param str name:
Name/ID of VM to clone
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.exec macvm 'find /etc/paths.d' runas=macdev | [
"Delete",
"a",
"VM"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parallels.py#L244-L262 |
35,541 | saltstack/salt | salt/modules/parallels.py | exists | def exists(name, runas=None):
'''
Query whether a VM exists
.. versionadded:: 2016.11.0
:param str name:
Name/ID of VM
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.exists macvm runas=macdev
... | python | def exists(name, runas=None):
'''
Query whether a VM exists
.. versionadded:: 2016.11.0
:param str name:
Name/ID of VM
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.exists macvm runas=macdev
... | [
"def",
"exists",
"(",
"name",
",",
"runas",
"=",
"None",
")",
":",
"vm_info",
"=",
"list_vms",
"(",
"name",
",",
"info",
"=",
"True",
",",
"runas",
"=",
"runas",
")",
".",
"splitlines",
"(",
")",
"for",
"info_line",
"in",
"vm_info",
":",
"if",
"'Na... | Query whether a VM exists
.. versionadded:: 2016.11.0
:param str name:
Name/ID of VM
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.exists macvm runas=macdev | [
"Query",
"whether",
"a",
"VM",
"exists"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parallels.py#L265-L287 |
35,542 | saltstack/salt | salt/modules/parallels.py | stop | def stop(name, kill=False, runas=None):
'''
Stop a VM
:param str name:
Name/ID of VM to stop
:param bool kill:
Perform a hard shutdown
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.stop... | python | def stop(name, kill=False, runas=None):
'''
Stop a VM
:param str name:
Name/ID of VM to stop
:param bool kill:
Perform a hard shutdown
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.stop... | [
"def",
"stop",
"(",
"name",
",",
"kill",
"=",
"False",
",",
"runas",
"=",
"None",
")",
":",
"# Construct argument list",
"args",
"=",
"[",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"name",
")",
"]",
"if",
"kill",
":",
"args",
".",
"app... | Stop a VM
:param str name:
Name/ID of VM to stop
:param bool kill:
Perform a hard shutdown
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.stop macvm runas=macdev
salt '*' parallels.stop ... | [
"Stop",
"a",
"VM"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parallels.py#L309-L335 |
35,543 | saltstack/salt | salt/modules/parallels.py | restart | def restart(name, runas=None):
'''
Restart a VM by gracefully shutting it down and then restarting
it
:param str name:
Name/ID of VM to restart
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.rest... | python | def restart(name, runas=None):
'''
Restart a VM by gracefully shutting it down and then restarting
it
:param str name:
Name/ID of VM to restart
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.rest... | [
"def",
"restart",
"(",
"name",
",",
"runas",
"=",
"None",
")",
":",
"return",
"prlctl",
"(",
"'restart'",
",",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"name",
")",
",",
"runas",
"=",
"runas",
")"
] | Restart a VM by gracefully shutting it down and then restarting
it
:param str name:
Name/ID of VM to restart
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.restart macvm runas=macdev | [
"Restart",
"a",
"VM",
"by",
"gracefully",
"shutting",
"it",
"down",
"and",
"then",
"restarting",
"it"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parallels.py#L338-L355 |
35,544 | saltstack/salt | salt/modules/parallels.py | reset | def reset(name, runas=None):
'''
Reset a VM by performing a hard shutdown and then a restart
:param str name:
Name/ID of VM to reset
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.reset macvm runas=m... | python | def reset(name, runas=None):
'''
Reset a VM by performing a hard shutdown and then a restart
:param str name:
Name/ID of VM to reset
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.reset macvm runas=m... | [
"def",
"reset",
"(",
"name",
",",
"runas",
"=",
"None",
")",
":",
"return",
"prlctl",
"(",
"'reset'",
",",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"name",
")",
",",
"runas",
"=",
"runas",
")"
] | Reset a VM by performing a hard shutdown and then a restart
:param str name:
Name/ID of VM to reset
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.reset macvm runas=macdev | [
"Reset",
"a",
"VM",
"by",
"performing",
"a",
"hard",
"shutdown",
"and",
"then",
"a",
"restart"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parallels.py#L358-L374 |
35,545 | saltstack/salt | salt/modules/parallels.py | status | def status(name, runas=None):
'''
Status of a VM
:param str name:
Name/ID of VM whose status will be returned
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.status macvm runas=macdev
'''
retu... | python | def status(name, runas=None):
'''
Status of a VM
:param str name:
Name/ID of VM whose status will be returned
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.status macvm runas=macdev
'''
retu... | [
"def",
"status",
"(",
"name",
",",
"runas",
"=",
"None",
")",
":",
"return",
"prlctl",
"(",
"'status'",
",",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"name",
")",
",",
"runas",
"=",
"runas",
")"
] | Status of a VM
:param str name:
Name/ID of VM whose status will be returned
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.status macvm runas=macdev | [
"Status",
"of",
"a",
"VM"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parallels.py#L377-L393 |
35,546 | saltstack/salt | salt/modules/parallels.py | exec_ | def exec_(name, command, runas=None):
'''
Run a command on a VM
:param str name:
Name/ID of VM whose exec will be returned
:param str command:
Command to run on the VM
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash... | python | def exec_(name, command, runas=None):
'''
Run a command on a VM
:param str name:
Name/ID of VM whose exec will be returned
:param str command:
Command to run on the VM
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash... | [
"def",
"exec_",
"(",
"name",
",",
"command",
",",
"runas",
"=",
"None",
")",
":",
"# Construct argument list",
"args",
"=",
"[",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"name",
")",
"]",
"args",
".",
"extend",
"(",
"_normalize_args",
"("... | Run a command on a VM
:param str name:
Name/ID of VM whose exec will be returned
:param str command:
Command to run on the VM
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.exec macvm 'find /etc... | [
"Run",
"a",
"command",
"on",
"a",
"VM"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parallels.py#L396-L420 |
35,547 | saltstack/salt | salt/modules/parallels.py | snapshot_id_to_name | def snapshot_id_to_name(name, snap_id, strict=False, runas=None):
'''
Attempt to convert a snapshot ID to a snapshot name. If the snapshot has
no name or if the ID is not found or invalid, an empty string will be returned
:param str name:
Name/ID of VM whose snapshots are inspected
:param... | python | def snapshot_id_to_name(name, snap_id, strict=False, runas=None):
'''
Attempt to convert a snapshot ID to a snapshot name. If the snapshot has
no name or if the ID is not found or invalid, an empty string will be returned
:param str name:
Name/ID of VM whose snapshots are inspected
:param... | [
"def",
"snapshot_id_to_name",
"(",
"name",
",",
"snap_id",
",",
"strict",
"=",
"False",
",",
"runas",
"=",
"None",
")",
":",
"# Validate VM name and snapshot ID",
"name",
"=",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"name",
")",
"if",
"not",... | Attempt to convert a snapshot ID to a snapshot name. If the snapshot has
no name or if the ID is not found or invalid, an empty string will be returned
:param str name:
Name/ID of VM whose snapshots are inspected
:param str snap_id:
ID of the snapshot
:param bool strict:
Rais... | [
"Attempt",
"to",
"convert",
"a",
"snapshot",
"ID",
"to",
"a",
"snapshot",
"name",
".",
"If",
"the",
"snapshot",
"has",
"no",
"name",
"or",
"if",
"the",
"ID",
"is",
"not",
"found",
"or",
"invalid",
"an",
"empty",
"string",
"will",
"be",
"returned"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parallels.py#L423-L501 |
35,548 | saltstack/salt | salt/modules/parallels.py | snapshot_name_to_id | def snapshot_name_to_id(name, snap_name, strict=False, runas=None):
'''
Attempt to convert a snapshot name to a snapshot ID. If the name is not
found an empty string is returned. If multiple snapshots share the same
name, a list will be returned
:param str name:
Name/ID of VM whose snapsh... | python | def snapshot_name_to_id(name, snap_name, strict=False, runas=None):
'''
Attempt to convert a snapshot name to a snapshot ID. If the name is not
found an empty string is returned. If multiple snapshots share the same
name, a list will be returned
:param str name:
Name/ID of VM whose snapsh... | [
"def",
"snapshot_name_to_id",
"(",
"name",
",",
"snap_name",
",",
"strict",
"=",
"False",
",",
"runas",
"=",
"None",
")",
":",
"# Validate VM and snapshot names",
"name",
"=",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"name",
")",
"snap_name",
... | Attempt to convert a snapshot name to a snapshot ID. If the name is not
found an empty string is returned. If multiple snapshots share the same
name, a list will be returned
:param str name:
Name/ID of VM whose snapshots are inspected
:param str snap_name:
Name of the snapshot
:... | [
"Attempt",
"to",
"convert",
"a",
"snapshot",
"name",
"to",
"a",
"snapshot",
"ID",
".",
"If",
"the",
"name",
"is",
"not",
"found",
"an",
"empty",
"string",
"is",
"returned",
".",
"If",
"multiple",
"snapshots",
"share",
"the",
"same",
"name",
"a",
"list",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parallels.py#L504-L559 |
35,549 | saltstack/salt | salt/modules/parallels.py | _validate_snap_name | def _validate_snap_name(name, snap_name, strict=True, runas=None):
'''
Validate snapshot name and convert to snapshot ID
:param str name:
Name/ID of VM whose snapshot name is being validated
:param str snap_name:
Name/ID of snapshot
:param bool strict:
Raise an exception i... | python | def _validate_snap_name(name, snap_name, strict=True, runas=None):
'''
Validate snapshot name and convert to snapshot ID
:param str name:
Name/ID of VM whose snapshot name is being validated
:param str snap_name:
Name/ID of snapshot
:param bool strict:
Raise an exception i... | [
"def",
"_validate_snap_name",
"(",
"name",
",",
"snap_name",
",",
"strict",
"=",
"True",
",",
"runas",
"=",
"None",
")",
":",
"snap_name",
"=",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"snap_name",
")",
"# Try to convert snapshot name to an ID wi... | Validate snapshot name and convert to snapshot ID
:param str name:
Name/ID of VM whose snapshot name is being validated
:param str snap_name:
Name/ID of snapshot
:param bool strict:
Raise an exception if multiple snapshot IDs are found
:param str runas:
The user that ... | [
"Validate",
"snapshot",
"name",
"and",
"convert",
"to",
"snapshot",
"ID"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parallels.py#L562-L584 |
35,550 | saltstack/salt | salt/modules/parallels.py | list_snapshots | def list_snapshots(name, snap_name=None, tree=False, names=False, runas=None):
'''
List the snapshots
:param str name:
Name/ID of VM whose snapshots will be listed
:param str snap_id:
Name/ID of snapshot to display information about. If ``tree=True`` is
also specified, display... | python | def list_snapshots(name, snap_name=None, tree=False, names=False, runas=None):
'''
List the snapshots
:param str name:
Name/ID of VM whose snapshots will be listed
:param str snap_id:
Name/ID of snapshot to display information about. If ``tree=True`` is
also specified, display... | [
"def",
"list_snapshots",
"(",
"name",
",",
"snap_name",
"=",
"None",
",",
"tree",
"=",
"False",
",",
"names",
"=",
"False",
",",
"runas",
"=",
"None",
")",
":",
"# Validate VM and snapshot names",
"name",
"=",
"salt",
".",
"utils",
".",
"data",
".",
"dec... | List the snapshots
:param str name:
Name/ID of VM whose snapshots will be listed
:param str snap_id:
Name/ID of snapshot to display information about. If ``tree=True`` is
also specified, display the snapshot subtree having this snapshot as
the root snapshot
:param bool tr... | [
"List",
"the",
"snapshots"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parallels.py#L587-L646 |
35,551 | saltstack/salt | salt/modules/parallels.py | snapshot | def snapshot(name, snap_name=None, desc=None, runas=None):
'''
Create a snapshot
:param str name:
Name/ID of VM to take a snapshot of
:param str snap_name:
Name of snapshot
:param str desc:
Description of snapshot
:param str runas:
The user that the prlctl com... | python | def snapshot(name, snap_name=None, desc=None, runas=None):
'''
Create a snapshot
:param str name:
Name/ID of VM to take a snapshot of
:param str snap_name:
Name of snapshot
:param str desc:
Description of snapshot
:param str runas:
The user that the prlctl com... | [
"def",
"snapshot",
"(",
"name",
",",
"snap_name",
"=",
"None",
",",
"desc",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"# Validate VM and snapshot names",
"name",
"=",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"name",
")",
"if",
"sn... | Create a snapshot
:param str name:
Name/ID of VM to take a snapshot of
:param str snap_name:
Name of snapshot
:param str desc:
Description of snapshot
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
sa... | [
"Create",
"a",
"snapshot"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parallels.py#L649-L685 |
35,552 | saltstack/salt | salt/modules/parallels.py | delete_snapshot | def delete_snapshot(name, snap_name, runas=None, all=False):
'''
Delete a snapshot
.. note::
Deleting a snapshot from which other snapshots are dervied will not
delete the derived snapshots
:param str name:
Name/ID of VM whose snapshot will be deleted
:param str snap_name... | python | def delete_snapshot(name, snap_name, runas=None, all=False):
'''
Delete a snapshot
.. note::
Deleting a snapshot from which other snapshots are dervied will not
delete the derived snapshots
:param str name:
Name/ID of VM whose snapshot will be deleted
:param str snap_name... | [
"def",
"delete_snapshot",
"(",
"name",
",",
"snap_name",
",",
"runas",
"=",
"None",
",",
"all",
"=",
"False",
")",
":",
"# strict means raise an error if multiple snapshot IDs found for the name given",
"strict",
"=",
"not",
"all",
"# Validate VM and snapshot names",
"nam... | Delete a snapshot
.. note::
Deleting a snapshot from which other snapshots are dervied will not
delete the derived snapshots
:param str name:
Name/ID of VM whose snapshot will be deleted
:param str snap_name:
Name/ID of snapshot to delete
:param str runas:
Th... | [
"Delete",
"a",
"snapshot"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parallels.py#L688-L742 |
35,553 | saltstack/salt | salt/modules/parallels.py | revert_snapshot | def revert_snapshot(name, snap_name, runas=None):
'''
Revert a VM to a snapshot
:param str name:
Name/ID of VM to revert to a snapshot
:param str snap_name:
Name/ID of snapshot to revert to
:param str runas:
The user that the prlctl command will be run as
Example:
... | python | def revert_snapshot(name, snap_name, runas=None):
'''
Revert a VM to a snapshot
:param str name:
Name/ID of VM to revert to a snapshot
:param str snap_name:
Name/ID of snapshot to revert to
:param str runas:
The user that the prlctl command will be run as
Example:
... | [
"def",
"revert_snapshot",
"(",
"name",
",",
"snap_name",
",",
"runas",
"=",
"None",
")",
":",
"# Validate VM and snapshot names",
"name",
"=",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"name",
")",
"snap_name",
"=",
"_validate_snap_name",
"(",
"... | Revert a VM to a snapshot
:param str name:
Name/ID of VM to revert to a snapshot
:param str snap_name:
Name/ID of snapshot to revert to
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.revert_snap... | [
"Revert",
"a",
"VM",
"to",
"a",
"snapshot"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parallels.py#L745-L772 |
35,554 | saltstack/salt | salt/states/junos.py | rpc | def rpc(name, dest=None, **kwargs):
'''
Executes the given rpc. The returned data can be stored in a file
by specifying the destination path with dest as an argument
.. code-block:: yaml
get-interface-information:
junos:
- rpc
- dest: /home/user/rpc.log
... | python | def rpc(name, dest=None, **kwargs):
'''
Executes the given rpc. The returned data can be stored in a file
by specifying the destination path with dest as an argument
.. code-block:: yaml
get-interface-information:
junos:
- rpc
- dest: /home/user/rpc.log
... | [
"def",
"rpc",
"(",
"name",
",",
"dest",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"ret",
"[",
"'chang... | Executes the given rpc. The returned data can be stored in a file
by specifying the destination path with dest as an argument
.. code-block:: yaml
get-interface-information:
junos:
- rpc
- dest: /home/user/rpc.log
- interface_name: lo0
Parame... | [
"Executes",
"the",
"given",
"rpc",
".",
"The",
"returned",
"data",
"can",
"be",
"stored",
"in",
"a",
"file",
"by",
"specifying",
"the",
"destination",
"path",
"with",
"dest",
"as",
"an",
"argument"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/junos.py#L35-L75 |
35,555 | saltstack/salt | salt/states/junos.py | set_hostname | def set_hostname(name, **kwargs):
'''
Changes the hostname of the device.
.. code-block:: yaml
device_name:
junos:
- set_hostname
- comment: "Host-name set via saltstack."
Parameters:
Required
* hostname: The name to be set. (def... | python | def set_hostname(name, **kwargs):
'''
Changes the hostname of the device.
.. code-block:: yaml
device_name:
junos:
- set_hostname
- comment: "Host-name set via saltstack."
Parameters:
Required
* hostname: The name to be set. (def... | [
"def",
"set_hostname",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"ret",
"[",
"'changes'",
"]",
"=",
"__... | Changes the hostname of the device.
.. code-block:: yaml
device_name:
junos:
- set_hostname
- comment: "Host-name set via saltstack."
Parameters:
Required
* hostname: The name to be set. (default = None)
Optional
* kwargs: K... | [
"Changes",
"the",
"hostname",
"of",
"the",
"device",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/junos.py#L79-L109 |
35,556 | saltstack/salt | salt/states/junos.py | commit | def commit(name, **kwargs):
'''
Commits the changes loaded into the candidate configuration.
.. code-block:: yaml
commit the changes:
junos:
- commit
- confirm: 10
Parameters:
Optional
* kwargs: Keyworded arguments which can be ... | python | def commit(name, **kwargs):
'''
Commits the changes loaded into the candidate configuration.
.. code-block:: yaml
commit the changes:
junos:
- commit
- confirm: 10
Parameters:
Optional
* kwargs: Keyworded arguments which can be ... | [
"def",
"commit",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"ret",
"[",
"'changes'",
"]",
"=",
"__salt__... | Commits the changes loaded into the candidate configuration.
.. code-block:: yaml
commit the changes:
junos:
- commit
- confirm: 10
Parameters:
Optional
* kwargs: Keyworded arguments which can be provided like-
* timeout:
... | [
"Commits",
"the",
"changes",
"loaded",
"into",
"the",
"candidate",
"configuration",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/junos.py#L113-L153 |
35,557 | saltstack/salt | salt/states/junos.py | rollback | def rollback(name, **kwargs):
'''
Rollbacks the committed changes.
.. code-block:: yaml
rollback the changes:
junos:
- rollback
- id: 5
Parameters:
Optional
* id:
The rollback id value [0-49]. (default = 0)
* kw... | python | def rollback(name, **kwargs):
'''
Rollbacks the committed changes.
.. code-block:: yaml
rollback the changes:
junos:
- rollback
- id: 5
Parameters:
Optional
* id:
The rollback id value [0-49]. (default = 0)
* kw... | [
"def",
"rollback",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"ret",
"[",
"'changes'",
"]",
"=",
"__salt... | Rollbacks the committed changes.
.. code-block:: yaml
rollback the changes:
junos:
- rollback
- id: 5
Parameters:
Optional
* id:
The rollback id value [0-49]. (default = 0)
* kwargs: Keyworded arguments which can be pro... | [
"Rollbacks",
"the",
"committed",
"changes",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/junos.py#L157-L188 |
35,558 | saltstack/salt | salt/states/junos.py | diff | def diff(name, **kwargs):
'''
Gets the difference between the candidate and the current configuration.
.. code-block:: yaml
get the diff:
junos:
- diff
- id: 10
Parameters:
Optional
* id:
The rollback id value [0-49]. (... | python | def diff(name, **kwargs):
'''
Gets the difference between the candidate and the current configuration.
.. code-block:: yaml
get the diff:
junos:
- diff
- id: 10
Parameters:
Optional
* id:
The rollback id value [0-49]. (... | [
"def",
"diff",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"ret",
"[",
"'changes'",
"]",
"=",
"__salt__",... | Gets the difference between the candidate and the current configuration.
.. code-block:: yaml
get the diff:
junos:
- diff
- id: 10
Parameters:
Optional
* id:
The rollback id value [0-49]. (default = 0) | [
"Gets",
"the",
"difference",
"between",
"the",
"candidate",
"and",
"the",
"current",
"configuration",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/junos.py#L192-L210 |
35,559 | saltstack/salt | salt/states/junos.py | cli | def cli(name, format='text', **kwargs):
'''
Executes the CLI commands and reuturns the text output.
.. code-block:: yaml
show version:
junos:
- cli
- format: xml
Parameters:
Required
* command:
The command that need to ... | python | def cli(name, format='text', **kwargs):
'''
Executes the CLI commands and reuturns the text output.
.. code-block:: yaml
show version:
junos:
- cli
- format: xml
Parameters:
Required
* command:
The command that need to ... | [
"def",
"cli",
"(",
"name",
",",
"format",
"=",
"'text'",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"ret",
"[",
"'c... | Executes the CLI commands and reuturns the text output.
.. code-block:: yaml
show version:
junos:
- cli
- format: xml
Parameters:
Required
* command:
The command that need to be executed on Junos CLI. (default = None)
Opt... | [
"Executes",
"the",
"CLI",
"commands",
"and",
"reuturns",
"the",
"text",
"output",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/junos.py#L214-L243 |
35,560 | saltstack/salt | salt/states/junos.py | shutdown | def shutdown(name, **kwargs):
'''
Shuts down the device.
.. code-block:: yaml
shut the device:
junos:
- shutdown
- in_min: 10
Parameters:
Optional
* kwargs:
* reboot:
Whether to reboot instead of shutdow... | python | def shutdown(name, **kwargs):
'''
Shuts down the device.
.. code-block:: yaml
shut the device:
junos:
- shutdown
- in_min: 10
Parameters:
Optional
* kwargs:
* reboot:
Whether to reboot instead of shutdow... | [
"def",
"shutdown",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"ret",
"[",
"'changes'",
"]",
"=",
"__salt... | Shuts down the device.
.. code-block:: yaml
shut the device:
junos:
- shutdown
- in_min: 10
Parameters:
Optional
* kwargs:
* reboot:
Whether to reboot instead of shutdown. (default=False)
* at:
... | [
"Shuts",
"down",
"the",
"device",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/junos.py#L247-L270 |
35,561 | saltstack/salt | salt/states/junos.py | install_config | def install_config(name, **kwargs):
'''
Loads and commits the configuration provided.
.. code-block:: yaml
Install the mentioned config:
junos:
- install_config
- path: salt//configs/interface.set
- timeout: 100
- di... | python | def install_config(name, **kwargs):
'''
Loads and commits the configuration provided.
.. code-block:: yaml
Install the mentioned config:
junos:
- install_config
- path: salt//configs/interface.set
- timeout: 100
- di... | [
"def",
"install_config",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"ret",
"[",
"'changes'",
"]",
"=",
"... | Loads and commits the configuration provided.
.. code-block:: yaml
Install the mentioned config:
junos:
- install_config
- path: salt//configs/interface.set
- timeout: 100
- diffs_file: 'var/log/diff'
.. code-block:: y... | [
"Loads",
"and",
"commits",
"the",
"configuration",
"provided",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/junos.py#L274-L342 |
35,562 | saltstack/salt | salt/states/junos.py | install_os | def install_os(name, **kwargs):
'''
Installs the given image on the device. After the installation is complete
the device is rebooted, if reboot=True is given as a keyworded argument.
.. code-block:: yaml
salt://images/junos_image.tgz:
junos:
- install_os
... | python | def install_os(name, **kwargs):
'''
Installs the given image on the device. After the installation is complete
the device is rebooted, if reboot=True is given as a keyworded argument.
.. code-block:: yaml
salt://images/junos_image.tgz:
junos:
- install_os
... | [
"def",
"install_os",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"ret",
"[",
"'changes'",
"]",
"=",
"__sa... | Installs the given image on the device. After the installation is complete
the device is rebooted, if reboot=True is given as a keyworded argument.
.. code-block:: yaml
salt://images/junos_image.tgz:
junos:
- install_os
- timeout: 100
-... | [
"Installs",
"the",
"given",
"image",
"on",
"the",
"device",
".",
"After",
"the",
"installation",
"is",
"complete",
"the",
"device",
"is",
"rebooted",
"if",
"reboot",
"=",
"True",
"is",
"given",
"as",
"a",
"keyworded",
"argument",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/junos.py#L363-L395 |
35,563 | saltstack/salt | salt/states/junos.py | file_copy | def file_copy(name, dest=None, **kwargs):
'''
Copies the file from the local device to the junos device.
.. code-block:: yaml
/home/m2/info.txt:
junos:
- file_copy
- dest: info_copy.txt
Parameters:
Required
* src:
The s... | python | def file_copy(name, dest=None, **kwargs):
'''
Copies the file from the local device to the junos device.
.. code-block:: yaml
/home/m2/info.txt:
junos:
- file_copy
- dest: info_copy.txt
Parameters:
Required
* src:
The s... | [
"def",
"file_copy",
"(",
"name",
",",
"dest",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"ret",
"[",
"... | Copies the file from the local device to the junos device.
.. code-block:: yaml
/home/m2/info.txt:
junos:
- file_copy
- dest: info_copy.txt
Parameters:
Required
* src:
The sorce path where the file is kept.
* dest:
... | [
"Copies",
"the",
"file",
"from",
"the",
"local",
"device",
"to",
"the",
"junos",
"device",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/junos.py#L399-L419 |
35,564 | saltstack/salt | salt/states/junos.py | load | def load(name, **kwargs):
'''
Loads the configuration provided onto the junos device.
.. code-block:: yaml
Install the mentioned config:
junos:
- load
- path: salt//configs/interface.set
.. code-block:: yaml
Install the mentioned ... | python | def load(name, **kwargs):
'''
Loads the configuration provided onto the junos device.
.. code-block:: yaml
Install the mentioned config:
junos:
- load
- path: salt//configs/interface.set
.. code-block:: yaml
Install the mentioned ... | [
"def",
"load",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"ret",
"[",
"'changes'",
"]",
"=",
"__salt__",... | Loads the configuration provided onto the junos device.
.. code-block:: yaml
Install the mentioned config:
junos:
- load
- path: salt//configs/interface.set
.. code-block:: yaml
Install the mentioned config:
junos:
... | [
"Loads",
"the",
"configuration",
"provided",
"onto",
"the",
"junos",
"device",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/junos.py#L461-L519 |
35,565 | saltstack/salt | salt/modules/extfs.py | mkfs | def mkfs(device, fs_type, **kwargs):
'''
Create a file system on the specified device
CLI Example:
.. code-block:: bash
salt '*' extfs.mkfs /dev/sda1 fs_type=ext4 opts='acl,noexec'
Valid options are:
* **block_size**: 1024, 2048 or 4096
* **check**: check for bad blocks
* **... | python | def mkfs(device, fs_type, **kwargs):
'''
Create a file system on the specified device
CLI Example:
.. code-block:: bash
salt '*' extfs.mkfs /dev/sda1 fs_type=ext4 opts='acl,noexec'
Valid options are:
* **block_size**: 1024, 2048 or 4096
* **check**: check for bad blocks
* **... | [
"def",
"mkfs",
"(",
"device",
",",
"fs_type",
",",
"*",
"*",
"kwargs",
")",
":",
"kwarg_map",
"=",
"{",
"'block_size'",
":",
"'b'",
",",
"'check'",
":",
"'c'",
",",
"'direct'",
":",
"'D'",
",",
"'ext_opts'",
":",
"'E'",
",",
"'fragment_size'",
":",
"... | Create a file system on the specified device
CLI Example:
.. code-block:: bash
salt '*' extfs.mkfs /dev/sda1 fs_type=ext4 opts='acl,noexec'
Valid options are:
* **block_size**: 1024, 2048 or 4096
* **check**: check for bad blocks
* **direct**: use direct IO
* **ext_opts**: exten... | [
"Create",
"a",
"file",
"system",
"on",
"the",
"specified",
"device"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/extfs.py#L29-L123 |
35,566 | saltstack/salt | salt/utils/verify.py | zmq_version | def zmq_version():
'''
ZeroMQ python bindings >= 2.1.9 are required
'''
try:
import zmq
except Exception:
# Return True for local mode
return True
ver = zmq.__version__
# The last matched group can be None if the version
# is something like 3.1 and that will work ... | python | def zmq_version():
'''
ZeroMQ python bindings >= 2.1.9 are required
'''
try:
import zmq
except Exception:
# Return True for local mode
return True
ver = zmq.__version__
# The last matched group can be None if the version
# is something like 3.1 and that will work ... | [
"def",
"zmq_version",
"(",
")",
":",
"try",
":",
"import",
"zmq",
"except",
"Exception",
":",
"# Return True for local mode",
"return",
"True",
"ver",
"=",
"zmq",
".",
"__version__",
"# The last matched group can be None if the version",
"# is something like 3.1 and that wi... | ZeroMQ python bindings >= 2.1.9 are required | [
"ZeroMQ",
"python",
"bindings",
">",
"=",
"2",
".",
"1",
".",
"9",
"are",
"required"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/verify.py#L40-L98 |
35,567 | saltstack/salt | salt/utils/verify.py | lookup_family | def lookup_family(hostname):
'''
Lookup a hostname and determine its address family. The first address returned
will be AF_INET6 if the system is IPv6-enabled, and AF_INET otherwise.
'''
# If lookups fail, fall back to AF_INET sockets (and v4 addresses).
fallback = socket.AF_INET
try:
... | python | def lookup_family(hostname):
'''
Lookup a hostname and determine its address family. The first address returned
will be AF_INET6 if the system is IPv6-enabled, and AF_INET otherwise.
'''
# If lookups fail, fall back to AF_INET sockets (and v4 addresses).
fallback = socket.AF_INET
try:
... | [
"def",
"lookup_family",
"(",
"hostname",
")",
":",
"# If lookups fail, fall back to AF_INET sockets (and v4 addresses).",
"fallback",
"=",
"socket",
".",
"AF_INET",
"try",
":",
"hostnames",
"=",
"socket",
".",
"getaddrinfo",
"(",
"hostname",
"or",
"None",
",",
"None",... | Lookup a hostname and determine its address family. The first address returned
will be AF_INET6 if the system is IPv6-enabled, and AF_INET otherwise. | [
"Lookup",
"a",
"hostname",
"and",
"determine",
"its",
"address",
"family",
".",
"The",
"first",
"address",
"returned",
"will",
"be",
"AF_INET6",
"if",
"the",
"system",
"is",
"IPv6",
"-",
"enabled",
"and",
"AF_INET",
"otherwise",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/verify.py#L101-L117 |
35,568 | saltstack/salt | salt/utils/verify.py | verify_socket | def verify_socket(interface, pub_port, ret_port):
'''
Attempt to bind to the sockets to verify that they are available
'''
addr_family = lookup_family(interface)
for port in pub_port, ret_port:
sock = socket.socket(addr_family, socket.SOCK_STREAM)
try:
sock.setsockopt(so... | python | def verify_socket(interface, pub_port, ret_port):
'''
Attempt to bind to the sockets to verify that they are available
'''
addr_family = lookup_family(interface)
for port in pub_port, ret_port:
sock = socket.socket(addr_family, socket.SOCK_STREAM)
try:
sock.setsockopt(so... | [
"def",
"verify_socket",
"(",
"interface",
",",
"pub_port",
",",
"ret_port",
")",
":",
"addr_family",
"=",
"lookup_family",
"(",
"interface",
")",
"for",
"port",
"in",
"pub_port",
",",
"ret_port",
":",
"sock",
"=",
"socket",
".",
"socket",
"(",
"addr_family",... | Attempt to bind to the sockets to verify that they are available | [
"Attempt",
"to",
"bind",
"to",
"the",
"sockets",
"to",
"verify",
"that",
"they",
"are",
"available"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/verify.py#L120-L146 |
35,569 | saltstack/salt | salt/utils/verify.py | verify_files | def verify_files(files, user):
'''
Verify that the named files exist and are owned by the named user
'''
if salt.utils.platform.is_windows():
return True
import pwd # after confirming not running Windows
try:
pwnam = pwd.getpwnam(user)
uid = pwnam[2]
except KeyError:... | python | def verify_files(files, user):
'''
Verify that the named files exist and are owned by the named user
'''
if salt.utils.platform.is_windows():
return True
import pwd # after confirming not running Windows
try:
pwnam = pwd.getpwnam(user)
uid = pwnam[2]
except KeyError:... | [
"def",
"verify_files",
"(",
"files",
",",
"user",
")",
":",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"return",
"True",
"import",
"pwd",
"# after confirming not running Windows",
"try",
":",
"pwnam",
"=",
"pwd",
".",
"g... | Verify that the named files exist and are owned by the named user | [
"Verify",
"that",
"the",
"named",
"files",
"exist",
"and",
"are",
"owned",
"by",
"the",
"named",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/verify.py#L149-L197 |
35,570 | saltstack/salt | salt/utils/verify.py | list_path_traversal | def list_path_traversal(path):
'''
Returns a full list of directories leading up to, and including, a path.
So list_path_traversal('/path/to/salt') would return:
['/', '/path', '/path/to', '/path/to/salt']
in that order.
This routine has been tested on Windows systems as well.
list_pat... | python | def list_path_traversal(path):
'''
Returns a full list of directories leading up to, and including, a path.
So list_path_traversal('/path/to/salt') would return:
['/', '/path', '/path/to', '/path/to/salt']
in that order.
This routine has been tested on Windows systems as well.
list_pat... | [
"def",
"list_path_traversal",
"(",
"path",
")",
":",
"out",
"=",
"[",
"path",
"]",
"(",
"head",
",",
"tail",
")",
"=",
"os",
".",
"path",
".",
"split",
"(",
"path",
")",
"if",
"tail",
"==",
"''",
":",
"# paths with trailing separators will return an empty ... | Returns a full list of directories leading up to, and including, a path.
So list_path_traversal('/path/to/salt') would return:
['/', '/path', '/path/to', '/path/to/salt']
in that order.
This routine has been tested on Windows systems as well.
list_path_traversal('c:\\path\\to\\salt') on Window... | [
"Returns",
"a",
"full",
"list",
"of",
"directories",
"leading",
"up",
"to",
"and",
"including",
"a",
"path",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/verify.py#L359-L381 |
35,571 | saltstack/salt | salt/utils/verify.py | check_path_traversal | def check_path_traversal(path, user='root', skip_perm_errors=False):
'''
Walk from the root up to a directory and verify that the current
user has access to read each directory. This is used for making
sure a user can read all parent directories of the minion's key
before trying to go and generate... | python | def check_path_traversal(path, user='root', skip_perm_errors=False):
'''
Walk from the root up to a directory and verify that the current
user has access to read each directory. This is used for making
sure a user can read all parent directories of the minion's key
before trying to go and generate... | [
"def",
"check_path_traversal",
"(",
"path",
",",
"user",
"=",
"'root'",
",",
"skip_perm_errors",
"=",
"False",
")",
":",
"for",
"tpath",
"in",
"list_path_traversal",
"(",
"path",
")",
":",
"if",
"not",
"os",
".",
"access",
"(",
"tpath",
",",
"os",
".",
... | Walk from the root up to a directory and verify that the current
user has access to read each directory. This is used for making
sure a user can read all parent directories of the minion's key
before trying to go and generate a new key and raising an IOError | [
"Walk",
"from",
"the",
"root",
"up",
"to",
"a",
"directory",
"and",
"verify",
"that",
"the",
"current",
"user",
"has",
"access",
"to",
"read",
"each",
"directory",
".",
"This",
"is",
"used",
"for",
"making",
"sure",
"a",
"user",
"can",
"read",
"all",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/verify.py#L384-L412 |
35,572 | saltstack/salt | salt/utils/verify.py | check_max_open_files | def check_max_open_files(opts):
'''
Check the number of max allowed open files and adjust if needed
'''
mof_c = opts.get('max_open_files', 100000)
if sys.platform.startswith('win'):
# Check the Windows API for more detail on this
# http://msdn.microsoft.com/en-us/library/xt874334(v=v... | python | def check_max_open_files(opts):
'''
Check the number of max allowed open files and adjust if needed
'''
mof_c = opts.get('max_open_files', 100000)
if sys.platform.startswith('win'):
# Check the Windows API for more detail on this
# http://msdn.microsoft.com/en-us/library/xt874334(v=v... | [
"def",
"check_max_open_files",
"(",
"opts",
")",
":",
"mof_c",
"=",
"opts",
".",
"get",
"(",
"'max_open_files'",
",",
"100000",
")",
"if",
"sys",
".",
"platform",
".",
"startswith",
"(",
"'win'",
")",
":",
"# Check the Windows API for more detail on this",
"# ht... | Check the number of max allowed open files and adjust if needed | [
"Check",
"the",
"number",
"of",
"max",
"allowed",
"open",
"files",
"and",
"adjust",
"if",
"needed"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/verify.py#L415-L472 |
35,573 | saltstack/salt | salt/utils/verify.py | clean_path | def clean_path(root, path, subdir=False):
'''
Accepts the root the path needs to be under and verifies that the path is
under said root. Pass in subdir=True if the path can result in a
subdirectory of the root instead of having to reside directly in the root
'''
if not os.path.isabs(root):
... | python | def clean_path(root, path, subdir=False):
'''
Accepts the root the path needs to be under and verifies that the path is
under said root. Pass in subdir=True if the path can result in a
subdirectory of the root instead of having to reside directly in the root
'''
if not os.path.isabs(root):
... | [
"def",
"clean_path",
"(",
"root",
",",
"path",
",",
"subdir",
"=",
"False",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isabs",
"(",
"root",
")",
":",
"return",
"''",
"if",
"not",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")",
":",
"pat... | Accepts the root the path needs to be under and verifies that the path is
under said root. Pass in subdir=True if the path can result in a
subdirectory of the root instead of having to reside directly in the root | [
"Accepts",
"the",
"root",
"the",
"path",
"needs",
"to",
"be",
"under",
"and",
"verifies",
"that",
"the",
"path",
"is",
"under",
"said",
"root",
".",
"Pass",
"in",
"subdir",
"=",
"True",
"if",
"the",
"path",
"can",
"result",
"in",
"a",
"subdirectory",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/verify.py#L475-L492 |
35,574 | saltstack/salt | salt/utils/verify.py | valid_id | def valid_id(opts, id_):
'''
Returns if the passed id is valid
'''
try:
if any(x in id_ for x in ('/', '\\', str('\0'))):
return False
return bool(clean_path(opts['pki_dir'], id_))
except (AttributeError, KeyError, TypeError, UnicodeDecodeError):
return False | python | def valid_id(opts, id_):
'''
Returns if the passed id is valid
'''
try:
if any(x in id_ for x in ('/', '\\', str('\0'))):
return False
return bool(clean_path(opts['pki_dir'], id_))
except (AttributeError, KeyError, TypeError, UnicodeDecodeError):
return False | [
"def",
"valid_id",
"(",
"opts",
",",
"id_",
")",
":",
"try",
":",
"if",
"any",
"(",
"x",
"in",
"id_",
"for",
"x",
"in",
"(",
"'/'",
",",
"'\\\\'",
",",
"str",
"(",
"'\\0'",
")",
")",
")",
":",
"return",
"False",
"return",
"bool",
"(",
"clean_pa... | Returns if the passed id is valid | [
"Returns",
"if",
"the",
"passed",
"id",
"is",
"valid"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/verify.py#L495-L504 |
35,575 | saltstack/salt | salt/utils/verify.py | safe_py_code | def safe_py_code(code):
'''
Check a string to see if it has any potentially unsafe routines which
could be executed via python, this routine is used to improve the
safety of modules suct as virtualenv
'''
bads = (
'import',
';',
'subprocess',
'eval... | python | def safe_py_code(code):
'''
Check a string to see if it has any potentially unsafe routines which
could be executed via python, this routine is used to improve the
safety of modules suct as virtualenv
'''
bads = (
'import',
';',
'subprocess',
'eval... | [
"def",
"safe_py_code",
"(",
"code",
")",
":",
"bads",
"=",
"(",
"'import'",
",",
"';'",
",",
"'subprocess'",
",",
"'eval'",
",",
"'open'",
",",
"'file'",
",",
"'exec'",
",",
"'input'",
")",
"for",
"bad",
"in",
"bads",
":",
"if",
"code",
".",
"count",... | Check a string to see if it has any potentially unsafe routines which
could be executed via python, this routine is used to improve the
safety of modules suct as virtualenv | [
"Check",
"a",
"string",
"to",
"see",
"if",
"it",
"has",
"any",
"potentially",
"unsafe",
"routines",
"which",
"could",
"be",
"executed",
"via",
"python",
"this",
"routine",
"is",
"used",
"to",
"improve",
"the",
"safety",
"of",
"modules",
"suct",
"as",
"virt... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/verify.py#L507-L525 |
35,576 | saltstack/salt | salt/utils/verify.py | verify_log | def verify_log(opts):
'''
If an insecre logging configuration is found, show a warning
'''
level = LOG_LEVELS.get(str(opts.get('log_level')).lower(), logging.NOTSET)
if level < logging.INFO:
log.warning('Insecure logging configuration detected! Sensitive data may be logged.') | python | def verify_log(opts):
'''
If an insecre logging configuration is found, show a warning
'''
level = LOG_LEVELS.get(str(opts.get('log_level')).lower(), logging.NOTSET)
if level < logging.INFO:
log.warning('Insecure logging configuration detected! Sensitive data may be logged.') | [
"def",
"verify_log",
"(",
"opts",
")",
":",
"level",
"=",
"LOG_LEVELS",
".",
"get",
"(",
"str",
"(",
"opts",
".",
"get",
"(",
"'log_level'",
")",
")",
".",
"lower",
"(",
")",
",",
"logging",
".",
"NOTSET",
")",
"if",
"level",
"<",
"logging",
".",
... | If an insecre logging configuration is found, show a warning | [
"If",
"an",
"insecre",
"logging",
"configuration",
"is",
"found",
"show",
"a",
"warning"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/verify.py#L528-L535 |
35,577 | saltstack/salt | salt/modules/pacmanpkg.py | _uninstall | def _uninstall(action='remove', name=None, pkgs=None, **kwargs):
'''
remove and purge do identical things but with different pacman commands,
this function performs the common logic.
'''
try:
pkg_params = __salt__['pkg_resource.parse_targets'](name, pkgs)[0]
except MinionError as exc:
... | python | def _uninstall(action='remove', name=None, pkgs=None, **kwargs):
'''
remove and purge do identical things but with different pacman commands,
this function performs the common logic.
'''
try:
pkg_params = __salt__['pkg_resource.parse_targets'](name, pkgs)[0]
except MinionError as exc:
... | [
"def",
"_uninstall",
"(",
"action",
"=",
"'remove'",
",",
"name",
"=",
"None",
",",
"pkgs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"pkg_params",
"=",
"__salt__",
"[",
"'pkg_resource.parse_targets'",
"]",
"(",
"name",
",",
"pkgs",
"... | remove and purge do identical things but with different pacman commands,
this function performs the common logic. | [
"remove",
"and",
"purge",
"do",
"identical",
"things",
"but",
"with",
"different",
"pacman",
"commands",
"this",
"function",
"performs",
"the",
"common",
"logic",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pacmanpkg.py#L706-L754 |
35,578 | saltstack/salt | salt/cli/spm.py | SPM.run | def run(self):
'''
Run the api
'''
ui = salt.spm.SPMCmdlineInterface()
self.parse_args()
self.setup_logfile_logger()
v_dirs = [
self.config['spm_cache_dir'],
]
verify_env(v_dirs,
self.config['user'],
... | python | def run(self):
'''
Run the api
'''
ui = salt.spm.SPMCmdlineInterface()
self.parse_args()
self.setup_logfile_logger()
v_dirs = [
self.config['spm_cache_dir'],
]
verify_env(v_dirs,
self.config['user'],
... | [
"def",
"run",
"(",
"self",
")",
":",
"ui",
"=",
"salt",
".",
"spm",
".",
"SPMCmdlineInterface",
"(",
")",
"self",
".",
"parse_args",
"(",
")",
"self",
".",
"setup_logfile_logger",
"(",
")",
"v_dirs",
"=",
"[",
"self",
".",
"config",
"[",
"'spm_cache_di... | Run the api | [
"Run",
"the",
"api"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/spm.py#L25-L41 |
35,579 | saltstack/salt | salt/pillar/sql_base.py | SqlBaseExtPillar.enter_root | def enter_root(self, root):
'''
Set self.focus for kwarg queries
'''
# There is no collision protection on root name isolation
if root:
self.result[root] = self.focus = {}
else:
self.focus = self.result | python | def enter_root(self, root):
'''
Set self.focus for kwarg queries
'''
# There is no collision protection on root name isolation
if root:
self.result[root] = self.focus = {}
else:
self.focus = self.result | [
"def",
"enter_root",
"(",
"self",
",",
"root",
")",
":",
"# There is no collision protection on root name isolation",
"if",
"root",
":",
"self",
".",
"result",
"[",
"root",
"]",
"=",
"self",
".",
"focus",
"=",
"{",
"}",
"else",
":",
"self",
".",
"focus",
"... | Set self.focus for kwarg queries | [
"Set",
"self",
".",
"focus",
"for",
"kwarg",
"queries"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/sql_base.py#L286-L294 |
35,580 | saltstack/salt | salt/pillar/sql_base.py | SqlBaseExtPillar.process_fields | def process_fields(self, field_names, depth):
'''
The primary purpose of this function is to store the sql field list
and the depth to which we process.
'''
# List of field names in correct order.
self.field_names = field_names
# number of fields.
self.num... | python | def process_fields(self, field_names, depth):
'''
The primary purpose of this function is to store the sql field list
and the depth to which we process.
'''
# List of field names in correct order.
self.field_names = field_names
# number of fields.
self.num... | [
"def",
"process_fields",
"(",
"self",
",",
"field_names",
",",
"depth",
")",
":",
"# List of field names in correct order.",
"self",
".",
"field_names",
"=",
"field_names",
"# number of fields.",
"self",
".",
"num_fields",
"=",
"len",
"(",
"field_names",
")",
"# Con... | The primary purpose of this function is to store the sql field list
and the depth to which we process. | [
"The",
"primary",
"purpose",
"of",
"this",
"function",
"is",
"to",
"store",
"the",
"sql",
"field",
"list",
"and",
"the",
"depth",
"to",
"which",
"we",
"process",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/sql_base.py#L296-L309 |
35,581 | saltstack/salt | salt/pillar/sql_base.py | SqlBaseExtPillar.fetch | def fetch(self,
minion_id,
pillar, # pylint: disable=W0613
*args,
**kwargs):
'''
Execute queries, merge and return as a dict.
'''
db_name = self._db_name()
log.info('Querying %s for information for %s', db_name, minion_id)
... | python | def fetch(self,
minion_id,
pillar, # pylint: disable=W0613
*args,
**kwargs):
'''
Execute queries, merge and return as a dict.
'''
db_name = self._db_name()
log.info('Querying %s for information for %s', db_name, minion_id)
... | [
"def",
"fetch",
"(",
"self",
",",
"minion_id",
",",
"pillar",
",",
"# pylint: disable=W0613",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"db_name",
"=",
"self",
".",
"_db_name",
"(",
")",
"log",
".",
"info",
"(",
"'Querying %s for information for %s'",
... | Execute queries, merge and return as a dict. | [
"Execute",
"queries",
"merge",
"and",
"return",
"as",
"a",
"dict",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/sql_base.py#L418-L451 |
35,582 | saltstack/salt | salt/modules/bridge.py | _linux_delif | def _linux_delif(br, iface):
'''
Internal, removes an interface from a bridge
'''
brctl = _tool_path('brctl')
return __salt__['cmd.run']('{0} delif {1} {2}'.format(brctl, br, iface),
python_shell=False) | python | def _linux_delif(br, iface):
'''
Internal, removes an interface from a bridge
'''
brctl = _tool_path('brctl')
return __salt__['cmd.run']('{0} delif {1} {2}'.format(brctl, br, iface),
python_shell=False) | [
"def",
"_linux_delif",
"(",
"br",
",",
"iface",
")",
":",
"brctl",
"=",
"_tool_path",
"(",
"'brctl'",
")",
"return",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'{0} delif {1} {2}'",
".",
"format",
"(",
"brctl",
",",
"br",
",",
"iface",
")",
",",
"python_sh... | Internal, removes an interface from a bridge | [
"Internal",
"removes",
"an",
"interface",
"from",
"a",
"bridge"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bridge.py#L121-L127 |
35,583 | saltstack/salt | salt/modules/bridge.py | _linux_stp | def _linux_stp(br, state):
'''
Internal, sets STP state
'''
brctl = _tool_path('brctl')
return __salt__['cmd.run']('{0} stp {1} {2}'.format(brctl, br, state),
python_shell=False) | python | def _linux_stp(br, state):
'''
Internal, sets STP state
'''
brctl = _tool_path('brctl')
return __salt__['cmd.run']('{0} stp {1} {2}'.format(brctl, br, state),
python_shell=False) | [
"def",
"_linux_stp",
"(",
"br",
",",
"state",
")",
":",
"brctl",
"=",
"_tool_path",
"(",
"'brctl'",
")",
"return",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'{0} stp {1} {2}'",
".",
"format",
"(",
"brctl",
",",
"br",
",",
"state",
")",
",",
"python_shell"... | Internal, sets STP state | [
"Internal",
"sets",
"STP",
"state"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bridge.py#L130-L136 |
35,584 | saltstack/salt | salt/modules/bridge.py | _bsd_addif | def _bsd_addif(br, iface):
'''
Internal, adds an interface to a bridge
'''
kernel = __grains__['kernel']
if kernel == 'NetBSD':
cmd = _tool_path('brconfig')
brcmd = 'add'
else:
cmd = _tool_path('ifconfig')
brcmd = 'addem'
if not br or not iface:
retur... | python | def _bsd_addif(br, iface):
'''
Internal, adds an interface to a bridge
'''
kernel = __grains__['kernel']
if kernel == 'NetBSD':
cmd = _tool_path('brconfig')
brcmd = 'add'
else:
cmd = _tool_path('ifconfig')
brcmd = 'addem'
if not br or not iface:
retur... | [
"def",
"_bsd_addif",
"(",
"br",
",",
"iface",
")",
":",
"kernel",
"=",
"__grains__",
"[",
"'kernel'",
"]",
"if",
"kernel",
"==",
"'NetBSD'",
":",
"cmd",
"=",
"_tool_path",
"(",
"'brconfig'",
")",
"brcmd",
"=",
"'add'",
"else",
":",
"cmd",
"=",
"_tool_p... | Internal, adds an interface to a bridge | [
"Internal",
"adds",
"an",
"interface",
"to",
"a",
"bridge"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bridge.py#L252-L268 |
35,585 | saltstack/salt | salt/modules/bridge.py | _bsd_stp | def _bsd_stp(br, state, iface):
'''
Internal, sets STP state. On BSD-like, it is required to specify the
STP physical interface
'''
kernel = __grains__['kernel']
if kernel == 'NetBSD':
cmd = _tool_path('brconfig')
else:
cmd = _tool_path('ifconfig')
if not br or not iface... | python | def _bsd_stp(br, state, iface):
'''
Internal, sets STP state. On BSD-like, it is required to specify the
STP physical interface
'''
kernel = __grains__['kernel']
if kernel == 'NetBSD':
cmd = _tool_path('brconfig')
else:
cmd = _tool_path('ifconfig')
if not br or not iface... | [
"def",
"_bsd_stp",
"(",
"br",
",",
"state",
",",
"iface",
")",
":",
"kernel",
"=",
"__grains__",
"[",
"'kernel'",
"]",
"if",
"kernel",
"==",
"'NetBSD'",
":",
"cmd",
"=",
"_tool_path",
"(",
"'brconfig'",
")",
"else",
":",
"cmd",
"=",
"_tool_path",
"(",
... | Internal, sets STP state. On BSD-like, it is required to specify the
STP physical interface | [
"Internal",
"sets",
"STP",
"state",
".",
"On",
"BSD",
"-",
"like",
"it",
"is",
"required",
"to",
"specify",
"the",
"STP",
"physical",
"interface"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bridge.py#L290-L305 |
35,586 | saltstack/salt | salt/modules/bridge.py | _os_dispatch | def _os_dispatch(func, *args, **kwargs):
'''
Internal, dispatches functions by operating system
'''
if __grains__['kernel'] in SUPPORTED_BSD_LIKE:
kernel = 'bsd'
else:
kernel = __grains__['kernel'].lower()
_os_func = getattr(sys.modules[__name__], '_{0}_{1}'.format(kernel, func)... | python | def _os_dispatch(func, *args, **kwargs):
'''
Internal, dispatches functions by operating system
'''
if __grains__['kernel'] in SUPPORTED_BSD_LIKE:
kernel = 'bsd'
else:
kernel = __grains__['kernel'].lower()
_os_func = getattr(sys.modules[__name__], '_{0}_{1}'.format(kernel, func)... | [
"def",
"_os_dispatch",
"(",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"__grains__",
"[",
"'kernel'",
"]",
"in",
"SUPPORTED_BSD_LIKE",
":",
"kernel",
"=",
"'bsd'",
"else",
":",
"kernel",
"=",
"__grains__",
"[",
"'kernel'",
"]",
... | Internal, dispatches functions by operating system | [
"Internal",
"dispatches",
"functions",
"by",
"operating",
"system"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bridge.py#L308-L320 |
35,587 | saltstack/salt | salt/modules/bridge.py | list_ | def list_():
'''
Returns the machine's bridges list
CLI Example:
.. code-block:: bash
salt '*' bridge.list
'''
brs = _os_dispatch('brshow')
if not brs:
return None
brlist = []
for br in brs:
brlist.append(br)
return brlist | python | def list_():
'''
Returns the machine's bridges list
CLI Example:
.. code-block:: bash
salt '*' bridge.list
'''
brs = _os_dispatch('brshow')
if not brs:
return None
brlist = []
for br in brs:
brlist.append(br)
return brlist | [
"def",
"list_",
"(",
")",
":",
"brs",
"=",
"_os_dispatch",
"(",
"'brshow'",
")",
"if",
"not",
"brs",
":",
"return",
"None",
"brlist",
"=",
"[",
"]",
"for",
"br",
"in",
"brs",
":",
"brlist",
".",
"append",
"(",
"br",
")",
"return",
"brlist"
] | Returns the machine's bridges list
CLI Example:
.. code-block:: bash
salt '*' bridge.list | [
"Returns",
"the",
"machine",
"s",
"bridges",
"list"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bridge.py#L342-L359 |
35,588 | saltstack/salt | salt/modules/bridge.py | find_interfaces | def find_interfaces(*args):
'''
Returns the bridge to which the interfaces are bond to
CLI Example:
.. code-block:: bash
salt '*' bridge.find_interfaces eth0 [eth1...]
'''
brs = _os_dispatch('brshow')
if not brs:
return None
iflist = {}
for iface in args:
... | python | def find_interfaces(*args):
'''
Returns the bridge to which the interfaces are bond to
CLI Example:
.. code-block:: bash
salt '*' bridge.find_interfaces eth0 [eth1...]
'''
brs = _os_dispatch('brshow')
if not brs:
return None
iflist = {}
for iface in args:
... | [
"def",
"find_interfaces",
"(",
"*",
"args",
")",
":",
"brs",
"=",
"_os_dispatch",
"(",
"'brshow'",
")",
"if",
"not",
"brs",
":",
"return",
"None",
"iflist",
"=",
"{",
"}",
"for",
"iface",
"in",
"args",
":",
"for",
"br",
"in",
"brs",
":",
"try",
":"... | Returns the bridge to which the interfaces are bond to
CLI Example:
.. code-block:: bash
salt '*' bridge.find_interfaces eth0 [eth1...] | [
"Returns",
"the",
"bridge",
"to",
"which",
"the",
"interfaces",
"are",
"bond",
"to"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bridge.py#L380-L404 |
35,589 | saltstack/salt | salt/modules/bridge.py | stp | def stp(br=None, state='disable', iface=None):
'''
Sets Spanning Tree Protocol state for a bridge
CLI Example:
.. code-block:: bash
salt '*' bridge.stp br0 enable
salt '*' bridge.stp br0 disable
For BSD-like operating systems, it is required to add the interface on
which to e... | python | def stp(br=None, state='disable', iface=None):
'''
Sets Spanning Tree Protocol state for a bridge
CLI Example:
.. code-block:: bash
salt '*' bridge.stp br0 enable
salt '*' bridge.stp br0 disable
For BSD-like operating systems, it is required to add the interface on
which to e... | [
"def",
"stp",
"(",
"br",
"=",
"None",
",",
"state",
"=",
"'disable'",
",",
"iface",
"=",
"None",
")",
":",
"kernel",
"=",
"__grains__",
"[",
"'kernel'",
"]",
"if",
"kernel",
"==",
"'Linux'",
":",
"states",
"=",
"{",
"'enable'",
":",
"'on'",
",",
"'... | Sets Spanning Tree Protocol state for a bridge
CLI Example:
.. code-block:: bash
salt '*' bridge.stp br0 enable
salt '*' bridge.stp br0 disable
For BSD-like operating systems, it is required to add the interface on
which to enable the STP.
CLI Example:
.. code-block:: bash
... | [
"Sets",
"Spanning",
"Tree",
"Protocol",
"state",
"for",
"a",
"bridge"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bridge.py#L459-L488 |
35,590 | saltstack/salt | salt/utils/decorators/state.py | OutputUnifier.content_check | def content_check(self, result):
'''
Checks for specific types in the state output.
Raises an Exception in case particular rule is broken.
:param result:
:return:
'''
if not isinstance(result, dict):
err_msg = 'Malformed state return. Data must be a d... | python | def content_check(self, result):
'''
Checks for specific types in the state output.
Raises an Exception in case particular rule is broken.
:param result:
:return:
'''
if not isinstance(result, dict):
err_msg = 'Malformed state return. Data must be a d... | [
"def",
"content_check",
"(",
"self",
",",
"result",
")",
":",
"if",
"not",
"isinstance",
"(",
"result",
",",
"dict",
")",
":",
"err_msg",
"=",
"'Malformed state return. Data must be a dictionary type.'",
"elif",
"not",
"isinstance",
"(",
"result",
".",
"get",
"(... | Checks for specific types in the state output.
Raises an Exception in case particular rule is broken.
:param result:
:return: | [
"Checks",
"for",
"specific",
"types",
"in",
"the",
"state",
"output",
".",
"Raises",
"an",
"Exception",
"in",
"case",
"particular",
"rule",
"is",
"broken",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/state.py#L48-L73 |
35,591 | saltstack/salt | salt/modules/mac_xattr.py | delete | def delete(path, attribute):
'''
Removes the given attribute from the file
:param str path: The file(s) to get attributes from
:param str attribute: The attribute name to be deleted from the
file/directory
:return: True if successful, otherwise False
:rtype: bool
:raises: Command... | python | def delete(path, attribute):
'''
Removes the given attribute from the file
:param str path: The file(s) to get attributes from
:param str attribute: The attribute name to be deleted from the
file/directory
:return: True if successful, otherwise False
:rtype: bool
:raises: Command... | [
"def",
"delete",
"(",
"path",
",",
"attribute",
")",
":",
"cmd",
"=",
"'xattr -d \"{0}\" \"{1}\"'",
".",
"format",
"(",
"attribute",
",",
"path",
")",
"try",
":",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_success",
"(",
"cmd",
")",
"exce... | Removes the given attribute from the file
:param str path: The file(s) to get attributes from
:param str attribute: The attribute name to be deleted from the
file/directory
:return: True if successful, otherwise False
:rtype: bool
:raises: CommandExecutionError on file not found, attribu... | [
"Removes",
"the",
"given",
"attribute",
"from",
"the",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_xattr.py#L171-L202 |
35,592 | saltstack/salt | salt/modules/rallydev.py | _get_token | def _get_token():
'''
Get an auth token
'''
username = __opts__.get('rallydev', {}).get('username', None)
password = __opts__.get('rallydev', {}).get('password', None)
path = 'https://rally1.rallydev.com/slm/webservice/v2.0/security/authorize'
result = salt.utils.http.query(
path,
... | python | def _get_token():
'''
Get an auth token
'''
username = __opts__.get('rallydev', {}).get('username', None)
password = __opts__.get('rallydev', {}).get('password', None)
path = 'https://rally1.rallydev.com/slm/webservice/v2.0/security/authorize'
result = salt.utils.http.query(
path,
... | [
"def",
"_get_token",
"(",
")",
":",
"username",
"=",
"__opts__",
".",
"get",
"(",
"'rallydev'",
",",
"{",
"}",
")",
".",
"get",
"(",
"'username'",
",",
"None",
")",
"password",
"=",
"__opts__",
".",
"get",
"(",
"'rallydev'",
",",
"{",
"}",
")",
"."... | Get an auth token | [
"Get",
"an",
"auth",
"token"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rallydev.py#L39-L61 |
35,593 | saltstack/salt | salt/modules/rallydev.py | _query | def _query(action=None,
command=None,
args=None,
method='GET',
header_dict=None,
data=None):
'''
Make a web call to RallyDev.
'''
token = _get_token()
username = __opts__.get('rallydev', {}).get('username', None)
password = __opts__.get('ral... | python | def _query(action=None,
command=None,
args=None,
method='GET',
header_dict=None,
data=None):
'''
Make a web call to RallyDev.
'''
token = _get_token()
username = __opts__.get('rallydev', {}).get('username', None)
password = __opts__.get('ral... | [
"def",
"_query",
"(",
"action",
"=",
"None",
",",
"command",
"=",
"None",
",",
"args",
"=",
"None",
",",
"method",
"=",
"'GET'",
",",
"header_dict",
"=",
"None",
",",
"data",
"=",
"None",
")",
":",
"token",
"=",
"_get_token",
"(",
")",
"username",
... | Make a web call to RallyDev. | [
"Make",
"a",
"web",
"call",
"to",
"RallyDev",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rallydev.py#L64-L123 |
35,594 | saltstack/salt | salt/modules/rallydev.py | show_item | def show_item(name, id_):
'''
Show an item
CLI Example:
.. code-block:: bash
salt myminion rallydev.show_<item name> <item id>
'''
status, result = _query(action=name, command=id_)
return result | python | def show_item(name, id_):
'''
Show an item
CLI Example:
.. code-block:: bash
salt myminion rallydev.show_<item name> <item id>
'''
status, result = _query(action=name, command=id_)
return result | [
"def",
"show_item",
"(",
"name",
",",
"id_",
")",
":",
"status",
",",
"result",
"=",
"_query",
"(",
"action",
"=",
"name",
",",
"command",
"=",
"id_",
")",
"return",
"result"
] | Show an item
CLI Example:
.. code-block:: bash
salt myminion rallydev.show_<item name> <item id> | [
"Show",
"an",
"item"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rallydev.py#L164-L175 |
35,595 | saltstack/salt | salt/modules/rallydev.py | update_item | def update_item(name, id_, field=None, value=None, postdata=None):
'''
Update an item. Either a field and a value, or a chunk of POST data, may be
used, but not both.
CLI Example:
.. code-block:: bash
salt myminion rallydev.update_<item name> <item id> field=<field> value=<value>
... | python | def update_item(name, id_, field=None, value=None, postdata=None):
'''
Update an item. Either a field and a value, or a chunk of POST data, may be
used, but not both.
CLI Example:
.. code-block:: bash
salt myminion rallydev.update_<item name> <item id> field=<field> value=<value>
... | [
"def",
"update_item",
"(",
"name",
",",
"id_",
",",
"field",
"=",
"None",
",",
"value",
"=",
"None",
",",
"postdata",
"=",
"None",
")",
":",
"if",
"field",
"and",
"value",
":",
"if",
"postdata",
":",
"raise",
"SaltInvocationError",
"(",
"'Either a field ... | Update an item. Either a field and a value, or a chunk of POST data, may be
used, but not both.
CLI Example:
.. code-block:: bash
salt myminion rallydev.update_<item name> <item id> field=<field> value=<value>
salt myminion rallydev.update_<item name> <item id> postdata=<post data> | [
"Update",
"an",
"item",
".",
"Either",
"a",
"field",
"and",
"a",
"value",
"or",
"a",
"chunk",
"of",
"POST",
"data",
"may",
"be",
"used",
"but",
"not",
"both",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rallydev.py#L178-L207 |
35,596 | saltstack/salt | salt/_compat.py | IPv6AddressScoped._is_packed_binary | def _is_packed_binary(self, data):
'''
Check if data is hexadecimal packed
:param data:
:return:
'''
packed = False
if isinstance(data, bytes) and len(data) == 16 and b':' not in data:
try:
packed = bool(int(binascii.hexlify(data), 16)... | python | def _is_packed_binary(self, data):
'''
Check if data is hexadecimal packed
:param data:
:return:
'''
packed = False
if isinstance(data, bytes) and len(data) == 16 and b':' not in data:
try:
packed = bool(int(binascii.hexlify(data), 16)... | [
"def",
"_is_packed_binary",
"(",
"self",
",",
"data",
")",
":",
"packed",
"=",
"False",
"if",
"isinstance",
"(",
"data",
",",
"bytes",
")",
"and",
"len",
"(",
"data",
")",
"==",
"16",
"and",
"b':'",
"not",
"in",
"data",
":",
"try",
":",
"packed",
"... | Check if data is hexadecimal packed
:param data:
:return: | [
"Check",
"if",
"data",
"is",
"hexadecimal",
"packed"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/_compat.py#L183-L197 |
35,597 | saltstack/salt | salt/modules/win_iis.py | _list_certs | def _list_certs(certificate_store='My'):
'''
List details of available certificates in the LocalMachine certificate
store.
Args:
certificate_store (str): The name of the certificate store on the local
machine.
Returns:
dict: A dictionary of certificates found in the sto... | python | def _list_certs(certificate_store='My'):
'''
List details of available certificates in the LocalMachine certificate
store.
Args:
certificate_store (str): The name of the certificate store on the local
machine.
Returns:
dict: A dictionary of certificates found in the sto... | [
"def",
"_list_certs",
"(",
"certificate_store",
"=",
"'My'",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"blacklist_keys",
"=",
"[",
"'DnsNameList'",
",",
"'Thumbprint'",
"]",
"ps_cmd",
"=",
"[",
"'Get-ChildItem'",
",",
"'-Path'",
",",
"r\"'Cert:\\LocalMachine\\{0}'... | List details of available certificates in the LocalMachine certificate
store.
Args:
certificate_store (str): The name of the certificate store on the local
machine.
Returns:
dict: A dictionary of certificates found in the store | [
"List",
"details",
"of",
"available",
"certificates",
"in",
"the",
"LocalMachine",
"certificate",
"store",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_iis.py#L76-L116 |
35,598 | saltstack/salt | salt/modules/win_iis.py | _srvmgr | def _srvmgr(cmd, return_json=False):
'''
Execute a powershell command from the WebAdministration PS module.
Args:
cmd (list): The command to execute in a list
return_json (bool): True formats the return in JSON, False just returns
the output of the command.
Returns:
... | python | def _srvmgr(cmd, return_json=False):
'''
Execute a powershell command from the WebAdministration PS module.
Args:
cmd (list): The command to execute in a list
return_json (bool): True formats the return in JSON, False just returns
the output of the command.
Returns:
... | [
"def",
"_srvmgr",
"(",
"cmd",
",",
"return_json",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"cmd",
",",
"list",
")",
":",
"cmd",
"=",
"' '",
".",
"join",
"(",
"cmd",
")",
"if",
"return_json",
":",
"cmd",
"=",
"'ConvertTo-Json -Compress -Depth 4 -I... | Execute a powershell command from the WebAdministration PS module.
Args:
cmd (list): The command to execute in a list
return_json (bool): True formats the return in JSON, False just returns
the output of the command.
Returns:
str: The output from the command | [
"Execute",
"a",
"powershell",
"command",
"from",
"the",
"WebAdministration",
"PS",
"module",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_iis.py#L135-L163 |
35,599 | saltstack/salt | salt/modules/win_iis.py | _collection_match_to_index | def _collection_match_to_index(pspath, colfilter, name, match):
'''
Returns index of collection item matching the match dictionary.
'''
collection = get_webconfiguration_settings(pspath, [{'name': name, 'filter': colfilter}])[0]['value']
for idx, collect_dict in enumerate(collection):
if all... | python | def _collection_match_to_index(pspath, colfilter, name, match):
'''
Returns index of collection item matching the match dictionary.
'''
collection = get_webconfiguration_settings(pspath, [{'name': name, 'filter': colfilter}])[0]['value']
for idx, collect_dict in enumerate(collection):
if all... | [
"def",
"_collection_match_to_index",
"(",
"pspath",
",",
"colfilter",
",",
"name",
",",
"match",
")",
":",
"collection",
"=",
"get_webconfiguration_settings",
"(",
"pspath",
",",
"[",
"{",
"'name'",
":",
"name",
",",
"'filter'",
":",
"colfilter",
"}",
"]",
"... | Returns index of collection item matching the match dictionary. | [
"Returns",
"index",
"of",
"collection",
"item",
"matching",
"the",
"match",
"dictionary",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_iis.py#L166-L174 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.