repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/tls.py | validate | def validate(cert, ca_name, crl_file):
'''
.. versionadded:: Neon
Validate a certificate against a given CA/CRL.
cert
path to the certifiate PEM file or string
ca_name
name of the CA
crl_file
full path to the CRL file
'''
store = OpenSSL.crypto.X509Store()
... | python | def validate(cert, ca_name, crl_file):
'''
.. versionadded:: Neon
Validate a certificate against a given CA/CRL.
cert
path to the certifiate PEM file or string
ca_name
name of the CA
crl_file
full path to the CRL file
'''
store = OpenSSL.crypto.X509Store()
... | [
"def",
"validate",
"(",
"cert",
",",
"ca_name",
",",
"crl_file",
")",
":",
"store",
"=",
"OpenSSL",
".",
"crypto",
".",
"X509Store",
"(",
")",
"cert_obj",
"=",
"_read_cert",
"(",
"cert",
")",
"if",
"cert_obj",
"is",
"None",
":",
"raise",
"CommandExecutio... | .. versionadded:: Neon
Validate a certificate against a given CA/CRL.
cert
path to the certifiate PEM file or string
ca_name
name of the CA
crl_file
full path to the CRL file | [
"..",
"versionadded",
"::",
"Neon"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L566-L609 | train |
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 | train |
saltstack/salt | salt/modules/tls.py | create_ca | def create_ca(ca_name,
bits=2048,
days=365,
CN='localhost',
C='US',
ST='Utah',
L='Salt Lake City',
O='SaltStack',
OU=None,
emailAddress=None,
fixmode=False,
cacert_pa... | python | def create_ca(ca_name,
bits=2048,
days=365,
CN='localhost',
C='US',
ST='Utah',
L='Salt Lake City',
O='SaltStack',
OU=None,
emailAddress=None,
fixmode=False,
cacert_pa... | [
"def",
"create_ca",
"(",
"ca_name",
",",
"bits",
"=",
"2048",
",",
"days",
"=",
"365",
",",
"CN",
"=",
"'localhost'",
",",
"C",
"=",
"'US'",
",",
"ST",
"=",
"'Utah'",
",",
"L",
"=",
"'Salt Lake City'",
",",
"O",
"=",
"'SaltStack'",
",",
"OU",
"=",
... | Create a Certificate Authority (CA)
ca_name
name of the CA
bits
number of RSA key bits, default is 2048
days
number of days the CA will be valid, default is 365
CN
common name in the request, default is "localhost"
C
country, default is "US"
ST
st... | [
"Create",
"a",
"Certificate",
"Authority",
"(",
"CA",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L675-L870 | train |
saltstack/salt | salt/modules/tls.py | get_extensions | def get_extensions(cert_type):
'''
Fetch X509 and CSR extension definitions from tls:extensions:
(common|server|client) or set them to standard defaults.
.. versionadded:: 2015.8.0
cert_type:
The type of certificate such as ``server`` or ``client``.
CLI Example:
.. code-block:: b... | python | def get_extensions(cert_type):
'''
Fetch X509 and CSR extension definitions from tls:extensions:
(common|server|client) or set them to standard defaults.
.. versionadded:: 2015.8.0
cert_type:
The type of certificate such as ``server`` or ``client``.
CLI Example:
.. code-block:: b... | [
"def",
"get_extensions",
"(",
"cert_type",
")",
":",
"assert",
"X509_EXT_ENABLED",
",",
"(",
"'X509 extensions are not supported in '",
"'pyOpenSSL prior to version 0.15.1. Your '",
"'version: {0}'",
".",
"format",
"(",
"OpenSSL_version",
")",
")",
"ext",
"=",
"{",
"}",
... | Fetch X509 and CSR extension definitions from tls:extensions:
(common|server|client) or set them to standard defaults.
.. versionadded:: 2015.8.0
cert_type:
The type of certificate such as ``server`` or ``client``.
CLI Example:
.. code-block:: bash
salt '*' tls.get_extensions cl... | [
"Fetch",
"X509",
"and",
"CSR",
"extension",
"definitions",
"from",
"tls",
":",
"extensions",
":",
"(",
"common|server|client",
")",
"or",
"set",
"them",
"to",
"standard",
"defaults",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L873-L961 | train |
saltstack/salt | salt/modules/tls.py | create_csr | def create_csr(ca_name,
bits=2048,
CN='localhost',
C='US',
ST='Utah',
L='Salt Lake City',
O='SaltStack',
OU=None,
emailAddress=None,
subjectAltName=None,
cacert_path=None... | python | def create_csr(ca_name,
bits=2048,
CN='localhost',
C='US',
ST='Utah',
L='Salt Lake City',
O='SaltStack',
OU=None,
emailAddress=None,
subjectAltName=None,
cacert_path=None... | [
"def",
"create_csr",
"(",
"ca_name",
",",
"bits",
"=",
"2048",
",",
"CN",
"=",
"'localhost'",
",",
"C",
"=",
"'US'",
",",
"ST",
"=",
"'Utah'",
",",
"L",
"=",
"'Salt Lake City'",
",",
"O",
"=",
"'SaltStack'",
",",
"OU",
"=",
"None",
",",
"emailAddress... | Create a Certificate Signing Request (CSR) for a
particular Certificate Authority (CA)
ca_name
name of the CA
bits
number of RSA key bits, default is 2048
CN
common name in the request, default is "localhost"
C
country, default is "US"
ST
state, default i... | [
"Create",
"a",
"Certificate",
"Signing",
"Request",
"(",
"CSR",
")",
"for",
"a",
"particular",
"Certificate",
"Authority",
"(",
"CA",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L964-L1193 | train |
saltstack/salt | salt/modules/tls.py | create_self_signed_cert | def create_self_signed_cert(tls_dir='tls',
bits=2048,
days=365,
CN='localhost',
C='US',
ST='Utah',
L='Salt Lake City',
O='Sa... | python | def create_self_signed_cert(tls_dir='tls',
bits=2048,
days=365,
CN='localhost',
C='US',
ST='Utah',
L='Salt Lake City',
O='Sa... | [
"def",
"create_self_signed_cert",
"(",
"tls_dir",
"=",
"'tls'",
",",
"bits",
"=",
"2048",
",",
"days",
"=",
"365",
",",
"CN",
"=",
"'localhost'",
",",
"C",
"=",
"'US'",
",",
"ST",
"=",
"'Utah'",
",",
"L",
"=",
"'Salt Lake City'",
",",
"O",
"=",
"'Sal... | Create a Self-Signed Certificate (CERT)
tls_dir
location appended to the ca.cert_base_path, default is 'tls'
bits
number of RSA key bits, default is 2048
CN
common name in the request, default is "localhost"
C
country, default is "US"
ST
state, default is "Ut... | [
"Create",
"a",
"Self",
"-",
"Signed",
"Certificate",
"(",
"CERT",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L1196-L1348 | train |
saltstack/salt | salt/modules/tls.py | create_ca_signed_cert | def create_ca_signed_cert(ca_name,
CN,
days=365,
cacert_path=None,
ca_filename=None,
cert_path=None,
cert_filename=None,
digest='sha256',
... | python | def create_ca_signed_cert(ca_name,
CN,
days=365,
cacert_path=None,
ca_filename=None,
cert_path=None,
cert_filename=None,
digest='sha256',
... | [
"def",
"create_ca_signed_cert",
"(",
"ca_name",
",",
"CN",
",",
"days",
"=",
"365",
",",
"cacert_path",
"=",
"None",
",",
"ca_filename",
"=",
"None",
",",
"cert_path",
"=",
"None",
",",
"cert_filename",
"=",
"None",
",",
"digest",
"=",
"'sha256'",
",",
"... | Create a Certificate (CERT) signed by a named Certificate Authority (CA)
If the certificate file already exists, the function just returns assuming
the CERT already exists.
The CN *must* match an existing CSR generated by create_csr. If it
does not, this method does nothing.
ca_name
name ... | [
"Create",
"a",
"Certificate",
"(",
"CERT",
")",
"signed",
"by",
"a",
"named",
"Certificate",
"Authority",
"(",
"CA",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L1351-L1579 | train |
saltstack/salt | salt/modules/tls.py | create_pkcs12 | def create_pkcs12(ca_name, CN, passphrase='', cacert_path=None, replace=False):
'''
Create a PKCS#12 browser certificate for a particular Certificate (CN)
ca_name
name of the CA
CN
common name matching the certificate signing request
passphrase
used to unlock the PKCS#12 cer... | python | def create_pkcs12(ca_name, CN, passphrase='', cacert_path=None, replace=False):
'''
Create a PKCS#12 browser certificate for a particular Certificate (CN)
ca_name
name of the CA
CN
common name matching the certificate signing request
passphrase
used to unlock the PKCS#12 cer... | [
"def",
"create_pkcs12",
"(",
"ca_name",
",",
"CN",
",",
"passphrase",
"=",
"''",
",",
"cacert_path",
"=",
"None",
",",
"replace",
"=",
"False",
")",
":",
"set_ca_path",
"(",
"cacert_path",
")",
"if",
"not",
"replace",
"and",
"os",
".",
"path",
".",
"ex... | Create a PKCS#12 browser certificate for a particular Certificate (CN)
ca_name
name of the CA
CN
common name matching the certificate signing request
passphrase
used to unlock the PKCS#12 certificate when loaded into the browser
cacert_path
absolute path to ca certificat... | [
"Create",
"a",
"PKCS#12",
"browser",
"certificate",
"for",
"a",
"particular",
"Certificate",
"(",
"CN",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L1582-L1673 | train |
saltstack/salt | salt/modules/tls.py | cert_info | def cert_info(cert, digest='sha256'):
'''
Return information for a particular certificate
cert
path to the certifiate PEM file or string
.. versionchanged:: 2018.3.4
digest
what digest to use for fingerprinting
CLI Example:
.. code-block:: bash
salt '*' tls.... | python | def cert_info(cert, digest='sha256'):
'''
Return information for a particular certificate
cert
path to the certifiate PEM file or string
.. versionchanged:: 2018.3.4
digest
what digest to use for fingerprinting
CLI Example:
.. code-block:: bash
salt '*' tls.... | [
"def",
"cert_info",
"(",
"cert",
",",
"digest",
"=",
"'sha256'",
")",
":",
"# format that OpenSSL returns dates in",
"date_fmt",
"=",
"'%Y%m%d%H%M%SZ'",
"if",
"'-----BEGIN'",
"not",
"in",
"cert",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"... | Return information for a particular certificate
cert
path to the certifiate PEM file or string
.. versionchanged:: 2018.3.4
digest
what digest to use for fingerprinting
CLI Example:
.. code-block:: bash
salt '*' tls.cert_info /dir/for/certs/cert.pem | [
"Return",
"information",
"for",
"a",
"particular",
"certificate"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L1676-L1770 | train |
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 | train |
saltstack/salt | salt/modules/tls.py | revoke_cert | def revoke_cert(
ca_name,
CN,
cacert_path=None,
ca_filename=None,
cert_path=None,
cert_filename=None,
crl_file=None,
digest='sha256',
):
'''
Revoke a certificate.
.. versionadded:: 2015.8.0
ca_name
Name of the CA.
CN
... | python | def revoke_cert(
ca_name,
CN,
cacert_path=None,
ca_filename=None,
cert_path=None,
cert_filename=None,
crl_file=None,
digest='sha256',
):
'''
Revoke a certificate.
.. versionadded:: 2015.8.0
ca_name
Name of the CA.
CN
... | [
"def",
"revoke_cert",
"(",
"ca_name",
",",
"CN",
",",
"cacert_path",
"=",
"None",
",",
"ca_filename",
"=",
"None",
",",
"cert_path",
"=",
"None",
",",
"cert_filename",
"=",
"None",
",",
"crl_file",
"=",
"None",
",",
"digest",
"=",
"'sha256'",
",",
")",
... | Revoke a certificate.
.. versionadded:: 2015.8.0
ca_name
Name of the CA.
CN
Common name matching the certificate signing request.
cacert_path
Absolute path to ca certificates root directory.
ca_filename
Alternative filename for the CA.
cert_path
Path... | [
"Revoke",
"a",
"certificate",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L1857-L2035 | train |
saltstack/salt | salt/utils/roster_matcher.py | _convert_range_to_list | def _convert_range_to_list(tgt, range_server):
'''
convert a seco.range range into a list target
'''
r = seco.range.Range(range_server)
try:
return r.expand(tgt)
except seco.range.RangeException as err:
log.error('Range server exception: %s', err)
return [] | python | def _convert_range_to_list(tgt, range_server):
'''
convert a seco.range range into a list target
'''
r = seco.range.Range(range_server)
try:
return r.expand(tgt)
except seco.range.RangeException as err:
log.error('Range server exception: %s', err)
return [] | [
"def",
"_convert_range_to_list",
"(",
"tgt",
",",
"range_server",
")",
":",
"r",
"=",
"seco",
".",
"range",
".",
"Range",
"(",
"range_server",
")",
"try",
":",
"return",
"r",
".",
"expand",
"(",
"tgt",
")",
"except",
"seco",
".",
"range",
".",
"RangeEx... | convert a seco.range range into a list target | [
"convert",
"a",
"seco",
".",
"range",
"range",
"into",
"a",
"list",
"target"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/roster_matcher.py#L133-L142 | train |
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 | train |
saltstack/salt | salt/utils/roster_matcher.py | RosterMatcher.ret_glob_minions | def ret_glob_minions(self):
'''
Return minions that match via glob
'''
fnfilter = functools.partial(fnmatch.filter, pat=self.tgt)
return self._ret_minions(fnfilter) | python | def ret_glob_minions(self):
'''
Return minions that match via glob
'''
fnfilter = functools.partial(fnmatch.filter, pat=self.tgt)
return self._ret_minions(fnfilter) | [
"def",
"ret_glob_minions",
"(",
"self",
")",
":",
"fnfilter",
"=",
"functools",
".",
"partial",
"(",
"fnmatch",
".",
"filter",
",",
"pat",
"=",
"self",
".",
"tgt",
")",
"return",
"self",
".",
"_ret_minions",
"(",
"fnfilter",
")"
] | Return minions that match via glob | [
"Return",
"minions",
"that",
"match",
"via",
"glob"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/roster_matcher.py#L77-L82 | train |
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 | train |
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 | train |
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 | train |
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 | train |
saltstack/salt | salt/utils/roster_matcher.py | RosterMatcher.get_data | def get_data(self, minion):
'''
Return the configured ip
'''
ret = copy.deepcopy(__opts__.get('roster_defaults', {}))
if isinstance(self.raw[minion], six.string_types):
ret.update({'host': self.raw[minion]})
return ret
elif isinstance(self.raw[mini... | python | def get_data(self, minion):
'''
Return the configured ip
'''
ret = copy.deepcopy(__opts__.get('roster_defaults', {}))
if isinstance(self.raw[minion], six.string_types):
ret.update({'host': self.raw[minion]})
return ret
elif isinstance(self.raw[mini... | [
"def",
"get_data",
"(",
"self",
",",
"minion",
")",
":",
"ret",
"=",
"copy",
".",
"deepcopy",
"(",
"__opts__",
".",
"get",
"(",
"'roster_defaults'",
",",
"{",
"}",
")",
")",
"if",
"isinstance",
"(",
"self",
".",
"raw",
"[",
"minion",
"]",
",",
"six... | Return the configured ip | [
"Return",
"the",
"configured",
"ip"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/roster_matcher.py#L119-L130 | train |
saltstack/salt | salt/output/raw.py | output | def output(data, **kwargs): # pylint: disable=unused-argument
'''
Rather basic....
'''
if not isinstance(data, six.string_types):
data = six.text_type(data)
return salt.utils.stringutils.to_unicode(data) | python | def output(data, **kwargs): # pylint: disable=unused-argument
'''
Rather basic....
'''
if not isinstance(data, six.string_types):
data = six.text_type(data)
return salt.utils.stringutils.to_unicode(data) | [
"def",
"output",
"(",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"if",
"not",
"isinstance",
"(",
"data",
",",
"six",
".",
"string_types",
")",
":",
"data",
"=",
"six",
".",
"text_type",
"(",
"data",
")",
"return",
"sa... | Rather basic.... | [
"Rather",
"basic",
"...."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/raw.py#L29-L35 | train |
saltstack/salt | salt/cloud/clouds/parallels.py | avail_images | def avail_images(call=None):
'''
Return a list of the images that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-images option'
)
items = query(act... | python | def avail_images(call=None):
'''
Return a list of the images that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-images option'
)
items = query(act... | [
"def",
"avail_images",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_images function must be called with '",
"'-f or --function, or with the --list-images option'",
")",
"items",
"=",
"query",
"("... | Return a list of the images that are on the provider | [
"Return",
"a",
"list",
"of",
"the",
"images",
"that",
"are",
"on",
"the",
"provider"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/parallels.py#L84-L99 | train |
saltstack/salt | salt/cloud/clouds/parallels.py | list_nodes | def list_nodes(call=None):
'''
Return a list of the VMs that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
ret = {}
items = query(action='ve')
for item in items:
... | python | def list_nodes(call=None):
'''
Return a list of the VMs that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
ret = {}
items = query(action='ve')
for item in items:
... | [
"def",
"list_nodes",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_nodes function must be called with -f or --function.'",
")",
"ret",
"=",
"{",
"}",
"items",
"=",
"query",
"(",
"action",
... | Return a list of the VMs that are on the provider | [
"Return",
"a",
"list",
"of",
"the",
"VMs",
"that",
"are",
"on",
"the",
"provider"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/parallels.py#L102-L128 | train |
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 | train |
saltstack/salt | salt/cloud/clouds/parallels.py | create | def create(vm_):
'''
Create a single VM from a data dict
'''
try:
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'par... | python | def create(vm_):
'''
Create a single VM from a data dict
'''
try:
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'par... | [
"def",
"create",
"(",
"vm_",
")",
":",
"try",
":",
"# Check for required profile parameters before sending any API calls.",
"if",
"vm_",
"[",
"'profile'",
"]",
"and",
"config",
".",
"is_profile_configured",
"(",
"__opts__",
",",
"__active_provider_name__",
"or",
"'paral... | Create a single VM from a data dict | [
"Create",
"a",
"single",
"VM",
"from",
"a",
"data",
"dict"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/parallels.py#L273-L365 | train |
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 | train |
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 | train |
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 | train |
saltstack/salt | salt/cloud/clouds/parallels.py | wait_until | def wait_until(name, state, timeout=300):
'''
Wait until a specific state has been reached on a node
'''
start_time = time.time()
node = show_instance(name, call='action')
while True:
if node['state'] == state:
return True
time.sleep(1)
if time.time() - start... | python | def wait_until(name, state, timeout=300):
'''
Wait until a specific state has been reached on a node
'''
start_time = time.time()
node = show_instance(name, call='action')
while True:
if node['state'] == state:
return True
time.sleep(1)
if time.time() - start... | [
"def",
"wait_until",
"(",
"name",
",",
"state",
",",
"timeout",
"=",
"300",
")",
":",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"node",
"=",
"show_instance",
"(",
"name",
",",
"call",
"=",
"'action'",
")",
"while",
"True",
":",
"if",
"node",
... | Wait until a specific state has been reached on a node | [
"Wait",
"until",
"a",
"specific",
"state",
"has",
"been",
"reached",
"on",
"a",
"node"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/parallels.py#L497-L509 | train |
saltstack/salt | salt/cloud/clouds/parallels.py | destroy | def destroy(name, call=None):
'''
Destroy a node.
CLI Example:
.. code-block:: bash
salt-cloud --destroy mymachine
'''
if call == 'function':
raise SaltCloudSystemExit(
'The destroy action must be called with -d, --destroy, '
'-a or --action.'
)... | python | def destroy(name, call=None):
'''
Destroy a node.
CLI Example:
.. code-block:: bash
salt-cloud --destroy mymachine
'''
if call == 'function':
raise SaltCloudSystemExit(
'The destroy action must be called with -d, --destroy, '
'-a or --action.'
)... | [
"def",
"destroy",
"(",
"name",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The destroy action must be called with -d, --destroy, '",
"'-a or --action.'",
")",
"__utils__",
"[",
"'cloud.fire_event'",
... | Destroy a node.
CLI Example:
.. code-block:: bash
salt-cloud --destroy mymachine | [
"Destroy",
"a",
"node",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/parallels.py#L512-L564 | train |
saltstack/salt | salt/cloud/clouds/parallels.py | start | def start(name, call=None):
'''
Start a node.
CLI Example:
.. code-block:: bash
salt-cloud -a start mymachine
'''
if call != 'action':
raise SaltCloudSystemExit(
'The show_instance action must be called with -a or --action.'
)
data = query(action='ve',... | python | def start(name, call=None):
'''
Start a node.
CLI Example:
.. code-block:: bash
salt-cloud -a start mymachine
'''
if call != 'action':
raise SaltCloudSystemExit(
'The show_instance action must be called with -a or --action.'
)
data = query(action='ve',... | [
"def",
"start",
"(",
"name",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"!=",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The show_instance action must be called with -a or --action.'",
")",
"data",
"=",
"query",
"(",
"action",
"=",
"'ve'",
",... | Start a node.
CLI Example:
.. code-block:: bash
salt-cloud -a start mymachine | [
"Start",
"a",
"node",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/parallels.py#L567-L587 | train |
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 | train |
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 | train |
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 | train |
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 | train |
saltstack/salt | salt/returners/local_cache.py | save_load | def save_load(jid, clear_load, minions=None, recurse_count=0):
'''
Save the load to the specified jid
minions argument is to provide a pre-computed list of matched minions for
the job, for cases when this function can't compute that list itself (such
as for salt-ssh)
'''
if recurse_count >=... | python | def save_load(jid, clear_load, minions=None, recurse_count=0):
'''
Save the load to the specified jid
minions argument is to provide a pre-computed list of matched minions for
the job, for cases when this function can't compute that list itself (such
as for salt-ssh)
'''
if recurse_count >=... | [
"def",
"save_load",
"(",
"jid",
",",
"clear_load",
",",
"minions",
"=",
"None",
",",
"recurse_count",
"=",
"0",
")",
":",
"if",
"recurse_count",
">=",
"5",
":",
"err",
"=",
"(",
"'save_load could not write job cache file after {0} retries.'",
".",
"format",
"(",... | Save the load to the specified jid
minions argument is to provide a pre-computed list of matched minions for
the job, for cases when this function can't compute that list itself (such
as for salt-ssh) | [
"Save",
"the",
"load",
"to",
"the",
"specified",
"jid"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/local_cache.py#L187-L238 | train |
saltstack/salt | salt/returners/local_cache.py | save_minions | def save_minions(jid, minions, syndic_id=None):
'''
Save/update the serialized list of minions for a given job
'''
# Ensure we have a list for Python 3 compatability
minions = list(minions)
log.debug(
'Adding minions for job %s%s: %s',
jid,
' from syndic master \'{0}\''.... | python | def save_minions(jid, minions, syndic_id=None):
'''
Save/update the serialized list of minions for a given job
'''
# Ensure we have a list for Python 3 compatability
minions = list(minions)
log.debug(
'Adding minions for job %s%s: %s',
jid,
' from syndic master \'{0}\''.... | [
"def",
"save_minions",
"(",
"jid",
",",
"minions",
",",
"syndic_id",
"=",
"None",
")",
":",
"# Ensure we have a list for Python 3 compatability",
"minions",
"=",
"list",
"(",
"minions",
")",
"log",
".",
"debug",
"(",
"'Adding minions for job %s%s: %s'",
",",
"jid",
... | Save/update the serialized list of minions for a given job | [
"Save",
"/",
"update",
"the",
"serialized",
"list",
"of",
"minions",
"for",
"a",
"given",
"job"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/local_cache.py#L241-L289 | train |
saltstack/salt | salt/returners/local_cache.py | get_load | def get_load(jid):
'''
Return the load data that marks a specified jid
'''
jid_dir = salt.utils.jid.jid_dir(jid, _job_dir(), __opts__['hash_type'])
load_fn = os.path.join(jid_dir, LOAD_P)
if not os.path.exists(jid_dir) or not os.path.exists(load_fn):
return {}
serial = salt.payload.S... | python | def get_load(jid):
'''
Return the load data that marks a specified jid
'''
jid_dir = salt.utils.jid.jid_dir(jid, _job_dir(), __opts__['hash_type'])
load_fn = os.path.join(jid_dir, LOAD_P)
if not os.path.exists(jid_dir) or not os.path.exists(load_fn):
return {}
serial = salt.payload.S... | [
"def",
"get_load",
"(",
"jid",
")",
":",
"jid_dir",
"=",
"salt",
".",
"utils",
".",
"jid",
".",
"jid_dir",
"(",
"jid",
",",
"_job_dir",
"(",
")",
",",
"__opts__",
"[",
"'hash_type'",
"]",
")",
"load_fn",
"=",
"os",
".",
"path",
".",
"join",
"(",
... | Return the load data that marks a specified jid | [
"Return",
"the",
"load",
"data",
"that",
"marks",
"a",
"specified",
"jid"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/local_cache.py#L292-L333 | train |
saltstack/salt | salt/returners/local_cache.py | get_jid | def get_jid(jid):
'''
Return the information returned when the specified job id was executed
'''
jid_dir = salt.utils.jid.jid_dir(jid, _job_dir(), __opts__['hash_type'])
serial = salt.payload.Serial(__opts__)
ret = {}
# Check to see if the jid is real, if not return the empty dict
if no... | python | def get_jid(jid):
'''
Return the information returned when the specified job id was executed
'''
jid_dir = salt.utils.jid.jid_dir(jid, _job_dir(), __opts__['hash_type'])
serial = salt.payload.Serial(__opts__)
ret = {}
# Check to see if the jid is real, if not return the empty dict
if no... | [
"def",
"get_jid",
"(",
"jid",
")",
":",
"jid_dir",
"=",
"salt",
".",
"utils",
".",
"jid",
".",
"jid_dir",
"(",
"jid",
",",
"_job_dir",
"(",
")",
",",
"__opts__",
"[",
"'hash_type'",
"]",
")",
"serial",
"=",
"salt",
".",
"payload",
".",
"Serial",
"(... | Return the information returned when the specified job id was executed | [
"Return",
"the",
"information",
"returned",
"when",
"the",
"specified",
"job",
"id",
"was",
"executed"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/local_cache.py#L336-L371 | train |
saltstack/salt | salt/returners/local_cache.py | get_jids | def get_jids():
'''
Return a dict mapping all job ids to job information
'''
ret = {}
for jid, job, _, _ in _walk_through(_job_dir()):
ret[jid] = salt.utils.jid.format_jid_instance(jid, job)
if __opts__.get('job_cache_store_endtime'):
endtime = get_endtime(jid)
... | python | def get_jids():
'''
Return a dict mapping all job ids to job information
'''
ret = {}
for jid, job, _, _ in _walk_through(_job_dir()):
ret[jid] = salt.utils.jid.format_jid_instance(jid, job)
if __opts__.get('job_cache_store_endtime'):
endtime = get_endtime(jid)
... | [
"def",
"get_jids",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"jid",
",",
"job",
",",
"_",
",",
"_",
"in",
"_walk_through",
"(",
"_job_dir",
"(",
")",
")",
":",
"ret",
"[",
"jid",
"]",
"=",
"salt",
".",
"utils",
".",
"jid",
".",
"format_jid_in... | Return a dict mapping all job ids to job information | [
"Return",
"a",
"dict",
"mapping",
"all",
"job",
"ids",
"to",
"job",
"information"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/local_cache.py#L374-L387 | train |
saltstack/salt | salt/returners/local_cache.py | get_jids_filter | def get_jids_filter(count, filter_find_job=True):
'''
Return a list of all jobs information filtered by the given criteria.
:param int count: show not more than the count of most recent jobs
:param bool filter_find_jobs: filter out 'saltutil.find_job' jobs
'''
keys = []
ret = []
for jid,... | python | def get_jids_filter(count, filter_find_job=True):
'''
Return a list of all jobs information filtered by the given criteria.
:param int count: show not more than the count of most recent jobs
:param bool filter_find_jobs: filter out 'saltutil.find_job' jobs
'''
keys = []
ret = []
for jid,... | [
"def",
"get_jids_filter",
"(",
"count",
",",
"filter_find_job",
"=",
"True",
")",
":",
"keys",
"=",
"[",
"]",
"ret",
"=",
"[",
"]",
"for",
"jid",
",",
"job",
",",
"_",
",",
"_",
"in",
"_walk_through",
"(",
"_job_dir",
"(",
")",
")",
":",
"job",
"... | Return a list of all jobs information filtered by the given criteria.
:param int count: show not more than the count of most recent jobs
:param bool filter_find_jobs: filter out 'saltutil.find_job' jobs | [
"Return",
"a",
"list",
"of",
"all",
"jobs",
"information",
"filtered",
"by",
"the",
"given",
"criteria",
".",
":",
"param",
"int",
"count",
":",
"show",
"not",
"more",
"than",
"the",
"count",
"of",
"most",
"recent",
"jobs",
":",
"param",
"bool",
"filter_... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/local_cache.py#L390-L410 | train |
saltstack/salt | salt/returners/local_cache.py | clean_old_jobs | def clean_old_jobs():
'''
Clean out the old jobs from the job cache
'''
if __opts__['keep_jobs'] != 0:
jid_root = _job_dir()
if not os.path.exists(jid_root):
return
# Keep track of any empty t_path dirs that need to be removed later
dirs_to_remove = set()
... | python | def clean_old_jobs():
'''
Clean out the old jobs from the job cache
'''
if __opts__['keep_jobs'] != 0:
jid_root = _job_dir()
if not os.path.exists(jid_root):
return
# Keep track of any empty t_path dirs that need to be removed later
dirs_to_remove = set()
... | [
"def",
"clean_old_jobs",
"(",
")",
":",
"if",
"__opts__",
"[",
"'keep_jobs'",
"]",
"!=",
"0",
":",
"jid_root",
"=",
"_job_dir",
"(",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"jid_root",
")",
":",
"return",
"# Keep track of any empty t_path ... | Clean out the old jobs from the job cache | [
"Clean",
"out",
"the",
"old",
"jobs",
"from",
"the",
"job",
"cache"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/local_cache.py#L413-L466 | train |
saltstack/salt | salt/returners/local_cache.py | update_endtime | def update_endtime(jid, time):
'''
Update (or store) the end time for a given job
Endtime is stored as a plain text string
'''
jid_dir = salt.utils.jid.jid_dir(jid, _job_dir(), __opts__['hash_type'])
try:
if not os.path.exists(jid_dir):
os.makedirs(jid_dir)
with salt... | python | def update_endtime(jid, time):
'''
Update (or store) the end time for a given job
Endtime is stored as a plain text string
'''
jid_dir = salt.utils.jid.jid_dir(jid, _job_dir(), __opts__['hash_type'])
try:
if not os.path.exists(jid_dir):
os.makedirs(jid_dir)
with salt... | [
"def",
"update_endtime",
"(",
"jid",
",",
"time",
")",
":",
"jid_dir",
"=",
"salt",
".",
"utils",
".",
"jid",
".",
"jid_dir",
"(",
"jid",
",",
"_job_dir",
"(",
")",
",",
"__opts__",
"[",
"'hash_type'",
"]",
")",
"try",
":",
"if",
"not",
"os",
".",
... | Update (or store) the end time for a given job
Endtime is stored as a plain text string | [
"Update",
"(",
"or",
"store",
")",
"the",
"end",
"time",
"for",
"a",
"given",
"job"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/local_cache.py#L469-L482 | train |
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 | train |
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 | train |
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 | train |
saltstack/salt | salt/serializers/yamlex.py | merge_recursive | def merge_recursive(obj_a, obj_b, level=False):
'''
Merge obj_b into obj_a.
'''
return aggregate(obj_a, obj_b, level,
map_class=AggregatedMap,
sequence_class=AggregatedSequence) | python | def merge_recursive(obj_a, obj_b, level=False):
'''
Merge obj_b into obj_a.
'''
return aggregate(obj_a, obj_b, level,
map_class=AggregatedMap,
sequence_class=AggregatedSequence) | [
"def",
"merge_recursive",
"(",
"obj_a",
",",
"obj_b",
",",
"level",
"=",
"False",
")",
":",
"return",
"aggregate",
"(",
"obj_a",
",",
"obj_b",
",",
"level",
",",
"map_class",
"=",
"AggregatedMap",
",",
"sequence_class",
"=",
"AggregatedSequence",
")"
] | Merge obj_b into obj_a. | [
"Merge",
"obj_b",
"into",
"obj_a",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/serializers/yamlex.py#L427-L433 | train |
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 | train |
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 | train |
saltstack/salt | salt/serializers/yamlex.py | Loader.construct_sls_int | def construct_sls_int(self, node):
'''
Verify integers and pass them in correctly is they are declared
as octal
'''
if node.value == '0':
pass
elif node.value.startswith('0') \
and not node.value.startswith(('0b', '0x')):
node.value... | python | def construct_sls_int(self, node):
'''
Verify integers and pass them in correctly is they are declared
as octal
'''
if node.value == '0':
pass
elif node.value.startswith('0') \
and not node.value.startswith(('0b', '0x')):
node.value... | [
"def",
"construct_sls_int",
"(",
"self",
",",
"node",
")",
":",
"if",
"node",
".",
"value",
"==",
"'0'",
":",
"pass",
"elif",
"node",
".",
"value",
".",
"startswith",
"(",
"'0'",
")",
"and",
"not",
"node",
".",
"value",
".",
"startswith",
"(",
"(",
... | Verify integers and pass them in correctly is they are declared
as octal | [
"Verify",
"integers",
"and",
"pass",
"them",
"in",
"correctly",
"is",
"they",
"are",
"declared",
"as",
"octal"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/serializers/yamlex.py#L265-L279 | train |
saltstack/salt | salt/states/boto_dynamodb.py | present | def present(name=None,
table_name=None,
region=None,
key=None,
keyid=None,
profile=None,
read_capacity_units=None,
write_capacity_units=None,
alarms=None,
alarms_from_pillar="boto_dynamodb_alarms",
ha... | python | def present(name=None,
table_name=None,
region=None,
key=None,
keyid=None,
profile=None,
read_capacity_units=None,
write_capacity_units=None,
alarms=None,
alarms_from_pillar="boto_dynamodb_alarms",
ha... | [
"def",
"present",
"(",
"name",
"=",
"None",
",",
"table_name",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"read_capacity_units",
"=",
"None",
",",
"write_capacity_units",... | Ensure the DynamoDB table exists. Table throughput can be updated after
table creation.
Global secondary indexes (GSIs) are managed with some exceptions:
- If a GSI deletion is detected, a failure will occur (deletes should be
done manually in the AWS console).
- If multiple GSIs are added in a... | [
"Ensure",
"the",
"DynamoDB",
"table",
"exists",
".",
"Table",
"throughput",
"can",
"be",
"updated",
"after",
"table",
"creation",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_dynamodb.py#L190-L425 | train |
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 | train |
saltstack/salt | salt/states/boto_dynamodb.py | _partition_index_names | def _partition_index_names(provisioned_index_names, index_names):
'''Returns 3 disjoint sets of indexes: existing, to be created, and to be deleted.'''
existing_index_names = set()
new_index_names = set()
for name in index_names:
if name in provisioned_index_names:
existing_index_nam... | python | def _partition_index_names(provisioned_index_names, index_names):
'''Returns 3 disjoint sets of indexes: existing, to be created, and to be deleted.'''
existing_index_names = set()
new_index_names = set()
for name in index_names:
if name in provisioned_index_names:
existing_index_nam... | [
"def",
"_partition_index_names",
"(",
"provisioned_index_names",
",",
"index_names",
")",
":",
"existing_index_names",
"=",
"set",
"(",
")",
"new_index_names",
"=",
"set",
"(",
")",
"for",
"name",
"in",
"index_names",
":",
"if",
"name",
"in",
"provisioned_index_na... | Returns 3 disjoint sets of indexes: existing, to be created, and to be deleted. | [
"Returns",
"3",
"disjoint",
"sets",
"of",
"indexes",
":",
"existing",
"to",
"be",
"created",
"and",
"to",
"be",
"deleted",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_dynamodb.py#L498-L508 | train |
saltstack/salt | salt/states/boto_dynamodb.py | _add_global_secondary_index | def _add_global_secondary_index(ret, name, index_name, changes_old, changes_new, comments,
gsi_config, region, key, keyid, profile):
'''Updates ret iff there was a failure or in test mode.'''
if __opts__['test']:
ret['result'] = None
ret['comment'] = 'Dynamo table... | python | def _add_global_secondary_index(ret, name, index_name, changes_old, changes_new, comments,
gsi_config, region, key, keyid, profile):
'''Updates ret iff there was a failure or in test mode.'''
if __opts__['test']:
ret['result'] = None
ret['comment'] = 'Dynamo table... | [
"def",
"_add_global_secondary_index",
"(",
"ret",
",",
"name",
",",
"index_name",
",",
"changes_old",
",",
"changes_new",
",",
"comments",
",",
"gsi_config",
",",
"region",
",",
"key",
",",
"keyid",
",",
"profile",
")",
":",
"if",
"__opts__",
"[",
"'test'",
... | Updates ret iff there was a failure or in test mode. | [
"Updates",
"ret",
"iff",
"there",
"was",
"a",
"failure",
"or",
"in",
"test",
"mode",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_dynamodb.py#L511-L535 | train |
saltstack/salt | salt/states/boto_dynamodb.py | _update_global_secondary_indexes | def _update_global_secondary_indexes(ret, changes_old, changes_new, comments, existing_index_names,
provisioned_gsi_config, gsi_config, name, region, key,
keyid, profile):
'''Updates ret iff there was a failure or in test mode.'''
try:
... | python | def _update_global_secondary_indexes(ret, changes_old, changes_new, comments, existing_index_names,
provisioned_gsi_config, gsi_config, name, region, key,
keyid, profile):
'''Updates ret iff there was a failure or in test mode.'''
try:
... | [
"def",
"_update_global_secondary_indexes",
"(",
"ret",
",",
"changes_old",
",",
"changes_new",
",",
"comments",
",",
"existing_index_names",
",",
"provisioned_gsi_config",
",",
"gsi_config",
",",
"name",
",",
"region",
",",
"key",
",",
"keyid",
",",
"profile",
")"... | Updates ret iff there was a failure or in test mode. | [
"Updates",
"ret",
"iff",
"there",
"was",
"a",
"failure",
"or",
"in",
"test",
"mode",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_dynamodb.py#L538-L575 | train |
saltstack/salt | salt/states/boto_dynamodb.py | _alarms_present | def _alarms_present(name, alarms, alarms_from_pillar,
write_capacity_units, read_capacity_units,
region, key, keyid, profile):
'''helper method for present. ensure that cloudwatch_alarms are set'''
# load data from alarms_from_pillar
tmp = copy.deepcopy(
__sa... | python | def _alarms_present(name, alarms, alarms_from_pillar,
write_capacity_units, read_capacity_units,
region, key, keyid, profile):
'''helper method for present. ensure that cloudwatch_alarms are set'''
# load data from alarms_from_pillar
tmp = copy.deepcopy(
__sa... | [
"def",
"_alarms_present",
"(",
"name",
",",
"alarms",
",",
"alarms_from_pillar",
",",
"write_capacity_units",
",",
"read_capacity_units",
",",
"region",
",",
"key",
",",
"keyid",
",",
"profile",
")",
":",
"# load data from alarms_from_pillar",
"tmp",
"=",
"copy",
... | helper method for present. ensure that cloudwatch_alarms are set | [
"helper",
"method",
"for",
"present",
".",
"ensure",
"that",
"cloudwatch_alarms",
"are",
"set"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_dynamodb.py#L617-L668 | train |
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 | train |
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 | train |
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 | train |
saltstack/salt | salt/utils/extmods.py | sync | def sync(opts,
form,
saltenv=None,
extmod_whitelist=None,
extmod_blacklist=None):
'''
Sync custom modules into the extension_modules directory
'''
if saltenv is None:
saltenv = ['base']
if extmod_whitelist is None:
extmod_whitelist = opts['extmod_... | python | def sync(opts,
form,
saltenv=None,
extmod_whitelist=None,
extmod_blacklist=None):
'''
Sync custom modules into the extension_modules directory
'''
if saltenv is None:
saltenv = ['base']
if extmod_whitelist is None:
extmod_whitelist = opts['extmod_... | [
"def",
"sync",
"(",
"opts",
",",
"form",
",",
"saltenv",
"=",
"None",
",",
"extmod_whitelist",
"=",
"None",
",",
"extmod_blacklist",
"=",
"None",
")",
":",
"if",
"saltenv",
"is",
"None",
":",
"saltenv",
"=",
"[",
"'base'",
"]",
"if",
"extmod_whitelist",
... | Sync custom modules into the extension_modules directory | [
"Sync",
"custom",
"modules",
"into",
"the",
"extension_modules",
"directory"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/extmods.py#L43-L159 | train |
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 | train |
saltstack/salt | salt/states/saltmod.py | state | def state(name,
tgt,
ssh=False,
tgt_type='glob',
ret='',
ret_config=None,
ret_kwargs=None,
highstate=None,
sls=None,
top=None,
saltenv=None,
test=None,
pillar=None,
pillarenv=None,
expect_minions=True,
... | python | def state(name,
tgt,
ssh=False,
tgt_type='glob',
ret='',
ret_config=None,
ret_kwargs=None,
highstate=None,
sls=None,
top=None,
saltenv=None,
test=None,
pillar=None,
pillarenv=None,
expect_minions=True,
... | [
"def",
"state",
"(",
"name",
",",
"tgt",
",",
"ssh",
"=",
"False",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"ret_config",
"=",
"None",
",",
"ret_kwargs",
"=",
"None",
",",
"highstate",
"=",
"None",
",",
"sls",
"=",
"None",
",",
... | Invoke a state run on a given target
name
An arbitrary name used to track the state execution
tgt
The target specification for the state run.
.. versionadded: 2016.11.0
Masterless support: When running on a masterless minion, the ``tgt``
is ignored and will always be ... | [
"Invoke",
"a",
"state",
"run",
"on",
"a",
"given",
"target"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/saltmod.py#L108-L452 | train |
saltstack/salt | salt/states/saltmod.py | function | def function(
name,
tgt,
ssh=False,
tgt_type='glob',
ret='',
ret_config=None,
ret_kwargs=None,
expect_minions=False,
fail_minions=None,
fail_function=None,
arg=None,
kwarg=None,
timeout=None,
batch=None,
... | python | def function(
name,
tgt,
ssh=False,
tgt_type='glob',
ret='',
ret_config=None,
ret_kwargs=None,
expect_minions=False,
fail_minions=None,
fail_function=None,
arg=None,
kwarg=None,
timeout=None,
batch=None,
... | [
"def",
"function",
"(",
"name",
",",
"tgt",
",",
"ssh",
"=",
"False",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"ret_config",
"=",
"None",
",",
"ret_kwargs",
"=",
"None",
",",
"expect_minions",
"=",
"False",
",",
"fail_minions",
"=",
... | Execute a single module function on a remote minion via salt or salt-ssh
name
The name of the function to run, aka cmd.run or pkg.install
tgt
The target specification, aka '*' for all minions
tgt_type
The target type, defaults to ``glob``
arg
The list of arguments to ... | [
"Execute",
"a",
"single",
"module",
"function",
"on",
"a",
"remote",
"minion",
"via",
"salt",
"or",
"salt",
"-",
"ssh"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/saltmod.py#L455-L633 | train |
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 | train |
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 | train |
saltstack/salt | salt/states/saltmod.py | parallel_runners | def parallel_runners(name, runners, **kwargs): # pylint: disable=unused-argument
'''
Executes multiple runner modules on the master in parallel.
.. versionadded:: 2017.x.0 (Nitrogen)
A separate thread is spawned for each runner. This state is intended to be
used with the orchestrate runner in pla... | python | def parallel_runners(name, runners, **kwargs): # pylint: disable=unused-argument
'''
Executes multiple runner modules on the master in parallel.
.. versionadded:: 2017.x.0 (Nitrogen)
A separate thread is spawned for each runner. This state is intended to be
used with the orchestrate runner in pla... | [
"def",
"parallel_runners",
"(",
"name",
",",
"runners",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"# For the sake of consistency, we treat a single string in the same way as",
"# a key without a value. This allows something like",
"# salt.parallel_runn... | Executes multiple runner modules on the master in parallel.
.. versionadded:: 2017.x.0 (Nitrogen)
A separate thread is spawned for each runner. This state is intended to be
used with the orchestrate runner in place of the ``saltmod.runner`` state
when different tasks should be run in parallel. In gene... | [
"Executes",
"multiple",
"runner",
"modules",
"on",
"the",
"master",
"in",
"parallel",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/saltmod.py#L822-L1003 | train |
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 | train |
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 | train |
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 | train |
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 | train |
saltstack/salt | salt/modules/slack_notify.py | post_message | def post_message(channel,
message,
from_name,
api_key=None,
icon=None):
'''
Send a message to a Slack channel.
:param channel: The channel name, either will work.
:param message: The message to send to the Slack channel.
:p... | python | def post_message(channel,
message,
from_name,
api_key=None,
icon=None):
'''
Send a message to a Slack channel.
:param channel: The channel name, either will work.
:param message: The message to send to the Slack channel.
:p... | [
"def",
"post_message",
"(",
"channel",
",",
"message",
",",
"from_name",
",",
"api_key",
"=",
"None",
",",
"icon",
"=",
"None",
")",
":",
"if",
"not",
"api_key",
":",
"api_key",
"=",
"_get_api_key",
"(",
")",
"if",
"not",
"channel",
":",
"log",
".",
... | Send a message to a Slack channel.
:param channel: The channel name, either will work.
:param message: The message to send to the Slack channel.
:param from_name: Specify who the message is from.
:param api_key: The Slack api key, if not specified in the configuration.
:param icon: ... | [
"Send",
"a",
"message",
"to",
"a",
"Slack",
"channel",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/slack_notify.py#L176-L241 | train |
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 | train |
saltstack/salt | salt/modules/groupadd.py | add | def add(name, gid=None, system=False, root=None):
'''
Add the specified group
name
Name of the new group
gid
Use GID for the new group
system
Create a system account
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' gr... | python | def add(name, gid=None, system=False, root=None):
'''
Add the specified group
name
Name of the new group
gid
Use GID for the new group
system
Create a system account
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' gr... | [
"def",
"add",
"(",
"name",
",",
"gid",
"=",
"None",
",",
"system",
"=",
"False",
",",
"root",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'groupadd'",
"]",
"if",
"gid",
":",
"cmd",
".",
"append",
"(",
"'-g {0}'",
".",
"format",
"(",
"gid",
")",
")... | Add the specified group
name
Name of the new group
gid
Use GID for the new group
system
Create a system account
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' group.add foo 3456 | [
"Add",
"the",
"specified",
"group"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/groupadd.py#L43-L78 | train |
saltstack/salt | salt/modules/groupadd.py | delete | def delete(name, root=None):
'''
Remove the named group
name
Name group to delete
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' group.delete foo
'''
cmd = ['groupdel']
if root is not None:
cmd.extend(('-R', root))
... | python | def delete(name, root=None):
'''
Remove the named group
name
Name group to delete
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' group.delete foo
'''
cmd = ['groupdel']
if root is not None:
cmd.extend(('-R', root))
... | [
"def",
"delete",
"(",
"name",
",",
"root",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'groupdel'",
"]",
"if",
"root",
"is",
"not",
"None",
":",
"cmd",
".",
"extend",
"(",
"(",
"'-R'",
",",
"root",
")",
")",
"cmd",
".",
"append",
"(",
"name",
")",... | Remove the named group
name
Name group to delete
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' group.delete foo | [
"Remove",
"the",
"named",
"group"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/groupadd.py#L81-L106 | train |
saltstack/salt | salt/modules/groupadd.py | info | def info(name, root=None):
'''
Return information about a group
name
Name of the group
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' group.info foo
'''
if root is not None:
getgrnam = functools.partial(_getgrnam, root=root)
... | python | def info(name, root=None):
'''
Return information about a group
name
Name of the group
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' group.info foo
'''
if root is not None:
getgrnam = functools.partial(_getgrnam, root=root)
... | [
"def",
"info",
"(",
"name",
",",
"root",
"=",
"None",
")",
":",
"if",
"root",
"is",
"not",
"None",
":",
"getgrnam",
"=",
"functools",
".",
"partial",
"(",
"_getgrnam",
",",
"root",
"=",
"root",
")",
"else",
":",
"getgrnam",
"=",
"functools",
".",
"... | Return information about a group
name
Name of the group
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' group.info foo | [
"Return",
"information",
"about",
"a",
"group"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/groupadd.py#L109-L135 | train |
saltstack/salt | salt/modules/groupadd.py | getent | def getent(refresh=False, root=None):
'''
Return info on all groups
refresh
Force a refresh of group information
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' group.getent
'''
if 'group.getent' in __context__ and not refresh:
... | python | def getent(refresh=False, root=None):
'''
Return info on all groups
refresh
Force a refresh of group information
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' group.getent
'''
if 'group.getent' in __context__ and not refresh:
... | [
"def",
"getent",
"(",
"refresh",
"=",
"False",
",",
"root",
"=",
"None",
")",
":",
"if",
"'group.getent'",
"in",
"__context__",
"and",
"not",
"refresh",
":",
"return",
"__context__",
"[",
"'group.getent'",
"]",
"ret",
"=",
"[",
"]",
"if",
"root",
"is",
... | Return info on all groups
refresh
Force a refresh of group information
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' group.getent | [
"Return",
"info",
"on",
"all",
"groups"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/groupadd.py#L148-L176 | train |
saltstack/salt | salt/modules/groupadd.py | _chattrib | def _chattrib(name, key, value, param, root=None):
'''
Change an attribute for a named user
'''
pre_info = info(name, root=root)
if not pre_info:
return False
if value == pre_info[key]:
return True
cmd = ['groupmod']
if root is not None:
cmd.extend(('-R', root)... | python | def _chattrib(name, key, value, param, root=None):
'''
Change an attribute for a named user
'''
pre_info = info(name, root=root)
if not pre_info:
return False
if value == pre_info[key]:
return True
cmd = ['groupmod']
if root is not None:
cmd.extend(('-R', root)... | [
"def",
"_chattrib",
"(",
"name",
",",
"key",
",",
"value",
",",
"param",
",",
"root",
"=",
"None",
")",
":",
"pre_info",
"=",
"info",
"(",
"name",
",",
"root",
"=",
"root",
")",
"if",
"not",
"pre_info",
":",
"return",
"False",
"if",
"value",
"==",
... | Change an attribute for a named user | [
"Change",
"an",
"attribute",
"for",
"a",
"named",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/groupadd.py#L179-L198 | train |
saltstack/salt | salt/modules/groupadd.py | adduser | def adduser(name, username, root=None):
'''
Add a user in the group.
name
Name of the group to modify
username
Username to add to the group
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' group.adduser foo bar
Verifies if a... | python | def adduser(name, username, root=None):
'''
Add a user in the group.
name
Name of the group to modify
username
Username to add to the group
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' group.adduser foo bar
Verifies if a... | [
"def",
"adduser",
"(",
"name",
",",
"username",
",",
"root",
"=",
"None",
")",
":",
"on_redhat_5",
"=",
"__grains__",
".",
"get",
"(",
"'os_family'",
")",
"==",
"'RedHat'",
"and",
"__grains__",
".",
"get",
"(",
"'osmajorrelease'",
")",
"==",
"'5'",
"on_s... | Add a user in the group.
name
Name of the group to modify
username
Username to add to the group
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' group.adduser foo bar
Verifies if a valid username 'bar' as a member of an existing gro... | [
"Add",
"a",
"user",
"in",
"the",
"group",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/groupadd.py#L223-L264 | train |
saltstack/salt | salt/modules/groupadd.py | deluser | def deluser(name, username, root=None):
'''
Remove a user from the group.
name
Name of the group to modify
username
Username to delete from the group
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' group.deluser foo bar
Rem... | python | def deluser(name, username, root=None):
'''
Remove a user from the group.
name
Name of the group to modify
username
Username to delete from the group
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' group.deluser foo bar
Rem... | [
"def",
"deluser",
"(",
"name",
",",
"username",
",",
"root",
"=",
"None",
")",
":",
"on_redhat_5",
"=",
"__grains__",
".",
"get",
"(",
"'os_family'",
")",
"==",
"'RedHat'",
"and",
"__grains__",
".",
"get",
"(",
"'osmajorrelease'",
")",
"==",
"'5'",
"on_s... | Remove a user from the group.
name
Name of the group to modify
username
Username to delete from the group
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' group.deluser foo bar
Removes a member user 'bar' from a group 'foo'. If grou... | [
"Remove",
"a",
"user",
"from",
"the",
"group",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/groupadd.py#L267-L319 | train |
saltstack/salt | salt/modules/groupadd.py | members | def members(name, members_list, root=None):
'''
Replaces members of the group with a provided list.
name
Name of the group to modify
members_list
Username list to set into the group
root
Directory to chroot into
CLI Example:
salt '*' group.members foo 'user1,... | python | def members(name, members_list, root=None):
'''
Replaces members of the group with a provided list.
name
Name of the group to modify
members_list
Username list to set into the group
root
Directory to chroot into
CLI Example:
salt '*' group.members foo 'user1,... | [
"def",
"members",
"(",
"name",
",",
"members_list",
",",
"root",
"=",
"None",
")",
":",
"on_redhat_5",
"=",
"__grains__",
".",
"get",
"(",
"'os_family'",
")",
"==",
"'RedHat'",
"and",
"__grains__",
".",
"get",
"(",
"'osmajorrelease'",
")",
"==",
"'5'",
"... | Replaces members of the group with a provided list.
name
Name of the group to modify
members_list
Username list to set into the group
root
Directory to chroot into
CLI Example:
salt '*' group.members foo 'user1,user2,user3,...'
Replaces a membership list for a l... | [
"Replaces",
"members",
"of",
"the",
"group",
"with",
"a",
"provided",
"list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/groupadd.py#L322-L379 | train |
saltstack/salt | salt/modules/groupadd.py | _getgrnam | def _getgrnam(name, root=None):
'''
Alternative implementation for getgrnam, that use only /etc/group
'''
root = root or '/'
passwd = os.path.join(root, 'etc/group')
with salt.utils.files.fopen(passwd) as fp_:
for line in fp_:
line = salt.utils.stringutils.to_unicode(line)
... | python | def _getgrnam(name, root=None):
'''
Alternative implementation for getgrnam, that use only /etc/group
'''
root = root or '/'
passwd = os.path.join(root, 'etc/group')
with salt.utils.files.fopen(passwd) as fp_:
for line in fp_:
line = salt.utils.stringutils.to_unicode(line)
... | [
"def",
"_getgrnam",
"(",
"name",
",",
"root",
"=",
"None",
")",
":",
"root",
"=",
"root",
"or",
"'/'",
"passwd",
"=",
"os",
".",
"path",
".",
"join",
"(",
"root",
",",
"'etc/group'",
")",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
... | Alternative implementation for getgrnam, that use only /etc/group | [
"Alternative",
"implementation",
"for",
"getgrnam",
"that",
"use",
"only",
"/",
"etc",
"/",
"group"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/groupadd.py#L382-L400 | train |
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 | train |
saltstack/salt | salt/modules/nagios.py | _execute_pillar | def _execute_pillar(pillar_name, run_type):
'''
Run one or more nagios plugins from pillar data and get the result of run_type
The pillar have to be in this format:
------
webserver:
Ping_google:
- check_icmp: 8.8.8.8
- check_icmp: google.com
Load:
... | python | def _execute_pillar(pillar_name, run_type):
'''
Run one or more nagios plugins from pillar data and get the result of run_type
The pillar have to be in this format:
------
webserver:
Ping_google:
- check_icmp: 8.8.8.8
- check_icmp: google.com
Load:
... | [
"def",
"_execute_pillar",
"(",
"pillar_name",
",",
"run_type",
")",
":",
"groups",
"=",
"__salt__",
"[",
"'pillar.get'",
"]",
"(",
"pillar_name",
")",
"data",
"=",
"{",
"}",
"for",
"group",
"in",
"groups",
":",
"data",
"[",
"group",
"]",
"=",
"{",
"}",... | Run one or more nagios plugins from pillar data and get the result of run_type
The pillar have to be in this format:
------
webserver:
Ping_google:
- check_icmp: 8.8.8.8
- check_icmp: google.com
Load:
- check_load: -w 0.8 -c 1
APT:
- ch... | [
"Run",
"one",
"or",
"more",
"nagios",
"plugins",
"from",
"pillar",
"data",
"and",
"get",
"the",
"result",
"of",
"run_type",
"The",
"pillar",
"have",
"to",
"be",
"in",
"this",
"format",
":",
"------",
"webserver",
":",
"Ping_google",
":",
"-",
"check_icmp",... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nagios.py#L44-L76 | train |
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 | train |
saltstack/salt | salt/modules/nagios.py | retcode_pillar | def retcode_pillar(pillar_name):
'''
Run one or more nagios plugins from pillar data and get the result of cmd.retcode
The pillar have to be in this format::
------
webserver:
Ping_google:
- check_icmp: 8.8.8.8
- check_icmp: google.com
... | python | def retcode_pillar(pillar_name):
'''
Run one or more nagios plugins from pillar data and get the result of cmd.retcode
The pillar have to be in this format::
------
webserver:
Ping_google:
- check_icmp: 8.8.8.8
- check_icmp: google.com
... | [
"def",
"retcode_pillar",
"(",
"pillar_name",
")",
":",
"groups",
"=",
"__salt__",
"[",
"'pillar.get'",
"]",
"(",
"pillar_name",
")",
"check",
"=",
"{",
"}",
"data",
"=",
"{",
"}",
"for",
"group",
"in",
"groups",
":",
"commands",
"=",
"groups",
"[",
"gr... | Run one or more nagios plugins from pillar data and get the result of cmd.retcode
The pillar have to be in this format::
------
webserver:
Ping_google:
- check_icmp: 8.8.8.8
- check_icmp: google.com
Load:
- check_load: -w 0.8 -... | [
"Run",
"one",
"or",
"more",
"nagios",
"plugins",
"from",
"pillar",
"data",
"and",
"get",
"the",
"result",
"of",
"cmd",
".",
"retcode",
"The",
"pillar",
"have",
"to",
"be",
"in",
"this",
"format",
"::"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nagios.py#L131-L189 | train |
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 | train |
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 | train |
saltstack/salt | salt/states/cyg.py | removed | def removed(name, cyg_arch='x86_64', mirrors=None):
'''
Make sure that a package is not installed.
name
The name of the package to uninstall
cyg_arch : x86_64
The cygwin architecture to remove the package from.
Current options are x86 and x86_64
mirrors : None
List... | python | def removed(name, cyg_arch='x86_64', mirrors=None):
'''
Make sure that a package is not installed.
name
The name of the package to uninstall
cyg_arch : x86_64
The cygwin architecture to remove the package from.
Current options are x86 and x86_64
mirrors : None
List... | [
"def",
"removed",
"(",
"name",
",",
"cyg_arch",
"=",
"'x86_64'",
",",
"mirrors",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"if",
... | Make sure that a package is not installed.
name
The name of the package to uninstall
cyg_arch : x86_64
The cygwin architecture to remove the package from.
Current options are x86 and x86_64
mirrors : None
List of mirrors to check.
None will use a default mirror (ke... | [
"Make",
"sure",
"that",
"a",
"package",
"is",
"not",
"installed",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cyg.py#L94-L149 | train |
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 | train |
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 | train |
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 | train |
saltstack/salt | salt/utils/pagerduty.py | list_items | def list_items(action, key, profile_dict=None, api_key=None, opts=None):
'''
List items belonging to an API call. Used for list_services() and
list_incidents()
'''
items = salt.utils.json.loads(query(
profile_dict=profile_dict,
api_key=api_key,
action=action,
opts=opt... | python | def list_items(action, key, profile_dict=None, api_key=None, opts=None):
'''
List items belonging to an API call. Used for list_services() and
list_incidents()
'''
items = salt.utils.json.loads(query(
profile_dict=profile_dict,
api_key=api_key,
action=action,
opts=opt... | [
"def",
"list_items",
"(",
"action",
",",
"key",
",",
"profile_dict",
"=",
"None",
",",
"api_key",
"=",
"None",
",",
"opts",
"=",
"None",
")",
":",
"items",
"=",
"salt",
".",
"utils",
".",
"json",
".",
"loads",
"(",
"query",
"(",
"profile_dict",
"=",
... | List items belonging to an API call. Used for list_services() and
list_incidents() | [
"List",
"items",
"belonging",
"to",
"an",
"API",
"call",
".",
"Used",
"for",
"list_services",
"()",
"and",
"list_incidents",
"()"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pagerduty.py#L111-L125 | train |
saltstack/salt | salt/modules/aix_group.py | add | def add(name, gid=None, system=False, root=None):
'''
Add the specified group
CLI Example:
.. code-block:: bash
salt '*' group.add foo 3456
'''
cmd = 'mkgroup '
if system and root is not None:
cmd += '-a '
if gid:
cmd += 'id={0} '.format(gid)
cmd += name
... | python | def add(name, gid=None, system=False, root=None):
'''
Add the specified group
CLI Example:
.. code-block:: bash
salt '*' group.add foo 3456
'''
cmd = 'mkgroup '
if system and root is not None:
cmd += '-a '
if gid:
cmd += 'id={0} '.format(gid)
cmd += name
... | [
"def",
"add",
"(",
"name",
",",
"gid",
"=",
"None",
",",
"system",
"=",
"False",
",",
"root",
"=",
"None",
")",
":",
"cmd",
"=",
"'mkgroup '",
"if",
"system",
"and",
"root",
"is",
"not",
"None",
":",
"cmd",
"+=",
"'-a '",
"if",
"gid",
":",
"cmd",... | Add the specified group
CLI Example:
.. code-block:: bash
salt '*' group.add foo 3456 | [
"Add",
"the",
"specified",
"group"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aix_group.py#L39-L60 | train |
saltstack/salt | salt/modules/aix_group.py | info | def info(name):
'''
Return information about a group
CLI Example:
.. code-block:: bash
salt '*' group.info foo
'''
try:
grinfo = grp.getgrnam(name)
except KeyError:
return {}
else:
return {'name': grinfo.gr_name,
'passwd': grinfo.gr_pass... | python | def info(name):
'''
Return information about a group
CLI Example:
.. code-block:: bash
salt '*' group.info foo
'''
try:
grinfo = grp.getgrnam(name)
except KeyError:
return {}
else:
return {'name': grinfo.gr_name,
'passwd': grinfo.gr_pass... | [
"def",
"info",
"(",
"name",
")",
":",
"try",
":",
"grinfo",
"=",
"grp",
".",
"getgrnam",
"(",
"name",
")",
"except",
"KeyError",
":",
"return",
"{",
"}",
"else",
":",
"return",
"{",
"'name'",
":",
"grinfo",
".",
"gr_name",
",",
"'passwd'",
":",
"gr... | Return information about a group
CLI Example:
.. code-block:: bash
salt '*' group.info foo | [
"Return",
"information",
"about",
"a",
"group"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aix_group.py#L78-L96 | train |
saltstack/salt | salt/modules/aix_group.py | getent | def getent(refresh=False):
'''
Return info on all groups
CLI Example:
.. code-block:: bash
salt '*' group.getent
'''
if 'group.getent' in __context__ and not refresh:
return __context__['group.getent']
ret = []
for grinfo in grp.getgrall():
ret.append(info(gri... | python | def getent(refresh=False):
'''
Return info on all groups
CLI Example:
.. code-block:: bash
salt '*' group.getent
'''
if 'group.getent' in __context__ and not refresh:
return __context__['group.getent']
ret = []
for grinfo in grp.getgrall():
ret.append(info(gri... | [
"def",
"getent",
"(",
"refresh",
"=",
"False",
")",
":",
"if",
"'group.getent'",
"in",
"__context__",
"and",
"not",
"refresh",
":",
"return",
"__context__",
"[",
"'group.getent'",
"]",
"ret",
"=",
"[",
"]",
"for",
"grinfo",
"in",
"grp",
".",
"getgrall",
... | Return info on all groups
CLI Example:
.. code-block:: bash
salt '*' group.getent | [
"Return",
"info",
"on",
"all",
"groups"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aix_group.py#L99-L117 | train |
saltstack/salt | salt/modules/aix_group.py | deluser | def deluser(name, username, root=None):
'''
Remove a user from the group.
CLI Example:
.. code-block:: bash
salt '*' group.deluser foo bar
Removes a member user 'bar' from a group 'foo'. If group is not present
then returns True.
'''
grp_info = __salt__['group.info'](name)
... | python | def deluser(name, username, root=None):
'''
Remove a user from the group.
CLI Example:
.. code-block:: bash
salt '*' group.deluser foo bar
Removes a member user 'bar' from a group 'foo'. If group is not present
then returns True.
'''
grp_info = __salt__['group.info'](name)
... | [
"def",
"deluser",
"(",
"name",
",",
"username",
",",
"root",
"=",
"None",
")",
":",
"grp_info",
"=",
"__salt__",
"[",
"'group.info'",
"]",
"(",
"name",
")",
"try",
":",
"if",
"username",
"in",
"grp_info",
"[",
"'members'",
"]",
":",
"cmd",
"=",
"'chg... | Remove a user from the group.
CLI Example:
.. code-block:: bash
salt '*' group.deluser foo bar
Removes a member user 'bar' from a group 'foo'. If group is not present
then returns True. | [
"Remove",
"a",
"user",
"from",
"the",
"group",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aix_group.py#L161-L183 | train |
saltstack/salt | salt/modules/aix_group.py | members | def members(name, members_list, root=None):
'''
Replaces members of the group with a provided list.
CLI Example:
salt '*' group.members foo 'user1,user2,user3,...'
Replaces a membership list for a local group 'foo'.
foo:x:1234:user1,user2,user3,...
'''
cmd = 'chgrpmem -m = {0}... | python | def members(name, members_list, root=None):
'''
Replaces members of the group with a provided list.
CLI Example:
salt '*' group.members foo 'user1,user2,user3,...'
Replaces a membership list for a local group 'foo'.
foo:x:1234:user1,user2,user3,...
'''
cmd = 'chgrpmem -m = {0}... | [
"def",
"members",
"(",
"name",
",",
"members_list",
",",
"root",
"=",
"None",
")",
":",
"cmd",
"=",
"'chgrpmem -m = {0} {1}'",
".",
"format",
"(",
"members_list",
",",
"name",
")",
"retcode",
"=",
"__salt__",
"[",
"'cmd.retcode'",
"]",
"(",
"cmd",
",",
"... | Replaces members of the group with a provided list.
CLI Example:
salt '*' group.members foo 'user1,user2,user3,...'
Replaces a membership list for a local group 'foo'.
foo:x:1234:user1,user2,user3,... | [
"Replaces",
"members",
"of",
"the",
"group",
"with",
"a",
"provided",
"list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aix_group.py#L186-L200 | train |
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 | train |
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 | train |
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 | train |
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 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.