repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/status.py | netdev | def netdev():
'''
.. versionchanged:: 2016.3.2
Return the network device stats for this minion
.. versionchanged:: 2016.11.4
Added support for AIX
CLI Example:
.. code-block:: bash
salt '*' status.netdev
'''
def linux_netdev():
'''
linux specific i... | python | def netdev():
'''
.. versionchanged:: 2016.3.2
Return the network device stats for this minion
.. versionchanged:: 2016.11.4
Added support for AIX
CLI Example:
.. code-block:: bash
salt '*' status.netdev
'''
def linux_netdev():
'''
linux specific i... | [
"def",
"netdev",
"(",
")",
":",
"def",
"linux_netdev",
"(",
")",
":",
"'''\n linux specific implementation of netdev\n '''",
"ret",
"=",
"{",
"}",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"'/proc/net/dev'",
",",
... | .. versionchanged:: 2016.3.2
Return the network device stats for this minion
.. versionchanged:: 2016.11.4
Added support for AIX
CLI Example:
.. code-block:: bash
salt '*' status.netdev | [
"..",
"versionchanged",
"::",
"2016",
".",
"3",
".",
"2",
"Return",
"the",
"network",
"device",
"stats",
"for",
"this",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/status.py#L1254-L1431 | train |
saltstack/salt | salt/modules/status.py | w | def w(): # pylint: disable=C0103
'''
Return a list of logged in users for this minion, using the w command
CLI Example:
.. code-block:: bash
salt '*' status.w
'''
def linux_w():
'''
Linux specific implementation for w
'''
user_list = []
users =... | python | def w(): # pylint: disable=C0103
'''
Return a list of logged in users for this minion, using the w command
CLI Example:
.. code-block:: bash
salt '*' status.w
'''
def linux_w():
'''
Linux specific implementation for w
'''
user_list = []
users =... | [
"def",
"w",
"(",
")",
":",
"# pylint: disable=C0103",
"def",
"linux_w",
"(",
")",
":",
"'''\n Linux specific implementation for w\n '''",
"user_list",
"=",
"[",
"]",
"users",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'w -fh'",
")",
".",
"splitlin... | Return a list of logged in users for this minion, using the w command
CLI Example:
.. code-block:: bash
salt '*' status.w | [
"Return",
"a",
"list",
"of",
"logged",
"in",
"users",
"for",
"this",
"minion",
"using",
"the",
"w",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/status.py#L1434-L1492 | train |
saltstack/salt | salt/modules/status.py | all_status | def all_status():
'''
Return a composite of all status data and info for this minion.
Warning: There is a LOT here!
CLI Example:
.. code-block:: bash
salt '*' status.all_status
'''
return {'cpuinfo': cpuinfo(),
'cpustats': cpustats(),
'diskstats': diskstats... | python | def all_status():
'''
Return a composite of all status data and info for this minion.
Warning: There is a LOT here!
CLI Example:
.. code-block:: bash
salt '*' status.all_status
'''
return {'cpuinfo': cpuinfo(),
'cpustats': cpustats(),
'diskstats': diskstats... | [
"def",
"all_status",
"(",
")",
":",
"return",
"{",
"'cpuinfo'",
":",
"cpuinfo",
"(",
")",
",",
"'cpustats'",
":",
"cpustats",
"(",
")",
",",
"'diskstats'",
":",
"diskstats",
"(",
")",
",",
"'diskusage'",
":",
"diskusage",
"(",
")",
",",
"'loadavg'",
":... | Return a composite of all status data and info for this minion.
Warning: There is a LOT here!
CLI Example:
.. code-block:: bash
salt '*' status.all_status | [
"Return",
"a",
"composite",
"of",
"all",
"status",
"data",
"and",
"info",
"for",
"this",
"minion",
".",
"Warning",
":",
"There",
"is",
"a",
"LOT",
"here!"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/status.py#L1495-L1516 | train |
saltstack/salt | salt/modules/status.py | pid | def pid(sig):
'''
Return the PID or an empty string if the process is running or not.
Pass a signature to use to find the process via ps. Note you can pass
a Python-compatible regular expression to return all pids of
processes matching the regexp.
.. versionchanged:: 2016.11.4
Added su... | python | def pid(sig):
'''
Return the PID or an empty string if the process is running or not.
Pass a signature to use to find the process via ps. Note you can pass
a Python-compatible regular expression to return all pids of
processes matching the regexp.
.. versionchanged:: 2016.11.4
Added su... | [
"def",
"pid",
"(",
"sig",
")",
":",
"cmd",
"=",
"__grains__",
"[",
"'ps'",
"]",
"output",
"=",
"__salt__",
"[",
"'cmd.run_stdout'",
"]",
"(",
"cmd",
",",
"python_shell",
"=",
"True",
")",
"pids",
"=",
"''",
"for",
"line",
"in",
"output",
".",
"splitl... | Return the PID or an empty string if the process is running or not.
Pass a signature to use to find the process via ps. Note you can pass
a Python-compatible regular expression to return all pids of
processes matching the regexp.
.. versionchanged:: 2016.11.4
Added support for AIX
CLI Exa... | [
"Return",
"the",
"PID",
"or",
"an",
"empty",
"string",
"if",
"the",
"process",
"is",
"running",
"or",
"not",
".",
"Pass",
"a",
"signature",
"to",
"use",
"to",
"find",
"the",
"process",
"via",
"ps",
".",
"Note",
"you",
"can",
"pass",
"a",
"Python",
"-... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/status.py#L1519-L1548 | train |
saltstack/salt | salt/modules/status.py | version | def version():
'''
Return the system version for this minion
.. versionchanged:: 2016.11.4
Added support for AIX
.. versionchanged:: 2018.3.0
Added support for OpenBSD
CLI Example:
.. code-block:: bash
salt '*' status.version
'''
def linux_version():
... | python | def version():
'''
Return the system version for this minion
.. versionchanged:: 2016.11.4
Added support for AIX
.. versionchanged:: 2018.3.0
Added support for OpenBSD
CLI Example:
.. code-block:: bash
salt '*' status.version
'''
def linux_version():
... | [
"def",
"version",
"(",
")",
":",
"def",
"linux_version",
"(",
")",
":",
"'''\n linux specific implementation of version\n '''",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"'/proc/version'",
",",
"'r'",
")",
"as",
"fp... | Return the system version for this minion
.. versionchanged:: 2016.11.4
Added support for AIX
.. versionchanged:: 2018.3.0
Added support for OpenBSD
CLI Example:
.. code-block:: bash
salt '*' status.version | [
"Return",
"the",
"system",
"version",
"for",
"this",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/status.py#L1551-L1592 | train |
saltstack/salt | salt/modules/status.py | master | def master(master=None, connected=True):
'''
.. versionadded:: 2014.7.0
Return the connection status with master. Fire an event if the
connection to master is not as expected. This function is meant to be
run via a scheduled job from the minion. If master_ip is an FQDN/Hostname,
it must be reso... | python | def master(master=None, connected=True):
'''
.. versionadded:: 2014.7.0
Return the connection status with master. Fire an event if the
connection to master is not as expected. This function is meant to be
run via a scheduled job from the minion. If master_ip is an FQDN/Hostname,
it must be reso... | [
"def",
"master",
"(",
"master",
"=",
"None",
",",
"connected",
"=",
"True",
")",
":",
"master_ips",
"=",
"None",
"if",
"master",
":",
"master_ips",
"=",
"salt",
".",
"utils",
".",
"network",
".",
"host_to_ips",
"(",
"master",
")",
"if",
"not",
"master_... | .. versionadded:: 2014.7.0
Return the connection status with master. Fire an event if the
connection to master is not as expected. This function is meant to be
run via a scheduled job from the minion. If master_ip is an FQDN/Hostname,
it must be resolvable to a valid IPv4 address.
.. versionchange... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/status.py#L1595-L1639 | train |
saltstack/salt | salt/modules/status.py | ping_master | def ping_master(master):
'''
.. versionadded:: 2016.3.0
Sends ping request to the given master. Fires '__master_failback' event on success.
Returns bool result.
CLI Example:
.. code-block:: bash
salt '*' status.ping_master localhost
'''
if master is None or master == '':
... | python | def ping_master(master):
'''
.. versionadded:: 2016.3.0
Sends ping request to the given master. Fires '__master_failback' event on success.
Returns bool result.
CLI Example:
.. code-block:: bash
salt '*' status.ping_master localhost
'''
if master is None or master == '':
... | [
"def",
"ping_master",
"(",
"master",
")",
":",
"if",
"master",
"is",
"None",
"or",
"master",
"==",
"''",
":",
"return",
"False",
"opts",
"=",
"copy",
".",
"deepcopy",
"(",
"__opts__",
")",
"opts",
"[",
"'master'",
"]",
"=",
"master",
"if",
"'master_ip'... | .. versionadded:: 2016.3.0
Sends ping request to the given master. Fires '__master_failback' event on success.
Returns bool result.
CLI Example:
.. code-block:: bash
salt '*' status.ping_master localhost | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/status.py#L1642-L1683 | train |
saltstack/salt | salt/modules/status.py | proxy_reconnect | def proxy_reconnect(proxy_name, opts=None):
'''
Forces proxy minion reconnection when not alive.
proxy_name
The virtual name of the proxy module.
opts: None
Opts dictionary. Not intended for CLI usage.
CLI Example:
salt '*' status.proxy_reconnect rest_sample
'''
... | python | def proxy_reconnect(proxy_name, opts=None):
'''
Forces proxy minion reconnection when not alive.
proxy_name
The virtual name of the proxy module.
opts: None
Opts dictionary. Not intended for CLI usage.
CLI Example:
salt '*' status.proxy_reconnect rest_sample
'''
... | [
"def",
"proxy_reconnect",
"(",
"proxy_name",
",",
"opts",
"=",
"None",
")",
":",
"if",
"not",
"opts",
":",
"opts",
"=",
"__opts__",
"if",
"'proxy'",
"not",
"in",
"opts",
":",
"return",
"False",
"# fail",
"proxy_keepalive_fn",
"=",
"proxy_name",
"+",
"'.ali... | Forces proxy minion reconnection when not alive.
proxy_name
The virtual name of the proxy module.
opts: None
Opts dictionary. Not intended for CLI usage.
CLI Example:
salt '*' status.proxy_reconnect rest_sample | [
"Forces",
"proxy",
"minion",
"reconnection",
"when",
"not",
"alive",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/status.py#L1686-L1719 | train |
saltstack/salt | salt/states/x509.py | _revoked_to_list | def _revoked_to_list(revs):
'''
Turn the mess of OrderedDicts and Lists into a list of dicts for
use in the CRL module.
'''
list_ = []
for rev in revs:
for rev_name, props in six.iteritems(
rev): # pylint: disable=unused-variable
dict_ = {}
... | python | def _revoked_to_list(revs):
'''
Turn the mess of OrderedDicts and Lists into a list of dicts for
use in the CRL module.
'''
list_ = []
for rev in revs:
for rev_name, props in six.iteritems(
rev): # pylint: disable=unused-variable
dict_ = {}
... | [
"def",
"_revoked_to_list",
"(",
"revs",
")",
":",
"list_",
"=",
"[",
"]",
"for",
"rev",
"in",
"revs",
":",
"for",
"rev_name",
",",
"props",
"in",
"six",
".",
"iteritems",
"(",
"rev",
")",
":",
"# pylint: disable=unused-variable",
"dict_",
"=",
"{",
"}",
... | Turn the mess of OrderedDicts and Lists into a list of dicts for
use in the CRL module. | [
"Turn",
"the",
"mess",
"of",
"OrderedDicts",
"and",
"Lists",
"into",
"a",
"list",
"of",
"dicts",
"for",
"use",
"in",
"the",
"CRL",
"module",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/x509.py#L187-L205 | train |
saltstack/salt | salt/states/x509.py | private_key_managed | def private_key_managed(name,
bits=2048,
passphrase=None,
cipher='aes_128_cbc',
new=False,
overwrite=False,
verbose=True,
**kwargs):
'''
Manage ... | python | def private_key_managed(name,
bits=2048,
passphrase=None,
cipher='aes_128_cbc',
new=False,
overwrite=False,
verbose=True,
**kwargs):
'''
Manage ... | [
"def",
"private_key_managed",
"(",
"name",
",",
"bits",
"=",
"2048",
",",
"passphrase",
"=",
"None",
",",
"cipher",
"=",
"'aes_128_cbc'",
",",
"new",
"=",
"False",
",",
"overwrite",
"=",
"False",
",",
"verbose",
"=",
"True",
",",
"*",
"*",
"kwargs",
")... | Manage a private key's existence.
name:
Path to the private key
bits:
Key length in bits. Default 2048.
passphrase:
Passphrase for encrypting the private key.
cipher:
Cipher for encrypting the private key.
new:
Always create a new key. Defaults to False.
... | [
"Manage",
"a",
"private",
"key",
"s",
"existence",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/x509.py#L246-L320 | train |
saltstack/salt | salt/states/x509.py | csr_managed | def csr_managed(name,
**kwargs):
'''
Manage a Certificate Signing Request
name:
Path to the CSR
properties:
The properties to be added to the certificate request, including items like subject, extensions
and public key. See above for valid properties.
kwarg... | python | def csr_managed(name,
**kwargs):
'''
Manage a Certificate Signing Request
name:
Path to the CSR
properties:
The properties to be added to the certificate request, including items like subject, extensions
and public key. See above for valid properties.
kwarg... | [
"def",
"csr_managed",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"old",
"=",
"__salt__",
"[",
"'x509.read_csr'",
"]",
"(",
"name",
")",
"except",
"salt",
".",
"exceptions",
".",
"SaltInvocationError",
":",
"old",
"=",
"'{0} is not a valid ... | Manage a Certificate Signing Request
name:
Path to the CSR
properties:
The properties to be added to the certificate request, including items like subject, extensions
and public key. See above for valid properties.
kwargs:
Any arguments supported by :py:func:`file.managed ... | [
"Manage",
"a",
"Certificate",
"Signing",
"Request"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/x509.py#L323-L385 | train |
saltstack/salt | salt/states/x509.py | certificate_managed | def certificate_managed(name,
days_remaining=90,
managed_private_key=None,
append_certs=None,
**kwargs):
'''
Manage a Certificate
name
Path to the certificate
days_remaining : 90
The minimum... | python | def certificate_managed(name,
days_remaining=90,
managed_private_key=None,
append_certs=None,
**kwargs):
'''
Manage a Certificate
name
Path to the certificate
days_remaining : 90
The minimum... | [
"def",
"certificate_managed",
"(",
"name",
",",
"days_remaining",
"=",
"90",
",",
"managed_private_key",
"=",
"None",
",",
"append_certs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'path'",
"in",
"kwargs",
":",
"name",
"=",
"kwargs",
".",
"p... | Manage a Certificate
name
Path to the certificate
days_remaining : 90
The minimum number of days remaining when the certificate should be
recreated. A value of 0 disables automatic renewal.
managed_private_key
Manages the private key corresponding to the certificate. All o... | [
"Manage",
"a",
"Certificate"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/x509.py#L388-L610 | train |
saltstack/salt | salt/states/x509.py | crl_managed | def crl_managed(name,
signing_private_key,
signing_private_key_passphrase=None,
signing_cert=None,
revoked=None,
days_valid=100,
digest="",
days_remaining=30,
include_expired=False,
... | python | def crl_managed(name,
signing_private_key,
signing_private_key_passphrase=None,
signing_cert=None,
revoked=None,
days_valid=100,
digest="",
days_remaining=30,
include_expired=False,
... | [
"def",
"crl_managed",
"(",
"name",
",",
"signing_private_key",
",",
"signing_private_key_passphrase",
"=",
"None",
",",
"signing_cert",
"=",
"None",
",",
"revoked",
"=",
"None",
",",
"days_valid",
"=",
"100",
",",
"digest",
"=",
"\"\"",
",",
"days_remaining",
... | Manage a Certificate Revocation List
name
Path to the certificate
signing_private_key
The private key that will be used to sign this crl. This is
usually your CA's private key.
signing_private_key_passphrase
Passphrase to decrypt the private key.
signing_cert
... | [
"Manage",
"a",
"Certificate",
"Revocation",
"List"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/x509.py#L613-L731 | train |
saltstack/salt | salt/states/x509.py | pem_managed | def pem_managed(name,
text,
backup=False,
**kwargs):
'''
Manage the contents of a PEM file directly with the content in text, ensuring correct formatting.
name:
The path to the file to manage
text:
The PEM formatted text to write.
kw... | python | def pem_managed(name,
text,
backup=False,
**kwargs):
'''
Manage the contents of a PEM file directly with the content in text, ensuring correct formatting.
name:
The path to the file to manage
text:
The PEM formatted text to write.
kw... | [
"def",
"pem_managed",
"(",
"name",
",",
"text",
",",
"backup",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"file_args",
",",
"kwargs",
"=",
"_get_file_args",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
"file_args",
"[",
"'contents'",
"]",
"=",
"s... | Manage the contents of a PEM file directly with the content in text, ensuring correct formatting.
name:
The path to the file to manage
text:
The PEM formatted text to write.
kwargs:
Any arguments supported by :py:func:`file.managed <salt.states.file.managed>` are supported. | [
"Manage",
"the",
"contents",
"of",
"a",
"PEM",
"file",
"directly",
"with",
"the",
"content",
"in",
"text",
"ensuring",
"correct",
"formatting",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/x509.py#L734-L753 | train |
saltstack/salt | salt/utils/dateutils.py | date_cast | def date_cast(date):
'''
Casts any object into a datetime.datetime object
date
any datetime, time string representation...
'''
if date is None:
return datetime.datetime.now()
elif isinstance(date, datetime.datetime):
return date
# fuzzy date
try:
if isinst... | python | def date_cast(date):
'''
Casts any object into a datetime.datetime object
date
any datetime, time string representation...
'''
if date is None:
return datetime.datetime.now()
elif isinstance(date, datetime.datetime):
return date
# fuzzy date
try:
if isinst... | [
"def",
"date_cast",
"(",
"date",
")",
":",
"if",
"date",
"is",
"None",
":",
"return",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
"elif",
"isinstance",
"(",
"date",
",",
"datetime",
".",
"datetime",
")",
":",
"return",
"date",
"# fuzzy date",
"t... | Casts any object into a datetime.datetime object
date
any datetime, time string representation... | [
"Casts",
"any",
"object",
"into",
"a",
"datetime",
".",
"datetime",
"object"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dateutils.py#L25-L60 | train |
saltstack/salt | salt/states/mssql_user.py | present | def present(name, login=None, domain=None, database=None, roles=None, options=None, **kwargs):
'''
Checks existance of the named user.
If not present, creates the user with the specified roles and options.
name
The name of the user to manage
login
If not specified, will be created W... | python | def present(name, login=None, domain=None, database=None, roles=None, options=None, **kwargs):
'''
Checks existance of the named user.
If not present, creates the user with the specified roles and options.
name
The name of the user to manage
login
If not specified, will be created W... | [
"def",
"present",
"(",
"name",
",",
"login",
"=",
"None",
",",
"domain",
"=",
"None",
",",
"database",
"=",
"None",
",",
"roles",
"=",
"None",
",",
"options",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",... | Checks existance of the named user.
If not present, creates the user with the specified roles and options.
name
The name of the user to manage
login
If not specified, will be created WITHOUT LOGIN
domain
Creates a Windows authentication user.
Needs to be NetBIOS domain o... | [
"Checks",
"existance",
"of",
"the",
"named",
"user",
".",
"If",
"not",
"present",
"creates",
"the",
"user",
"with",
"the",
"specified",
"roles",
"and",
"options",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mssql_user.py#L37-L85 | train |
saltstack/salt | salt/states/mssql_user.py | absent | def absent(name, **kwargs):
'''
Ensure that the named user is absent
name
The username of the user to remove
'''
ret = {'name': name,
'changes': {},
'result': True,
'comment': ''}
if not __salt__['mssql.user_exists'](name):
ret['comment'] = 'Use... | python | def absent(name, **kwargs):
'''
Ensure that the named user is absent
name
The username of the user to remove
'''
ret = {'name': name,
'changes': {},
'result': True,
'comment': ''}
if not __salt__['mssql.user_exists'](name):
ret['comment'] = 'Use... | [
"def",
"absent",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"if",
"not",
"__salt__",
"[",
"'mssql.user_exi... | Ensure that the named user is absent
name
The username of the user to remove | [
"Ensure",
"that",
"the",
"named",
"user",
"is",
"absent"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mssql_user.py#L88-L114 | train |
saltstack/salt | salt/modules/jinja.py | _strip_odict | def _strip_odict(wrapped):
'''
dump to json and load it again, replaces OrderedDicts with regular ones
'''
@functools.wraps(wrapped)
def strip(*args):
return salt.utils.json.loads(salt.utils.json.dumps(wrapped(*args)))
return strip | python | def _strip_odict(wrapped):
'''
dump to json and load it again, replaces OrderedDicts with regular ones
'''
@functools.wraps(wrapped)
def strip(*args):
return salt.utils.json.loads(salt.utils.json.dumps(wrapped(*args)))
return strip | [
"def",
"_strip_odict",
"(",
"wrapped",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"wrapped",
")",
"def",
"strip",
"(",
"*",
"args",
")",
":",
"return",
"salt",
".",
"utils",
".",
"json",
".",
"loads",
"(",
"salt",
".",
"utils",
".",
"json",
"."... | dump to json and load it again, replaces OrderedDicts with regular ones | [
"dump",
"to",
"json",
"and",
"load",
"it",
"again",
"replaces",
"OrderedDicts",
"with",
"regular",
"ones"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jinja.py#L23-L30 | train |
saltstack/salt | salt/modules/jinja.py | load_map | def load_map(path, value):
'''
Loads the map at the specified path, and returns the specified value from
that map.
CLI Example:
.. code-block:: bash
# Assuming the map is loaded in your formula SLS as follows:
#
# {% from "myformula/map.jinja" import myformula with context... | python | def load_map(path, value):
'''
Loads the map at the specified path, and returns the specified value from
that map.
CLI Example:
.. code-block:: bash
# Assuming the map is loaded in your formula SLS as follows:
#
# {% from "myformula/map.jinja" import myformula with context... | [
"def",
"load_map",
"(",
"path",
",",
"value",
")",
":",
"tmplstr",
"=",
"textwrap",
".",
"dedent",
"(",
"'''\\\n {{% from \"{path}\" import {value} with context %}}\n {{{{ {value} | tojson }}}}\n '''",
".",
"format",
"(",
"path",
"=",
"path",
",",
"va... | Loads the map at the specified path, and returns the specified value from
that map.
CLI Example:
.. code-block:: bash
# Assuming the map is loaded in your formula SLS as follows:
#
# {% from "myformula/map.jinja" import myformula with context %}
#
# the following s... | [
"Loads",
"the",
"map",
"at",
"the",
"specified",
"path",
"and",
"returns",
"the",
"specified",
"value",
"from",
"that",
"map",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jinja.py#L34-L60 | train |
saltstack/salt | salt/modules/pillar.py | get | def get(key,
default=KeyError,
merge=False,
merge_nested_lists=None,
delimiter=DEFAULT_TARGET_DELIM,
pillarenv=None,
saltenv=None):
'''
.. versionadded:: 0.14
Attempt to retrieve the named value from :ref:`in-memory pillar data
<pillar-in-memory>`. If the... | python | def get(key,
default=KeyError,
merge=False,
merge_nested_lists=None,
delimiter=DEFAULT_TARGET_DELIM,
pillarenv=None,
saltenv=None):
'''
.. versionadded:: 0.14
Attempt to retrieve the named value from :ref:`in-memory pillar data
<pillar-in-memory>`. If the... | [
"def",
"get",
"(",
"key",
",",
"default",
"=",
"KeyError",
",",
"merge",
"=",
"False",
",",
"merge_nested_lists",
"=",
"None",
",",
"delimiter",
"=",
"DEFAULT_TARGET_DELIM",
",",
"pillarenv",
"=",
"None",
",",
"saltenv",
"=",
"None",
")",
":",
"if",
"not... | .. versionadded:: 0.14
Attempt to retrieve the named value from :ref:`in-memory pillar data
<pillar-in-memory>`. If the pillar key is not present in the in-memory
pillar, then the value specified in the ``default`` option (described
below) will be returned.
If the merge parameter is set to ``True`... | [
"..",
"versionadded",
"::",
"0",
".",
"14"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pillar.py#L32-L189 | train |
saltstack/salt | salt/modules/pillar.py | items | def items(*args, **kwargs):
'''
Calls the master for a fresh pillar and generates the pillar data on the
fly
Contrast with :py:func:`raw` which returns the pillar data that is
currently loaded into the minion.
pillar
If specified, allows for a dictionary of pillar data to be made
... | python | def items(*args, **kwargs):
'''
Calls the master for a fresh pillar and generates the pillar data on the
fly
Contrast with :py:func:`raw` which returns the pillar data that is
currently loaded into the minion.
pillar
If specified, allows for a dictionary of pillar data to be made
... | [
"def",
"items",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Preserve backwards compatibility",
"if",
"args",
":",
"return",
"item",
"(",
"*",
"args",
")",
"pillarenv",
"=",
"kwargs",
".",
"get",
"(",
"'pillarenv'",
")",
"if",
"pillarenv",
"is... | Calls the master for a fresh pillar and generates the pillar data on the
fly
Contrast with :py:func:`raw` which returns the pillar data that is
currently loaded into the minion.
pillar
If specified, allows for a dictionary of pillar data to be made
available to pillar and ext_pillar re... | [
"Calls",
"the",
"master",
"for",
"a",
"fresh",
"pillar",
"and",
"generates",
"the",
"pillar",
"data",
"on",
"the",
"fly"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pillar.py#L192-L277 | train |
saltstack/salt | salt/modules/pillar.py | _obfuscate_inner | def _obfuscate_inner(var):
'''
Recursive obfuscation of collection types.
Leaf or unknown Python types get replaced by the type name
Known collection types trigger recursion.
In the special case of mapping types, keys are not obfuscated
'''
if isinstance(var, (dict, salt.utils.odict.Ordered... | python | def _obfuscate_inner(var):
'''
Recursive obfuscation of collection types.
Leaf or unknown Python types get replaced by the type name
Known collection types trigger recursion.
In the special case of mapping types, keys are not obfuscated
'''
if isinstance(var, (dict, salt.utils.odict.Ordered... | [
"def",
"_obfuscate_inner",
"(",
"var",
")",
":",
"if",
"isinstance",
"(",
"var",
",",
"(",
"dict",
",",
"salt",
".",
"utils",
".",
"odict",
".",
"OrderedDict",
")",
")",
":",
"return",
"var",
".",
"__class__",
"(",
"(",
"key",
",",
"_obfuscate_inner",
... | Recursive obfuscation of collection types.
Leaf or unknown Python types get replaced by the type name
Known collection types trigger recursion.
In the special case of mapping types, keys are not obfuscated | [
"Recursive",
"obfuscation",
"of",
"collection",
"types",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pillar.py#L284-L298 | train |
saltstack/salt | salt/modules/pillar.py | item | def item(*args, **kwargs):
'''
.. versionadded:: 0.16.2
Return one or more pillar entries from the :ref:`in-memory pillar data
<pillar-in-memory>`.
delimiter
Delimiter used to traverse nested dictionaries.
.. note::
This is different from :py:func:`pillar.get
... | python | def item(*args, **kwargs):
'''
.. versionadded:: 0.16.2
Return one or more pillar entries from the :ref:`in-memory pillar data
<pillar-in-memory>`.
delimiter
Delimiter used to traverse nested dictionaries.
.. note::
This is different from :py:func:`pillar.get
... | [
"def",
"item",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"}",
"default",
"=",
"kwargs",
".",
"get",
"(",
"'default'",
",",
"''",
")",
"delimiter",
"=",
"kwargs",
".",
"get",
"(",
"'delimiter'",
",",
"DEFAULT_TARGET_DELIM",... | .. versionadded:: 0.16.2
Return one or more pillar entries from the :ref:`in-memory pillar data
<pillar-in-memory>`.
delimiter
Delimiter used to traverse nested dictionaries.
.. note::
This is different from :py:func:`pillar.get
<salt.modules.pillar.get>` in that n... | [
"..",
"versionadded",
"::",
"0",
".",
"16",
".",
"2"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pillar.py#L350-L423 | train |
saltstack/salt | salt/modules/pillar.py | ext | def ext(external, pillar=None):
'''
.. versionchanged:: 2016.3.6,2016.11.3,2017.7.0
The supported ext_pillar types are now tunable using the
:conf_master:`on_demand_ext_pillar` config option. Earlier releases
used a hard-coded default.
Generate the pillar and apply an explicit exter... | python | def ext(external, pillar=None):
'''
.. versionchanged:: 2016.3.6,2016.11.3,2017.7.0
The supported ext_pillar types are now tunable using the
:conf_master:`on_demand_ext_pillar` config option. Earlier releases
used a hard-coded default.
Generate the pillar and apply an explicit exter... | [
"def",
"ext",
"(",
"external",
",",
"pillar",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"external",
",",
"six",
".",
"string_types",
")",
":",
"external",
"=",
"salt",
".",
"utils",
".",
"yaml",
".",
"safe_load",
"(",
"external",
")",
"pillar_obj... | .. versionchanged:: 2016.3.6,2016.11.3,2017.7.0
The supported ext_pillar types are now tunable using the
:conf_master:`on_demand_ext_pillar` config option. Earlier releases
used a hard-coded default.
Generate the pillar and apply an explicit external pillar
external
A single e... | [
"..",
"versionchanged",
"::",
"2016",
".",
"3",
".",
"6",
"2016",
".",
"11",
".",
"3",
"2017",
".",
"7",
".",
"0",
"The",
"supported",
"ext_pillar",
"types",
"are",
"now",
"tunable",
"using",
"the",
":",
"conf_master",
":",
"on_demand_ext_pillar",
"confi... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pillar.py#L452-L516 | train |
saltstack/salt | salt/modules/pillar.py | file_exists | def file_exists(path, saltenv=None):
'''
.. versionadded:: 2016.3.0
This is a master-only function. Calling from the minion is not supported.
Use the given path and search relative to the pillar environments to see if
a file exists at that path.
If the ``saltenv`` argument is given, restrict ... | python | def file_exists(path, saltenv=None):
'''
.. versionadded:: 2016.3.0
This is a master-only function. Calling from the minion is not supported.
Use the given path and search relative to the pillar environments to see if
a file exists at that path.
If the ``saltenv`` argument is given, restrict ... | [
"def",
"file_exists",
"(",
"path",
",",
"saltenv",
"=",
"None",
")",
":",
"pillar_roots",
"=",
"__opts__",
".",
"get",
"(",
"'pillar_roots'",
")",
"if",
"not",
"pillar_roots",
":",
"raise",
"CommandExecutionError",
"(",
"'No pillar_roots found. Are you running '",
... | .. versionadded:: 2016.3.0
This is a master-only function. Calling from the minion is not supported.
Use the given path and search relative to the pillar environments to see if
a file exists at that path.
If the ``saltenv`` argument is given, restrict search to that environment
only.
Will on... | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pillar.py#L549-L594 | train |
saltstack/salt | salt/modules/pillar.py | filter_by | def filter_by(lookup_dict,
pillar,
merge=None,
default='default',
base=None):
'''
.. versionadded:: 2017.7.0
Look up the given pillar in a given dictionary and return the result
:param lookup_dict: A dictionary, keyed by a pillar, containing a va... | python | def filter_by(lookup_dict,
pillar,
merge=None,
default='default',
base=None):
'''
.. versionadded:: 2017.7.0
Look up the given pillar in a given dictionary and return the result
:param lookup_dict: A dictionary, keyed by a pillar, containing a va... | [
"def",
"filter_by",
"(",
"lookup_dict",
",",
"pillar",
",",
"merge",
"=",
"None",
",",
"default",
"=",
"'default'",
",",
"base",
"=",
"None",
")",
":",
"return",
"salt",
".",
"utils",
".",
"data",
".",
"filter_by",
"(",
"lookup_dict",
"=",
"lookup_dict",... | .. versionadded:: 2017.7.0
Look up the given pillar in a given dictionary and return the result
:param lookup_dict: A dictionary, keyed by a pillar, containing a value or
values relevant to systems matching that pillar. For example, a key
could be a pillar for a role and the value could the na... | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pillar.py#L601-L658 | train |
saltstack/salt | salt/modules/purefa.py | _get_system | def _get_system():
'''
Get Pure Storage FlashArray configuration
1) From the minion config
pure_tags:
fa:
san_ip: management vip or hostname for the FlashArray
api_token: A valid api token for the FlashArray being managed
2) From environment (PUREFA_IP and PURE... | python | def _get_system():
'''
Get Pure Storage FlashArray configuration
1) From the minion config
pure_tags:
fa:
san_ip: management vip or hostname for the FlashArray
api_token: A valid api token for the FlashArray being managed
2) From environment (PUREFA_IP and PURE... | [
"def",
"_get_system",
"(",
")",
":",
"agent",
"=",
"{",
"'base'",
":",
"USER_AGENT_BASE",
",",
"'class'",
":",
"__name__",
",",
"'version'",
":",
"VERSION",
",",
"'platform'",
":",
"platform",
".",
"platform",
"(",
")",
"}",
"user_agent",
"=",
"'{base} {cl... | Get Pure Storage FlashArray configuration
1) From the minion config
pure_tags:
fa:
san_ip: management vip or hostname for the FlashArray
api_token: A valid api token for the FlashArray being managed
2) From environment (PUREFA_IP and PUREFA_API)
3) From the pillar ... | [
"Get",
"Pure",
"Storage",
"FlashArray",
"configuration"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/purefa.py#L94-L139 | train |
saltstack/salt | salt/modules/purefa.py | _get_snapshot | def _get_snapshot(name, suffix, array):
'''Private function to check snapshot'''
snapshot = name + '.' + suffix
try:
for snap in array.get_volume(name, snap=True):
if snap['name'] == snapshot:
return snapshot
except purestorage.PureError:
return None | python | def _get_snapshot(name, suffix, array):
'''Private function to check snapshot'''
snapshot = name + '.' + suffix
try:
for snap in array.get_volume(name, snap=True):
if snap['name'] == snapshot:
return snapshot
except purestorage.PureError:
return None | [
"def",
"_get_snapshot",
"(",
"name",
",",
"suffix",
",",
"array",
")",
":",
"snapshot",
"=",
"name",
"+",
"'.'",
"+",
"suffix",
"try",
":",
"for",
"snap",
"in",
"array",
".",
"get_volume",
"(",
"name",
",",
"snap",
"=",
"True",
")",
":",
"if",
"sna... | Private function to check snapshot | [
"Private",
"function",
"to",
"check",
"snapshot"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/purefa.py#L150-L158 | train |
saltstack/salt | salt/modules/purefa.py | _get_pgroup | def _get_pgroup(name, array):
'''Private function to check protection group'''
pgroup = None
for temp in array.list_pgroups():
if temp['name'] == name:
pgroup = temp
break
return pgroup | python | def _get_pgroup(name, array):
'''Private function to check protection group'''
pgroup = None
for temp in array.list_pgroups():
if temp['name'] == name:
pgroup = temp
break
return pgroup | [
"def",
"_get_pgroup",
"(",
"name",
",",
"array",
")",
":",
"pgroup",
"=",
"None",
"for",
"temp",
"in",
"array",
".",
"list_pgroups",
"(",
")",
":",
"if",
"temp",
"[",
"'name'",
"]",
"==",
"name",
":",
"pgroup",
"=",
"temp",
"break",
"return",
"pgroup... | Private function to check protection group | [
"Private",
"function",
"to",
"check",
"protection",
"group"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/purefa.py#L169-L176 | train |
saltstack/salt | salt/modules/purefa.py | _get_hgroup | def _get_hgroup(name, array):
'''Private function to check hostgroup'''
hostgroup = None
for temp in array.list_hgroups():
if temp['name'] == name:
hostgroup = temp
break
return hostgroup | python | def _get_hgroup(name, array):
'''Private function to check hostgroup'''
hostgroup = None
for temp in array.list_hgroups():
if temp['name'] == name:
hostgroup = temp
break
return hostgroup | [
"def",
"_get_hgroup",
"(",
"name",
",",
"array",
")",
":",
"hostgroup",
"=",
"None",
"for",
"temp",
"in",
"array",
".",
"list_hgroups",
"(",
")",
":",
"if",
"temp",
"[",
"'name'",
"]",
"==",
"name",
":",
"hostgroup",
"=",
"temp",
"break",
"return",
"... | Private function to check hostgroup | [
"Private",
"function",
"to",
"check",
"hostgroup"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/purefa.py#L187-L194 | train |
saltstack/salt | salt/modules/purefa.py | _get_host | def _get_host(name, array):
'''Private function to check host'''
host = None
for temp in array.list_hosts():
if temp['name'] == name:
host = temp
break
return host | python | def _get_host(name, array):
'''Private function to check host'''
host = None
for temp in array.list_hosts():
if temp['name'] == name:
host = temp
break
return host | [
"def",
"_get_host",
"(",
"name",
",",
"array",
")",
":",
"host",
"=",
"None",
"for",
"temp",
"in",
"array",
".",
"list_hosts",
"(",
")",
":",
"if",
"temp",
"[",
"'name'",
"]",
"==",
"name",
":",
"host",
"=",
"temp",
"break",
"return",
"host"
] | Private function to check host | [
"Private",
"function",
"to",
"check",
"host"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/purefa.py#L197-L204 | train |
saltstack/salt | salt/states/boto_sns.py | present | def present(
name,
subscriptions=None,
region=None,
key=None,
keyid=None,
profile=None):
'''
Ensure the SNS topic exists.
name
Name of the SNS topic.
subscriptions
List of SNS subscriptions.
Each subscription is a dictionary with... | python | def present(
name,
subscriptions=None,
region=None,
key=None,
keyid=None,
profile=None):
'''
Ensure the SNS topic exists.
name
Name of the SNS topic.
subscriptions
List of SNS subscriptions.
Each subscription is a dictionary with... | [
"def",
"present",
"(",
"name",
",",
"subscriptions",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
... | Ensure the SNS topic exists.
name
Name of the SNS topic.
subscriptions
List of SNS subscriptions.
Each subscription is a dictionary with a protocol and endpoint key:
.. code-block:: python
[
{'protocol': 'https', 'endpoint': 'https://www.example.com/s... | [
"Ensure",
"the",
"SNS",
"topic",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_sns.py#L70-L207 | train |
saltstack/salt | salt/states/boto_sns.py | absent | def absent(
name,
region=None,
key=None,
keyid=None,
profile=None,
unsubscribe=False):
'''
Ensure the named sns topic is deleted.
name
Name of the SNS topic.
region
Region to connect to.
key
Secret key to be used.
keyid
... | python | def absent(
name,
region=None,
key=None,
keyid=None,
profile=None,
unsubscribe=False):
'''
Ensure the named sns topic is deleted.
name
Name of the SNS topic.
region
Region to connect to.
key
Secret key to be used.
keyid
... | [
"def",
"absent",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"unsubscribe",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"... | Ensure the named sns topic is deleted.
name
Name of the SNS topic.
region
Region to connect to.
key
Secret key to be used.
keyid
Access key to be used.
profile
A dict with region, key and keyid, or a pillar key (string)
that contains a dict with r... | [
"Ensure",
"the",
"named",
"sns",
"topic",
"is",
"deleted",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_sns.py#L210-L287 | train |
saltstack/salt | salt/cloud/clouds/softlayer_hw.py | avail_locations | def avail_locations(call=None):
'''
List all available locations
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_locations function must be called with '
'-f or --function, or with the --list-locations option'
)
ret = {}
conn = get_conn(ser... | python | def avail_locations(call=None):
'''
List all available locations
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_locations function must be called with '
'-f or --function, or with the --list-locations option'
)
ret = {}
conn = get_conn(ser... | [
"def",
"avail_locations",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_locations function must be called with '",
"'-f or --function, or with the --list-locations option'",
")",
"ret",
"=",
"{",
... | List all available locations | [
"List",
"all",
"available",
"locations"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/softlayer_hw.py#L117-L144 | train |
saltstack/salt | salt/cloud/clouds/softlayer_hw.py | avail_images | def avail_images(call=None):
'''
Return a dict of all available VM images on the cloud provider.
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-images option'
)
ret = ... | python | def avail_images(call=None):
'''
Return a dict of all available VM images on the cloud provider.
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-images option'
)
ret = ... | [
"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'",
")",
"ret",
"=",
"{",
"}",
"c... | Return a dict of all available VM images on the cloud provider. | [
"Return",
"a",
"dict",
"of",
"all",
"available",
"VM",
"images",
"on",
"the",
"cloud",
"provider",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/softlayer_hw.py#L171-L190 | train |
saltstack/salt | salt/cloud/clouds/softlayer_hw.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 'sof... | 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 'sof... | [
"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",
"'softl... | 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/softlayer_hw.py#L212-L425 | train |
saltstack/salt | salt/cloud/clouds/softlayer_hw.py | list_nodes_full | def list_nodes_full(mask='mask[id, hostname, primaryIpAddress, \
primaryBackendIpAddress, processorPhysicalCoreAmount, memoryCount]',
call=None):
'''
Return a list of the VMs that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_... | python | def list_nodes_full(mask='mask[id, hostname, primaryIpAddress, \
primaryBackendIpAddress, processorPhysicalCoreAmount, memoryCount]',
call=None):
'''
Return a list of the VMs that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_... | [
"def",
"list_nodes_full",
"(",
"mask",
"=",
"'mask[id, hostname, primaryIpAddress, \\\n primaryBackendIpAddress, processorPhysicalCoreAmount, memoryCount]'",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"... | 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/softlayer_hw.py#L428-L446 | train |
saltstack/salt | salt/cloud/clouds/softlayer_hw.py | show_pricing | def show_pricing(kwargs=None, call=None):
'''
Show pricing for a particular profile. This is only an estimate, based on
unofficial pricing sources.
CLI Examples:
.. code-block:: bash
salt-cloud -f show_pricing my-softlayerhw-config profile=my-profile
If pricing sources have not been ... | python | def show_pricing(kwargs=None, call=None):
'''
Show pricing for a particular profile. This is only an estimate, based on
unofficial pricing sources.
CLI Examples:
.. code-block:: bash
salt-cloud -f show_pricing my-softlayerhw-config profile=my-profile
If pricing sources have not been ... | [
"def",
"show_pricing",
"(",
"kwargs",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"profile",
"=",
"__opts__",
"[",
"'profiles'",
"]",
".",
"get",
"(",
"kwargs",
"[",
"'profile'",
"]",
",",
"{",
"}",
")",
"if",
"not",
"profile",
":",
"return",
... | Show pricing for a particular profile. This is only an estimate, based on
unofficial pricing sources.
CLI Examples:
.. code-block:: bash
salt-cloud -f show_pricing my-softlayerhw-config profile=my-profile
If pricing sources have not been cached, they will be downloaded. Once they
have be... | [
"Show",
"pricing",
"for",
"a",
"particular",
"profile",
".",
"This",
"is",
"only",
"an",
"estimate",
"based",
"on",
"unofficial",
"pricing",
"sources",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/softlayer_hw.py#L566-L616 | train |
saltstack/salt | salt/cloud/clouds/softlayer_hw.py | show_all_prices | def show_all_prices(call=None, kwargs=None):
'''
Return a dict of all prices on the cloud provider.
'''
if call == 'action':
raise SaltCloudSystemExit(
'The show_all_prices function must be called with -f or --function.'
)
if kwargs is None:
kwargs = {}
conn... | python | def show_all_prices(call=None, kwargs=None):
'''
Return a dict of all prices on the cloud provider.
'''
if call == 'action':
raise SaltCloudSystemExit(
'The show_all_prices function must be called with -f or --function.'
)
if kwargs is None:
kwargs = {}
conn... | [
"def",
"show_all_prices",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The show_all_prices function must be called with -f or --function.'",
")",
"if",
"kwargs",
"is",
"No... | Return a dict of all prices on the cloud provider. | [
"Return",
"a",
"dict",
"of",
"all",
"prices",
"on",
"the",
"cloud",
"provider",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/softlayer_hw.py#L619-L643 | train |
saltstack/salt | salt/cloud/clouds/softlayer_hw.py | show_all_categories | def show_all_categories(call=None):
'''
Return a dict of all available categories on the cloud provider.
.. versionadded:: 2016.3.0
'''
if call == 'action':
raise SaltCloudSystemExit(
'The show_all_categories function must be called with -f or --function.'
)
conn = ... | python | def show_all_categories(call=None):
'''
Return a dict of all available categories on the cloud provider.
.. versionadded:: 2016.3.0
'''
if call == 'action':
raise SaltCloudSystemExit(
'The show_all_categories function must be called with -f or --function.'
)
conn = ... | [
"def",
"show_all_categories",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The show_all_categories function must be called with -f or --function.'",
")",
"conn",
"=",
"get_conn",
"(",
"service",
"=",
"... | Return a dict of all available categories on the cloud provider.
.. versionadded:: 2016.3.0 | [
"Return",
"a",
"dict",
"of",
"all",
"available",
"categories",
"on",
"the",
"cloud",
"provider",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/softlayer_hw.py#L646-L663 | train |
saltstack/salt | salt/modules/mysql.py | _connect | def _connect(**kwargs):
'''
wrap authentication credentials here
'''
connargs = dict()
def _connarg(name, key=None, get_opts=True):
'''
Add key to connargs, only if name exists in our kwargs or,
if get_opts is true, as mysql.<name> in __opts__ or __pillar__
If get_o... | python | def _connect(**kwargs):
'''
wrap authentication credentials here
'''
connargs = dict()
def _connarg(name, key=None, get_opts=True):
'''
Add key to connargs, only if name exists in our kwargs or,
if get_opts is true, as mysql.<name> in __opts__ or __pillar__
If get_o... | [
"def",
"_connect",
"(",
"*",
"*",
"kwargs",
")",
":",
"connargs",
"=",
"dict",
"(",
")",
"def",
"_connarg",
"(",
"name",
",",
"key",
"=",
"None",
",",
"get_opts",
"=",
"True",
")",
":",
"'''\n Add key to connargs, only if name exists in our kwargs or,\n ... | wrap authentication credentials here | [
"wrap",
"authentication",
"credentials",
"here"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L329-L400 | train |
saltstack/salt | salt/modules/mysql.py | quote_identifier | def quote_identifier(identifier, for_grants=False):
r'''
Return an identifier name (column, table, database, etc) escaped for MySQL
This means surrounded by "`" character and escaping this character inside.
It also means doubling the '%' character for MySQLdb internal usage.
:param identifier: the... | python | def quote_identifier(identifier, for_grants=False):
r'''
Return an identifier name (column, table, database, etc) escaped for MySQL
This means surrounded by "`" character and escaping this character inside.
It also means doubling the '%' character for MySQLdb internal usage.
:param identifier: the... | [
"def",
"quote_identifier",
"(",
"identifier",
",",
"for_grants",
"=",
"False",
")",
":",
"if",
"for_grants",
":",
"return",
"'`'",
"+",
"identifier",
".",
"replace",
"(",
"'`'",
",",
"'``'",
")",
".",
"replace",
"(",
"'_'",
",",
"r'\\_'",
")",
".",
"re... | r'''
Return an identifier name (column, table, database, etc) escaped for MySQL
This means surrounded by "`" character and escaping this character inside.
It also means doubling the '%' character for MySQLdb internal usage.
:param identifier: the table, column or database identifier
:param for_gr... | [
"r",
"Return",
"an",
"identifier",
"name",
"(",
"column",
"table",
"database",
"etc",
")",
"escaped",
"for",
"MySQL"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L562-L587 | train |
saltstack/salt | salt/modules/mysql.py | _execute | def _execute(cur, qry, args=None):
'''
Internal wrapper around MySQLdb cursor.execute() function
MySQLDb does not apply the same filters when arguments are used with the
query. For example '%' characters on the query must be encoded as '%%' and
will be restored as '%' when arguments are applied. Bu... | python | def _execute(cur, qry, args=None):
'''
Internal wrapper around MySQLdb cursor.execute() function
MySQLDb does not apply the same filters when arguments are used with the
query. For example '%' characters on the query must be encoded as '%%' and
will be restored as '%' when arguments are applied. Bu... | [
"def",
"_execute",
"(",
"cur",
",",
"qry",
",",
"args",
"=",
"None",
")",
":",
"if",
"args",
"is",
"None",
"or",
"args",
"==",
"{",
"}",
":",
"qry",
"=",
"qry",
".",
"replace",
"(",
"'%%'",
",",
"'%'",
")",
"log",
".",
"debug",
"(",
"'Doing que... | Internal wrapper around MySQLdb cursor.execute() function
MySQLDb does not apply the same filters when arguments are used with the
query. For example '%' characters on the query must be encoded as '%%' and
will be restored as '%' when arguments are applied. But when there're no
arguments the '%%' is no... | [
"Internal",
"wrapper",
"around",
"MySQLdb",
"cursor",
".",
"execute",
"()",
"function"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L590-L607 | train |
saltstack/salt | salt/modules/mysql.py | query | def query(database, query, **connection_args):
'''
Run an arbitrary SQL query and return the results or
the number of affected rows.
CLI Example:
.. code-block:: bash
salt '*' mysql.query mydb "UPDATE mytable set myfield=1 limit 1"
Return data:
.. code-block:: python
{'... | python | def query(database, query, **connection_args):
'''
Run an arbitrary SQL query and return the results or
the number of affected rows.
CLI Example:
.. code-block:: bash
salt '*' mysql.query mydb "UPDATE mytable set myfield=1 limit 1"
Return data:
.. code-block:: python
{'... | [
"def",
"query",
"(",
"database",
",",
"query",
",",
"*",
"*",
"connection_args",
")",
":",
"# Doesn't do anything about sql warnings, e.g. empty values on an insert.",
"# I don't think it handles multiple queries at once, so adding \"commit\"",
"# might not work.",
"# The following 3 l... | Run an arbitrary SQL query and return the results or
the number of affected rows.
CLI Example:
.. code-block:: bash
salt '*' mysql.query mydb "UPDATE mytable set myfield=1 limit 1"
Return data:
.. code-block:: python
{'query time': {'human': '39.0ms', 'raw': '0.03899'}, 'rows a... | [
"Run",
"an",
"arbitrary",
"SQL",
"query",
"and",
"return",
"the",
"results",
"or",
"the",
"number",
"of",
"affected",
"rows",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L610-L739 | train |
saltstack/salt | salt/modules/mysql.py | file_query | def file_query(database, file_name, **connection_args):
'''
Run an arbitrary SQL query from the specified file and return the
the number of affected rows.
.. versionadded:: 2017.7.0
database
database to run script inside
file_name
File name of the script. This can be on the... | python | def file_query(database, file_name, **connection_args):
'''
Run an arbitrary SQL query from the specified file and return the
the number of affected rows.
.. versionadded:: 2017.7.0
database
database to run script inside
file_name
File name of the script. This can be on the... | [
"def",
"file_query",
"(",
"database",
",",
"file_name",
",",
"*",
"*",
"connection_args",
")",
":",
"if",
"any",
"(",
"file_name",
".",
"startswith",
"(",
"proto",
")",
"for",
"proto",
"in",
"(",
"'salt://'",
",",
"'http://'",
",",
"'https://'",
",",
"'s... | Run an arbitrary SQL query from the specified file and return the
the number of affected rows.
.. versionadded:: 2017.7.0
database
database to run script inside
file_name
File name of the script. This can be on the minion, or a file that is reachable by the fileserver
CLI Exam... | [
"Run",
"an",
"arbitrary",
"SQL",
"query",
"from",
"the",
"specified",
"file",
"and",
"return",
"the",
"the",
"number",
"of",
"affected",
"rows",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L742-L813 | train |
saltstack/salt | salt/modules/mysql.py | status | def status(**connection_args):
'''
Return the status of a MySQL server using the output from the ``SHOW
STATUS`` query.
CLI Example:
.. code-block:: bash
salt '*' mysql.status
'''
dbc = _connect(**connection_args)
if dbc is None:
return {}
cur = dbc.cursor()
qr... | python | def status(**connection_args):
'''
Return the status of a MySQL server using the output from the ``SHOW
STATUS`` query.
CLI Example:
.. code-block:: bash
salt '*' mysql.status
'''
dbc = _connect(**connection_args)
if dbc is None:
return {}
cur = dbc.cursor()
qr... | [
"def",
"status",
"(",
"*",
"*",
"connection_args",
")",
":",
"dbc",
"=",
"_connect",
"(",
"*",
"*",
"connection_args",
")",
"if",
"dbc",
"is",
"None",
":",
"return",
"{",
"}",
"cur",
"=",
"dbc",
".",
"cursor",
"(",
")",
"qry",
"=",
"'SHOW STATUS'",
... | Return the status of a MySQL server using the output from the ``SHOW
STATUS`` query.
CLI Example:
.. code-block:: bash
salt '*' mysql.status | [
"Return",
"the",
"status",
"of",
"a",
"MySQL",
"server",
"using",
"the",
"output",
"from",
"the",
"SHOW",
"STATUS",
"query",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L816-L844 | train |
saltstack/salt | salt/modules/mysql.py | version | def version(**connection_args):
'''
Return the version of a MySQL server using the output from the ``SELECT
VERSION()`` query.
CLI Example:
.. code-block:: bash
salt '*' mysql.version
'''
dbc = _connect(**connection_args)
if dbc is None:
return ''
cur = dbc.cursor(... | python | def version(**connection_args):
'''
Return the version of a MySQL server using the output from the ``SELECT
VERSION()`` query.
CLI Example:
.. code-block:: bash
salt '*' mysql.version
'''
dbc = _connect(**connection_args)
if dbc is None:
return ''
cur = dbc.cursor(... | [
"def",
"version",
"(",
"*",
"*",
"connection_args",
")",
":",
"dbc",
"=",
"_connect",
"(",
"*",
"*",
"connection_args",
")",
"if",
"dbc",
"is",
"None",
":",
"return",
"''",
"cur",
"=",
"dbc",
".",
"cursor",
"(",
")",
"qry",
"=",
"'SELECT VERSION()'",
... | Return the version of a MySQL server using the output from the ``SELECT
VERSION()`` query.
CLI Example:
.. code-block:: bash
salt '*' mysql.version | [
"Return",
"the",
"version",
"of",
"a",
"MySQL",
"server",
"using",
"the",
"output",
"from",
"the",
"SELECT",
"VERSION",
"()",
"query",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L847-L874 | train |
saltstack/salt | salt/modules/mysql.py | slave_lag | def slave_lag(**connection_args):
'''
Return the number of seconds that a slave SQL server is lagging behind the
master, if the host is not a slave it will return -1. If the server is
configured to be a slave for replication but slave IO is not running then
-2 will be returned. If there was an erro... | python | def slave_lag(**connection_args):
'''
Return the number of seconds that a slave SQL server is lagging behind the
master, if the host is not a slave it will return -1. If the server is
configured to be a slave for replication but slave IO is not running then
-2 will be returned. If there was an erro... | [
"def",
"slave_lag",
"(",
"*",
"*",
"connection_args",
")",
":",
"dbc",
"=",
"_connect",
"(",
"*",
"*",
"connection_args",
")",
"if",
"dbc",
"is",
"None",
":",
"return",
"-",
"3",
"cur",
"=",
"dbc",
".",
"cursor",
"(",
"MySQLdb",
".",
"cursors",
".",
... | Return the number of seconds that a slave SQL server is lagging behind the
master, if the host is not a slave it will return -1. If the server is
configured to be a slave for replication but slave IO is not running then
-2 will be returned. If there was an error connecting to the database or
checking t... | [
"Return",
"the",
"number",
"of",
"seconds",
"that",
"a",
"slave",
"SQL",
"server",
"is",
"lagging",
"behind",
"the",
"master",
"if",
"the",
"host",
"is",
"not",
"a",
"slave",
"it",
"will",
"return",
"-",
"1",
".",
"If",
"the",
"server",
"is",
"configur... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L877-L916 | train |
saltstack/salt | salt/modules/mysql.py | free_slave | def free_slave(**connection_args):
'''
Frees a slave from its master. This is a WIP, do not use.
CLI Example:
.. code-block:: bash
salt '*' mysql.free_slave
'''
slave_db = _connect(**connection_args)
if slave_db is None:
return ''
slave_cur = slave_db.cursor(MySQLdb.c... | python | def free_slave(**connection_args):
'''
Frees a slave from its master. This is a WIP, do not use.
CLI Example:
.. code-block:: bash
salt '*' mysql.free_slave
'''
slave_db = _connect(**connection_args)
if slave_db is None:
return ''
slave_cur = slave_db.cursor(MySQLdb.c... | [
"def",
"free_slave",
"(",
"*",
"*",
"connection_args",
")",
":",
"slave_db",
"=",
"_connect",
"(",
"*",
"*",
"connection_args",
")",
"if",
"slave_db",
"is",
"None",
":",
"return",
"''",
"slave_cur",
"=",
"slave_db",
".",
"cursor",
"(",
"MySQLdb",
".",
"c... | Frees a slave from its master. This is a WIP, do not use.
CLI Example:
.. code-block:: bash
salt '*' mysql.free_slave | [
"Frees",
"a",
"slave",
"from",
"its",
"master",
".",
"This",
"is",
"a",
"WIP",
"do",
"not",
"use",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L919-L961 | train |
saltstack/salt | salt/modules/mysql.py | db_list | def db_list(**connection_args):
'''
Return a list of databases of a MySQL server using the output
from the ``SHOW DATABASES`` query.
CLI Example:
.. code-block:: bash
salt '*' mysql.db_list
'''
dbc = _connect(**connection_args)
if dbc is None:
return []
cur = dbc.c... | python | def db_list(**connection_args):
'''
Return a list of databases of a MySQL server using the output
from the ``SHOW DATABASES`` query.
CLI Example:
.. code-block:: bash
salt '*' mysql.db_list
'''
dbc = _connect(**connection_args)
if dbc is None:
return []
cur = dbc.c... | [
"def",
"db_list",
"(",
"*",
"*",
"connection_args",
")",
":",
"dbc",
"=",
"_connect",
"(",
"*",
"*",
"connection_args",
")",
"if",
"dbc",
"is",
"None",
":",
"return",
"[",
"]",
"cur",
"=",
"dbc",
".",
"cursor",
"(",
")",
"qry",
"=",
"'SHOW DATABASES'... | Return a list of databases of a MySQL server using the output
from the ``SHOW DATABASES`` query.
CLI Example:
.. code-block:: bash
salt '*' mysql.db_list | [
"Return",
"a",
"list",
"of",
"databases",
"of",
"a",
"MySQL",
"server",
"using",
"the",
"output",
"from",
"the",
"SHOW",
"DATABASES",
"query",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L965-L995 | train |
saltstack/salt | salt/modules/mysql.py | alter_db | def alter_db(name, character_set=None, collate=None, **connection_args):
'''
Modify database using ``ALTER DATABASE %(dbname)s CHARACTER SET %(charset)s
COLLATE %(collation)s;`` query.
CLI Example:
.. code-block:: bash
salt '*' mysql.alter_db testdb charset='latin1'
'''
dbc = _con... | python | def alter_db(name, character_set=None, collate=None, **connection_args):
'''
Modify database using ``ALTER DATABASE %(dbname)s CHARACTER SET %(charset)s
COLLATE %(collation)s;`` query.
CLI Example:
.. code-block:: bash
salt '*' mysql.alter_db testdb charset='latin1'
'''
dbc = _con... | [
"def",
"alter_db",
"(",
"name",
",",
"character_set",
"=",
"None",
",",
"collate",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"dbc",
"=",
"_connect",
"(",
"*",
"*",
"connection_args",
")",
"if",
"dbc",
"is",
"None",
":",
"return",
"[",
... | Modify database using ``ALTER DATABASE %(dbname)s CHARACTER SET %(charset)s
COLLATE %(collation)s;`` query.
CLI Example:
.. code-block:: bash
salt '*' mysql.alter_db testdb charset='latin1' | [
"Modify",
"database",
"using",
"ALTER",
"DATABASE",
"%",
"(",
"dbname",
")",
"s",
"CHARACTER",
"SET",
"%",
"(",
"charset",
")",
"s",
"COLLATE",
"%",
"(",
"collation",
")",
"s",
";",
"query",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L998-L1019 | train |
saltstack/salt | salt/modules/mysql.py | db_get | def db_get(name, **connection_args):
'''
Return a list of databases of a MySQL server using the output
from the ``SELECT DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME FROM
INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='dbname';`` query.
CLI Example:
.. code-block:: bash
salt '*' ... | python | def db_get(name, **connection_args):
'''
Return a list of databases of a MySQL server using the output
from the ``SELECT DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME FROM
INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='dbname';`` query.
CLI Example:
.. code-block:: bash
salt '*' ... | [
"def",
"db_get",
"(",
"name",
",",
"*",
"*",
"connection_args",
")",
":",
"dbc",
"=",
"_connect",
"(",
"*",
"*",
"connection_args",
")",
"if",
"dbc",
"is",
"None",
":",
"return",
"[",
"]",
"cur",
"=",
"dbc",
".",
"cursor",
"(",
")",
"qry",
"=",
"... | Return a list of databases of a MySQL server using the output
from the ``SELECT DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME FROM
INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='dbname';`` query.
CLI Example:
.. code-block:: bash
salt '*' mysql.db_get test | [
"Return",
"a",
"list",
"of",
"databases",
"of",
"a",
"MySQL",
"server",
"using",
"the",
"output",
"from",
"the",
"SELECT",
"DEFAULT_CHARACTER_SET_NAME",
"DEFAULT_COLLATION_NAME",
"FROM",
"INFORMATION_SCHEMA",
".",
"SCHEMATA",
"WHERE",
"SCHEMA_NAME",
"=",
"dbname",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L1022-L1046 | train |
saltstack/salt | salt/modules/mysql.py | db_tables | def db_tables(name, **connection_args):
'''
Shows the tables in the given MySQL database (if exists)
CLI Example:
.. code-block:: bash
salt '*' mysql.db_tables 'database'
'''
if not db_exists(name, **connection_args):
log.info('Database \'%s\' does not exist', name)
re... | python | def db_tables(name, **connection_args):
'''
Shows the tables in the given MySQL database (if exists)
CLI Example:
.. code-block:: bash
salt '*' mysql.db_tables 'database'
'''
if not db_exists(name, **connection_args):
log.info('Database \'%s\' does not exist', name)
re... | [
"def",
"db_tables",
"(",
"name",
",",
"*",
"*",
"connection_args",
")",
":",
"if",
"not",
"db_exists",
"(",
"name",
",",
"*",
"*",
"connection_args",
")",
":",
"log",
".",
"info",
"(",
"'Database \\'%s\\' does not exist'",
",",
"name",
")",
"return",
"Fals... | Shows the tables in the given MySQL database (if exists)
CLI Example:
.. code-block:: bash
salt '*' mysql.db_tables 'database' | [
"Shows",
"the",
"tables",
"in",
"the",
"given",
"MySQL",
"database",
"(",
"if",
"exists",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L1049-L1083 | train |
saltstack/salt | salt/modules/mysql.py | db_exists | def db_exists(name, **connection_args):
'''
Checks if a database exists on the MySQL server.
CLI Example:
.. code-block:: bash
salt '*' mysql.db_exists 'dbname'
'''
dbc = _connect(**connection_args)
if dbc is None:
return False
cur = dbc.cursor()
# Warn: here db id... | python | def db_exists(name, **connection_args):
'''
Checks if a database exists on the MySQL server.
CLI Example:
.. code-block:: bash
salt '*' mysql.db_exists 'dbname'
'''
dbc = _connect(**connection_args)
if dbc is None:
return False
cur = dbc.cursor()
# Warn: here db id... | [
"def",
"db_exists",
"(",
"name",
",",
"*",
"*",
"connection_args",
")",
":",
"dbc",
"=",
"_connect",
"(",
"*",
"*",
"connection_args",
")",
"if",
"dbc",
"is",
"None",
":",
"return",
"False",
"cur",
"=",
"dbc",
".",
"cursor",
"(",
")",
"# Warn: here db ... | Checks if a database exists on the MySQL server.
CLI Example:
.. code-block:: bash
salt '*' mysql.db_exists 'dbname' | [
"Checks",
"if",
"a",
"database",
"exists",
"on",
"the",
"MySQL",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L1086-L1113 | train |
saltstack/salt | salt/modules/mysql.py | db_create | def db_create(name, character_set=None, collate=None, **connection_args):
'''
Adds a databases to the MySQL server.
name
The name of the database to manage
character_set
The character set, if left empty the MySQL default will be used
collate
The collation, if left empty th... | python | def db_create(name, character_set=None, collate=None, **connection_args):
'''
Adds a databases to the MySQL server.
name
The name of the database to manage
character_set
The character set, if left empty the MySQL default will be used
collate
The collation, if left empty th... | [
"def",
"db_create",
"(",
"name",
",",
"character_set",
"=",
"None",
",",
"collate",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"# check if db exists",
"if",
"db_exists",
"(",
"name",
",",
"*",
"*",
"connection_args",
")",
":",
"log",
".",
"... | Adds a databases to the MySQL server.
name
The name of the database to manage
character_set
The character set, if left empty the MySQL default will be used
collate
The collation, if left empty the MySQL default will be used
CLI Example:
.. code-block:: bash
salt... | [
"Adds",
"a",
"databases",
"to",
"the",
"MySQL",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L1116-L1166 | train |
saltstack/salt | salt/modules/mysql.py | db_remove | def db_remove(name, **connection_args):
'''
Removes a databases from the MySQL server.
CLI Example:
.. code-block:: bash
salt '*' mysql.db_remove 'dbname'
'''
# check if db exists
if not db_exists(name, **connection_args):
log.info('DB \'%s\' does not exist', name)
... | python | def db_remove(name, **connection_args):
'''
Removes a databases from the MySQL server.
CLI Example:
.. code-block:: bash
salt '*' mysql.db_remove 'dbname'
'''
# check if db exists
if not db_exists(name, **connection_args):
log.info('DB \'%s\' does not exist', name)
... | [
"def",
"db_remove",
"(",
"name",
",",
"*",
"*",
"connection_args",
")",
":",
"# check if db exists",
"if",
"not",
"db_exists",
"(",
"name",
",",
"*",
"*",
"connection_args",
")",
":",
"log",
".",
"info",
"(",
"'DB \\'%s\\' does not exist'",
",",
"name",
")",... | Removes a databases from the MySQL server.
CLI Example:
.. code-block:: bash
salt '*' mysql.db_remove 'dbname' | [
"Removes",
"a",
"databases",
"from",
"the",
"MySQL",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L1169-L1209 | train |
saltstack/salt | salt/modules/mysql.py | user_list | def user_list(**connection_args):
'''
Return a list of users on a MySQL server
CLI Example:
.. code-block:: bash
salt '*' mysql.user_list
'''
dbc = _connect(**connection_args)
if dbc is None:
return []
cur = dbc.cursor(MySQLdb.cursors.DictCursor)
try:
qry =... | python | def user_list(**connection_args):
'''
Return a list of users on a MySQL server
CLI Example:
.. code-block:: bash
salt '*' mysql.user_list
'''
dbc = _connect(**connection_args)
if dbc is None:
return []
cur = dbc.cursor(MySQLdb.cursors.DictCursor)
try:
qry =... | [
"def",
"user_list",
"(",
"*",
"*",
"connection_args",
")",
":",
"dbc",
"=",
"_connect",
"(",
"*",
"*",
"connection_args",
")",
"if",
"dbc",
"is",
"None",
":",
"return",
"[",
"]",
"cur",
"=",
"dbc",
".",
"cursor",
"(",
"MySQLdb",
".",
"cursors",
".",
... | Return a list of users on a MySQL server
CLI Example:
.. code-block:: bash
salt '*' mysql.user_list | [
"Return",
"a",
"list",
"of",
"users",
"on",
"a",
"MySQL",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L1213-L1237 | train |
saltstack/salt | salt/modules/mysql.py | user_exists | def user_exists(user,
host='localhost',
password=None,
password_hash=None,
passwordless=False,
unix_socket=False,
password_column=None,
**connection_args):
'''
Checks if a user exists on the MySQL ser... | python | def user_exists(user,
host='localhost',
password=None,
password_hash=None,
passwordless=False,
unix_socket=False,
password_column=None,
**connection_args):
'''
Checks if a user exists on the MySQL ser... | [
"def",
"user_exists",
"(",
"user",
",",
"host",
"=",
"'localhost'",
",",
"password",
"=",
"None",
",",
"password_hash",
"=",
"None",
",",
"passwordless",
"=",
"False",
",",
"unix_socket",
"=",
"False",
",",
"password_column",
"=",
"None",
",",
"*",
"*",
... | Checks if a user exists on the MySQL server. A login can be checked to see
if passwordless login is permitted by omitting ``password`` and
``password_hash``, and using ``passwordless=True``.
.. versionadded:: 0.16.2
The ``passwordless`` option was added.
CLI Example:
.. code-block:: bash
... | [
"Checks",
"if",
"a",
"user",
"exists",
"on",
"the",
"MySQL",
"server",
".",
"A",
"login",
"can",
"be",
"checked",
"to",
"see",
"if",
"passwordless",
"login",
"is",
"permitted",
"by",
"omitting",
"password",
"and",
"password_hash",
"and",
"using",
"passwordle... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L1240-L1325 | train |
saltstack/salt | salt/modules/mysql.py | user_info | def user_info(user, host='localhost', **connection_args):
'''
Get full info on a MySQL user
CLI Example:
.. code-block:: bash
salt '*' mysql.user_info root localhost
'''
dbc = _connect(**connection_args)
if dbc is None:
return False
cur = dbc.cursor(MySQLdb.cursors.Di... | python | def user_info(user, host='localhost', **connection_args):
'''
Get full info on a MySQL user
CLI Example:
.. code-block:: bash
salt '*' mysql.user_info root localhost
'''
dbc = _connect(**connection_args)
if dbc is None:
return False
cur = dbc.cursor(MySQLdb.cursors.Di... | [
"def",
"user_info",
"(",
"user",
",",
"host",
"=",
"'localhost'",
",",
"*",
"*",
"connection_args",
")",
":",
"dbc",
"=",
"_connect",
"(",
"*",
"*",
"connection_args",
")",
"if",
"dbc",
"is",
"None",
":",
"return",
"False",
"cur",
"=",
"dbc",
".",
"c... | Get full info on a MySQL user
CLI Example:
.. code-block:: bash
salt '*' mysql.user_info root localhost | [
"Get",
"full",
"info",
"on",
"a",
"MySQL",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L1328-L1358 | train |
saltstack/salt | salt/modules/mysql.py | user_create | def user_create(user,
host='localhost',
password=None,
password_hash=None,
allow_passwordless=False,
unix_socket=False,
password_column=None,
**connection_args):
'''
Creates a MySQL user
host
... | python | def user_create(user,
host='localhost',
password=None,
password_hash=None,
allow_passwordless=False,
unix_socket=False,
password_column=None,
**connection_args):
'''
Creates a MySQL user
host
... | [
"def",
"user_create",
"(",
"user",
",",
"host",
"=",
"'localhost'",
",",
"password",
"=",
"None",
",",
"password_hash",
"=",
"None",
",",
"allow_passwordless",
"=",
"False",
",",
"unix_socket",
"=",
"False",
",",
"password_column",
"=",
"None",
",",
"*",
"... | Creates a MySQL user
host
Host for which this user/password combo applies
password
The password to use for the new user. Will take precedence over the
``password_hash`` option if both are specified.
password_hash
The password in hashed form. Be sure to quote the password b... | [
"Creates",
"a",
"MySQL",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L1361-L1471 | train |
saltstack/salt | salt/modules/mysql.py | user_chpass | def user_chpass(user,
host='localhost',
password=None,
password_hash=None,
allow_passwordless=False,
unix_socket=None,
password_column=None,
**connection_args):
'''
Change password for a MySQL user
... | python | def user_chpass(user,
host='localhost',
password=None,
password_hash=None,
allow_passwordless=False,
unix_socket=None,
password_column=None,
**connection_args):
'''
Change password for a MySQL user
... | [
"def",
"user_chpass",
"(",
"user",
",",
"host",
"=",
"'localhost'",
",",
"password",
"=",
"None",
",",
"password_hash",
"=",
"None",
",",
"allow_passwordless",
"=",
"False",
",",
"unix_socket",
"=",
"None",
",",
"password_column",
"=",
"None",
",",
"*",
"*... | Change password for a MySQL user
host
Host for which this user/password combo applies
password
The password to set for the new user. Will take precedence over the
``password_hash`` option if both are specified.
password_hash
The password in hashed form. Be sure to quote th... | [
"Change",
"password",
"for",
"a",
"MySQL",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L1474-L1602 | train |
saltstack/salt | salt/modules/mysql.py | user_remove | def user_remove(user,
host='localhost',
**connection_args):
'''
Delete MySQL user
CLI Example:
.. code-block:: bash
salt '*' mysql.user_remove frank localhost
'''
dbc = _connect(**connection_args)
if dbc is None:
return False
cur = dbc.... | python | def user_remove(user,
host='localhost',
**connection_args):
'''
Delete MySQL user
CLI Example:
.. code-block:: bash
salt '*' mysql.user_remove frank localhost
'''
dbc = _connect(**connection_args)
if dbc is None:
return False
cur = dbc.... | [
"def",
"user_remove",
"(",
"user",
",",
"host",
"=",
"'localhost'",
",",
"*",
"*",
"connection_args",
")",
":",
"dbc",
"=",
"_connect",
"(",
"*",
"*",
"connection_args",
")",
"if",
"dbc",
"is",
"None",
":",
"return",
"False",
"cur",
"=",
"dbc",
".",
... | Delete MySQL user
CLI Example:
.. code-block:: bash
salt '*' mysql.user_remove frank localhost | [
"Delete",
"MySQL",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L1605-L1639 | train |
saltstack/salt | salt/modules/mysql.py | db_check | def db_check(name,
table=None,
**connection_args):
'''
Repairs the full database or just a given table
CLI Example:
.. code-block:: bash
salt '*' mysql.db_check dbname
salt '*' mysql.db_check dbname dbtable
'''
ret = []
if table is None:
#... | python | def db_check(name,
table=None,
**connection_args):
'''
Repairs the full database or just a given table
CLI Example:
.. code-block:: bash
salt '*' mysql.db_check dbname
salt '*' mysql.db_check dbname dbtable
'''
ret = []
if table is None:
#... | [
"def",
"db_check",
"(",
"name",
",",
"table",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"ret",
"=",
"[",
"]",
"if",
"table",
"is",
"None",
":",
"# we need to check all tables",
"tables",
"=",
"db_tables",
"(",
"name",
",",
"*",
"*",
"con... | Repairs the full database or just a given table
CLI Example:
.. code-block:: bash
salt '*' mysql.db_check dbname
salt '*' mysql.db_check dbname dbtable | [
"Repairs",
"the",
"full",
"database",
"or",
"just",
"a",
"given",
"table"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L1659-L1682 | train |
saltstack/salt | salt/modules/mysql.py | db_repair | def db_repair(name,
table=None,
**connection_args):
'''
Repairs the full database or just a given table
CLI Example:
.. code-block:: bash
salt '*' mysql.db_repair dbname
'''
ret = []
if table is None:
# we need to repair all tables
table... | python | def db_repair(name,
table=None,
**connection_args):
'''
Repairs the full database or just a given table
CLI Example:
.. code-block:: bash
salt '*' mysql.db_repair dbname
'''
ret = []
if table is None:
# we need to repair all tables
table... | [
"def",
"db_repair",
"(",
"name",
",",
"table",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"ret",
"=",
"[",
"]",
"if",
"table",
"is",
"None",
":",
"# we need to repair all tables",
"tables",
"=",
"db_tables",
"(",
"name",
",",
"*",
"*",
"c... | Repairs the full database or just a given table
CLI Example:
.. code-block:: bash
salt '*' mysql.db_repair dbname | [
"Repairs",
"the",
"full",
"database",
"or",
"just",
"a",
"given",
"table"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L1685-L1707 | train |
saltstack/salt | salt/modules/mysql.py | db_optimize | def db_optimize(name,
table=None,
**connection_args):
'''
Optimizes the full database or just a given table
CLI Example:
.. code-block:: bash
salt '*' mysql.db_optimize dbname
'''
ret = []
if table is None:
# we need to optimize all tables
... | python | def db_optimize(name,
table=None,
**connection_args):
'''
Optimizes the full database or just a given table
CLI Example:
.. code-block:: bash
salt '*' mysql.db_optimize dbname
'''
ret = []
if table is None:
# we need to optimize all tables
... | [
"def",
"db_optimize",
"(",
"name",
",",
"table",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"ret",
"=",
"[",
"]",
"if",
"table",
"is",
"None",
":",
"# we need to optimize all tables",
"tables",
"=",
"db_tables",
"(",
"name",
",",
"*",
"*",
... | Optimizes the full database or just a given table
CLI Example:
.. code-block:: bash
salt '*' mysql.db_optimize dbname | [
"Optimizes",
"the",
"full",
"database",
"or",
"just",
"a",
"given",
"table"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L1710-L1732 | train |
saltstack/salt | salt/modules/mysql.py | __grant_generate | def __grant_generate(grant,
database,
user,
host='localhost',
grant_option=False,
escape=True,
ssl_option=False):
'''
Validate grants and build the query that could set the given grants
N... | python | def __grant_generate(grant,
database,
user,
host='localhost',
grant_option=False,
escape=True,
ssl_option=False):
'''
Validate grants and build the query that could set the given grants
N... | [
"def",
"__grant_generate",
"(",
"grant",
",",
"database",
",",
"user",
",",
"host",
"=",
"'localhost'",
",",
"grant_option",
"=",
"False",
",",
"escape",
"=",
"True",
",",
"ssl_option",
"=",
"False",
")",
":",
"# TODO: Re-order the grant so it is according to the"... | Validate grants and build the query that could set the given grants
Note that this query contains arguments for user and host but not for
grants or database. | [
"Validate",
"grants",
"and",
"build",
"the",
"query",
"that",
"could",
"set",
"the",
"given",
"grants"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L1778-L1818 | train |
saltstack/salt | salt/modules/mysql.py | user_grants | def user_grants(user,
host='localhost', **connection_args):
'''
Shows the grants for the given MySQL user (if it exists)
CLI Example:
.. code-block:: bash
salt '*' mysql.user_grants 'frank' 'localhost'
'''
if not user_exists(user, host, **connection_args):
log.... | python | def user_grants(user,
host='localhost', **connection_args):
'''
Shows the grants for the given MySQL user (if it exists)
CLI Example:
.. code-block:: bash
salt '*' mysql.user_grants 'frank' 'localhost'
'''
if not user_exists(user, host, **connection_args):
log.... | [
"def",
"user_grants",
"(",
"user",
",",
"host",
"=",
"'localhost'",
",",
"*",
"*",
"connection_args",
")",
":",
"if",
"not",
"user_exists",
"(",
"user",
",",
"host",
",",
"*",
"*",
"connection_args",
")",
":",
"log",
".",
"info",
"(",
"'User \\'%s\\'@\\'... | Shows the grants for the given MySQL user (if it exists)
CLI Example:
.. code-block:: bash
salt '*' mysql.user_grants 'frank' 'localhost' | [
"Shows",
"the",
"grants",
"for",
"the",
"given",
"MySQL",
"user",
"(",
"if",
"it",
"exists",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L1821-L1860 | train |
saltstack/salt | salt/modules/mysql.py | grant_exists | def grant_exists(grant,
database,
user,
host='localhost',
grant_option=False,
escape=True,
**connection_args):
'''
Checks to see if a grant exists in the database
CLI Example:
.. code-block:: bash
... | python | def grant_exists(grant,
database,
user,
host='localhost',
grant_option=False,
escape=True,
**connection_args):
'''
Checks to see if a grant exists in the database
CLI Example:
.. code-block:: bash
... | [
"def",
"grant_exists",
"(",
"grant",
",",
"database",
",",
"user",
",",
"host",
"=",
"'localhost'",
",",
"grant_option",
"=",
"False",
",",
"escape",
"=",
"True",
",",
"*",
"*",
"connection_args",
")",
":",
"server_version",
"=",
"salt",
".",
"utils",
".... | Checks to see if a grant exists in the database
CLI Example:
.. code-block:: bash
salt '*' mysql.grant_exists \
'SELECT,INSERT,UPDATE,...' 'database.*' 'frank' 'localhost' | [
"Checks",
"to",
"see",
"if",
"a",
"grant",
"exists",
"in",
"the",
"database"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L1863-L1949 | train |
saltstack/salt | salt/modules/mysql.py | grant_add | def grant_add(grant,
database,
user,
host='localhost',
grant_option=False,
escape=True,
ssl_option=False,
**connection_args):
'''
Adds a grant to the MySQL server.
For database, make sure you specify database.... | python | def grant_add(grant,
database,
user,
host='localhost',
grant_option=False,
escape=True,
ssl_option=False,
**connection_args):
'''
Adds a grant to the MySQL server.
For database, make sure you specify database.... | [
"def",
"grant_add",
"(",
"grant",
",",
"database",
",",
"user",
",",
"host",
"=",
"'localhost'",
",",
"grant_option",
"=",
"False",
",",
"escape",
"=",
"True",
",",
"ssl_option",
"=",
"False",
",",
"*",
"*",
"connection_args",
")",
":",
"dbc",
"=",
"_c... | Adds a grant to the MySQL server.
For database, make sure you specify database.table or database.*
CLI Example:
.. code-block:: bash
salt '*' mysql.grant_add \
'SELECT,INSERT,UPDATE,...' 'database.*' 'frank' 'localhost' | [
"Adds",
"a",
"grant",
"to",
"the",
"MySQL",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L1952-L2004 | train |
saltstack/salt | salt/modules/mysql.py | grant_revoke | def grant_revoke(grant,
database,
user,
host='localhost',
grant_option=False,
escape=True,
**connection_args):
'''
Removes a grant from the MySQL server.
CLI Example:
.. code-block:: bash
sal... | python | def grant_revoke(grant,
database,
user,
host='localhost',
grant_option=False,
escape=True,
**connection_args):
'''
Removes a grant from the MySQL server.
CLI Example:
.. code-block:: bash
sal... | [
"def",
"grant_revoke",
"(",
"grant",
",",
"database",
",",
"user",
",",
"host",
"=",
"'localhost'",
",",
"grant_option",
"=",
"False",
",",
"escape",
"=",
"True",
",",
"*",
"*",
"connection_args",
")",
":",
"dbc",
"=",
"_connect",
"(",
"*",
"*",
"conne... | Removes a grant from the MySQL server.
CLI Example:
.. code-block:: bash
salt '*' mysql.grant_revoke \
'SELECT,INSERT,UPDATE' 'database.*' 'frank' 'localhost' | [
"Removes",
"a",
"grant",
"from",
"the",
"MySQL",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L2007-L2081 | train |
saltstack/salt | salt/modules/mysql.py | processlist | def processlist(**connection_args):
'''
Retrieves the processlist from the MySQL server via
"SHOW FULL PROCESSLIST".
Returns: a list of dicts, with each dict representing a process:
.. code-block:: python
{'Command': 'Query',
'Host': 'localhost',
'Id': 39,
'Info': ... | python | def processlist(**connection_args):
'''
Retrieves the processlist from the MySQL server via
"SHOW FULL PROCESSLIST".
Returns: a list of dicts, with each dict representing a process:
.. code-block:: python
{'Command': 'Query',
'Host': 'localhost',
'Id': 39,
'Info': ... | [
"def",
"processlist",
"(",
"*",
"*",
"connection_args",
")",
":",
"ret",
"=",
"[",
"]",
"dbc",
"=",
"_connect",
"(",
"*",
"*",
"connection_args",
")",
"if",
"dbc",
"is",
"None",
":",
"return",
"[",
"]",
"cur",
"=",
"dbc",
".",
"cursor",
"(",
")",
... | Retrieves the processlist from the MySQL server via
"SHOW FULL PROCESSLIST".
Returns: a list of dicts, with each dict representing a process:
.. code-block:: python
{'Command': 'Query',
'Host': 'localhost',
'Id': 39,
'Info': 'SHOW FULL PROCESSLIST',
'Rows_examined'... | [
"Retrieves",
"the",
"processlist",
"from",
"the",
"MySQL",
"server",
"via",
"SHOW",
"FULL",
"PROCESSLIST",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L2084-L2127 | train |
saltstack/salt | salt/modules/mysql.py | __do_query_into_hash | def __do_query_into_hash(conn, sql_str):
'''
Perform the query that is passed to it (sql_str).
Returns:
results in a dict.
'''
mod = sys._getframe().f_code.co_name
log.debug('%s<--(%s)', mod, sql_str)
rtn_results = []
try:
cursor = conn.cursor()
except MySQLdb.MySQ... | python | def __do_query_into_hash(conn, sql_str):
'''
Perform the query that is passed to it (sql_str).
Returns:
results in a dict.
'''
mod = sys._getframe().f_code.co_name
log.debug('%s<--(%s)', mod, sql_str)
rtn_results = []
try:
cursor = conn.cursor()
except MySQLdb.MySQ... | [
"def",
"__do_query_into_hash",
"(",
"conn",
",",
"sql_str",
")",
":",
"mod",
"=",
"sys",
".",
"_getframe",
"(",
")",
".",
"f_code",
".",
"co_name",
"log",
".",
"debug",
"(",
"'%s<--(%s)'",
",",
"mod",
",",
"sql_str",
")",
"rtn_results",
"=",
"[",
"]",
... | Perform the query that is passed to it (sql_str).
Returns:
results in a dict. | [
"Perform",
"the",
"query",
"that",
"is",
"passed",
"to",
"it",
"(",
"sql_str",
")",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L2130-L2173 | train |
saltstack/salt | salt/modules/mysql.py | get_master_status | def get_master_status(**connection_args):
'''
Retrieves the master status from the minion.
Returns::
{'host.domain.com': {'Binlog_Do_DB': '',
'Binlog_Ignore_DB': '',
'File': 'mysql-bin.000021',
'Position': 107}}
CLI Ex... | python | def get_master_status(**connection_args):
'''
Retrieves the master status from the minion.
Returns::
{'host.domain.com': {'Binlog_Do_DB': '',
'Binlog_Ignore_DB': '',
'File': 'mysql-bin.000021',
'Position': 107}}
CLI Ex... | [
"def",
"get_master_status",
"(",
"*",
"*",
"connection_args",
")",
":",
"mod",
"=",
"sys",
".",
"_getframe",
"(",
")",
".",
"f_code",
".",
"co_name",
"log",
".",
"debug",
"(",
"'%s<--'",
",",
"mod",
")",
"conn",
"=",
"_connect",
"(",
"*",
"*",
"conne... | Retrieves the master status from the minion.
Returns::
{'host.domain.com': {'Binlog_Do_DB': '',
'Binlog_Ignore_DB': '',
'File': 'mysql-bin.000021',
'Position': 107}}
CLI Example:
.. code-block:: bash
salt '*' mys... | [
"Retrieves",
"the",
"master",
"status",
"from",
"the",
"minion",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L2176-L2207 | train |
saltstack/salt | salt/modules/mysql.py | verify_login | def verify_login(user, password=None, **connection_args):
'''
Attempt to login using the provided credentials.
If successful, return true. Otherwise, return False.
CLI Example:
.. code-block:: bash
salt '*' mysql.verify_login root password
'''
# Override the connection args for u... | python | def verify_login(user, password=None, **connection_args):
'''
Attempt to login using the provided credentials.
If successful, return true. Otherwise, return False.
CLI Example:
.. code-block:: bash
salt '*' mysql.verify_login root password
'''
# Override the connection args for u... | [
"def",
"verify_login",
"(",
"user",
",",
"password",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"# Override the connection args for username and password",
"connection_args",
"[",
"'connection_user'",
"]",
"=",
"user",
"connection_args",
"[",
"'connection_... | Attempt to login using the provided credentials.
If successful, return true. Otherwise, return False.
CLI Example:
.. code-block:: bash
salt '*' mysql.verify_login root password | [
"Attempt",
"to",
"login",
"using",
"the",
"provided",
"credentials",
".",
"If",
"successful",
"return",
"true",
".",
"Otherwise",
"return",
"False",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L2336-L2358 | train |
saltstack/salt | salt/wheel/__init__.py | WheelClient.call_func | def call_func(self, fun, **kwargs):
'''
Backwards compatibility
'''
return self.low(fun, kwargs, print_event=kwargs.get('print_event', True), full_return=kwargs.get('full_return', False)) | python | def call_func(self, fun, **kwargs):
'''
Backwards compatibility
'''
return self.low(fun, kwargs, print_event=kwargs.get('print_event', True), full_return=kwargs.get('full_return', False)) | [
"def",
"call_func",
"(",
"self",
",",
"fun",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"low",
"(",
"fun",
",",
"kwargs",
",",
"print_event",
"=",
"kwargs",
".",
"get",
"(",
"'print_event'",
",",
"True",
")",
",",
"full_return",
"=",
... | Backwards compatibility | [
"Backwards",
"compatibility"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/wheel/__init__.py#L53-L57 | train |
saltstack/salt | salt/wheel/__init__.py | WheelClient.master_call | def master_call(self, **kwargs):
'''
Execute a wheel function through the master network interface (eauth).
'''
load = kwargs
load['cmd'] = 'wheel'
interface = self.opts['interface']
if interface == '0.0.0.0':
interface = '127.0.0.1'
master_uri... | python | def master_call(self, **kwargs):
'''
Execute a wheel function through the master network interface (eauth).
'''
load = kwargs
load['cmd'] = 'wheel'
interface = self.opts['interface']
if interface == '0.0.0.0':
interface = '127.0.0.1'
master_uri... | [
"def",
"master_call",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"load",
"=",
"kwargs",
"load",
"[",
"'cmd'",
"]",
"=",
"'wheel'",
"interface",
"=",
"self",
".",
"opts",
"[",
"'interface'",
"]",
"if",
"interface",
"==",
"'0.0.0.0'",
":",
"interfac... | Execute a wheel function through the master network interface (eauth). | [
"Execute",
"a",
"wheel",
"function",
"through",
"the",
"master",
"network",
"interface",
"(",
"eauth",
")",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/wheel/__init__.py#L61-L85 | train |
saltstack/salt | salt/wheel/__init__.py | WheelClient.cmd_async | def cmd_async(self, low):
'''
Execute a function asynchronously; eauth is respected
This function requires that :conf_master:`external_auth` is configured
and the user is authorized
.. code-block:: python
>>> wheel.cmd_async({
'fun': 'key.finger',
... | python | def cmd_async(self, low):
'''
Execute a function asynchronously; eauth is respected
This function requires that :conf_master:`external_auth` is configured
and the user is authorized
.. code-block:: python
>>> wheel.cmd_async({
'fun': 'key.finger',
... | [
"def",
"cmd_async",
"(",
"self",
",",
"low",
")",
":",
"fun",
"=",
"low",
".",
"pop",
"(",
"'fun'",
")",
"return",
"self",
".",
"asynchronous",
"(",
"fun",
",",
"low",
")"
] | Execute a function asynchronously; eauth is respected
This function requires that :conf_master:`external_auth` is configured
and the user is authorized
.. code-block:: python
>>> wheel.cmd_async({
'fun': 'key.finger',
'match': 'jerry',
... | [
"Execute",
"a",
"function",
"asynchronously",
";",
"eauth",
"is",
"respected"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/wheel/__init__.py#L109-L128 | train |
saltstack/salt | salt/wheel/__init__.py | WheelClient.cmd | def cmd(self, fun, arg=None, pub_data=None, kwarg=None, print_event=True, full_return=False):
'''
Execute a function
.. code-block:: python
>>> wheel.cmd('key.finger', ['jerry'])
{'minions': {'jerry': '5d:f6:79:43:5e:d4:42:3f:57:b8:45:a8:7e:a4:6e:ca'}}
'''
... | python | def cmd(self, fun, arg=None, pub_data=None, kwarg=None, print_event=True, full_return=False):
'''
Execute a function
.. code-block:: python
>>> wheel.cmd('key.finger', ['jerry'])
{'minions': {'jerry': '5d:f6:79:43:5e:d4:42:3f:57:b8:45:a8:7e:a4:6e:ca'}}
'''
... | [
"def",
"cmd",
"(",
"self",
",",
"fun",
",",
"arg",
"=",
"None",
",",
"pub_data",
"=",
"None",
",",
"kwarg",
"=",
"None",
",",
"print_event",
"=",
"True",
",",
"full_return",
"=",
"False",
")",
":",
"return",
"super",
"(",
"WheelClient",
",",
"self",
... | Execute a function
.. code-block:: python
>>> wheel.cmd('key.finger', ['jerry'])
{'minions': {'jerry': '5d:f6:79:43:5e:d4:42:3f:57:b8:45:a8:7e:a4:6e:ca'}} | [
"Execute",
"a",
"function"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/wheel/__init__.py#L130-L144 | train |
saltstack/salt | salt/modules/makeconf.py | _add_var | def _add_var(var, value):
'''
Add a new var to the make.conf. If using layman, the source line
for the layman make.conf needs to be at the very end of the
config. This ensures that the new var will be above the source
line.
'''
makeconf = _get_makeconf()
layman = 'source /var/lib/layman/... | python | def _add_var(var, value):
'''
Add a new var to the make.conf. If using layman, the source line
for the layman make.conf needs to be at the very end of the
config. This ensures that the new var will be above the source
line.
'''
makeconf = _get_makeconf()
layman = 'source /var/lib/layman/... | [
"def",
"_add_var",
"(",
"var",
",",
"value",
")",
":",
"makeconf",
"=",
"_get_makeconf",
"(",
")",
"layman",
"=",
"'source /var/lib/layman/make.conf'",
"fullvar",
"=",
"'{0}=\"{1}\"'",
".",
"format",
"(",
"var",
",",
"value",
")",
"if",
"__salt__",
"[",
"'fi... | Add a new var to the make.conf. If using layman, the source line
for the layman make.conf needs to be at the very end of the
config. This ensures that the new var will be above the source
line. | [
"Add",
"a",
"new",
"var",
"to",
"the",
"make",
".",
"conf",
".",
"If",
"using",
"layman",
"the",
"source",
"line",
"for",
"the",
"layman",
"make",
".",
"conf",
"needs",
"to",
"be",
"at",
"the",
"very",
"end",
"of",
"the",
"config",
".",
"This",
"en... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/makeconf.py#L36-L54 | train |
saltstack/salt | salt/modules/makeconf.py | set_var | def set_var(var, value):
'''
Set a variable in the make.conf
Return a dict containing the new value for variable::
{'<variable>': {'old': '<old-value>',
'new': '<new-value>'}}
CLI Example:
.. code-block:: bash
salt '*' makeconf.set_var 'LINGUAS' 'en'
... | python | def set_var(var, value):
'''
Set a variable in the make.conf
Return a dict containing the new value for variable::
{'<variable>': {'old': '<old-value>',
'new': '<new-value>'}}
CLI Example:
.. code-block:: bash
salt '*' makeconf.set_var 'LINGUAS' 'en'
... | [
"def",
"set_var",
"(",
"var",
",",
"value",
")",
":",
"makeconf",
"=",
"_get_makeconf",
"(",
")",
"old_value",
"=",
"get_var",
"(",
"var",
")",
"# If var already in file, replace its value",
"if",
"old_value",
"is",
"not",
"None",
":",
"__salt__",
"[",
"'file.... | Set a variable in the make.conf
Return a dict containing the new value for variable::
{'<variable>': {'old': '<old-value>',
'new': '<new-value>'}}
CLI Example:
.. code-block:: bash
salt '*' makeconf.set_var 'LINGUAS' 'en' | [
"Set",
"a",
"variable",
"in",
"the",
"make",
".",
"conf"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/makeconf.py#L57-L85 | train |
saltstack/salt | salt/modules/makeconf.py | remove_var | def remove_var(var):
'''
Remove a variable from the make.conf
Return a dict containing the new value for the variable::
{'<variable>': {'old': '<old-value>',
'new': '<new-value>'}}
CLI Example:
.. code-block:: bash
salt '*' makeconf.remove_var 'LINGUAS'
... | python | def remove_var(var):
'''
Remove a variable from the make.conf
Return a dict containing the new value for the variable::
{'<variable>': {'old': '<old-value>',
'new': '<new-value>'}}
CLI Example:
.. code-block:: bash
salt '*' makeconf.remove_var 'LINGUAS'
... | [
"def",
"remove_var",
"(",
"var",
")",
":",
"makeconf",
"=",
"_get_makeconf",
"(",
")",
"old_value",
"=",
"get_var",
"(",
"var",
")",
"# If var is in file",
"if",
"old_value",
"is",
"not",
"None",
":",
"__salt__",
"[",
"'file.sed'",
"]",
"(",
"makeconf",
",... | Remove a variable from the make.conf
Return a dict containing the new value for the variable::
{'<variable>': {'old': '<old-value>',
'new': '<new-value>'}}
CLI Example:
.. code-block:: bash
salt '*' makeconf.remove_var 'LINGUAS' | [
"Remove",
"a",
"variable",
"from",
"the",
"make",
".",
"conf"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/makeconf.py#L88-L112 | train |
saltstack/salt | salt/modules/makeconf.py | append_var | def append_var(var, value):
'''
Add to or create a new variable in the make.conf
Return a dict containing the new value for variable::
{'<variable>': {'old': '<old-value>',
'new': '<new-value>'}}
CLI Example:
.. code-block:: bash
salt '*' makeconf.append_... | python | def append_var(var, value):
'''
Add to or create a new variable in the make.conf
Return a dict containing the new value for variable::
{'<variable>': {'old': '<old-value>',
'new': '<new-value>'}}
CLI Example:
.. code-block:: bash
salt '*' makeconf.append_... | [
"def",
"append_var",
"(",
"var",
",",
"value",
")",
":",
"makeconf",
"=",
"_get_makeconf",
"(",
")",
"old_value",
"=",
"get_var",
"(",
"var",
")",
"# If var already in file, add to its value",
"if",
"old_value",
"is",
"not",
"None",
":",
"appended_value",
"=",
... | Add to or create a new variable in the make.conf
Return a dict containing the new value for variable::
{'<variable>': {'old': '<old-value>',
'new': '<new-value>'}}
CLI Example:
.. code-block:: bash
salt '*' makeconf.append_var 'LINGUAS' 'en' | [
"Add",
"to",
"or",
"create",
"a",
"new",
"variable",
"in",
"the",
"make",
".",
"conf"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/makeconf.py#L115-L143 | train |
saltstack/salt | salt/modules/makeconf.py | trim_var | def trim_var(var, value):
'''
Remove a value from a variable in the make.conf
Return a dict containing the new value for variable::
{'<variable>': {'old': '<old-value>',
'new': '<new-value>'}}
CLI Example:
.. code-block:: bash
salt '*' makeconf.trim_var '... | python | def trim_var(var, value):
'''
Remove a value from a variable in the make.conf
Return a dict containing the new value for variable::
{'<variable>': {'old': '<old-value>',
'new': '<new-value>'}}
CLI Example:
.. code-block:: bash
salt '*' makeconf.trim_var '... | [
"def",
"trim_var",
"(",
"var",
",",
"value",
")",
":",
"makeconf",
"=",
"_get_makeconf",
"(",
")",
"old_value",
"=",
"get_var",
"(",
"var",
")",
"# If var in file, trim value from its value",
"if",
"old_value",
"is",
"not",
"None",
":",
"__salt__",
"[",
"'file... | Remove a value from a variable in the make.conf
Return a dict containing the new value for variable::
{'<variable>': {'old': '<old-value>',
'new': '<new-value>'}}
CLI Example:
.. code-block:: bash
salt '*' makeconf.trim_var 'LINGUAS' 'en' | [
"Remove",
"a",
"value",
"from",
"a",
"variable",
"in",
"the",
"make",
".",
"conf"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/makeconf.py#L146-L170 | train |
saltstack/salt | salt/modules/makeconf.py | get_var | def get_var(var):
'''
Get the value of a variable in make.conf
Return the value of the variable or None if the variable is not in
make.conf
CLI Example:
.. code-block:: bash
salt '*' makeconf.get_var 'LINGUAS'
'''
makeconf = _get_makeconf()
# Open makeconf
with salt.u... | python | def get_var(var):
'''
Get the value of a variable in make.conf
Return the value of the variable or None if the variable is not in
make.conf
CLI Example:
.. code-block:: bash
salt '*' makeconf.get_var 'LINGUAS'
'''
makeconf = _get_makeconf()
# Open makeconf
with salt.u... | [
"def",
"get_var",
"(",
"var",
")",
":",
"makeconf",
"=",
"_get_makeconf",
"(",
")",
"# Open makeconf",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"makeconf",
")",
"as",
"fn_",
":",
"conf_file",
"=",
"salt",
".",
"utils",
".",
"data"... | Get the value of a variable in make.conf
Return the value of the variable or None if the variable is not in
make.conf
CLI Example:
.. code-block:: bash
salt '*' makeconf.get_var 'LINGUAS' | [
"Get",
"the",
"value",
"of",
"a",
"variable",
"in",
"make",
".",
"conf"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/makeconf.py#L173-L199 | train |
saltstack/salt | salt/modules/makeconf.py | var_contains | def var_contains(var, value):
'''
Verify if variable contains a value in make.conf
Return True if value is set for var
CLI Example:
.. code-block:: bash
salt '*' makeconf.var_contains 'LINGUAS' 'en'
'''
setval = get_var(var)
# Remove any escaping that was needed to past throu... | python | def var_contains(var, value):
'''
Verify if variable contains a value in make.conf
Return True if value is set for var
CLI Example:
.. code-block:: bash
salt '*' makeconf.var_contains 'LINGUAS' 'en'
'''
setval = get_var(var)
# Remove any escaping that was needed to past throu... | [
"def",
"var_contains",
"(",
"var",
",",
"value",
")",
":",
"setval",
"=",
"get_var",
"(",
"var",
")",
"# Remove any escaping that was needed to past through salt",
"value",
"=",
"value",
".",
"replace",
"(",
"'\\\\'",
",",
"''",
")",
"if",
"setval",
"is",
"Non... | Verify if variable contains a value in make.conf
Return True if value is set for var
CLI Example:
.. code-block:: bash
salt '*' makeconf.var_contains 'LINGUAS' 'en' | [
"Verify",
"if",
"variable",
"contains",
"a",
"value",
"in",
"make",
".",
"conf"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/makeconf.py#L202-L219 | train |
saltstack/salt | salt/returners/carbon_return.py | _carbon | def _carbon(host, port):
'''
Context manager to ensure the clean creation and destruction of a socket.
host
The IP or hostname of the carbon server
port
The port that carbon is listening on
'''
carbon_sock = None
try:
carbon_sock = socket.socket(socket.AF_INET, sock... | python | def _carbon(host, port):
'''
Context manager to ensure the clean creation and destruction of a socket.
host
The IP or hostname of the carbon server
port
The port that carbon is listening on
'''
carbon_sock = None
try:
carbon_sock = socket.socket(socket.AF_INET, sock... | [
"def",
"_carbon",
"(",
"host",
",",
"port",
")",
":",
"carbon_sock",
"=",
"None",
"try",
":",
"carbon_sock",
"=",
"socket",
".",
"socket",
"(",
"socket",
".",
"AF_INET",
",",
"socket",
".",
"SOCK_STREAM",
",",
"socket",
".",
"IPPROTO_TCP",
")",
"carbon_s... | Context manager to ensure the clean creation and destruction of a socket.
host
The IP or hostname of the carbon server
port
The port that carbon is listening on | [
"Context",
"manager",
"to",
"ensure",
"the",
"clean",
"creation",
"and",
"destruction",
"of",
"a",
"socket",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/carbon_return.py#L129-L157 | train |
saltstack/salt | salt/returners/carbon_return.py | _send_picklemetrics | def _send_picklemetrics(metrics):
'''
Format metrics for the carbon pickle protocol
'''
metrics = [(metric_name, (timestamp, value))
for (metric_name, value, timestamp) in metrics]
data = cPickle.dumps(metrics, -1)
payload = struct.pack(b'!L', len(data)) + data
return paylo... | python | def _send_picklemetrics(metrics):
'''
Format metrics for the carbon pickle protocol
'''
metrics = [(metric_name, (timestamp, value))
for (metric_name, value, timestamp) in metrics]
data = cPickle.dumps(metrics, -1)
payload = struct.pack(b'!L', len(data)) + data
return paylo... | [
"def",
"_send_picklemetrics",
"(",
"metrics",
")",
":",
"metrics",
"=",
"[",
"(",
"metric_name",
",",
"(",
"timestamp",
",",
"value",
")",
")",
"for",
"(",
"metric_name",
",",
"value",
",",
"timestamp",
")",
"in",
"metrics",
"]",
"data",
"=",
"cPickle",
... | Format metrics for the carbon pickle protocol | [
"Format",
"metrics",
"for",
"the",
"carbon",
"pickle",
"protocol"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/carbon_return.py#L160-L171 | train |
saltstack/salt | salt/returners/carbon_return.py | _send_textmetrics | def _send_textmetrics(metrics):
'''
Format metrics for the carbon plaintext protocol
'''
data = [' '.join(map(six.text_type, metric)) for metric in metrics] + ['']
return '\n'.join(data) | python | def _send_textmetrics(metrics):
'''
Format metrics for the carbon plaintext protocol
'''
data = [' '.join(map(six.text_type, metric)) for metric in metrics] + ['']
return '\n'.join(data) | [
"def",
"_send_textmetrics",
"(",
"metrics",
")",
":",
"data",
"=",
"[",
"' '",
".",
"join",
"(",
"map",
"(",
"six",
".",
"text_type",
",",
"metric",
")",
")",
"for",
"metric",
"in",
"metrics",
"]",
"+",
"[",
"''",
"]",
"return",
"'\\n'",
".",
"join... | Format metrics for the carbon plaintext protocol | [
"Format",
"metrics",
"for",
"the",
"carbon",
"plaintext",
"protocol"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/carbon_return.py#L174-L181 | train |
saltstack/salt | salt/returners/carbon_return.py | _walk | def _walk(path, value, metrics, timestamp, skip):
'''
Recursively include metrics from *value*.
path
The dot-separated path of the metric.
value
A dictionary or value from a dictionary. If a dictionary, ``_walk``
will be called again with the each key/value pair as a new set of
... | python | def _walk(path, value, metrics, timestamp, skip):
'''
Recursively include metrics from *value*.
path
The dot-separated path of the metric.
value
A dictionary or value from a dictionary. If a dictionary, ``_walk``
will be called again with the each key/value pair as a new set of
... | [
"def",
"_walk",
"(",
"path",
",",
"value",
",",
"metrics",
",",
"timestamp",
",",
"skip",
")",
":",
"log",
".",
"trace",
"(",
"'Carbon return walking path: %s, value: %s, metrics: %s, '",
"'timestamp: %s'",
",",
"path",
",",
"value",
",",
"metrics",
",",
"timest... | Recursively include metrics from *value*.
path
The dot-separated path of the metric.
value
A dictionary or value from a dictionary. If a dictionary, ``_walk``
will be called again with the each key/value pair as a new set of
metrics.
metrics
The list of metrics that ... | [
"Recursively",
"include",
"metrics",
"from",
"*",
"value",
"*",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/carbon_return.py#L184-L224 | train |
saltstack/salt | salt/returners/carbon_return.py | _send | def _send(saltdata, metric_base, opts):
'''
Send the data to carbon
'''
host = opts.get('host')
port = opts.get('port')
skip = opts.get('skip')
metric_base_pattern = opts.get('carbon.metric_base_pattern')
mode = opts.get('mode').lower() if 'mode' in opts else 'text'
log.debug('Carb... | python | def _send(saltdata, metric_base, opts):
'''
Send the data to carbon
'''
host = opts.get('host')
port = opts.get('port')
skip = opts.get('skip')
metric_base_pattern = opts.get('carbon.metric_base_pattern')
mode = opts.get('mode').lower() if 'mode' in opts else 'text'
log.debug('Carb... | [
"def",
"_send",
"(",
"saltdata",
",",
"metric_base",
",",
"opts",
")",
":",
"host",
"=",
"opts",
".",
"get",
"(",
"'host'",
")",
"port",
"=",
"opts",
".",
"get",
"(",
"'port'",
")",
"skip",
"=",
"opts",
".",
"get",
"(",
"'skip'",
")",
"metric_base_... | Send the data to carbon | [
"Send",
"the",
"data",
"to",
"carbon"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/carbon_return.py#L227-L266 | train |
saltstack/salt | salt/returners/carbon_return.py | event_return | def event_return(events):
'''
Return event data to remote carbon server
Provide a list of events to be stored in carbon
'''
opts = _get_options({}) # Pass in empty ret, since this is a list of events
opts['skip'] = True
for event in events:
log.trace('Carbon returner received event... | python | def event_return(events):
'''
Return event data to remote carbon server
Provide a list of events to be stored in carbon
'''
opts = _get_options({}) # Pass in empty ret, since this is a list of events
opts['skip'] = True
for event in events:
log.trace('Carbon returner received event... | [
"def",
"event_return",
"(",
"events",
")",
":",
"opts",
"=",
"_get_options",
"(",
"{",
"}",
")",
"# Pass in empty ret, since this is a list of events",
"opts",
"[",
"'skip'",
"]",
"=",
"True",
"for",
"event",
"in",
"events",
":",
"log",
".",
"trace",
"(",
"'... | Return event data to remote carbon server
Provide a list of events to be stored in carbon | [
"Return",
"event",
"data",
"to",
"remote",
"carbon",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/carbon_return.py#L269-L281 | train |
saltstack/salt | salt/returners/carbon_return.py | returner | def returner(ret):
'''
Return data to a remote carbon server using the text metric protocol
Each metric will look like::
[module].[function].[minion_id].[metric path [...]].[metric name]
'''
opts = _get_options(ret)
metric_base = ret['fun']
# Strip the hostname from the carbon bas... | python | def returner(ret):
'''
Return data to a remote carbon server using the text metric protocol
Each metric will look like::
[module].[function].[minion_id].[metric path [...]].[metric name]
'''
opts = _get_options(ret)
metric_base = ret['fun']
# Strip the hostname from the carbon bas... | [
"def",
"returner",
"(",
"ret",
")",
":",
"opts",
"=",
"_get_options",
"(",
"ret",
")",
"metric_base",
"=",
"ret",
"[",
"'fun'",
"]",
"# Strip the hostname from the carbon base if we are returning from virt",
"# module since then we will get stable metric bases even if the VM is... | Return data to a remote carbon server using the text metric protocol
Each metric will look like::
[module].[function].[minion_id].[metric path [...]].[metric name] | [
"Return",
"data",
"to",
"a",
"remote",
"carbon",
"server",
"using",
"the",
"text",
"metric",
"protocol"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/carbon_return.py#L284-L302 | train |
saltstack/salt | salt/modules/boto_cfn.py | exists | def exists(name, region=None, key=None, keyid=None, profile=None):
'''
Check to see if a stack exists.
CLI Example:
.. code-block:: bash
salt myminion boto_cfn.exists mystack region=us-east-1
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
try:
... | python | def exists(name, region=None, key=None, keyid=None, profile=None):
'''
Check to see if a stack exists.
CLI Example:
.. code-block:: bash
salt myminion boto_cfn.exists mystack region=us-east-1
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
try:
... | [
"def",
"exists",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
",",
"keyid",
"="... | Check to see if a stack exists.
CLI Example:
.. code-block:: bash
salt myminion boto_cfn.exists mystack region=us-east-1 | [
"Check",
"to",
"see",
"if",
"a",
"stack",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_cfn.py#L71-L90 | train |
saltstack/salt | salt/modules/boto_cfn.py | describe | def describe(name, region=None, key=None, keyid=None, profile=None):
'''
Describe a stack.
.. versionadded:: 2015.8.0
CLI Example:
.. code-block:: bash
salt myminion boto_cfn.describe mystack region=us-east-1
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profi... | python | def describe(name, region=None, key=None, keyid=None, profile=None):
'''
Describe a stack.
.. versionadded:: 2015.8.0
CLI Example:
.. code-block:: bash
salt myminion boto_cfn.describe mystack region=us-east-1
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profi... | [
"def",
"describe",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
",",
"keyid",
"... | Describe a stack.
.. versionadded:: 2015.8.0
CLI Example:
.. code-block:: bash
salt myminion boto_cfn.describe mystack region=us-east-1 | [
"Describe",
"a",
"stack",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_cfn.py#L93-L133 | train |
saltstack/salt | salt/modules/boto_cfn.py | create | def create(name, template_body=None, template_url=None, parameters=None, notification_arns=None, disable_rollback=None,
timeout_in_minutes=None, capabilities=None, tags=None, on_failure=None, stack_policy_body=None,
stack_policy_url=None, region=None, key=None, keyid=None, profile=None):
'''
... | python | def create(name, template_body=None, template_url=None, parameters=None, notification_arns=None, disable_rollback=None,
timeout_in_minutes=None, capabilities=None, tags=None, on_failure=None, stack_policy_body=None,
stack_policy_url=None, region=None, key=None, keyid=None, profile=None):
'''
... | [
"def",
"create",
"(",
"name",
",",
"template_body",
"=",
"None",
",",
"template_url",
"=",
"None",
",",
"parameters",
"=",
"None",
",",
"notification_arns",
"=",
"None",
",",
"disable_rollback",
"=",
"None",
",",
"timeout_in_minutes",
"=",
"None",
",",
"capa... | Create a CFN stack.
CLI Example:
.. code-block:: bash
salt myminion boto_cfn.create mystack template_url='https://s3.amazonaws.com/bucket/template.cft' \
region=us-east-1 | [
"Create",
"a",
"CFN",
"stack",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_cfn.py#L136-L158 | train |
saltstack/salt | salt/modules/boto_cfn.py | update_stack | def update_stack(name, template_body=None, template_url=None, parameters=None, notification_arns=None,
disable_rollback=False, timeout_in_minutes=None, capabilities=None, tags=None,
use_previous_template=None, stack_policy_during_update_body=None, stack_policy_during_update_url=None,
... | python | def update_stack(name, template_body=None, template_url=None, parameters=None, notification_arns=None,
disable_rollback=False, timeout_in_minutes=None, capabilities=None, tags=None,
use_previous_template=None, stack_policy_during_update_body=None, stack_policy_during_update_url=None,
... | [
"def",
"update_stack",
"(",
"name",
",",
"template_body",
"=",
"None",
",",
"template_url",
"=",
"None",
",",
"parameters",
"=",
"None",
",",
"notification_arns",
"=",
"None",
",",
"disable_rollback",
"=",
"False",
",",
"timeout_in_minutes",
"=",
"None",
",",
... | Update a CFN stack.
.. versionadded:: 2015.8.0
CLI Example:
.. code-block:: bash
salt myminion boto_cfn.update_stack mystack template_url='https://s3.amazonaws.com/bucket/template.cft' \
region=us-east-1 | [
"Update",
"a",
"CFN",
"stack",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_cfn.py#L161-L190 | train |
saltstack/salt | salt/modules/boto_cfn.py | delete | def delete(name, region=None, key=None, keyid=None, profile=None):
'''
Delete a CFN stack.
CLI Example:
.. code-block:: bash
salt myminion boto_cfn.delete mystack region=us-east-1
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
try:
return conn.... | python | def delete(name, region=None, key=None, keyid=None, profile=None):
'''
Delete a CFN stack.
CLI Example:
.. code-block:: bash
salt myminion boto_cfn.delete mystack region=us-east-1
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
try:
return conn.... | [
"def",
"delete",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
",",
"keyid",
"="... | Delete a CFN stack.
CLI Example:
.. code-block:: bash
salt myminion boto_cfn.delete mystack region=us-east-1 | [
"Delete",
"a",
"CFN",
"stack",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_cfn.py#L193-L211 | train |
saltstack/salt | salt/modules/boto_cfn.py | get_template | def get_template(name, region=None, key=None, keyid=None, profile=None):
'''
Check to see if attributes are set on a CFN stack.
CLI Example:
.. code-block:: bash
salt myminion boto_cfn.get_template mystack
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
... | python | def get_template(name, region=None, key=None, keyid=None, profile=None):
'''
Check to see if attributes are set on a CFN stack.
CLI Example:
.. code-block:: bash
salt myminion boto_cfn.get_template mystack
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
... | [
"def",
"get_template",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
",",
"keyid",... | Check to see if attributes are set on a CFN stack.
CLI Example:
.. code-block:: bash
salt myminion boto_cfn.get_template mystack | [
"Check",
"to",
"see",
"if",
"attributes",
"are",
"set",
"on",
"a",
"CFN",
"stack",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_cfn.py#L214-L234 | train |
saltstack/salt | salt/modules/boto_cfn.py | validate_template | def validate_template(template_body=None, template_url=None, region=None, key=None, keyid=None, profile=None):
'''
Validate cloudformation template
.. versionadded:: 2015.8.0
CLI Example:
.. code-block:: bash
salt myminion boto_cfn.validate_template mystack-template
'''
conn = _g... | python | def validate_template(template_body=None, template_url=None, region=None, key=None, keyid=None, profile=None):
'''
Validate cloudformation template
.. versionadded:: 2015.8.0
CLI Example:
.. code-block:: bash
salt myminion boto_cfn.validate_template mystack-template
'''
conn = _g... | [
"def",
"validate_template",
"(",
"template_body",
"=",
"None",
",",
"template_url",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"regi... | Validate cloudformation template
.. versionadded:: 2015.8.0
CLI Example:
.. code-block:: bash
salt myminion boto_cfn.validate_template mystack-template | [
"Validate",
"cloudformation",
"template"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_cfn.py#L237-L258 | train |
saltstack/salt | salt/modules/service.py | run | def run(name, action):
'''
Run the specified service with an action.
.. versionadded:: 2015.8.1
name
Service name.
action
Action name (like start, stop, reload, restart).
CLI Example:
.. code-block:: bash
salt '*' service.run apache2 reload
salt '*' s... | python | def run(name, action):
'''
Run the specified service with an action.
.. versionadded:: 2015.8.1
name
Service name.
action
Action name (like start, stop, reload, restart).
CLI Example:
.. code-block:: bash
salt '*' service.run apache2 reload
salt '*' s... | [
"def",
"run",
"(",
"name",
",",
"action",
")",
":",
"cmd",
"=",
"os",
".",
"path",
".",
"join",
"(",
"_GRAINMAP",
".",
"get",
"(",
"__grains__",
".",
"get",
"(",
"'os'",
")",
",",
"'/etc/init.d'",
")",
",",
"name",
")",
"+",
"' '",
"+",
"action",... | Run the specified service with an action.
.. versionadded:: 2015.8.1
name
Service name.
action
Action name (like start, stop, reload, restart).
CLI Example:
.. code-block:: bash
salt '*' service.run apache2 reload
salt '*' service.run postgresql initdb | [
"Run",
"the",
"specified",
"service",
"with",
"an",
"action",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/service.py#L60-L83 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.