id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
35,700 | saltstack/salt | salt/modules/ethtool.py | show_driver | def show_driver(devname):
'''
Queries the specified network device for associated driver information
CLI Example:
.. code-block:: bash
salt '*' ethtool.show_driver <devname>
'''
try:
module = ethtool.get_module(devname)
except IOError:
log.error('Driver informatio... | python | def show_driver(devname):
'''
Queries the specified network device for associated driver information
CLI Example:
.. code-block:: bash
salt '*' ethtool.show_driver <devname>
'''
try:
module = ethtool.get_module(devname)
except IOError:
log.error('Driver informatio... | [
"def",
"show_driver",
"(",
"devname",
")",
":",
"try",
":",
"module",
"=",
"ethtool",
".",
"get_module",
"(",
"devname",
")",
"except",
"IOError",
":",
"log",
".",
"error",
"(",
"'Driver information not implemented on %s'",
",",
"devname",
")",
"return",
"'Not... | Queries the specified network device for associated driver information
CLI Example:
.. code-block:: bash
salt '*' ethtool.show_driver <devname> | [
"Queries",
"the",
"specified",
"network",
"device",
"for",
"associated",
"driver",
"information"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ethtool.py#L133-L161 |
35,701 | saltstack/salt | salt/modules/ethtool.py | set_coalesce | def set_coalesce(devname, **kwargs):
'''
Changes the coalescing settings of the specified network device
CLI Example:
.. code-block:: bash
salt '*' ethtool.set_coalesce <devname> [adaptive_rx=on|off] [adaptive_tx=on|off] [rx_usecs=N] [rx_frames=N]
[rx_usecs_irq=N] [rx_frames_irq=N... | python | def set_coalesce(devname, **kwargs):
'''
Changes the coalescing settings of the specified network device
CLI Example:
.. code-block:: bash
salt '*' ethtool.set_coalesce <devname> [adaptive_rx=on|off] [adaptive_tx=on|off] [rx_usecs=N] [rx_frames=N]
[rx_usecs_irq=N] [rx_frames_irq=N... | [
"def",
"set_coalesce",
"(",
"devname",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"coalesce",
"=",
"ethtool",
".",
"get_coalesce",
"(",
"devname",
")",
"except",
"IOError",
":",
"log",
".",
"error",
"(",
"'Interrupt coalescing not supported on %s'",
",",
... | Changes the coalescing settings of the specified network device
CLI Example:
.. code-block:: bash
salt '*' ethtool.set_coalesce <devname> [adaptive_rx=on|off] [adaptive_tx=on|off] [rx_usecs=N] [rx_frames=N]
[rx_usecs_irq=N] [rx_frames_irq=N] [tx_usecs=N] [tx_frames=N] [tx_usecs_irq=N] [tx... | [
"Changes",
"the",
"coalescing",
"settings",
"of",
"the",
"specified",
"network",
"device"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ethtool.py#L199-L235 |
35,702 | saltstack/salt | salt/modules/ethtool.py | show_offload | def show_offload(devname):
'''
Queries the specified network device for the state of protocol offload and other features
CLI Example:
.. code-block:: bash
salt '*' ethtool.show_offload <devname>
'''
try:
sg = ethtool.get_sg(devname) and "on" or "off"
except IOError:
... | python | def show_offload(devname):
'''
Queries the specified network device for the state of protocol offload and other features
CLI Example:
.. code-block:: bash
salt '*' ethtool.show_offload <devname>
'''
try:
sg = ethtool.get_sg(devname) and "on" or "off"
except IOError:
... | [
"def",
"show_offload",
"(",
"devname",
")",
":",
"try",
":",
"sg",
"=",
"ethtool",
".",
"get_sg",
"(",
"devname",
")",
"and",
"\"on\"",
"or",
"\"off\"",
"except",
"IOError",
":",
"sg",
"=",
"\"not supported\"",
"try",
":",
"tso",
"=",
"ethtool",
".",
"... | Queries the specified network device for the state of protocol offload and other features
CLI Example:
.. code-block:: bash
salt '*' ethtool.show_offload <devname> | [
"Queries",
"the",
"specified",
"network",
"device",
"for",
"the",
"state",
"of",
"protocol",
"offload",
"and",
"other",
"features"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ethtool.py#L238-L276 |
35,703 | saltstack/salt | salt/modules/ethtool.py | set_offload | def set_offload(devname, **kwargs):
'''
Changes the offload parameters and other features of the specified network device
CLI Example:
.. code-block:: bash
salt '*' ethtool.set_offload <devname> tcp_segmentation_offload=on
'''
for param, value in kwargs.items():
if param == '... | python | def set_offload(devname, **kwargs):
'''
Changes the offload parameters and other features of the specified network device
CLI Example:
.. code-block:: bash
salt '*' ethtool.set_offload <devname> tcp_segmentation_offload=on
'''
for param, value in kwargs.items():
if param == '... | [
"def",
"set_offload",
"(",
"devname",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"param",
",",
"value",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"param",
"==",
"'tcp_segmentation_offload'",
":",
"value",
"=",
"value",
"==",
"\"on\"",
"and",
"1... | Changes the offload parameters and other features of the specified network device
CLI Example:
.. code-block:: bash
salt '*' ethtool.set_offload <devname> tcp_segmentation_offload=on | [
"Changes",
"the",
"offload",
"parameters",
"and",
"other",
"features",
"of",
"the",
"specified",
"network",
"device"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ethtool.py#L279-L298 |
35,704 | saltstack/salt | salt/modules/tls.py | cert_base_path | def cert_base_path(cacert_path=None):
'''
Return the base path for certs from CLI or from options
cacert_path
absolute path to ca certificates root directory
CLI Example:
.. code-block:: bash
salt '*' tls.cert_base_path
'''
if not cacert_path:
cacert_path = __cont... | python | def cert_base_path(cacert_path=None):
'''
Return the base path for certs from CLI or from options
cacert_path
absolute path to ca certificates root directory
CLI Example:
.. code-block:: bash
salt '*' tls.cert_base_path
'''
if not cacert_path:
cacert_path = __cont... | [
"def",
"cert_base_path",
"(",
"cacert_path",
"=",
"None",
")",
":",
"if",
"not",
"cacert_path",
":",
"cacert_path",
"=",
"__context__",
".",
"get",
"(",
"'ca.contextual_cert_base_path'",
",",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'ca.contextual_cert_base_pa... | Return the base path for certs from CLI or from options
cacert_path
absolute path to ca certificates root directory
CLI Example:
.. code-block:: bash
salt '*' tls.cert_base_path | [
"Return",
"the",
"base",
"path",
"for",
"certs",
"from",
"CLI",
"or",
"from",
"options"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L174-L195 |
35,705 | saltstack/salt | salt/modules/tls.py | _get_basic_info | def _get_basic_info(ca_name, cert, ca_dir=None):
'''
Get basic info to write out to the index.txt
'''
if ca_dir is None:
ca_dir = '{0}/{1}'.format(_cert_base_path(), ca_name)
index_file = "{0}/index.txt".format(ca_dir)
cert = _read_cert(cert)
expire_date = _four_digit_year_to_two_d... | python | def _get_basic_info(ca_name, cert, ca_dir=None):
'''
Get basic info to write out to the index.txt
'''
if ca_dir is None:
ca_dir = '{0}/{1}'.format(_cert_base_path(), ca_name)
index_file = "{0}/index.txt".format(ca_dir)
cert = _read_cert(cert)
expire_date = _four_digit_year_to_two_d... | [
"def",
"_get_basic_info",
"(",
"ca_name",
",",
"cert",
",",
"ca_dir",
"=",
"None",
")",
":",
"if",
"ca_dir",
"is",
"None",
":",
"ca_dir",
"=",
"'{0}/{1}'",
".",
"format",
"(",
"_cert_base_path",
"(",
")",
",",
"ca_name",
")",
"index_file",
"=",
"\"{0}/in... | Get basic info to write out to the index.txt | [
"Get",
"basic",
"info",
"to",
"write",
"out",
"to",
"the",
"index",
".",
"txt"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L262-L286 |
35,706 | saltstack/salt | salt/modules/tls.py | _write_cert_to_database | def _write_cert_to_database(ca_name, cert, cacert_path=None, status='V'):
'''
write out the index.txt database file in the appropriate directory to
track certificates
ca_name
name of the CA
cert
certificate to be recorded
'''
set_ca_path(cacert_path)
ca_dir = '{0}/{1}'.f... | python | def _write_cert_to_database(ca_name, cert, cacert_path=None, status='V'):
'''
write out the index.txt database file in the appropriate directory to
track certificates
ca_name
name of the CA
cert
certificate to be recorded
'''
set_ca_path(cacert_path)
ca_dir = '{0}/{1}'.f... | [
"def",
"_write_cert_to_database",
"(",
"ca_name",
",",
"cert",
",",
"cacert_path",
"=",
"None",
",",
"status",
"=",
"'V'",
")",
":",
"set_ca_path",
"(",
"cacert_path",
")",
"ca_dir",
"=",
"'{0}/{1}'",
".",
"format",
"(",
"cert_base_path",
"(",
")",
",",
"c... | write out the index.txt database file in the appropriate directory to
track certificates
ca_name
name of the CA
cert
certificate to be recorded | [
"write",
"out",
"the",
"index",
".",
"txt",
"database",
"file",
"in",
"the",
"appropriate",
"directory",
"to",
"track",
"certificates"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L289-L314 |
35,707 | saltstack/salt | salt/modules/tls.py | _get_expiration_date | def _get_expiration_date(cert):
'''
Returns a datetime.datetime object
'''
cert_obj = _read_cert(cert)
if cert_obj is None:
raise CommandExecutionError(
'Failed to read cert from {0}, see log for details'.format(cert)
)
return datetime.strptime(
salt.utils.s... | python | def _get_expiration_date(cert):
'''
Returns a datetime.datetime object
'''
cert_obj = _read_cert(cert)
if cert_obj is None:
raise CommandExecutionError(
'Failed to read cert from {0}, see log for details'.format(cert)
)
return datetime.strptime(
salt.utils.s... | [
"def",
"_get_expiration_date",
"(",
"cert",
")",
":",
"cert_obj",
"=",
"_read_cert",
"(",
"cert",
")",
"if",
"cert_obj",
"is",
"None",
":",
"raise",
"CommandExecutionError",
"(",
"'Failed to read cert from {0}, see log for details'",
".",
"format",
"(",
"cert",
")",... | Returns a datetime.datetime object | [
"Returns",
"a",
"datetime",
".",
"datetime",
"object"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L612-L626 |
35,708 | saltstack/salt | salt/modules/tls.py | create_empty_crl | def create_empty_crl(
ca_name,
cacert_path=None,
ca_filename=None,
crl_file=None,
digest='sha256'):
'''
Create an empty Certificate Revocation List.
.. versionadded:: 2015.8.0
ca_name
name of the CA
cacert_path
absolute path to ca certificate... | python | def create_empty_crl(
ca_name,
cacert_path=None,
ca_filename=None,
crl_file=None,
digest='sha256'):
'''
Create an empty Certificate Revocation List.
.. versionadded:: 2015.8.0
ca_name
name of the CA
cacert_path
absolute path to ca certificate... | [
"def",
"create_empty_crl",
"(",
"ca_name",
",",
"cacert_path",
"=",
"None",
",",
"ca_filename",
"=",
"None",
",",
"crl_file",
"=",
"None",
",",
"digest",
"=",
"'sha256'",
")",
":",
"set_ca_path",
"(",
"cacert_path",
")",
"if",
"not",
"ca_filename",
":",
"c... | Create an empty Certificate Revocation List.
.. versionadded:: 2015.8.0
ca_name
name of the CA
cacert_path
absolute path to ca certificates root directory
ca_filename
alternative filename for the CA
.. versionadded:: 2015.5.3
crl_file
full path to the CRL ... | [
"Create",
"an",
"empty",
"Certificate",
"Revocation",
"List",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L1773-L1854 |
35,709 | saltstack/salt | salt/utils/roster_matcher.py | RosterMatcher._ret_minions | def _ret_minions(self, filter_):
'''
Filter minions by a generic filter.
'''
minions = {}
for minion in filter_(self.raw):
data = self.get_data(minion)
if data:
minions[minion] = data.copy()
return minions | python | def _ret_minions(self, filter_):
'''
Filter minions by a generic filter.
'''
minions = {}
for minion in filter_(self.raw):
data = self.get_data(minion)
if data:
minions[minion] = data.copy()
return minions | [
"def",
"_ret_minions",
"(",
"self",
",",
"filter_",
")",
":",
"minions",
"=",
"{",
"}",
"for",
"minion",
"in",
"filter_",
"(",
"self",
".",
"raw",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"minion",
")",
"if",
"data",
":",
"minions",
"["... | Filter minions by a generic filter. | [
"Filter",
"minions",
"by",
"a",
"generic",
"filter",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/roster_matcher.py#L66-L75 |
35,710 | saltstack/salt | salt/utils/roster_matcher.py | RosterMatcher.ret_pcre_minions | def ret_pcre_minions(self):
'''
Return minions that match via pcre
'''
tgt = re.compile(self.tgt)
refilter = functools.partial(filter, tgt.match)
return self._ret_minions(refilter) | python | def ret_pcre_minions(self):
'''
Return minions that match via pcre
'''
tgt = re.compile(self.tgt)
refilter = functools.partial(filter, tgt.match)
return self._ret_minions(refilter) | [
"def",
"ret_pcre_minions",
"(",
"self",
")",
":",
"tgt",
"=",
"re",
".",
"compile",
"(",
"self",
".",
"tgt",
")",
"refilter",
"=",
"functools",
".",
"partial",
"(",
"filter",
",",
"tgt",
".",
"match",
")",
"return",
"self",
".",
"_ret_minions",
"(",
... | Return minions that match via pcre | [
"Return",
"minions",
"that",
"match",
"via",
"pcre"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/roster_matcher.py#L84-L90 |
35,711 | saltstack/salt | salt/utils/roster_matcher.py | RosterMatcher.ret_list_minions | def ret_list_minions(self):
'''
Return minions that match via list
'''
tgt = _tgt_set(self.tgt)
return self._ret_minions(tgt.intersection) | python | def ret_list_minions(self):
'''
Return minions that match via list
'''
tgt = _tgt_set(self.tgt)
return self._ret_minions(tgt.intersection) | [
"def",
"ret_list_minions",
"(",
"self",
")",
":",
"tgt",
"=",
"_tgt_set",
"(",
"self",
".",
"tgt",
")",
"return",
"self",
".",
"_ret_minions",
"(",
"tgt",
".",
"intersection",
")"
] | Return minions that match via list | [
"Return",
"minions",
"that",
"match",
"via",
"list"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/roster_matcher.py#L92-L97 |
35,712 | saltstack/salt | salt/utils/roster_matcher.py | RosterMatcher.ret_nodegroup_minions | def ret_nodegroup_minions(self):
'''
Return minions which match the special list-only groups defined by
ssh_list_nodegroups
'''
nodegroup = __opts__.get('ssh_list_nodegroups', {}).get(self.tgt, [])
nodegroup = _tgt_set(nodegroup)
return self._ret_minions(nodegroup... | python | def ret_nodegroup_minions(self):
'''
Return minions which match the special list-only groups defined by
ssh_list_nodegroups
'''
nodegroup = __opts__.get('ssh_list_nodegroups', {}).get(self.tgt, [])
nodegroup = _tgt_set(nodegroup)
return self._ret_minions(nodegroup... | [
"def",
"ret_nodegroup_minions",
"(",
"self",
")",
":",
"nodegroup",
"=",
"__opts__",
".",
"get",
"(",
"'ssh_list_nodegroups'",
",",
"{",
"}",
")",
".",
"get",
"(",
"self",
".",
"tgt",
",",
"[",
"]",
")",
"nodegroup",
"=",
"_tgt_set",
"(",
"nodegroup",
... | Return minions which match the special list-only groups defined by
ssh_list_nodegroups | [
"Return",
"minions",
"which",
"match",
"the",
"special",
"list",
"-",
"only",
"groups",
"defined",
"by",
"ssh_list_nodegroups"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/roster_matcher.py#L99-L106 |
35,713 | saltstack/salt | salt/utils/roster_matcher.py | RosterMatcher.ret_range_minions | def ret_range_minions(self):
'''
Return minions that are returned by a range query
'''
if HAS_RANGE is False:
raise RuntimeError("Python lib 'seco.range' is not available")
minions = {}
range_hosts = _convert_range_to_list(self.tgt, __opts__['range_server'])
... | python | def ret_range_minions(self):
'''
Return minions that are returned by a range query
'''
if HAS_RANGE is False:
raise RuntimeError("Python lib 'seco.range' is not available")
minions = {}
range_hosts = _convert_range_to_list(self.tgt, __opts__['range_server'])
... | [
"def",
"ret_range_minions",
"(",
"self",
")",
":",
"if",
"HAS_RANGE",
"is",
"False",
":",
"raise",
"RuntimeError",
"(",
"\"Python lib 'seco.range' is not available\"",
")",
"minions",
"=",
"{",
"}",
"range_hosts",
"=",
"_convert_range_to_list",
"(",
"self",
".",
"... | Return minions that are returned by a range query | [
"Return",
"minions",
"that",
"are",
"returned",
"by",
"a",
"range",
"query"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/roster_matcher.py#L108-L117 |
35,714 | saltstack/salt | salt/cloud/clouds/parallels.py | create_node | def create_node(vm_):
'''
Build and submit the XML to create a node
'''
# Start the tree
content = ET.Element('ve')
# Name of the instance
name = ET.SubElement(content, 'name')
name.text = vm_['name']
# Description, defaults to name
desc = ET.SubElement(content, 'description')
... | python | def create_node(vm_):
'''
Build and submit the XML to create a node
'''
# Start the tree
content = ET.Element('ve')
# Name of the instance
name = ET.SubElement(content, 'name')
name.text = vm_['name']
# Description, defaults to name
desc = ET.SubElement(content, 'description')
... | [
"def",
"create_node",
"(",
"vm_",
")",
":",
"# Start the tree",
"content",
"=",
"ET",
".",
"Element",
"(",
"'ve'",
")",
"# Name of the instance",
"name",
"=",
"ET",
".",
"SubElement",
"(",
"content",
",",
"'name'",
")",
"name",
".",
"text",
"=",
"vm_",
"... | Build and submit the XML to create a node | [
"Build",
"and",
"submit",
"the",
"XML",
"to",
"create",
"a",
"node"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/parallels.py#L184-L270 |
35,715 | saltstack/salt | salt/cloud/clouds/parallels.py | query | def query(action=None, command=None, args=None, method='GET', data=None):
'''
Make a web call to a Parallels provider
'''
path = config.get_cloud_config_value(
'url', get_configured_provider(), __opts__, search_global=False
)
auth_handler = _HTTPBasicAuthHandler()
auth_handler.add_pa... | python | def query(action=None, command=None, args=None, method='GET', data=None):
'''
Make a web call to a Parallels provider
'''
path = config.get_cloud_config_value(
'url', get_configured_provider(), __opts__, search_global=False
)
auth_handler = _HTTPBasicAuthHandler()
auth_handler.add_pa... | [
"def",
"query",
"(",
"action",
"=",
"None",
",",
"command",
"=",
"None",
",",
"args",
"=",
"None",
",",
"method",
"=",
"'GET'",
",",
"data",
"=",
"None",
")",
":",
"path",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'url'",
",",
"get_configured... | Make a web call to a Parallels provider | [
"Make",
"a",
"web",
"call",
"to",
"a",
"Parallels",
"provider"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/parallels.py#L368-L432 |
35,716 | saltstack/salt | salt/cloud/clouds/parallels.py | show_image | def show_image(kwargs, call=None):
'''
Show the details from Parallels concerning an image
'''
if call != 'function':
raise SaltCloudSystemExit(
'The show_image function must be called with -f or --function.'
)
items = query(action='template', command=kwargs['image'])
... | python | def show_image(kwargs, call=None):
'''
Show the details from Parallels concerning an image
'''
if call != 'function':
raise SaltCloudSystemExit(
'The show_image function must be called with -f or --function.'
)
items = query(action='template', command=kwargs['image'])
... | [
"def",
"show_image",
"(",
"kwargs",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"!=",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The show_image function must be called with -f or --function.'",
")",
"items",
"=",
"query",
"(",
"action",
"=",
"... | Show the details from Parallels concerning an image | [
"Show",
"the",
"details",
"from",
"Parallels",
"concerning",
"an",
"image"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/parallels.py#L449-L466 |
35,717 | saltstack/salt | salt/cloud/clouds/parallels.py | show_instance | def show_instance(name, call=None):
'''
Show the details from Parallels concerning an instance
'''
if call != 'action':
raise SaltCloudSystemExit(
'The show_instance action must be called with -a or --action.'
)
items = query(action='ve', command=name)
ret = {}
... | python | def show_instance(name, call=None):
'''
Show the details from Parallels concerning an instance
'''
if call != 'action':
raise SaltCloudSystemExit(
'The show_instance action must be called with -a or --action.'
)
items = query(action='ve', command=name)
ret = {}
... | [
"def",
"show_instance",
"(",
"name",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"!=",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The show_instance action must be called with -a or --action.'",
")",
"items",
"=",
"query",
"(",
"action",
"=",
"'v... | Show the details from Parallels concerning an instance | [
"Show",
"the",
"details",
"from",
"Parallels",
"concerning",
"an",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/parallels.py#L469-L494 |
35,718 | saltstack/salt | salt/returners/telegram_return.py | returner | def returner(ret):
'''
Send a Telegram message with the data.
:param ret: The data to be sent.
:return: Boolean if message was sent successfully.
'''
_options = _get_options(ret)
chat_id = _options.get('chat_id')
token = _options.get('token')
if not chat_id:
log... | python | def returner(ret):
'''
Send a Telegram message with the data.
:param ret: The data to be sent.
:return: Boolean if message was sent successfully.
'''
_options = _get_options(ret)
chat_id = _options.get('chat_id')
token = _options.get('token')
if not chat_id:
log... | [
"def",
"returner",
"(",
"ret",
")",
":",
"_options",
"=",
"_get_options",
"(",
"ret",
")",
"chat_id",
"=",
"_options",
".",
"get",
"(",
"'chat_id'",
")",
"token",
"=",
"_options",
".",
"get",
"(",
"'token'",
")",
"if",
"not",
"chat_id",
":",
"log",
"... | Send a Telegram message with the data.
:param ret: The data to be sent.
:return: Boolean if message was sent successfully. | [
"Send",
"a",
"Telegram",
"message",
"with",
"the",
"data",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/telegram_return.py#L67-L99 |
35,719 | saltstack/salt | salt/returners/local_cache.py | _walk_through | def _walk_through(job_dir):
'''
Walk though the jid dir and look for jobs
'''
serial = salt.payload.Serial(__opts__)
for top in os.listdir(job_dir):
t_path = os.path.join(job_dir, top)
if not os.path.exists(t_path):
continue
for final in os.listdir(t_path):
... | python | def _walk_through(job_dir):
'''
Walk though the jid dir and look for jobs
'''
serial = salt.payload.Serial(__opts__)
for top in os.listdir(job_dir):
t_path = os.path.join(job_dir, top)
if not os.path.exists(t_path):
continue
for final in os.listdir(t_path):
... | [
"def",
"_walk_through",
"(",
"job_dir",
")",
":",
"serial",
"=",
"salt",
".",
"payload",
".",
"Serial",
"(",
"__opts__",
")",
"for",
"top",
"in",
"os",
".",
"listdir",
"(",
"job_dir",
")",
":",
"t_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"j... | Walk though the jid dir and look for jobs | [
"Walk",
"though",
"the",
"jid",
"dir",
"and",
"look",
"for",
"jobs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/local_cache.py#L56-L84 |
35,720 | saltstack/salt | salt/returners/local_cache.py | prep_jid | def prep_jid(nocache=False, passed_jid=None, recurse_count=0):
'''
Return a job id and prepare the job id directory.
This is the function responsible for making sure jids don't collide (unless
it is passed a jid).
So do what you have to do to make sure that stays the case
'''
if recurse_cou... | python | def prep_jid(nocache=False, passed_jid=None, recurse_count=0):
'''
Return a job id and prepare the job id directory.
This is the function responsible for making sure jids don't collide (unless
it is passed a jid).
So do what you have to do to make sure that stays the case
'''
if recurse_cou... | [
"def",
"prep_jid",
"(",
"nocache",
"=",
"False",
",",
"passed_jid",
"=",
"None",
",",
"recurse_count",
"=",
"0",
")",
":",
"if",
"recurse_count",
">=",
"5",
":",
"err",
"=",
"'prep_jid could not store a jid after {0} tries.'",
".",
"format",
"(",
"recurse_count"... | Return a job id and prepare the job id directory.
This is the function responsible for making sure jids don't collide (unless
it is passed a jid).
So do what you have to do to make sure that stays the case | [
"Return",
"a",
"job",
"id",
"and",
"prepare",
"the",
"job",
"id",
"directory",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/local_cache.py#L88-L130 |
35,721 | saltstack/salt | salt/returners/local_cache.py | returner | def returner(load):
'''
Return data to the local job cache
'''
serial = salt.payload.Serial(__opts__)
# if a minion is returning a standalone job, get a jobid
if load['jid'] == 'req':
load['jid'] = prep_jid(nocache=load.get('nocache', False))
jid_dir = salt.utils.jid.jid_dir(load['... | python | def returner(load):
'''
Return data to the local job cache
'''
serial = salt.payload.Serial(__opts__)
# if a minion is returning a standalone job, get a jobid
if load['jid'] == 'req':
load['jid'] = prep_jid(nocache=load.get('nocache', False))
jid_dir = salt.utils.jid.jid_dir(load['... | [
"def",
"returner",
"(",
"load",
")",
":",
"serial",
"=",
"salt",
".",
"payload",
".",
"Serial",
"(",
"__opts__",
")",
"# if a minion is returning a standalone job, get a jobid",
"if",
"load",
"[",
"'jid'",
"]",
"==",
"'req'",
":",
"load",
"[",
"'jid'",
"]",
... | Return data to the local job cache | [
"Return",
"data",
"to",
"the",
"local",
"job",
"cache"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/local_cache.py#L133-L184 |
35,722 | saltstack/salt | salt/returners/local_cache.py | get_endtime | def get_endtime(jid):
'''
Retrieve the stored endtime for a given job
Returns False if no endtime is present
'''
jid_dir = salt.utils.jid.jid_dir(jid, _job_dir(), __opts__['hash_type'])
etpath = os.path.join(jid_dir, ENDTIME)
if not os.path.exists(etpath):
return False
with salt... | python | def get_endtime(jid):
'''
Retrieve the stored endtime for a given job
Returns False if no endtime is present
'''
jid_dir = salt.utils.jid.jid_dir(jid, _job_dir(), __opts__['hash_type'])
etpath = os.path.join(jid_dir, ENDTIME)
if not os.path.exists(etpath):
return False
with salt... | [
"def",
"get_endtime",
"(",
"jid",
")",
":",
"jid_dir",
"=",
"salt",
".",
"utils",
".",
"jid",
".",
"jid_dir",
"(",
"jid",
",",
"_job_dir",
"(",
")",
",",
"__opts__",
"[",
"'hash_type'",
"]",
")",
"etpath",
"=",
"os",
".",
"path",
".",
"join",
"(",
... | Retrieve the stored endtime for a given job
Returns False if no endtime is present | [
"Retrieve",
"the",
"stored",
"endtime",
"for",
"a",
"given",
"job"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/local_cache.py#L485-L497 |
35,723 | saltstack/salt | salt/returners/local_cache.py | save_reg | def save_reg(data):
'''
Save the register to msgpack files
'''
reg_dir = _reg_dir()
regfile = os.path.join(reg_dir, 'register')
try:
if not os.path.exists(reg_dir):
os.makedirs(reg_dir)
except OSError as exc:
if exc.errno == errno.EEXIST:
pass
... | python | def save_reg(data):
'''
Save the register to msgpack files
'''
reg_dir = _reg_dir()
regfile = os.path.join(reg_dir, 'register')
try:
if not os.path.exists(reg_dir):
os.makedirs(reg_dir)
except OSError as exc:
if exc.errno == errno.EEXIST:
pass
... | [
"def",
"save_reg",
"(",
"data",
")",
":",
"reg_dir",
"=",
"_reg_dir",
"(",
")",
"regfile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"reg_dir",
",",
"'register'",
")",
"try",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"reg_dir",
")",
... | Save the register to msgpack files | [
"Save",
"the",
"register",
"to",
"msgpack",
"files"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/local_cache.py#L507-L526 |
35,724 | saltstack/salt | salt/returners/local_cache.py | load_reg | def load_reg():
'''
Load the register from msgpack files
'''
reg_dir = _reg_dir()
regfile = os.path.join(reg_dir, 'register')
try:
with salt.utils.files.fopen(regfile, 'r') as fh_:
return salt.utils.msgpack.load(fh_)
except Exception:
log.error('Could not write to... | python | def load_reg():
'''
Load the register from msgpack files
'''
reg_dir = _reg_dir()
regfile = os.path.join(reg_dir, 'register')
try:
with salt.utils.files.fopen(regfile, 'r') as fh_:
return salt.utils.msgpack.load(fh_)
except Exception:
log.error('Could not write to... | [
"def",
"load_reg",
"(",
")",
":",
"reg_dir",
"=",
"_reg_dir",
"(",
")",
"regfile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"reg_dir",
",",
"'register'",
")",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"regfile",
",... | Load the register from msgpack files | [
"Load",
"the",
"register",
"from",
"msgpack",
"files"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/local_cache.py#L529-L540 |
35,725 | saltstack/salt | salt/serializers/yamlex.py | Loader.construct_yaml_omap | def construct_yaml_omap(self, node):
'''
Build the SLSMap
'''
sls_map = SLSMap()
if not isinstance(node, MappingNode):
raise ConstructorError(
None,
None,
'expected a mapping node, but found {0}'.format(node.id),
... | python | def construct_yaml_omap(self, node):
'''
Build the SLSMap
'''
sls_map = SLSMap()
if not isinstance(node, MappingNode):
raise ConstructorError(
None,
None,
'expected a mapping node, but found {0}'.format(node.id),
... | [
"def",
"construct_yaml_omap",
"(",
"self",
",",
"node",
")",
":",
"sls_map",
"=",
"SLSMap",
"(",
")",
"if",
"not",
"isinstance",
"(",
"node",
",",
"MappingNode",
")",
":",
"raise",
"ConstructorError",
"(",
"None",
",",
"None",
",",
"'expected a mapping node,... | Build the SLSMap | [
"Build",
"the",
"SLSMap"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/serializers/yamlex.py#L214-L252 |
35,726 | saltstack/salt | salt/serializers/yamlex.py | Loader.construct_sls_str | def construct_sls_str(self, node):
'''
Build the SLSString.
'''
# Ensure obj is str, not py2 unicode or py3 bytes
obj = self.construct_scalar(node)
if six.PY2:
obj = obj.encode('utf-8')
return SLSString(obj) | python | def construct_sls_str(self, node):
'''
Build the SLSString.
'''
# Ensure obj is str, not py2 unicode or py3 bytes
obj = self.construct_scalar(node)
if six.PY2:
obj = obj.encode('utf-8')
return SLSString(obj) | [
"def",
"construct_sls_str",
"(",
"self",
",",
"node",
")",
":",
"# Ensure obj is str, not py2 unicode or py3 bytes",
"obj",
"=",
"self",
".",
"construct_scalar",
"(",
"node",
")",
"if",
"six",
".",
"PY2",
":",
"obj",
"=",
"obj",
".",
"encode",
"(",
"'utf-8'",
... | Build the SLSString. | [
"Build",
"the",
"SLSString",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/serializers/yamlex.py#L254-L263 |
35,727 | saltstack/salt | salt/states/boto_dynamodb.py | _global_indexes_present | def _global_indexes_present(provisioned_indexes, global_indexes, changes_old,
changes_new, comments, name, region, key, keyid,
profile):
'''Handles global secondary index for the table present state.'''
ret = {'result': True}
if provisioned_indexes:
... | python | def _global_indexes_present(provisioned_indexes, global_indexes, changes_old,
changes_new, comments, name, region, key, keyid,
profile):
'''Handles global secondary index for the table present state.'''
ret = {'result': True}
if provisioned_indexes:
... | [
"def",
"_global_indexes_present",
"(",
"provisioned_indexes",
",",
"global_indexes",
",",
"changes_old",
",",
"changes_new",
",",
"comments",
",",
"name",
",",
"region",
",",
"key",
",",
"keyid",
",",
"profile",
")",
":",
"ret",
"=",
"{",
"'result'",
":",
"T... | Handles global secondary index for the table present state. | [
"Handles",
"global",
"secondary",
"index",
"for",
"the",
"table",
"present",
"state",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_dynamodb.py#L435-L495 |
35,728 | saltstack/salt | salt/states/boto_dynamodb.py | _next_datetime_with_utc_hour | def _next_datetime_with_utc_hour(table_name, utc_hour):
'''
Datapipeline API is throttling us, as all the pipelines are started at the same time.
We would like to uniformly distribute the startTime over a 60 minute window.
Return the next future utc datetime where
hour == utc_hour
minut... | python | def _next_datetime_with_utc_hour(table_name, utc_hour):
'''
Datapipeline API is throttling us, as all the pipelines are started at the same time.
We would like to uniformly distribute the startTime over a 60 minute window.
Return the next future utc datetime where
hour == utc_hour
minut... | [
"def",
"_next_datetime_with_utc_hour",
"(",
"table_name",
",",
"utc_hour",
")",
":",
"today",
"=",
"datetime",
".",
"date",
".",
"today",
"(",
")",
"# The minute and second values generated are deterministic, as we do not want",
"# pipeline definition to change for every run.",
... | Datapipeline API is throttling us, as all the pipelines are started at the same time.
We would like to uniformly distribute the startTime over a 60 minute window.
Return the next future utc datetime where
hour == utc_hour
minute = A value between 0-59 (depending on table name)
second = ... | [
"Datapipeline",
"API",
"is",
"throttling",
"us",
"as",
"all",
"the",
"pipelines",
"are",
"started",
"at",
"the",
"same",
"time",
".",
"We",
"would",
"like",
"to",
"uniformly",
"distribute",
"the",
"startTime",
"over",
"a",
"60",
"minute",
"window",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_dynamodb.py#L701-L728 |
35,729 | saltstack/salt | salt/runners/winrepo.py | genrepo | def genrepo(opts=None, fire_event=True):
'''
Generate winrepo_cachefile based on sls files in the winrepo_dir
opts
Specify an alternate opts dict. Should not be used unless this function
is imported into an execution module.
fire_event : True
Fire an event on failure. Only supp... | python | def genrepo(opts=None, fire_event=True):
'''
Generate winrepo_cachefile based on sls files in the winrepo_dir
opts
Specify an alternate opts dict. Should not be used unless this function
is imported into an execution module.
fire_event : True
Fire an event on failure. Only supp... | [
"def",
"genrepo",
"(",
"opts",
"=",
"None",
",",
"fire_event",
"=",
"True",
")",
":",
"if",
"opts",
"is",
"None",
":",
"opts",
"=",
"__opts__",
"winrepo_dir",
"=",
"opts",
"[",
"'winrepo_dir'",
"]",
"winrepo_cachefile",
"=",
"opts",
"[",
"'winrepo_cachefil... | Generate winrepo_cachefile based on sls files in the winrepo_dir
opts
Specify an alternate opts dict. Should not be used unless this function
is imported into an execution module.
fire_event : True
Fire an event on failure. Only supported on the master.
CLI Example:
.. code-b... | [
"Generate",
"winrepo_cachefile",
"based",
"on",
"sls",
"files",
"in",
"the",
"winrepo_dir"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/winrepo.py#L40-L125 |
35,730 | saltstack/salt | salt/runners/winrepo.py | update_git_repos | def update_git_repos(opts=None, clean=False, masterless=False):
'''
Checkout git repos containing Windows Software Package Definitions
opts
Specify an alternate opts dict. Should not be used unless this function
is imported into an execution module.
clean : False
Clean repo cac... | python | def update_git_repos(opts=None, clean=False, masterless=False):
'''
Checkout git repos containing Windows Software Package Definitions
opts
Specify an alternate opts dict. Should not be used unless this function
is imported into an execution module.
clean : False
Clean repo cac... | [
"def",
"update_git_repos",
"(",
"opts",
"=",
"None",
",",
"clean",
"=",
"False",
",",
"masterless",
"=",
"False",
")",
":",
"if",
"opts",
"is",
"None",
":",
"opts",
"=",
"__opts__",
"winrepo_dir",
"=",
"opts",
"[",
"'winrepo_dir'",
"]",
"winrepo_remotes",
... | Checkout git repos containing Windows Software Package Definitions
opts
Specify an alternate opts dict. Should not be used unless this function
is imported into an execution module.
clean : False
Clean repo cachedirs which are not configured under
:conf_master:`winrepo_remotes`... | [
"Checkout",
"git",
"repos",
"containing",
"Windows",
"Software",
"Package",
"Definitions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/winrepo.py#L128-L233 |
35,731 | saltstack/salt | salt/states/saltmod.py | _parallel_map | def _parallel_map(func, inputs):
'''
Applies a function to each element of a list, returning the resulting list.
A separate thread is created for each element in the input list and the
passed function is called for each of the elements. When all threads have
finished execution a list with the resul... | python | def _parallel_map(func, inputs):
'''
Applies a function to each element of a list, returning the resulting list.
A separate thread is created for each element in the input list and the
passed function is called for each of the elements. When all threads have
finished execution a list with the resul... | [
"def",
"_parallel_map",
"(",
"func",
",",
"inputs",
")",
":",
"outputs",
"=",
"len",
"(",
"inputs",
")",
"*",
"[",
"None",
"]",
"errors",
"=",
"len",
"(",
"inputs",
")",
"*",
"[",
"None",
"]",
"def",
"create_thread",
"(",
"index",
")",
":",
"def",
... | Applies a function to each element of a list, returning the resulting list.
A separate thread is created for each element in the input list and the
passed function is called for each of the elements. When all threads have
finished execution a list with the results corresponding to the inputs is
returne... | [
"Applies",
"a",
"function",
"to",
"each",
"element",
"of",
"a",
"list",
"returning",
"the",
"resulting",
"list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/saltmod.py#L66-L105 |
35,732 | saltstack/salt | salt/states/saltmod.py | wait_for_event | def wait_for_event(
name,
id_list,
event_id='id',
timeout=300,
node='master'):
'''
Watch Salt's event bus and block until a condition is met
.. versionadded:: 2014.7.0
name
An event tag to watch for; supports Reactor-style globbing.
id_list
A... | python | def wait_for_event(
name,
id_list,
event_id='id',
timeout=300,
node='master'):
'''
Watch Salt's event bus and block until a condition is met
.. versionadded:: 2014.7.0
name
An event tag to watch for; supports Reactor-style globbing.
id_list
A... | [
"def",
"wait_for_event",
"(",
"name",
",",
"id_list",
",",
"event_id",
"=",
"'id'",
",",
"timeout",
"=",
"300",
",",
"node",
"=",
"'master'",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
... | Watch Salt's event bus and block until a condition is met
.. versionadded:: 2014.7.0
name
An event tag to watch for; supports Reactor-style globbing.
id_list
A list of event identifiers to watch for -- usually the minion ID. Each
time an event tag is matched the event data is inspe... | [
"Watch",
"Salt",
"s",
"event",
"bus",
"and",
"block",
"until",
"a",
"condition",
"is",
"met"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/saltmod.py#L636-L748 |
35,733 | saltstack/salt | salt/states/saltmod.py | runner | def runner(name, **kwargs):
'''
Execute a runner module on the master
.. versionadded:: 2014.7.0
name
The name of the function to run
kwargs
Any keyword arguments to pass to the runner function
asynchronous
Run the salt command but don't wait for a reply.
.. ... | python | def runner(name, **kwargs):
'''
Execute a runner module on the master
.. versionadded:: 2014.7.0
name
The name of the function to run
kwargs
Any keyword arguments to pass to the runner function
asynchronous
Run the salt command but don't wait for a reply.
.. ... | [
"def",
"runner",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"jid",
"=",
"__orchestration_jid__",
"except",
"NameError",
":",
"log",
".",
"debug",
"(",
"'Unable to fire args event due to missing __orchestration_jid__'",
")",
"jid",
"=",
"None",
"... | Execute a runner module on the master
.. versionadded:: 2014.7.0
name
The name of the function to run
kwargs
Any keyword arguments to pass to the runner function
asynchronous
Run the salt command but don't wait for a reply.
.. versionadded:: neon
.. code-block:... | [
"Execute",
"a",
"runner",
"module",
"on",
"the",
"master"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/saltmod.py#L751-L819 |
35,734 | saltstack/salt | salt/states/saltmod.py | wheel | def wheel(name, **kwargs):
'''
Execute a wheel module on the master
.. versionadded:: 2014.7.0
name
The name of the function to run
kwargs
Any keyword arguments to pass to the wheel function
asynchronous
Run the salt command but don't wait for a reply.
.. ver... | python | def wheel(name, **kwargs):
'''
Execute a wheel module on the master
.. versionadded:: 2014.7.0
name
The name of the function to run
kwargs
Any keyword arguments to pass to the wheel function
asynchronous
Run the salt command but don't wait for a reply.
.. ver... | [
"def",
"wheel",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"False",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
"}",
"try",
":",
"jid",
"=",
"__orchestration_jid__... | Execute a wheel module on the master
.. versionadded:: 2014.7.0
name
The name of the function to run
kwargs
Any keyword arguments to pass to the wheel function
asynchronous
Run the salt command but don't wait for a reply.
.. versionadded:: neon
.. code-block:: ... | [
"Execute",
"a",
"wheel",
"module",
"on",
"the",
"master"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/saltmod.py#L1006-L1079 |
35,735 | saltstack/salt | salt/modules/slack_notify.py | list_rooms | def list_rooms(api_key=None):
'''
List all Slack rooms.
:param api_key: The Slack admin api key.
:return: The room list.
CLI Example:
.. code-block:: bash
salt '*' slack.list_rooms
salt '*' slack.list_rooms api_key=peWcBiMOS9HrZG15peWcBiMOS9HrZG15
'''
if not api_key:... | python | def list_rooms(api_key=None):
'''
List all Slack rooms.
:param api_key: The Slack admin api key.
:return: The room list.
CLI Example:
.. code-block:: bash
salt '*' slack.list_rooms
salt '*' slack.list_rooms api_key=peWcBiMOS9HrZG15peWcBiMOS9HrZG15
'''
if not api_key:... | [
"def",
"list_rooms",
"(",
"api_key",
"=",
"None",
")",
":",
"if",
"not",
"api_key",
":",
"api_key",
"=",
"_get_api_key",
"(",
")",
"return",
"salt",
".",
"utils",
".",
"slack",
".",
"query",
"(",
"function",
"=",
"'rooms'",
",",
"api_key",
"=",
"api_ke... | List all Slack rooms.
:param api_key: The Slack admin api key.
:return: The room list.
CLI Example:
.. code-block:: bash
salt '*' slack.list_rooms
salt '*' slack.list_rooms api_key=peWcBiMOS9HrZG15peWcBiMOS9HrZG15 | [
"List",
"all",
"Slack",
"rooms",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/slack_notify.py#L69-L88 |
35,736 | saltstack/salt | salt/modules/slack_notify.py | find_room | def find_room(name, api_key=None):
'''
Find a room by name and return it.
:param name: The room name.
:param api_key: The Slack admin api key.
:return: The room object.
CLI Example:
.. code-block:: bash
salt '*' slack.find_room name="random"
salt '*' slack.find... | python | def find_room(name, api_key=None):
'''
Find a room by name and return it.
:param name: The room name.
:param api_key: The Slack admin api key.
:return: The room object.
CLI Example:
.. code-block:: bash
salt '*' slack.find_room name="random"
salt '*' slack.find... | [
"def",
"find_room",
"(",
"name",
",",
"api_key",
"=",
"None",
")",
":",
"if",
"not",
"api_key",
":",
"api_key",
"=",
"_get_api_key",
"(",
")",
"# search results don't include the name of the",
"# channel with a hash, if the passed channel name",
"# has a hash we remove it."... | Find a room by name and return it.
:param name: The room name.
:param api_key: The Slack admin api key.
:return: The room object.
CLI Example:
.. code-block:: bash
salt '*' slack.find_room name="random"
salt '*' slack.find_room name="random" api_key=peWcBiMOS9HrZG15peW... | [
"Find",
"a",
"room",
"by",
"name",
"and",
"return",
"it",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/slack_notify.py#L113-L144 |
35,737 | saltstack/salt | salt/modules/slack_notify.py | find_user | def find_user(name, api_key=None):
'''
Find a user by name and return it.
:param name: The user name.
:param api_key: The Slack admin api key.
:return: The user object.
CLI Example:
.. code-block:: bash
salt '*' slack.find_user name="ThomasHatch"
sa... | python | def find_user(name, api_key=None):
'''
Find a user by name and return it.
:param name: The user name.
:param api_key: The Slack admin api key.
:return: The user object.
CLI Example:
.. code-block:: bash
salt '*' slack.find_user name="ThomasHatch"
sa... | [
"def",
"find_user",
"(",
"name",
",",
"api_key",
"=",
"None",
")",
":",
"if",
"not",
"api_key",
":",
"api_key",
"=",
"_get_api_key",
"(",
")",
"ret",
"=",
"list_users",
"(",
"api_key",
")",
"if",
"ret",
"[",
"'res'",
"]",
":",
"users",
"=",
"ret",
... | Find a user by name and return it.
:param name: The user name.
:param api_key: The Slack admin api key.
:return: The user object.
CLI Example:
.. code-block:: bash
salt '*' slack.find_user name="ThomasHatch"
salt '*' slack.find_user name="ThomasHatch" api_k... | [
"Find",
"a",
"user",
"by",
"name",
"and",
"return",
"it",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/slack_notify.py#L147-L173 |
35,738 | saltstack/salt | salt/modules/slack_notify.py | call_hook | def call_hook(message,
attachment=None,
color='good',
short=False,
identifier=None,
channel=None,
username=None,
icon_emoji=None):
'''
Send message to Slack incoming webhook.
:param message: The topic of m... | python | def call_hook(message,
attachment=None,
color='good',
short=False,
identifier=None,
channel=None,
username=None,
icon_emoji=None):
'''
Send message to Slack incoming webhook.
:param message: The topic of m... | [
"def",
"call_hook",
"(",
"message",
",",
"attachment",
"=",
"None",
",",
"color",
"=",
"'good'",
",",
"short",
"=",
"False",
",",
"identifier",
"=",
"None",
",",
"channel",
"=",
"None",
",",
"username",
"=",
"None",
",",
"icon_emoji",
"=",
"None",
")",... | Send message to Slack incoming webhook.
:param message: The topic of message.
:param attachment: The message to send to the Slacke WebHook.
:param color: The color of border of left side
:param short: An optional flag indicating whether the value is short
enough... | [
"Send",
"message",
"to",
"Slack",
"incoming",
"webhook",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/slack_notify.py#L244-L325 |
35,739 | saltstack/salt | salt/modules/nagios.py | _execute_cmd | def _execute_cmd(plugin, args='', run_type='cmd.retcode'):
'''
Execute nagios plugin if it's in the directory with salt command specified in run_type
'''
data = {}
all_plugins = list_plugins()
if plugin in all_plugins:
data = __salt__[run_type](
'{0}{1} {2}'.format(PLUGI... | python | def _execute_cmd(plugin, args='', run_type='cmd.retcode'):
'''
Execute nagios plugin if it's in the directory with salt command specified in run_type
'''
data = {}
all_plugins = list_plugins()
if plugin in all_plugins:
data = __salt__[run_type](
'{0}{1} {2}'.format(PLUGI... | [
"def",
"_execute_cmd",
"(",
"plugin",
",",
"args",
"=",
"''",
",",
"run_type",
"=",
"'cmd.retcode'",
")",
":",
"data",
"=",
"{",
"}",
"all_plugins",
"=",
"list_plugins",
"(",
")",
"if",
"plugin",
"in",
"all_plugins",
":",
"data",
"=",
"__salt__",
"[",
... | Execute nagios plugin if it's in the directory with salt command specified in run_type | [
"Execute",
"nagios",
"plugin",
"if",
"it",
"s",
"in",
"the",
"directory",
"with",
"salt",
"command",
"specified",
"in",
"run_type"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nagios.py#L29-L41 |
35,740 | saltstack/salt | salt/modules/nagios.py | retcode | def retcode(plugin, args='', key_name=None):
'''
Run one nagios plugin and return retcode of the execution
'''
data = {}
# Remove all the spaces, the key must not have any space
if key_name is None:
key_name = _format_dict_key(args, plugin)
data[key_name] = {}
status = _execut... | python | def retcode(plugin, args='', key_name=None):
'''
Run one nagios plugin and return retcode of the execution
'''
data = {}
# Remove all the spaces, the key must not have any space
if key_name is None:
key_name = _format_dict_key(args, plugin)
data[key_name] = {}
status = _execut... | [
"def",
"retcode",
"(",
"plugin",
",",
"args",
"=",
"''",
",",
"key_name",
"=",
"None",
")",
":",
"data",
"=",
"{",
"}",
"# Remove all the spaces, the key must not have any space",
"if",
"key_name",
"is",
"None",
":",
"key_name",
"=",
"_format_dict_key",
"(",
"... | Run one nagios plugin and return retcode of the execution | [
"Run",
"one",
"nagios",
"plugin",
"and",
"return",
"retcode",
"of",
"the",
"execution"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nagios.py#L105-L120 |
35,741 | saltstack/salt | salt/modules/nagios.py | list_plugins | def list_plugins():
'''
List all the nagios plugins
CLI Example:
.. code-block:: bash
salt '*' nagios.list_plugins
'''
plugin_list = os.listdir(PLUGINDIR)
ret = []
for plugin in plugin_list:
# Check if execute bit
stat_f = os.path.join(PLUGINDIR, plugin)
... | python | def list_plugins():
'''
List all the nagios plugins
CLI Example:
.. code-block:: bash
salt '*' nagios.list_plugins
'''
plugin_list = os.listdir(PLUGINDIR)
ret = []
for plugin in plugin_list:
# Check if execute bit
stat_f = os.path.join(PLUGINDIR, plugin)
... | [
"def",
"list_plugins",
"(",
")",
":",
"plugin_list",
"=",
"os",
".",
"listdir",
"(",
"PLUGINDIR",
")",
"ret",
"=",
"[",
"]",
"for",
"plugin",
"in",
"plugin_list",
":",
"# Check if execute bit",
"stat_f",
"=",
"os",
".",
"path",
".",
"join",
"(",
"PLUGIND... | List all the nagios plugins
CLI Example:
.. code-block:: bash
salt '*' nagios.list_plugins | [
"List",
"all",
"the",
"nagios",
"plugins"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nagios.py#L255-L273 |
35,742 | saltstack/salt | salt/states/cyg.py | installed | def installed(name,
cyg_arch='x86_64',
mirrors=None):
'''
Make sure that a package is installed.
name
The name of the package to install
cyg_arch : x86_64
The cygwin architecture to install the package into.
Current options are x86 and x86_64
mi... | python | def installed(name,
cyg_arch='x86_64',
mirrors=None):
'''
Make sure that a package is installed.
name
The name of the package to install
cyg_arch : x86_64
The cygwin architecture to install the package into.
Current options are x86 and x86_64
mi... | [
"def",
"installed",
"(",
"name",
",",
"cyg_arch",
"=",
"'x86_64'",
",",
"mirrors",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"if",... | Make sure that a package is installed.
name
The name of the package to install
cyg_arch : x86_64
The cygwin architecture to install the package into.
Current options are x86 and x86_64
mirrors : None
List of mirrors to check.
None will use a default mirror (kernel.... | [
"Make",
"sure",
"that",
"a",
"package",
"is",
"installed",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cyg.py#L26-L91 |
35,743 | saltstack/salt | salt/states/cyg.py | updated | def updated(name=None, cyg_arch='x86_64', mirrors=None):
'''
Make sure all packages are up to date.
name : None
No affect, salt fails poorly without the arg available
cyg_arch : x86_64
The cygwin architecture to update.
Current options are x86 and x86_64
mirrors : None
... | python | def updated(name=None, cyg_arch='x86_64', mirrors=None):
'''
Make sure all packages are up to date.
name : None
No affect, salt fails poorly without the arg available
cyg_arch : x86_64
The cygwin architecture to update.
Current options are x86 and x86_64
mirrors : None
... | [
"def",
"updated",
"(",
"name",
"=",
"None",
",",
"cyg_arch",
"=",
"'x86_64'",
",",
"mirrors",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"'cyg.updated'",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{... | Make sure all packages are up to date.
name : None
No affect, salt fails poorly without the arg available
cyg_arch : x86_64
The cygwin architecture to update.
Current options are x86 and x86_64
mirrors : None
List of mirrors to check.
None will use a default mirror... | [
"Make",
"sure",
"all",
"packages",
"are",
"up",
"to",
"date",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cyg.py#L152-L207 |
35,744 | saltstack/salt | salt/pillar/varstack_pillar.py | ext_pillar | def ext_pillar(minion_id, # pylint: disable=W0613
pillar, # pylint: disable=W0613
conf):
'''
Parse varstack data and return the result
'''
vs = varstack.Varstack(config_filename=conf)
return vs.evaluate(__grains__) | python | def ext_pillar(minion_id, # pylint: disable=W0613
pillar, # pylint: disable=W0613
conf):
'''
Parse varstack data and return the result
'''
vs = varstack.Varstack(config_filename=conf)
return vs.evaluate(__grains__) | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"# pylint: disable=W0613",
"pillar",
",",
"# pylint: disable=W0613",
"conf",
")",
":",
"vs",
"=",
"varstack",
".",
"Varstack",
"(",
"config_filename",
"=",
"conf",
")",
"return",
"vs",
".",
"evaluate",
"(",
"__grains__... | Parse varstack data and return the result | [
"Parse",
"varstack",
"data",
"and",
"return",
"the",
"result"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/varstack_pillar.py#L40-L47 |
35,745 | saltstack/salt | salt/utils/pagerduty.py | query | def query(method='GET', profile_dict=None, url=None, path='api/v1',
action=None, api_key=None, service=None, params=None,
data=None, subdomain=None, client_url=None, description=None,
opts=None, verify_ssl=True):
'''
Query the PagerDuty API
'''
user_agent = 'SaltStack {0}'.... | python | def query(method='GET', profile_dict=None, url=None, path='api/v1',
action=None, api_key=None, service=None, params=None,
data=None, subdomain=None, client_url=None, description=None,
opts=None, verify_ssl=True):
'''
Query the PagerDuty API
'''
user_agent = 'SaltStack {0}'.... | [
"def",
"query",
"(",
"method",
"=",
"'GET'",
",",
"profile_dict",
"=",
"None",
",",
"url",
"=",
"None",
",",
"path",
"=",
"'api/v1'",
",",
"action",
"=",
"None",
",",
"api_key",
"=",
"None",
",",
"service",
"=",
"None",
",",
"params",
"=",
"None",
... | Query the PagerDuty API | [
"Query",
"the",
"PagerDuty",
"API"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pagerduty.py#L29-L108 |
35,746 | saltstack/salt | salt/modules/pyenv.py | install | def install(runas=None, path=None):
'''
Install pyenv systemwide
CLI Example:
.. code-block:: bash
salt '*' pyenv.install
'''
path = path or _pyenv_path(runas)
path = os.path.expanduser(path)
return _install_pyenv(path, runas) | python | def install(runas=None, path=None):
'''
Install pyenv systemwide
CLI Example:
.. code-block:: bash
salt '*' pyenv.install
'''
path = path or _pyenv_path(runas)
path = os.path.expanduser(path)
return _install_pyenv(path, runas) | [
"def",
"install",
"(",
"runas",
"=",
"None",
",",
"path",
"=",
"None",
")",
":",
"path",
"=",
"path",
"or",
"_pyenv_path",
"(",
"runas",
")",
"path",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"path",
")",
"return",
"_install_pyenv",
"(",
"path"... | Install pyenv systemwide
CLI Example:
.. code-block:: bash
salt '*' pyenv.install | [
"Install",
"pyenv",
"systemwide"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pyenv.py#L105-L117 |
35,747 | saltstack/salt | salt/modules/pyenv.py | update | def update(runas=None, path=None):
'''
Updates the current versions of pyenv and python-Build
CLI Example:
.. code-block:: bash
salt '*' pyenv.update
'''
path = path or _pyenv_path(runas)
path = os.path.expanduser(path)
return _update_pyenv(path, runas) | python | def update(runas=None, path=None):
'''
Updates the current versions of pyenv and python-Build
CLI Example:
.. code-block:: bash
salt '*' pyenv.update
'''
path = path or _pyenv_path(runas)
path = os.path.expanduser(path)
return _update_pyenv(path, runas) | [
"def",
"update",
"(",
"runas",
"=",
"None",
",",
"path",
"=",
"None",
")",
":",
"path",
"=",
"path",
"or",
"_pyenv_path",
"(",
"runas",
")",
"path",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"path",
")",
"return",
"_update_pyenv",
"(",
"path",
... | Updates the current versions of pyenv and python-Build
CLI Example:
.. code-block:: bash
salt '*' pyenv.update | [
"Updates",
"the",
"current",
"versions",
"of",
"pyenv",
"and",
"python",
"-",
"Build"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pyenv.py#L120-L133 |
35,748 | saltstack/salt | salt/modules/pyenv.py | install_python | def install_python(python, runas=None):
'''
Install a python implementation.
python
The version of python to install, should match one of the
versions listed by pyenv.list
CLI Example:
.. code-block:: bash
salt '*' pyenv.install_python 2.0.0-p0
'''
python = re.sub... | python | def install_python(python, runas=None):
'''
Install a python implementation.
python
The version of python to install, should match one of the
versions listed by pyenv.list
CLI Example:
.. code-block:: bash
salt '*' pyenv.install_python 2.0.0-p0
'''
python = re.sub... | [
"def",
"install_python",
"(",
"python",
",",
"runas",
"=",
"None",
")",
":",
"python",
"=",
"re",
".",
"sub",
"(",
"r'^python-'",
",",
"''",
",",
"python",
")",
"env",
"=",
"None",
"env_list",
"=",
"[",
"]",
"if",
"__grains__",
"[",
"'os'",
"]",
"i... | Install a python implementation.
python
The version of python to install, should match one of the
versions listed by pyenv.list
CLI Example:
.. code-block:: bash
salt '*' pyenv.install_python 2.0.0-p0 | [
"Install",
"a",
"python",
"implementation",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pyenv.py#L149-L185 |
35,749 | saltstack/salt | salt/modules/pyenv.py | uninstall_python | def uninstall_python(python, runas=None):
'''
Uninstall a python implementation.
python
The version of python to uninstall. Should match one of the versions
listed by :mod:`pyenv.versions <salt.modules.pyenv.versions>`
CLI Example:
.. code-block:: bash
salt '*' pyenv.unin... | python | def uninstall_python(python, runas=None):
'''
Uninstall a python implementation.
python
The version of python to uninstall. Should match one of the versions
listed by :mod:`pyenv.versions <salt.modules.pyenv.versions>`
CLI Example:
.. code-block:: bash
salt '*' pyenv.unin... | [
"def",
"uninstall_python",
"(",
"python",
",",
"runas",
"=",
"None",
")",
":",
"python",
"=",
"re",
".",
"sub",
"(",
"r'^python-'",
",",
"''",
",",
"python",
")",
"args",
"=",
"'--force {0}'",
".",
"format",
"(",
"python",
")",
"_pyenv_exec",
"(",
"'un... | Uninstall a python implementation.
python
The version of python to uninstall. Should match one of the versions
listed by :mod:`pyenv.versions <salt.modules.pyenv.versions>`
CLI Example:
.. code-block:: bash
salt '*' pyenv.uninstall_python 2.0.0-p0 | [
"Uninstall",
"a",
"python",
"implementation",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pyenv.py#L188-L206 |
35,750 | saltstack/salt | salt/modules/pyenv.py | versions | def versions(runas=None):
'''
List the installed versions of python.
CLI Example:
.. code-block:: bash
salt '*' pyenv.versions
'''
ret = _pyenv_exec('versions', '--bare', runas=runas)
return [] if ret is False else ret.splitlines() | python | def versions(runas=None):
'''
List the installed versions of python.
CLI Example:
.. code-block:: bash
salt '*' pyenv.versions
'''
ret = _pyenv_exec('versions', '--bare', runas=runas)
return [] if ret is False else ret.splitlines() | [
"def",
"versions",
"(",
"runas",
"=",
"None",
")",
":",
"ret",
"=",
"_pyenv_exec",
"(",
"'versions'",
",",
"'--bare'",
",",
"runas",
"=",
"runas",
")",
"return",
"[",
"]",
"if",
"ret",
"is",
"False",
"else",
"ret",
".",
"splitlines",
"(",
")"
] | List the installed versions of python.
CLI Example:
.. code-block:: bash
salt '*' pyenv.versions | [
"List",
"the",
"installed",
"versions",
"of",
"python",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pyenv.py#L209-L220 |
35,751 | saltstack/salt | salt/modules/pyenv.py | default | def default(python=None, runas=None):
'''
Returns or sets the currently defined default python.
python=None
The version to set as the default. Should match one of the versions
listed by :mod:`pyenv.versions <salt.modules.pyenv.versions>`. Leave
blank to return the current default.
... | python | def default(python=None, runas=None):
'''
Returns or sets the currently defined default python.
python=None
The version to set as the default. Should match one of the versions
listed by :mod:`pyenv.versions <salt.modules.pyenv.versions>`. Leave
blank to return the current default.
... | [
"def",
"default",
"(",
"python",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"if",
"python",
":",
"_pyenv_exec",
"(",
"'global'",
",",
"python",
",",
"runas",
"=",
"runas",
")",
"return",
"True",
"else",
":",
"ret",
"=",
"_pyenv_exec",
"(",
"'g... | Returns or sets the currently defined default python.
python=None
The version to set as the default. Should match one of the versions
listed by :mod:`pyenv.versions <salt.modules.pyenv.versions>`. Leave
blank to return the current default.
CLI Example:
.. code-block:: bash
... | [
"Returns",
"or",
"sets",
"the",
"currently",
"defined",
"default",
"python",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pyenv.py#L223-L244 |
35,752 | saltstack/salt | salt/modules/pyenv.py | do | def do(cmdline=None, runas=None):
'''
Execute a python command with pyenv's shims from the user or the system.
CLI Example:
.. code-block:: bash
salt '*' pyenv.do 'gem list bundler'
salt '*' pyenv.do 'gem list bundler' deploy
'''
path = _pyenv_path(runas)
cmd_split = cmdli... | python | def do(cmdline=None, runas=None):
'''
Execute a python command with pyenv's shims from the user or the system.
CLI Example:
.. code-block:: bash
salt '*' pyenv.do 'gem list bundler'
salt '*' pyenv.do 'gem list bundler' deploy
'''
path = _pyenv_path(runas)
cmd_split = cmdli... | [
"def",
"do",
"(",
"cmdline",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"path",
"=",
"_pyenv_path",
"(",
"runas",
")",
"cmd_split",
"=",
"cmdline",
".",
"split",
"(",
")",
"quoted_line",
"=",
"''",
"for",
"cmd",
"in",
"cmd_split",
":",
"quoted... | Execute a python command with pyenv's shims from the user or the system.
CLI Example:
.. code-block:: bash
salt '*' pyenv.do 'gem list bundler'
salt '*' pyenv.do 'gem list bundler' deploy | [
"Execute",
"a",
"python",
"command",
"with",
"pyenv",
"s",
"shims",
"from",
"the",
"user",
"or",
"the",
"system",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pyenv.py#L281-L307 |
35,753 | saltstack/salt | salt/modules/pyenv.py | do_with_python | def do_with_python(python, cmdline, runas=None):
'''
Execute a python command with pyenv's shims using a specific python version.
CLI Example:
.. code-block:: bash
salt '*' pyenv.do_with_python 2.0.0-p0 'gem list bundler'
salt '*' pyenv.do_with_python 2.0.0-p0 'gem list bundler' deplo... | python | def do_with_python(python, cmdline, runas=None):
'''
Execute a python command with pyenv's shims using a specific python version.
CLI Example:
.. code-block:: bash
salt '*' pyenv.do_with_python 2.0.0-p0 'gem list bundler'
salt '*' pyenv.do_with_python 2.0.0-p0 'gem list bundler' deplo... | [
"def",
"do_with_python",
"(",
"python",
",",
"cmdline",
",",
"runas",
"=",
"None",
")",
":",
"if",
"python",
":",
"cmd",
"=",
"'PYENV_VERSION={0} {1}'",
".",
"format",
"(",
"python",
",",
"cmdline",
")",
"else",
":",
"cmd",
"=",
"cmdline",
"return",
"do"... | Execute a python command with pyenv's shims using a specific python version.
CLI Example:
.. code-block:: bash
salt '*' pyenv.do_with_python 2.0.0-p0 'gem list bundler'
salt '*' pyenv.do_with_python 2.0.0-p0 'gem list bundler' deploy | [
"Execute",
"a",
"python",
"command",
"with",
"pyenv",
"s",
"shims",
"using",
"a",
"specific",
"python",
"version",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pyenv.py#L310-L326 |
35,754 | saltstack/salt | salt/states/boto_rds.py | present | def present(name,
allocated_storage,
db_instance_class,
engine,
master_username,
master_user_password,
db_name=None,
storage_type=None,
db_security_groups=None,
vpc_security_group_ids=None,
vpc_securi... | python | def present(name,
allocated_storage,
db_instance_class,
engine,
master_username,
master_user_password,
db_name=None,
storage_type=None,
db_security_groups=None,
vpc_security_group_ids=None,
vpc_securi... | [
"def",
"present",
"(",
"name",
",",
"allocated_storage",
",",
"db_instance_class",
",",
"engine",
",",
"master_username",
",",
"master_user_password",
",",
"db_name",
"=",
"None",
",",
"storage_type",
"=",
"None",
",",
"db_security_groups",
"=",
"None",
",",
"vp... | Ensure RDS instance exists.
name
Name of the RDS state definition.
allocated_storage
The amount of storage (in gigabytes) to be initially allocated for the
database instance.
db_instance_class
The compute and memory capacity of the Amazon RDS DB instance.
engine
... | [
"Ensure",
"RDS",
"instance",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_rds.py#L94-L361 |
35,755 | saltstack/salt | salt/states/boto_rds.py | replica_present | def replica_present(name, source, db_instance_class=None,
availability_zone=None, port=None,
auto_minor_version_upgrade=None, iops=None,
option_group_name=None, publicly_accessible=None,
tags=None, region=None, key=None, keyid=None,
... | python | def replica_present(name, source, db_instance_class=None,
availability_zone=None, port=None,
auto_minor_version_upgrade=None, iops=None,
option_group_name=None, publicly_accessible=None,
tags=None, region=None, key=None, keyid=None,
... | [
"def",
"replica_present",
"(",
"name",
",",
"source",
",",
"db_instance_class",
"=",
"None",
",",
"availability_zone",
"=",
"None",
",",
"port",
"=",
"None",
",",
"auto_minor_version_upgrade",
"=",
"None",
",",
"iops",
"=",
"None",
",",
"option_group_name",
"=... | Ensure RDS replica exists.
.. code-block:: yaml
Ensure myrds replica RDS exists:
boto_rds.create_replica:
- name: myreplica
- source: mydb | [
"Ensure",
"RDS",
"replica",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_rds.py#L364-L428 |
35,756 | saltstack/salt | salt/states/boto_rds.py | subnet_group_present | def subnet_group_present(name, description, subnet_ids=None, subnet_names=None,
tags=None, region=None, key=None, keyid=None,
profile=None):
'''
Ensure DB subnet group exists.
name
The name for the DB subnet group. This value is stored as a lowercas... | python | def subnet_group_present(name, description, subnet_ids=None, subnet_names=None,
tags=None, region=None, key=None, keyid=None,
profile=None):
'''
Ensure DB subnet group exists.
name
The name for the DB subnet group. This value is stored as a lowercas... | [
"def",
"subnet_group_present",
"(",
"name",
",",
"description",
",",
"subnet_ids",
"=",
"None",
",",
"subnet_names",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
... | Ensure DB subnet group exists.
name
The name for the DB subnet group. This value is stored as a lowercase string.
subnet_ids
A list of the EC2 Subnet IDs for the DB subnet group.
Either subnet_ids or subnet_names must be provided.
subnet_names
A list of The EC2 Subnet name... | [
"Ensure",
"DB",
"subnet",
"group",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_rds.py#L431-L523 |
35,757 | saltstack/salt | salt/states/boto_rds.py | absent | def absent(name, skip_final_snapshot=None, final_db_snapshot_identifier=None,
tags=None, wait_for_deletion=True, timeout=180,
region=None, key=None, keyid=None, profile=None):
'''
Ensure RDS instance is absent.
name
Name of the RDS instance.
skip_final_snapshot
Wh... | python | def absent(name, skip_final_snapshot=None, final_db_snapshot_identifier=None,
tags=None, wait_for_deletion=True, timeout=180,
region=None, key=None, keyid=None, profile=None):
'''
Ensure RDS instance is absent.
name
Name of the RDS instance.
skip_final_snapshot
Wh... | [
"def",
"absent",
"(",
"name",
",",
"skip_final_snapshot",
"=",
"None",
",",
"final_db_snapshot_identifier",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"wait_for_deletion",
"=",
"True",
",",
"timeout",
"=",
"180",
",",
"region",
"=",
"None",
",",
"key",
"=... | Ensure RDS instance is absent.
name
Name of the RDS instance.
skip_final_snapshot
Whether a final db snapshot is created before the instance is deleted.
If True, no snapshot is created.
If False, a snapshot is created before deleting the instance.
final_db_snapshot_identif... | [
"Ensure",
"RDS",
"instance",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_rds.py#L526-L595 |
35,758 | saltstack/salt | salt/utils/find.py | Finder.find | def find(self, path):
'''
Generate filenames in path that satisfy criteria specified in
the constructor.
This method is a generator and should be repeatedly called
until there are no more results.
'''
if self.mindepth < 1:
dirpath, name = os.path.split... | python | def find(self, path):
'''
Generate filenames in path that satisfy criteria specified in
the constructor.
This method is a generator and should be repeatedly called
until there are no more results.
'''
if self.mindepth < 1:
dirpath, name = os.path.split... | [
"def",
"find",
"(",
"self",
",",
"path",
")",
":",
"if",
"self",
".",
"mindepth",
"<",
"1",
":",
"dirpath",
",",
"name",
"=",
"os",
".",
"path",
".",
"split",
"(",
"path",
")",
"match",
",",
"fstat",
"=",
"self",
".",
"_check_criteria",
"(",
"dir... | Generate filenames in path that satisfy criteria specified in
the constructor.
This method is a generator and should be repeatedly called
until there are no more results. | [
"Generate",
"filenames",
"in",
"path",
"that",
"satisfy",
"criteria",
"specified",
"in",
"the",
"constructor",
".",
"This",
"method",
"is",
"a",
"generator",
"and",
"should",
"be",
"repeatedly",
"called",
"until",
"there",
"are",
"no",
"more",
"results",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/find.py#L632-L658 |
35,759 | saltstack/salt | salt/modules/pagerduty.py | create_event | def create_event(service_key=None, description=None, details=None,
incident_key=None, profile=None):
'''
Create an event in PagerDuty. Designed for use in states.
CLI Example:
.. code-block:: yaml
salt myminion pagerduty.create_event <service_key> <description> <details> \
... | python | def create_event(service_key=None, description=None, details=None,
incident_key=None, profile=None):
'''
Create an event in PagerDuty. Designed for use in states.
CLI Example:
.. code-block:: yaml
salt myminion pagerduty.create_event <service_key> <description> <details> \
... | [
"def",
"create_event",
"(",
"service_key",
"=",
"None",
",",
"description",
"=",
"None",
",",
"details",
"=",
"None",
",",
"incident_key",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"trigger_url",
"=",
"'https://events.pagerduty.com/generic/2010-04-15/cre... | Create an event in PagerDuty. Designed for use in states.
CLI Example:
.. code-block:: yaml
salt myminion pagerduty.create_event <service_key> <description> <details> \
profile=my-pagerduty-account
The following parameters are required:
service_key
This key can be found by u... | [
"Create",
"an",
"event",
"in",
"PagerDuty",
".",
"Designed",
"for",
"use",
"in",
"states",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty.py#L149-L197 |
35,760 | saltstack/salt | salt/states/win_certutil.py | add_store | def add_store(name, store, saltenv='base'):
'''
Store a certificate to the given store
name
The certificate to store, this can use local paths
or salt:// paths
store
The store to add the certificate to
saltenv
The salt environment to use, this is ignored if a local... | python | def add_store(name, store, saltenv='base'):
'''
Store a certificate to the given store
name
The certificate to store, this can use local paths
or salt:// paths
store
The store to add the certificate to
saltenv
The salt environment to use, this is ignored if a local... | [
"def",
"add_store",
"(",
"name",
",",
"store",
",",
"saltenv",
"=",
"'base'",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"cert_file",
"=",
"__sa... | Store a certificate to the given store
name
The certificate to store, this can use local paths
or salt:// paths
store
The store to add the certificate to
saltenv
The salt environment to use, this is ignored if a local
path is specified | [
"Store",
"a",
"certificate",
"to",
"the",
"given",
"store"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_certutil.py#L34-L73 |
35,761 | saltstack/salt | salt/client/mixins.py | SyncClientMixin.master_call | def master_call(self, **kwargs):
'''
Execute a function through the master network interface.
'''
load = kwargs
load['cmd'] = self.client
channel = salt.transport.client.ReqChannel.factory(self.opts,
crypt='clear'... | python | def master_call(self, **kwargs):
'''
Execute a function through the master network interface.
'''
load = kwargs
load['cmd'] = self.client
channel = salt.transport.client.ReqChannel.factory(self.opts,
crypt='clear'... | [
"def",
"master_call",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"load",
"=",
"kwargs",
"load",
"[",
"'cmd'",
"]",
"=",
"self",
".",
"client",
"channel",
"=",
"salt",
".",
"transport",
".",
"client",
".",
"ReqChannel",
".",
"factory",
"(",
"self... | Execute a function through the master network interface. | [
"Execute",
"a",
"function",
"through",
"the",
"master",
"network",
"interface",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/mixins.py#L139-L155 |
35,762 | saltstack/salt | salt/client/mixins.py | SyncClientMixin.store_job | def store_job(self):
'''
Helper that allows us to turn off storing jobs for different classes
that may incorporate this mixin.
'''
try:
class_name = self.__class__.__name__.lower()
except AttributeError:
log.warning(
'Unable to dete... | python | def store_job(self):
'''
Helper that allows us to turn off storing jobs for different classes
that may incorporate this mixin.
'''
try:
class_name = self.__class__.__name__.lower()
except AttributeError:
log.warning(
'Unable to dete... | [
"def",
"store_job",
"(",
"self",
")",
":",
"try",
":",
"class_name",
"=",
"self",
".",
"__class__",
".",
"__name__",
".",
"lower",
"(",
")",
"except",
"AttributeError",
":",
"log",
".",
"warning",
"(",
"'Unable to determine class name'",
",",
"exc_info_on_logl... | Helper that allows us to turn off storing jobs for different classes
that may incorporate this mixin. | [
"Helper",
"that",
"allows",
"us",
"to",
"turn",
"off",
"storing",
"jobs",
"for",
"different",
"classes",
"that",
"may",
"incorporate",
"this",
"mixin",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/mixins.py#L258-L277 |
35,763 | saltstack/salt | salt/client/mixins.py | SyncClientMixin.get_docs | def get_docs(self, arg=None):
'''
Return a dictionary of functions and the inline documentation for each
'''
if arg:
if '*' in arg:
target_mod = arg
_use_fnmatch = True
else:
target_mod = arg + '.' if not arg.endswit... | python | def get_docs(self, arg=None):
'''
Return a dictionary of functions and the inline documentation for each
'''
if arg:
if '*' in arg:
target_mod = arg
_use_fnmatch = True
else:
target_mod = arg + '.' if not arg.endswit... | [
"def",
"get_docs",
"(",
"self",
",",
"arg",
"=",
"None",
")",
":",
"if",
"arg",
":",
"if",
"'*'",
"in",
"arg",
":",
"target_mod",
"=",
"arg",
"_use_fnmatch",
"=",
"True",
"else",
":",
"target_mod",
"=",
"arg",
"+",
"'.'",
"if",
"not",
"arg",
".",
... | Return a dictionary of functions and the inline documentation for each | [
"Return",
"a",
"dictionary",
"of",
"functions",
"and",
"the",
"inline",
"documentation",
"for",
"each"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/mixins.py#L446-L468 |
35,764 | saltstack/salt | salt/client/mixins.py | AsyncClientMixin.asynchronous | def asynchronous(self, fun, low, user='UNKNOWN', pub=None):
'''
Execute the function in a multiprocess and return the event tag to use
to watch for the return
'''
async_pub = pub if pub is not None else self._gen_async_pub()
proc = salt.utils.process.SignalHandlingMultip... | python | def asynchronous(self, fun, low, user='UNKNOWN', pub=None):
'''
Execute the function in a multiprocess and return the event tag to use
to watch for the return
'''
async_pub = pub if pub is not None else self._gen_async_pub()
proc = salt.utils.process.SignalHandlingMultip... | [
"def",
"asynchronous",
"(",
"self",
",",
"fun",
",",
"low",
",",
"user",
"=",
"'UNKNOWN'",
",",
"pub",
"=",
"None",
")",
":",
"async_pub",
"=",
"pub",
"if",
"pub",
"is",
"not",
"None",
"else",
"self",
".",
"_gen_async_pub",
"(",
")",
"proc",
"=",
"... | Execute the function in a multiprocess and return the event tag to use
to watch for the return | [
"Execute",
"the",
"function",
"in",
"a",
"multiprocess",
"and",
"return",
"the",
"event",
"tag",
"to",
"use",
"to",
"watch",
"for",
"the",
"return"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/mixins.py#L525-L540 |
35,765 | saltstack/salt | salt/client/mixins.py | AsyncClientMixin.print_async_event | def print_async_event(self, suffix, event):
'''
Print all of the events with the prefix 'tag'
'''
if not isinstance(event, dict):
return
# if we are "quiet", don't print
if self.opts.get('quiet', False):
return
# some suffixes we don't wa... | python | def print_async_event(self, suffix, event):
'''
Print all of the events with the prefix 'tag'
'''
if not isinstance(event, dict):
return
# if we are "quiet", don't print
if self.opts.get('quiet', False):
return
# some suffixes we don't wa... | [
"def",
"print_async_event",
"(",
"self",
",",
"suffix",
",",
"event",
")",
":",
"if",
"not",
"isinstance",
"(",
"event",
",",
"dict",
")",
":",
"return",
"# if we are \"quiet\", don't print",
"if",
"self",
".",
"opts",
".",
"get",
"(",
"'quiet'",
",",
"Fal... | Print all of the events with the prefix 'tag' | [
"Print",
"all",
"of",
"the",
"events",
"with",
"the",
"prefix",
"tag"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/mixins.py#L542-L575 |
35,766 | saltstack/salt | doc/_ext/shorturls.py | write_urls_index | def write_urls_index(app, exc):
'''
Generate a JSON file to serve as an index for short-URL lookups
'''
inventory = os.path.join(app.builder.outdir, 'objects.inv')
objects = sphinx.ext.intersphinx.fetch_inventory(app, DOCS_URL, inventory)
with open(os.path.join(app.builder.outdir, 'shorturls.js... | python | def write_urls_index(app, exc):
'''
Generate a JSON file to serve as an index for short-URL lookups
'''
inventory = os.path.join(app.builder.outdir, 'objects.inv')
objects = sphinx.ext.intersphinx.fetch_inventory(app, DOCS_URL, inventory)
with open(os.path.join(app.builder.outdir, 'shorturls.js... | [
"def",
"write_urls_index",
"(",
"app",
",",
"exc",
")",
":",
"inventory",
"=",
"os",
".",
"path",
".",
"join",
"(",
"app",
".",
"builder",
".",
"outdir",
",",
"'objects.inv'",
")",
"objects",
"=",
"sphinx",
".",
"ext",
".",
"intersphinx",
".",
"fetch_i... | Generate a JSON file to serve as an index for short-URL lookups | [
"Generate",
"a",
"JSON",
"file",
"to",
"serve",
"as",
"an",
"index",
"for",
"short",
"-",
"URL",
"lookups"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/doc/_ext/shorturls.py#L11-L19 |
35,767 | saltstack/salt | salt/utils/mac_utils.py | execute_return_success | def execute_return_success(cmd):
'''
Executes the passed command. Returns True if successful
:param str cmd: The command to run
:return: True if successful, otherwise False
:rtype: bool
:raises: Error if command fails or is not supported
'''
ret = _run_all(cmd)
if ret['retcode']... | python | def execute_return_success(cmd):
'''
Executes the passed command. Returns True if successful
:param str cmd: The command to run
:return: True if successful, otherwise False
:rtype: bool
:raises: Error if command fails or is not supported
'''
ret = _run_all(cmd)
if ret['retcode']... | [
"def",
"execute_return_success",
"(",
"cmd",
")",
":",
"ret",
"=",
"_run_all",
"(",
"cmd",
")",
"if",
"ret",
"[",
"'retcode'",
"]",
"!=",
"0",
"or",
"'not supported'",
"in",
"ret",
"[",
"'stdout'",
"]",
".",
"lower",
"(",
")",
":",
"msg",
"=",
"'Comm... | Executes the passed command. Returns True if successful
:param str cmd: The command to run
:return: True if successful, otherwise False
:rtype: bool
:raises: Error if command fails or is not supported | [
"Executes",
"the",
"passed",
"command",
".",
"Returns",
"True",
"if",
"successful"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/mac_utils.py#L144-L165 |
35,768 | saltstack/salt | salt/utils/mac_utils.py | execute_return_result | def execute_return_result(cmd):
'''
Executes the passed command. Returns the standard out if successful
:param str cmd: The command to run
:return: The standard out of the command if successful, otherwise returns
an error
:rtype: str
:raises: Error if command fails or is not supported
... | python | def execute_return_result(cmd):
'''
Executes the passed command. Returns the standard out if successful
:param str cmd: The command to run
:return: The standard out of the command if successful, otherwise returns
an error
:rtype: str
:raises: Error if command fails or is not supported
... | [
"def",
"execute_return_result",
"(",
"cmd",
")",
":",
"ret",
"=",
"_run_all",
"(",
"cmd",
")",
"if",
"ret",
"[",
"'retcode'",
"]",
"!=",
"0",
"or",
"'not supported'",
"in",
"ret",
"[",
"'stdout'",
"]",
".",
"lower",
"(",
")",
":",
"msg",
"=",
"'Comma... | Executes the passed command. Returns the standard out if successful
:param str cmd: The command to run
:return: The standard out of the command if successful, otherwise returns
an error
:rtype: str
:raises: Error if command fails or is not supported | [
"Executes",
"the",
"passed",
"command",
".",
"Returns",
"the",
"standard",
"out",
"if",
"successful"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/mac_utils.py#L168-L189 |
35,769 | saltstack/salt | salt/utils/mac_utils.py | confirm_updated | def confirm_updated(value, check_fun, normalize_ret=False, wait=5):
'''
Wait up to ``wait`` seconds for a system parameter to be changed before
deciding it hasn't changed.
:param str value: The value indicating a successful change
:param function check_fun: The function whose return is compared wi... | python | def confirm_updated(value, check_fun, normalize_ret=False, wait=5):
'''
Wait up to ``wait`` seconds for a system parameter to be changed before
deciding it hasn't changed.
:param str value: The value indicating a successful change
:param function check_fun: The function whose return is compared wi... | [
"def",
"confirm_updated",
"(",
"value",
",",
"check_fun",
",",
"normalize_ret",
"=",
"False",
",",
"wait",
"=",
"5",
")",
":",
"for",
"i",
"in",
"range",
"(",
"wait",
")",
":",
"state",
"=",
"validate_enabled",
"(",
"check_fun",
"(",
")",
")",
"if",
... | Wait up to ``wait`` seconds for a system parameter to be changed before
deciding it hasn't changed.
:param str value: The value indicating a successful change
:param function check_fun: The function whose return is compared with
``value``
:param bool normalize_ret: Whether to normalize the re... | [
"Wait",
"up",
"to",
"wait",
"seconds",
"for",
"a",
"system",
"parameter",
"to",
"be",
"changed",
"before",
"deciding",
"it",
"hasn",
"t",
"changed",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/mac_utils.py#L239-L260 |
35,770 | saltstack/salt | salt/utils/mac_utils.py | launchctl | def launchctl(sub_cmd, *args, **kwargs):
'''
Run a launchctl command and raise an error if it fails
Args: additional args are passed to launchctl
sub_cmd (str): Sub command supplied to launchctl
Kwargs: passed to ``cmd.run_all``
return_stdout (bool): A keyword argument. If true return ... | python | def launchctl(sub_cmd, *args, **kwargs):
'''
Run a launchctl command and raise an error if it fails
Args: additional args are passed to launchctl
sub_cmd (str): Sub command supplied to launchctl
Kwargs: passed to ``cmd.run_all``
return_stdout (bool): A keyword argument. If true return ... | [
"def",
"launchctl",
"(",
"sub_cmd",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Get return type",
"return_stdout",
"=",
"kwargs",
".",
"pop",
"(",
"'return_stdout'",
",",
"False",
")",
"# Construct command",
"cmd",
"=",
"[",
"'launchctl'",
",",
... | Run a launchctl command and raise an error if it fails
Args: additional args are passed to launchctl
sub_cmd (str): Sub command supplied to launchctl
Kwargs: passed to ``cmd.run_all``
return_stdout (bool): A keyword argument. If true return the stdout of
the launchctl command
... | [
"Run",
"a",
"launchctl",
"command",
"and",
"raise",
"an",
"error",
"if",
"it",
"fails"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/mac_utils.py#L263-L309 |
35,771 | saltstack/salt | salt/utils/mac_utils.py | _available_services | def _available_services(refresh=False):
'''
This is a helper function for getting the available macOS services.
The strategy is to look through the known system locations for
launchd plist files, parse them, and use their information for
populating the list of services. Services can run without a p... | python | def _available_services(refresh=False):
'''
This is a helper function for getting the available macOS services.
The strategy is to look through the known system locations for
launchd plist files, parse them, and use their information for
populating the list of services. Services can run without a p... | [
"def",
"_available_services",
"(",
"refresh",
"=",
"False",
")",
":",
"try",
":",
"if",
"__context__",
"[",
"'available_services'",
"]",
"and",
"not",
"refresh",
":",
"log",
".",
"debug",
"(",
"'Found context for available services.'",
")",
"__context__",
"[",
"... | This is a helper function for getting the available macOS services.
The strategy is to look through the known system locations for
launchd plist files, parse them, and use their information for
populating the list of services. Services can run without a plist
file present, but normally services which h... | [
"This",
"is",
"a",
"helper",
"function",
"for",
"getting",
"the",
"available",
"macOS",
"services",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/mac_utils.py#L312-L417 |
35,772 | saltstack/salt | salt/utils/mac_utils.py | console_user | def console_user(username=False):
'''
Gets the UID or Username of the current console user.
:return: The uid or username of the console user.
:param bool username: Whether to return the username of the console
user instead of the UID. Defaults to False
:rtype: Interger of the UID, or a string... | python | def console_user(username=False):
'''
Gets the UID or Username of the current console user.
:return: The uid or username of the console user.
:param bool username: Whether to return the username of the console
user instead of the UID. Defaults to False
:rtype: Interger of the UID, or a string... | [
"def",
"console_user",
"(",
"username",
"=",
"False",
")",
":",
"try",
":",
"# returns the 'st_uid' stat from the /dev/console file.",
"uid",
"=",
"os",
".",
"stat",
"(",
"'/dev/console'",
")",
"[",
"4",
"]",
"except",
"(",
"OSError",
",",
"IndexError",
")",
"... | Gets the UID or Username of the current console user.
:return: The uid or username of the console user.
:param bool username: Whether to return the username of the console
user instead of the UID. Defaults to False
:rtype: Interger of the UID, or a string of the username.
Raises:
Command... | [
"Gets",
"the",
"UID",
"or",
"Username",
"of",
"the",
"current",
"console",
"user",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/mac_utils.py#L441-L472 |
35,773 | saltstack/salt | salt/states/pkgrepo.py | absent | def absent(name, **kwargs):
'''
This function deletes the specified repo on the system, if it exists. It
is essentially a wrapper around pkg.del_repo.
name
The name of the package repo, as it would be referred to when running
the regular package manager commands.
**UBUNTU-SPECIFIC ... | python | def absent(name, **kwargs):
'''
This function deletes the specified repo on the system, if it exists. It
is essentially a wrapper around pkg.del_repo.
name
The name of the package repo, as it would be referred to when running
the regular package manager commands.
**UBUNTU-SPECIFIC ... | [
"def",
"absent",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"if",
"'ppa'",
"in",
"kwargs",
"and",
"__gra... | This function deletes the specified repo on the system, if it exists. It
is essentially a wrapper around pkg.del_repo.
name
The name of the package repo, as it would be referred to when running
the regular package manager commands.
**UBUNTU-SPECIFIC OPTIONS**
ppa
On Ubuntu, yo... | [
"This",
"function",
"deletes",
"the",
"specified",
"repo",
"on",
"the",
"system",
"if",
"it",
"exists",
".",
"It",
"is",
"essentially",
"a",
"wrapper",
"around",
"pkg",
".",
"del_repo",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkgrepo.py#L538-L653 |
35,774 | saltstack/salt | salt/pillar/foreman.py | ext_pillar | def ext_pillar(minion_id,
pillar, # pylint: disable=W0613
key=None,
only=()):
'''
Read pillar data from Foreman via its API.
'''
url = __opts__['foreman.url']
user = __opts__['foreman.user']
password = __opts__['foreman.password']
api = __opts__[... | python | def ext_pillar(minion_id,
pillar, # pylint: disable=W0613
key=None,
only=()):
'''
Read pillar data from Foreman via its API.
'''
url = __opts__['foreman.url']
user = __opts__['foreman.user']
password = __opts__['foreman.password']
api = __opts__[... | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"pillar",
",",
"# pylint: disable=W0613",
"key",
"=",
"None",
",",
"only",
"=",
"(",
")",
")",
":",
"url",
"=",
"__opts__",
"[",
"'foreman.url'",
"]",
"user",
"=",
"__opts__",
"[",
"'foreman.user'",
"]",
"passwor... | Read pillar data from Foreman via its API. | [
"Read",
"pillar",
"data",
"from",
"Foreman",
"via",
"its",
"API",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/foreman.py#L81-L141 |
35,775 | saltstack/salt | salt/modules/boto_dynamodb.py | create_table | def create_table(table_name, region=None, key=None, keyid=None, profile=None,
read_capacity_units=None, write_capacity_units=None,
hash_key=None, hash_key_data_type=None, range_key=None,
range_key_data_type=None, local_indexes=None,
global_indexes=None... | python | def create_table(table_name, region=None, key=None, keyid=None, profile=None,
read_capacity_units=None, write_capacity_units=None,
hash_key=None, hash_key_data_type=None, range_key=None,
range_key_data_type=None, local_indexes=None,
global_indexes=None... | [
"def",
"create_table",
"(",
"table_name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"read_capacity_units",
"=",
"None",
",",
"write_capacity_units",
"=",
"None",
",",
"hash_key",
"=",
... | Creates a DynamoDB table.
CLI Example:
.. code-block:: bash
salt myminion boto_dynamodb.create_table table_name /
region=us-east-1 /
hash_key=id /
hash_key_data_type=N /
range_key=created_at /
range_key_data_type=N /
read_capacity_units=1 /
writ... | [
"Creates",
"a",
"DynamoDB",
"table",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_dynamodb.py#L85-L161 |
35,776 | saltstack/salt | salt/modules/boto_dynamodb.py | delete | def delete(table_name, region=None, key=None, keyid=None, profile=None):
'''
Delete a DynamoDB table.
CLI Example:
.. code-block:: bash
salt myminion boto_dynamodb.delete table_name region=us-east-1
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
table ... | python | def delete(table_name, region=None, key=None, keyid=None, profile=None):
'''
Delete a DynamoDB table.
CLI Example:
.. code-block:: bash
salt myminion boto_dynamodb.delete table_name region=us-east-1
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
table ... | [
"def",
"delete",
"(",
"table_name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
",",
"keyid",... | Delete a DynamoDB table.
CLI Example:
.. code-block:: bash
salt myminion boto_dynamodb.delete table_name region=us-east-1 | [
"Delete",
"a",
"DynamoDB",
"table",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_dynamodb.py#L185-L208 |
35,777 | saltstack/salt | salt/modules/boto_dynamodb.py | update | def update(table_name, throughput=None, global_indexes=None,
region=None, key=None, keyid=None, profile=None):
'''
Update a DynamoDB table.
CLI example::
salt myminion boto_dynamodb.update table_name region=us-east-1
'''
conn = _get_conn(region=region, key=key, keyid=keyid, prof... | python | def update(table_name, throughput=None, global_indexes=None,
region=None, key=None, keyid=None, profile=None):
'''
Update a DynamoDB table.
CLI example::
salt myminion boto_dynamodb.update table_name region=us-east-1
'''
conn = _get_conn(region=region, key=key, keyid=keyid, prof... | [
"def",
"update",
"(",
"table_name",
",",
"throughput",
"=",
"None",
",",
"global_indexes",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"... | Update a DynamoDB table.
CLI example::
salt myminion boto_dynamodb.update table_name region=us-east-1 | [
"Update",
"a",
"DynamoDB",
"table",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_dynamodb.py#L211-L222 |
35,778 | saltstack/salt | salt/modules/boto_dynamodb.py | create_global_secondary_index | def create_global_secondary_index(table_name, global_index, region=None,
key=None, keyid=None, profile=None):
'''
Creates a single global secondary index on a DynamoDB table.
CLI Example:
.. code-block:: bash
salt myminion boto_dynamodb.create_global_secondary... | python | def create_global_secondary_index(table_name, global_index, region=None,
key=None, keyid=None, profile=None):
'''
Creates a single global secondary index on a DynamoDB table.
CLI Example:
.. code-block:: bash
salt myminion boto_dynamodb.create_global_secondary... | [
"def",
"create_global_secondary_index",
"(",
"table_name",
",",
"global_index",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
... | Creates a single global secondary index on a DynamoDB table.
CLI Example:
.. code-block:: bash
salt myminion boto_dynamodb.create_global_secondary_index table_name /
index_name | [
"Creates",
"a",
"single",
"global",
"secondary",
"index",
"on",
"a",
"DynamoDB",
"table",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_dynamodb.py#L225-L238 |
35,779 | saltstack/salt | salt/modules/boto_dynamodb.py | update_global_secondary_index | def update_global_secondary_index(table_name, global_indexes, region=None,
key=None, keyid=None, profile=None):
'''
Updates the throughput of the given global secondary indexes.
CLI Example:
.. code-block:: bash
salt myminion boto_dynamodb.update_global_second... | python | def update_global_secondary_index(table_name, global_indexes, region=None,
key=None, keyid=None, profile=None):
'''
Updates the throughput of the given global secondary indexes.
CLI Example:
.. code-block:: bash
salt myminion boto_dynamodb.update_global_second... | [
"def",
"update_global_secondary_index",
"(",
"table_name",
",",
"global_indexes",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",... | Updates the throughput of the given global secondary indexes.
CLI Example:
.. code-block:: bash
salt myminion boto_dynamodb.update_global_secondary_index table_name /
indexes | [
"Updates",
"the",
"throughput",
"of",
"the",
"given",
"global",
"secondary",
"indexes",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_dynamodb.py#L241-L254 |
35,780 | saltstack/salt | salt/modules/boto_dynamodb.py | describe | def describe(table_name, region=None, key=None, keyid=None, profile=None):
'''
Describe a DynamoDB table.
CLI example::
salt myminion boto_dynamodb.describe table_name region=us-east-1
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
table = Table(table_name, ... | python | def describe(table_name, region=None, key=None, keyid=None, profile=None):
'''
Describe a DynamoDB table.
CLI example::
salt myminion boto_dynamodb.describe table_name region=us-east-1
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
table = Table(table_name, ... | [
"def",
"describe",
"(",
"table_name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
",",
"keyid... | Describe a DynamoDB table.
CLI example::
salt myminion boto_dynamodb.describe table_name region=us-east-1 | [
"Describe",
"a",
"DynamoDB",
"table",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_dynamodb.py#L257-L267 |
35,781 | saltstack/salt | salt/modules/boto_dynamodb.py | extract_index | def extract_index(index_data, global_index=False):
'''
Instantiates and returns an AllIndex object given a valid index
configuration
CLI Example:
salt myminion boto_dynamodb.extract_index index
'''
parsed_data = {}
keys = []
for key, value in six.iteritems(index_data):
... | python | def extract_index(index_data, global_index=False):
'''
Instantiates and returns an AllIndex object given a valid index
configuration
CLI Example:
salt myminion boto_dynamodb.extract_index index
'''
parsed_data = {}
keys = []
for key, value in six.iteritems(index_data):
... | [
"def",
"extract_index",
"(",
"index_data",
",",
"global_index",
"=",
"False",
")",
":",
"parsed_data",
"=",
"{",
"}",
"keys",
"=",
"[",
"]",
"for",
"key",
",",
"value",
"in",
"six",
".",
"iteritems",
"(",
"index_data",
")",
":",
"for",
"item",
"in",
... | Instantiates and returns an AllIndex object given a valid index
configuration
CLI Example:
salt myminion boto_dynamodb.extract_index index | [
"Instantiates",
"and",
"returns",
"an",
"AllIndex",
"object",
"given",
"a",
"valid",
"index",
"configuration"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_dynamodb.py#L270-L353 |
35,782 | saltstack/salt | salt/modules/cpan.py | install | def install(module):
'''
Install a Perl module from CPAN
CLI Example:
.. code-block:: bash
salt '*' cpan.install Template::Alloy
'''
ret = {
'old': None,
'new': None,
}
old_info = show(module)
cmd = 'cpan -i {0}'.format(module)
out = __salt__['cmd.run... | python | def install(module):
'''
Install a Perl module from CPAN
CLI Example:
.. code-block:: bash
salt '*' cpan.install Template::Alloy
'''
ret = {
'old': None,
'new': None,
}
old_info = show(module)
cmd = 'cpan -i {0}'.format(module)
out = __salt__['cmd.run... | [
"def",
"install",
"(",
"module",
")",
":",
"ret",
"=",
"{",
"'old'",
":",
"None",
",",
"'new'",
":",
"None",
",",
"}",
"old_info",
"=",
"show",
"(",
"module",
")",
"cmd",
"=",
"'cpan -i {0}'",
".",
"format",
"(",
"module",
")",
"out",
"=",
"__salt_... | Install a Perl module from CPAN
CLI Example:
.. code-block:: bash
salt '*' cpan.install Template::Alloy | [
"Install",
"a",
"Perl",
"module",
"from",
"CPAN"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cpan.py#L35-L63 |
35,783 | saltstack/salt | salt/modules/cpan.py | remove | def remove(module, details=False):
'''
Attempt to remove a Perl module that was installed from CPAN. Because the
``cpan`` command doesn't actually support "uninstall"-like functionality,
this function will attempt to do what it can, with what it has from CPAN.
Until this function is declared stable... | python | def remove(module, details=False):
'''
Attempt to remove a Perl module that was installed from CPAN. Because the
``cpan`` command doesn't actually support "uninstall"-like functionality,
this function will attempt to do what it can, with what it has from CPAN.
Until this function is declared stable... | [
"def",
"remove",
"(",
"module",
",",
"details",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'old'",
":",
"None",
",",
"'new'",
":",
"None",
",",
"}",
"info",
"=",
"show",
"(",
"module",
")",
"if",
"'error'",
"in",
"info",
":",
"return",
"{",
"'erro... | Attempt to remove a Perl module that was installed from CPAN. Because the
``cpan`` command doesn't actually support "uninstall"-like functionality,
this function will attempt to do what it can, with what it has from CPAN.
Until this function is declared stable, USE AT YOUR OWN RISK!
CLI Example:
... | [
"Attempt",
"to",
"remove",
"a",
"Perl",
"module",
"that",
"was",
"installed",
"from",
"CPAN",
".",
"Because",
"the",
"cpan",
"command",
"doesn",
"t",
"actually",
"support",
"uninstall",
"-",
"like",
"functionality",
"this",
"function",
"will",
"attempt",
"to",... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cpan.py#L66-L130 |
35,784 | saltstack/salt | salt/modules/cpan.py | list_ | def list_():
'''
List installed Perl modules, and the version installed
CLI Example:
.. code-block:: bash
salt '*' cpan.list
'''
ret = {}
cmd = 'cpan -l'
out = __salt__['cmd.run'](cmd).splitlines()
for line in out:
comps = line.split()
ret[comps[0]] = comps... | python | def list_():
'''
List installed Perl modules, and the version installed
CLI Example:
.. code-block:: bash
salt '*' cpan.list
'''
ret = {}
cmd = 'cpan -l'
out = __salt__['cmd.run'](cmd).splitlines()
for line in out:
comps = line.split()
ret[comps[0]] = comps... | [
"def",
"list_",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"'cpan -l'",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
")",
".",
"splitlines",
"(",
")",
"for",
"line",
"in",
"out",
":",
"comps",
"=",
"line",
".",
"split",
"(",
... | List installed Perl modules, and the version installed
CLI Example:
.. code-block:: bash
salt '*' cpan.list | [
"List",
"installed",
"Perl",
"modules",
"and",
"the",
"version",
"installed"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cpan.py#L133-L149 |
35,785 | saltstack/salt | salt/modules/cpan.py | show | def show(module):
'''
Show information about a specific Perl module
CLI Example:
.. code-block:: bash
salt '*' cpan.show Template::Alloy
'''
ret = {}
ret['name'] = module
# This section parses out details from CPAN, if possible
cmd = 'cpan -D {0}'.format(module)
out =... | python | def show(module):
'''
Show information about a specific Perl module
CLI Example:
.. code-block:: bash
salt '*' cpan.show Template::Alloy
'''
ret = {}
ret['name'] = module
# This section parses out details from CPAN, if possible
cmd = 'cpan -D {0}'.format(module)
out =... | [
"def",
"show",
"(",
"module",
")",
":",
"ret",
"=",
"{",
"}",
"ret",
"[",
"'name'",
"]",
"=",
"module",
"# This section parses out details from CPAN, if possible",
"cmd",
"=",
"'cpan -D {0}'",
".",
"format",
"(",
"module",
")",
"out",
"=",
"__salt__",
"[",
"... | Show information about a specific Perl module
CLI Example:
.. code-block:: bash
salt '*' cpan.show Template::Alloy | [
"Show",
"information",
"about",
"a",
"specific",
"Perl",
"module"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cpan.py#L152-L214 |
35,786 | saltstack/salt | salt/modules/cpan.py | show_config | def show_config():
'''
Return a dict of CPAN configuration values
CLI Example:
.. code-block:: bash
salt '*' cpan.show_config
'''
ret = {}
cmd = 'cpan -J'
out = __salt__['cmd.run'](cmd).splitlines()
for line in out:
if '=>' not in line:
# TODO: Some opt... | python | def show_config():
'''
Return a dict of CPAN configuration values
CLI Example:
.. code-block:: bash
salt '*' cpan.show_config
'''
ret = {}
cmd = 'cpan -J'
out = __salt__['cmd.run'](cmd).splitlines()
for line in out:
if '=>' not in line:
# TODO: Some opt... | [
"def",
"show_config",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"'cpan -J'",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
")",
".",
"splitlines",
"(",
")",
"for",
"line",
"in",
"out",
":",
"if",
"'=>'",
"not",
"in",
"line",
"... | Return a dict of CPAN configuration values
CLI Example:
.. code-block:: bash
salt '*' cpan.show_config | [
"Return",
"a",
"dict",
"of",
"CPAN",
"configuration",
"values"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cpan.py#L217-L238 |
35,787 | saltstack/salt | salt/cache/mysql_cache.py | _init_client | def _init_client():
"""Initialize connection and create table if needed
"""
if client is not None:
return
global _mysql_kwargs, _table_name
_mysql_kwargs = {
'host': __opts__.get('mysql.host', '127.0.0.1'),
'user': __opts__.get('mysql.user', None),
'passwd': __opts__... | python | def _init_client():
"""Initialize connection and create table if needed
"""
if client is not None:
return
global _mysql_kwargs, _table_name
_mysql_kwargs = {
'host': __opts__.get('mysql.host', '127.0.0.1'),
'user': __opts__.get('mysql.user', None),
'passwd': __opts__... | [
"def",
"_init_client",
"(",
")",
":",
"if",
"client",
"is",
"not",
"None",
":",
"return",
"global",
"_mysql_kwargs",
",",
"_table_name",
"_mysql_kwargs",
"=",
"{",
"'host'",
":",
"__opts__",
".",
"get",
"(",
"'mysql.host'",
",",
"'127.0.0.1'",
")",
",",
"'... | Initialize connection and create table if needed | [
"Initialize",
"connection",
"and",
"create",
"table",
"if",
"needed"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/mysql_cache.py#L149-L176 |
35,788 | saltstack/salt | salt/modules/inspectlib/fsdb.py | CsvDB.new | def new(self):
'''
Create a new database and opens it.
:return:
'''
dbname = self._label()
self.db_path = os.path.join(self.path, dbname)
if not os.path.exists(self.db_path):
os.makedirs(self.db_path)
self._opened = True
self.list_tabl... | python | def new(self):
'''
Create a new database and opens it.
:return:
'''
dbname = self._label()
self.db_path = os.path.join(self.path, dbname)
if not os.path.exists(self.db_path):
os.makedirs(self.db_path)
self._opened = True
self.list_tabl... | [
"def",
"new",
"(",
"self",
")",
":",
"dbname",
"=",
"self",
".",
"_label",
"(",
")",
"self",
".",
"db_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"path",
",",
"dbname",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
... | Create a new database and opens it.
:return: | [
"Create",
"a",
"new",
"database",
"and",
"opens",
"it",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L76-L89 |
35,789 | saltstack/salt | salt/modules/inspectlib/fsdb.py | CsvDB.purge | def purge(self, dbid):
'''
Purge the database.
:param dbid:
:return:
'''
db_path = os.path.join(self.path, dbid)
if os.path.exists(db_path):
shutil.rmtree(db_path, ignore_errors=True)
return True
return False | python | def purge(self, dbid):
'''
Purge the database.
:param dbid:
:return:
'''
db_path = os.path.join(self.path, dbid)
if os.path.exists(db_path):
shutil.rmtree(db_path, ignore_errors=True)
return True
return False | [
"def",
"purge",
"(",
"self",
",",
"dbid",
")",
":",
"db_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"path",
",",
"dbid",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"db_path",
")",
":",
"shutil",
".",
"rmtree",
"(",
"db_... | Purge the database.
:param dbid:
:return: | [
"Purge",
"the",
"database",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L91-L102 |
35,790 | saltstack/salt | salt/modules/inspectlib/fsdb.py | CsvDB.flush | def flush(self, table):
'''
Flush table.
:param table:
:return:
'''
table_path = os.path.join(self.db_path, table)
if os.path.exists(table_path):
os.unlink(table_path) | python | def flush(self, table):
'''
Flush table.
:param table:
:return:
'''
table_path = os.path.join(self.db_path, table)
if os.path.exists(table_path):
os.unlink(table_path) | [
"def",
"flush",
"(",
"self",
",",
"table",
")",
":",
"table_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"db_path",
",",
"table",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"table_path",
")",
":",
"os",
".",
"unlink",
"(",... | Flush table.
:param table:
:return: | [
"Flush",
"table",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L104-L113 |
35,791 | saltstack/salt | salt/modules/inspectlib/fsdb.py | CsvDB.list | def list(self):
'''
List all the databases on the given path.
:return:
'''
databases = []
for dbname in os.listdir(self.path):
databases.append(dbname)
return list(reversed(sorted(databases))) | python | def list(self):
'''
List all the databases on the given path.
:return:
'''
databases = []
for dbname in os.listdir(self.path):
databases.append(dbname)
return list(reversed(sorted(databases))) | [
"def",
"list",
"(",
"self",
")",
":",
"databases",
"=",
"[",
"]",
"for",
"dbname",
"in",
"os",
".",
"listdir",
"(",
"self",
".",
"path",
")",
":",
"databases",
".",
"append",
"(",
"dbname",
")",
"return",
"list",
"(",
"reversed",
"(",
"sorted",
"("... | List all the databases on the given path.
:return: | [
"List",
"all",
"the",
"databases",
"on",
"the",
"given",
"path",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L115-L124 |
35,792 | saltstack/salt | salt/modules/inspectlib/fsdb.py | CsvDB.list_tables | def list_tables(self):
'''
Load existing tables and their descriptions.
:return:
'''
if not self._tables:
for table_name in os.listdir(self.db_path):
self._tables[table_name] = self._load_table(table_name)
return self._tables.keys() | python | def list_tables(self):
'''
Load existing tables and their descriptions.
:return:
'''
if not self._tables:
for table_name in os.listdir(self.db_path):
self._tables[table_name] = self._load_table(table_name)
return self._tables.keys() | [
"def",
"list_tables",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_tables",
":",
"for",
"table_name",
"in",
"os",
".",
"listdir",
"(",
"self",
".",
"db_path",
")",
":",
"self",
".",
"_tables",
"[",
"table_name",
"]",
"=",
"self",
".",
"_load_ta... | Load existing tables and their descriptions.
:return: | [
"Load",
"existing",
"tables",
"and",
"their",
"descriptions",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L126-L136 |
35,793 | saltstack/salt | salt/modules/inspectlib/fsdb.py | CsvDB.open | def open(self, dbname=None):
'''
Open database from the path with the name or latest.
If there are no yet databases, create a new implicitly.
:return:
'''
databases = self.list()
if self.is_closed():
self.db_path = os.path.join(self.path, dbname or (d... | python | def open(self, dbname=None):
'''
Open database from the path with the name or latest.
If there are no yet databases, create a new implicitly.
:return:
'''
databases = self.list()
if self.is_closed():
self.db_path = os.path.join(self.path, dbname or (d... | [
"def",
"open",
"(",
"self",
",",
"dbname",
"=",
"None",
")",
":",
"databases",
"=",
"self",
".",
"list",
"(",
")",
"if",
"self",
".",
"is_closed",
"(",
")",
":",
"self",
".",
"db_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"pa... | Open database from the path with the name or latest.
If there are no yet databases, create a new implicitly.
:return: | [
"Open",
"database",
"from",
"the",
"path",
"with",
"the",
"name",
"or",
"latest",
".",
"If",
"there",
"are",
"no",
"yet",
"databases",
"create",
"a",
"new",
"implicitly",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L142-L154 |
35,794 | saltstack/salt | salt/modules/inspectlib/fsdb.py | CsvDB.store | def store(self, obj, distinct=False):
'''
Store an object in the table.
:param obj: An object to store
:param distinct: Store object only if there is none identical of such.
If at least one field is different, store it.
:return:
'''
if d... | python | def store(self, obj, distinct=False):
'''
Store an object in the table.
:param obj: An object to store
:param distinct: Store object only if there is none identical of such.
If at least one field is different, store it.
:return:
'''
if d... | [
"def",
"store",
"(",
"self",
",",
"obj",
",",
"distinct",
"=",
"False",
")",
":",
"if",
"distinct",
":",
"fields",
"=",
"dict",
"(",
"zip",
"(",
"self",
".",
"_tables",
"[",
"obj",
".",
"_TABLE",
"]",
".",
"keys",
"(",
")",
",",
"obj",
".",
"_s... | Store an object in the table.
:param obj: An object to store
:param distinct: Store object only if there is none identical of such.
If at least one field is different, store it.
:return: | [
"Store",
"an",
"object",
"in",
"the",
"table",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L187-L203 |
35,795 | saltstack/salt | salt/modules/inspectlib/fsdb.py | CsvDB.delete | def delete(self, obj, matches=None, mt=None, lt=None, eq=None):
'''
Delete object from the database.
:param obj:
:param matches:
:param mt:
:param lt:
:param eq:
:return:
'''
deleted = False
objects = list()
for _obj in sel... | python | def delete(self, obj, matches=None, mt=None, lt=None, eq=None):
'''
Delete object from the database.
:param obj:
:param matches:
:param mt:
:param lt:
:param eq:
:return:
'''
deleted = False
objects = list()
for _obj in sel... | [
"def",
"delete",
"(",
"self",
",",
"obj",
",",
"matches",
"=",
"None",
",",
"mt",
"=",
"None",
",",
"lt",
"=",
"None",
",",
"eq",
"=",
"None",
")",
":",
"deleted",
"=",
"False",
"objects",
"=",
"list",
"(",
")",
"for",
"_obj",
"in",
"self",
"."... | Delete object from the database.
:param obj:
:param matches:
:param mt:
:param lt:
:param eq:
:return: | [
"Delete",
"object",
"from",
"the",
"database",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L231-L255 |
35,796 | saltstack/salt | salt/modules/inspectlib/fsdb.py | CsvDB.__criteria | def __criteria(self, obj, matches=None, mt=None, lt=None, eq=None):
'''
Returns True if object is aligned to the criteria.
:param obj:
:param matches:
:param mt:
:param lt:
:param eq:
:return: Boolean
'''
# Fail matcher if "less than"
... | python | def __criteria(self, obj, matches=None, mt=None, lt=None, eq=None):
'''
Returns True if object is aligned to the criteria.
:param obj:
:param matches:
:param mt:
:param lt:
:param eq:
:return: Boolean
'''
# Fail matcher if "less than"
... | [
"def",
"__criteria",
"(",
"self",
",",
"obj",
",",
"matches",
"=",
"None",
",",
"mt",
"=",
"None",
",",
"lt",
"=",
"None",
",",
"eq",
"=",
"None",
")",
":",
"# Fail matcher if \"less than\"",
"for",
"field",
",",
"value",
"in",
"(",
"mt",
"or",
"{",
... | Returns True if object is aligned to the criteria.
:param obj:
:param matches:
:param mt:
:param lt:
:param eq:
:return: Boolean | [
"Returns",
"True",
"if",
"object",
"is",
"aligned",
"to",
"the",
"criteria",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L263-L294 |
35,797 | saltstack/salt | salt/modules/inspectlib/fsdb.py | CsvDB.get | def get(self, obj, matches=None, mt=None, lt=None, eq=None):
'''
Get objects from the table.
:param table_name:
:param matches: Regexp.
:param mt: More than.
:param lt: Less than.
:param eq: Equals.
:return:
'''
objects = []
with g... | python | def get(self, obj, matches=None, mt=None, lt=None, eq=None):
'''
Get objects from the table.
:param table_name:
:param matches: Regexp.
:param mt: More than.
:param lt: Less than.
:param eq: Equals.
:return:
'''
objects = []
with g... | [
"def",
"get",
"(",
"self",
",",
"obj",
",",
"matches",
"=",
"None",
",",
"mt",
"=",
"None",
",",
"lt",
"=",
"None",
",",
"eq",
"=",
"None",
")",
":",
"objects",
"=",
"[",
"]",
"with",
"gzip",
".",
"open",
"(",
"os",
".",
"path",
".",
"join",
... | Get objects from the table.
:param table_name:
:param matches: Regexp.
:param mt: More than.
:param lt: Less than.
:param eq: Equals.
:return: | [
"Get",
"objects",
"from",
"the",
"table",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L296-L320 |
35,798 | saltstack/salt | salt/runners/event.py | send | def send(tag, data=None):
'''
Send an event with the given tag and data.
This is useful for sending events directly to the master from the shell
with salt-run. It is also quite useful for sending events in orchestration
states where the ``fire_event`` requisite isn't sufficient because it does
... | python | def send(tag, data=None):
'''
Send an event with the given tag and data.
This is useful for sending events directly to the master from the shell
with salt-run. It is also quite useful for sending events in orchestration
states where the ``fire_event`` requisite isn't sufficient because it does
... | [
"def",
"send",
"(",
"tag",
",",
"data",
"=",
"None",
")",
":",
"data",
"=",
"data",
"or",
"{",
"}",
"event",
"=",
"salt",
".",
"utils",
".",
"event",
".",
"get_master_event",
"(",
"__opts__",
",",
"__opts__",
"[",
"'sock_dir'",
"]",
",",
"listen",
... | Send an event with the given tag and data.
This is useful for sending events directly to the master from the shell
with salt-run. It is also quite useful for sending events in orchestration
states where the ``fire_event`` requisite isn't sufficient because it does
not support sending custom data with t... | [
"Send",
"an",
"event",
"with",
"the",
"given",
"tag",
"and",
"data",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/event.py#L17-L80 |
35,799 | saltstack/salt | salt/runners/cache.py | cloud | def cloud(tgt, provider=None):
'''
Return cloud cache data for target.
.. note:: Only works with glob matching
tgt
Glob Target to match minion ids
provider
Cloud Provider
CLI Example:
.. code-block:: bash
salt-run cache.cloud 'salt*'
salt-run cache.cloud gla... | python | def cloud(tgt, provider=None):
'''
Return cloud cache data for target.
.. note:: Only works with glob matching
tgt
Glob Target to match minion ids
provider
Cloud Provider
CLI Example:
.. code-block:: bash
salt-run cache.cloud 'salt*'
salt-run cache.cloud gla... | [
"def",
"cloud",
"(",
"tgt",
",",
"provider",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"tgt",
",",
"six",
".",
"string_types",
")",
":",
"return",
"{",
"}",
"opts",
"=",
"salt",
".",
"config",
".",
"cloud_config",
"(",
"os",
".",
"path... | Return cloud cache data for target.
.. note:: Only works with glob matching
tgt
Glob Target to match minion ids
provider
Cloud Provider
CLI Example:
.. code-block:: bash
salt-run cache.cloud 'salt*'
salt-run cache.cloud glance.example.org provider=openstack | [
"Return",
"cloud",
"cache",
"data",
"for",
"target",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/cache.py#L346-L385 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.