partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | get_policy | Return the current policy for the specified table/chain
CLI Example:
.. code-block:: bash
salt '*' iptables.get_policy filter INPUT
IPv6:
salt '*' iptables.get_policy filter INPUT family=ipv6 | salt/modules/iptables.py | def get_policy(table='filter', chain=None, family='ipv4'):
'''
Return the current policy for the specified table/chain
CLI Example:
.. code-block:: bash
salt '*' iptables.get_policy filter INPUT
IPv6:
salt '*' iptables.get_policy filter INPUT family=ipv6
'''
if not ch... | def get_policy(table='filter', chain=None, family='ipv4'):
'''
Return the current policy for the specified table/chain
CLI Example:
.. code-block:: bash
salt '*' iptables.get_policy filter INPUT
IPv6:
salt '*' iptables.get_policy filter INPUT family=ipv6
'''
if not ch... | [
"Return",
"the",
"current",
"policy",
"for",
"the",
"specified",
"table",
"/",
"chain"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L609-L629 | [
"def",
"get_policy",
"(",
"table",
"=",
"'filter'",
",",
"chain",
"=",
"None",
",",
"family",
"=",
"'ipv4'",
")",
":",
"if",
"not",
"chain",
":",
"return",
"'Error: Chain needs to be specified'",
"rules",
"=",
"_parse_conf",
"(",
"in_mem",
"=",
"True",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_policy | Set the current policy for the specified table/chain
CLI Example:
.. code-block:: bash
salt '*' iptables.set_policy filter INPUT ACCEPT
IPv6:
salt '*' iptables.set_policy filter INPUT ACCEPT family=ipv6 | salt/modules/iptables.py | def set_policy(table='filter', chain=None, policy=None, family='ipv4'):
'''
Set the current policy for the specified table/chain
CLI Example:
.. code-block:: bash
salt '*' iptables.set_policy filter INPUT ACCEPT
IPv6:
salt '*' iptables.set_policy filter INPUT ACCEPT family=ip... | def set_policy(table='filter', chain=None, policy=None, family='ipv4'):
'''
Set the current policy for the specified table/chain
CLI Example:
.. code-block:: bash
salt '*' iptables.set_policy filter INPUT ACCEPT
IPv6:
salt '*' iptables.set_policy filter INPUT ACCEPT family=ip... | [
"Set",
"the",
"current",
"policy",
"for",
"the",
"specified",
"table",
"/",
"chain"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L632-L654 | [
"def",
"set_policy",
"(",
"table",
"=",
"'filter'",
",",
"chain",
"=",
"None",
",",
"policy",
"=",
"None",
",",
"family",
"=",
"'ipv4'",
")",
":",
"if",
"not",
"chain",
":",
"return",
"'Error: Chain needs to be specified'",
"if",
"not",
"policy",
":",
"ret... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | save | Save the current in-memory rules to disk
CLI Example:
.. code-block:: bash
salt '*' iptables.save /etc/sysconfig/iptables
IPv6:
salt '*' iptables.save /etc/sysconfig/iptables family=ipv6 | salt/modules/iptables.py | def save(filename=None, family='ipv4'):
'''
Save the current in-memory rules to disk
CLI Example:
.. code-block:: bash
salt '*' iptables.save /etc/sysconfig/iptables
IPv6:
salt '*' iptables.save /etc/sysconfig/iptables family=ipv6
'''
if _conf() and not filename:
... | def save(filename=None, family='ipv4'):
'''
Save the current in-memory rules to disk
CLI Example:
.. code-block:: bash
salt '*' iptables.save /etc/sysconfig/iptables
IPv6:
salt '*' iptables.save /etc/sysconfig/iptables family=ipv6
'''
if _conf() and not filename:
... | [
"Save",
"the",
"current",
"in",
"-",
"memory",
"rules",
"to",
"disk"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L657-L686 | [
"def",
"save",
"(",
"filename",
"=",
"None",
",",
"family",
"=",
"'ipv4'",
")",
":",
"if",
"_conf",
"(",
")",
"and",
"not",
"filename",
":",
"filename",
"=",
"_conf",
"(",
"family",
")",
"log",
".",
"debug",
"(",
"'Saving rules to %s'",
",",
"filename"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | check | Check for the existence of a rule in the table and chain
This function accepts a rule in a standard iptables command format,
starting with the chain. Trying to force users to adapt to a new
method of creating rules would be irritating at best, and we
already have a parser that can handle it... | salt/modules/iptables.py | def check(table='filter', chain=None, rule=None, family='ipv4'):
'''
Check for the existence of a rule in the table and chain
This function accepts a rule in a standard iptables command format,
starting with the chain. Trying to force users to adapt to a new
method of creating rules would b... | def check(table='filter', chain=None, rule=None, family='ipv4'):
'''
Check for the existence of a rule in the table and chain
This function accepts a rule in a standard iptables command format,
starting with the chain. Trying to force users to adapt to a new
method of creating rules would b... | [
"Check",
"for",
"the",
"existence",
"of",
"a",
"rule",
"in",
"the",
"table",
"and",
"chain"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L689-L741 | [
"def",
"check",
"(",
"table",
"=",
"'filter'",
",",
"chain",
"=",
"None",
",",
"rule",
"=",
"None",
",",
"family",
"=",
"'ipv4'",
")",
":",
"if",
"not",
"chain",
":",
"return",
"'Error: Chain needs to be specified'",
"if",
"not",
"rule",
":",
"return",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | check_chain | .. versionadded:: 2014.1.0
Check for the existence of a chain in the table
CLI Example:
.. code-block:: bash
salt '*' iptables.check_chain filter INPUT
IPv6:
salt '*' iptables.check_chain filter INPUT family=ipv6 | salt/modules/iptables.py | def check_chain(table='filter', chain=None, family='ipv4'):
'''
.. versionadded:: 2014.1.0
Check for the existence of a chain in the table
CLI Example:
.. code-block:: bash
salt '*' iptables.check_chain filter INPUT
IPv6:
salt '*' iptables.check_chain filter INPUT family... | def check_chain(table='filter', chain=None, family='ipv4'):
'''
.. versionadded:: 2014.1.0
Check for the existence of a chain in the table
CLI Example:
.. code-block:: bash
salt '*' iptables.check_chain filter INPUT
IPv6:
salt '*' iptables.check_chain filter INPUT family... | [
"..",
"versionadded",
"::",
"2014",
".",
"1",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L744-L771 | [
"def",
"check_chain",
"(",
"table",
"=",
"'filter'",
",",
"chain",
"=",
"None",
",",
"family",
"=",
"'ipv4'",
")",
":",
"if",
"not",
"chain",
":",
"return",
"'Error: Chain needs to be specified'",
"cmd",
"=",
"'{0}-save -t {1}'",
".",
"format",
"(",
"_iptables... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | new_chain | .. versionadded:: 2014.1.0
Create new custom chain to the specified table.
CLI Example:
.. code-block:: bash
salt '*' iptables.new_chain filter CUSTOM_CHAIN
IPv6:
salt '*' iptables.new_chain filter CUSTOM_CHAIN family=ipv6 | salt/modules/iptables.py | def new_chain(table='filter', chain=None, family='ipv4'):
'''
.. versionadded:: 2014.1.0
Create new custom chain to the specified table.
CLI Example:
.. code-block:: bash
salt '*' iptables.new_chain filter CUSTOM_CHAIN
IPv6:
salt '*' iptables.new_chain filter CUSTOM_CHAI... | def new_chain(table='filter', chain=None, family='ipv4'):
'''
.. versionadded:: 2014.1.0
Create new custom chain to the specified table.
CLI Example:
.. code-block:: bash
salt '*' iptables.new_chain filter CUSTOM_CHAIN
IPv6:
salt '*' iptables.new_chain filter CUSTOM_CHAI... | [
"..",
"versionadded",
"::",
"2014",
".",
"1",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L774-L800 | [
"def",
"new_chain",
"(",
"table",
"=",
"'filter'",
",",
"chain",
"=",
"None",
",",
"family",
"=",
"'ipv4'",
")",
":",
"if",
"not",
"chain",
":",
"return",
"'Error: Chain needs to be specified'",
"wait",
"=",
"'--wait'",
"if",
"_has_option",
"(",
"'--wait'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | append | Append a rule to the specified table/chain.
This function accepts a rule in a standard iptables command format,
starting with the chain. Trying to force users to adapt to a new
method of creating rules would be irritating at best, and we
already have a parser that can handle it.
CLI Ex... | salt/modules/iptables.py | def append(table='filter', chain=None, rule=None, family='ipv4'):
'''
Append a rule to the specified table/chain.
This function accepts a rule in a standard iptables command format,
starting with the chain. Trying to force users to adapt to a new
method of creating rules would be irritating... | def append(table='filter', chain=None, rule=None, family='ipv4'):
'''
Append a rule to the specified table/chain.
This function accepts a rule in a standard iptables command format,
starting with the chain. Trying to force users to adapt to a new
method of creating rules would be irritating... | [
"Append",
"a",
"rule",
"to",
"the",
"specified",
"table",
"/",
"chain",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L832-L865 | [
"def",
"append",
"(",
"table",
"=",
"'filter'",
",",
"chain",
"=",
"None",
",",
"rule",
"=",
"None",
",",
"family",
"=",
"'ipv4'",
")",
":",
"if",
"not",
"chain",
":",
"return",
"'Error: Chain needs to be specified'",
"if",
"not",
"rule",
":",
"return",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | insert | Insert a rule into the specified table/chain, at the specified position.
This function accepts a rule in a standard iptables command format,
starting with the chain. Trying to force users to adapt to a new
method of creating rules would be irritating at best, and we
already have a parser th... | salt/modules/iptables.py | def insert(table='filter', chain=None, position=None, rule=None, family='ipv4'):
'''
Insert a rule into the specified table/chain, at the specified position.
This function accepts a rule in a standard iptables command format,
starting with the chain. Trying to force users to adapt to a new
... | def insert(table='filter', chain=None, position=None, rule=None, family='ipv4'):
'''
Insert a rule into the specified table/chain, at the specified position.
This function accepts a rule in a standard iptables command format,
starting with the chain. Trying to force users to adapt to a new
... | [
"Insert",
"a",
"rule",
"into",
"the",
"specified",
"table",
"/",
"chain",
"at",
"the",
"specified",
"position",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L868-L915 | [
"def",
"insert",
"(",
"table",
"=",
"'filter'",
",",
"chain",
"=",
"None",
",",
"position",
"=",
"None",
",",
"rule",
"=",
"None",
",",
"family",
"=",
"'ipv4'",
")",
":",
"if",
"not",
"chain",
":",
"return",
"'Error: Chain needs to be specified'",
"if",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete | Delete a rule from the specified table/chain, specifying either the rule
in its entirety, or the rule's position in the chain.
This function accepts a rule in a standard iptables command format,
starting with the chain. Trying to force users to adapt to a new
method of creating rules would ... | salt/modules/iptables.py | def delete(table, chain=None, position=None, rule=None, family='ipv4'):
'''
Delete a rule from the specified table/chain, specifying either the rule
in its entirety, or the rule's position in the chain.
This function accepts a rule in a standard iptables command format,
starting with the ch... | def delete(table, chain=None, position=None, rule=None, family='ipv4'):
'''
Delete a rule from the specified table/chain, specifying either the rule
in its entirety, or the rule's position in the chain.
This function accepts a rule in a standard iptables command format,
starting with the ch... | [
"Delete",
"a",
"rule",
"from",
"the",
"specified",
"table",
"/",
"chain",
"specifying",
"either",
"the",
"rule",
"in",
"its",
"entirety",
"or",
"the",
"rule",
"s",
"position",
"in",
"the",
"chain",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L918-L953 | [
"def",
"delete",
"(",
"table",
",",
"chain",
"=",
"None",
",",
"position",
"=",
"None",
",",
"rule",
"=",
"None",
",",
"family",
"=",
"'ipv4'",
")",
":",
"if",
"position",
"and",
"rule",
":",
"return",
"'Error: Only specify a position or a rule, not both'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | flush | Flush the chain in the specified table, flush all chains in the specified
table if not specified chain.
CLI Example:
.. code-block:: bash
salt '*' iptables.flush filter INPUT
IPv6:
salt '*' iptables.flush filter INPUT family=ipv6 | salt/modules/iptables.py | def flush(table='filter', chain='', family='ipv4'):
'''
Flush the chain in the specified table, flush all chains in the specified
table if not specified chain.
CLI Example:
.. code-block:: bash
salt '*' iptables.flush filter INPUT
IPv6:
salt '*' iptables.flush filter INPU... | def flush(table='filter', chain='', family='ipv4'):
'''
Flush the chain in the specified table, flush all chains in the specified
table if not specified chain.
CLI Example:
.. code-block:: bash
salt '*' iptables.flush filter INPUT
IPv6:
salt '*' iptables.flush filter INPU... | [
"Flush",
"the",
"chain",
"in",
"the",
"specified",
"table",
"flush",
"all",
"chains",
"in",
"the",
"specified",
"table",
"if",
"not",
"specified",
"chain",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L956-L974 | [
"def",
"flush",
"(",
"table",
"=",
"'filter'",
",",
"chain",
"=",
"''",
",",
"family",
"=",
"'ipv4'",
")",
":",
"wait",
"=",
"'--wait'",
"if",
"_has_option",
"(",
"'--wait'",
",",
"family",
")",
"else",
"''",
"cmd",
"=",
"'{0} {1} -t {2} -F {3}'",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_conf | If a file is not passed in, and the correct one for this OS is not
detected, return False | salt/modules/iptables.py | def _parse_conf(conf_file=None, in_mem=False, family='ipv4'):
'''
If a file is not passed in, and the correct one for this OS is not
detected, return False
'''
if _conf() and not conf_file and not in_mem:
conf_file = _conf(family)
rules = ''
if conf_file:
with salt.utils.fil... | def _parse_conf(conf_file=None, in_mem=False, family='ipv4'):
'''
If a file is not passed in, and the correct one for this OS is not
detected, return False
'''
if _conf() and not conf_file and not in_mem:
conf_file = _conf(family)
rules = ''
if conf_file:
with salt.utils.fil... | [
"If",
"a",
"file",
"is",
"not",
"passed",
"in",
"and",
"the",
"correct",
"one",
"for",
"this",
"OS",
"is",
"not",
"detected",
"return",
"False"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L977-L1046 | [
"def",
"_parse_conf",
"(",
"conf_file",
"=",
"None",
",",
"in_mem",
"=",
"False",
",",
"family",
"=",
"'ipv4'",
")",
":",
"if",
"_conf",
"(",
")",
"and",
"not",
"conf_file",
"and",
"not",
"in_mem",
":",
"conf_file",
"=",
"_conf",
"(",
"family",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parser | This function attempts to list all the options documented in the
iptables(8) and iptables-extensions(8) man pages. They will not all be
used by all parts of the module; use them intelligently and appropriately. | salt/modules/iptables.py | def _parser():
'''
This function attempts to list all the options documented in the
iptables(8) and iptables-extensions(8) man pages. They will not all be
used by all parts of the module; use them intelligently and appropriately.
'''
add_arg = None
if sys.version.startswith('2.6'):
... | def _parser():
'''
This function attempts to list all the options documented in the
iptables(8) and iptables-extensions(8) man pages. They will not all be
used by all parts of the module; use them intelligently and appropriately.
'''
add_arg = None
if sys.version.startswith('2.6'):
... | [
"This",
"function",
"attempts",
"to",
"list",
"all",
"the",
"options",
"documented",
"in",
"the",
"iptables",
"(",
"8",
")",
"and",
"iptables",
"-",
"extensions",
"(",
"8",
")",
"man",
"pages",
".",
"They",
"will",
"not",
"all",
"be",
"used",
"by",
"al... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L1049-L1597 | [
"def",
"_parser",
"(",
")",
":",
"add_arg",
"=",
"None",
"if",
"sys",
".",
"version",
".",
"startswith",
"(",
"'2.6'",
")",
":",
"import",
"optparse",
"parser",
"=",
"optparse",
".",
"OptionParser",
"(",
")",
"add_arg",
"=",
"parser",
".",
"add_option",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _changes | Return a dict of the changes required for a group if the group is present,
otherwise return False. | salt/states/group.py | def _changes(name,
gid=None,
addusers=None,
delusers=None,
members=None):
'''
Return a dict of the changes required for a group if the group is present,
otherwise return False.
'''
lgrp = __salt__['group.info'](name)
if not lgrp:
return... | def _changes(name,
gid=None,
addusers=None,
delusers=None,
members=None):
'''
Return a dict of the changes required for a group if the group is present,
otherwise return False.
'''
lgrp = __salt__['group.info'](name)
if not lgrp:
return... | [
"Return",
"a",
"dict",
"of",
"the",
"changes",
"required",
"for",
"a",
"group",
"if",
"the",
"group",
"is",
"present",
"otherwise",
"return",
"False",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/group.py#L49-L104 | [
"def",
"_changes",
"(",
"name",
",",
"gid",
"=",
"None",
",",
"addusers",
"=",
"None",
",",
"delusers",
"=",
"None",
",",
"members",
"=",
"None",
")",
":",
"lgrp",
"=",
"__salt__",
"[",
"'group.info'",
"]",
"(",
"name",
")",
"if",
"not",
"lgrp",
":... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | present | r'''
Ensure that a group is present
Args:
name (str):
The name of the group to manage
gid (str):
The group id to assign to the named group; if left empty, then the
next available group id will be assigned. Ignored on Windows
system (bool):
... | salt/states/group.py | def present(name,
gid=None,
system=False,
addusers=None,
delusers=None,
members=None):
r'''
Ensure that a group is present
Args:
name (str):
The name of the group to manage
gid (str):
The group id to assig... | def present(name,
gid=None,
system=False,
addusers=None,
delusers=None,
members=None):
r'''
Ensure that a group is present
Args:
name (str):
The name of the group to manage
gid (str):
The group id to assig... | [
"r",
"Ensure",
"that",
"a",
"group",
"is",
"present"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/group.py#L107-L285 | [
"def",
"present",
"(",
"name",
",",
"gid",
"=",
"None",
",",
"system",
"=",
"False",
",",
"addusers",
"=",
"None",
",",
"delusers",
"=",
"None",
",",
"members",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _run | Just a convenience function for ``__salt__['cmd.run_all'](cmd)`` | salt/modules/nix.py | def _run(cmd):
'''
Just a convenience function for ``__salt__['cmd.run_all'](cmd)``
'''
return __salt__['cmd.run_all'](cmd, env={'HOME': os.path.expanduser('~{0}'.format(__opts__['user']))}) | def _run(cmd):
'''
Just a convenience function for ``__salt__['cmd.run_all'](cmd)``
'''
return __salt__['cmd.run_all'](cmd, env={'HOME': os.path.expanduser('~{0}'.format(__opts__['user']))}) | [
"Just",
"a",
"convenience",
"function",
"for",
"__salt__",
"[",
"cmd",
".",
"run_all",
"]",
"(",
"cmd",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nix.py#L47-L51 | [
"def",
"_run",
"(",
"cmd",
")",
":",
"return",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"env",
"=",
"{",
"'HOME'",
":",
"os",
".",
"path",
".",
"expanduser",
"(",
"'~{0}'",
".",
"format",
"(",
"__opts__",
"[",
"'user'",
"]",
")",
")"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _nix_env | nix-env with quiet option. By default, nix is extremely verbose and prints the build log of every package to stderr. This tells nix to
only show changes. | salt/modules/nix.py | def _nix_env():
'''
nix-env with quiet option. By default, nix is extremely verbose and prints the build log of every package to stderr. This tells nix to
only show changes.
'''
nixhome = os.path.join(os.path.expanduser('~{0}'.format(__opts__['user'])), '.nix-profile/bin/')
return [os.path.join(... | def _nix_env():
'''
nix-env with quiet option. By default, nix is extremely verbose and prints the build log of every package to stderr. This tells nix to
only show changes.
'''
nixhome = os.path.join(os.path.expanduser('~{0}'.format(__opts__['user'])), '.nix-profile/bin/')
return [os.path.join(... | [
"nix",
"-",
"env",
"with",
"quiet",
"option",
".",
"By",
"default",
"nix",
"is",
"extremely",
"verbose",
"and",
"prints",
"the",
"build",
"log",
"of",
"every",
"package",
"to",
"stderr",
".",
"This",
"tells",
"nix",
"to",
"only",
"show",
"changes",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nix.py#L54-L60 | [
"def",
"_nix_env",
"(",
")",
":",
"nixhome",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
"'~{0}'",
".",
"format",
"(",
"__opts__",
"[",
"'user'",
"]",
")",
")",
",",
"'.nix-profile/bin/'",
")",
"return",
"[",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _nix_collect_garbage | Make sure we get the right nix-store, too. | salt/modules/nix.py | def _nix_collect_garbage():
'''
Make sure we get the right nix-store, too.
'''
nixhome = os.path.join(os.path.expanduser('~{0}'.format(__opts__['user'])), '.nix-profile/bin/')
return [os.path.join(nixhome, 'nix-collect-garbage')] | def _nix_collect_garbage():
'''
Make sure we get the right nix-store, too.
'''
nixhome = os.path.join(os.path.expanduser('~{0}'.format(__opts__['user'])), '.nix-profile/bin/')
return [os.path.join(nixhome, 'nix-collect-garbage')] | [
"Make",
"sure",
"we",
"get",
"the",
"right",
"nix",
"-",
"store",
"too",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nix.py#L63-L68 | [
"def",
"_nix_collect_garbage",
"(",
")",
":",
"nixhome",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
"'~{0}'",
".",
"format",
"(",
"__opts__",
"[",
"'user'",
"]",
")",
")",
",",
"'.nix-profile/bin/'",
")",
"retu... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _zip_flatten | intersperse x into ys, with an extra element at the beginning. | salt/modules/nix.py | def _zip_flatten(x, ys):
'''
intersperse x into ys, with an extra element at the beginning.
'''
return itertools.chain.from_iterable(
zip(itertools.repeat(x), ys)) | def _zip_flatten(x, ys):
'''
intersperse x into ys, with an extra element at the beginning.
'''
return itertools.chain.from_iterable(
zip(itertools.repeat(x), ys)) | [
"intersperse",
"x",
"into",
"ys",
"with",
"an",
"extra",
"element",
"at",
"the",
"beginning",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nix.py#L81-L86 | [
"def",
"_zip_flatten",
"(",
"x",
",",
"ys",
")",
":",
"return",
"itertools",
".",
"chain",
".",
"from_iterable",
"(",
"zip",
"(",
"itertools",
".",
"repeat",
"(",
"x",
")",
",",
"ys",
")",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _output_format | gets a list of all the packages that were affected by ``operation``, splits it up (there can be multiple packages on a line), and then
flattens that list. We make it to a list for easier parsing. | salt/modules/nix.py | def _output_format(out,
operation):
'''
gets a list of all the packages that were affected by ``operation``, splits it up (there can be multiple packages on a line), and then
flattens that list. We make it to a list for easier parsing.
'''
return [s.split()[1:] for s in out
... | def _output_format(out,
operation):
'''
gets a list of all the packages that were affected by ``operation``, splits it up (there can be multiple packages on a line), and then
flattens that list. We make it to a list for easier parsing.
'''
return [s.split()[1:] for s in out
... | [
"gets",
"a",
"list",
"of",
"all",
"the",
"packages",
"that",
"were",
"affected",
"by",
"operation",
"splits",
"it",
"up",
"(",
"there",
"can",
"be",
"multiple",
"packages",
"on",
"a",
"line",
")",
"and",
"then",
"flattens",
"that",
"list",
".",
"We",
"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nix.py#L89-L96 | [
"def",
"_output_format",
"(",
"out",
",",
"operation",
")",
":",
"return",
"[",
"s",
".",
"split",
"(",
")",
"[",
"1",
":",
"]",
"for",
"s",
"in",
"out",
"if",
"s",
".",
"startswith",
"(",
"operation",
")",
"]"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | upgrade | Runs an update operation on the specified packages, or all packages if none is specified.
:type pkgs: list(str)
:param pkgs:
List of packages to update
:return: The upgraded packages. Example element: ``['libxslt-1.1.0', 'libxslt-1.1.10']``
:rtype: list(tuple(str, str))
.. code-block:: ba... | salt/modules/nix.py | def upgrade(*pkgs):
'''
Runs an update operation on the specified packages, or all packages if none is specified.
:type pkgs: list(str)
:param pkgs:
List of packages to update
:return: The upgraded packages. Example element: ``['libxslt-1.1.0', 'libxslt-1.1.10']``
:rtype: list(tuple(st... | def upgrade(*pkgs):
'''
Runs an update operation on the specified packages, or all packages if none is specified.
:type pkgs: list(str)
:param pkgs:
List of packages to update
:return: The upgraded packages. Example element: ``['libxslt-1.1.0', 'libxslt-1.1.10']``
:rtype: list(tuple(st... | [
"Runs",
"an",
"update",
"operation",
"on",
"the",
"specified",
"packages",
"or",
"all",
"packages",
"if",
"none",
"is",
"specified",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nix.py#L113-L140 | [
"def",
"upgrade",
"(",
"*",
"pkgs",
")",
":",
"cmd",
"=",
"_quietnix",
"(",
")",
"cmd",
".",
"append",
"(",
"'--upgrade'",
")",
"cmd",
".",
"extend",
"(",
"pkgs",
")",
"out",
"=",
"_run",
"(",
"cmd",
")",
"upgrades",
"=",
"[",
"_format_upgrade",
"(... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | install | Installs a single or multiple packages via nix
:type pkgs: list(str)
:param pkgs:
packages to update
:param bool attributes:
Pass the list of packages or single package as attribues, not package names.
default: False
:return: Installed packages. Example element: ``gcc-3.3.2``
... | salt/modules/nix.py | def install(*pkgs, **kwargs):
'''
Installs a single or multiple packages via nix
:type pkgs: list(str)
:param pkgs:
packages to update
:param bool attributes:
Pass the list of packages or single package as attribues, not package names.
default: False
:return: Installed ... | def install(*pkgs, **kwargs):
'''
Installs a single or multiple packages via nix
:type pkgs: list(str)
:param pkgs:
packages to update
:param bool attributes:
Pass the list of packages or single package as attribues, not package names.
default: False
:return: Installed ... | [
"Installs",
"a",
"single",
"or",
"multiple",
"packages",
"via",
"nix"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nix.py#L143-L183 | [
"def",
"install",
"(",
"*",
"pkgs",
",",
"*",
"*",
"kwargs",
")",
":",
"attributes",
"=",
"kwargs",
".",
"get",
"(",
"'attributes'",
",",
"False",
")",
"if",
"not",
"pkgs",
":",
"return",
"\"Plese specify a package or packages to upgrade\"",
"cmd",
"=",
"_qu... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_pkgs | Lists installed packages. Due to how nix works, it defaults to just doing a ``nix-env -q``.
:param bool installed:
list only installed packages. This can be a very long list (12,000+ elements), so caution is advised.
Default: True
:param bool attributes:
show the attributes of the pack... | salt/modules/nix.py | def list_pkgs(installed=True,
attributes=True):
'''
Lists installed packages. Due to how nix works, it defaults to just doing a ``nix-env -q``.
:param bool installed:
list only installed packages. This can be a very long list (12,000+ elements), so caution is advised.
Default:... | def list_pkgs(installed=True,
attributes=True):
'''
Lists installed packages. Due to how nix works, it defaults to just doing a ``nix-env -q``.
:param bool installed:
list only installed packages. This can be a very long list (12,000+ elements), so caution is advised.
Default:... | [
"Lists",
"installed",
"packages",
".",
"Due",
"to",
"how",
"nix",
"works",
"it",
"defaults",
"to",
"just",
"doing",
"a",
"nix",
"-",
"env",
"-",
"q",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nix.py#L186-L228 | [
"def",
"list_pkgs",
"(",
"installed",
"=",
"True",
",",
"attributes",
"=",
"True",
")",
":",
"# We don't use -Q here, as it obfuscates the attribute names on full package listings.",
"cmd",
"=",
"_nix_env",
"(",
")",
"cmd",
".",
"append",
"(",
"'--query'",
")",
"if",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | uninstall | Erases a package from the current nix profile. Nix uninstalls work differently than other package managers, and the symlinks in the
profile are removed, while the actual package remains. There is also a ``nix.purge`` function, to clear the package cache of unused
packages.
:type pkgs: list(str)
:param ... | salt/modules/nix.py | def uninstall(*pkgs):
'''
Erases a package from the current nix profile. Nix uninstalls work differently than other package managers, and the symlinks in the
profile are removed, while the actual package remains. There is also a ``nix.purge`` function, to clear the package cache of unused
packages.
... | def uninstall(*pkgs):
'''
Erases a package from the current nix profile. Nix uninstalls work differently than other package managers, and the symlinks in the
profile are removed, while the actual package remains. There is also a ``nix.purge`` function, to clear the package cache of unused
packages.
... | [
"Erases",
"a",
"package",
"from",
"the",
"current",
"nix",
"profile",
".",
"Nix",
"uninstalls",
"work",
"differently",
"than",
"other",
"package",
"managers",
"and",
"the",
"symlinks",
"in",
"the",
"profile",
"are",
"removed",
"while",
"the",
"actual",
"packag... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nix.py#L231-L259 | [
"def",
"uninstall",
"(",
"*",
"pkgs",
")",
":",
"cmd",
"=",
"_quietnix",
"(",
")",
"cmd",
".",
"append",
"(",
"'--uninstall'",
")",
"cmd",
".",
"extend",
"(",
"pkgs",
")",
"out",
"=",
"_run",
"(",
"cmd",
")",
"fmtout",
"=",
"out",
"[",
"'stderr'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | collect_garbage | Completely removed all currently 'uninstalled' packages in the nix store.
Tells the user how many store paths were removed and how much space was freed.
:return: How much space was freed and how many derivations were removed
:rtype: str
.. warning::
This is a destructive action on the nix stor... | salt/modules/nix.py | def collect_garbage():
'''
Completely removed all currently 'uninstalled' packages in the nix store.
Tells the user how many store paths were removed and how much space was freed.
:return: How much space was freed and how many derivations were removed
:rtype: str
.. warning::
This is a... | def collect_garbage():
'''
Completely removed all currently 'uninstalled' packages in the nix store.
Tells the user how many store paths were removed and how much space was freed.
:return: How much space was freed and how many derivations were removed
:rtype: str
.. warning::
This is a... | [
"Completely",
"removed",
"all",
"currently",
"uninstalled",
"packages",
"in",
"the",
"nix",
"store",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nix.py#L262-L283 | [
"def",
"collect_garbage",
"(",
")",
":",
"cmd",
"=",
"_nix_collect_garbage",
"(",
")",
"cmd",
".",
"append",
"(",
"'--delete-old'",
")",
"out",
"=",
"_run",
"(",
"cmd",
")",
"return",
"out",
"[",
"'stdout'",
"]",
".",
"splitlines",
"(",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ext_pillar | Collect minion external pillars from a RethinkDB database
Arguments:
* `table`: The RethinkDB table containing external pillar information.
Defaults to ``'pillar'``
* `id_field`: Field in document containing the minion id.
If blank then we assume the table index matches minion ids
* `field`... | salt/pillar/rethinkdb_pillar.py | def ext_pillar(minion_id,
pillar,
table='pillar',
id_field=None,
field=None,
pillar_key=None):
'''
Collect minion external pillars from a RethinkDB database
Arguments:
* `table`: The RethinkDB table containing external pillar in... | def ext_pillar(minion_id,
pillar,
table='pillar',
id_field=None,
field=None,
pillar_key=None):
'''
Collect minion external pillars from a RethinkDB database
Arguments:
* `table`: The RethinkDB table containing external pillar in... | [
"Collect",
"minion",
"external",
"pillars",
"from",
"a",
"RethinkDB",
"database"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/rethinkdb_pillar.py#L78-L163 | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"pillar",
",",
"table",
"=",
"'pillar'",
",",
"id_field",
"=",
"None",
",",
"field",
"=",
"None",
",",
"pillar_key",
"=",
"None",
")",
":",
"host",
"=",
"__opts__",
"[",
"'rethinkdb.host'",
"]",
"port",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalRunner._proc_function | Same as original _proc_function in AsyncClientMixin,
except it calls "low" without firing a print event. | salt/cli/support/localrunner.py | def _proc_function(self, fun, low, user, tag, jid, daemonize=True):
'''
Same as original _proc_function in AsyncClientMixin,
except it calls "low" without firing a print event.
'''
if daemonize and not salt.utils.platform.is_windows():
salt.log.setup.shutdown_multipro... | def _proc_function(self, fun, low, user, tag, jid, daemonize=True):
'''
Same as original _proc_function in AsyncClientMixin,
except it calls "low" without firing a print event.
'''
if daemonize and not salt.utils.platform.is_windows():
salt.log.setup.shutdown_multipro... | [
"Same",
"as",
"original",
"_proc_function",
"in",
"AsyncClientMixin",
"except",
"it",
"calls",
"low",
"without",
"firing",
"a",
"print",
"event",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/localrunner.py#L20-L34 | [
"def",
"_proc_function",
"(",
"self",
",",
"fun",
",",
"low",
",",
"user",
",",
"tag",
",",
"jid",
",",
"daemonize",
"=",
"True",
")",
":",
"if",
"daemonize",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"s... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | run | Execute a puppet run and return a dict with the stderr, stdout,
return code, etc. The first positional argument given is checked as a
subcommand. Following positional arguments should be ordered with arguments
required by the subcommand first, followed by non-keyword arguments.
Tags are specified by a t... | salt/modules/puppet.py | def run(*args, **kwargs):
'''
Execute a puppet run and return a dict with the stderr, stdout,
return code, etc. The first positional argument given is checked as a
subcommand. Following positional arguments should be ordered with arguments
required by the subcommand first, followed by non-keyword ar... | def run(*args, **kwargs):
'''
Execute a puppet run and return a dict with the stderr, stdout,
return code, etc. The first positional argument given is checked as a
subcommand. Following positional arguments should be ordered with arguments
required by the subcommand first, followed by non-keyword ar... | [
"Execute",
"a",
"puppet",
"run",
"and",
"return",
"a",
"dict",
"with",
"the",
"stderr",
"stdout",
"return",
"code",
"etc",
".",
"The",
"first",
"positional",
"argument",
"given",
"is",
"checked",
"as",
"a",
"subcommand",
".",
"Following",
"positional",
"argu... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/puppet.py#L138-L175 | [
"def",
"run",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"puppet",
"=",
"_Puppet",
"(",
")",
"# new args tuple to filter out agent/apply for _Puppet.arguments()",
"buildargs",
"=",
"(",
")",
"for",
"arg",
"in",
"range",
"(",
"len",
"(",
"args",
")"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | enable | .. versionadded:: 2014.7.0
Enable the puppet agent
CLI Example:
.. code-block:: bash
salt '*' puppet.enable | salt/modules/puppet.py | def enable():
'''
.. versionadded:: 2014.7.0
Enable the puppet agent
CLI Example:
.. code-block:: bash
salt '*' puppet.enable
'''
puppet = _Puppet()
if os.path.isfile(puppet.disabled_lockfile):
try:
os.remove(puppet.disabled_lockfile)
except (IOEr... | def enable():
'''
.. versionadded:: 2014.7.0
Enable the puppet agent
CLI Example:
.. code-block:: bash
salt '*' puppet.enable
'''
puppet = _Puppet()
if os.path.isfile(puppet.disabled_lockfile):
try:
os.remove(puppet.disabled_lockfile)
except (IOEr... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/puppet.py#L196-L219 | [
"def",
"enable",
"(",
")",
":",
"puppet",
"=",
"_Puppet",
"(",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"puppet",
".",
"disabled_lockfile",
")",
":",
"try",
":",
"os",
".",
"remove",
"(",
"puppet",
".",
"disabled_lockfile",
")",
"except",
"(... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | disable | .. versionadded:: 2014.7.0
Disable the puppet agent
message
.. versionadded:: 2015.5.2
Disable message to send to puppet
CLI Example:
.. code-block:: bash
salt '*' puppet.disable
salt '*' puppet.disable 'Disabled, contact XYZ before enabling' | salt/modules/puppet.py | def disable(message=None):
'''
.. versionadded:: 2014.7.0
Disable the puppet agent
message
.. versionadded:: 2015.5.2
Disable message to send to puppet
CLI Example:
.. code-block:: bash
salt '*' puppet.disable
salt '*' puppet.disable 'Disabled, contact XYZ b... | def disable(message=None):
'''
.. versionadded:: 2014.7.0
Disable the puppet agent
message
.. versionadded:: 2015.5.2
Disable message to send to puppet
CLI Example:
.. code-block:: bash
salt '*' puppet.disable
salt '*' puppet.disable 'Disabled, contact XYZ b... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/puppet.py#L222-L256 | [
"def",
"disable",
"(",
"message",
"=",
"None",
")",
":",
"puppet",
"=",
"_Puppet",
"(",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"puppet",
".",
"disabled_lockfile",
")",
":",
"return",
"False",
"else",
":",
"with",
"salt",
".",
"utils",
".",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | status | .. versionadded:: 2014.7.0
Display puppet agent status
CLI Example:
.. code-block:: bash
salt '*' puppet.status | salt/modules/puppet.py | def status():
'''
.. versionadded:: 2014.7.0
Display puppet agent status
CLI Example:
.. code-block:: bash
salt '*' puppet.status
'''
puppet = _Puppet()
if os.path.isfile(puppet.disabled_lockfile):
return 'Administratively disabled'
if os.path.isfile(puppet.run_... | def status():
'''
.. versionadded:: 2014.7.0
Display puppet agent status
CLI Example:
.. code-block:: bash
salt '*' puppet.status
'''
puppet = _Puppet()
if os.path.isfile(puppet.disabled_lockfile):
return 'Administratively disabled'
if os.path.isfile(puppet.run_... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/puppet.py#L259-L296 | [
"def",
"status",
"(",
")",
":",
"puppet",
"=",
"_Puppet",
"(",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"puppet",
".",
"disabled_lockfile",
")",
":",
"return",
"'Administratively disabled'",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"puppet",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | summary | .. versionadded:: 2014.7.0
Show a summary of the last puppet agent run
CLI Example:
.. code-block:: bash
salt '*' puppet.summary | salt/modules/puppet.py | def summary():
'''
.. versionadded:: 2014.7.0
Show a summary of the last puppet agent run
CLI Example:
.. code-block:: bash
salt '*' puppet.summary
'''
puppet = _Puppet()
try:
with salt.utils.files.fopen(puppet.lastrunfile, 'r') as fp_:
report = salt.uti... | def summary():
'''
.. versionadded:: 2014.7.0
Show a summary of the last puppet agent run
CLI Example:
.. code-block:: bash
salt '*' puppet.summary
'''
puppet = _Puppet()
try:
with salt.utils.files.fopen(puppet.lastrunfile, 'r') as fp_:
report = salt.uti... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/puppet.py#L299-L343 | [
"def",
"summary",
"(",
")",
":",
"puppet",
"=",
"_Puppet",
"(",
")",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"puppet",
".",
"lastrunfile",
",",
"'r'",
")",
"as",
"fp_",
":",
"report",
"=",
"salt",
".",
"utils",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | facts | Run facter and return the results
CLI Example:
.. code-block:: bash
salt '*' puppet.facts | salt/modules/puppet.py | def facts(puppet=False):
'''
Run facter and return the results
CLI Example:
.. code-block:: bash
salt '*' puppet.facts
'''
ret = {}
opt_puppet = '--puppet' if puppet else ''
cmd_ret = __salt__['cmd.run_all']('facter {0}'.format(opt_puppet))
if cmd_ret['retcode'] != 0:
... | def facts(puppet=False):
'''
Run facter and return the results
CLI Example:
.. code-block:: bash
salt '*' puppet.facts
'''
ret = {}
opt_puppet = '--puppet' if puppet else ''
cmd_ret = __salt__['cmd.run_all']('facter {0}'.format(opt_puppet))
if cmd_ret['retcode'] != 0:
... | [
"Run",
"facter",
"and",
"return",
"the",
"results"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/puppet.py#L363-L392 | [
"def",
"facts",
"(",
"puppet",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"}",
"opt_puppet",
"=",
"'--puppet'",
"if",
"puppet",
"else",
"''",
"cmd_ret",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"'facter {0}'",
".",
"format",
"(",
"opt_puppet",
")",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | fact | Run facter for a specific fact
CLI Example:
.. code-block:: bash
salt '*' puppet.fact kernel | salt/modules/puppet.py | def fact(name, puppet=False):
'''
Run facter for a specific fact
CLI Example:
.. code-block:: bash
salt '*' puppet.fact kernel
'''
opt_puppet = '--puppet' if puppet else ''
ret = __salt__['cmd.run_all'](
'facter {0} {1}'.format(opt_puppet, name),
python_she... | def fact(name, puppet=False):
'''
Run facter for a specific fact
CLI Example:
.. code-block:: bash
salt '*' puppet.fact kernel
'''
opt_puppet = '--puppet' if puppet else ''
ret = __salt__['cmd.run_all'](
'facter {0} {1}'.format(opt_puppet, name),
python_she... | [
"Run",
"facter",
"for",
"a",
"specific",
"fact"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/puppet.py#L395-L415 | [
"def",
"fact",
"(",
"name",
",",
"puppet",
"=",
"False",
")",
":",
"opt_puppet",
"=",
"'--puppet'",
"if",
"puppet",
"else",
"''",
"ret",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"'facter {0} {1}'",
".",
"format",
"(",
"opt_puppet",
",",
"name",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _Puppet.arguments | Read in arguments for the current subcommand. These are added to the
cmd line without '--' appended. Any others are redirected as standard
options with the double hyphen prefixed. | salt/modules/puppet.py | def arguments(self, args=None):
'''
Read in arguments for the current subcommand. These are added to the
cmd line without '--' appended. Any others are redirected as standard
options with the double hyphen prefixed.
'''
# permits deleting elements rather than using slices... | def arguments(self, args=None):
'''
Read in arguments for the current subcommand. These are added to the
cmd line without '--' appended. Any others are redirected as standard
options with the double hyphen prefixed.
'''
# permits deleting elements rather than using slices... | [
"Read",
"in",
"arguments",
"for",
"the",
"current",
"subcommand",
".",
"These",
"are",
"added",
"to",
"the",
"cmd",
"line",
"without",
"--",
"appended",
".",
"Any",
"others",
"are",
"redirected",
"as",
"standard",
"options",
"with",
"the",
"double",
"hyphen"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/puppet.py#L113-L135 | [
"def",
"arguments",
"(",
"self",
",",
"args",
"=",
"None",
")",
":",
"# permits deleting elements rather than using slices",
"args",
"=",
"args",
"and",
"list",
"(",
"args",
")",
"or",
"[",
"]",
"# match against all known/supported subcmds",
"if",
"self",
".",
"su... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | keys_present | .. versionadded:: 2015.8.0
Ensure the IAM access keys are present.
name (string)
The name of the new user.
number (int)
Number of keys that user should have.
save_dir (string)
The directory that the key/keys will be saved. Keys are saved to a file named according
to t... | salt/states/boto_iam.py | def keys_present(name, number, save_dir, region=None, key=None, keyid=None, profile=None,
save_format="{2}\n{0}\n{3}\n{1}\n"):
'''
.. versionadded:: 2015.8.0
Ensure the IAM access keys are present.
name (string)
The name of the new user.
number (int)
Number of key... | def keys_present(name, number, save_dir, region=None, key=None, keyid=None, profile=None,
save_format="{2}\n{0}\n{3}\n{1}\n"):
'''
.. versionadded:: 2015.8.0
Ensure the IAM access keys are present.
name (string)
The name of the new user.
number (int)
Number of key... | [
"..",
"versionadded",
"::",
"2015",
".",
"8",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_iam.py#L313-L414 | [
"def",
"keys_present",
"(",
"name",
",",
"number",
",",
"save_dir",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"save_format",
"=",
"\"{2}\\n{0}\\n{3}\\n{1}\\n\"",
")",
":",
"ret",
"="... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | account_policy | Change account policy.
.. versionadded:: 2015.8.0
name (string)
The name of the account policy
allow_users_to_change_password (bool)
Allows all IAM users in your account to
use the AWS Management Console to change their own passwords.
hard_expiry (bool)
Prevents IAM u... | salt/states/boto_iam.py | def account_policy(name=None, allow_users_to_change_password=None,
hard_expiry=None, max_password_age=None,
minimum_password_length=None, password_reuse_prevention=None,
require_lowercase_characters=None, require_numbers=None,
require_symbols=N... | def account_policy(name=None, allow_users_to_change_password=None,
hard_expiry=None, max_password_age=None,
minimum_password_length=None, password_reuse_prevention=None,
require_lowercase_characters=None, require_numbers=None,
require_symbols=N... | [
"Change",
"account",
"policy",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_iam.py#L1235-L1329 | [
"def",
"account_policy",
"(",
"name",
"=",
"None",
",",
"allow_users_to_change_password",
"=",
"None",
",",
"hard_expiry",
"=",
"None",
",",
"max_password_age",
"=",
"None",
",",
"minimum_password_length",
"=",
"None",
",",
"password_reuse_prevention",
"=",
"None",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | server_cert_present | Crete server certificate.
.. versionadded:: 2015.8.0
name (string)
The name for the server certificate. Do not include the path in this value.
public_key (string)
The contents of the public key certificate in PEM-encoded format.
private_key (string)
The contents of the privat... | salt/states/boto_iam.py | def server_cert_present(name, public_key, private_key, cert_chain=None, path=None,
region=None, key=None, keyid=None, profile=None):
'''
Crete server certificate.
.. versionadded:: 2015.8.0
name (string)
The name for the server certificate. Do not include the path in th... | def server_cert_present(name, public_key, private_key, cert_chain=None, path=None,
region=None, key=None, keyid=None, profile=None):
'''
Crete server certificate.
.. versionadded:: 2015.8.0
name (string)
The name for the server certificate. Do not include the path in th... | [
"Crete",
"server",
"certificate",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_iam.py#L1372-L1449 | [
"def",
"server_cert_present",
"(",
"name",
",",
"public_key",
",",
"private_key",
",",
"cert_chain",
"=",
"None",
",",
"path",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | saml_provider_present | .. versionadded:: 2016.11.0
Ensure the SAML provider with the specified name is present.
name (string)
The name of the SAML provider.
saml_metadata_document (string)
The xml document of the SAML provider.
region (string)
Region to connect to.
key (string)
Secret ... | salt/states/boto_iam.py | def saml_provider_present(name, saml_metadata_document, region=None, key=None, keyid=None, profile=None):
'''
.. versionadded:: 2016.11.0
Ensure the SAML provider with the specified name is present.
name (string)
The name of the SAML provider.
saml_metadata_document (string)
The x... | def saml_provider_present(name, saml_metadata_document, region=None, key=None, keyid=None, profile=None):
'''
.. versionadded:: 2016.11.0
Ensure the SAML provider with the specified name is present.
name (string)
The name of the SAML provider.
saml_metadata_document (string)
The x... | [
"..",
"versionadded",
"::",
"2016",
".",
"11",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_iam.py#L1611-L1665 | [
"def",
"saml_provider_present",
"(",
"name",
",",
"saml_metadata_document",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | saml_provider_absent | .. versionadded:: 2016.11.0
Ensure the SAML provider with the specified name is absent.
name (string)
The name of the SAML provider.
saml_metadata_document (string)
The xml document of the SAML provider.
region (string)
Region to connect to.
key (string)
Secret k... | salt/states/boto_iam.py | def saml_provider_absent(name, region=None, key=None, keyid=None, profile=None):
'''
.. versionadded:: 2016.11.0
Ensure the SAML provider with the specified name is absent.
name (string)
The name of the SAML provider.
saml_metadata_document (string)
The xml document of the SAML pr... | def saml_provider_absent(name, region=None, key=None, keyid=None, profile=None):
'''
.. versionadded:: 2016.11.0
Ensure the SAML provider with the specified name is absent.
name (string)
The name of the SAML provider.
saml_metadata_document (string)
The xml document of the SAML pr... | [
"..",
"versionadded",
"::",
"2016",
".",
"11",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_iam.py#L1668-L1713 | [
"def",
"saml_provider_absent",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'comment'",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | config | Provides the BGP configuration on the device.
:param group: Name of the group selected to display the configuration.
:param neighbor: IP Address of the neighbor to display the configuration.
If the group parameter is not specified, the neighbor setting will be
ignored.
:return: A dictionar... | salt/modules/napalm_bgp.py | def config(group=None, neighbor=None, **kwargs):
'''
Provides the BGP configuration on the device.
:param group: Name of the group selected to display the configuration.
:param neighbor: IP Address of the neighbor to display the configuration.
If the group parameter is not specified, the neigh... | def config(group=None, neighbor=None, **kwargs):
'''
Provides the BGP configuration on the device.
:param group: Name of the group selected to display the configuration.
:param neighbor: IP Address of the neighbor to display the configuration.
If the group parameter is not specified, the neigh... | [
"Provides",
"the",
"BGP",
"configuration",
"on",
"the",
"device",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_bgp.py#L61-L170 | [
"def",
"config",
"(",
"group",
"=",
"None",
",",
"neighbor",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"salt",
".",
"utils",
".",
"napalm",
".",
"call",
"(",
"napalm_device",
",",
"# pylint: disable=undefined-variable",
"'get_bgp_config'",
",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _salt | Execute a salt function on a specific minion
Special kwargs:
salt_target
target to exec things on
salt_timeout
timeout for jobs
salt_job_poll
poll interval to wait for job finish result | salt/cloud/clouds/lxc.py | def _salt(fun, *args, **kw):
'''Execute a salt function on a specific minion
Special kwargs:
salt_target
target to exec things on
salt_timeout
timeout for jobs
salt_job_poll
poll interval to wait for job finish result
'''
... | def _salt(fun, *args, **kw):
'''Execute a salt function on a specific minion
Special kwargs:
salt_target
target to exec things on
salt_timeout
timeout for jobs
salt_job_poll
poll interval to wait for job finish result
'''
... | [
"Execute",
"a",
"salt",
"function",
"on",
"a",
"specific",
"minion"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/lxc.py#L97-L254 | [
"def",
"_salt",
"(",
"fun",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"try",
":",
"poll",
"=",
"kw",
".",
"pop",
"(",
"'salt_job_poll'",
")",
"except",
"KeyError",
":",
"poll",
"=",
"0.1",
"try",
":",
"target",
"=",
"kw",
".",
"pop",
"("... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_nodes_select | Return a list of the VMs that are on the provider, with select fields | salt/cloud/clouds/lxc.py | def list_nodes_select(call=None):
'''
Return a list of the VMs that are on the provider, with select fields
'''
if not call:
call = 'select'
if not get_configured_provider():
return
info = ['id', 'name', 'image', 'size', 'state', 'public_ips', 'private_ips']
return salt.utils... | def list_nodes_select(call=None):
'''
Return a list of the VMs that are on the provider, with select fields
'''
if not call:
call = 'select'
if not get_configured_provider():
return
info = ['id', 'name', 'image', 'size', 'state', 'public_ips', 'private_ips']
return salt.utils... | [
"Return",
"a",
"list",
"of",
"the",
"VMs",
"that",
"are",
"on",
"the",
"provider",
"with",
"select",
"fields"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/lxc.py#L338-L349 | [
"def",
"list_nodes_select",
"(",
"call",
"=",
"None",
")",
":",
"if",
"not",
"call",
":",
"call",
"=",
"'select'",
"if",
"not",
"get_configured_provider",
"(",
")",
":",
"return",
"info",
"=",
"[",
"'id'",
",",
"'name'",
",",
"'image'",
",",
"'size'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | destroy | Destroy a lxc container | salt/cloud/clouds/lxc.py | def destroy(vm_, call=None):
'''Destroy a lxc container'''
destroy_opt = __opts__.get('destroy', False)
profiles = __opts__.get('profiles', {})
profile = __opts__.get('profile',
__opts__.get('internal_lxc_profile', []))
path = None
if profile and profile in profiles:
... | def destroy(vm_, call=None):
'''Destroy a lxc container'''
destroy_opt = __opts__.get('destroy', False)
profiles = __opts__.get('profiles', {})
profile = __opts__.get('profile',
__opts__.get('internal_lxc_profile', []))
path = None
if profile and profile in profiles:
... | [
"Destroy",
"a",
"lxc",
"container"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/lxc.py#L375-L417 | [
"def",
"destroy",
"(",
"vm_",
",",
"call",
"=",
"None",
")",
":",
"destroy_opt",
"=",
"__opts__",
".",
"get",
"(",
"'destroy'",
",",
"False",
")",
"profiles",
"=",
"__opts__",
".",
"get",
"(",
"'profiles'",
",",
"{",
"}",
")",
"profile",
"=",
"__opts... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create | Create an lxc Container.
This function is idempotent and will try to either provision
or finish the provision of an lxc container.
NOTE: Most of the initialization code has been moved and merged
with the lxc runner and lxc.init functions | salt/cloud/clouds/lxc.py | def create(vm_, call=None):
'''Create an lxc Container.
This function is idempotent and will try to either provision
or finish the provision of an lxc container.
NOTE: Most of the initialization code has been moved and merged
with the lxc runner and lxc.init functions
'''
prov = get_configu... | def create(vm_, call=None):
'''Create an lxc Container.
This function is idempotent and will try to either provision
or finish the provision of an lxc container.
NOTE: Most of the initialization code has been moved and merged
with the lxc runner and lxc.init functions
'''
prov = get_configu... | [
"Create",
"an",
"lxc",
"Container",
".",
"This",
"function",
"is",
"idempotent",
"and",
"will",
"try",
"to",
"either",
"provision",
"or",
"finish",
"the",
"provision",
"of",
"an",
"lxc",
"container",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/lxc.py#L420-L497 | [
"def",
"create",
"(",
"vm_",
",",
"call",
"=",
"None",
")",
":",
"prov",
"=",
"get_configured_provider",
"(",
"vm_",
")",
"if",
"not",
"prov",
":",
"return",
"# we cant use profile as a configuration key as it conflicts",
"# with salt cloud internals",
"profile",
"=",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_configured_provider | Return the contextual provider of None if no configured
one can be found. | salt/cloud/clouds/lxc.py | def get_configured_provider(vm_=None):
'''
Return the contextual provider of None if no configured
one can be found.
'''
if vm_ is None:
vm_ = {}
dalias, driver = __active_provider_name__.split(':')
data = None
tgt = 'unknown'
img_provider = __opts__.get('list_images', '')
... | def get_configured_provider(vm_=None):
'''
Return the contextual provider of None if no configured
one can be found.
'''
if vm_ is None:
vm_ = {}
dalias, driver = __active_provider_name__.split(':')
data = None
tgt = 'unknown'
img_provider = __opts__.get('list_images', '')
... | [
"Return",
"the",
"contextual",
"provider",
"of",
"None",
"if",
"no",
"configured",
"one",
"can",
"be",
"found",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/lxc.py#L511-L570 | [
"def",
"get_configured_provider",
"(",
"vm_",
"=",
"None",
")",
":",
"if",
"vm_",
"is",
"None",
":",
"vm_",
"=",
"{",
"}",
"dalias",
",",
"driver",
"=",
"__active_provider_name__",
".",
"split",
"(",
"':'",
")",
"data",
"=",
"None",
"tgt",
"=",
"'unkno... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | write_launchd_plist | Write a launchd plist for managing salt-master or salt-minion
CLI Example:
.. code-block:: bash
salt-run launchd.write_launchd_plist salt-master | salt/runners/launchd.py | def write_launchd_plist(program):
'''
Write a launchd plist for managing salt-master or salt-minion
CLI Example:
.. code-block:: bash
salt-run launchd.write_launchd_plist salt-master
'''
plist_sample_text = '''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//D... | def write_launchd_plist(program):
'''
Write a launchd plist for managing salt-master or salt-minion
CLI Example:
.. code-block:: bash
salt-run launchd.write_launchd_plist salt-master
'''
plist_sample_text = '''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//D... | [
"Write",
"a",
"launchd",
"plist",
"for",
"managing",
"salt",
"-",
"master",
"or",
"salt",
"-",
"minion"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/launchd.py#L12-L63 | [
"def",
"write_launchd_plist",
"(",
"program",
")",
":",
"plist_sample_text",
"=",
"'''\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n <dict>\n <key>Label</key>\n ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _windows_cpudata | Return some CPU information on Windows minions | salt/grains/core.py | def _windows_cpudata():
'''
Return some CPU information on Windows minions
'''
# Provides:
# num_cpus
# cpu_model
grains = {}
if 'NUMBER_OF_PROCESSORS' in os.environ:
# Cast to int so that the logic isn't broken when used as a
# conditional in templating. Also follows... | def _windows_cpudata():
'''
Return some CPU information on Windows minions
'''
# Provides:
# num_cpus
# cpu_model
grains = {}
if 'NUMBER_OF_PROCESSORS' in os.environ:
# Cast to int so that the logic isn't broken when used as a
# conditional in templating. Also follows... | [
"Return",
"some",
"CPU",
"information",
"on",
"Windows",
"minions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L110-L129 | [
"def",
"_windows_cpudata",
"(",
")",
":",
"# Provides:",
"# num_cpus",
"# cpu_model",
"grains",
"=",
"{",
"}",
"if",
"'NUMBER_OF_PROCESSORS'",
"in",
"os",
".",
"environ",
":",
"# Cast to int so that the logic isn't broken when used as a",
"# conditional in templating. Als... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _linux_cpudata | Return some CPU information for Linux minions | salt/grains/core.py | def _linux_cpudata():
'''
Return some CPU information for Linux minions
'''
# Provides:
# num_cpus
# cpu_model
# cpu_flags
grains = {}
cpuinfo = '/proc/cpuinfo'
# Parse over the cpuinfo file
if os.path.isfile(cpuinfo):
with salt.utils.files.fopen(cpuinfo, 'r') a... | def _linux_cpudata():
'''
Return some CPU information for Linux minions
'''
# Provides:
# num_cpus
# cpu_model
# cpu_flags
grains = {}
cpuinfo = '/proc/cpuinfo'
# Parse over the cpuinfo file
if os.path.isfile(cpuinfo):
with salt.utils.files.fopen(cpuinfo, 'r') a... | [
"Return",
"some",
"CPU",
"information",
"for",
"Linux",
"minions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L132-L183 | [
"def",
"_linux_cpudata",
"(",
")",
":",
"# Provides:",
"# num_cpus",
"# cpu_model",
"# cpu_flags",
"grains",
"=",
"{",
"}",
"cpuinfo",
"=",
"'/proc/cpuinfo'",
"# Parse over the cpuinfo file",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"cpuinfo",
")",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _linux_gpu_data | num_gpus: int
gpus:
- vendor: nvidia|amd|ati|...
model: string | salt/grains/core.py | def _linux_gpu_data():
'''
num_gpus: int
gpus:
- vendor: nvidia|amd|ati|...
model: string
'''
if __opts__.get('enable_lspci', True) is False:
return {}
if __opts__.get('enable_gpu_grains', True) is False:
return {}
lspci = salt.utils.path.which('lspci')
if... | def _linux_gpu_data():
'''
num_gpus: int
gpus:
- vendor: nvidia|amd|ati|...
model: string
'''
if __opts__.get('enable_lspci', True) is False:
return {}
if __opts__.get('enable_gpu_grains', True) is False:
return {}
lspci = salt.utils.path.which('lspci')
if... | [
"num_gpus",
":",
"int",
"gpus",
":",
"-",
"vendor",
":",
"nvidia|amd|ati|",
"...",
"model",
":",
"string"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L186-L259 | [
"def",
"_linux_gpu_data",
"(",
")",
":",
"if",
"__opts__",
".",
"get",
"(",
"'enable_lspci'",
",",
"True",
")",
"is",
"False",
":",
"return",
"{",
"}",
"if",
"__opts__",
".",
"get",
"(",
"'enable_gpu_grains'",
",",
"True",
")",
"is",
"False",
":",
"ret... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _netbsd_gpu_data | num_gpus: int
gpus:
- vendor: nvidia|amd|ati|...
model: string | salt/grains/core.py | def _netbsd_gpu_data():
'''
num_gpus: int
gpus:
- vendor: nvidia|amd|ati|...
model: string
'''
known_vendors = ['nvidia', 'amd', 'ati', 'intel', 'cirrus logic', 'vmware', 'matrox', 'aspeed']
gpus = []
try:
pcictl_out = __salt__['cmd.run']('pcictl pci0 list')
f... | def _netbsd_gpu_data():
'''
num_gpus: int
gpus:
- vendor: nvidia|amd|ati|...
model: string
'''
known_vendors = ['nvidia', 'amd', 'ati', 'intel', 'cirrus logic', 'vmware', 'matrox', 'aspeed']
gpus = []
try:
pcictl_out = __salt__['cmd.run']('pcictl pci0 list')
f... | [
"num_gpus",
":",
"int",
"gpus",
":",
"-",
"vendor",
":",
"nvidia|amd|ati|",
"...",
"model",
":",
"string"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L262-L290 | [
"def",
"_netbsd_gpu_data",
"(",
")",
":",
"known_vendors",
"=",
"[",
"'nvidia'",
",",
"'amd'",
",",
"'ati'",
",",
"'intel'",
",",
"'cirrus logic'",
",",
"'vmware'",
",",
"'matrox'",
",",
"'aspeed'",
"]",
"gpus",
"=",
"[",
"]",
"try",
":",
"pcictl_out",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _osx_gpudata | num_gpus: int
gpus:
- vendor: nvidia|amd|ati|...
model: string | salt/grains/core.py | def _osx_gpudata():
'''
num_gpus: int
gpus:
- vendor: nvidia|amd|ati|...
model: string
'''
gpus = []
try:
pcictl_out = __salt__['cmd.run']('system_profiler SPDisplaysDataType')
for line in pcictl_out.splitlines():
fieldname, _, fieldval = line.partitio... | def _osx_gpudata():
'''
num_gpus: int
gpus:
- vendor: nvidia|amd|ati|...
model: string
'''
gpus = []
try:
pcictl_out = __salt__['cmd.run']('system_profiler SPDisplaysDataType')
for line in pcictl_out.splitlines():
fieldname, _, fieldval = line.partitio... | [
"num_gpus",
":",
"int",
"gpus",
":",
"-",
"vendor",
":",
"nvidia|amd|ati|",
"...",
"model",
":",
"string"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L293-L318 | [
"def",
"_osx_gpudata",
"(",
")",
":",
"gpus",
"=",
"[",
"]",
"try",
":",
"pcictl_out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'system_profiler SPDisplaysDataType'",
")",
"for",
"line",
"in",
"pcictl_out",
".",
"splitlines",
"(",
")",
":",
"fieldname",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _bsd_cpudata | Return CPU information for BSD-like systems | salt/grains/core.py | def _bsd_cpudata(osdata):
'''
Return CPU information for BSD-like systems
'''
# Provides:
# cpuarch
# num_cpus
# cpu_model
# cpu_flags
sysctl = salt.utils.path.which('sysctl')
arch = salt.utils.path.which('arch')
cmds = {}
if sysctl:
cmds.update({
... | def _bsd_cpudata(osdata):
'''
Return CPU information for BSD-like systems
'''
# Provides:
# cpuarch
# num_cpus
# cpu_model
# cpu_flags
sysctl = salt.utils.path.which('sysctl')
arch = salt.utils.path.which('arch')
cmds = {}
if sysctl:
cmds.update({
... | [
"Return",
"CPU",
"information",
"for",
"BSD",
"-",
"like",
"systems"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L321-L384 | [
"def",
"_bsd_cpudata",
"(",
"osdata",
")",
":",
"# Provides:",
"# cpuarch",
"# num_cpus",
"# cpu_model",
"# cpu_flags",
"sysctl",
"=",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'sysctl'",
")",
"arch",
"=",
"salt",
".",
"utils",
".",
"pat... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _sunos_cpudata | Return the CPU information for Solaris-like systems | salt/grains/core.py | def _sunos_cpudata():
'''
Return the CPU information for Solaris-like systems
'''
# Provides:
# cpuarch
# num_cpus
# cpu_model
# cpu_flags
grains = {}
grains['cpu_flags'] = []
grains['cpuarch'] = __salt__['cmd.run']('isainfo -k')
psrinfo = '/usr/sbin/psrinfo 2>/d... | def _sunos_cpudata():
'''
Return the CPU information for Solaris-like systems
'''
# Provides:
# cpuarch
# num_cpus
# cpu_model
# cpu_flags
grains = {}
grains['cpu_flags'] = []
grains['cpuarch'] = __salt__['cmd.run']('isainfo -k')
psrinfo = '/usr/sbin/psrinfo 2>/d... | [
"Return",
"the",
"CPU",
"information",
"for",
"Solaris",
"-",
"like",
"systems"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L387-L414 | [
"def",
"_sunos_cpudata",
"(",
")",
":",
"# Provides:",
"# cpuarch",
"# num_cpus",
"# cpu_model",
"# cpu_flags",
"grains",
"=",
"{",
"}",
"grains",
"[",
"'cpu_flags'",
"]",
"=",
"[",
"]",
"grains",
"[",
"'cpuarch'",
"]",
"=",
"__salt__",
"[",
"'cmd.run'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _aix_cpudata | Return CPU information for AIX systems | salt/grains/core.py | def _aix_cpudata():
'''
Return CPU information for AIX systems
'''
# Provides:
# cpuarch
# num_cpus
# cpu_model
# cpu_flags
grains = {}
cmd = salt.utils.path.which('prtconf')
if cmd:
data = __salt__['cmd.run']('{0}'.format(cmd)) + os.linesep
for dest, ... | def _aix_cpudata():
'''
Return CPU information for AIX systems
'''
# Provides:
# cpuarch
# num_cpus
# cpu_model
# cpu_flags
grains = {}
cmd = salt.utils.path.which('prtconf')
if cmd:
data = __salt__['cmd.run']('{0}'.format(cmd)) + os.linesep
for dest, ... | [
"Return",
"CPU",
"information",
"for",
"AIX",
"systems"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L417-L440 | [
"def",
"_aix_cpudata",
"(",
")",
":",
"# Provides:",
"# cpuarch",
"# num_cpus",
"# cpu_model",
"# cpu_flags",
"grains",
"=",
"{",
"}",
"cmd",
"=",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'prtconf'",
")",
"if",
"cmd",
":",
"data",
"="... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _linux_memdata | Return the memory information for Linux-like systems | salt/grains/core.py | def _linux_memdata():
'''
Return the memory information for Linux-like systems
'''
grains = {'mem_total': 0, 'swap_total': 0}
meminfo = '/proc/meminfo'
if os.path.isfile(meminfo):
with salt.utils.files.fopen(meminfo, 'r') as ifile:
for line in ifile:
comps = ... | def _linux_memdata():
'''
Return the memory information for Linux-like systems
'''
grains = {'mem_total': 0, 'swap_total': 0}
meminfo = '/proc/meminfo'
if os.path.isfile(meminfo):
with salt.utils.files.fopen(meminfo, 'r') as ifile:
for line in ifile:
comps = ... | [
"Return",
"the",
"memory",
"information",
"for",
"Linux",
"-",
"like",
"systems"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L443-L462 | [
"def",
"_linux_memdata",
"(",
")",
":",
"grains",
"=",
"{",
"'mem_total'",
":",
"0",
",",
"'swap_total'",
":",
"0",
"}",
"meminfo",
"=",
"'/proc/meminfo'",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"meminfo",
")",
":",
"with",
"salt",
".",
"utils",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _osx_memdata | Return the memory information for BSD-like systems | salt/grains/core.py | def _osx_memdata():
'''
Return the memory information for BSD-like systems
'''
grains = {'mem_total': 0, 'swap_total': 0}
sysctl = salt.utils.path.which('sysctl')
if sysctl:
mem = __salt__['cmd.run']('{0} -n hw.memsize'.format(sysctl))
swap_total = __salt__['cmd.run']('{0} -n vm... | def _osx_memdata():
'''
Return the memory information for BSD-like systems
'''
grains = {'mem_total': 0, 'swap_total': 0}
sysctl = salt.utils.path.which('sysctl')
if sysctl:
mem = __salt__['cmd.run']('{0} -n hw.memsize'.format(sysctl))
swap_total = __salt__['cmd.run']('{0} -n vm... | [
"Return",
"the",
"memory",
"information",
"for",
"BSD",
"-",
"like",
"systems"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L465-L485 | [
"def",
"_osx_memdata",
"(",
")",
":",
"grains",
"=",
"{",
"'mem_total'",
":",
"0",
",",
"'swap_total'",
":",
"0",
"}",
"sysctl",
"=",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'sysctl'",
")",
"if",
"sysctl",
":",
"mem",
"=",
"__salt__",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _bsd_memdata | Return the memory information for BSD-like systems | salt/grains/core.py | def _bsd_memdata(osdata):
'''
Return the memory information for BSD-like systems
'''
grains = {'mem_total': 0, 'swap_total': 0}
sysctl = salt.utils.path.which('sysctl')
if sysctl:
mem = __salt__['cmd.run']('{0} -n hw.physmem'.format(sysctl))
if osdata['kernel'] == 'NetBSD' and m... | def _bsd_memdata(osdata):
'''
Return the memory information for BSD-like systems
'''
grains = {'mem_total': 0, 'swap_total': 0}
sysctl = salt.utils.path.which('sysctl')
if sysctl:
mem = __salt__['cmd.run']('{0} -n hw.physmem'.format(sysctl))
if osdata['kernel'] == 'NetBSD' and m... | [
"Return",
"the",
"memory",
"information",
"for",
"BSD",
"-",
"like",
"systems"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L488-L511 | [
"def",
"_bsd_memdata",
"(",
"osdata",
")",
":",
"grains",
"=",
"{",
"'mem_total'",
":",
"0",
",",
"'swap_total'",
":",
"0",
"}",
"sysctl",
"=",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'sysctl'",
")",
"if",
"sysctl",
":",
"mem",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _sunos_memdata | Return the memory information for SunOS-like systems | salt/grains/core.py | def _sunos_memdata():
'''
Return the memory information for SunOS-like systems
'''
grains = {'mem_total': 0, 'swap_total': 0}
prtconf = '/usr/sbin/prtconf 2>/dev/null'
for line in __salt__['cmd.run'](prtconf, python_shell=True).splitlines():
comps = line.split(' ')
if comps[0].s... | def _sunos_memdata():
'''
Return the memory information for SunOS-like systems
'''
grains = {'mem_total': 0, 'swap_total': 0}
prtconf = '/usr/sbin/prtconf 2>/dev/null'
for line in __salt__['cmd.run'](prtconf, python_shell=True).splitlines():
comps = line.split(' ')
if comps[0].s... | [
"Return",
"the",
"memory",
"information",
"for",
"SunOS",
"-",
"like",
"systems"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L514-L535 | [
"def",
"_sunos_memdata",
"(",
")",
":",
"grains",
"=",
"{",
"'mem_total'",
":",
"0",
",",
"'swap_total'",
":",
"0",
"}",
"prtconf",
"=",
"'/usr/sbin/prtconf 2>/dev/null'",
"for",
"line",
"in",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"prtconf",
",",
"python_s... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _aix_memdata | Return the memory information for AIX systems | salt/grains/core.py | def _aix_memdata():
'''
Return the memory information for AIX systems
'''
grains = {'mem_total': 0, 'swap_total': 0}
prtconf = salt.utils.path.which('prtconf')
if prtconf:
for line in __salt__['cmd.run'](prtconf, python_shell=True).splitlines():
comps = [x for x in line.strip... | def _aix_memdata():
'''
Return the memory information for AIX systems
'''
grains = {'mem_total': 0, 'swap_total': 0}
prtconf = salt.utils.path.which('prtconf')
if prtconf:
for line in __salt__['cmd.run'](prtconf, python_shell=True).splitlines():
comps = [x for x in line.strip... | [
"Return",
"the",
"memory",
"information",
"for",
"AIX",
"systems"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L538-L563 | [
"def",
"_aix_memdata",
"(",
")",
":",
"grains",
"=",
"{",
"'mem_total'",
":",
"0",
",",
"'swap_total'",
":",
"0",
"}",
"prtconf",
"=",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'prtconf'",
")",
"if",
"prtconf",
":",
"for",
"line",
"in",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _memdata | Gather information about the system memory | salt/grains/core.py | def _memdata(osdata):
'''
Gather information about the system memory
'''
# Provides:
# mem_total
# swap_total, for supported systems.
grains = {'mem_total': 0}
if osdata['kernel'] == 'Linux':
grains.update(_linux_memdata())
elif osdata['kernel'] in ('FreeBSD', 'OpenBSD', ... | def _memdata(osdata):
'''
Gather information about the system memory
'''
# Provides:
# mem_total
# swap_total, for supported systems.
grains = {'mem_total': 0}
if osdata['kernel'] == 'Linux':
grains.update(_linux_memdata())
elif osdata['kernel'] in ('FreeBSD', 'OpenBSD', ... | [
"Gather",
"information",
"about",
"the",
"system",
"memory"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L578-L598 | [
"def",
"_memdata",
"(",
"osdata",
")",
":",
"# Provides:",
"# mem_total",
"# swap_total, for supported systems.",
"grains",
"=",
"{",
"'mem_total'",
":",
"0",
"}",
"if",
"osdata",
"[",
"'kernel'",
"]",
"==",
"'Linux'",
":",
"grains",
".",
"update",
"(",
"_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _aix_get_machine_id | Parse the output of lsattr -El sys0 for os_uuid | salt/grains/core.py | def _aix_get_machine_id():
'''
Parse the output of lsattr -El sys0 for os_uuid
'''
grains = {}
cmd = salt.utils.path.which('lsattr')
if cmd:
data = __salt__['cmd.run']('{0} -El sys0'.format(cmd)) + os.linesep
uuid_regexes = [re.compile(r'(?im)^\s*os_uuid\s+(\S+)\s+(.*)')]
... | def _aix_get_machine_id():
'''
Parse the output of lsattr -El sys0 for os_uuid
'''
grains = {}
cmd = salt.utils.path.which('lsattr')
if cmd:
data = __salt__['cmd.run']('{0} -El sys0'.format(cmd)) + os.linesep
uuid_regexes = [re.compile(r'(?im)^\s*os_uuid\s+(\S+)\s+(.*)')]
... | [
"Parse",
"the",
"output",
"of",
"lsattr",
"-",
"El",
"sys0",
"for",
"os_uuid"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L601-L617 | [
"def",
"_aix_get_machine_id",
"(",
")",
":",
"grains",
"=",
"{",
"}",
"cmd",
"=",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'lsattr'",
")",
"if",
"cmd",
":",
"data",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'{0} -El sys0'",
".",
"fo... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _windows_virtual | Returns what type of virtual hardware is under the hood, kvm or physical | salt/grains/core.py | def _windows_virtual(osdata):
'''
Returns what type of virtual hardware is under the hood, kvm or physical
'''
# Provides:
# virtual
# virtual_subtype
grains = dict()
if osdata['kernel'] != 'Windows':
return grains
grains['virtual'] = 'physical'
# It is possible tha... | def _windows_virtual(osdata):
'''
Returns what type of virtual hardware is under the hood, kvm or physical
'''
# Provides:
# virtual
# virtual_subtype
grains = dict()
if osdata['kernel'] != 'Windows':
return grains
grains['virtual'] = 'physical'
# It is possible tha... | [
"Returns",
"what",
"type",
"of",
"virtual",
"hardware",
"is",
"under",
"the",
"hood",
"kvm",
"or",
"physical"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L620-L674 | [
"def",
"_windows_virtual",
"(",
"osdata",
")",
":",
"# Provides:",
"# virtual",
"# virtual_subtype",
"grains",
"=",
"dict",
"(",
")",
"if",
"osdata",
"[",
"'kernel'",
"]",
"!=",
"'Windows'",
":",
"return",
"grains",
"grains",
"[",
"'virtual'",
"]",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _virtual | Returns what type of virtual hardware is under the hood, kvm or physical | salt/grains/core.py | def _virtual(osdata):
'''
Returns what type of virtual hardware is under the hood, kvm or physical
'''
# This is going to be a monster, if you are running a vm you can test this
# grain with please submit patches!
# Provides:
# virtual
# virtual_subtype
grains = {'virtual': 'phys... | def _virtual(osdata):
'''
Returns what type of virtual hardware is under the hood, kvm or physical
'''
# This is going to be a monster, if you are running a vm you can test this
# grain with please submit patches!
# Provides:
# virtual
# virtual_subtype
grains = {'virtual': 'phys... | [
"Returns",
"what",
"type",
"of",
"virtual",
"hardware",
"is",
"under",
"the",
"hood",
"kvm",
"or",
"physical"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L677-L1068 | [
"def",
"_virtual",
"(",
"osdata",
")",
":",
"# This is going to be a monster, if you are running a vm you can test this",
"# grain with please submit patches!",
"# Provides:",
"# virtual",
"# virtual_subtype",
"grains",
"=",
"{",
"'virtual'",
":",
"'physical'",
"}",
"# Skip t... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _virtual_hv | Returns detailed hypervisor information from sysfs
Currently this seems to be used only by Xen | salt/grains/core.py | def _virtual_hv(osdata):
'''
Returns detailed hypervisor information from sysfs
Currently this seems to be used only by Xen
'''
grains = {}
# Bail early if we're not running on Xen
try:
if 'xen' not in osdata['virtual']:
return grains
except KeyError:
return ... | def _virtual_hv(osdata):
'''
Returns detailed hypervisor information from sysfs
Currently this seems to be used only by Xen
'''
grains = {}
# Bail early if we're not running on Xen
try:
if 'xen' not in osdata['virtual']:
return grains
except KeyError:
return ... | [
"Returns",
"detailed",
"hypervisor",
"information",
"from",
"sysfs",
"Currently",
"this",
"seems",
"to",
"be",
"used",
"only",
"by",
"Xen"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L1071-L1125 | [
"def",
"_virtual_hv",
"(",
"osdata",
")",
":",
"grains",
"=",
"{",
"}",
"# Bail early if we're not running on Xen",
"try",
":",
"if",
"'xen'",
"not",
"in",
"osdata",
"[",
"'virtual'",
"]",
":",
"return",
"grains",
"except",
"KeyError",
":",
"return",
"grains",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _ps | Return the ps grain | salt/grains/core.py | def _ps(osdata):
'''
Return the ps grain
'''
grains = {}
bsd_choices = ('FreeBSD', 'NetBSD', 'OpenBSD', 'MacOS')
if osdata['os'] in bsd_choices:
grains['ps'] = 'ps auxwww'
elif osdata['os_family'] == 'Solaris':
grains['ps'] = '/usr/ucb/ps auxwww'
elif osdata['os'] == 'Win... | def _ps(osdata):
'''
Return the ps grain
'''
grains = {}
bsd_choices = ('FreeBSD', 'NetBSD', 'OpenBSD', 'MacOS')
if osdata['os'] in bsd_choices:
grains['ps'] = 'ps auxwww'
elif osdata['os_family'] == 'Solaris':
grains['ps'] = '/usr/ucb/ps auxwww'
elif osdata['os'] == 'Win... | [
"Return",
"the",
"ps",
"grain"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L1128-L1152 | [
"def",
"_ps",
"(",
"osdata",
")",
":",
"grains",
"=",
"{",
"}",
"bsd_choices",
"=",
"(",
"'FreeBSD'",
",",
"'NetBSD'",
",",
"'OpenBSD'",
",",
"'MacOS'",
")",
"if",
"osdata",
"[",
"'os'",
"]",
"in",
"bsd_choices",
":",
"grains",
"[",
"'ps'",
"]",
"=",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _clean_value | Clean out well-known bogus values.
If it isn't clean (for example has value 'None'), return None.
Otherwise, return the original value.
NOTE: This logic also exists in the smbios module. This function is
for use when not using smbios to retrieve the value. | salt/grains/core.py | def _clean_value(key, val):
'''
Clean out well-known bogus values.
If it isn't clean (for example has value 'None'), return None.
Otherwise, return the original value.
NOTE: This logic also exists in the smbios module. This function is
for use when not using smbios to retrieve the value.
... | def _clean_value(key, val):
'''
Clean out well-known bogus values.
If it isn't clean (for example has value 'None'), return None.
Otherwise, return the original value.
NOTE: This logic also exists in the smbios module. This function is
for use when not using smbios to retrieve the value.
... | [
"Clean",
"out",
"well",
"-",
"known",
"bogus",
"values",
".",
"If",
"it",
"isn",
"t",
"clean",
"(",
"for",
"example",
"has",
"value",
"None",
")",
"return",
"None",
".",
"Otherwise",
"return",
"the",
"original",
"value",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L1155-L1197 | [
"def",
"_clean_value",
"(",
"key",
",",
"val",
")",
":",
"if",
"(",
"val",
"is",
"None",
"or",
"not",
"val",
"or",
"re",
".",
"match",
"(",
"'none'",
",",
"val",
",",
"flags",
"=",
"re",
".",
"IGNORECASE",
")",
")",
":",
"return",
"None",
"elif",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _windows_platform_data | Use the platform module for as much as we can. | salt/grains/core.py | def _windows_platform_data():
'''
Use the platform module for as much as we can.
'''
# Provides:
# kernelrelease
# kernelversion
# osversion
# osrelease
# osservicepack
# osmanufacturer
# manufacturer
# productname
# biosversion
# ser... | def _windows_platform_data():
'''
Use the platform module for as much as we can.
'''
# Provides:
# kernelrelease
# kernelversion
# osversion
# osrelease
# osservicepack
# osmanufacturer
# manufacturer
# productname
# biosversion
# ser... | [
"Use",
"the",
"platform",
"module",
"for",
"as",
"much",
"as",
"we",
"can",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L1200-L1319 | [
"def",
"_windows_platform_data",
"(",
")",
":",
"# Provides:",
"# kernelrelease",
"# kernelversion",
"# osversion",
"# osrelease",
"# osservicepack",
"# osmanufacturer",
"# manufacturer",
"# productname",
"# biosversion",
"# serialnumber",
"# osfullna... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _osx_platform_data | Additional data for macOS systems
Returns: A dictionary containing values for the following:
- model_name
- boot_rom_version
- smc_version
- system_serialnumber | salt/grains/core.py | def _osx_platform_data():
'''
Additional data for macOS systems
Returns: A dictionary containing values for the following:
- model_name
- boot_rom_version
- smc_version
- system_serialnumber
'''
cmd = 'system_profiler SPHardwareDataType'
hardware = __salt__['cmd.r... | def _osx_platform_data():
'''
Additional data for macOS systems
Returns: A dictionary containing values for the following:
- model_name
- boot_rom_version
- smc_version
- system_serialnumber
'''
cmd = 'system_profiler SPHardwareDataType'
hardware = __salt__['cmd.r... | [
"Additional",
"data",
"for",
"macOS",
"systems",
"Returns",
":",
"A",
"dictionary",
"containing",
"values",
"for",
"the",
"following",
":",
"-",
"model_name",
"-",
"boot_rom_version",
"-",
"smc_version",
"-",
"system_serialnumber"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L1322-L1350 | [
"def",
"_osx_platform_data",
"(",
")",
":",
"cmd",
"=",
"'system_profiler SPHardwareDataType'",
"hardware",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
")",
"grains",
"=",
"{",
"}",
"for",
"line",
"in",
"hardware",
".",
"splitlines",
"(",
")",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _linux_bin_exists | Does a binary exist in linux (depends on which, type, or whereis) | salt/grains/core.py | def _linux_bin_exists(binary):
'''
Does a binary exist in linux (depends on which, type, or whereis)
'''
for search_cmd in ('which', 'type -ap'):
try:
return __salt__['cmd.retcode'](
'{0} {1}'.format(search_cmd, binary)
) == 0
except salt.exception... | def _linux_bin_exists(binary):
'''
Does a binary exist in linux (depends on which, type, or whereis)
'''
for search_cmd in ('which', 'type -ap'):
try:
return __salt__['cmd.retcode'](
'{0} {1}'.format(search_cmd, binary)
) == 0
except salt.exception... | [
"Does",
"a",
"binary",
"exist",
"in",
"linux",
"(",
"depends",
"on",
"which",
"type",
"or",
"whereis",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L1483-L1500 | [
"def",
"_linux_bin_exists",
"(",
"binary",
")",
":",
"for",
"search_cmd",
"in",
"(",
"'which'",
",",
"'type -ap'",
")",
":",
"try",
":",
"return",
"__salt__",
"[",
"'cmd.retcode'",
"]",
"(",
"'{0} {1}'",
".",
"format",
"(",
"search_cmd",
",",
"binary",
")"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_os_release | Parse os-release and return a parameter dictionary
See http://www.freedesktop.org/software/systemd/man/os-release.html
for specification of the file format. | salt/grains/core.py | def _parse_os_release(*os_release_files):
'''
Parse os-release and return a parameter dictionary
See http://www.freedesktop.org/software/systemd/man/os-release.html
for specification of the file format.
'''
ret = {}
for filename in os_release_files:
try:
with salt.utils.... | def _parse_os_release(*os_release_files):
'''
Parse os-release and return a parameter dictionary
See http://www.freedesktop.org/software/systemd/man/os-release.html
for specification of the file format.
'''
ret = {}
for filename in os_release_files:
try:
with salt.utils.... | [
"Parse",
"os",
"-",
"release",
"and",
"return",
"a",
"parameter",
"dictionary"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L1532-L1556 | [
"def",
"_parse_os_release",
"(",
"*",
"os_release_files",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"filename",
"in",
"os_release_files",
":",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"filename",
")",
"as",
"ifile",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_cpe_name | Parse CPE_NAME data from the os-release
Info: https://csrc.nist.gov/projects/security-content-automation-protocol/scap-specifications/cpe
:param cpe:
:return: | salt/grains/core.py | def _parse_cpe_name(cpe):
'''
Parse CPE_NAME data from the os-release
Info: https://csrc.nist.gov/projects/security-content-automation-protocol/scap-specifications/cpe
:param cpe:
:return:
'''
part = {
'o': 'operating system',
'h': 'hardware',
'a': 'application',
... | def _parse_cpe_name(cpe):
'''
Parse CPE_NAME data from the os-release
Info: https://csrc.nist.gov/projects/security-content-automation-protocol/scap-specifications/cpe
:param cpe:
:return:
'''
part = {
'o': 'operating system',
'h': 'hardware',
'a': 'application',
... | [
"Parse",
"CPE_NAME",
"data",
"from",
"the",
"os",
"-",
"release"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L1559-L1584 | [
"def",
"_parse_cpe_name",
"(",
"cpe",
")",
":",
"part",
"=",
"{",
"'o'",
":",
"'operating system'",
",",
"'h'",
":",
"'hardware'",
",",
"'a'",
":",
"'application'",
",",
"}",
"ret",
"=",
"{",
"}",
"cpe",
"=",
"(",
"cpe",
"or",
"''",
")",
".",
"spli... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | os_data | Return grains pertaining to the operating system | salt/grains/core.py | def os_data():
'''
Return grains pertaining to the operating system
'''
grains = {
'num_gpus': 0,
'gpus': [],
}
# Windows Server 2008 64-bit
# ('Windows', 'MINIONNAME', '2008ServerR2', '6.1.7601', 'AMD64',
# 'Intel64 Fam ily 6 Model 23 Stepping 6, GenuineIntel')
... | def os_data():
'''
Return grains pertaining to the operating system
'''
grains = {
'num_gpus': 0,
'gpus': [],
}
# Windows Server 2008 64-bit
# ('Windows', 'MINIONNAME', '2008ServerR2', '6.1.7601', 'AMD64',
# 'Intel64 Fam ily 6 Model 23 Stepping 6, GenuineIntel')
... | [
"Return",
"grains",
"pertaining",
"to",
"the",
"operating",
"system"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L1587-L2084 | [
"def",
"os_data",
"(",
")",
":",
"grains",
"=",
"{",
"'num_gpus'",
":",
"0",
",",
"'gpus'",
":",
"[",
"]",
",",
"}",
"# Windows Server 2008 64-bit",
"# ('Windows', 'MINIONNAME', '2008ServerR2', '6.1.7601', 'AMD64',",
"# 'Intel64 Fam ily 6 Model 23 Stepping 6, GenuineIntel')"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | locale_info | Provides
defaultlanguage
defaultencoding | salt/grains/core.py | def locale_info():
'''
Provides
defaultlanguage
defaultencoding
'''
grains = {}
grains['locale_info'] = {}
if salt.utils.platform.is_proxy():
return grains
try:
(
grains['locale_info']['defaultlanguage'],
grains['locale_info']['defaul... | def locale_info():
'''
Provides
defaultlanguage
defaultencoding
'''
grains = {}
grains['locale_info'] = {}
if salt.utils.platform.is_proxy():
return grains
try:
(
grains['locale_info']['defaultlanguage'],
grains['locale_info']['defaul... | [
"Provides",
"defaultlanguage",
"defaultencoding"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L2087-L2112 | [
"def",
"locale_info",
"(",
")",
":",
"grains",
"=",
"{",
"}",
"grains",
"[",
"'locale_info'",
"]",
"=",
"{",
"}",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_proxy",
"(",
")",
":",
"return",
"grains",
"try",
":",
"(",
"grains",
"[",
"'loc... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | hostname | Return fqdn, hostname, domainname | salt/grains/core.py | def hostname():
'''
Return fqdn, hostname, domainname
'''
# This is going to need some work
# Provides:
# fqdn
# host
# localhost
# domain
global __FQDN__
grains = {}
if salt.utils.platform.is_proxy():
return grains
grains['localhost'] = socket.getho... | def hostname():
'''
Return fqdn, hostname, domainname
'''
# This is going to need some work
# Provides:
# fqdn
# host
# localhost
# domain
global __FQDN__
grains = {}
if salt.utils.platform.is_proxy():
return grains
grains['localhost'] = socket.getho... | [
"Return",
"fqdn",
"hostname",
"domainname"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L2115-L2146 | [
"def",
"hostname",
"(",
")",
":",
"# This is going to need some work",
"# Provides:",
"# fqdn",
"# host",
"# localhost",
"# domain",
"global",
"__FQDN__",
"grains",
"=",
"{",
"}",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_proxy",
"(",
")",
":... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | append_domain | Return append_domain if set | salt/grains/core.py | def append_domain():
'''
Return append_domain if set
'''
grain = {}
if salt.utils.platform.is_proxy():
return grain
if 'append_domain' in __opts__:
grain['append_domain'] = __opts__['append_domain']
return grain | def append_domain():
'''
Return append_domain if set
'''
grain = {}
if salt.utils.platform.is_proxy():
return grain
if 'append_domain' in __opts__:
grain['append_domain'] = __opts__['append_domain']
return grain | [
"Return",
"append_domain",
"if",
"set"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L2149-L2161 | [
"def",
"append_domain",
"(",
")",
":",
"grain",
"=",
"{",
"}",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_proxy",
"(",
")",
":",
"return",
"grain",
"if",
"'append_domain'",
"in",
"__opts__",
":",
"grain",
"[",
"'append_domain'",
"]",
"=",
"_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | fqdns | Return all known FQDNs for the system by enumerating all interfaces and
then trying to reverse resolve them (excluding 'lo' interface). | salt/grains/core.py | def fqdns():
'''
Return all known FQDNs for the system by enumerating all interfaces and
then trying to reverse resolve them (excluding 'lo' interface).
'''
# Provides:
# fqdns
grains = {}
fqdns = set()
addresses = salt.utils.network.ip_addrs(include_loopback=False, interface_data=... | def fqdns():
'''
Return all known FQDNs for the system by enumerating all interfaces and
then trying to reverse resolve them (excluding 'lo' interface).
'''
# Provides:
# fqdns
grains = {}
fqdns = set()
addresses = salt.utils.network.ip_addrs(include_loopback=False, interface_data=... | [
"Return",
"all",
"known",
"FQDNs",
"for",
"the",
"system",
"by",
"enumerating",
"all",
"interfaces",
"and",
"then",
"trying",
"to",
"reverse",
"resolve",
"them",
"(",
"excluding",
"lo",
"interface",
")",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L2164-L2191 | [
"def",
"fqdns",
"(",
")",
":",
"# Provides:",
"# fqdns",
"grains",
"=",
"{",
"}",
"fqdns",
"=",
"set",
"(",
")",
"addresses",
"=",
"salt",
".",
"utils",
".",
"network",
".",
"ip_addrs",
"(",
"include_loopback",
"=",
"False",
",",
"interface_data",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ip_fqdn | Return ip address and FQDN grains | salt/grains/core.py | def ip_fqdn():
'''
Return ip address and FQDN grains
'''
if salt.utils.platform.is_proxy():
return {}
ret = {}
ret['ipv4'] = salt.utils.network.ip_addrs(include_loopback=True)
ret['ipv6'] = salt.utils.network.ip_addrs6(include_loopback=True)
_fqdn = hostname()['fqdn']
for s... | def ip_fqdn():
'''
Return ip address and FQDN grains
'''
if salt.utils.platform.is_proxy():
return {}
ret = {}
ret['ipv4'] = salt.utils.network.ip_addrs(include_loopback=True)
ret['ipv6'] = salt.utils.network.ip_addrs6(include_loopback=True)
_fqdn = hostname()['fqdn']
for s... | [
"Return",
"ip",
"address",
"and",
"FQDN",
"grains"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L2194-L2226 | [
"def",
"ip_fqdn",
"(",
")",
":",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_proxy",
"(",
")",
":",
"return",
"{",
"}",
"ret",
"=",
"{",
"}",
"ret",
"[",
"'ipv4'",
"]",
"=",
"salt",
".",
"utils",
".",
"network",
".",
"ip_addrs",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ip_interfaces | Provide a dict of the connected interfaces and their ip addresses
The addresses will be passed as a list for each interface | salt/grains/core.py | def ip_interfaces():
'''
Provide a dict of the connected interfaces and their ip addresses
The addresses will be passed as a list for each interface
'''
# Provides:
# ip_interfaces
if salt.utils.platform.is_proxy():
return {}
ret = {}
ifaces = _get_interfaces()
for fa... | def ip_interfaces():
'''
Provide a dict of the connected interfaces and their ip addresses
The addresses will be passed as a list for each interface
'''
# Provides:
# ip_interfaces
if salt.utils.platform.is_proxy():
return {}
ret = {}
ifaces = _get_interfaces()
for fa... | [
"Provide",
"a",
"dict",
"of",
"the",
"connected",
"interfaces",
"and",
"their",
"ip",
"addresses",
"The",
"addresses",
"will",
"be",
"passed",
"as",
"a",
"list",
"for",
"each",
"interface"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L2229-L2254 | [
"def",
"ip_interfaces",
"(",
")",
":",
"# Provides:",
"# ip_interfaces",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_proxy",
"(",
")",
":",
"return",
"{",
"}",
"ret",
"=",
"{",
"}",
"ifaces",
"=",
"_get_interfaces",
"(",
")",
"for",
"face",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | hwaddr_interfaces | Provide a dict of the connected interfaces and their
hw addresses (Mac Address) | salt/grains/core.py | def hwaddr_interfaces():
'''
Provide a dict of the connected interfaces and their
hw addresses (Mac Address)
'''
# Provides:
# hwaddr_interfaces
ret = {}
ifaces = _get_interfaces()
for face in ifaces:
if 'hwaddr' in ifaces[face]:
ret[face] = ifaces[face]['hwaddr... | def hwaddr_interfaces():
'''
Provide a dict of the connected interfaces and their
hw addresses (Mac Address)
'''
# Provides:
# hwaddr_interfaces
ret = {}
ifaces = _get_interfaces()
for face in ifaces:
if 'hwaddr' in ifaces[face]:
ret[face] = ifaces[face]['hwaddr... | [
"Provide",
"a",
"dict",
"of",
"the",
"connected",
"interfaces",
"and",
"their",
"hw",
"addresses",
"(",
"Mac",
"Address",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L2307-L2319 | [
"def",
"hwaddr_interfaces",
"(",
")",
":",
"# Provides:",
"# hwaddr_interfaces",
"ret",
"=",
"{",
"}",
"ifaces",
"=",
"_get_interfaces",
"(",
")",
"for",
"face",
"in",
"ifaces",
":",
"if",
"'hwaddr'",
"in",
"ifaces",
"[",
"face",
"]",
":",
"ret",
"[",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | dns | Parse the resolver configuration file
.. versionadded:: 2016.3.0 | salt/grains/core.py | def dns():
'''
Parse the resolver configuration file
.. versionadded:: 2016.3.0
'''
# Provides:
# dns
if salt.utils.platform.is_windows() or 'proxyminion' in __opts__:
return {}
resolv = salt.utils.dns.parse_resolv()
for key in ('nameservers', 'ip4_nameservers', 'ip6_nam... | def dns():
'''
Parse the resolver configuration file
.. versionadded:: 2016.3.0
'''
# Provides:
# dns
if salt.utils.platform.is_windows() or 'proxyminion' in __opts__:
return {}
resolv = salt.utils.dns.parse_resolv()
for key in ('nameservers', 'ip4_nameservers', 'ip6_nam... | [
"Parse",
"the",
"resolver",
"configuration",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L2322-L2339 | [
"def",
"dns",
"(",
")",
":",
"# Provides:",
"# dns",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
"or",
"'proxyminion'",
"in",
"__opts__",
":",
"return",
"{",
"}",
"resolv",
"=",
"salt",
".",
"utils",
".",
"dns",
".",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_machine_id | Provide the machine-id for machine/virtualization combination | salt/grains/core.py | def get_machine_id():
'''
Provide the machine-id for machine/virtualization combination
'''
# Provides:
# machine-id
if platform.system() == 'AIX':
return _aix_get_machine_id()
locations = ['/etc/machine-id', '/var/lib/dbus/machine-id']
existing_locations = [loc for loc in loc... | def get_machine_id():
'''
Provide the machine-id for machine/virtualization combination
'''
# Provides:
# machine-id
if platform.system() == 'AIX':
return _aix_get_machine_id()
locations = ['/etc/machine-id', '/var/lib/dbus/machine-id']
existing_locations = [loc for loc in loc... | [
"Provide",
"the",
"machine",
"-",
"id",
"for",
"machine",
"/",
"virtualization",
"combination"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L2342-L2357 | [
"def",
"get_machine_id",
"(",
")",
":",
"# Provides:",
"# machine-id",
"if",
"platform",
".",
"system",
"(",
")",
"==",
"'AIX'",
":",
"return",
"_aix_get_machine_id",
"(",
")",
"locations",
"=",
"[",
"'/etc/machine-id'",
",",
"'/var/lib/dbus/machine-id'",
"]",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | saltpath | Return the path of the salt module | salt/grains/core.py | def saltpath():
'''
Return the path of the salt module
'''
# Provides:
# saltpath
salt_path = os.path.abspath(os.path.join(__file__, os.path.pardir))
return {'saltpath': os.path.dirname(salt_path)} | def saltpath():
'''
Return the path of the salt module
'''
# Provides:
# saltpath
salt_path = os.path.abspath(os.path.join(__file__, os.path.pardir))
return {'saltpath': os.path.dirname(salt_path)} | [
"Return",
"the",
"path",
"of",
"the",
"salt",
"module"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L2403-L2410 | [
"def",
"saltpath",
"(",
")",
":",
"# Provides:",
"# saltpath",
"salt_path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"__file__",
",",
"os",
".",
"path",
".",
"pardir",
")",
")",
"return",
"{",
"'saltpath'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _hw_data | Get system specific hardware data from dmidecode
Provides
biosversion
productname
manufacturer
serialnumber
biosreleasedate
uuid
.. versionadded:: 0.9.5 | salt/grains/core.py | def _hw_data(osdata):
'''
Get system specific hardware data from dmidecode
Provides
biosversion
productname
manufacturer
serialnumber
biosreleasedate
uuid
.. versionadded:: 0.9.5
'''
if salt.utils.platform.is_proxy():
return {}
grai... | def _hw_data(osdata):
'''
Get system specific hardware data from dmidecode
Provides
biosversion
productname
manufacturer
serialnumber
biosreleasedate
uuid
.. versionadded:: 0.9.5
'''
if salt.utils.platform.is_proxy():
return {}
grai... | [
"Get",
"system",
"specific",
"hardware",
"data",
"from",
"dmidecode"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L2448-L2737 | [
"def",
"_hw_data",
"(",
"osdata",
")",
":",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_proxy",
"(",
")",
":",
"return",
"{",
"}",
"grains",
"=",
"{",
"}",
"if",
"osdata",
"[",
"'kernel'",
"]",
"==",
"'Linux'",
"and",
"os",
".",
"path",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_hash_by_shell | Shell-out Python 3 for compute reliable hash
:return: | salt/grains/core.py | def _get_hash_by_shell():
'''
Shell-out Python 3 for compute reliable hash
:return:
'''
id_ = __opts__.get('id', '')
id_hash = None
py_ver = sys.version_info[:2]
if py_ver >= (3, 3):
# Python 3.3 enabled hash randomization, so we need to shell out to get
# a reliable hash... | def _get_hash_by_shell():
'''
Shell-out Python 3 for compute reliable hash
:return:
'''
id_ = __opts__.get('id', '')
id_hash = None
py_ver = sys.version_info[:2]
if py_ver >= (3, 3):
# Python 3.3 enabled hash randomization, so we need to shell out to get
# a reliable hash... | [
"Shell",
"-",
"out",
"Python",
"3",
"for",
"compute",
"reliable",
"hash",
":",
"return",
":"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L2740-L2762 | [
"def",
"_get_hash_by_shell",
"(",
")",
":",
"id_",
"=",
"__opts__",
".",
"get",
"(",
"'id'",
",",
"''",
")",
"id_hash",
"=",
"None",
"py_ver",
"=",
"sys",
".",
"version_info",
"[",
":",
"2",
"]",
"if",
"py_ver",
">=",
"(",
"3",
",",
"3",
")",
":"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_server_id | Provides an integer based on the FQDN of a machine.
Useful as server-id in MySQL replication or anywhere else you'll need an ID
like this. | salt/grains/core.py | def get_server_id():
'''
Provides an integer based on the FQDN of a machine.
Useful as server-id in MySQL replication or anywhere else you'll need an ID
like this.
'''
# Provides:
# server_id
if salt.utils.platform.is_proxy():
server_id = {}
else:
use_crc = __opts_... | def get_server_id():
'''
Provides an integer based on the FQDN of a machine.
Useful as server-id in MySQL replication or anywhere else you'll need an ID
like this.
'''
# Provides:
# server_id
if salt.utils.platform.is_proxy():
server_id = {}
else:
use_crc = __opts_... | [
"Provides",
"an",
"integer",
"based",
"on",
"the",
"FQDN",
"of",
"a",
"machine",
".",
"Useful",
"as",
"server",
"-",
"id",
"in",
"MySQL",
"replication",
"or",
"anywhere",
"else",
"you",
"ll",
"need",
"an",
"ID",
"like",
"this",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L2765-L2788 | [
"def",
"get_server_id",
"(",
")",
":",
"# Provides:",
"# server_id",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_proxy",
"(",
")",
":",
"server_id",
"=",
"{",
"}",
"else",
":",
"use_crc",
"=",
"__opts__",
".",
"get",
"(",
"'server_id_use_crc'",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | default_gateway | Populates grains which describe whether a server has a default gateway
configured or not. Uses `ip -4 route show` and `ip -6 route show` and greps
for a `default` at the beginning of any line. Assuming the standard
`default via <ip>` format for default gateways, it will also parse out the
ip address of ... | salt/grains/core.py | def default_gateway():
'''
Populates grains which describe whether a server has a default gateway
configured or not. Uses `ip -4 route show` and `ip -6 route show` and greps
for a `default` at the beginning of any line. Assuming the standard
`default via <ip>` format for default gateways, it will al... | def default_gateway():
'''
Populates grains which describe whether a server has a default gateway
configured or not. Uses `ip -4 route show` and `ip -6 route show` and greps
for a `default` at the beginning of any line. Assuming the standard
`default via <ip>` format for default gateways, it will al... | [
"Populates",
"grains",
"which",
"describe",
"whether",
"a",
"server",
"has",
"a",
"default",
"gateway",
"configured",
"or",
"not",
".",
"Uses",
"ip",
"-",
"4",
"route",
"show",
"and",
"ip",
"-",
"6",
"route",
"show",
"and",
"greps",
"for",
"a",
"default"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L2801-L2844 | [
"def",
"default_gateway",
"(",
")",
":",
"grains",
"=",
"{",
"}",
"ip_bin",
"=",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'ip'",
")",
"if",
"not",
"ip_bin",
":",
"return",
"{",
"}",
"grains",
"[",
"'ip_gw'",
"]",
"=",
"False",
"grains... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | kernelparams | Return the kernel boot parameters | salt/grains/core.py | def kernelparams():
'''
Return the kernel boot parameters
'''
if salt.utils.platform.is_windows():
# TODO: add grains using `bcdedit /enum {current}`
return {}
else:
try:
with salt.utils.files.fopen('/proc/cmdline', 'r') as fhr:
cmdline = fhr.read(... | def kernelparams():
'''
Return the kernel boot parameters
'''
if salt.utils.platform.is_windows():
# TODO: add grains using `bcdedit /enum {current}`
return {}
else:
try:
with salt.utils.files.fopen('/proc/cmdline', 'r') as fhr:
cmdline = fhr.read(... | [
"Return",
"the",
"kernel",
"boot",
"parameters"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L2847-L2869 | [
"def",
"kernelparams",
"(",
")",
":",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"# TODO: add grains using `bcdedit /enum {current}`",
"return",
"{",
"}",
"else",
":",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _table_attrs | Helper function to find valid table attributes | salt/modules/osquery.py | def _table_attrs(table):
'''
Helper function to find valid table attributes
'''
cmd = ['osqueryi'] + ['--json'] + ['pragma table_info({0})'.format(table)]
res = __salt__['cmd.run_all'](cmd)
if res['retcode'] == 0:
attrs = []
text = salt.utils.json.loads(res['stdout'])
for... | def _table_attrs(table):
'''
Helper function to find valid table attributes
'''
cmd = ['osqueryi'] + ['--json'] + ['pragma table_info({0})'.format(table)]
res = __salt__['cmd.run_all'](cmd)
if res['retcode'] == 0:
attrs = []
text = salt.utils.json.loads(res['stdout'])
for... | [
"Helper",
"function",
"to",
"find",
"valid",
"table",
"attributes"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/osquery.py#L36-L48 | [
"def",
"_table_attrs",
"(",
"table",
")",
":",
"cmd",
"=",
"[",
"'osqueryi'",
"]",
"+",
"[",
"'--json'",
"]",
"+",
"[",
"'pragma table_info({0})'",
".",
"format",
"(",
"table",
")",
"]",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
")... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _osquery | Helper function to run raw osquery queries | salt/modules/osquery.py | def _osquery(sql, format='json'):
'''
Helper function to run raw osquery queries
'''
ret = {
'result': True,
}
cmd = ['osqueryi'] + ['--json'] + [sql]
res = __salt__['cmd.run_all'](cmd)
if res['stderr']:
ret['result'] = False
ret['error'] = res['stderr']
else... | def _osquery(sql, format='json'):
'''
Helper function to run raw osquery queries
'''
ret = {
'result': True,
}
cmd = ['osqueryi'] + ['--json'] + [sql]
res = __salt__['cmd.run_all'](cmd)
if res['stderr']:
ret['result'] = False
ret['error'] = res['stderr']
else... | [
"Helper",
"function",
"to",
"run",
"raw",
"osquery",
"queries"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/osquery.py#L51-L67 | [
"def",
"_osquery",
"(",
"sql",
",",
"format",
"=",
"'json'",
")",
":",
"ret",
"=",
"{",
"'result'",
":",
"True",
",",
"}",
"cmd",
"=",
"[",
"'osqueryi'",
"]",
"+",
"[",
"'--json'",
"]",
"+",
"[",
"sql",
"]",
"res",
"=",
"__salt__",
"[",
"'cmd.run... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _osquery_cmd | Helper function to run osquery queries | salt/modules/osquery.py | def _osquery_cmd(table, attrs=None, where=None, format='json'):
'''
Helper function to run osquery queries
'''
ret = {
'result': True,
}
if attrs:
if isinstance(attrs, list):
valid_attrs = _table_attrs(table)
if valid_attrs:
for a in attrs... | def _osquery_cmd(table, attrs=None, where=None, format='json'):
'''
Helper function to run osquery queries
'''
ret = {
'result': True,
}
if attrs:
if isinstance(attrs, list):
valid_attrs = _table_attrs(table)
if valid_attrs:
for a in attrs... | [
"Helper",
"function",
"to",
"run",
"osquery",
"queries"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/osquery.py#L70-L111 | [
"def",
"_osquery_cmd",
"(",
"table",
",",
"attrs",
"=",
"None",
",",
"where",
"=",
"None",
",",
"format",
"=",
"'json'",
")",
":",
"ret",
"=",
"{",
"'result'",
":",
"True",
",",
"}",
"if",
"attrs",
":",
"if",
"isinstance",
"(",
"attrs",
",",
"list"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | version | Return version of osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.version | salt/modules/osquery.py | def version():
'''
Return version of osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.version
'''
_false_return = {'result': False,
'comment': 'OSQuery version unavailable.'}
res = _osquery_cmd(table='osquery_info', attrs=['version'])
if 'result'... | def version():
'''
Return version of osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.version
'''
_false_return = {'result': False,
'comment': 'OSQuery version unavailable.'}
res = _osquery_cmd(table='osquery_info', attrs=['version'])
if 'result'... | [
"Return",
"version",
"of",
"osquery"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/osquery.py#L114-L130 | [
"def",
"version",
"(",
")",
":",
"_false_return",
"=",
"{",
"'result'",
":",
"False",
",",
"'comment'",
":",
"'OSQuery version unavailable.'",
"}",
"res",
"=",
"_osquery_cmd",
"(",
"table",
"=",
"'osquery_info'",
",",
"attrs",
"=",
"[",
"'version'",
"]",
")"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | rpm_packages | Return cpuid information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.rpm_packages | salt/modules/osquery.py | def rpm_packages(attrs=None, where=None):
'''
Return cpuid information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.rpm_packages
'''
if __grains__['os_family'] == 'RedHat':
return _osquery_cmd(table='rpm_packages', attrs=attrs, where=where)
return {'resu... | def rpm_packages(attrs=None, where=None):
'''
Return cpuid information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.rpm_packages
'''
if __grains__['os_family'] == 'RedHat':
return _osquery_cmd(table='rpm_packages', attrs=attrs, where=where)
return {'resu... | [
"Return",
"cpuid",
"information",
"from",
"osquery"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/osquery.py#L133-L146 | [
"def",
"rpm_packages",
"(",
"attrs",
"=",
"None",
",",
"where",
"=",
"None",
")",
":",
"if",
"__grains__",
"[",
"'os_family'",
"]",
"==",
"'RedHat'",
":",
"return",
"_osquery_cmd",
"(",
"table",
"=",
"'rpm_packages'",
",",
"attrs",
"=",
"attrs",
",",
"wh... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | kernel_integrity | Return kernel_integrity information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.kernel_integrity | salt/modules/osquery.py | def kernel_integrity(attrs=None, where=None):
'''
Return kernel_integrity information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.kernel_integrity
'''
if __grains__['os_family'] in ['RedHat', 'Debian']:
return _osquery_cmd(table='kernel_integrity', attrs=at... | def kernel_integrity(attrs=None, where=None):
'''
Return kernel_integrity information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.kernel_integrity
'''
if __grains__['os_family'] in ['RedHat', 'Debian']:
return _osquery_cmd(table='kernel_integrity', attrs=at... | [
"Return",
"kernel_integrity",
"information",
"from",
"osquery"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/osquery.py#L149-L161 | [
"def",
"kernel_integrity",
"(",
"attrs",
"=",
"None",
",",
"where",
"=",
"None",
")",
":",
"if",
"__grains__",
"[",
"'os_family'",
"]",
"in",
"[",
"'RedHat'",
",",
"'Debian'",
"]",
":",
"return",
"_osquery_cmd",
"(",
"table",
"=",
"'kernel_integrity'",
","... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | kernel_modules | Return kernel_modules information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.kernel_modules | salt/modules/osquery.py | def kernel_modules(attrs=None, where=None):
'''
Return kernel_modules information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.kernel_modules
'''
if __grains__['os_family'] in ['RedHat', 'Debian']:
return _osquery_cmd(table='kernel_modules', attrs=attrs, whe... | def kernel_modules(attrs=None, where=None):
'''
Return kernel_modules information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.kernel_modules
'''
if __grains__['os_family'] in ['RedHat', 'Debian']:
return _osquery_cmd(table='kernel_modules', attrs=attrs, whe... | [
"Return",
"kernel_modules",
"information",
"from",
"osquery"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/osquery.py#L164-L176 | [
"def",
"kernel_modules",
"(",
"attrs",
"=",
"None",
",",
"where",
"=",
"None",
")",
":",
"if",
"__grains__",
"[",
"'os_family'",
"]",
"in",
"[",
"'RedHat'",
",",
"'Debian'",
"]",
":",
"return",
"_osquery_cmd",
"(",
"table",
"=",
"'kernel_modules'",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | memory_map | Return memory_map information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.memory_map | salt/modules/osquery.py | def memory_map(attrs=None, where=None):
'''
Return memory_map information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.memory_map
'''
if __grains__['os_family'] in ['RedHat', 'Debian']:
return _osquery_cmd(table='memory_map', attrs=attrs, where=where)
re... | def memory_map(attrs=None, where=None):
'''
Return memory_map information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.memory_map
'''
if __grains__['os_family'] in ['RedHat', 'Debian']:
return _osquery_cmd(table='memory_map', attrs=attrs, where=where)
re... | [
"Return",
"memory_map",
"information",
"from",
"osquery"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/osquery.py#L179-L191 | [
"def",
"memory_map",
"(",
"attrs",
"=",
"None",
",",
"where",
"=",
"None",
")",
":",
"if",
"__grains__",
"[",
"'os_family'",
"]",
"in",
"[",
"'RedHat'",
",",
"'Debian'",
"]",
":",
"return",
"_osquery_cmd",
"(",
"table",
"=",
"'memory_map'",
",",
"attrs",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | process_memory_map | Return process_memory_map information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.process_memory_map | salt/modules/osquery.py | def process_memory_map(attrs=None, where=None):
'''
Return process_memory_map information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.process_memory_map
'''
if __grains__['os_family'] in ['RedHat', 'Debian']:
return _osquery_cmd(table='process_memory_map', ... | def process_memory_map(attrs=None, where=None):
'''
Return process_memory_map information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.process_memory_map
'''
if __grains__['os_family'] in ['RedHat', 'Debian']:
return _osquery_cmd(table='process_memory_map', ... | [
"Return",
"process_memory_map",
"information",
"from",
"osquery"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/osquery.py#L194-L206 | [
"def",
"process_memory_map",
"(",
"attrs",
"=",
"None",
",",
"where",
"=",
"None",
")",
":",
"if",
"__grains__",
"[",
"'os_family'",
"]",
"in",
"[",
"'RedHat'",
",",
"'Debian'",
"]",
":",
"return",
"_osquery_cmd",
"(",
"table",
"=",
"'process_memory_map'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | shared_memory | Return shared_memory information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.shared_memory | salt/modules/osquery.py | def shared_memory(attrs=None, where=None):
'''
Return shared_memory information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.shared_memory
'''
if __grains__['os_family'] in ['RedHat', 'Debian']:
return _osquery_cmd(table='shared_memory', attrs=attrs, where=w... | def shared_memory(attrs=None, where=None):
'''
Return shared_memory information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.shared_memory
'''
if __grains__['os_family'] in ['RedHat', 'Debian']:
return _osquery_cmd(table='shared_memory', attrs=attrs, where=w... | [
"Return",
"shared_memory",
"information",
"from",
"osquery"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/osquery.py#L209-L221 | [
"def",
"shared_memory",
"(",
"attrs",
"=",
"None",
",",
"where",
"=",
"None",
")",
":",
"if",
"__grains__",
"[",
"'os_family'",
"]",
"in",
"[",
"'RedHat'",
",",
"'Debian'",
"]",
":",
"return",
"_osquery_cmd",
"(",
"table",
"=",
"'shared_memory'",
",",
"a... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | apt_sources | Return apt_sources information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.apt_sources | salt/modules/osquery.py | def apt_sources(attrs=None, where=None):
'''
Return apt_sources information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.apt_sources
'''
if __grains__['os_family'] == 'Debian':
return _osquery_cmd(table='apt_sources', attrs=attrs, where=where)
return {'r... | def apt_sources(attrs=None, where=None):
'''
Return apt_sources information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.apt_sources
'''
if __grains__['os_family'] == 'Debian':
return _osquery_cmd(table='apt_sources', attrs=attrs, where=where)
return {'r... | [
"Return",
"apt_sources",
"information",
"from",
"osquery"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/osquery.py#L224-L236 | [
"def",
"apt_sources",
"(",
"attrs",
"=",
"None",
",",
"where",
"=",
"None",
")",
":",
"if",
"__grains__",
"[",
"'os_family'",
"]",
"==",
"'Debian'",
":",
"return",
"_osquery_cmd",
"(",
"table",
"=",
"'apt_sources'",
",",
"attrs",
"=",
"attrs",
",",
"wher... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | deb_packages | Return deb_packages information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.deb_packages | salt/modules/osquery.py | def deb_packages(attrs=None, where=None):
'''
Return deb_packages information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.deb_packages
'''
if __grains__['os_family'] == 'Debian':
return _osquery_cmd(table='deb_packages', attrs=attrs, where=where)
return... | def deb_packages(attrs=None, where=None):
'''
Return deb_packages information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.deb_packages
'''
if __grains__['os_family'] == 'Debian':
return _osquery_cmd(table='deb_packages', attrs=attrs, where=where)
return... | [
"Return",
"deb_packages",
"information",
"from",
"osquery"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/osquery.py#L239-L251 | [
"def",
"deb_packages",
"(",
"attrs",
"=",
"None",
",",
"where",
"=",
"None",
")",
":",
"if",
"__grains__",
"[",
"'os_family'",
"]",
"==",
"'Debian'",
":",
"return",
"_osquery_cmd",
"(",
"table",
"=",
"'deb_packages'",
",",
"attrs",
"=",
"attrs",
",",
"wh... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | alf | Return alf information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.alf | salt/modules/osquery.py | def alf(attrs=None, where=None):
'''
Return alf information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.alf
'''
if salt.utils.platform.is_darwin():
return _osquery_cmd(table='alf', attrs=attrs, where=where)
return {'result': False, 'comment': 'Only avai... | def alf(attrs=None, where=None):
'''
Return alf information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.alf
'''
if salt.utils.platform.is_darwin():
return _osquery_cmd(table='alf', attrs=attrs, where=where)
return {'result': False, 'comment': 'Only avai... | [
"Return",
"alf",
"information",
"from",
"osquery"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/osquery.py#L657-L669 | [
"def",
"alf",
"(",
"attrs",
"=",
"None",
",",
"where",
"=",
"None",
")",
":",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_darwin",
"(",
")",
":",
"return",
"_osquery_cmd",
"(",
"table",
"=",
"'alf'",
",",
"attrs",
"=",
"attrs",
",",
"wher... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.