repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/runners/state.py | orchestrate_high | def orchestrate_high(data, test=None, queue=False, pillar=None, **kwargs):
'''
Execute a single state orchestration routine
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt-run state.orchestrate_high '{
stage_one:
{salt.state: [{tgt: "db*"}, {... | python | def orchestrate_high(data, test=None, queue=False, pillar=None, **kwargs):
'''
Execute a single state orchestration routine
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt-run state.orchestrate_high '{
stage_one:
{salt.state: [{tgt: "db*"}, {... | [
"def",
"orchestrate_high",
"(",
"data",
",",
"test",
"=",
"None",
",",
"queue",
"=",
"False",
",",
"pillar",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"pillar",
"is",
"not",
"None",
"and",
"not",
"isinstance",
"(",
"pillar",
",",
"dict",
... | Execute a single state orchestration routine
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt-run state.orchestrate_high '{
stage_one:
{salt.state: [{tgt: "db*"}, {sls: postgres_setup}]},
stage_two:
{salt.state: [{tgt: "web... | [
"Execute",
"a",
"single",
"state",
"orchestration",
"routine"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/state.py#L173-L206 | train |
saltstack/salt | salt/runners/state.py | orchestrate_show_sls | def orchestrate_show_sls(mods,
saltenv='base',
test=None,
queue=False,
pillar=None,
pillarenv=None,
pillar_enc=None):
'''
Display the state data from a specific s... | python | def orchestrate_show_sls(mods,
saltenv='base',
test=None,
queue=False,
pillar=None,
pillarenv=None,
pillar_enc=None):
'''
Display the state data from a specific s... | [
"def",
"orchestrate_show_sls",
"(",
"mods",
",",
"saltenv",
"=",
"'base'",
",",
"test",
"=",
"None",
",",
"queue",
"=",
"False",
",",
"pillar",
"=",
"None",
",",
"pillarenv",
"=",
"None",
",",
"pillar_enc",
"=",
"None",
")",
":",
"if",
"pillar",
"is",
... | Display the state data from a specific sls, or list of sls files, after
being render using the master minion.
Note, the master minion adds a "_master" suffix to it's minion id.
.. seealso:: The state.show_sls module function
CLI Example:
.. code-block:: bash
salt-run state.orch_show_sls ... | [
"Display",
"the",
"state",
"data",
"from",
"a",
"specific",
"sls",
"or",
"list",
"of",
"sls",
"files",
"after",
"being",
"render",
"using",
"the",
"master",
"minion",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/state.py#L209-L245 | train |
saltstack/salt | salt/runners/state.py | event | def event(tagmatch='*',
count=-1,
quiet=False,
sock_dir=None,
pretty=False,
node='master'):
r'''
Watch Salt's event bus and block until the given tag is matched
.. versionadded:: 2014.7.0
.. versionchanged:: 2019.2.0
``tagmatch`` can now be eith... | python | def event(tagmatch='*',
count=-1,
quiet=False,
sock_dir=None,
pretty=False,
node='master'):
r'''
Watch Salt's event bus and block until the given tag is matched
.. versionadded:: 2014.7.0
.. versionchanged:: 2019.2.0
``tagmatch`` can now be eith... | [
"def",
"event",
"(",
"tagmatch",
"=",
"'*'",
",",
"count",
"=",
"-",
"1",
",",
"quiet",
"=",
"False",
",",
"sock_dir",
"=",
"None",
",",
"pretty",
"=",
"False",
",",
"node",
"=",
"'master'",
")",
":",
"statemod",
"=",
"salt",
".",
"loader",
".",
... | r'''
Watch Salt's event bus and block until the given tag is matched
.. versionadded:: 2014.7.0
.. versionchanged:: 2019.2.0
``tagmatch`` can now be either a glob or regular expression.
This is useful for utilizing Salt's event bus from shell scripts or for
taking simple actions directly f... | [
"r",
"Watch",
"Salt",
"s",
"event",
"bus",
"and",
"block",
"until",
"the",
"given",
"tag",
"is",
"matched"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/state.py#L251-L313 | train |
saltstack/salt | salt/modules/smtp.py | send_msg | def send_msg(recipient,
message,
subject='Message from Salt',
sender=None,
server=None,
use_ssl='True',
username=None,
password=None,
profile=None,
attachments=None):
'''
Send a message to an SMT... | python | def send_msg(recipient,
message,
subject='Message from Salt',
sender=None,
server=None,
use_ssl='True',
username=None,
password=None,
profile=None,
attachments=None):
'''
Send a message to an SMT... | [
"def",
"send_msg",
"(",
"recipient",
",",
"message",
",",
"subject",
"=",
"'Message from Salt'",
",",
"sender",
"=",
"None",
",",
"server",
"=",
"None",
",",
"use_ssl",
"=",
"'True'",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"prof... | Send a message to an SMTP recipient. Designed for use in states.
CLI Examples:
.. code-block:: bash
salt '*' smtp.send_msg 'admin@example.com' 'This is a salt module test' profile='my-smtp-account'
salt '*' smtp.send_msg 'admin@example.com' 'This is a salt module test' username='myuser' passw... | [
"Send",
"a",
"message",
"to",
"an",
"SMTP",
"recipient",
".",
"Designed",
"for",
"use",
"in",
"states",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smtp.py#L77-L175 | train |
saltstack/salt | salt/modules/bluecoat_sslv.py | add_distinguished_name | def add_distinguished_name(list_name, item_name):
'''
Adds a distinguished name to a distinguished name list.
list_name(str): The name of the specific policy distinguished name list to append to.
item_name(str): The distinguished name to append.
CLI Example:
.. code-block:: bash
sal... | python | def add_distinguished_name(list_name, item_name):
'''
Adds a distinguished name to a distinguished name list.
list_name(str): The name of the specific policy distinguished name list to append to.
item_name(str): The distinguished name to append.
CLI Example:
.. code-block:: bash
sal... | [
"def",
"add_distinguished_name",
"(",
"list_name",
",",
"item_name",
")",
":",
"payload",
"=",
"{",
"\"jsonrpc\"",
":",
"\"2.0\"",
",",
"\"id\"",
":",
"\"ID0\"",
",",
"\"method\"",
":",
"\"add_policy_distinguished_names\"",
",",
"\"params\"",
":",
"[",
"list_name"... | Adds a distinguished name to a distinguished name list.
list_name(str): The name of the specific policy distinguished name list to append to.
item_name(str): The distinguished name to append.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_distinguished_name MyDistinguishedList... | [
"Adds",
"a",
"distinguished",
"name",
"to",
"a",
"distinguished",
"name",
"list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluecoat_sslv.py#L76-L98 | train |
saltstack/salt | salt/modules/bluecoat_sslv.py | add_distinguished_name_list | def add_distinguished_name_list(list_name):
'''
Add a list of policy distinguished names.
list_name(str): The name of the specific policy distinguished name list to add.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_distinguished_name_list MyDistinguishedList
'''
... | python | def add_distinguished_name_list(list_name):
'''
Add a list of policy distinguished names.
list_name(str): The name of the specific policy distinguished name list to add.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_distinguished_name_list MyDistinguishedList
'''
... | [
"def",
"add_distinguished_name_list",
"(",
"list_name",
")",
":",
"payload",
"=",
"{",
"\"jsonrpc\"",
":",
"\"2.0\"",
",",
"\"id\"",
":",
"\"ID0\"",
",",
"\"method\"",
":",
"\"add_policy_distinguished_names_list\"",
",",
"\"params\"",
":",
"[",
"{",
"\"list_name\"",... | Add a list of policy distinguished names.
list_name(str): The name of the specific policy distinguished name list to add.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_distinguished_name_list MyDistinguishedList | [
"Add",
"a",
"list",
"of",
"policy",
"distinguished",
"names",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluecoat_sslv.py#L101-L121 | train |
saltstack/salt | salt/modules/bluecoat_sslv.py | add_domain_name | def add_domain_name(list_name, item_name):
'''
Adds a domain name to a domain name list.
list_name(str): The name of the specific policy domain name list to append to.
item_name(str): The domain name to append.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_domain_name... | python | def add_domain_name(list_name, item_name):
'''
Adds a domain name to a domain name list.
list_name(str): The name of the specific policy domain name list to append to.
item_name(str): The domain name to append.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_domain_name... | [
"def",
"add_domain_name",
"(",
"list_name",
",",
"item_name",
")",
":",
"payload",
"=",
"{",
"\"jsonrpc\"",
":",
"\"2.0\"",
",",
"\"id\"",
":",
"\"ID0\"",
",",
"\"method\"",
":",
"\"add_policy_domain_names\"",
",",
"\"params\"",
":",
"[",
"list_name",
",",
"{"... | Adds a domain name to a domain name list.
list_name(str): The name of the specific policy domain name list to append to.
item_name(str): The domain name to append.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_domain_name MyDomainName foo.bar.com | [
"Adds",
"a",
"domain",
"name",
"to",
"a",
"domain",
"name",
"list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluecoat_sslv.py#L124-L146 | train |
saltstack/salt | salt/modules/bluecoat_sslv.py | add_domain_name_list | def add_domain_name_list(list_name):
'''
Add a list of policy domain names.
list_name(str): The name of the specific policy domain name list to add.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_domain_name_list MyDomainNameList
'''
payload = {"jsonrpc": "2.0",
... | python | def add_domain_name_list(list_name):
'''
Add a list of policy domain names.
list_name(str): The name of the specific policy domain name list to add.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_domain_name_list MyDomainNameList
'''
payload = {"jsonrpc": "2.0",
... | [
"def",
"add_domain_name_list",
"(",
"list_name",
")",
":",
"payload",
"=",
"{",
"\"jsonrpc\"",
":",
"\"2.0\"",
",",
"\"id\"",
":",
"\"ID0\"",
",",
"\"method\"",
":",
"\"add_policy_domain_names_list\"",
",",
"\"params\"",
":",
"[",
"{",
"\"list_name\"",
":",
"lis... | Add a list of policy domain names.
list_name(str): The name of the specific policy domain name list to add.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_domain_name_list MyDomainNameList | [
"Add",
"a",
"list",
"of",
"policy",
"domain",
"names",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluecoat_sslv.py#L149-L169 | train |
saltstack/salt | salt/modules/bluecoat_sslv.py | add_ip_address | def add_ip_address(list_name, item_name):
'''
Add an IP address to an IP address list.
list_name(str): The name of the specific policy IP address list to append to.
item_name(str): The IP address to append to the list.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_ip_... | python | def add_ip_address(list_name, item_name):
'''
Add an IP address to an IP address list.
list_name(str): The name of the specific policy IP address list to append to.
item_name(str): The IP address to append to the list.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_ip_... | [
"def",
"add_ip_address",
"(",
"list_name",
",",
"item_name",
")",
":",
"payload",
"=",
"{",
"\"jsonrpc\"",
":",
"\"2.0\"",
",",
"\"id\"",
":",
"\"ID0\"",
",",
"\"method\"",
":",
"\"add_policy_ip_addresses\"",
",",
"\"params\"",
":",
"[",
"list_name",
",",
"{",... | Add an IP address to an IP address list.
list_name(str): The name of the specific policy IP address list to append to.
item_name(str): The IP address to append to the list.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_ip_address MyIPAddressList 10.0.0.0/24 | [
"Add",
"an",
"IP",
"address",
"to",
"an",
"IP",
"address",
"list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluecoat_sslv.py#L172-L194 | train |
saltstack/salt | salt/modules/bluecoat_sslv.py | add_ip_address_list | def add_ip_address_list(list_name):
'''
Retrieves a list of all IP address lists.
list_name(str): The name of the specific IP address list to add.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_ip_address_list MyIPAddressList
'''
payload = {"jsonrpc": "2.0",
... | python | def add_ip_address_list(list_name):
'''
Retrieves a list of all IP address lists.
list_name(str): The name of the specific IP address list to add.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_ip_address_list MyIPAddressList
'''
payload = {"jsonrpc": "2.0",
... | [
"def",
"add_ip_address_list",
"(",
"list_name",
")",
":",
"payload",
"=",
"{",
"\"jsonrpc\"",
":",
"\"2.0\"",
",",
"\"id\"",
":",
"\"ID0\"",
",",
"\"method\"",
":",
"\"add_policy_ip_addresses_list\"",
",",
"\"params\"",
":",
"[",
"{",
"\"list_name\"",
":",
"list... | Retrieves a list of all IP address lists.
list_name(str): The name of the specific IP address list to add.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_ip_address_list MyIPAddressList | [
"Retrieves",
"a",
"list",
"of",
"all",
"IP",
"address",
"lists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluecoat_sslv.py#L197-L217 | train |
saltstack/salt | salt/modules/bluecoat_sslv.py | get_distinguished_name_list | def get_distinguished_name_list(list_name):
'''
Retrieves a specific policy distinguished name list.
list_name(str): The name of the specific policy distinguished name list to retrieve.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.get_distinguished_name_list MyDistinguishedLi... | python | def get_distinguished_name_list(list_name):
'''
Retrieves a specific policy distinguished name list.
list_name(str): The name of the specific policy distinguished name list to retrieve.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.get_distinguished_name_list MyDistinguishedLi... | [
"def",
"get_distinguished_name_list",
"(",
"list_name",
")",
":",
"payload",
"=",
"{",
"\"jsonrpc\"",
":",
"\"2.0\"",
",",
"\"id\"",
":",
"\"ID0\"",
",",
"\"method\"",
":",
"\"get_policy_distinguished_names\"",
",",
"\"params\"",
":",
"[",
"list_name",
",",
"0",
... | Retrieves a specific policy distinguished name list.
list_name(str): The name of the specific policy distinguished name list to retrieve.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.get_distinguished_name_list MyDistinguishedList | [
"Retrieves",
"a",
"specific",
"policy",
"distinguished",
"name",
"list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluecoat_sslv.py#L220-L240 | train |
saltstack/salt | salt/modules/bluecoat_sslv.py | get_domain_list | def get_domain_list(list_name):
'''
Retrieves a specific policy domain name list.
list_name(str): The name of the specific policy domain name list to retrieve.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.get_domain_list MyDomainNameList
'''
payload = {"jsonrpc": "2.... | python | def get_domain_list(list_name):
'''
Retrieves a specific policy domain name list.
list_name(str): The name of the specific policy domain name list to retrieve.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.get_domain_list MyDomainNameList
'''
payload = {"jsonrpc": "2.... | [
"def",
"get_domain_list",
"(",
"list_name",
")",
":",
"payload",
"=",
"{",
"\"jsonrpc\"",
":",
"\"2.0\"",
",",
"\"id\"",
":",
"\"ID0\"",
",",
"\"method\"",
":",
"\"get_policy_domain_names\"",
",",
"\"params\"",
":",
"[",
"list_name",
",",
"0",
",",
"256",
"]... | Retrieves a specific policy domain name list.
list_name(str): The name of the specific policy domain name list to retrieve.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.get_domain_list MyDomainNameList | [
"Retrieves",
"a",
"specific",
"policy",
"domain",
"name",
"list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluecoat_sslv.py#L264-L284 | train |
saltstack/salt | salt/modules/bluecoat_sslv.py | get_ip_address_list | def get_ip_address_list(list_name):
'''
Retrieves a specific IP address list.
list_name(str): The name of the specific policy IP address list to retrieve.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.get_ip_address_list MyIPAddressList
'''
payload = {"jsonrpc": "2.0"... | python | def get_ip_address_list(list_name):
'''
Retrieves a specific IP address list.
list_name(str): The name of the specific policy IP address list to retrieve.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.get_ip_address_list MyIPAddressList
'''
payload = {"jsonrpc": "2.0"... | [
"def",
"get_ip_address_list",
"(",
"list_name",
")",
":",
"payload",
"=",
"{",
"\"jsonrpc\"",
":",
"\"2.0\"",
",",
"\"id\"",
":",
"\"ID0\"",
",",
"\"method\"",
":",
"\"get_policy_ip_addresses\"",
",",
"\"params\"",
":",
"[",
"list_name",
",",
"0",
",",
"256",
... | Retrieves a specific IP address list.
list_name(str): The name of the specific policy IP address list to retrieve.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.get_ip_address_list MyIPAddressList | [
"Retrieves",
"a",
"specific",
"IP",
"address",
"list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluecoat_sslv.py#L308-L328 | train |
saltstack/salt | salt/utils/win_runas.py | runas | def runas(cmdLine, username, password=None, cwd=None):
'''
Run a command as another user. If the process is running as an admin or
system account this method does not require a password. Other non
privileged accounts need to provide a password for the user to runas.
Commands are run in with the high... | python | def runas(cmdLine, username, password=None, cwd=None):
'''
Run a command as another user. If the process is running as an admin or
system account this method does not require a password. Other non
privileged accounts need to provide a password for the user to runas.
Commands are run in with the high... | [
"def",
"runas",
"(",
"cmdLine",
",",
"username",
",",
"password",
"=",
"None",
",",
"cwd",
"=",
"None",
")",
":",
"# Elevate the token from the current process",
"access",
"=",
"(",
"win32security",
".",
"TOKEN_QUERY",
"|",
"win32security",
".",
"TOKEN_ADJUST_PRIV... | Run a command as another user. If the process is running as an admin or
system account this method does not require a password. Other non
privileged accounts need to provide a password for the user to runas.
Commands are run in with the highest level privileges possible for the
account provided. | [
"Run",
"a",
"command",
"as",
"another",
"user",
".",
"If",
"the",
"process",
"is",
"running",
"as",
"an",
"admin",
"or",
"system",
"account",
"this",
"method",
"does",
"not",
"require",
"a",
"password",
".",
"Other",
"non",
"privileged",
"accounts",
"need"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_runas.py#L62-L224 | train |
saltstack/salt | salt/utils/win_runas.py | runas_unpriv | def runas_unpriv(cmd, username, password, cwd=None):
'''
Runas that works for non-priviledged users
'''
# Create a pipe to set as stdout in the child. The write handle needs to be
# inheritable.
c2pread, c2pwrite = salt.platform.win.CreatePipe(
inherit_read=False, inherit_write=True,
... | python | def runas_unpriv(cmd, username, password, cwd=None):
'''
Runas that works for non-priviledged users
'''
# Create a pipe to set as stdout in the child. The write handle needs to be
# inheritable.
c2pread, c2pwrite = salt.platform.win.CreatePipe(
inherit_read=False, inherit_write=True,
... | [
"def",
"runas_unpriv",
"(",
"cmd",
",",
"username",
",",
"password",
",",
"cwd",
"=",
"None",
")",
":",
"# Create a pipe to set as stdout in the child. The write handle needs to be",
"# inheritable.",
"c2pread",
",",
"c2pwrite",
"=",
"salt",
".",
"platform",
".",
"win... | Runas that works for non-priviledged users | [
"Runas",
"that",
"works",
"for",
"non",
"-",
"priviledged",
"users"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_runas.py#L227-L295 | train |
saltstack/salt | salt/matchers/data_match.py | match | def match(tgt, functions=None, opts=None):
'''
Match based on the local data store on the minion
'''
if not opts:
opts = __opts__
if functions is None:
utils = salt.loader.utils(opts)
functions = salt.loader.minion_mods(opts, utils=utils)
comps = tgt.split(':')
if len... | python | def match(tgt, functions=None, opts=None):
'''
Match based on the local data store on the minion
'''
if not opts:
opts = __opts__
if functions is None:
utils = salt.loader.utils(opts)
functions = salt.loader.minion_mods(opts, utils=utils)
comps = tgt.split(':')
if len... | [
"def",
"match",
"(",
"tgt",
",",
"functions",
"=",
"None",
",",
"opts",
"=",
"None",
")",
":",
"if",
"not",
"opts",
":",
"opts",
"=",
"__opts__",
"if",
"functions",
"is",
"None",
":",
"utils",
"=",
"salt",
".",
"loader",
".",
"utils",
"(",
"opts",
... | Match based on the local data store on the minion | [
"Match",
"based",
"on",
"the",
"local",
"data",
"store",
"on",
"the",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/matchers/data_match.py#L19-L48 | train |
saltstack/salt | salt/states/glance.py | _find_image | def _find_image(name):
'''
Tries to find image with given name, returns
- image, 'Found image <name>'
- None, 'No such image found'
- False, 'Found more than one image with given name'
'''
try:
images = __salt__['glance.image_list'](name=name)
except kstone_Unauthoriz... | python | def _find_image(name):
'''
Tries to find image with given name, returns
- image, 'Found image <name>'
- None, 'No such image found'
- False, 'Found more than one image with given name'
'''
try:
images = __salt__['glance.image_list'](name=name)
except kstone_Unauthoriz... | [
"def",
"_find_image",
"(",
"name",
")",
":",
"try",
":",
"images",
"=",
"__salt__",
"[",
"'glance.image_list'",
"]",
"(",
"name",
"=",
"name",
")",
"except",
"kstone_Unauthorized",
":",
"return",
"False",
",",
"'keystoneclient: Unauthorized'",
"except",
"glance_... | Tries to find image with given name, returns
- image, 'Found image <name>'
- None, 'No such image found'
- False, 'Found more than one image with given name' | [
"Tries",
"to",
"find",
"image",
"with",
"given",
"name",
"returns",
"-",
"image",
"Found",
"image",
"<name",
">",
"-",
"None",
"No",
"such",
"image",
"found",
"-",
"False",
"Found",
"more",
"than",
"one",
"image",
"with",
"given",
"name"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glance.py#L43-L70 | train |
saltstack/salt | salt/states/glance.py | image_present | def image_present(name, visibility='public', protected=None,
checksum=None, location=None, disk_format='raw', wait_for=None,
timeout=30):
'''
Checks if given image is present with properties
set as specified.
An image should got through the stages 'queued', 'saving'
before becoming ... | python | def image_present(name, visibility='public', protected=None,
checksum=None, location=None, disk_format='raw', wait_for=None,
timeout=30):
'''
Checks if given image is present with properties
set as specified.
An image should got through the stages 'queued', 'saving'
before becoming ... | [
"def",
"image_present",
"(",
"name",
",",
"visibility",
"=",
"'public'",
",",
"protected",
"=",
"None",
",",
"checksum",
"=",
"None",
",",
"location",
"=",
"None",
",",
"disk_format",
"=",
"'raw'",
",",
"wait_for",
"=",
"None",
",",
"timeout",
"=",
"30",... | Checks if given image is present with properties
set as specified.
An image should got through the stages 'queued', 'saving'
before becoming 'active'. The attribute 'checksum' can
only be checked once the image is active.
If you don't specify 'wait_for' but 'checksum' the function
will wait for... | [
"Checks",
"if",
"given",
"image",
"is",
"present",
"with",
"properties",
"set",
"as",
"specified",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glance.py#L73-L250 | train |
saltstack/salt | salt/returners/cassandra_cql_return.py | returner | def returner(ret):
'''
Return data to one of potentially many clustered cassandra nodes
'''
query = '''INSERT INTO {keyspace}.salt_returns (
jid, minion_id, fun, alter_time, full_ret, return, success
) VALUES (?, ?, ?, ?, ?, ?, ?)'''.format(keyspace=_get_keyspace())
... | python | def returner(ret):
'''
Return data to one of potentially many clustered cassandra nodes
'''
query = '''INSERT INTO {keyspace}.salt_returns (
jid, minion_id, fun, alter_time, full_ret, return, success
) VALUES (?, ?, ?, ?, ?, ?, ?)'''.format(keyspace=_get_keyspace())
... | [
"def",
"returner",
"(",
"ret",
")",
":",
"query",
"=",
"'''INSERT INTO {keyspace}.salt_returns (\n jid, minion_id, fun, alter_time, full_ret, return, success\n ) VALUES (?, ?, ?, ?, ?, ?, ?)'''",
".",
"format",
"(",
"keyspace",
"=",
"_get_keyspace",
"(",
... | Return data to one of potentially many clustered cassandra nodes | [
"Return",
"data",
"to",
"one",
"of",
"potentially",
"many",
"clustered",
"cassandra",
"nodes"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/cassandra_cql_return.py#L192-L243 | train |
saltstack/salt | salt/returners/cassandra_cql_return.py | event_return | def event_return(events):
'''
Return event to one of potentially many clustered cassandra nodes
Requires that configuration be enabled via 'event_return'
option in master config.
Cassandra does not support an auto-increment feature due to the
highly inefficient nature of creating a monotonical... | python | def event_return(events):
'''
Return event to one of potentially many clustered cassandra nodes
Requires that configuration be enabled via 'event_return'
option in master config.
Cassandra does not support an auto-increment feature due to the
highly inefficient nature of creating a monotonical... | [
"def",
"event_return",
"(",
"events",
")",
":",
"for",
"event",
"in",
"events",
":",
"tag",
"=",
"event",
".",
"get",
"(",
"'tag'",
",",
"''",
")",
"data",
"=",
"event",
".",
"get",
"(",
"'data'",
",",
"''",
")",
"query",
"=",
"'''INSERT INTO {keyspa... | Return event to one of potentially many clustered cassandra nodes
Requires that configuration be enabled via 'event_return'
option in master config.
Cassandra does not support an auto-increment feature due to the
highly inefficient nature of creating a monotonically increasing
number across all no... | [
"Return",
"event",
"to",
"one",
"of",
"potentially",
"many",
"clustered",
"cassandra",
"nodes"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/cassandra_cql_return.py#L246-L283 | train |
saltstack/salt | salt/returners/cassandra_cql_return.py | save_load | def save_load(jid, load, minions=None):
'''
Save the load to the specified jid id
'''
# Load is being stored as a text datatype. Single quotes are used in the
# VALUES list. Therefore, all single quotes contained in the results from
# salt.utils.json.dumps(load) must be escaped Cassandra style.
... | python | def save_load(jid, load, minions=None):
'''
Save the load to the specified jid id
'''
# Load is being stored as a text datatype. Single quotes are used in the
# VALUES list. Therefore, all single quotes contained in the results from
# salt.utils.json.dumps(load) must be escaped Cassandra style.
... | [
"def",
"save_load",
"(",
"jid",
",",
"load",
",",
"minions",
"=",
"None",
")",
":",
"# Load is being stored as a text datatype. Single quotes are used in the",
"# VALUES list. Therefore, all single quotes contained in the results from",
"# salt.utils.json.dumps(load) must be escaped Cass... | Save the load to the specified jid id | [
"Save",
"the",
"load",
"to",
"the",
"specified",
"jid",
"id"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/cassandra_cql_return.py#L286-L312 | train |
saltstack/salt | salt/returners/cassandra_cql_return.py | get_jid | def get_jid(jid):
'''
Return the information returned when the specified job id was executed
'''
query = '''SELECT minion_id, full_ret FROM {keyspace}.salt_returns
WHERE jid = ?;'''.format(keyspace=_get_keyspace())
ret = {}
# cassandra_cql.cql_query may raise a CommandExecutionE... | python | def get_jid(jid):
'''
Return the information returned when the specified job id was executed
'''
query = '''SELECT minion_id, full_ret FROM {keyspace}.salt_returns
WHERE jid = ?;'''.format(keyspace=_get_keyspace())
ret = {}
# cassandra_cql.cql_query may raise a CommandExecutionE... | [
"def",
"get_jid",
"(",
"jid",
")",
":",
"query",
"=",
"'''SELECT minion_id, full_ret FROM {keyspace}.salt_returns\n WHERE jid = ?;'''",
".",
"format",
"(",
"keyspace",
"=",
"_get_keyspace",
"(",
")",
")",
"ret",
"=",
"{",
"}",
"# cassandra_cql.cql_query may ... | Return the information returned when the specified job id was executed | [
"Return",
"the",
"information",
"returned",
"when",
"the",
"specified",
"job",
"id",
"was",
"executed"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/cassandra_cql_return.py#L350-L376 | train |
saltstack/salt | salt/returners/cassandra_cql_return.py | get_fun | def get_fun(fun):
'''
Return a dict of the last function called for all minions
'''
query = '''SELECT minion_id, last_fun FROM {keyspace}.minions
WHERE last_fun = ?;'''.format(keyspace=_get_keyspace())
ret = {}
# cassandra_cql.cql_query may raise a CommandExecutionError
try:... | python | def get_fun(fun):
'''
Return a dict of the last function called for all minions
'''
query = '''SELECT minion_id, last_fun FROM {keyspace}.minions
WHERE last_fun = ?;'''.format(keyspace=_get_keyspace())
ret = {}
# cassandra_cql.cql_query may raise a CommandExecutionError
try:... | [
"def",
"get_fun",
"(",
"fun",
")",
":",
"query",
"=",
"'''SELECT minion_id, last_fun FROM {keyspace}.minions\n WHERE last_fun = ?;'''",
".",
"format",
"(",
"keyspace",
"=",
"_get_keyspace",
"(",
")",
")",
"ret",
"=",
"{",
"}",
"# cassandra_cql.cql_query may ... | Return a dict of the last function called for all minions | [
"Return",
"a",
"dict",
"of",
"the",
"last",
"function",
"called",
"for",
"all",
"minions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/cassandra_cql_return.py#L380-L406 | train |
saltstack/salt | salt/returners/cassandra_cql_return.py | get_jids | def get_jids():
'''
Return a list of all job ids
'''
query = '''SELECT jid, load FROM {keyspace}.jids;'''.format(keyspace=_get_keyspace())
ret = {}
# cassandra_cql.cql_query may raise a CommandExecutionError
try:
data = __salt__['cassandra_cql.cql_query'](query)
if data:
... | python | def get_jids():
'''
Return a list of all job ids
'''
query = '''SELECT jid, load FROM {keyspace}.jids;'''.format(keyspace=_get_keyspace())
ret = {}
# cassandra_cql.cql_query may raise a CommandExecutionError
try:
data = __salt__['cassandra_cql.cql_query'](query)
if data:
... | [
"def",
"get_jids",
"(",
")",
":",
"query",
"=",
"'''SELECT jid, load FROM {keyspace}.jids;'''",
".",
"format",
"(",
"keyspace",
"=",
"_get_keyspace",
"(",
")",
")",
"ret",
"=",
"{",
"}",
"# cassandra_cql.cql_query may raise a CommandExecutionError",
"try",
":",
"data"... | Return a list of all job ids | [
"Return",
"a",
"list",
"of",
"all",
"job",
"ids"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/cassandra_cql_return.py#L410-L437 | train |
saltstack/salt | salt/returners/cassandra_cql_return.py | get_minions | def get_minions():
'''
Return a list of minions
'''
query = '''SELECT DISTINCT minion_id
FROM {keyspace}.minions;'''.format(keyspace=_get_keyspace())
ret = []
# cassandra_cql.cql_query may raise a CommandExecutionError
try:
data = __salt__['cassandra_cql.cql_query'](... | python | def get_minions():
'''
Return a list of minions
'''
query = '''SELECT DISTINCT minion_id
FROM {keyspace}.minions;'''.format(keyspace=_get_keyspace())
ret = []
# cassandra_cql.cql_query may raise a CommandExecutionError
try:
data = __salt__['cassandra_cql.cql_query'](... | [
"def",
"get_minions",
"(",
")",
":",
"query",
"=",
"'''SELECT DISTINCT minion_id\n FROM {keyspace}.minions;'''",
".",
"format",
"(",
"keyspace",
"=",
"_get_keyspace",
"(",
")",
")",
"ret",
"=",
"[",
"]",
"# cassandra_cql.cql_query may raise a CommandExecutionE... | Return a list of minions | [
"Return",
"a",
"list",
"of",
"minions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/cassandra_cql_return.py#L441-L466 | train |
saltstack/salt | salt/output/json_out.py | output | def output(data, **kwargs): # pylint: disable=unused-argument
'''
Print the output data in JSON
'''
try:
if 'output_indent' not in __opts__:
return salt.utils.json.dumps(data, default=repr, indent=4)
indent = __opts__.get('output_indent')
sort_keys = False
... | python | def output(data, **kwargs): # pylint: disable=unused-argument
'''
Print the output data in JSON
'''
try:
if 'output_indent' not in __opts__:
return salt.utils.json.dumps(data, default=repr, indent=4)
indent = __opts__.get('output_indent')
sort_keys = False
... | [
"def",
"output",
"(",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"try",
":",
"if",
"'output_indent'",
"not",
"in",
"__opts__",
":",
"return",
"salt",
".",
"utils",
".",
"json",
".",
"dumps",
"(",
"data",
",",
"default",... | Print the output data in JSON | [
"Print",
"the",
"output",
"data",
"in",
"JSON"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/json_out.py#L56-L92 | train |
saltstack/salt | salt/states/mssql_role.py | present | def present(name, owner=None, grants=None, **kwargs):
'''
Ensure that the named database is present with the specified options
name
The name of the database to manage
owner
Adds owner using AUTHORIZATION option
Grants
Can only be a list of strings
'''
ret = {'name': ... | python | def present(name, owner=None, grants=None, **kwargs):
'''
Ensure that the named database is present with the specified options
name
The name of the database to manage
owner
Adds owner using AUTHORIZATION option
Grants
Can only be a list of strings
'''
ret = {'name': ... | [
"def",
"present",
"(",
"name",
",",
"owner",
"=",
"None",
",",
"grants",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",... | Ensure that the named database is present with the specified options
name
The name of the database to manage
owner
Adds owner using AUTHORIZATION option
Grants
Can only be a list of strings | [
"Ensure",
"that",
"the",
"named",
"database",
"is",
"present",
"with",
"the",
"specified",
"options"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mssql_role.py#L24-L55 | train |
saltstack/salt | salt/modules/servicenow.py | set_change_request_state | def set_change_request_state(change_id, state='approved'):
'''
Set the approval state of a change request/record
:param change_id: The ID of the change request, e.g. CHG123545
:type change_id: ``str``
:param state: The target state, e.g. approved
:type state: ``str``
CLI Example:
.... | python | def set_change_request_state(change_id, state='approved'):
'''
Set the approval state of a change request/record
:param change_id: The ID of the change request, e.g. CHG123545
:type change_id: ``str``
:param state: The target state, e.g. approved
:type state: ``str``
CLI Example:
.... | [
"def",
"set_change_request_state",
"(",
"change_id",
",",
"state",
"=",
"'approved'",
")",
":",
"client",
"=",
"_get_client",
"(",
")",
"client",
".",
"table",
"=",
"'change_request'",
"# Get the change record first",
"record",
"=",
"client",
".",
"get",
"(",
"{... | Set the approval state of a change request/record
:param change_id: The ID of the change request, e.g. CHG123545
:type change_id: ``str``
:param state: The target state, e.g. approved
:type state: ``str``
CLI Example:
.. code-block:: bash
salt myminion servicenow.set_change_reques... | [
"Set",
"the",
"approval",
"state",
"of",
"a",
"change",
"request",
"/",
"record"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/servicenow.py#L61-L88 | train |
saltstack/salt | salt/modules/servicenow.py | delete_record | def delete_record(table, sys_id):
'''
Delete an existing record
:param table: The table name, e.g. sys_user
:type table: ``str``
:param sys_id: The unique ID of the record
:type sys_id: ``str``
CLI Example:
.. code-block:: bash
salt myminion servicenow.delete_record sys_co... | python | def delete_record(table, sys_id):
'''
Delete an existing record
:param table: The table name, e.g. sys_user
:type table: ``str``
:param sys_id: The unique ID of the record
:type sys_id: ``str``
CLI Example:
.. code-block:: bash
salt myminion servicenow.delete_record sys_co... | [
"def",
"delete_record",
"(",
"table",
",",
"sys_id",
")",
":",
"client",
"=",
"_get_client",
"(",
")",
"client",
".",
"table",
"=",
"table",
"response",
"=",
"client",
".",
"delete",
"(",
"sys_id",
")",
"return",
"response"
] | Delete an existing record
:param table: The table name, e.g. sys_user
:type table: ``str``
:param sys_id: The unique ID of the record
:type sys_id: ``str``
CLI Example:
.. code-block:: bash
salt myminion servicenow.delete_record sys_computer 2134566 | [
"Delete",
"an",
"existing",
"record"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/servicenow.py#L91-L110 | train |
saltstack/salt | salt/modules/servicenow.py | non_structured_query | def non_structured_query(table, query=None, **kwargs):
'''
Run a non-structed (not a dict) query on a servicenow table.
See http://wiki.servicenow.com/index.php?title=Encoded_Query_Strings#gsc.tab=0
for help on constructing a non-structured query string.
:param table: The table name, e.g. sys_user
... | python | def non_structured_query(table, query=None, **kwargs):
'''
Run a non-structed (not a dict) query on a servicenow table.
See http://wiki.servicenow.com/index.php?title=Encoded_Query_Strings#gsc.tab=0
for help on constructing a non-structured query string.
:param table: The table name, e.g. sys_user
... | [
"def",
"non_structured_query",
"(",
"table",
",",
"query",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"_get_client",
"(",
")",
"client",
".",
"table",
"=",
"table",
"# underlying lib doesn't use six or past.basestring,",
"# does isinstance(x, str... | Run a non-structed (not a dict) query on a servicenow table.
See http://wiki.servicenow.com/index.php?title=Encoded_Query_Strings#gsc.tab=0
for help on constructing a non-structured query string.
:param table: The table name, e.g. sys_user
:type table: ``str``
:param query: The query to run (or u... | [
"Run",
"a",
"non",
"-",
"structed",
"(",
"not",
"a",
"dict",
")",
"query",
"on",
"a",
"servicenow",
"table",
".",
"See",
"http",
":",
"//",
"wiki",
".",
"servicenow",
".",
"com",
"/",
"index",
".",
"php?title",
"=",
"Encoded_Query_Strings#gsc",
".",
"t... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/servicenow.py#L113-L145 | train |
saltstack/salt | salt/modules/servicenow.py | update_record_field | def update_record_field(table, sys_id, field, value):
'''
Update the value of a record's field in a servicenow table
:param table: The table name, e.g. sys_user
:type table: ``str``
:param sys_id: The unique ID of the record
:type sys_id: ``str``
:param field: The new value
:type f... | python | def update_record_field(table, sys_id, field, value):
'''
Update the value of a record's field in a servicenow table
:param table: The table name, e.g. sys_user
:type table: ``str``
:param sys_id: The unique ID of the record
:type sys_id: ``str``
:param field: The new value
:type f... | [
"def",
"update_record_field",
"(",
"table",
",",
"sys_id",
",",
"field",
",",
"value",
")",
":",
"client",
"=",
"_get_client",
"(",
")",
"client",
".",
"table",
"=",
"table",
"response",
"=",
"client",
".",
"update",
"(",
"{",
"field",
":",
"value",
"}... | Update the value of a record's field in a servicenow table
:param table: The table name, e.g. sys_user
:type table: ``str``
:param sys_id: The unique ID of the record
:type sys_id: ``str``
:param field: The new value
:type field: ``str``
:param value: The new value
:type value: `... | [
"Update",
"the",
"value",
"of",
"a",
"record",
"s",
"field",
"in",
"a",
"servicenow",
"table"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/servicenow.py#L148-L173 | train |
saltstack/salt | salt/states/cabal.py | _parse_pkg_string | def _parse_pkg_string(pkg):
'''
Parse pkg string and return a tuple of package name, separator, and
package version.
Cabal support install package with following format:
* foo-1.0
* foo < 1.2
* foo > 1.3
For the sake of simplicity only the first form is supported,
support for othe... | python | def _parse_pkg_string(pkg):
'''
Parse pkg string and return a tuple of package name, separator, and
package version.
Cabal support install package with following format:
* foo-1.0
* foo < 1.2
* foo > 1.3
For the sake of simplicity only the first form is supported,
support for othe... | [
"def",
"_parse_pkg_string",
"(",
"pkg",
")",
":",
"pkg_name",
",",
"separator",
",",
"pkg_ver",
"=",
"pkg",
".",
"partition",
"(",
"'-'",
")",
"return",
"(",
"pkg_name",
".",
"strip",
"(",
")",
",",
"separator",
",",
"pkg_ver",
".",
"strip",
"(",
")",
... | Parse pkg string and return a tuple of package name, separator, and
package version.
Cabal support install package with following format:
* foo-1.0
* foo < 1.2
* foo > 1.3
For the sake of simplicity only the first form is supported,
support for other forms can be added later. | [
"Parse",
"pkg",
"string",
"and",
"return",
"a",
"tuple",
"of",
"package",
"name",
"separator",
"and",
"package",
"version",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cabal.py#L40-L55 | train |
saltstack/salt | salt/states/cabal.py | installed | def installed(name,
pkgs=None,
user=None,
install_global=False,
env=None):
'''
Verify that the given package is installed and is at the correct version
(if specified).
.. code-block:: yaml
ShellCheck-0.3.5:
cabal:
- ... | python | def installed(name,
pkgs=None,
user=None,
install_global=False,
env=None):
'''
Verify that the given package is installed and is at the correct version
(if specified).
.. code-block:: yaml
ShellCheck-0.3.5:
cabal:
- ... | [
"def",
"installed",
"(",
"name",
",",
"pkgs",
"=",
"None",
",",
"user",
"=",
"None",
",",
"install_global",
"=",
"False",
",",
"env",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"None",
",",
"'comment'",
":"... | Verify that the given package is installed and is at the correct version
(if specified).
.. code-block:: yaml
ShellCheck-0.3.5:
cabal:
- installed:
name
The package to install
user
The user to run cabal install with
install_global
Install pack... | [
"Verify",
"that",
"the",
"given",
"package",
"is",
"installed",
"and",
"is",
"at",
"the",
"correct",
"version",
"(",
"if",
"specified",
")",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cabal.py#L58-L169 | train |
saltstack/salt | salt/states/cabal.py | removed | def removed(name,
user=None,
env=None):
'''
Verify that given package is not installed.
'''
ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}
try:
installed_pkgs = __salt__['cabal.list'](
user=user, installed=True, env=env)
except (C... | python | def removed(name,
user=None,
env=None):
'''
Verify that given package is not installed.
'''
ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}
try:
installed_pkgs = __salt__['cabal.list'](
user=user, installed=True, env=env)
except (C... | [
"def",
"removed",
"(",
"name",
",",
"user",
"=",
"None",
",",
"env",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"try",
":",
"in... | Verify that given package is not installed. | [
"Verify",
"that",
"given",
"package",
"is",
"not",
"installed",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cabal.py#L172-L206 | train |
saltstack/salt | salt/beacons/service.py | beacon | def beacon(config):
'''
Scan for the configured services and fire events
Example Config
.. code-block:: yaml
beacons:
service:
- services:
salt-master: {}
mysql: {}
The config above sets up beacons to check for
the salt-master and... | python | def beacon(config):
'''
Scan for the configured services and fire events
Example Config
.. code-block:: yaml
beacons:
service:
- services:
salt-master: {}
mysql: {}
The config above sets up beacons to check for
the salt-master and... | [
"def",
"beacon",
"(",
"config",
")",
":",
"ret",
"=",
"[",
"]",
"_config",
"=",
"{",
"}",
"list",
"(",
"map",
"(",
"_config",
".",
"update",
",",
"config",
")",
")",
"for",
"service",
"in",
"_config",
".",
"get",
"(",
"'services'",
",",
"{",
"}",... | Scan for the configured services and fire events
Example Config
.. code-block:: yaml
beacons:
service:
- services:
salt-master: {}
mysql: {}
The config above sets up beacons to check for
the salt-master and mysql services.
The config... | [
"Scan",
"for",
"the",
"configured",
"services",
"and",
"fire",
"events"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/service.py#L44-L164 | train |
saltstack/salt | salt/modules/jira_mod.py | _get_credentials | def _get_credentials(server=None,
username=None,
password=None):
'''
Returns the credentials merged with the config data (opts + pillar).
'''
jira_cfg = __salt__['config.merge']('jira', default={})
if not server:
server = jira_cfg.get('server')
i... | python | def _get_credentials(server=None,
username=None,
password=None):
'''
Returns the credentials merged with the config data (opts + pillar).
'''
jira_cfg = __salt__['config.merge']('jira', default={})
if not server:
server = jira_cfg.get('server')
i... | [
"def",
"_get_credentials",
"(",
"server",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"jira_cfg",
"=",
"__salt__",
"[",
"'config.merge'",
"]",
"(",
"'jira'",
",",
"default",
"=",
"{",
"}",
")",
"if",
"not",
"serve... | Returns the credentials merged with the config data (opts + pillar). | [
"Returns",
"the",
"credentials",
"merged",
"with",
"the",
"config",
"data",
"(",
"opts",
"+",
"pillar",
")",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jira_mod.py#L50-L63 | train |
saltstack/salt | salt/modules/jira_mod.py | create_issue | def create_issue(project,
summary,
description,
template_engine='jinja',
context=None,
defaults=None,
saltenv='base',
issuetype='Bug',
priority='Normal',
labels=None,
... | python | def create_issue(project,
summary,
description,
template_engine='jinja',
context=None,
defaults=None,
saltenv='base',
issuetype='Bug',
priority='Normal',
labels=None,
... | [
"def",
"create_issue",
"(",
"project",
",",
"summary",
",",
"description",
",",
"template_engine",
"=",
"'jinja'",
",",
"context",
"=",
"None",
",",
"defaults",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
",",
"issuetype",
"=",
"'Bug'",
",",
"priority",
"=... | Create a JIRA issue using the named settings. Return the JIRA ticket ID.
project
The name of the project to attach the JIRA ticket to.
summary
The summary (title) of the JIRA ticket. When the ``template_engine``
argument is set to a proper value of an existing Salt template engine
... | [
"Create",
"a",
"JIRA",
"issue",
"using",
"the",
"named",
"settings",
".",
"Return",
"the",
"JIRA",
"ticket",
"ID",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jira_mod.py#L80-L183 | train |
saltstack/salt | salt/modules/jira_mod.py | assign_issue | def assign_issue(issue_key,
assignee,
server=None,
username=None,
password=None):
'''
Assign the issue to an existing user. Return ``True`` when the issue has
been properly assigned.
issue_key
The JIRA ID of the ticket to manip... | python | def assign_issue(issue_key,
assignee,
server=None,
username=None,
password=None):
'''
Assign the issue to an existing user. Return ``True`` when the issue has
been properly assigned.
issue_key
The JIRA ID of the ticket to manip... | [
"def",
"assign_issue",
"(",
"issue_key",
",",
"assignee",
",",
"server",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"jira_",
"=",
"_get_jira",
"(",
"server",
"=",
"server",
",",
"username",
"=",
"username",
",",
... | Assign the issue to an existing user. Return ``True`` when the issue has
been properly assigned.
issue_key
The JIRA ID of the ticket to manipulate.
assignee
The name of the user to assign the ticket to.
CLI Example:
salt '*' jira.assign_issue NET-123 example_user | [
"Assign",
"the",
"issue",
"to",
"an",
"existing",
"user",
".",
"Return",
"True",
"when",
"the",
"issue",
"has",
"been",
"properly",
"assigned",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jira_mod.py#L186-L209 | train |
saltstack/salt | salt/modules/jira_mod.py | add_comment | def add_comment(issue_key,
comment,
visibility=None,
is_internal=False,
server=None,
username=None,
password=None):
'''
Add a comment to an existing ticket. Return ``True`` when it successfully
added the comment.... | python | def add_comment(issue_key,
comment,
visibility=None,
is_internal=False,
server=None,
username=None,
password=None):
'''
Add a comment to an existing ticket. Return ``True`` when it successfully
added the comment.... | [
"def",
"add_comment",
"(",
"issue_key",
",",
"comment",
",",
"visibility",
"=",
"None",
",",
"is_internal",
"=",
"False",
",",
"server",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"jira_",
"=",
"_get_jira",
"(",
... | Add a comment to an existing ticket. Return ``True`` when it successfully
added the comment.
issue_key
The issue ID to add the comment to.
comment
The body of the comment to be added.
visibility: ``None``
A dictionary having two keys:
- ``type``: is ``role`` (or ``gro... | [
"Add",
"a",
"comment",
"to",
"an",
"existing",
"ticket",
".",
"Return",
"True",
"when",
"it",
"successfully",
"added",
"the",
"comment",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jira_mod.py#L212-L253 | train |
saltstack/salt | salt/modules/jira_mod.py | issue_closed | def issue_closed(issue_key,
server=None,
username=None,
password=None):
'''
Check if the issue is closed.
issue_key
The JIRA iD of the ticket to close.
Returns:
- ``True``: the ticket exists and it is closed.
- ``False``: the ticket e... | python | def issue_closed(issue_key,
server=None,
username=None,
password=None):
'''
Check if the issue is closed.
issue_key
The JIRA iD of the ticket to close.
Returns:
- ``True``: the ticket exists and it is closed.
- ``False``: the ticket e... | [
"def",
"issue_closed",
"(",
"issue_key",
",",
"server",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"if",
"not",
"issue_key",
":",
"return",
"None",
"jira_",
"=",
"_get_jira",
"(",
"server",
"=",
"server",
",",
"u... | Check if the issue is closed.
issue_key
The JIRA iD of the ticket to close.
Returns:
- ``True``: the ticket exists and it is closed.
- ``False``: the ticket exists and it has not been closed.
- ``None``: the ticket does not exist.
CLI Example:
.. code-block:: bash
salt ... | [
"Check",
"if",
"the",
"issue",
"is",
"closed",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jira_mod.py#L256-L288 | train |
saltstack/salt | salt/grains/junos.py | _remove_complex_types | def _remove_complex_types(dictionary):
'''
Linode-python is now returning some complex types that
are not serializable by msgpack. Kill those.
'''
for k, v in six.iteritems(dictionary):
if isinstance(v, dict):
dictionary[k] = _remove_complex_types(v)
elif hasattr(v, 'to_... | python | def _remove_complex_types(dictionary):
'''
Linode-python is now returning some complex types that
are not serializable by msgpack. Kill those.
'''
for k, v in six.iteritems(dictionary):
if isinstance(v, dict):
dictionary[k] = _remove_complex_types(v)
elif hasattr(v, 'to_... | [
"def",
"_remove_complex_types",
"(",
"dictionary",
")",
":",
"for",
"k",
",",
"v",
"in",
"six",
".",
"iteritems",
"(",
"dictionary",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"dict",
")",
":",
"dictionary",
"[",
"k",
"]",
"=",
"_remove_complex_types",... | Linode-python is now returning some complex types that
are not serializable by msgpack. Kill those. | [
"Linode",
"-",
"python",
"is",
"now",
"returning",
"some",
"complex",
"types",
"that",
"are",
"not",
"serializable",
"by",
"msgpack",
".",
"Kill",
"those",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/junos.py#L30-L41 | train |
saltstack/salt | salt/states/module.py | run | def run(**kwargs):
'''
Run a single module function or a range of module functions in a batch.
Supersedes ``module.run`` function, which requires ``m_`` prefix to
function-specific parameters.
:param returner:
Specify a common returner for the whole batch to send the return data
:param... | python | def run(**kwargs):
'''
Run a single module function or a range of module functions in a batch.
Supersedes ``module.run`` function, which requires ``m_`` prefix to
function-specific parameters.
:param returner:
Specify a common returner for the whole batch to send the return data
:param... | [
"def",
"run",
"(",
"*",
"*",
"kwargs",
")",
":",
"if",
"'name'",
"in",
"kwargs",
":",
"kwargs",
".",
"pop",
"(",
"'name'",
")",
"ret",
"=",
"{",
"'name'",
":",
"list",
"(",
"kwargs",
")",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
... | Run a single module function or a range of module functions in a batch.
Supersedes ``module.run`` function, which requires ``m_`` prefix to
function-specific parameters.
:param returner:
Specify a common returner for the whole batch to send the return data
:param kwargs:
Pass any argum... | [
"Run",
"a",
"single",
"module",
"function",
"or",
"a",
"range",
"of",
"module",
"functions",
"in",
"a",
"batch",
".",
"Supersedes",
"module",
".",
"run",
"function",
"which",
"requires",
"m_",
"prefix",
"to",
"function",
"-",
"specific",
"parameters",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/module.py#L350-L436 | train |
saltstack/salt | salt/states/module.py | _call_function | def _call_function(name, returner=None, **kwargs):
'''
Calls a function from the specified module.
:param name:
:param kwargs:
:return:
'''
argspec = salt.utils.args.get_function_argspec(__salt__[name])
# func_kw is initialized to a dictionary of keyword arguments the function to be ru... | python | def _call_function(name, returner=None, **kwargs):
'''
Calls a function from the specified module.
:param name:
:param kwargs:
:return:
'''
argspec = salt.utils.args.get_function_argspec(__salt__[name])
# func_kw is initialized to a dictionary of keyword arguments the function to be ru... | [
"def",
"_call_function",
"(",
"name",
",",
"returner",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"argspec",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"get_function_argspec",
"(",
"__salt__",
"[",
"name",
"]",
")",
"# func_kw is initialized to a dict... | Calls a function from the specified module.
:param name:
:param kwargs:
:return: | [
"Calls",
"a",
"function",
"from",
"the",
"specified",
"module",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/module.py#L439-L496 | train |
saltstack/salt | salt/states/module.py | _run | def _run(name, **kwargs):
'''
.. deprecated:: 2017.7.0
Function name stays the same, behaviour will change.
Run a single module function
``name``
The module function to execute
``returner``
Specify the returner to send the return of the module execution to
``kwargs``
... | python | def _run(name, **kwargs):
'''
.. deprecated:: 2017.7.0
Function name stays the same, behaviour will change.
Run a single module function
``name``
The module function to execute
``returner``
Specify the returner to send the return of the module execution to
``kwargs``
... | [
"def",
"_run",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
",",
"'result'",
":",
"None",
"}",
"if",
"name",
"not",
"in",
"__salt__",
":",
... | .. deprecated:: 2017.7.0
Function name stays the same, behaviour will change.
Run a single module function
``name``
The module function to execute
``returner``
Specify the returner to send the return of the module execution to
``kwargs``
Pass any arguments needed to ex... | [
"..",
"deprecated",
"::",
"2017",
".",
"7",
".",
"0",
"Function",
"name",
"stays",
"the",
"same",
"behaviour",
"will",
"change",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/module.py#L499-L647 | train |
saltstack/salt | salt/matchers/list_match.py | match | def match(tgt, opts=None):
'''
Determines if this host is on the list
'''
if not opts:
opts = __opts__
try:
if ',' + opts['id'] + ',' in tgt \
or tgt.startswith(opts['id'] + ',') \
or tgt.endswith(',' + opts['id']):
return True
# t... | python | def match(tgt, opts=None):
'''
Determines if this host is on the list
'''
if not opts:
opts = __opts__
try:
if ',' + opts['id'] + ',' in tgt \
or tgt.startswith(opts['id'] + ',') \
or tgt.endswith(',' + opts['id']):
return True
# t... | [
"def",
"match",
"(",
"tgt",
",",
"opts",
"=",
"None",
")",
":",
"if",
"not",
"opts",
":",
"opts",
"=",
"__opts__",
"try",
":",
"if",
"','",
"+",
"opts",
"[",
"'id'",
"]",
"+",
"','",
"in",
"tgt",
"or",
"tgt",
".",
"startswith",
"(",
"opts",
"["... | Determines if this host is on the list | [
"Determines",
"if",
"this",
"host",
"is",
"on",
"the",
"list"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/matchers/list_match.py#L11-L42 | train |
saltstack/salt | salt/modules/influxdb08mod.py | db_list | def db_list(user=None, password=None, host=None, port=None):
'''
List all InfluxDB databases
user
The user to connect as
password
The password of the user
host
The host to connect to
port
The port to connect to
CLI Example:
.. code-block:: bash
... | python | def db_list(user=None, password=None, host=None, port=None):
'''
List all InfluxDB databases
user
The user to connect as
password
The password of the user
host
The host to connect to
port
The port to connect to
CLI Example:
.. code-block:: bash
... | [
"def",
"db_list",
"(",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
")",
":",
"client",
"=",
"_client",
"(",
"user",
"=",
"user",
",",
"password",
"=",
"password",
",",
"host",
"=",
"host",
... | List all InfluxDB databases
user
The user to connect as
password
The password of the user
host
The host to connect to
port
The port to connect to
CLI Example:
.. code-block:: bash
salt '*' influxdb08.db_list
salt '*' influxdb08.db_list <user... | [
"List",
"all",
"InfluxDB",
"databases"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L65-L90 | train |
saltstack/salt | salt/modules/influxdb08mod.py | db_exists | def db_exists(name, user=None, password=None, host=None, port=None):
'''
Checks if a database exists in Influxdb
name
Database name to create
user
The user to connect as
password
The password of the user
host
The host to connect to
port
The port t... | python | def db_exists(name, user=None, password=None, host=None, port=None):
'''
Checks if a database exists in Influxdb
name
Database name to create
user
The user to connect as
password
The password of the user
host
The host to connect to
port
The port t... | [
"def",
"db_exists",
"(",
"name",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
")",
":",
"dbs",
"=",
"db_list",
"(",
"user",
",",
"password",
",",
"host",
",",
"port",
")",
"if",
"not"... | Checks if a database exists in Influxdb
name
Database name to create
user
The user to connect as
password
The password of the user
host
The host to connect to
port
The port to connect to
CLI Example:
.. code-block:: bash
salt '*' influx... | [
"Checks",
"if",
"a",
"database",
"exists",
"in",
"Influxdb"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L93-L122 | train |
saltstack/salt | salt/modules/influxdb08mod.py | db_create | def db_create(name, user=None, password=None, host=None, port=None):
'''
Create a database
name
Database name to create
user
The user to connect as
password
The password of the user
host
The host to connect to
port
The port to connect to
CLI ... | python | def db_create(name, user=None, password=None, host=None, port=None):
'''
Create a database
name
Database name to create
user
The user to connect as
password
The password of the user
host
The host to connect to
port
The port to connect to
CLI ... | [
"def",
"db_create",
"(",
"name",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
")",
":",
"if",
"db_exists",
"(",
"name",
",",
"user",
",",
"password",
",",
"host",
",",
"port",
")",
":... | Create a database
name
Database name to create
user
The user to connect as
password
The password of the user
host
The host to connect to
port
The port to connect to
CLI Example:
.. code-block:: bash
salt '*' influxdb08.db_create <name>
... | [
"Create",
"a",
"database"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L125-L156 | train |
saltstack/salt | salt/modules/influxdb08mod.py | db_remove | def db_remove(name, user=None, password=None, host=None, port=None):
'''
Remove a database
name
Database name to remove
user
The user to connect as
password
The password of the user
host
The host to connect to
port
The port to connect to
CLI ... | python | def db_remove(name, user=None, password=None, host=None, port=None):
'''
Remove a database
name
Database name to remove
user
The user to connect as
password
The password of the user
host
The host to connect to
port
The port to connect to
CLI ... | [
"def",
"db_remove",
"(",
"name",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
")",
":",
"if",
"not",
"db_exists",
"(",
"name",
",",
"user",
",",
"password",
",",
"host",
",",
"port",
... | Remove a database
name
Database name to remove
user
The user to connect as
password
The password of the user
host
The host to connect to
port
The port to connect to
CLI Example:
.. code-block:: bash
salt '*' influxdb08.db_remove <name>
... | [
"Remove",
"a",
"database"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L159-L189 | train |
saltstack/salt | salt/modules/influxdb08mod.py | user_list | def user_list(database=None, user=None, password=None, host=None, port=None):
'''
List cluster admins or database users.
If a database is specified: it will return database users list.
If a database is not specified: it will return cluster admins list.
database
The database to list the use... | python | def user_list(database=None, user=None, password=None, host=None, port=None):
'''
List cluster admins or database users.
If a database is specified: it will return database users list.
If a database is not specified: it will return cluster admins list.
database
The database to list the use... | [
"def",
"user_list",
"(",
"database",
"=",
"None",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
")",
":",
"client",
"=",
"_client",
"(",
"user",
"=",
"user",
",",
"password",
"=",
"passw... | List cluster admins or database users.
If a database is specified: it will return database users list.
If a database is not specified: it will return cluster admins list.
database
The database to list the users from
user
The user to connect as
password
The password of the... | [
"List",
"cluster",
"admins",
"or",
"database",
"users",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L192-L228 | train |
saltstack/salt | salt/modules/influxdb08mod.py | user_exists | def user_exists(name, database=None, user=None, password=None, host=None, port=None):
'''
Checks if a cluster admin or database user exists.
If a database is specified: it will check for database user existence.
If a database is not specified: it will check for cluster admin existence.
name
... | python | def user_exists(name, database=None, user=None, password=None, host=None, port=None):
'''
Checks if a cluster admin or database user exists.
If a database is specified: it will check for database user existence.
If a database is not specified: it will check for cluster admin existence.
name
... | [
"def",
"user_exists",
"(",
"name",
",",
"database",
"=",
"None",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
")",
":",
"users",
"=",
"user_list",
"(",
"database",
",",
"user",
",",
"pa... | Checks if a cluster admin or database user exists.
If a database is specified: it will check for database user existence.
If a database is not specified: it will check for cluster admin existence.
name
User name
database
The database to check for the user to exist
user
Th... | [
"Checks",
"if",
"a",
"cluster",
"admin",
"or",
"database",
"user",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L231-L277 | train |
saltstack/salt | salt/modules/influxdb08mod.py | user_create | def user_create(name,
passwd,
database=None,
user=None,
password=None,
host=None,
port=None):
'''
Create a cluster admin or a database user.
If a database is specified: it will create database user.
If a dat... | python | def user_create(name,
passwd,
database=None,
user=None,
password=None,
host=None,
port=None):
'''
Create a cluster admin or a database user.
If a database is specified: it will create database user.
If a dat... | [
"def",
"user_create",
"(",
"name",
",",
"passwd",
",",
"database",
"=",
"None",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
")",
":",
"if",
"user_exists",
"(",
"name",
",",
"database",
... | Create a cluster admin or a database user.
If a database is specified: it will create database user.
If a database is not specified: it will create a cluster admin.
name
User name for the new user to create
passwd
Password for the new user to create
database
The database ... | [
"Create",
"a",
"cluster",
"admin",
"or",
"a",
"database",
"user",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L280-L335 | train |
saltstack/salt | salt/modules/influxdb08mod.py | user_chpass | def user_chpass(name,
passwd,
database=None,
user=None,
password=None,
host=None,
port=None):
'''
Change password for a cluster admin or a database user.
If a database is specified: it will update database user ... | python | def user_chpass(name,
passwd,
database=None,
user=None,
password=None,
host=None,
port=None):
'''
Change password for a cluster admin or a database user.
If a database is specified: it will update database user ... | [
"def",
"user_chpass",
"(",
"name",
",",
"passwd",
",",
"database",
"=",
"None",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
")",
":",
"if",
"not",
"user_exists",
"(",
"name",
",",
"dat... | Change password for a cluster admin or a database user.
If a database is specified: it will update database user password.
If a database is not specified: it will update cluster admin password.
name
User name for whom to change the password
passwd
New password
database
Th... | [
"Change",
"password",
"for",
"a",
"cluster",
"admin",
"or",
"a",
"database",
"user",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L338-L393 | train |
saltstack/salt | salt/modules/influxdb08mod.py | user_remove | def user_remove(name,
database=None,
user=None,
password=None,
host=None,
port=None):
'''
Remove a cluster admin or a database user.
If a database is specified: it will remove the database user.
If a database is not specifi... | python | def user_remove(name,
database=None,
user=None,
password=None,
host=None,
port=None):
'''
Remove a cluster admin or a database user.
If a database is specified: it will remove the database user.
If a database is not specifi... | [
"def",
"user_remove",
"(",
"name",
",",
"database",
"=",
"None",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
")",
":",
"if",
"not",
"user_exists",
"(",
"name",
",",
"database",
",",
"u... | Remove a cluster admin or a database user.
If a database is specified: it will remove the database user.
If a database is not specified: it will remove the cluster admin.
name
User name to remove
database
The database to remove the user from
user
User name for the new use... | [
"Remove",
"a",
"cluster",
"admin",
"or",
"a",
"database",
"user",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L396-L450 | train |
saltstack/salt | salt/modules/influxdb08mod.py | retention_policy_get | def retention_policy_get(database,
name,
user=None,
password=None,
host=None,
port=None):
'''
Get an existing retention policy.
database
The database to operate on.
name... | python | def retention_policy_get(database,
name,
user=None,
password=None,
host=None,
port=None):
'''
Get an existing retention policy.
database
The database to operate on.
name... | [
"def",
"retention_policy_get",
"(",
"database",
",",
"name",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
")",
":",
"client",
"=",
"_client",
"(",
"user",
"=",
"user",
",",
"password",
"=... | Get an existing retention policy.
database
The database to operate on.
name
Name of the policy to modify.
CLI Example:
.. code-block:: bash
salt '*' influxdb08.retention_policy_get metrics default | [
"Get",
"an",
"existing",
"retention",
"policy",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L453-L480 | train |
saltstack/salt | salt/modules/influxdb08mod.py | retention_policy_exists | def retention_policy_exists(database,
name,
user=None,
password=None,
host=None,
port=None):
'''
Check if a retention policy exists.
database
The database to o... | python | def retention_policy_exists(database,
name,
user=None,
password=None,
host=None,
port=None):
'''
Check if a retention policy exists.
database
The database to o... | [
"def",
"retention_policy_exists",
"(",
"database",
",",
"name",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
")",
":",
"policy",
"=",
"retention_policy_get",
"(",
"database",
",",
"name",
","... | Check if a retention policy exists.
database
The database to operate on.
name
Name of the policy to modify.
CLI Example:
.. code-block:: bash
salt '*' influxdb08.retention_policy_exists metrics default | [
"Check",
"if",
"a",
"retention",
"policy",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L483-L505 | train |
saltstack/salt | salt/modules/influxdb08mod.py | retention_policy_add | def retention_policy_add(database,
name,
duration,
replication,
default=False,
user=None,
password=None,
host=None,
port... | python | def retention_policy_add(database,
name,
duration,
replication,
default=False,
user=None,
password=None,
host=None,
port... | [
"def",
"retention_policy_add",
"(",
"database",
",",
"name",
",",
"duration",
",",
"replication",
",",
"default",
"=",
"False",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
")",
":",
"clien... | Add a retention policy.
database
The database to operate on.
name
Name of the policy to modify.
duration
How long InfluxDB keeps the data.
replication
How many copies of the data are stored in the cluster.
default
Whether this policy should be the default... | [
"Add",
"a",
"retention",
"policy",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L508-L543 | train |
saltstack/salt | salt/modules/influxdb08mod.py | retention_policy_alter | def retention_policy_alter(database,
name,
duration,
replication,
default=False,
user=None,
password=None,
host=None,
... | python | def retention_policy_alter(database,
name,
duration,
replication,
default=False,
user=None,
password=None,
host=None,
... | [
"def",
"retention_policy_alter",
"(",
"database",
",",
"name",
",",
"duration",
",",
"replication",
",",
"default",
"=",
"False",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
")",
":",
"cli... | Modify an existing retention policy.
database
The database to operate on.
name
Name of the policy to modify.
duration
How long InfluxDB keeps the data.
replication
How many copies of the data are stored in the cluster.
default
Whether this policy should b... | [
"Modify",
"an",
"existing",
"retention",
"policy",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L546-L581 | train |
saltstack/salt | salt/modules/influxdb08mod.py | query | def query(database,
query,
time_precision='s',
chunked=False,
user=None,
password=None,
host=None,
port=None):
'''
Querying data
database
The database to query
query
Query to be executed
time_precision
T... | python | def query(database,
query,
time_precision='s',
chunked=False,
user=None,
password=None,
host=None,
port=None):
'''
Querying data
database
The database to query
query
Query to be executed
time_precision
T... | [
"def",
"query",
"(",
"database",
",",
"query",
",",
"time_precision",
"=",
"'s'",
",",
"chunked",
"=",
"False",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
")",
":",
"client",
"=",
"_c... | Querying data
database
The database to query
query
Query to be executed
time_precision
Time precision to use ('s', 'm', or 'u')
chunked
Whether is chunked or not
user
The user to connect as
password
The password of the user
host
... | [
"Querying",
"data"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L584-L628 | train |
saltstack/salt | salt/log/handlers/__init__.py | TemporaryLoggingHandler.sync_with_handlers | def sync_with_handlers(self, handlers=()):
'''
Sync the stored log records to the provided log handlers.
'''
if not handlers:
return
while self.__messages:
record = self.__messages.pop(0)
for handler in handlers:
if handler.lev... | python | def sync_with_handlers(self, handlers=()):
'''
Sync the stored log records to the provided log handlers.
'''
if not handlers:
return
while self.__messages:
record = self.__messages.pop(0)
for handler in handlers:
if handler.lev... | [
"def",
"sync_with_handlers",
"(",
"self",
",",
"handlers",
"=",
"(",
")",
")",
":",
"if",
"not",
"handlers",
":",
"return",
"while",
"self",
".",
"__messages",
":",
"record",
"=",
"self",
".",
"__messages",
".",
"pop",
"(",
"0",
")",
"for",
"handler",
... | Sync the stored log records to the provided log handlers. | [
"Sync",
"the",
"stored",
"log",
"records",
"to",
"the",
"provided",
"log",
"handlers",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/handlers/__init__.py#L73-L87 | train |
saltstack/salt | salt/log/handlers/__init__.py | SysLogHandler.handleError | def handleError(self, record):
'''
Override the default error handling mechanism for py3
Deal with syslog os errors when the log file does not exist
'''
handled = False
if sys.stderr and sys.version_info >= (3, 5, 4):
t, v, tb = sys.exc_info()
if t... | python | def handleError(self, record):
'''
Override the default error handling mechanism for py3
Deal with syslog os errors when the log file does not exist
'''
handled = False
if sys.stderr and sys.version_info >= (3, 5, 4):
t, v, tb = sys.exc_info()
if t... | [
"def",
"handleError",
"(",
"self",
",",
"record",
")",
":",
"handled",
"=",
"False",
"if",
"sys",
".",
"stderr",
"and",
"sys",
".",
"version_info",
">=",
"(",
"3",
",",
"5",
",",
"4",
")",
":",
"t",
",",
"v",
",",
"tb",
"=",
"sys",
".",
"exc_in... | Override the default error handling mechanism for py3
Deal with syslog os errors when the log file does not exist | [
"Override",
"the",
"default",
"error",
"handling",
"mechanism",
"for",
"py3",
"Deal",
"with",
"syslog",
"os",
"errors",
"when",
"the",
"log",
"file",
"does",
"not",
"exist"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/handlers/__init__.py#L106-L119 | train |
saltstack/salt | salt/log/handlers/__init__.py | RotatingFileHandler.handleError | def handleError(self, record):
'''
Override the default error handling mechanism
Deal with log file rotation errors due to log file in use
more softly.
'''
handled = False
# Can't use "salt.utils.platform.is_windows()" in this file
if (sys.platform.start... | python | def handleError(self, record):
'''
Override the default error handling mechanism
Deal with log file rotation errors due to log file in use
more softly.
'''
handled = False
# Can't use "salt.utils.platform.is_windows()" in this file
if (sys.platform.start... | [
"def",
"handleError",
"(",
"self",
",",
"record",
")",
":",
"handled",
"=",
"False",
"# Can't use \"salt.utils.platform.is_windows()\" in this file",
"if",
"(",
"sys",
".",
"platform",
".",
"startswith",
"(",
"'win'",
")",
"and",
"logging",
".",
"raiseExceptions",
... | Override the default error handling mechanism
Deal with log file rotation errors due to log file in use
more softly. | [
"Override",
"the",
"default",
"error",
"handling",
"mechanism"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/handlers/__init__.py#L126-L155 | train |
saltstack/salt | salt/beacons/status.py | beacon | def beacon(config):
'''
Return status for requested information
'''
log.debug(config)
ctime = datetime.datetime.utcnow().isoformat()
if not config:
config = [{
'loadavg': ['all'],
'cpustats': ['all'],
'meminfo': ['all'],
'vmstats': ['all']... | python | def beacon(config):
'''
Return status for requested information
'''
log.debug(config)
ctime = datetime.datetime.utcnow().isoformat()
if not config:
config = [{
'loadavg': ['all'],
'cpustats': ['all'],
'meminfo': ['all'],
'vmstats': ['all']... | [
"def",
"beacon",
"(",
"config",
")",
":",
"log",
".",
"debug",
"(",
"config",
")",
"ctime",
"=",
"datetime",
".",
"datetime",
".",
"utcnow",
"(",
")",
".",
"isoformat",
"(",
")",
"if",
"not",
"config",
":",
"config",
"=",
"[",
"{",
"'loadavg'",
":"... | Return status for requested information | [
"Return",
"status",
"for",
"requested",
"information"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/status.py#L119-L168 | train |
saltstack/salt | salt/states/sysctl.py | present | def present(name, value, config=None):
'''
Ensure that the named sysctl value is set in memory and persisted to the
named configuration file. The default sysctl configuration file is
/etc/sysctl.conf
name
The name of the sysctl value to edit
value
The sysctl value to apply
... | python | def present(name, value, config=None):
'''
Ensure that the named sysctl value is set in memory and persisted to the
named configuration file. The default sysctl configuration file is
/etc/sysctl.conf
name
The name of the sysctl value to edit
value
The sysctl value to apply
... | [
"def",
"present",
"(",
"name",
",",
"value",
",",
"config",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
"}",
"if",
"config",
"is",
"Non... | Ensure that the named sysctl value is set in memory and persisted to the
named configuration file. The default sysctl configuration file is
/etc/sysctl.conf
name
The name of the sysctl value to edit
value
The sysctl value to apply
config
The location of the sysctl configur... | [
"Ensure",
"that",
"the",
"named",
"sysctl",
"value",
"is",
"set",
"in",
"memory",
"and",
"persisted",
"to",
"the",
"named",
"configuration",
"file",
".",
"The",
"default",
"sysctl",
"configuration",
"file",
"is",
"/",
"etc",
"/",
"sysctl",
".",
"conf"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/sysctl.py#L33-L131 | train |
saltstack/salt | salt/grains/opts.py | opts | def opts():
'''
Return the minion configuration settings
'''
if __opts__.get('grain_opts', False) or \
(isinstance(__pillar__, dict) and __pillar__.get('grain_opts', False)):
return __opts__
return {} | python | def opts():
'''
Return the minion configuration settings
'''
if __opts__.get('grain_opts', False) or \
(isinstance(__pillar__, dict) and __pillar__.get('grain_opts', False)):
return __opts__
return {} | [
"def",
"opts",
"(",
")",
":",
"if",
"__opts__",
".",
"get",
"(",
"'grain_opts'",
",",
"False",
")",
"or",
"(",
"isinstance",
"(",
"__pillar__",
",",
"dict",
")",
"and",
"__pillar__",
".",
"get",
"(",
"'grain_opts'",
",",
"False",
")",
")",
":",
"retu... | Return the minion configuration settings | [
"Return",
"the",
"minion",
"configuration",
"settings"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/opts.py#L9-L16 | train |
saltstack/salt | salt/modules/freebsd_update.py | _cmd | def _cmd(**kwargs):
'''
.. versionadded:: 2016.3.4
Private function that returns the freebsd-update command string to be
executed. It checks if any arguments are given to freebsd-update and appends
them accordingly.
'''
update_cmd = salt.utils.path.which('freebsd-update')
if not update_... | python | def _cmd(**kwargs):
'''
.. versionadded:: 2016.3.4
Private function that returns the freebsd-update command string to be
executed. It checks if any arguments are given to freebsd-update and appends
them accordingly.
'''
update_cmd = salt.utils.path.which('freebsd-update')
if not update_... | [
"def",
"_cmd",
"(",
"*",
"*",
"kwargs",
")",
":",
"update_cmd",
"=",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'freebsd-update'",
")",
"if",
"not",
"update_cmd",
":",
"raise",
"CommandNotFoundError",
"(",
"'\"freebsd-update\" command not found'",
... | .. versionadded:: 2016.3.4
Private function that returns the freebsd-update command string to be
executed. It checks if any arguments are given to freebsd-update and appends
them accordingly. | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"4"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsd_update.py#L45-L77 | train |
saltstack/salt | salt/modules/freebsd_update.py | _wrapper | def _wrapper(orig, pre='', post='', err_=None, run_args=None, **kwargs):
'''
Helper function that wraps the execution of freebsd-update command.
orig:
Originating function that called _wrapper().
pre:
String that will be prepended to freebsd-update command.
post:
String th... | python | def _wrapper(orig, pre='', post='', err_=None, run_args=None, **kwargs):
'''
Helper function that wraps the execution of freebsd-update command.
orig:
Originating function that called _wrapper().
pre:
String that will be prepended to freebsd-update command.
post:
String th... | [
"def",
"_wrapper",
"(",
"orig",
",",
"pre",
"=",
"''",
",",
"post",
"=",
"''",
",",
"err_",
"=",
"None",
",",
"run_args",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"''",
"# the message to be returned",
"cmd",
"=",
"_cmd",
"(",
"*"... | Helper function that wraps the execution of freebsd-update command.
orig:
Originating function that called _wrapper().
pre:
String that will be prepended to freebsd-update command.
post:
String that will be appended to freebsd-update command.
err_:
Dictionary on which... | [
"Helper",
"function",
"that",
"wraps",
"the",
"execution",
"of",
"freebsd",
"-",
"update",
"command",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsd_update.py#L80-L123 | train |
saltstack/salt | salt/modules/freebsd_update.py | fetch | def fetch(**kwargs):
'''
.. versionadded:: 2016.3.4
freebsd-update fetch wrapper. Based on the currently installed world and the
configuration options set, fetch all available binary updates.
kwargs:
Parameters of freebsd-update command.
'''
# fetch continues when no controlling te... | python | def fetch(**kwargs):
'''
.. versionadded:: 2016.3.4
freebsd-update fetch wrapper. Based on the currently installed world and the
configuration options set, fetch all available binary updates.
kwargs:
Parameters of freebsd-update command.
'''
# fetch continues when no controlling te... | [
"def",
"fetch",
"(",
"*",
"*",
"kwargs",
")",
":",
"# fetch continues when no controlling terminal is present",
"pre",
"=",
"''",
"post",
"=",
"''",
"run_args",
"=",
"{",
"}",
"if",
"float",
"(",
"__grains__",
"[",
"'osrelease'",
"]",
")",
">=",
"10.2",
":",... | .. versionadded:: 2016.3.4
freebsd-update fetch wrapper. Based on the currently installed world and the
configuration options set, fetch all available binary updates.
kwargs:
Parameters of freebsd-update command. | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"4"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsd_update.py#L126-L145 | train |
saltstack/salt | salt/modules/freebsd_update.py | update | def update(**kwargs):
'''
.. versionadded:: 2016.3.4
Command that simplifies freebsd-update by running freebsd-update fetch first
and then freebsd-update install.
kwargs:
Parameters of freebsd-update command.
'''
stdout = {}
for mode in ('fetch', 'install'):
err_ = {}
... | python | def update(**kwargs):
'''
.. versionadded:: 2016.3.4
Command that simplifies freebsd-update by running freebsd-update fetch first
and then freebsd-update install.
kwargs:
Parameters of freebsd-update command.
'''
stdout = {}
for mode in ('fetch', 'install'):
err_ = {}
... | [
"def",
"update",
"(",
"*",
"*",
"kwargs",
")",
":",
"stdout",
"=",
"{",
"}",
"for",
"mode",
"in",
"(",
"'fetch'",
",",
"'install'",
")",
":",
"err_",
"=",
"{",
"}",
"ret",
"=",
"_wrapper",
"(",
"mode",
",",
"err_",
"=",
"err_",
",",
"*",
"*",
... | .. versionadded:: 2016.3.4
Command that simplifies freebsd-update by running freebsd-update fetch first
and then freebsd-update install.
kwargs:
Parameters of freebsd-update command. | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"4"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsd_update.py#L174-L193 | train |
saltstack/salt | salt/states/flatpak.py | uninstalled | def uninstalled(name):
'''
Ensure that the named package is not installed.
Args:
name (str): The flatpak package.
Returns:
dict: The ``result`` and ``output``.
Example:
.. code-block:: yaml
uninstall_package:
flatpack.uninstalled:
- name: gimp
... | python | def uninstalled(name):
'''
Ensure that the named package is not installed.
Args:
name (str): The flatpak package.
Returns:
dict: The ``result`` and ``output``.
Example:
.. code-block:: yaml
uninstall_package:
flatpack.uninstalled:
- name: gimp
... | [
"def",
"uninstalled",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"old",
"=",
"__salt__",
"[",
"'flatpak.is_installed'",
"]",
"(",
"na... | Ensure that the named package is not installed.
Args:
name (str): The flatpak package.
Returns:
dict: The ``result`` and ``output``.
Example:
.. code-block:: yaml
uninstall_package:
flatpack.uninstalled:
- name: gimp | [
"Ensure",
"that",
"the",
"named",
"package",
"is",
"not",
"installed",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/flatpak.py#L79-L121 | train |
saltstack/salt | salt/states/flatpak.py | add_remote | def add_remote(name, location):
'''
Adds a new location to install flatpak packages from.
Args:
name (str): The repository's name.
location (str): The location of the repository.
Returns:
dict: The ``result`` and ``output``.
Example:
.. code-block:: yaml
add_... | python | def add_remote(name, location):
'''
Adds a new location to install flatpak packages from.
Args:
name (str): The repository's name.
location (str): The location of the repository.
Returns:
dict: The ``result`` and ``output``.
Example:
.. code-block:: yaml
add_... | [
"def",
"add_remote",
"(",
"name",
",",
"location",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"old",
"=",
"__salt__",
"[",
"'flatpak.is_remote_added... | Adds a new location to install flatpak packages from.
Args:
name (str): The repository's name.
location (str): The location of the repository.
Returns:
dict: The ``result`` and ``output``.
Example:
.. code-block:: yaml
add_flathub:
flatpack.add_remote:
... | [
"Adds",
"a",
"new",
"location",
"to",
"install",
"flatpak",
"packages",
"from",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/flatpak.py#L124-L177 | train |
saltstack/salt | salt/modules/smartos_nictagadm.py | list_nictags | def list_nictags(include_etherstubs=True):
'''
List all nictags
include_etherstubs : boolean
toggle include of etherstubs
CLI Example:
.. code-block:: bash
salt '*' nictagadm.list
'''
ret = {}
cmd = 'nictagadm list -d "|" -p{0}'.format(
' -L' if not include_et... | python | def list_nictags(include_etherstubs=True):
'''
List all nictags
include_etherstubs : boolean
toggle include of etherstubs
CLI Example:
.. code-block:: bash
salt '*' nictagadm.list
'''
ret = {}
cmd = 'nictagadm list -d "|" -p{0}'.format(
' -L' if not include_et... | [
"def",
"list_nictags",
"(",
"include_etherstubs",
"=",
"True",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"'nictagadm list -d \"|\" -p{0}'",
".",
"format",
"(",
"' -L'",
"if",
"not",
"include_etherstubs",
"else",
"''",
")",
"res",
"=",
"__salt__",
"[",
"'cm... | List all nictags
include_etherstubs : boolean
toggle include of etherstubs
CLI Example:
.. code-block:: bash
salt '*' nictagadm.list | [
"List",
"all",
"nictags"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_nictagadm.py#L48-L78 | train |
saltstack/salt | salt/modules/smartos_nictagadm.py | vms | def vms(nictag):
'''
List all vms connect to nictag
nictag : string
name of nictag
CLI Example:
.. code-block:: bash
salt '*' nictagadm.vms admin
'''
ret = {}
cmd = 'nictagadm vms {0}'.format(nictag)
res = __salt__['cmd.run_all'](cmd)
retcode = res['retcode']
... | python | def vms(nictag):
'''
List all vms connect to nictag
nictag : string
name of nictag
CLI Example:
.. code-block:: bash
salt '*' nictagadm.vms admin
'''
ret = {}
cmd = 'nictagadm vms {0}'.format(nictag)
res = __salt__['cmd.run_all'](cmd)
retcode = res['retcode']
... | [
"def",
"vms",
"(",
"nictag",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"'nictagadm vms {0}'",
".",
"format",
"(",
"nictag",
")",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
")",
"retcode",
"=",
"res",
"[",
"'retcode'",
"]",
"if",... | List all vms connect to nictag
nictag : string
name of nictag
CLI Example:
.. code-block:: bash
salt '*' nictagadm.vms admin | [
"List",
"all",
"vms",
"connect",
"to",
"nictag"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_nictagadm.py#L81-L102 | train |
saltstack/salt | salt/modules/smartos_nictagadm.py | exists | def exists(*nictag, **kwargs):
'''
Check if nictags exists
nictag : string
one or more nictags to check
verbose : boolean
return list of nictags
CLI Example:
.. code-block:: bash
salt '*' nictagadm.exists admin
'''
ret = {}
if not nictag:
return {'... | python | def exists(*nictag, **kwargs):
'''
Check if nictags exists
nictag : string
one or more nictags to check
verbose : boolean
return list of nictags
CLI Example:
.. code-block:: bash
salt '*' nictagadm.exists admin
'''
ret = {}
if not nictag:
return {'... | [
"def",
"exists",
"(",
"*",
"nictag",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"not",
"nictag",
":",
"return",
"{",
"'Error'",
":",
"'Please provide at least one nictag to check.'",
"}",
"cmd",
"=",
"'nictagadm exists -l {0}'",
".",
"for... | Check if nictags exists
nictag : string
one or more nictags to check
verbose : boolean
return list of nictags
CLI Example:
.. code-block:: bash
salt '*' nictagadm.exists admin | [
"Check",
"if",
"nictags",
"exists"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_nictagadm.py#L105-L134 | train |
saltstack/salt | salt/modules/smartos_nictagadm.py | add | def add(name, mac, mtu=1500):
'''
Add a new nictag
name : string
name of new nictag
mac : string
mac of parent interface or 'etherstub' to create a ether stub
mtu : int
MTU (ignored for etherstubs)
CLI Example:
.. code-block:: bash
salt '*' nictagadm.add s... | python | def add(name, mac, mtu=1500):
'''
Add a new nictag
name : string
name of new nictag
mac : string
mac of parent interface or 'etherstub' to create a ether stub
mtu : int
MTU (ignored for etherstubs)
CLI Example:
.. code-block:: bash
salt '*' nictagadm.add s... | [
"def",
"add",
"(",
"name",
",",
"mac",
",",
"mtu",
"=",
"1500",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"mtu",
">",
"9000",
"or",
"mtu",
"<",
"1500",
":",
"return",
"{",
"'Error'",
":",
"'mtu must be a value between 1500 and 9000.'",
"}",
"if",
"mac",
... | Add a new nictag
name : string
name of new nictag
mac : string
mac of parent interface or 'etherstub' to create a ether stub
mtu : int
MTU (ignored for etherstubs)
CLI Example:
.. code-block:: bash
salt '*' nictagadm.add storage0 etherstub
salt '*' nictaga... | [
"Add",
"a",
"new",
"nictag"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_nictagadm.py#L137-L176 | train |
saltstack/salt | salt/modules/smartos_nictagadm.py | update | def update(name, mac=None, mtu=None):
'''
Update a nictag
name : string
name of nictag
mac : string
optional new mac for nictag
mtu : int
optional new MTU for nictag
CLI Example:
.. code-block:: bash
salt '*' nictagadm.update trunk mtu=9000
'''
ret... | python | def update(name, mac=None, mtu=None):
'''
Update a nictag
name : string
name of nictag
mac : string
optional new mac for nictag
mtu : int
optional new MTU for nictag
CLI Example:
.. code-block:: bash
salt '*' nictagadm.update trunk mtu=9000
'''
ret... | [
"def",
"update",
"(",
"name",
",",
"mac",
"=",
"None",
",",
"mtu",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"name",
"not",
"in",
"list_nictags",
"(",
")",
":",
"return",
"{",
"'Error'",
":",
"'nictag {0} does not exists.'",
".",
"format",
"... | Update a nictag
name : string
name of nictag
mac : string
optional new mac for nictag
mtu : int
optional new MTU for nictag
CLI Example:
.. code-block:: bash
salt '*' nictagadm.update trunk mtu=9000 | [
"Update",
"a",
"nictag"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_nictagadm.py#L179-L228 | train |
saltstack/salt | salt/modules/smartos_nictagadm.py | delete | def delete(name, force=False):
'''
Delete nictag
name : string
nictag to delete
force : boolean
force delete even if vms attached
CLI Example:
.. code-block:: bash
salt '*' nictagadm.exists admin
'''
ret = {}
if name not in list_nictags():
return ... | python | def delete(name, force=False):
'''
Delete nictag
name : string
nictag to delete
force : boolean
force delete even if vms attached
CLI Example:
.. code-block:: bash
salt '*' nictagadm.exists admin
'''
ret = {}
if name not in list_nictags():
return ... | [
"def",
"delete",
"(",
"name",
",",
"force",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"name",
"not",
"in",
"list_nictags",
"(",
")",
":",
"return",
"True",
"cmd",
"=",
"'nictagadm delete {0}{1}'",
".",
"format",
"(",
"\"-f \"",
"if",
"force",... | Delete nictag
name : string
nictag to delete
force : boolean
force delete even if vms attached
CLI Example:
.. code-block:: bash
salt '*' nictagadm.exists admin | [
"Delete",
"nictag"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_nictagadm.py#L231-L257 | train |
saltstack/salt | salt/proxy/philips_hue.py | init | def init(cnf):
'''
Initialize the module.
'''
CONFIG['host'] = cnf.get('proxy', {}).get('host')
if not CONFIG['host']:
raise MinionError(message="Cannot find 'host' parameter in the proxy configuration")
CONFIG['user'] = cnf.get('proxy', {}).get('user')
if not CONFIG['user']:
... | python | def init(cnf):
'''
Initialize the module.
'''
CONFIG['host'] = cnf.get('proxy', {}).get('host')
if not CONFIG['host']:
raise MinionError(message="Cannot find 'host' parameter in the proxy configuration")
CONFIG['user'] = cnf.get('proxy', {}).get('user')
if not CONFIG['user']:
... | [
"def",
"init",
"(",
"cnf",
")",
":",
"CONFIG",
"[",
"'host'",
"]",
"=",
"cnf",
".",
"get",
"(",
"'proxy'",
",",
"{",
"}",
")",
".",
"get",
"(",
"'host'",
")",
"if",
"not",
"CONFIG",
"[",
"'host'",
"]",
":",
"raise",
"MinionError",
"(",
"message",... | Initialize the module. | [
"Initialize",
"the",
"module",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L79-L91 | train |
saltstack/salt | salt/proxy/philips_hue.py | _query | def _query(lamp_id, state, action='', method='GET'):
'''
Query the URI
:return:
'''
# Because salt.utils.query is that dreadful... :(
err = None
url = "{0}/lights{1}".format(CONFIG['uri'],
lamp_id and '/{0}'.format(lamp_id) or '') \
+ (action and ... | python | def _query(lamp_id, state, action='', method='GET'):
'''
Query the URI
:return:
'''
# Because salt.utils.query is that dreadful... :(
err = None
url = "{0}/lights{1}".format(CONFIG['uri'],
lamp_id and '/{0}'.format(lamp_id) or '') \
+ (action and ... | [
"def",
"_query",
"(",
"lamp_id",
",",
"state",
",",
"action",
"=",
"''",
",",
"method",
"=",
"'GET'",
")",
":",
"# Because salt.utils.query is that dreadful... :(",
"err",
"=",
"None",
"url",
"=",
"\"{0}/lights{1}\"",
".",
"format",
"(",
"CONFIG",
"[",
"'uri'"... | Query the URI
:return: | [
"Query",
"the",
"URI"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L110-L137 | train |
saltstack/salt | salt/proxy/philips_hue.py | _set | def _set(lamp_id, state, method="state"):
'''
Set state to the device by ID.
:param lamp_id:
:param state:
:return:
'''
try:
res = _query(lamp_id, state, action=method, method='PUT')
except Exception as err:
raise CommandExecutionError(err)
res = len(res) > 1 and re... | python | def _set(lamp_id, state, method="state"):
'''
Set state to the device by ID.
:param lamp_id:
:param state:
:return:
'''
try:
res = _query(lamp_id, state, action=method, method='PUT')
except Exception as err:
raise CommandExecutionError(err)
res = len(res) > 1 and re... | [
"def",
"_set",
"(",
"lamp_id",
",",
"state",
",",
"method",
"=",
"\"state\"",
")",
":",
"try",
":",
"res",
"=",
"_query",
"(",
"lamp_id",
",",
"state",
",",
"action",
"=",
"method",
",",
"method",
"=",
"'PUT'",
")",
"except",
"Exception",
"as",
"err"... | Set state to the device by ID.
:param lamp_id:
:param state:
:return: | [
"Set",
"state",
"to",
"the",
"device",
"by",
"ID",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L140-L161 | train |
saltstack/salt | salt/proxy/philips_hue.py | _get_devices | def _get_devices(params):
'''
Parse device(s) ID(s) from the common params.
:param params:
:return:
'''
if 'id' not in params:
raise CommandExecutionError("Parameter ID is required.")
return type(params['id']) == int and [params['id']] \
or [int(dev) for dev in params['i... | python | def _get_devices(params):
'''
Parse device(s) ID(s) from the common params.
:param params:
:return:
'''
if 'id' not in params:
raise CommandExecutionError("Parameter ID is required.")
return type(params['id']) == int and [params['id']] \
or [int(dev) for dev in params['i... | [
"def",
"_get_devices",
"(",
"params",
")",
":",
"if",
"'id'",
"not",
"in",
"params",
":",
"raise",
"CommandExecutionError",
"(",
"\"Parameter ID is required.\"",
")",
"return",
"type",
"(",
"params",
"[",
"'id'",
"]",
")",
"==",
"int",
"and",
"[",
"params",
... | Parse device(s) ID(s) from the common params.
:param params:
:return: | [
"Parse",
"device",
"(",
"s",
")",
"ID",
"(",
"s",
")",
"from",
"the",
"common",
"params",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L164-L175 | train |
saltstack/salt | salt/proxy/philips_hue.py | call_lights | def call_lights(*args, **kwargs):
'''
Get info about all available lamps.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
CLI Example:
.. code-block:: bash
salt '*' hue.lights
salt '*' hue.lights id=1
salt '*' hue.lights id... | python | def call_lights(*args, **kwargs):
'''
Get info about all available lamps.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
CLI Example:
.. code-block:: bash
salt '*' hue.lights
salt '*' hue.lights id=1
salt '*' hue.lights id... | [
"def",
"call_lights",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"res",
"=",
"dict",
"(",
")",
"lights",
"=",
"_get_lights",
"(",
")",
"for",
"dev_id",
"in",
"'id'",
"in",
"kwargs",
"and",
"_get_devices",
"(",
"kwargs",
")",
"or",
"sorted",... | Get info about all available lamps.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
CLI Example:
.. code-block:: bash
salt '*' hue.lights
salt '*' hue.lights id=1
salt '*' hue.lights id=1,2,3 | [
"Get",
"info",
"about",
"all",
"available",
"lamps",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L186-L208 | train |
saltstack/salt | salt/proxy/philips_hue.py | call_switch | def call_switch(*args, **kwargs):
'''
Switch lamp ON/OFF.
If no particular state is passed,
then lamp will be switched to the opposite state.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **on**: True or False. Inverted current, if omitted
... | python | def call_switch(*args, **kwargs):
'''
Switch lamp ON/OFF.
If no particular state is passed,
then lamp will be switched to the opposite state.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **on**: True or False. Inverted current, if omitted
... | [
"def",
"call_switch",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"out",
"=",
"dict",
"(",
")",
"devices",
"=",
"_get_lights",
"(",
")",
"for",
"dev_id",
"in",
"'id'",
"not",
"in",
"kwargs",
"and",
"sorted",
"(",
"devices",
".",
"keys",
"(... | Switch lamp ON/OFF.
If no particular state is passed,
then lamp will be switched to the opposite state.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **on**: True or False. Inverted current, if omitted
CLI Example:
.. code-block:: bash
... | [
"Switch",
"lamp",
"ON",
"/",
"OFF",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L211-L241 | train |
saltstack/salt | salt/proxy/philips_hue.py | call_blink | def call_blink(*args, **kwargs):
'''
Blink a lamp. If lamp is ON, then blink ON-OFF-ON, otherwise OFF-ON-OFF.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **pause**: Time in seconds. Can be less than 1, i.e. 0.7, 0.5 sec.
CLI Example:
.. c... | python | def call_blink(*args, **kwargs):
'''
Blink a lamp. If lamp is ON, then blink ON-OFF-ON, otherwise OFF-ON-OFF.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **pause**: Time in seconds. Can be less than 1, i.e. 0.7, 0.5 sec.
CLI Example:
.. c... | [
"def",
"call_blink",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"devices",
"=",
"_get_lights",
"(",
")",
"pause",
"=",
"kwargs",
".",
"get",
"(",
"'pause'",
",",
"0",
")",
"res",
"=",
"dict",
"(",
")",
"for",
"dev_id",
"in",
"'id'",
"no... | Blink a lamp. If lamp is ON, then blink ON-OFF-ON, otherwise OFF-ON-OFF.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **pause**: Time in seconds. Can be less than 1, i.e. 0.7, 0.5 sec.
CLI Example:
.. code-block:: bash
salt '*' hue.blink ... | [
"Blink",
"a",
"lamp",
".",
"If",
"lamp",
"is",
"ON",
"then",
"blink",
"ON",
"-",
"OFF",
"-",
"ON",
"otherwise",
"OFF",
"-",
"ON",
"-",
"OFF",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L244-L270 | train |
saltstack/salt | salt/proxy/philips_hue.py | call_ping | def call_ping(*args, **kwargs):
'''
Ping the lamps by issuing a short inversion blink to all available devices.
CLI Example:
.. code-block:: bash
salt '*' hue.ping
'''
errors = dict()
for dev_id, dev_status in call_blink().items():
if not dev_status['result']:
... | python | def call_ping(*args, **kwargs):
'''
Ping the lamps by issuing a short inversion blink to all available devices.
CLI Example:
.. code-block:: bash
salt '*' hue.ping
'''
errors = dict()
for dev_id, dev_status in call_blink().items():
if not dev_status['result']:
... | [
"def",
"call_ping",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"errors",
"=",
"dict",
"(",
")",
"for",
"dev_id",
",",
"dev_status",
"in",
"call_blink",
"(",
")",
".",
"items",
"(",
")",
":",
"if",
"not",
"dev_status",
"[",
"'result'",
"]"... | Ping the lamps by issuing a short inversion blink to all available devices.
CLI Example:
.. code-block:: bash
salt '*' hue.ping | [
"Ping",
"the",
"lamps",
"by",
"issuing",
"a",
"short",
"inversion",
"blink",
"to",
"all",
"available",
"devices",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L273-L288 | train |
saltstack/salt | salt/proxy/philips_hue.py | call_status | def call_status(*args, **kwargs):
'''
Return the status of the lamps.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
CLI Example:
.. code-block:: bash
salt '*' hue.status
salt '*' hue.status id=1
salt '*' hue.status id=1,2... | python | def call_status(*args, **kwargs):
'''
Return the status of the lamps.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
CLI Example:
.. code-block:: bash
salt '*' hue.status
salt '*' hue.status id=1
salt '*' hue.status id=1,2... | [
"def",
"call_status",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"res",
"=",
"dict",
"(",
")",
"devices",
"=",
"_get_lights",
"(",
")",
"for",
"dev_id",
"in",
"'id'",
"not",
"in",
"kwargs",
"and",
"sorted",
"(",
"devices",
".",
"keys",
"(... | Return the status of the lamps.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
CLI Example:
.. code-block:: bash
salt '*' hue.status
salt '*' hue.status id=1
salt '*' hue.status id=1,2,3 | [
"Return",
"the",
"status",
"of",
"the",
"lamps",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L291-L316 | train |
saltstack/salt | salt/proxy/philips_hue.py | call_rename | def call_rename(*args, **kwargs):
'''
Rename a device.
Options:
* **id**: Specifies a device ID. Only one device at a time.
* **title**: Title of the device.
CLI Example:
.. code-block:: bash
salt '*' hue.rename id=1 title='WC for cats'
'''
dev_id = _get_devices(kwargs)
... | python | def call_rename(*args, **kwargs):
'''
Rename a device.
Options:
* **id**: Specifies a device ID. Only one device at a time.
* **title**: Title of the device.
CLI Example:
.. code-block:: bash
salt '*' hue.rename id=1 title='WC for cats'
'''
dev_id = _get_devices(kwargs)
... | [
"def",
"call_rename",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"dev_id",
"=",
"_get_devices",
"(",
"kwargs",
")",
"if",
"len",
"(",
"dev_id",
")",
">",
"1",
":",
"raise",
"CommandExecutionError",
"(",
"\"Only one device can be renamed at a time\"",... | Rename a device.
Options:
* **id**: Specifies a device ID. Only one device at a time.
* **title**: Title of the device.
CLI Example:
.. code-block:: bash
salt '*' hue.rename id=1 title='WC for cats' | [
"Rename",
"a",
"device",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L319-L341 | train |
saltstack/salt | salt/proxy/philips_hue.py | call_alert | def call_alert(*args, **kwargs):
'''
Lamp alert
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **on**: Turns on or off an alert. Default is True.
CLI Example:
.. code-block:: bash
salt '*' hue.alert
salt '*' hue.alert id=1
... | python | def call_alert(*args, **kwargs):
'''
Lamp alert
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **on**: Turns on or off an alert. Default is True.
CLI Example:
.. code-block:: bash
salt '*' hue.alert
salt '*' hue.alert id=1
... | [
"def",
"call_alert",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"res",
"=",
"dict",
"(",
")",
"devices",
"=",
"_get_lights",
"(",
")",
"for",
"dev_id",
"in",
"'id'",
"not",
"in",
"kwargs",
"and",
"sorted",
"(",
"devices",
".",
"keys",
"("... | Lamp alert
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **on**: Turns on or off an alert. Default is True.
CLI Example:
.. code-block:: bash
salt '*' hue.alert
salt '*' hue.alert id=1
salt '*' hue.alert id=1,2,3 on=false | [
"Lamp",
"alert"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L344-L367 | train |
saltstack/salt | salt/proxy/philips_hue.py | call_color | def call_color(*args, **kwargs):
'''
Set a color to the lamp.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **color**: Fixed color. Values are: red, green, blue, orange, pink, white,
yellow, daylight, purple. Default white.
* **t... | python | def call_color(*args, **kwargs):
'''
Set a color to the lamp.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **color**: Fixed color. Values are: red, green, blue, orange, pink, white,
yellow, daylight, purple. Default white.
* **t... | [
"def",
"call_color",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"res",
"=",
"dict",
"(",
")",
"colormap",
"=",
"{",
"'red'",
":",
"Const",
".",
"COLOR_RED",
",",
"'green'",
":",
"Const",
".",
"COLOR_GREEN",
",",
"'blue'",
":",
"Const",
".... | Set a color to the lamp.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **color**: Fixed color. Values are: red, green, blue, orange, pink, white,
yellow, daylight, purple. Default white.
* **transition**: Transition 0~200.
Advanced:... | [
"Set",
"a",
"color",
"to",
"the",
"lamp",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L396-L454 | train |
saltstack/salt | salt/proxy/philips_hue.py | call_brightness | def call_brightness(*args, **kwargs):
'''
Set an effect to the lamp.
Arguments:
* **value**: 0~255 brightness of the lamp.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **transition**: Transition 0~200. Default 0.
CLI Example:
.. ... | python | def call_brightness(*args, **kwargs):
'''
Set an effect to the lamp.
Arguments:
* **value**: 0~255 brightness of the lamp.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **transition**: Transition 0~200. Default 0.
CLI Example:
.. ... | [
"def",
"call_brightness",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"res",
"=",
"dict",
"(",
")",
"if",
"'value'",
"not",
"in",
"kwargs",
":",
"raise",
"CommandExecutionError",
"(",
"\"Parameter 'value' is missing\"",
")",
"try",
":",
"brightness"... | Set an effect to the lamp.
Arguments:
* **value**: 0~255 brightness of the lamp.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **transition**: Transition 0~200. Default 0.
CLI Example:
.. code-block:: bash
salt '*' hue.brightness... | [
"Set",
"an",
"effect",
"to",
"the",
"lamp",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L457-L497 | train |
saltstack/salt | salt/proxy/philips_hue.py | call_temperature | def call_temperature(*args, **kwargs):
'''
Set the mired color temperature. More: http://en.wikipedia.org/wiki/Mired
Arguments:
* **value**: 150~500.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
CLI Example:
.. code-block:: bash
... | python | def call_temperature(*args, **kwargs):
'''
Set the mired color temperature. More: http://en.wikipedia.org/wiki/Mired
Arguments:
* **value**: 150~500.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
CLI Example:
.. code-block:: bash
... | [
"def",
"call_temperature",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"res",
"=",
"dict",
"(",
")",
"if",
"'value'",
"not",
"in",
"kwargs",
":",
"raise",
"CommandExecutionError",
"(",
"\"Parameter 'value' (150~500) is missing\"",
")",
"try",
":",
"... | Set the mired color temperature. More: http://en.wikipedia.org/wiki/Mired
Arguments:
* **value**: 150~500.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
CLI Example:
.. code-block:: bash
salt '*' hue.temperature value=150
salt ... | [
"Set",
"the",
"mired",
"color",
"temperature",
".",
"More",
":",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Mired"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L500-L533 | train |
saltstack/salt | salt/fileserver/hgfs.py | _get_branch | def _get_branch(repo, name):
'''
Find the requested branch in the specified repo
'''
try:
return [x for x in _all_branches(repo) if x[0] == name][0]
except IndexError:
return False | python | def _get_branch(repo, name):
'''
Find the requested branch in the specified repo
'''
try:
return [x for x in _all_branches(repo) if x[0] == name][0]
except IndexError:
return False | [
"def",
"_get_branch",
"(",
"repo",
",",
"name",
")",
":",
"try",
":",
"return",
"[",
"x",
"for",
"x",
"in",
"_all_branches",
"(",
"repo",
")",
"if",
"x",
"[",
"0",
"]",
"==",
"name",
"]",
"[",
"0",
"]",
"except",
"IndexError",
":",
"return",
"Fal... | Find the requested branch in the specified repo | [
"Find",
"the",
"requested",
"branch",
"in",
"the",
"specified",
"repo"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L111-L118 | train |
saltstack/salt | salt/fileserver/hgfs.py | _get_bookmark | def _get_bookmark(repo, name):
'''
Find the requested bookmark in the specified repo
'''
try:
return [x for x in _all_bookmarks(repo) if x[0] == name][0]
except IndexError:
return False | python | def _get_bookmark(repo, name):
'''
Find the requested bookmark in the specified repo
'''
try:
return [x for x in _all_bookmarks(repo) if x[0] == name][0]
except IndexError:
return False | [
"def",
"_get_bookmark",
"(",
"repo",
",",
"name",
")",
":",
"try",
":",
"return",
"[",
"x",
"for",
"x",
"in",
"_all_bookmarks",
"(",
"repo",
")",
"if",
"x",
"[",
"0",
"]",
"==",
"name",
"]",
"[",
"0",
"]",
"except",
"IndexError",
":",
"return",
"... | Find the requested bookmark in the specified repo | [
"Find",
"the",
"requested",
"bookmark",
"in",
"the",
"specified",
"repo"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L132-L139 | train |
saltstack/salt | salt/fileserver/hgfs.py | _get_tag | def _get_tag(repo, name):
'''
Find the requested tag in the specified repo
'''
try:
return [x for x in _all_tags(repo) if x[0] == name][0]
except IndexError:
return False | python | def _get_tag(repo, name):
'''
Find the requested tag in the specified repo
'''
try:
return [x for x in _all_tags(repo) if x[0] == name][0]
except IndexError:
return False | [
"def",
"_get_tag",
"(",
"repo",
",",
"name",
")",
":",
"try",
":",
"return",
"[",
"x",
"for",
"x",
"in",
"_all_tags",
"(",
"repo",
")",
"if",
"x",
"[",
"0",
"]",
"==",
"name",
"]",
"[",
"0",
"]",
"except",
"IndexError",
":",
"return",
"False"
] | Find the requested tag in the specified repo | [
"Find",
"the",
"requested",
"tag",
"in",
"the",
"specified",
"repo"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L154-L161 | train |
saltstack/salt | salt/fileserver/hgfs.py | _get_ref | def _get_ref(repo, name):
'''
Return ref tuple if ref is in the repo.
'''
if name == 'base':
name = repo['base']
if name == repo['base'] or name in envs():
if repo['branch_method'] == 'branches':
return _get_branch(repo['repo'], name) \
or _get_tag(repo['r... | python | def _get_ref(repo, name):
'''
Return ref tuple if ref is in the repo.
'''
if name == 'base':
name = repo['base']
if name == repo['base'] or name in envs():
if repo['branch_method'] == 'branches':
return _get_branch(repo['repo'], name) \
or _get_tag(repo['r... | [
"def",
"_get_ref",
"(",
"repo",
",",
"name",
")",
":",
"if",
"name",
"==",
"'base'",
":",
"name",
"=",
"repo",
"[",
"'base'",
"]",
"if",
"name",
"==",
"repo",
"[",
"'base'",
"]",
"or",
"name",
"in",
"envs",
"(",
")",
":",
"if",
"repo",
"[",
"'b... | Return ref tuple if ref is in the repo. | [
"Return",
"ref",
"tuple",
"if",
"ref",
"is",
"in",
"the",
"repo",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L164-L181 | train |
saltstack/salt | salt/fileserver/hgfs.py | init | def init():
'''
Return a list of hglib objects for the various hgfs remotes
'''
bp_ = os.path.join(__opts__['cachedir'], 'hgfs')
new_remote = False
repos = []
per_remote_defaults = {}
for param in PER_REMOTE_OVERRIDES:
per_remote_defaults[param] = \
six.text_type(__o... | python | def init():
'''
Return a list of hglib objects for the various hgfs remotes
'''
bp_ = os.path.join(__opts__['cachedir'], 'hgfs')
new_remote = False
repos = []
per_remote_defaults = {}
for param in PER_REMOTE_OVERRIDES:
per_remote_defaults[param] = \
six.text_type(__o... | [
"def",
"init",
"(",
")",
":",
"bp_",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'cachedir'",
"]",
",",
"'hgfs'",
")",
"new_remote",
"=",
"False",
"repos",
"=",
"[",
"]",
"per_remote_defaults",
"=",
"{",
"}",
"for",
"param",
"in",
"... | Return a list of hglib objects for the various hgfs remotes | [
"Return",
"a",
"list",
"of",
"hglib",
"objects",
"for",
"the",
"various",
"hgfs",
"remotes"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L193-L341 | train |
saltstack/salt | salt/fileserver/hgfs.py | lock | def lock(remote=None):
'''
Place an update.lk
``remote`` can either be a dictionary containing repo configuration
information, or a pattern. If the latter, then remotes for which the URL
matches the pattern will be locked.
'''
def _do_lock(repo):
success = []
failed = []
... | python | def lock(remote=None):
'''
Place an update.lk
``remote`` can either be a dictionary containing repo configuration
information, or a pattern. If the latter, then remotes for which the URL
matches the pattern will be locked.
'''
def _do_lock(repo):
success = []
failed = []
... | [
"def",
"lock",
"(",
"remote",
"=",
"None",
")",
":",
"def",
"_do_lock",
"(",
"repo",
")",
":",
"success",
"=",
"[",
"]",
"failed",
"=",
"[",
"]",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"repo",
"[",
"'lockfile'",
"]",
")",
":",
"try... | Place an update.lk
``remote`` can either be a dictionary containing repo configuration
information, or a pattern. If the latter, then remotes for which the URL
matches the pattern will be locked. | [
"Place",
"an",
"update",
".",
"lk"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L457-L501 | train |
saltstack/salt | salt/fileserver/hgfs.py | update | def update():
'''
Execute an hg pull on all of the repos
'''
# data for the fileserver event
data = {'changed': False,
'backend': 'hgfs'}
# _clear_old_remotes runs init(), so use the value from there to avoid a
# second init()
data['changed'], repos = _clear_old_remotes()
... | python | def update():
'''
Execute an hg pull on all of the repos
'''
# data for the fileserver event
data = {'changed': False,
'backend': 'hgfs'}
# _clear_old_remotes runs init(), so use the value from there to avoid a
# second init()
data['changed'], repos = _clear_old_remotes()
... | [
"def",
"update",
"(",
")",
":",
"# data for the fileserver event",
"data",
"=",
"{",
"'changed'",
":",
"False",
",",
"'backend'",
":",
"'hgfs'",
"}",
"# _clear_old_remotes runs init(), so use the value from there to avoid a",
"# second init()",
"data",
"[",
"'changed'",
"... | Execute an hg pull on all of the repos | [
"Execute",
"an",
"hg",
"pull",
"on",
"all",
"of",
"the",
"repos"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L504-L575 | train |
saltstack/salt | salt/fileserver/hgfs.py | envs | def envs(ignore_cache=False):
'''
Return a list of refs that can be used as environments
'''
if not ignore_cache:
env_cache = os.path.join(__opts__['cachedir'], 'hgfs/envs.p')
cache_match = salt.fileserver.check_env_cache(__opts__, env_cache)
if cache_match is not None:
... | python | def envs(ignore_cache=False):
'''
Return a list of refs that can be used as environments
'''
if not ignore_cache:
env_cache = os.path.join(__opts__['cachedir'], 'hgfs/envs.p')
cache_match = salt.fileserver.check_env_cache(__opts__, env_cache)
if cache_match is not None:
... | [
"def",
"envs",
"(",
"ignore_cache",
"=",
"False",
")",
":",
"if",
"not",
"ignore_cache",
":",
"env_cache",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'cachedir'",
"]",
",",
"'hgfs/envs.p'",
")",
"cache_match",
"=",
"salt",
".",
"fileserv... | Return a list of refs that can be used as environments | [
"Return",
"a",
"list",
"of",
"refs",
"that",
"can",
"be",
"used",
"as",
"environments"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L610-L636 | train |
saltstack/salt | salt/fileserver/hgfs.py | find_file | def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613
'''
Find the first file to match the path and ref, read the file out of hg
and send the path to the newly cached file
'''
fnd = {'path': '',
'rel': ''}
if os.path.isabs(path) or tgt_env not in envs():
retu... | python | def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613
'''
Find the first file to match the path and ref, read the file out of hg
and send the path to the newly cached file
'''
fnd = {'path': '',
'rel': ''}
if os.path.isabs(path) or tgt_env not in envs():
retu... | [
"def",
"find_file",
"(",
"path",
",",
"tgt_env",
"=",
"'base'",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=W0613",
"fnd",
"=",
"{",
"'path'",
":",
"''",
",",
"'rel'",
":",
"''",
"}",
"if",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")... | Find the first file to match the path and ref, read the file out of hg
and send the path to the newly cached file | [
"Find",
"the",
"first",
"file",
"to",
"match",
"the",
"path",
"and",
"ref",
"read",
"the",
"file",
"out",
"of",
"hg",
"and",
"send",
"the",
"path",
"to",
"the",
"newly",
"cached",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L639-L742 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.