repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/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 | train |
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 | train |
saltstack/salt | salt/modules/selinux.py | _parse_protocol_port | def _parse_protocol_port(name, protocol, port):
'''
.. versionadded:: 2019.2.0
Validates and parses the protocol and port/port range from the name
if both protocol and port are not provided.
If the name is in a valid format, the protocol and port are ignored if provided
Examples: tcp/8080 or ... | python | def _parse_protocol_port(name, protocol, port):
'''
.. versionadded:: 2019.2.0
Validates and parses the protocol and port/port range from the name
if both protocol and port are not provided.
If the name is in a valid format, the protocol and port are ignored if provided
Examples: tcp/8080 or ... | [
"def",
"_parse_protocol_port",
"(",
"name",
",",
"protocol",
",",
"port",
")",
":",
"protocol_port_pattern",
"=",
"r'^(tcp|udp)\\/(([\\d]+)\\-?[\\d]+)$'",
"name_parts",
"=",
"re",
".",
"match",
"(",
"protocol_port_pattern",
",",
"name",
")",
"if",
"not",
"name_parts... | .. versionadded:: 2019.2.0
Validates and parses the protocol and port/port range from the name
if both protocol and port are not provided.
If the name is in a valid format, the protocol and port are ignored if provided
Examples: tcp/8080 or udp/20-21 | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L391-L410 | train |
saltstack/salt | salt/modules/selinux.py | _context_string_to_dict | def _context_string_to_dict(context):
'''
.. versionadded:: 2017.7.0
Converts an SELinux file context from string to dict.
'''
if not re.match('[^:]+:[^:]+:[^:]+:[^:]+$', context):
raise SaltInvocationError('Invalid SELinux context string: {0}. ' +
'Expecte... | python | def _context_string_to_dict(context):
'''
.. versionadded:: 2017.7.0
Converts an SELinux file context from string to dict.
'''
if not re.match('[^:]+:[^:]+:[^:]+:[^:]+$', context):
raise SaltInvocationError('Invalid SELinux context string: {0}. ' +
'Expecte... | [
"def",
"_context_string_to_dict",
"(",
"context",
")",
":",
"if",
"not",
"re",
".",
"match",
"(",
"'[^:]+:[^:]+:[^:]+:[^:]+$'",
",",
"context",
")",
":",
"raise",
"SaltInvocationError",
"(",
"'Invalid SELinux context string: {0}. '",
"+",
"'Expected \"sel_user:sel_role:se... | .. versionadded:: 2017.7.0
Converts an SELinux file context from string to dict. | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L422-L435 | train |
saltstack/salt | salt/modules/selinux.py | fcontext_get_policy | def fcontext_get_policy(name, filetype=None, sel_type=None, sel_user=None, sel_level=None):
'''
.. versionadded:: 2017.7.0
Returns the current entry in the SELinux policy list as a
dictionary. Returns None if no exact match was found.
Returned keys are:
* filespec (the name supplied and match... | python | def fcontext_get_policy(name, filetype=None, sel_type=None, sel_user=None, sel_level=None):
'''
.. versionadded:: 2017.7.0
Returns the current entry in the SELinux policy list as a
dictionary. Returns None if no exact match was found.
Returned keys are:
* filespec (the name supplied and match... | [
"def",
"fcontext_get_policy",
"(",
"name",
",",
"filetype",
"=",
"None",
",",
"sel_type",
"=",
"None",
",",
"sel_user",
"=",
"None",
",",
"sel_level",
"=",
"None",
")",
":",
"if",
"filetype",
":",
"_validate_filetype",
"(",
"filetype",
")",
"re_spacer",
"=... | .. versionadded:: 2017.7.0
Returns the current entry in the SELinux policy list as a
dictionary. Returns None if no exact match was found.
Returned keys are:
* filespec (the name supplied and matched)
* filetype (the descriptive name of the filetype supplied)
* sel_user, sel_role, sel_type, s... | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L450-L503 | train |
saltstack/salt | salt/modules/selinux.py | fcontext_add_policy | def fcontext_add_policy(name, filetype=None, sel_type=None, sel_user=None, sel_level=None):
'''
.. versionadded:: 2019.2.0
Adds the SELinux policy for a given filespec and other optional parameters.
Returns the result of the call to semanage.
Note that you don't have to remove an entry before set... | python | def fcontext_add_policy(name, filetype=None, sel_type=None, sel_user=None, sel_level=None):
'''
.. versionadded:: 2019.2.0
Adds the SELinux policy for a given filespec and other optional parameters.
Returns the result of the call to semanage.
Note that you don't have to remove an entry before set... | [
"def",
"fcontext_add_policy",
"(",
"name",
",",
"filetype",
"=",
"None",
",",
"sel_type",
"=",
"None",
",",
"sel_user",
"=",
"None",
",",
"sel_level",
"=",
"None",
")",
":",
"return",
"_fcontext_add_or_delete_policy",
"(",
"'add'",
",",
"name",
",",
"filetyp... | .. versionadded:: 2019.2.0
Adds the SELinux policy for a given filespec and other optional parameters.
Returns the result of the call to semanage.
Note that you don't have to remove an entry before setting a new
one for a given filespec and filetype, as adding one with semanage
automatically over... | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L506-L542 | train |
saltstack/salt | salt/modules/selinux.py | fcontext_delete_policy | def fcontext_delete_policy(name, filetype=None, sel_type=None, sel_user=None, sel_level=None):
'''
.. versionadded:: 2019.2.0
Deletes the SELinux policy for a given filespec and other optional parameters.
Returns the result of the call to semanage.
Note that you don't have to remove an entry befo... | python | def fcontext_delete_policy(name, filetype=None, sel_type=None, sel_user=None, sel_level=None):
'''
.. versionadded:: 2019.2.0
Deletes the SELinux policy for a given filespec and other optional parameters.
Returns the result of the call to semanage.
Note that you don't have to remove an entry befo... | [
"def",
"fcontext_delete_policy",
"(",
"name",
",",
"filetype",
"=",
"None",
",",
"sel_type",
"=",
"None",
",",
"sel_user",
"=",
"None",
",",
"sel_level",
"=",
"None",
")",
":",
"return",
"_fcontext_add_or_delete_policy",
"(",
"'delete'",
",",
"name",
",",
"f... | .. versionadded:: 2019.2.0
Deletes the SELinux policy for a given filespec and other optional parameters.
Returns the result of the call to semanage.
Note that you don't have to remove an entry before setting a new
one for a given filespec and filetype, as adding one with semanage
automatically o... | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L545-L581 | train |
saltstack/salt | salt/modules/selinux.py | fcontext_add_or_delete_policy | def fcontext_add_or_delete_policy(action, name, filetype=None, sel_type=None, sel_user=None, sel_level=None):
'''
.. versionadded:: 2017.7.0
Adds or deletes the SELinux policy for a given filespec and other optional parameters.
Returns the result of the call to semanage.
Note that you don't have ... | python | def fcontext_add_or_delete_policy(action, name, filetype=None, sel_type=None, sel_user=None, sel_level=None):
'''
.. versionadded:: 2017.7.0
Adds or deletes the SELinux policy for a given filespec and other optional parameters.
Returns the result of the call to semanage.
Note that you don't have ... | [
"def",
"fcontext_add_or_delete_policy",
"(",
"action",
",",
"name",
",",
"filetype",
"=",
"None",
",",
"sel_type",
"=",
"None",
",",
"sel_user",
"=",
"None",
",",
"sel_level",
"=",
"None",
")",
":",
"salt",
".",
"utils",
".",
"versions",
".",
"warn_until",... | .. versionadded:: 2017.7.0
Adds or deletes the SELinux policy for a given filespec and other optional parameters.
Returns the result of the call to semanage.
Note that you don't have to remove an entry before setting a new
one for a given filespec and filetype, as adding one with semanage
automat... | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L584-L637 | train |
saltstack/salt | salt/modules/selinux.py | _fcontext_add_or_delete_policy | def _fcontext_add_or_delete_policy(action, name, filetype=None, sel_type=None, sel_user=None, sel_level=None):
'''
.. versionadded:: 2019.2.0
Performs the action as called from ``fcontext_add_policy`` or ``fcontext_delete_policy``.
Returns the result of the call to semanage.
'''
if action not ... | python | def _fcontext_add_or_delete_policy(action, name, filetype=None, sel_type=None, sel_user=None, sel_level=None):
'''
.. versionadded:: 2019.2.0
Performs the action as called from ``fcontext_add_policy`` or ``fcontext_delete_policy``.
Returns the result of the call to semanage.
'''
if action not ... | [
"def",
"_fcontext_add_or_delete_policy",
"(",
"action",
",",
"name",
",",
"filetype",
"=",
"None",
",",
"sel_type",
"=",
"None",
",",
"sel_user",
"=",
"None",
",",
"sel_level",
"=",
"None",
")",
":",
"if",
"action",
"not",
"in",
"[",
"'add'",
",",
"'dele... | .. versionadded:: 2019.2.0
Performs the action as called from ``fcontext_add_policy`` or ``fcontext_delete_policy``.
Returns the result of the call to semanage. | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L640-L663 | train |
saltstack/salt | salt/modules/selinux.py | fcontext_policy_is_applied | def fcontext_policy_is_applied(name, recursive=False):
'''
.. versionadded:: 2017.7.0
Returns an empty string if the SELinux policy for a given filespec
is applied, returns string with differences in policy and actual
situation otherwise.
name
filespec of the file or directory. Regex s... | python | def fcontext_policy_is_applied(name, recursive=False):
'''
.. versionadded:: 2017.7.0
Returns an empty string if the SELinux policy for a given filespec
is applied, returns string with differences in policy and actual
situation otherwise.
name
filespec of the file or directory. Regex s... | [
"def",
"fcontext_policy_is_applied",
"(",
"name",
",",
"recursive",
"=",
"False",
")",
":",
"cmd",
"=",
"'restorecon -n -v '",
"if",
"recursive",
":",
"cmd",
"+=",
"'-R '",
"cmd",
"+=",
"re",
".",
"escape",
"(",
"name",
")",
"return",
"__salt__",
"[",
"'cm... | .. versionadded:: 2017.7.0
Returns an empty string if the SELinux policy for a given filespec
is applied, returns string with differences in policy and actual
situation otherwise.
name
filespec of the file or directory. Regex syntax is allowed.
CLI Example:
.. code-block:: bash
... | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L666-L687 | train |
saltstack/salt | salt/modules/selinux.py | fcontext_apply_policy | def fcontext_apply_policy(name, recursive=False):
'''
.. versionadded:: 2017.7.0
Applies SElinux policies to filespec using `restorecon [-R]
filespec`. Returns dict with changes if successful, the output of
the restorecon command otherwise.
name
filespec of the file or directory. Regex... | python | def fcontext_apply_policy(name, recursive=False):
'''
.. versionadded:: 2017.7.0
Applies SElinux policies to filespec using `restorecon [-R]
filespec`. Returns dict with changes if successful, the output of
the restorecon command otherwise.
name
filespec of the file or directory. Regex... | [
"def",
"fcontext_apply_policy",
"(",
"name",
",",
"recursive",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"}",
"changes_text",
"=",
"fcontext_policy_is_applied",
"(",
"name",
",",
"recursive",
")",
"cmd",
"=",
"'restorecon -v -F '",
"if",
"recursive",
":",
"cmd"... | .. versionadded:: 2017.7.0
Applies SElinux policies to filespec using `restorecon [-R]
filespec`. Returns dict with changes if successful, the output of
the restorecon command otherwise.
name
filespec of the file or directory. Regex syntax is allowed.
recursive
Recursively apply S... | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L690-L734 | train |
saltstack/salt | salt/modules/selinux.py | port_get_policy | def port_get_policy(name, sel_type=None, protocol=None, port=None):
'''
.. versionadded:: 2019.2.0
Returns the current entry in the SELinux policy list as a
dictionary. Returns None if no exact match was found.
Returned keys are:
* sel_type (the selinux type)
* proto (the protocol)
* ... | python | def port_get_policy(name, sel_type=None, protocol=None, port=None):
'''
.. versionadded:: 2019.2.0
Returns the current entry in the SELinux policy list as a
dictionary. Returns None if no exact match was found.
Returned keys are:
* sel_type (the selinux type)
* proto (the protocol)
* ... | [
"def",
"port_get_policy",
"(",
"name",
",",
"sel_type",
"=",
"None",
",",
"protocol",
"=",
"None",
",",
"port",
"=",
"None",
")",
":",
"(",
"protocol",
",",
"port",
")",
"=",
"_parse_protocol_port",
"(",
"name",
",",
"protocol",
",",
"port",
")",
"re_s... | .. versionadded:: 2019.2.0
Returns the current entry in the SELinux policy list as a
dictionary. Returns None if no exact match was found.
Returned keys are:
* sel_type (the selinux type)
* proto (the protocol)
* port (the port(s) and/or port range(s))
name
The protocol and port ... | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L737-L786 | train |
saltstack/salt | salt/modules/selinux.py | port_add_policy | def port_add_policy(name, sel_type=None, protocol=None, port=None, sel_range=None):
'''
.. versionadded:: 2019.2.0
Adds the SELinux policy for a given protocol and port.
Returns the result of the call to semanage.
name
The protocol and port spec. Can be formatted as ``(tcp|udp)/(port|port... | python | def port_add_policy(name, sel_type=None, protocol=None, port=None, sel_range=None):
'''
.. versionadded:: 2019.2.0
Adds the SELinux policy for a given protocol and port.
Returns the result of the call to semanage.
name
The protocol and port spec. Can be formatted as ``(tcp|udp)/(port|port... | [
"def",
"port_add_policy",
"(",
"name",
",",
"sel_type",
"=",
"None",
",",
"protocol",
"=",
"None",
",",
"port",
"=",
"None",
",",
"sel_range",
"=",
"None",
")",
":",
"return",
"_port_add_or_delete_policy",
"(",
"'add'",
",",
"name",
",",
"sel_type",
",",
... | .. versionadded:: 2019.2.0
Adds the SELinux policy for a given protocol and port.
Returns the result of the call to semanage.
name
The protocol and port spec. Can be formatted as ``(tcp|udp)/(port|port-range)``.
sel_type
The SELinux Type. Required.
protocol
The protocol ... | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L789-L819 | train |
saltstack/salt | salt/modules/selinux.py | _port_add_or_delete_policy | def _port_add_or_delete_policy(action, name, sel_type=None, protocol=None, port=None, sel_range=None):
'''
.. versionadded:: 2019.2.0
Performs the action as called from ``port_add_policy`` or ``port_delete_policy``.
Returns the result of the call to semanage.
'''
if action not in ['add', 'dele... | python | def _port_add_or_delete_policy(action, name, sel_type=None, protocol=None, port=None, sel_range=None):
'''
.. versionadded:: 2019.2.0
Performs the action as called from ``port_add_policy`` or ``port_delete_policy``.
Returns the result of the call to semanage.
'''
if action not in ['add', 'dele... | [
"def",
"_port_add_or_delete_policy",
"(",
"action",
",",
"name",
",",
"sel_type",
"=",
"None",
",",
"protocol",
"=",
"None",
",",
"port",
"=",
"None",
",",
"sel_range",
"=",
"None",
")",
":",
"if",
"action",
"not",
"in",
"[",
"'add'",
",",
"'delete'",
... | .. versionadded:: 2019.2.0
Performs the action as called from ``port_add_policy`` or ``port_delete_policy``.
Returns the result of the call to semanage. | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L849-L868 | train |
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 | train |
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 | train |
saltstack/salt | salt/returners/etcd_return.py | save_load | def save_load(jid, load, minions=None):
'''
Save the load to the specified jid
'''
log.debug('sdstack_etcd returner <save_load> called jid: %s', jid)
write_profile = __opts__.get('etcd.returner_write_profile')
client, path = _get_conn(__opts__, write_profile)
if write_profile:
ttl = ... | python | def save_load(jid, load, minions=None):
'''
Save the load to the specified jid
'''
log.debug('sdstack_etcd returner <save_load> called jid: %s', jid)
write_profile = __opts__.get('etcd.returner_write_profile')
client, path = _get_conn(__opts__, write_profile)
if write_profile:
ttl = ... | [
"def",
"save_load",
"(",
"jid",
",",
"load",
",",
"minions",
"=",
"None",
")",
":",
"log",
".",
"debug",
"(",
"'sdstack_etcd returner <save_load> called jid: %s'",
",",
"jid",
")",
"write_profile",
"=",
"__opts__",
".",
"get",
"(",
"'etcd.returner_write_profile'",... | Save the load to the specified jid | [
"Save",
"the",
"load",
"to",
"the",
"specified",
"jid"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/etcd_return.py#L137-L152 | train |
saltstack/salt | salt/returners/etcd_return.py | get_load | def get_load(jid):
'''
Return the load data that marks a specified jid
'''
log.debug('sdstack_etcd returner <get_load> called jid: %s', jid)
read_profile = __opts__.get('etcd.returner_read_profile')
client, path = _get_conn(__opts__, read_profile)
return salt.utils.json.loads(client.get('/'.... | python | def get_load(jid):
'''
Return the load data that marks a specified jid
'''
log.debug('sdstack_etcd returner <get_load> called jid: %s', jid)
read_profile = __opts__.get('etcd.returner_read_profile')
client, path = _get_conn(__opts__, read_profile)
return salt.utils.json.loads(client.get('/'.... | [
"def",
"get_load",
"(",
"jid",
")",
":",
"log",
".",
"debug",
"(",
"'sdstack_etcd returner <get_load> called jid: %s'",
",",
"jid",
")",
"read_profile",
"=",
"__opts__",
".",
"get",
"(",
"'etcd.returner_read_profile'",
")",
"client",
",",
"path",
"=",
"_get_conn",... | Return the load data that marks a specified jid | [
"Return",
"the",
"load",
"data",
"that",
"marks",
"a",
"specified",
"jid"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/etcd_return.py#L169-L176 | train |
saltstack/salt | salt/returners/etcd_return.py | get_jid | def get_jid(jid):
'''
Return the information returned when the specified job id was executed
'''
log.debug('sdstack_etcd returner <get_jid> called jid: %s', jid)
ret = {}
client, path = _get_conn(__opts__)
items = client.get('/'.join((path, 'jobs', jid)))
for item in items.children:
... | python | def get_jid(jid):
'''
Return the information returned when the specified job id was executed
'''
log.debug('sdstack_etcd returner <get_jid> called jid: %s', jid)
ret = {}
client, path = _get_conn(__opts__)
items = client.get('/'.join((path, 'jobs', jid)))
for item in items.children:
... | [
"def",
"get_jid",
"(",
"jid",
")",
":",
"log",
".",
"debug",
"(",
"'sdstack_etcd returner <get_jid> called jid: %s'",
",",
"jid",
")",
"ret",
"=",
"{",
"}",
"client",
",",
"path",
"=",
"_get_conn",
"(",
"__opts__",
")",
"items",
"=",
"client",
".",
"get",
... | Return the information returned when the specified job id was executed | [
"Return",
"the",
"information",
"returned",
"when",
"the",
"specified",
"job",
"id",
"was",
"executed"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/etcd_return.py#L179-L193 | train |
saltstack/salt | salt/returners/etcd_return.py | get_fun | def get_fun(fun):
'''
Return a dict of the last function called for all minions
'''
log.debug('sdstack_etcd returner <get_fun> called fun: %s', fun)
ret = {}
client, path = _get_conn(__opts__)
items = client.get('/'.join((path, 'minions')))
for item in items.children:
comps = str... | python | def get_fun(fun):
'''
Return a dict of the last function called for all minions
'''
log.debug('sdstack_etcd returner <get_fun> called fun: %s', fun)
ret = {}
client, path = _get_conn(__opts__)
items = client.get('/'.join((path, 'minions')))
for item in items.children:
comps = str... | [
"def",
"get_fun",
"(",
"fun",
")",
":",
"log",
".",
"debug",
"(",
"'sdstack_etcd returner <get_fun> called fun: %s'",
",",
"fun",
")",
"ret",
"=",
"{",
"}",
"client",
",",
"path",
"=",
"_get_conn",
"(",
"__opts__",
")",
"items",
"=",
"client",
".",
"get",
... | Return a dict of the last function called for all minions | [
"Return",
"a",
"dict",
"of",
"the",
"last",
"function",
"called",
"for",
"all",
"minions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/etcd_return.py#L196-L209 | train |
saltstack/salt | salt/returners/etcd_return.py | get_jids | def get_jids():
'''
Return a list of all job ids
'''
log.debug('sdstack_etcd returner <get_jids> called')
ret = []
client, path = _get_conn(__opts__)
items = client.get('/'.join((path, 'jobs')))
for item in items.children:
if item.dir is True:
jid = str(item.key).spli... | python | def get_jids():
'''
Return a list of all job ids
'''
log.debug('sdstack_etcd returner <get_jids> called')
ret = []
client, path = _get_conn(__opts__)
items = client.get('/'.join((path, 'jobs')))
for item in items.children:
if item.dir is True:
jid = str(item.key).spli... | [
"def",
"get_jids",
"(",
")",
":",
"log",
".",
"debug",
"(",
"'sdstack_etcd returner <get_jids> called'",
")",
"ret",
"=",
"[",
"]",
"client",
",",
"path",
"=",
"_get_conn",
"(",
"__opts__",
")",
"items",
"=",
"client",
".",
"get",
"(",
"'/'",
".",
"join"... | Return a list of all job ids | [
"Return",
"a",
"list",
"of",
"all",
"job",
"ids"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/etcd_return.py#L212-L224 | train |
saltstack/salt | salt/returners/etcd_return.py | get_minions | def get_minions():
'''
Return a list of minions
'''
log.debug('sdstack_etcd returner <get_minions> called')
ret = []
client, path = _get_conn(__opts__)
items = client.get('/'.join((path, 'minions')))
for item in items.children:
comps = str(item.key).split('/')
ret.append(... | python | def get_minions():
'''
Return a list of minions
'''
log.debug('sdstack_etcd returner <get_minions> called')
ret = []
client, path = _get_conn(__opts__)
items = client.get('/'.join((path, 'minions')))
for item in items.children:
comps = str(item.key).split('/')
ret.append(... | [
"def",
"get_minions",
"(",
")",
":",
"log",
".",
"debug",
"(",
"'sdstack_etcd returner <get_minions> called'",
")",
"ret",
"=",
"[",
"]",
"client",
",",
"path",
"=",
"_get_conn",
"(",
"__opts__",
")",
"items",
"=",
"client",
".",
"get",
"(",
"'/'",
".",
... | Return a list of minions | [
"Return",
"a",
"list",
"of",
"minions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/etcd_return.py#L227-L238 | train |
saltstack/salt | salt/states/linux_acl.py | present | def present(name, acl_type, acl_name='', perms='', recurse=False, force=False):
'''
Ensure a Linux ACL is present
name
The acl path
acl_type
The type of the acl is used for it can be 'user' or 'group'
acl_name
The user or group
perms
Set the permissions eg.: ... | python | def present(name, acl_type, acl_name='', perms='', recurse=False, force=False):
'''
Ensure a Linux ACL is present
name
The acl path
acl_type
The type of the acl is used for it can be 'user' or 'group'
acl_name
The user or group
perms
Set the permissions eg.: ... | [
"def",
"present",
"(",
"name",
",",
"acl_type",
",",
"acl_name",
"=",
"''",
",",
"perms",
"=",
"''",
",",
"recurse",
"=",
"False",
",",
"force",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'... | Ensure a Linux ACL is present
name
The acl path
acl_type
The type of the acl is used for it can be 'user' or 'group'
acl_name
The user or group
perms
Set the permissions eg.: rwx
recurse
Set the permissions recursive in the path
force
Wipe o... | [
"Ensure",
"a",
"Linux",
"ACL",
"is",
"present"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/linux_acl.py#L82-L219 | train |
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 | train |
saltstack/salt | salt/states/linux_acl.py | list_present | def list_present(name, acl_type, acl_names=None, perms='', recurse=False, force=False):
'''
Ensure a Linux ACL list is present
Takes a list of acl names and add them to the given path
name
The acl path
acl_type
The type of the acl is used for it can be 'user' or 'group'
acl_n... | python | def list_present(name, acl_type, acl_names=None, perms='', recurse=False, force=False):
'''
Ensure a Linux ACL list is present
Takes a list of acl names and add them to the given path
name
The acl path
acl_type
The type of the acl is used for it can be 'user' or 'group'
acl_n... | [
"def",
"list_present",
"(",
"name",
",",
"acl_type",
",",
"acl_names",
"=",
"None",
",",
"perms",
"=",
"''",
",",
"recurse",
"=",
"False",
",",
"force",
"=",
"False",
")",
":",
"if",
"acl_names",
"is",
"None",
":",
"acl_names",
"=",
"[",
"]",
"ret",
... | Ensure a Linux ACL list is present
Takes a list of acl names and add them to 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
Set the permissions eg.: rwx
recurs... | [
"Ensure",
"a",
"Linux",
"ACL",
"list",
"is",
"present"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/linux_acl.py#L310-L499 | train |
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 | train |
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 | train |
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 | train |
saltstack/salt | salt/states/boto_cognitoidentity.py | pool_present | def pool_present(name,
IdentityPoolName,
AuthenticatedRole,
AllowUnauthenticatedIdentities=False,
UnauthenticatedRole=None,
SupportedLoginProviders=None,
DeveloperProviderName=None,
OpenIdConnectProvid... | python | def pool_present(name,
IdentityPoolName,
AuthenticatedRole,
AllowUnauthenticatedIdentities=False,
UnauthenticatedRole=None,
SupportedLoginProviders=None,
DeveloperProviderName=None,
OpenIdConnectProvid... | [
"def",
"pool_present",
"(",
"name",
",",
"IdentityPoolName",
",",
"AuthenticatedRole",
",",
"AllowUnauthenticatedIdentities",
"=",
"False",
",",
"UnauthenticatedRole",
"=",
"None",
",",
"SupportedLoginProviders",
"=",
"None",
",",
"DeveloperProviderName",
"=",
"None",
... | Ensure Cognito Identity Pool exists.
name
The name of the state definition
IdentityPoolName
Name of the Cognito Identity Pool
AuthenticatedRole
An IAM role name or ARN that will be associated with temporary AWS
credentials for an authenticated cognito identity.
AllowU... | [
"Ensure",
"Cognito",
"Identity",
"Pool",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_cognitoidentity.py#L134-L279 | train |
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 | train |
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 | train |
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 | train |
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 | train |
saltstack/salt | salt/utils/minion.py | _read_proc_file | def _read_proc_file(path, opts):
'''
Return a dict of JID metadata, or None
'''
serial = salt.payload.Serial(opts)
current_thread = threading.currentThread().name
pid = os.getpid()
with salt.utils.files.fopen(path, 'rb') as fp_:
buf = fp_.read()
fp_.close()
if buf:
... | python | def _read_proc_file(path, opts):
'''
Return a dict of JID metadata, or None
'''
serial = salt.payload.Serial(opts)
current_thread = threading.currentThread().name
pid = os.getpid()
with salt.utils.files.fopen(path, 'rb') as fp_:
buf = fp_.read()
fp_.close()
if buf:
... | [
"def",
"_read_proc_file",
"(",
"path",
",",
"opts",
")",
":",
"serial",
"=",
"salt",
".",
"payload",
".",
"Serial",
"(",
"opts",
")",
"current_thread",
"=",
"threading",
".",
"currentThread",
"(",
")",
".",
"name",
"pid",
"=",
"os",
".",
"getpid",
"(",... | Return a dict of JID metadata, or None | [
"Return",
"a",
"dict",
"of",
"JID",
"metadata",
"or",
"None"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minion.py#L62-L122 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
saltstack/salt | salt/states/at.py | present | def present(name, timespec, tag=None, user=None, job=None, unique_tag=False):
'''
.. versionchanged:: 2017.7.0
Add a job to queue.
job : string
Command to run.
timespec : string
The 'timespec' follows the format documented in the at(1) manpage.
tag : string
Make a tag... | python | def present(name, timespec, tag=None, user=None, job=None, unique_tag=False):
'''
.. versionchanged:: 2017.7.0
Add a job to queue.
job : string
Command to run.
timespec : string
The 'timespec' follows the format documented in the at(1) manpage.
tag : string
Make a tag... | [
"def",
"present",
"(",
"name",
",",
"timespec",
",",
"tag",
"=",
"None",
",",
"user",
"=",
"None",
",",
"job",
"=",
"None",
",",
"unique_tag",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
... | .. versionchanged:: 2017.7.0
Add a job to queue.
job : string
Command to run.
timespec : string
The 'timespec' follows the format documented in the at(1) manpage.
tag : string
Make a tag for the job.
user : string
The user to run the at job
.. versionadde... | [
"..",
"versionchanged",
"::",
"2017",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/at.py#L26-L125 | train |
saltstack/salt | salt/states/at.py | absent | def absent(name, jobid=None, **kwargs):
'''
.. versionchanged:: 2017.7.0
Remove a job from queue
jobid: string|int
Specific jobid to remove
tag : string
Job's tag
runas : string
Runs user-specified jobs
kwargs
Addition kwargs can be provided to filter job... | python | def absent(name, jobid=None, **kwargs):
'''
.. versionchanged:: 2017.7.0
Remove a job from queue
jobid: string|int
Specific jobid to remove
tag : string
Job's tag
runas : string
Runs user-specified jobs
kwargs
Addition kwargs can be provided to filter job... | [
"def",
"absent",
"(",
"name",
",",
"jobid",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"# limit was never ... | .. versionchanged:: 2017.7.0
Remove a job from queue
jobid: string|int
Specific jobid to remove
tag : string
Job's tag
runas : string
Runs user-specified jobs
kwargs
Addition kwargs can be provided to filter jobs.
See output of `at.jobcheck` for more.
... | [
"..",
"versionchanged",
"::",
"2017",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/at.py#L128-L245 | train |
saltstack/salt | salt/states/at.py | watch | def watch(name, timespec, tag=None, user=None, job=None, unique_tag=False):
'''
.. versionadded:: 2017.7.0
Add an at job if trigger by watch
job : string
Command to run.
timespec : string
The 'timespec' follows the format documented in the at(1) manpage.
tag : string
... | python | def watch(name, timespec, tag=None, user=None, job=None, unique_tag=False):
'''
.. versionadded:: 2017.7.0
Add an at job if trigger by watch
job : string
Command to run.
timespec : string
The 'timespec' follows the format documented in the at(1) manpage.
tag : string
... | [
"def",
"watch",
"(",
"name",
",",
"timespec",
",",
"tag",
"=",
"None",
",",
"user",
"=",
"None",
",",
"job",
"=",
"None",
",",
"unique_tag",
"=",
"False",
")",
":",
"return",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'res... | .. versionadded:: 2017.7.0
Add an at job if trigger by watch
job : string
Command to run.
timespec : string
The 'timespec' follows the format documented in the at(1) manpage.
tag : string
Make a tag for the job.
user : string
The user to run the at job
..... | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/at.py#L248-L288 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
saltstack/salt | salt/modules/parallels.py | start | def start(name, runas=None):
'''
Start a VM
:param str name:
Name/ID of VM to start
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.start macvm runas=macdev
'''
return prlctl('start', salt.uti... | python | def start(name, runas=None):
'''
Start a VM
:param str name:
Name/ID of VM to start
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.start macvm runas=macdev
'''
return prlctl('start', salt.uti... | [
"def",
"start",
"(",
"name",
",",
"runas",
"=",
"None",
")",
":",
"return",
"prlctl",
"(",
"'start'",
",",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"name",
")",
",",
"runas",
"=",
"runas",
")"
] | Start a VM
:param str name:
Name/ID of VM to start
:param str runas:
The user that the prlctl command will be run as
Example:
.. code-block:: bash
salt '*' parallels.start macvm runas=macdev | [
"Start",
"a",
"VM"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parallels.py#L290-L306 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
saltstack/salt | salt/states/junos.py | get_table | def get_table(name, table, table_file, **kwargs):
'''
Retrieve data from a Junos device using Tables/Views
name (required)
task definition
table (required)
Name of PyEZ Table
file
YAML file that has the table specified in table parameter
path:
Path of location... | python | def get_table(name, table, table_file, **kwargs):
'''
Retrieve data from a Junos device using Tables/Views
name (required)
task definition
table (required)
Name of PyEZ Table
file
YAML file that has the table specified in table parameter
path:
Path of location... | [
"def",
"get_table",
"(",
"name",
",",
"table",
",",
"table_file",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"ret",
"... | Retrieve data from a Junos device using Tables/Views
name (required)
task definition
table (required)
Name of PyEZ Table
file
YAML file that has the table specified in table parameter
path:
Path of location of the YAML file.
defaults to op directory in jnpr.ju... | [
"Retrieve",
"data",
"from",
"a",
"Junos",
"device",
"using",
"Tables",
"/",
"Views"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/junos.py#L540-L581 | train |
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 | train |
saltstack/salt | salt/modules/extfs.py | tune | def tune(device, **kwargs):
'''
Set attributes for the specified device (using tune2fs)
CLI Example:
.. code-block:: bash
salt '*' extfs.tune /dev/sda1 force=True label=wildstallyns opts='acl,noexec'
Valid options are:
* **max**: max mount count
* **count**: mount count
* **... | python | def tune(device, **kwargs):
'''
Set attributes for the specified device (using tune2fs)
CLI Example:
.. code-block:: bash
salt '*' extfs.tune /dev/sda1 force=True label=wildstallyns opts='acl,noexec'
Valid options are:
* **max**: max mount count
* **count**: mount count
* **... | [
"def",
"tune",
"(",
"device",
",",
"*",
"*",
"kwargs",
")",
":",
"kwarg_map",
"=",
"{",
"'max'",
":",
"'c'",
",",
"'count'",
":",
"'C'",
",",
"'error'",
":",
"'e'",
",",
"'extended_opts'",
":",
"'E'",
",",
"'force'",
":",
"'f'",
",",
"'group'",
":"... | Set attributes for the specified device (using tune2fs)
CLI Example:
.. code-block:: bash
salt '*' extfs.tune /dev/sda1 force=True label=wildstallyns opts='acl,noexec'
Valid options are:
* **max**: max mount count
* **count**: mount count
* **error**: error behavior
* **extended... | [
"Set",
"attributes",
"for",
"the",
"specified",
"device",
"(",
"using",
"tune2fs",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/extfs.py#L126-L191 | train |
saltstack/salt | salt/modules/extfs.py | dump | def dump(device, args=None):
'''
Return all contents of dumpe2fs for a specified device
CLI Example:
.. code-block:: bash
salt '*' extfs.dump /dev/sda1
'''
cmd = 'dumpe2fs {0}'.format(device)
if args:
cmd = cmd + ' -' + args
ret = {'attributes': {}, 'blocks': {}}
o... | python | def dump(device, args=None):
'''
Return all contents of dumpe2fs for a specified device
CLI Example:
.. code-block:: bash
salt '*' extfs.dump /dev/sda1
'''
cmd = 'dumpe2fs {0}'.format(device)
if args:
cmd = cmd + ' -' + args
ret = {'attributes': {}, 'blocks': {}}
o... | [
"def",
"dump",
"(",
"device",
",",
"args",
"=",
"None",
")",
":",
"cmd",
"=",
"'dumpe2fs {0}'",
".",
"format",
"(",
"device",
")",
"if",
"args",
":",
"cmd",
"=",
"cmd",
"+",
"' -'",
"+",
"args",
"ret",
"=",
"{",
"'attributes'",
":",
"{",
"}",
","... | Return all contents of dumpe2fs for a specified device
CLI Example:
.. code-block:: bash
salt '*' extfs.dump /dev/sda1 | [
"Return",
"all",
"contents",
"of",
"dumpe2fs",
"for",
"a",
"specified",
"device"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/extfs.py#L222-L285 | train |
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 | train |
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 | train |
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 | train |
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 | train |
saltstack/salt | salt/utils/verify.py | verify_env | def verify_env(
dirs,
user,
permissive=False,
pki_dir='',
skip_extra=False,
root_dir=ROOT_DIR):
'''
Verify that the named directories are in place and that the environment
can shake the salt
'''
if salt.utils.platform.is_windows():
return win_v... | python | def verify_env(
dirs,
user,
permissive=False,
pki_dir='',
skip_extra=False,
root_dir=ROOT_DIR):
'''
Verify that the named directories are in place and that the environment
can shake the salt
'''
if salt.utils.platform.is_windows():
return win_v... | [
"def",
"verify_env",
"(",
"dirs",
",",
"user",
",",
"permissive",
"=",
"False",
",",
"pki_dir",
"=",
"''",
",",
"skip_extra",
"=",
"False",
",",
"root_dir",
"=",
"ROOT_DIR",
")",
":",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",... | Verify that the named directories are in place and that the environment
can shake the salt | [
"Verify",
"that",
"the",
"named",
"directories",
"are",
"in",
"place",
"and",
"that",
"the",
"environment",
"can",
"shake",
"the",
"salt"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/verify.py#L200-L307 | train |
saltstack/salt | salt/utils/verify.py | check_user | def check_user(user):
'''
Check user and assign process uid/gid.
'''
if salt.utils.platform.is_windows():
return True
if user == salt.utils.user.get_user():
return True
import pwd # after confirming not running Windows
try:
pwuser = pwd.getpwnam(user)
try:
... | python | def check_user(user):
'''
Check user and assign process uid/gid.
'''
if salt.utils.platform.is_windows():
return True
if user == salt.utils.user.get_user():
return True
import pwd # after confirming not running Windows
try:
pwuser = pwd.getpwnam(user)
try:
... | [
"def",
"check_user",
"(",
"user",
")",
":",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"return",
"True",
"if",
"user",
"==",
"salt",
".",
"utils",
".",
"user",
".",
"get_user",
"(",
")",
":",
"return",
"True",
"i... | Check user and assign process uid/gid. | [
"Check",
"user",
"and",
"assign",
"process",
"uid",
"/",
"gid",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/verify.py#L310-L356 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
saltstack/salt | salt/utils/verify.py | win_verify_env | def win_verify_env(
path,
dirs,
permissive=False,
pki_dir='',
skip_extra=False):
'''
Verify that the named directories are in place and that the environment
can shake the salt
'''
import salt.utils.win_functions
import salt.utils.win_dacl
import salt.u... | python | def win_verify_env(
path,
dirs,
permissive=False,
pki_dir='',
skip_extra=False):
'''
Verify that the named directories are in place and that the environment
can shake the salt
'''
import salt.utils.win_functions
import salt.utils.win_dacl
import salt.u... | [
"def",
"win_verify_env",
"(",
"path",
",",
"dirs",
",",
"permissive",
"=",
"False",
",",
"pki_dir",
"=",
"''",
",",
"skip_extra",
"=",
"False",
")",
":",
"import",
"salt",
".",
"utils",
".",
"win_functions",
"import",
"salt",
".",
"utils",
".",
"win_dacl... | Verify that the named directories are in place and that the environment
can shake the salt | [
"Verify",
"that",
"the",
"named",
"directories",
"are",
"in",
"place",
"and",
"that",
"the",
"environment",
"can",
"shake",
"the",
"salt"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/verify.py#L538-L658 | train |
saltstack/salt | salt/modules/pacmanpkg.py | list_upgrades | def list_upgrades(refresh=False, root=None, **kwargs): # pylint: disable=W0613
'''
List all available package upgrades on this system
CLI Example:
.. code-block:: bash
salt '*' pkg.list_upgrades
'''
upgrades = {}
cmd = ['pacman', '-S', '-p', '-u', '--print-format', '%n %v']
... | python | def list_upgrades(refresh=False, root=None, **kwargs): # pylint: disable=W0613
'''
List all available package upgrades on this system
CLI Example:
.. code-block:: bash
salt '*' pkg.list_upgrades
'''
upgrades = {}
cmd = ['pacman', '-S', '-p', '-u', '--print-format', '%n %v']
... | [
"def",
"list_upgrades",
"(",
"refresh",
"=",
"False",
",",
"root",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=W0613",
"upgrades",
"=",
"{",
"}",
"cmd",
"=",
"[",
"'pacman'",
",",
"'-S'",
",",
"'-p'",
",",
"'-u'",
",",
"'--print-... | List all available package upgrades on this system
CLI Example:
.. code-block:: bash
salt '*' pkg.list_upgrades | [
"List",
"all",
"available",
"package",
"upgrades",
"on",
"this",
"system"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pacmanpkg.py#L127-L174 | train |
saltstack/salt | salt/modules/pacmanpkg.py | list_pkgs | def list_pkgs(versions_as_list=False, **kwargs):
'''
List the packages currently installed as a dict::
{'<package_name>': '<version>'}
CLI Example:
.. code-block:: bash
salt '*' pkg.list_pkgs
'''
versions_as_list = salt.utils.data.is_true(versions_as_list)
# not yet imple... | python | def list_pkgs(versions_as_list=False, **kwargs):
'''
List the packages currently installed as a dict::
{'<package_name>': '<version>'}
CLI Example:
.. code-block:: bash
salt '*' pkg.list_pkgs
'''
versions_as_list = salt.utils.data.is_true(versions_as_list)
# not yet imple... | [
"def",
"list_pkgs",
"(",
"versions_as_list",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"versions_as_list",
"=",
"salt",
".",
"utils",
".",
"data",
".",
"is_true",
"(",
"versions_as_list",
")",
"# not yet implemented or not applicable",
"if",
"any",
"(",
... | List the packages currently installed as a dict::
{'<package_name>': '<version>'}
CLI Example:
.. code-block:: bash
salt '*' pkg.list_pkgs | [
"List",
"the",
"packages",
"currently",
"installed",
"as",
"a",
"dict",
"::"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pacmanpkg.py#L193-L241 | train |
saltstack/salt | salt/modules/pacmanpkg.py | group_list | def group_list():
'''
.. versionadded:: 2016.11.0
Lists all groups known by pacman on this system
CLI Example:
.. code-block:: bash
salt '*' pkg.group_list
'''
ret = {'installed': [],
'partially_installed': [],
'available': []}
# find out what's available
... | python | def group_list():
'''
.. versionadded:: 2016.11.0
Lists all groups known by pacman on this system
CLI Example:
.. code-block:: bash
salt '*' pkg.group_list
'''
ret = {'installed': [],
'partially_installed': [],
'available': []}
# find out what's available
... | [
"def",
"group_list",
"(",
")",
":",
"ret",
"=",
"{",
"'installed'",
":",
"[",
"]",
",",
"'partially_installed'",
":",
"[",
"]",
",",
"'available'",
":",
"[",
"]",
"}",
"# find out what's available",
"cmd",
"=",
"[",
"'pacman'",
",",
"'-Sgg'",
"]",
"out",... | .. versionadded:: 2016.11.0
Lists all groups known by pacman on this system
CLI Example:
.. code-block:: bash
salt '*' pkg.group_list | [
"..",
"versionadded",
"::",
"2016",
".",
"11",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pacmanpkg.py#L244-L318 | train |
saltstack/salt | salt/modules/pacmanpkg.py | group_info | def group_info(name):
'''
.. versionadded:: 2016.11.0
Lists all packages in the specified group
CLI Example:
.. code-block:: bash
salt '*' pkg.group_info 'xorg'
'''
pkgtypes = ('mandatory', 'optional', 'default', 'conditional')
ret = {}
for pkgtype in pkgtypes:
r... | python | def group_info(name):
'''
.. versionadded:: 2016.11.0
Lists all packages in the specified group
CLI Example:
.. code-block:: bash
salt '*' pkg.group_info 'xorg'
'''
pkgtypes = ('mandatory', 'optional', 'default', 'conditional')
ret = {}
for pkgtype in pkgtypes:
r... | [
"def",
"group_info",
"(",
"name",
")",
":",
"pkgtypes",
"=",
"(",
"'mandatory'",
",",
"'optional'",
",",
"'default'",
",",
"'conditional'",
")",
"ret",
"=",
"{",
"}",
"for",
"pkgtype",
"in",
"pkgtypes",
":",
"ret",
"[",
"pkgtype",
"]",
"=",
"set",
"(",... | .. versionadded:: 2016.11.0
Lists all packages in the specified group
CLI Example:
.. code-block:: bash
salt '*' pkg.group_info 'xorg' | [
"..",
"versionadded",
"::",
"2016",
".",
"11",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pacmanpkg.py#L321-L356 | train |
saltstack/salt | salt/modules/pacmanpkg.py | group_diff | def group_diff(name):
'''
.. versionadded:: 2016.11.0
Lists which of a group's packages are installed and which are not
installed
Compatible with yumpkg.group_diff for easy support of state.pkg.group_installed
CLI Example:
.. code-block:: bash
salt '*' pkg.group_diff 'xorg'
... | python | def group_diff(name):
'''
.. versionadded:: 2016.11.0
Lists which of a group's packages are installed and which are not
installed
Compatible with yumpkg.group_diff for easy support of state.pkg.group_installed
CLI Example:
.. code-block:: bash
salt '*' pkg.group_diff 'xorg'
... | [
"def",
"group_diff",
"(",
"name",
")",
":",
"# Use a compatible structure with yum, so we can leverage the existing state.group_installed",
"# In pacmanworld, everything is the default, but nothing is mandatory",
"pkgtypes",
"=",
"(",
"'mandatory'",
",",
"'optional'",
",",
"'default'",... | .. versionadded:: 2016.11.0
Lists which of a group's packages are installed and which are not
installed
Compatible with yumpkg.group_diff for easy support of state.pkg.group_installed
CLI Example:
.. code-block:: bash
salt '*' pkg.group_diff 'xorg' | [
"..",
"versionadded",
"::",
"2016",
".",
"11",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pacmanpkg.py#L359-L393 | train |
saltstack/salt | salt/modules/pacmanpkg.py | refresh_db | def refresh_db(root=None, **kwargs):
'''
Just run a ``pacman -Sy``, return a dict::
{'<database name>': Bool}
CLI Example:
.. code-block:: bash
salt '*' pkg.refresh_db
'''
# Remove rtag file to keep multiple refreshes from happening in pkg states
salt.utils.pkg.clear_rtag... | python | def refresh_db(root=None, **kwargs):
'''
Just run a ``pacman -Sy``, return a dict::
{'<database name>': Bool}
CLI Example:
.. code-block:: bash
salt '*' pkg.refresh_db
'''
# Remove rtag file to keep multiple refreshes from happening in pkg states
salt.utils.pkg.clear_rtag... | [
"def",
"refresh_db",
"(",
"root",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# Remove rtag file to keep multiple refreshes from happening in pkg states",
"salt",
".",
"utils",
".",
"pkg",
".",
"clear_rtag",
"(",
"__opts__",
")",
"cmd",
"=",
"[",
"'pacman'",
... | Just run a ``pacman -Sy``, return a dict::
{'<database name>': Bool}
CLI Example:
.. code-block:: bash
salt '*' pkg.refresh_db | [
"Just",
"run",
"a",
"pacman",
"-",
"Sy",
"return",
"a",
"dict",
"::"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pacmanpkg.py#L396-L441 | train |
saltstack/salt | salt/modules/pacmanpkg.py | install | def install(name=None,
refresh=False,
sysupgrade=None,
pkgs=None,
sources=None,
**kwargs):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which mod... | python | def install(name=None,
refresh=False,
sysupgrade=None,
pkgs=None,
sources=None,
**kwargs):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which mod... | [
"def",
"install",
"(",
"name",
"=",
"None",
",",
"refresh",
"=",
"False",
",",
"sysupgrade",
"=",
"None",
",",
"pkgs",
"=",
"None",
",",
"sources",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"pkg_params",
",",
"pkg_type",
"=",
"__s... | .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's control group. This is done to keep systemd
from killing any pacman commands spawned by Sa... | [
"..",
"versionchanged",
"::",
"2015",
".",
"8",
".",
"12",
"2016",
".",
"3",
".",
"3",
"2016",
".",
"11",
".",
"0",
"On",
"minions",
"running",
"systemd",
">",
"=",
"205",
"systemd",
"-",
"run",
"(",
"1",
")",
"_",
"is",
"now",
"used",
"to",
"i... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pacmanpkg.py#L444-L635 | train |
saltstack/salt | salt/modules/pacmanpkg.py | upgrade | def upgrade(refresh=False, root=None, **kwargs):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's control group. This is done to keep s... | python | def upgrade(refresh=False, root=None, **kwargs):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's control group. This is done to keep s... | [
"def",
"upgrade",
"(",
"refresh",
"=",
"False",
",",
"root",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"old",
"=",
"list_pkgs",
"("... | .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's control group. This is done to keep systemd
from killing any pacman commands spawned by Sa... | [
"..",
"versionchanged",
"::",
"2015",
".",
"8",
".",
"12",
"2016",
".",
"3",
".",
"3",
"2016",
".",
"11",
".",
"0",
"On",
"minions",
"running",
"systemd",
">",
"=",
"205",
"systemd",
"-",
"run",
"(",
"1",
")",
"_",
"is",
"now",
"used",
"to",
"i... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pacmanpkg.py#L638-L703 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.