partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | delete_stack | Delete a stack (heat stack-delete)
name
Name of the stack
poll
Poll and report events until stack complete
timeout
Stack creation timeout in minute
profile
Profile to use
CLI Examples:
.. code-block:: bash
salt '*' heat.delete_stack name=mystack po... | salt/modules/heat.py | def delete_stack(name=None, poll=0, timeout=60, profile=None):
'''
Delete a stack (heat stack-delete)
name
Name of the stack
poll
Poll and report events until stack complete
timeout
Stack creation timeout in minute
profile
Profile to use
CLI Examples:
... | def delete_stack(name=None, poll=0, timeout=60, profile=None):
'''
Delete a stack (heat stack-delete)
name
Name of the stack
poll
Poll and report events until stack complete
timeout
Stack creation timeout in minute
profile
Profile to use
CLI Examples:
... | [
"Delete",
"a",
"stack",
"(",
"heat",
"stack",
"-",
"delete",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/heat.py#L365-L428 | [
"def",
"delete_stack",
"(",
"name",
"=",
"None",
",",
"poll",
"=",
"0",
",",
"timeout",
"=",
"60",
",",
"profile",
"=",
"None",
")",
":",
"h_client",
"=",
"_auth",
"(",
"profile",
")",
"ret",
"=",
"{",
"'result'",
":",
"True",
",",
"'comment'",
":"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_stack | Create a stack (heat stack-create)
name
Name of the new stack
template_file
File of template
environment
File of environment
parameters
Parameter dict used to create the stack
poll
Poll and report events until stack complete
rollback
Enable r... | salt/modules/heat.py | def create_stack(name=None, template_file=None, environment=None,
parameters=None, poll=0, rollback=False, timeout=60,
profile=None, enviroment=None):
'''
Create a stack (heat stack-create)
name
Name of the new stack
template_file
File of template
... | def create_stack(name=None, template_file=None, environment=None,
parameters=None, poll=0, rollback=False, timeout=60,
profile=None, enviroment=None):
'''
Create a stack (heat stack-create)
name
Name of the new stack
template_file
File of template
... | [
"Create",
"a",
"stack",
"(",
"heat",
"stack",
"-",
"create",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/heat.py#L431-L623 | [
"def",
"create_stack",
"(",
"name",
"=",
"None",
",",
"template_file",
"=",
"None",
",",
"environment",
"=",
"None",
",",
"parameters",
"=",
"None",
",",
"poll",
"=",
"0",
",",
"rollback",
"=",
"False",
",",
"timeout",
"=",
"60",
",",
"profile",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | template_stack | Return template a specific stack (heat stack-template)
name
Name of the stack
profile
Profile to use
CLI Example:
.. code-block:: bash
salt '*' heat.template_stack name=mystack profile=openstack1 | salt/modules/heat.py | def template_stack(name=None, profile=None):
'''
Return template a specific stack (heat stack-template)
name
Name of the stack
profile
Profile to use
CLI Example:
.. code-block:: bash
salt '*' heat.template_stack name=mystack profile=openstack1
'''
h_client =... | def template_stack(name=None, profile=None):
'''
Return template a specific stack (heat stack-template)
name
Name of the stack
profile
Profile to use
CLI Example:
.. code-block:: bash
salt '*' heat.template_stack name=mystack profile=openstack1
'''
h_client =... | [
"Return",
"template",
"a",
"specific",
"stack",
"(",
"heat",
"stack",
"-",
"template",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/heat.py#L824-L871 | [
"def",
"template_stack",
"(",
"name",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"h_client",
"=",
"_auth",
"(",
"profile",
")",
"if",
"not",
"name",
":",
"return",
"{",
"'result'",
":",
"False",
",",
"'comment'",
":",
"'Parameter name missing or N... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | monitored | Makes sure an URL is monitored by uptime. Checks if URL is already
monitored, and if not, adds it. | salt/states/uptime.py | def monitored(name, **params):
'''
Makes sure an URL is monitored by uptime. Checks if URL is already
monitored, and if not, adds it.
'''
ret = {'name': name, 'changes': {}, 'result': None, 'comment': ''}
if __salt__['uptime.check_exists'](name=name):
ret['result'] = True
ret['... | def monitored(name, **params):
'''
Makes sure an URL is monitored by uptime. Checks if URL is already
monitored, and if not, adds it.
'''
ret = {'name': name, 'changes': {}, 'result': None, 'comment': ''}
if __salt__['uptime.check_exists'](name=name):
ret['result'] = True
ret['... | [
"Makes",
"sure",
"an",
"URL",
"is",
"monitored",
"by",
"uptime",
".",
"Checks",
"if",
"URL",
"is",
"already",
"monitored",
"and",
"if",
"not",
"adds",
"it",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/uptime.py#L47-L75 | [
"def",
"monitored",
"(",
"name",
",",
"*",
"*",
"params",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"if",
"__salt__",
"[",
"'uptime.check_exists'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | lock_holders | Return an un-ordered list of lock holders
path
The path in zookeeper where the lock is
zk_hosts
zookeeper connect string
identifier
Name to identify this minion, if unspecified defaults to hostname
max_concurrency
Maximum number of lock holders
timeout
ti... | salt/modules/zk_concurrency.py | def lock_holders(path,
zk_hosts=None,
identifier=None,
max_concurrency=1,
timeout=None,
ephemeral_lease=False,
profile=None,
scheme=None,
username=None,
password=None,... | def lock_holders(path,
zk_hosts=None,
identifier=None,
max_concurrency=1,
timeout=None,
ephemeral_lease=False,
profile=None,
scheme=None,
username=None,
password=None,... | [
"Return",
"an",
"un",
"-",
"ordered",
"list",
"of",
"lock",
"holders"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zk_concurrency.py#L154-L198 | [
"def",
"lock_holders",
"(",
"path",
",",
"zk_hosts",
"=",
"None",
",",
"identifier",
"=",
"None",
",",
"max_concurrency",
"=",
"1",
",",
"timeout",
"=",
"None",
",",
"ephemeral_lease",
"=",
"False",
",",
"profile",
"=",
"None",
",",
"scheme",
"=",
"None"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | lock | Get lock (with optional timeout)
path
The path in zookeeper where the lock is
zk_hosts
zookeeper connect string
identifier
Name to identify this minion, if unspecified defaults to the hostname
max_concurrency
Maximum number of lock holders
timeout
timeout... | salt/modules/zk_concurrency.py | def lock(path,
zk_hosts=None,
identifier=None,
max_concurrency=1,
timeout=None,
ephemeral_lease=False,
force=False, # foricble get the lock regardless of open slots
profile=None,
scheme=None,
username=None,
password=None,
... | def lock(path,
zk_hosts=None,
identifier=None,
max_concurrency=1,
timeout=None,
ephemeral_lease=False,
force=False, # foricble get the lock regardless of open slots
profile=None,
scheme=None,
username=None,
password=None,
... | [
"Get",
"lock",
"(",
"with",
"optional",
"timeout",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zk_concurrency.py#L201-L264 | [
"def",
"lock",
"(",
"path",
",",
"zk_hosts",
"=",
"None",
",",
"identifier",
"=",
"None",
",",
"max_concurrency",
"=",
"1",
",",
"timeout",
"=",
"None",
",",
"ephemeral_lease",
"=",
"False",
",",
"force",
"=",
"False",
",",
"# foricble get the lock regardles... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | unlock | Remove lease from semaphore
path
The path in zookeeper where the lock is
zk_hosts
zookeeper connect string
identifier
Name to identify this minion, if unspecified defaults to hostname
max_concurrency
Maximum number of lock holders
timeout
timeout to wait ... | salt/modules/zk_concurrency.py | def unlock(path,
zk_hosts=None, # in case you need to unlock without having run lock (failed execution for example)
identifier=None,
max_concurrency=1,
ephemeral_lease=False,
scheme=None,
profile=None,
username=None,
password=None,... | def unlock(path,
zk_hosts=None, # in case you need to unlock without having run lock (failed execution for example)
identifier=None,
max_concurrency=1,
ephemeral_lease=False,
scheme=None,
profile=None,
username=None,
password=None,... | [
"Remove",
"lease",
"from",
"semaphore"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zk_concurrency.py#L267-L320 | [
"def",
"unlock",
"(",
"path",
",",
"zk_hosts",
"=",
"None",
",",
"# in case you need to unlock without having run lock (failed execution for example)",
"identifier",
"=",
"None",
",",
"max_concurrency",
"=",
"1",
",",
"ephemeral_lease",
"=",
"False",
",",
"scheme",
"=",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | party_members | Get the List of identifiers in a particular party, optionally waiting for the
specified minimum number of nodes (min_nodes) to appear
path
The path in zookeeper where the lock is
zk_hosts
zookeeper connect string
min_nodes
The minimum number of nodes expected to be present in ... | salt/modules/zk_concurrency.py | def party_members(path,
zk_hosts=None,
min_nodes=1,
blocking=False,
profile=None,
scheme=None,
username=None,
password=None,
default_acl=None,
):
'''
... | def party_members(path,
zk_hosts=None,
min_nodes=1,
blocking=False,
profile=None,
scheme=None,
username=None,
password=None,
default_acl=None,
):
'''
... | [
"Get",
"the",
"List",
"of",
"identifiers",
"in",
"a",
"particular",
"party",
"optionally",
"waiting",
"for",
"the",
"specified",
"minimum",
"number",
"of",
"nodes",
"(",
"min_nodes",
")",
"to",
"appear"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zk_concurrency.py#L323-L364 | [
"def",
"party_members",
"(",
"path",
",",
"zk_hosts",
"=",
"None",
",",
"min_nodes",
"=",
"1",
",",
"blocking",
"=",
"False",
",",
"profile",
"=",
"None",
",",
"scheme",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"d... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _default_logfile | Retrieve the logfile name | salt/modules/chef.py | def _default_logfile(exe_name):
'''
Retrieve the logfile name
'''
if salt.utils.platform.is_windows():
tmp_dir = os.path.join(__opts__['cachedir'], 'tmp')
if not os.path.isdir(tmp_dir):
os.mkdir(tmp_dir)
logfile_tmp = tempfile.NamedTemporaryFile(dir=tmp_dir,
... | def _default_logfile(exe_name):
'''
Retrieve the logfile name
'''
if salt.utils.platform.is_windows():
tmp_dir = os.path.join(__opts__['cachedir'], 'tmp')
if not os.path.isdir(tmp_dir):
os.mkdir(tmp_dir)
logfile_tmp = tempfile.NamedTemporaryFile(dir=tmp_dir,
... | [
"Retrieve",
"the",
"logfile",
"name"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/chef.py#L32-L52 | [
"def",
"_default_logfile",
"(",
"exe_name",
")",
":",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"tmp_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'cachedir'",
"]",
",",
"'tmp'",
")",
"if",
"no... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | client | Execute a chef client run and return a dict with the stderr, stdout,
return code, and pid.
CLI Example:
.. code-block:: bash
salt '*' chef.client server=https://localhost
server
The chef server URL
client_key
Set the client key file location
config
The confi... | salt/modules/chef.py | def client(whyrun=False,
localmode=False,
logfile=None,
**kwargs):
'''
Execute a chef client run and return a dict with the stderr, stdout,
return code, and pid.
CLI Example:
.. code-block:: bash
salt '*' chef.client server=https://localhost
server
... | def client(whyrun=False,
localmode=False,
logfile=None,
**kwargs):
'''
Execute a chef client run and return a dict with the stderr, stdout,
return code, and pid.
CLI Example:
.. code-block:: bash
salt '*' chef.client server=https://localhost
server
... | [
"Execute",
"a",
"chef",
"client",
"run",
"and",
"return",
"a",
"dict",
"with",
"the",
"stderr",
"stdout",
"return",
"code",
"and",
"pid",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/chef.py#L56-L141 | [
"def",
"client",
"(",
"whyrun",
"=",
"False",
",",
"localmode",
"=",
"False",
",",
"logfile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"logfile",
"is",
"None",
":",
"logfile",
"=",
"_default_logfile",
"(",
"'chef-client'",
")",
"args",
"="... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | solo | Execute a chef solo run and return a dict with the stderr, stdout,
return code, and pid.
CLI Example:
.. code-block:: bash
salt '*' chef.solo override-runlist=test
config
The configuration file to use
environment
Set the Chef Environment on the node
group
Gr... | salt/modules/chef.py | def solo(whyrun=False,
logfile=None,
**kwargs):
'''
Execute a chef solo run and return a dict with the stderr, stdout,
return code, and pid.
CLI Example:
.. code-block:: bash
salt '*' chef.solo override-runlist=test
config
The configuration file to use
... | def solo(whyrun=False,
logfile=None,
**kwargs):
'''
Execute a chef solo run and return a dict with the stderr, stdout,
return code, and pid.
CLI Example:
.. code-block:: bash
salt '*' chef.solo override-runlist=test
config
The configuration file to use
... | [
"Execute",
"a",
"chef",
"solo",
"run",
"and",
"return",
"a",
"dict",
"with",
"the",
"stderr",
"stdout",
"return",
"code",
"and",
"pid",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/chef.py#L145-L206 | [
"def",
"solo",
"(",
"whyrun",
"=",
"False",
",",
"logfile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"logfile",
"is",
"None",
":",
"logfile",
"=",
"_default_logfile",
"(",
"'chef-solo'",
")",
"args",
"=",
"[",
"'chef-solo'",
",",
"'--no-co... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | frame_msg | Frame the given message with our wire protocol | salt/transport/frame.py | def frame_msg(body, header=None, raw_body=False): # pylint: disable=unused-argument
'''
Frame the given message with our wire protocol
'''
framed_msg = {}
if header is None:
header = {}
framed_msg['head'] = header
framed_msg['body'] = body
return salt.utils.msgpack.dumps(framed... | def frame_msg(body, header=None, raw_body=False): # pylint: disable=unused-argument
'''
Frame the given message with our wire protocol
'''
framed_msg = {}
if header is None:
header = {}
framed_msg['head'] = header
framed_msg['body'] = body
return salt.utils.msgpack.dumps(framed... | [
"Frame",
"the",
"given",
"message",
"with",
"our",
"wire",
"protocol"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/frame.py#L11-L21 | [
"def",
"frame_msg",
"(",
"body",
",",
"header",
"=",
"None",
",",
"raw_body",
"=",
"False",
")",
":",
"# pylint: disable=unused-argument",
"framed_msg",
"=",
"{",
"}",
"if",
"header",
"is",
"None",
":",
"header",
"=",
"{",
"}",
"framed_msg",
"[",
"'head'",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | frame_msg_ipc | Frame the given message with our wire protocol for IPC
For IPC, we don't need to be backwards compatible, so
use the more efficient "use_bin_type=True" on Python 3. | salt/transport/frame.py | def frame_msg_ipc(body, header=None, raw_body=False): # pylint: disable=unused-argument
'''
Frame the given message with our wire protocol for IPC
For IPC, we don't need to be backwards compatible, so
use the more efficient "use_bin_type=True" on Python 3.
'''
framed_msg = {}
if header is ... | def frame_msg_ipc(body, header=None, raw_body=False): # pylint: disable=unused-argument
'''
Frame the given message with our wire protocol for IPC
For IPC, we don't need to be backwards compatible, so
use the more efficient "use_bin_type=True" on Python 3.
'''
framed_msg = {}
if header is ... | [
"Frame",
"the",
"given",
"message",
"with",
"our",
"wire",
"protocol",
"for",
"IPC"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/frame.py#L24-L40 | [
"def",
"frame_msg_ipc",
"(",
"body",
",",
"header",
"=",
"None",
",",
"raw_body",
"=",
"False",
")",
":",
"# pylint: disable=unused-argument",
"framed_msg",
"=",
"{",
"}",
"if",
"header",
"is",
"None",
":",
"header",
"=",
"{",
"}",
"framed_msg",
"[",
"'hea... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _decode_embedded_list | Convert enbedded bytes to strings if possible.
List helper. | salt/transport/frame.py | def _decode_embedded_list(src):
'''
Convert enbedded bytes to strings if possible.
List helper.
'''
output = []
for elem in src:
if isinstance(elem, dict):
elem = _decode_embedded_dict(elem)
elif isinstance(elem, list):
elem = _decode_embedded_list(elem) ... | def _decode_embedded_list(src):
'''
Convert enbedded bytes to strings if possible.
List helper.
'''
output = []
for elem in src:
if isinstance(elem, dict):
elem = _decode_embedded_dict(elem)
elif isinstance(elem, list):
elem = _decode_embedded_list(elem) ... | [
"Convert",
"enbedded",
"bytes",
"to",
"strings",
"if",
"possible",
".",
"List",
"helper",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/frame.py#L43-L60 | [
"def",
"_decode_embedded_list",
"(",
"src",
")",
":",
"output",
"=",
"[",
"]",
"for",
"elem",
"in",
"src",
":",
"if",
"isinstance",
"(",
"elem",
",",
"dict",
")",
":",
"elem",
"=",
"_decode_embedded_dict",
"(",
"elem",
")",
"elif",
"isinstance",
"(",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _decode_embedded_dict | Convert enbedded bytes to strings if possible.
Dict helper. | salt/transport/frame.py | def _decode_embedded_dict(src):
'''
Convert enbedded bytes to strings if possible.
Dict helper.
'''
output = {}
for key, val in six.iteritems(src):
if isinstance(val, dict):
val = _decode_embedded_dict(val)
elif isinstance(val, list):
val = _decode_embedde... | def _decode_embedded_dict(src):
'''
Convert enbedded bytes to strings if possible.
Dict helper.
'''
output = {}
for key, val in six.iteritems(src):
if isinstance(val, dict):
val = _decode_embedded_dict(val)
elif isinstance(val, list):
val = _decode_embedde... | [
"Convert",
"enbedded",
"bytes",
"to",
"strings",
"if",
"possible",
".",
"Dict",
"helper",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/frame.py#L63-L85 | [
"def",
"_decode_embedded_dict",
"(",
"src",
")",
":",
"output",
"=",
"{",
"}",
"for",
"key",
",",
"val",
"in",
"six",
".",
"iteritems",
"(",
"src",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"dict",
")",
":",
"val",
"=",
"_decode_embedded_dict",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | decode_embedded_strs | Convert enbedded bytes to strings if possible.
This is necessary because Python 3 makes a distinction
between these types.
This wouldn't be needed if we used "use_bin_type=True" when encoding
and "encoding='utf-8'" when decoding. Unfortunately, this would break
backwards compatibility due to a chan... | salt/transport/frame.py | def decode_embedded_strs(src):
'''
Convert enbedded bytes to strings if possible.
This is necessary because Python 3 makes a distinction
between these types.
This wouldn't be needed if we used "use_bin_type=True" when encoding
and "encoding='utf-8'" when decoding. Unfortunately, this would brea... | def decode_embedded_strs(src):
'''
Convert enbedded bytes to strings if possible.
This is necessary because Python 3 makes a distinction
between these types.
This wouldn't be needed if we used "use_bin_type=True" when encoding
and "encoding='utf-8'" when decoding. Unfortunately, this would brea... | [
"Convert",
"enbedded",
"bytes",
"to",
"strings",
"if",
"possible",
".",
"This",
"is",
"necessary",
"because",
"Python",
"3",
"makes",
"a",
"distinction",
"between",
"these",
"types",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/frame.py#L88-L112 | [
"def",
"decode_embedded_strs",
"(",
"src",
")",
":",
"if",
"not",
"six",
".",
"PY3",
":",
"return",
"src",
"if",
"isinstance",
"(",
"src",
",",
"dict",
")",
":",
"return",
"_decode_embedded_dict",
"(",
"src",
")",
"elif",
"isinstance",
"(",
"src",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _validate_int | Validate the named integer within the supplied limits inclusive and
strip supplied unit characters | salt/states/disk.py | def _validate_int(name, value, limits=(), strip='%'):
'''
Validate the named integer within the supplied limits inclusive and
strip supplied unit characters
'''
comment = ''
# Must be integral
try:
if isinstance(value, string_types):
value = value.strip(' ' + strip)
... | def _validate_int(name, value, limits=(), strip='%'):
'''
Validate the named integer within the supplied limits inclusive and
strip supplied unit characters
'''
comment = ''
# Must be integral
try:
if isinstance(value, string_types):
value = value.strip(' ' + strip)
... | [
"Validate",
"the",
"named",
"integer",
"within",
"the",
"supplied",
"limits",
"inclusive",
"and",
"strip",
"supplied",
"unit",
"characters"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/disk.py#L57-L75 | [
"def",
"_validate_int",
"(",
"name",
",",
"value",
",",
"limits",
"=",
"(",
")",
",",
"strip",
"=",
"'%'",
")",
":",
"comment",
"=",
"''",
"# Must be integral",
"try",
":",
"if",
"isinstance",
"(",
"value",
",",
"string_types",
")",
":",
"value",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | status | Return the current disk usage stats for the named mount point
name
Disk mount or directory for which to check used space
maximum
The maximum disk utilization
minimum
The minimum disk utilization
absolute
By default, the utilization is measured in percentage. Set
... | salt/states/disk.py | def status(name, maximum=None, minimum=None, absolute=False, free=False):
'''
Return the current disk usage stats for the named mount point
name
Disk mount or directory for which to check used space
maximum
The maximum disk utilization
minimum
The minimum disk utilization
... | def status(name, maximum=None, minimum=None, absolute=False, free=False):
'''
Return the current disk usage stats for the named mount point
name
Disk mount or directory for which to check used space
maximum
The maximum disk utilization
minimum
The minimum disk utilization
... | [
"Return",
"the",
"current",
"disk",
"usage",
"stats",
"for",
"the",
"named",
"mount",
"point"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/disk.py#L154-L210 | [
"def",
"status",
"(",
"name",
",",
"maximum",
"=",
"None",
",",
"minimum",
"=",
"None",
",",
"absolute",
"=",
"False",
",",
"free",
"=",
"False",
")",
":",
"# Monitoring state, no changes will be made so no test interface needed",
"ret",
"=",
"{",
"'name'",
":",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | present | Verifies that the specified host is known by the specified user
On many systems, specifically those running with openssh 4 or older, the
``enc`` option must be set, only openssh 5 and above can detect the key
type.
name
The name of the remote host (e.g. "github.com")
Note that only a s... | salt/states/ssh_known_hosts.py | def present(
name,
user=None,
fingerprint=None,
key=None,
port=None,
enc=None,
config=None,
hash_known_hosts=True,
timeout=5,
fingerprint_hash_type=None):
'''
Verifies that the specified host is known by the specified user
On m... | def present(
name,
user=None,
fingerprint=None,
key=None,
port=None,
enc=None,
config=None,
hash_known_hosts=True,
timeout=5,
fingerprint_hash_type=None):
'''
Verifies that the specified host is known by the specified user
On m... | [
"Verifies",
"that",
"the",
"specified",
"host",
"is",
"known",
"by",
"the",
"specified",
"user"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ssh_known_hosts.py#L45-L191 | [
"def",
"present",
"(",
"name",
",",
"user",
"=",
"None",
",",
"fingerprint",
"=",
"None",
",",
"key",
"=",
"None",
",",
"port",
"=",
"None",
",",
"enc",
"=",
"None",
",",
"config",
"=",
"None",
",",
"hash_known_hosts",
"=",
"True",
",",
"timeout",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | absent | Verifies that the specified host is not known by the given user
name
The host name
Note that only single host names are supported. If foo.example.com
and bar.example.com are the same machine and you need to exclude both,
you will need one Salt state for each.
user
The ... | salt/states/ssh_known_hosts.py | def absent(name, user=None, config=None):
'''
Verifies that the specified host is not known by the given user
name
The host name
Note that only single host names are supported. If foo.example.com
and bar.example.com are the same machine and you need to exclude both,
you wil... | def absent(name, user=None, config=None):
'''
Verifies that the specified host is not known by the given user
name
The host name
Note that only single host names are supported. If foo.example.com
and bar.example.com are the same machine and you need to exclude both,
you wil... | [
"Verifies",
"that",
"the",
"specified",
"host",
"is",
"not",
"known",
"by",
"the",
"given",
"user"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ssh_known_hosts.py#L194-L245 | [
"def",
"absent",
"(",
"name",
",",
"user",
"=",
"None",
",",
"config",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"if",
"not",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | start_engines | Fire up the configured engines! | salt/engines/__init__.py | def start_engines(opts, proc_mgr, proxy=None):
'''
Fire up the configured engines!
'''
utils = salt.loader.utils(opts, proxy=proxy)
if opts['__role'] == 'master':
runners = salt.loader.runner(opts, utils=utils)
else:
runners = []
funcs = salt.loader.minion_mods(opts, utils=ut... | def start_engines(opts, proc_mgr, proxy=None):
'''
Fire up the configured engines!
'''
utils = salt.loader.utils(opts, proxy=proxy)
if opts['__role'] == 'master':
runners = salt.loader.runner(opts, utils=utils)
else:
runners = []
funcs = salt.loader.minion_mods(opts, utils=ut... | [
"Fire",
"up",
"the",
"configured",
"engines!"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/__init__.py#L20-L77 | [
"def",
"start_engines",
"(",
"opts",
",",
"proc_mgr",
",",
"proxy",
"=",
"None",
")",
":",
"utils",
"=",
"salt",
".",
"loader",
".",
"utils",
"(",
"opts",
",",
"proxy",
"=",
"proxy",
")",
"if",
"opts",
"[",
"'__role'",
"]",
"==",
"'master'",
":",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Engine.run | Run the master service! | salt/engines/__init__.py | def run(self):
'''
Run the master service!
'''
self.utils = salt.loader.utils(self.opts, proxy=self.proxy)
if salt.utils.platform.is_windows():
# Calculate function references since they can't be pickled.
if self.opts['__role'] == 'master':
... | def run(self):
'''
Run the master service!
'''
self.utils = salt.loader.utils(self.opts, proxy=self.proxy)
if salt.utils.platform.is_windows():
# Calculate function references since they can't be pickled.
if self.opts['__role'] == 'master':
... | [
"Run",
"the",
"master",
"service!"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/__init__.py#L124-L149 | [
"def",
"run",
"(",
"self",
")",
":",
"self",
".",
"utils",
"=",
"salt",
".",
"loader",
".",
"utils",
"(",
"self",
".",
"opts",
",",
"proxy",
"=",
"self",
".",
"proxy",
")",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | targets | Return the targets from a range query | salt/roster/range.py | def targets(tgt, tgt_type='range', **kwargs):
'''
Return the targets from a range query
'''
r = seco.range.Range(__opts__['range_server'])
log.debug('Range connection to \'%s\' established', __opts__['range_server'])
hosts = []
try:
log.debug('Querying range for \'%s\'', tgt)
... | def targets(tgt, tgt_type='range', **kwargs):
'''
Return the targets from a range query
'''
r = seco.range.Range(__opts__['range_server'])
log.debug('Range connection to \'%s\' established', __opts__['range_server'])
hosts = []
try:
log.debug('Querying range for \'%s\'', tgt)
... | [
"Return",
"the",
"targets",
"from",
"a",
"range",
"query"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/range.py#L35-L66 | [
"def",
"targets",
"(",
"tgt",
",",
"tgt_type",
"=",
"'range'",
",",
"*",
"*",
"kwargs",
")",
":",
"r",
"=",
"seco",
".",
"range",
".",
"Range",
"(",
"__opts__",
"[",
"'range_server'",
"]",
")",
"log",
".",
"debug",
"(",
"'Range connection to \\'%s\\' est... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _auth | returns a authentication handler. | salt/modules/modjk.py | def _auth(url, user, passwd, realm):
'''
returns a authentication handler.
'''
basic = _HTTPBasicAuthHandler()
basic.add_password(realm=realm, uri=url, user=user, passwd=passwd)
digest = _HTTPDigestAuthHandler()
digest.add_password(realm=realm, uri=url, user=user, passwd=passwd)
return ... | def _auth(url, user, passwd, realm):
'''
returns a authentication handler.
'''
basic = _HTTPBasicAuthHandler()
basic.add_password(realm=realm, uri=url, user=user, passwd=passwd)
digest = _HTTPDigestAuthHandler()
digest.add_password(realm=realm, uri=url, user=user, passwd=passwd)
return ... | [
"returns",
"a",
"authentication",
"handler",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L56-L65 | [
"def",
"_auth",
"(",
"url",
",",
"user",
",",
"passwd",
",",
"realm",
")",
":",
"basic",
"=",
"_HTTPBasicAuthHandler",
"(",
")",
"basic",
".",
"add_password",
"(",
"realm",
"=",
"realm",
",",
"uri",
"=",
"url",
",",
"user",
"=",
"user",
",",
"passwd"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _do_http | Make the http request and return the data | salt/modules/modjk.py | def _do_http(opts, profile='default'):
'''
Make the http request and return the data
'''
ret = {}
url = __salt__['config.get']('modjk:{0}:url'.format(profile), '')
user = __salt__['config.get']('modjk:{0}:user'.format(profile), '')
passwd = __salt__['config.get']('modjk:{0}:pass'.format(pr... | def _do_http(opts, profile='default'):
'''
Make the http request and return the data
'''
ret = {}
url = __salt__['config.get']('modjk:{0}:url'.format(profile), '')
user = __salt__['config.get']('modjk:{0}:user'.format(profile), '')
passwd = __salt__['config.get']('modjk:{0}:pass'.format(pr... | [
"Make",
"the",
"http",
"request",
"and",
"return",
"the",
"data"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L68-L97 | [
"def",
"_do_http",
"(",
"opts",
",",
"profile",
"=",
"'default'",
")",
":",
"ret",
"=",
"{",
"}",
"url",
"=",
"__salt__",
"[",
"'config.get'",
"]",
"(",
"'modjk:{0}:url'",
".",
"format",
"(",
"profile",
")",
",",
"''",
")",
"user",
"=",
"__salt__",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _worker_ctl | enable/disable/stop a worker | salt/modules/modjk.py | def _worker_ctl(worker, lbn, vwa, profile='default'):
'''
enable/disable/stop a worker
'''
cmd = {
'cmd': 'update',
'mime': 'prop',
'w': lbn,
'sw': worker,
'vwa': vwa,
}
return _do_http(cmd, profile)['worker.result.type'] == 'OK' | def _worker_ctl(worker, lbn, vwa, profile='default'):
'''
enable/disable/stop a worker
'''
cmd = {
'cmd': 'update',
'mime': 'prop',
'w': lbn,
'sw': worker,
'vwa': vwa,
}
return _do_http(cmd, profile)['worker.result.type'] == 'OK' | [
"enable",
"/",
"disable",
"/",
"stop",
"a",
"worker"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L100-L112 | [
"def",
"_worker_ctl",
"(",
"worker",
",",
"lbn",
",",
"vwa",
",",
"profile",
"=",
"'default'",
")",
":",
"cmd",
"=",
"{",
"'cmd'",
":",
"'update'",
",",
"'mime'",
":",
"'prop'",
",",
"'w'",
":",
"lbn",
",",
"'sw'",
":",
"worker",
",",
"'vwa'",
":",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_configured_members | Return a list of member workers from the configuration files
CLI Examples:
.. code-block:: bash
salt '*' modjk.list_configured_members loadbalancer1
salt '*' modjk.list_configured_members loadbalancer1 other-profile | salt/modules/modjk.py | def list_configured_members(lbn, profile='default'):
'''
Return a list of member workers from the configuration files
CLI Examples:
.. code-block:: bash
salt '*' modjk.list_configured_members loadbalancer1
salt '*' modjk.list_configured_members loadbalancer1 other-profile
'''
... | def list_configured_members(lbn, profile='default'):
'''
Return a list of member workers from the configuration files
CLI Examples:
.. code-block:: bash
salt '*' modjk.list_configured_members loadbalancer1
salt '*' modjk.list_configured_members loadbalancer1 other-profile
'''
... | [
"Return",
"a",
"list",
"of",
"member",
"workers",
"from",
"the",
"configuration",
"files"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L172-L191 | [
"def",
"list_configured_members",
"(",
"lbn",
",",
"profile",
"=",
"'default'",
")",
":",
"config",
"=",
"dump_config",
"(",
"profile",
")",
"try",
":",
"ret",
"=",
"config",
"[",
"'worker.{0}.balance_workers'",
".",
"format",
"(",
"lbn",
")",
"]",
"except",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | workers | Return a list of member workers and their status
CLI Examples:
.. code-block:: bash
salt '*' modjk.workers
salt '*' modjk.workers other-profile | salt/modules/modjk.py | def workers(profile='default'):
'''
Return a list of member workers and their status
CLI Examples:
.. code-block:: bash
salt '*' modjk.workers
salt '*' modjk.workers other-profile
'''
config = get_running(profile)
lbn = config['worker.list'].split(',')
worker_list = [... | def workers(profile='default'):
'''
Return a list of member workers and their status
CLI Examples:
.. code-block:: bash
salt '*' modjk.workers
salt '*' modjk.workers other-profile
'''
config = get_running(profile)
lbn = config['worker.list'].split(',')
worker_list = [... | [
"Return",
"a",
"list",
"of",
"member",
"workers",
"and",
"their",
"status"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L194-L227 | [
"def",
"workers",
"(",
"profile",
"=",
"'default'",
")",
":",
"config",
"=",
"get_running",
"(",
"profile",
")",
"lbn",
"=",
"config",
"[",
"'worker.list'",
"]",
".",
"split",
"(",
"','",
")",
"worker_list",
"=",
"[",
"]",
"ret",
"=",
"{",
"}",
"for"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | recover_all | Set the all the workers in lbn to recover and activate them if they are not
CLI Examples:
.. code-block:: bash
salt '*' modjk.recover_all loadbalancer1
salt '*' modjk.recover_all loadbalancer1 other-profile | salt/modules/modjk.py | def recover_all(lbn, profile='default'):
'''
Set the all the workers in lbn to recover and activate them if they are not
CLI Examples:
.. code-block:: bash
salt '*' modjk.recover_all loadbalancer1
salt '*' modjk.recover_all loadbalancer1 other-profile
'''
ret = {}
config ... | def recover_all(lbn, profile='default'):
'''
Set the all the workers in lbn to recover and activate them if they are not
CLI Examples:
.. code-block:: bash
salt '*' modjk.recover_all loadbalancer1
salt '*' modjk.recover_all loadbalancer1 other-profile
'''
ret = {}
config ... | [
"Set",
"the",
"all",
"the",
"workers",
"in",
"lbn",
"to",
"recover",
"and",
"activate",
"them",
"if",
"they",
"are",
"not"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L230-L257 | [
"def",
"recover_all",
"(",
"lbn",
",",
"profile",
"=",
"'default'",
")",
":",
"ret",
"=",
"{",
"}",
"config",
"=",
"get_running",
"(",
"profile",
")",
"try",
":",
"workers_",
"=",
"config",
"[",
"'worker.{0}.balance_workers'",
".",
"format",
"(",
"lbn",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | lb_edit | Edit the loadbalancer settings
Note: http://tomcat.apache.org/connectors-doc/reference/status.html
Data Parameters for the standard Update Action
CLI Examples:
.. code-block:: bash
salt '*' modjk.lb_edit loadbalancer1 "{'vlr': 1, 'vlt': 60}"
salt '*' modjk.lb_edit loadbalancer1 "{'vl... | salt/modules/modjk.py | def lb_edit(lbn, settings, profile='default'):
'''
Edit the loadbalancer settings
Note: http://tomcat.apache.org/connectors-doc/reference/status.html
Data Parameters for the standard Update Action
CLI Examples:
.. code-block:: bash
salt '*' modjk.lb_edit loadbalancer1 "{'vlr': 1, 'vl... | def lb_edit(lbn, settings, profile='default'):
'''
Edit the loadbalancer settings
Note: http://tomcat.apache.org/connectors-doc/reference/status.html
Data Parameters for the standard Update Action
CLI Examples:
.. code-block:: bash
salt '*' modjk.lb_edit loadbalancer1 "{'vlr': 1, 'vl... | [
"Edit",
"the",
"loadbalancer",
"settings"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L280-L299 | [
"def",
"lb_edit",
"(",
"lbn",
",",
"settings",
",",
"profile",
"=",
"'default'",
")",
":",
"settings",
"[",
"'cmd'",
"]",
"=",
"'update'",
"settings",
"[",
"'mime'",
"]",
"=",
"'prop'",
"settings",
"[",
"'w'",
"]",
"=",
"lbn",
"return",
"_do_http",
"("... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | bulk_stop | Stop all the given workers in the specific load balancer
CLI Examples:
.. code-block:: bash
salt '*' modjk.bulk_stop node1,node2,node3 loadbalancer1
salt '*' modjk.bulk_stop node1,node2,node3 loadbalancer1 other-profile
salt '*' modjk.bulk_stop ["node1","node2","node3"] loadbalancer1... | salt/modules/modjk.py | def bulk_stop(workers, lbn, profile='default'):
'''
Stop all the given workers in the specific load balancer
CLI Examples:
.. code-block:: bash
salt '*' modjk.bulk_stop node1,node2,node3 loadbalancer1
salt '*' modjk.bulk_stop node1,node2,node3 loadbalancer1 other-profile
salt... | def bulk_stop(workers, lbn, profile='default'):
'''
Stop all the given workers in the specific load balancer
CLI Examples:
.. code-block:: bash
salt '*' modjk.bulk_stop node1,node2,node3 loadbalancer1
salt '*' modjk.bulk_stop node1,node2,node3 loadbalancer1 other-profile
salt... | [
"Stop",
"all",
"the",
"given",
"workers",
"in",
"the",
"specific",
"load",
"balancer"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L302-L328 | [
"def",
"bulk_stop",
"(",
"workers",
",",
"lbn",
",",
"profile",
"=",
"'default'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"isinstance",
"(",
"workers",
",",
"six",
".",
"string_types",
")",
":",
"workers",
"=",
"workers",
".",
"split",
"(",
"','",
")",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | bulk_activate | Activate all the given workers in the specific load balancer
CLI Examples:
.. code-block:: bash
salt '*' modjk.bulk_activate node1,node2,node3 loadbalancer1
salt '*' modjk.bulk_activate node1,node2,node3 loadbalancer1 other-profile
salt '*' modjk.bulk_activate ["node1","node2","node3... | salt/modules/modjk.py | def bulk_activate(workers, lbn, profile='default'):
'''
Activate all the given workers in the specific load balancer
CLI Examples:
.. code-block:: bash
salt '*' modjk.bulk_activate node1,node2,node3 loadbalancer1
salt '*' modjk.bulk_activate node1,node2,node3 loadbalancer1 other-profi... | def bulk_activate(workers, lbn, profile='default'):
'''
Activate all the given workers in the specific load balancer
CLI Examples:
.. code-block:: bash
salt '*' modjk.bulk_activate node1,node2,node3 loadbalancer1
salt '*' modjk.bulk_activate node1,node2,node3 loadbalancer1 other-profi... | [
"Activate",
"all",
"the",
"given",
"workers",
"in",
"the",
"specific",
"load",
"balancer"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L331-L357 | [
"def",
"bulk_activate",
"(",
"workers",
",",
"lbn",
",",
"profile",
"=",
"'default'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"isinstance",
"(",
"workers",
",",
"six",
".",
"string_types",
")",
":",
"workers",
"=",
"workers",
".",
"split",
"(",
"','",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | bulk_disable | Disable all the given workers in the specific load balancer
CLI Examples:
.. code-block:: bash
salt '*' modjk.bulk_disable node1,node2,node3 loadbalancer1
salt '*' modjk.bulk_disable node1,node2,node3 loadbalancer1 other-profile
salt '*' modjk.bulk_disable ["node1","node2","node3"] l... | salt/modules/modjk.py | def bulk_disable(workers, lbn, profile='default'):
'''
Disable all the given workers in the specific load balancer
CLI Examples:
.. code-block:: bash
salt '*' modjk.bulk_disable node1,node2,node3 loadbalancer1
salt '*' modjk.bulk_disable node1,node2,node3 loadbalancer1 other-profile
... | def bulk_disable(workers, lbn, profile='default'):
'''
Disable all the given workers in the specific load balancer
CLI Examples:
.. code-block:: bash
salt '*' modjk.bulk_disable node1,node2,node3 loadbalancer1
salt '*' modjk.bulk_disable node1,node2,node3 loadbalancer1 other-profile
... | [
"Disable",
"all",
"the",
"given",
"workers",
"in",
"the",
"specific",
"load",
"balancer"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L360-L386 | [
"def",
"bulk_disable",
"(",
"workers",
",",
"lbn",
",",
"profile",
"=",
"'default'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"isinstance",
"(",
"workers",
",",
"six",
".",
"string_types",
")",
":",
"workers",
"=",
"workers",
".",
"split",
"(",
"','",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | bulk_recover | Recover all the given workers in the specific load balancer
CLI Examples:
.. code-block:: bash
salt '*' modjk.bulk_recover node1,node2,node3 loadbalancer1
salt '*' modjk.bulk_recover node1,node2,node3 loadbalancer1 other-profile
salt '*' modjk.bulk_recover ["node1","node2","node3"] l... | salt/modules/modjk.py | def bulk_recover(workers, lbn, profile='default'):
'''
Recover all the given workers in the specific load balancer
CLI Examples:
.. code-block:: bash
salt '*' modjk.bulk_recover node1,node2,node3 loadbalancer1
salt '*' modjk.bulk_recover node1,node2,node3 loadbalancer1 other-profile
... | def bulk_recover(workers, lbn, profile='default'):
'''
Recover all the given workers in the specific load balancer
CLI Examples:
.. code-block:: bash
salt '*' modjk.bulk_recover node1,node2,node3 loadbalancer1
salt '*' modjk.bulk_recover node1,node2,node3 loadbalancer1 other-profile
... | [
"Recover",
"all",
"the",
"given",
"workers",
"in",
"the",
"specific",
"load",
"balancer"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L389-L415 | [
"def",
"bulk_recover",
"(",
"workers",
",",
"lbn",
",",
"profile",
"=",
"'default'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"isinstance",
"(",
"workers",
",",
"six",
".",
"string_types",
")",
":",
"workers",
"=",
"workers",
".",
"split",
"(",
"','",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | worker_status | Return the state of the worker
CLI Examples:
.. code-block:: bash
salt '*' modjk.worker_status node1
salt '*' modjk.worker_status node1 other-profile | salt/modules/modjk.py | def worker_status(worker, profile='default'):
'''
Return the state of the worker
CLI Examples:
.. code-block:: bash
salt '*' modjk.worker_status node1
salt '*' modjk.worker_status node1 other-profile
'''
config = get_running(profile)
try:
return {
'act... | def worker_status(worker, profile='default'):
'''
Return the state of the worker
CLI Examples:
.. code-block:: bash
salt '*' modjk.worker_status node1
salt '*' modjk.worker_status node1 other-profile
'''
config = get_running(profile)
try:
return {
'act... | [
"Return",
"the",
"state",
"of",
"the",
"worker"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L418-L437 | [
"def",
"worker_status",
"(",
"worker",
",",
"profile",
"=",
"'default'",
")",
":",
"config",
"=",
"get_running",
"(",
"profile",
")",
"try",
":",
"return",
"{",
"'activation'",
":",
"config",
"[",
"'worker.{0}.activation'",
".",
"format",
"(",
"worker",
")",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | worker_recover | Set the worker to recover
this module will fail if it is in OK state
CLI Examples:
.. code-block:: bash
salt '*' modjk.worker_recover node1 loadbalancer1
salt '*' modjk.worker_recover node1 loadbalancer1 other-profile | salt/modules/modjk.py | def worker_recover(worker, lbn, profile='default'):
'''
Set the worker to recover
this module will fail if it is in OK state
CLI Examples:
.. code-block:: bash
salt '*' modjk.worker_recover node1 loadbalancer1
salt '*' modjk.worker_recover node1 loadbalancer1 other-profile
'''... | def worker_recover(worker, lbn, profile='default'):
'''
Set the worker to recover
this module will fail if it is in OK state
CLI Examples:
.. code-block:: bash
salt '*' modjk.worker_recover node1 loadbalancer1
salt '*' modjk.worker_recover node1 loadbalancer1 other-profile
'''... | [
"Set",
"the",
"worker",
"to",
"recover",
"this",
"module",
"will",
"fail",
"if",
"it",
"is",
"in",
"OK",
"state"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L440-L459 | [
"def",
"worker_recover",
"(",
"worker",
",",
"lbn",
",",
"profile",
"=",
"'default'",
")",
":",
"cmd",
"=",
"{",
"'cmd'",
":",
"'recover'",
",",
"'mime'",
":",
"'prop'",
",",
"'w'",
":",
"lbn",
",",
"'sw'",
":",
"worker",
",",
"}",
"return",
"_do_htt... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | worker_edit | Edit the worker settings
Note: http://tomcat.apache.org/connectors-doc/reference/status.html
Data Parameters for the standard Update Action
CLI Examples:
.. code-block:: bash
salt '*' modjk.worker_edit node1 loadbalancer1 "{'vwf': 500, 'vwd': 60}"
salt '*' modjk.worker_edit node1 loa... | salt/modules/modjk.py | def worker_edit(worker, lbn, settings, profile='default'):
'''
Edit the worker settings
Note: http://tomcat.apache.org/connectors-doc/reference/status.html
Data Parameters for the standard Update Action
CLI Examples:
.. code-block:: bash
salt '*' modjk.worker_edit node1 loadbalancer1... | def worker_edit(worker, lbn, settings, profile='default'):
'''
Edit the worker settings
Note: http://tomcat.apache.org/connectors-doc/reference/status.html
Data Parameters for the standard Update Action
CLI Examples:
.. code-block:: bash
salt '*' modjk.worker_edit node1 loadbalancer1... | [
"Edit",
"the",
"worker",
"settings"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L507-L527 | [
"def",
"worker_edit",
"(",
"worker",
",",
"lbn",
",",
"settings",
",",
"profile",
"=",
"'default'",
")",
":",
"settings",
"[",
"'cmd'",
"]",
"=",
"'update'",
"settings",
"[",
"'mime'",
"]",
"=",
"'prop'",
"settings",
"[",
"'w'",
"]",
"=",
"lbn",
"setti... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | build_info | Return server and build arguments
CLI Example:
.. code-block:: bash
salt '*' nginx.build_info | salt/modules/nginx.py | def build_info():
'''
Return server and build arguments
CLI Example:
.. code-block:: bash
salt '*' nginx.build_info
'''
ret = {'info': []}
out = __salt__['cmd.run']('{0} -V'.format(__detect_os()))
for i in out.splitlines():
if i.startswith('configure argument'):
... | def build_info():
'''
Return server and build arguments
CLI Example:
.. code-block:: bash
salt '*' nginx.build_info
'''
ret = {'info': []}
out = __salt__['cmd.run']('{0} -V'.format(__detect_os()))
for i in out.splitlines():
if i.startswith('configure argument'):
... | [
"Return",
"server",
"and",
"build",
"arguments"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nginx.py#L50-L70 | [
"def",
"build_info",
"(",
")",
":",
"ret",
"=",
"{",
"'info'",
":",
"[",
"]",
"}",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'{0} -V'",
".",
"format",
"(",
"__detect_os",
"(",
")",
")",
")",
"for",
"i",
"in",
"out",
".",
"splitlines",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | signal | Signals nginx to start, reload, reopen or stop.
CLI Example:
.. code-block:: bash
salt '*' nginx.signal reload | salt/modules/nginx.py | def signal(signal=None):
'''
Signals nginx to start, reload, reopen or stop.
CLI Example:
.. code-block:: bash
salt '*' nginx.signal reload
'''
valid_signals = ('start', 'reopen', 'stop', 'quit', 'reload')
if signal not in valid_signals:
return
# Make sure you use th... | def signal(signal=None):
'''
Signals nginx to start, reload, reopen or stop.
CLI Example:
.. code-block:: bash
salt '*' nginx.signal reload
'''
valid_signals = ('start', 'reopen', 'stop', 'quit', 'reload')
if signal not in valid_signals:
return
# Make sure you use th... | [
"Signals",
"nginx",
"to",
"start",
"reload",
"reopen",
"or",
"stop",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nginx.py#L102-L136 | [
"def",
"signal",
"(",
"signal",
"=",
"None",
")",
":",
"valid_signals",
"=",
"(",
"'start'",
",",
"'reopen'",
",",
"'stop'",
",",
"'quit'",
",",
"'reload'",
")",
"if",
"signal",
"not",
"in",
"valid_signals",
":",
"return",
"# Make sure you use the right argume... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | status | Return the data from an Nginx status page as a dictionary.
http://wiki.nginx.org/HttpStubStatusModule
url
The URL of the status page. Defaults to 'http://127.0.0.1/status'
CLI Example:
.. code-block:: bash
salt '*' nginx.status | salt/modules/nginx.py | def status(url="http://127.0.0.1/status"):
"""
Return the data from an Nginx status page as a dictionary.
http://wiki.nginx.org/HttpStubStatusModule
url
The URL of the status page. Defaults to 'http://127.0.0.1/status'
CLI Example:
.. code-block:: bash
salt '*' nginx.status
... | def status(url="http://127.0.0.1/status"):
"""
Return the data from an Nginx status page as a dictionary.
http://wiki.nginx.org/HttpStubStatusModule
url
The URL of the status page. Defaults to 'http://127.0.0.1/status'
CLI Example:
.. code-block:: bash
salt '*' nginx.status
... | [
"Return",
"the",
"data",
"from",
"an",
"Nginx",
"status",
"page",
"as",
"a",
"dictionary",
".",
"http",
":",
"//",
"wiki",
".",
"nginx",
".",
"org",
"/",
"HttpStubStatusModule"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nginx.py#L139-L175 | [
"def",
"status",
"(",
"url",
"=",
"\"http://127.0.0.1/status\"",
")",
":",
"resp",
"=",
"_urlopen",
"(",
"url",
")",
"status_data",
"=",
"resp",
".",
"read",
"(",
")",
"resp",
".",
"close",
"(",
")",
"lines",
"=",
"status_data",
".",
"splitlines",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | init | This function gets called when the proxy starts up. For
ESXi devices, the host, login credentials, and, if configured,
the protocol and port are cached. | salt/proxy/esxi.py | def init(opts):
'''
This function gets called when the proxy starts up. For
ESXi devices, the host, login credentials, and, if configured,
the protocol and port are cached.
'''
log.debug('Initting esxi proxy module in process %s', os.getpid())
log.debug('Validating esxi proxy input')
sch... | def init(opts):
'''
This function gets called when the proxy starts up. For
ESXi devices, the host, login credentials, and, if configured,
the protocol and port are cached.
'''
log.debug('Initting esxi proxy module in process %s', os.getpid())
log.debug('Validating esxi proxy input')
sch... | [
"This",
"function",
"gets",
"called",
"when",
"the",
"proxy",
"starts",
"up",
".",
"For",
"ESXi",
"devices",
"the",
"host",
"login",
"credentials",
"and",
"if",
"configured",
"the",
"protocol",
"and",
"port",
"are",
"cached",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/esxi.py#L314-L414 | [
"def",
"init",
"(",
"opts",
")",
":",
"log",
".",
"debug",
"(",
"'Initting esxi proxy module in process %s'",
",",
"os",
".",
"getpid",
"(",
")",
")",
"log",
".",
"debug",
"(",
"'Validating esxi proxy input'",
")",
"schema",
"=",
"EsxiProxySchema",
".",
"seria... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ping | Returns True if connection is to be done via a vCenter (no connection is attempted).
Check to see if the host is responding when connecting directly via an ESXi
host.
CLI Example:
.. code-block:: bash
salt esxi-host test.ping | salt/proxy/esxi.py | def ping():
'''
Returns True if connection is to be done via a vCenter (no connection is attempted).
Check to see if the host is responding when connecting directly via an ESXi
host.
CLI Example:
.. code-block:: bash
salt esxi-host test.ping
'''
if DETAILS.get('esxi_host'):
... | def ping():
'''
Returns True if connection is to be done via a vCenter (no connection is attempted).
Check to see if the host is responding when connecting directly via an ESXi
host.
CLI Example:
.. code-block:: bash
salt esxi-host test.ping
'''
if DETAILS.get('esxi_host'):
... | [
"Returns",
"True",
"if",
"connection",
"is",
"to",
"be",
"done",
"via",
"a",
"vCenter",
"(",
"no",
"connection",
"is",
"attempted",
")",
".",
"Check",
"to",
"see",
"if",
"the",
"host",
"is",
"responding",
"when",
"connecting",
"directly",
"via",
"an",
"E... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/esxi.py#L436-L461 | [
"def",
"ping",
"(",
")",
":",
"if",
"DETAILS",
".",
"get",
"(",
"'esxi_host'",
")",
":",
"return",
"True",
"else",
":",
"# TODO Check connection if mechanism is SSPI",
"if",
"DETAILS",
"[",
"'mechanism'",
"]",
"==",
"'userpass'",
":",
"find_credentials",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ch_config | This function is called by the
:mod:`salt.modules.esxi.cmd <salt.modules.esxi.cmd>` shim.
It then calls whatever is passed in ``cmd`` inside the
:mod:`salt.modules.vsphere <salt.modules.vsphere>` module.
Passes the return through from the vsphere module.
cmd
The command to call inside salt.... | salt/proxy/esxi.py | def ch_config(cmd, *args, **kwargs):
'''
This function is called by the
:mod:`salt.modules.esxi.cmd <salt.modules.esxi.cmd>` shim.
It then calls whatever is passed in ``cmd`` inside the
:mod:`salt.modules.vsphere <salt.modules.vsphere>` module.
Passes the return through from the vsphere module.
... | def ch_config(cmd, *args, **kwargs):
'''
This function is called by the
:mod:`salt.modules.esxi.cmd <salt.modules.esxi.cmd>` shim.
It then calls whatever is passed in ``cmd`` inside the
:mod:`salt.modules.vsphere <salt.modules.vsphere>` module.
Passes the return through from the vsphere module.
... | [
"This",
"function",
"is",
"called",
"by",
"the",
":",
"mod",
":",
"salt",
".",
"modules",
".",
"esxi",
".",
"cmd",
"<salt",
".",
"modules",
".",
"esxi",
".",
"cmd",
">",
"shim",
".",
"It",
"then",
"calls",
"whatever",
"is",
"passed",
"in",
"cmd",
"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/esxi.py#L472-L505 | [
"def",
"ch_config",
"(",
"cmd",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Strip the __pub_ keys...is there a better way to do this?",
"for",
"k",
"in",
"kwargs",
":",
"if",
"k",
".",
"startswith",
"(",
"'__pub_'",
")",
":",
"kwargs",
".",
"pop"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | find_credentials | Cycle through all the possible credentials and return the first one that
works. | salt/proxy/esxi.py | def find_credentials(host):
'''
Cycle through all the possible credentials and return the first one that
works.
'''
user_names = [__pillar__['proxy'].get('username', 'root')]
passwords = __pillar__['proxy']['passwords']
for user in user_names:
for password in passwords:
t... | def find_credentials(host):
'''
Cycle through all the possible credentials and return the first one that
works.
'''
user_names = [__pillar__['proxy'].get('username', 'root')]
passwords = __pillar__['proxy']['passwords']
for user in user_names:
for password in passwords:
t... | [
"Cycle",
"through",
"all",
"the",
"possible",
"credentials",
"and",
"return",
"the",
"first",
"one",
"that",
"works",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/esxi.py#L508-L531 | [
"def",
"find_credentials",
"(",
"host",
")",
":",
"user_names",
"=",
"[",
"__pillar__",
"[",
"'proxy'",
"]",
".",
"get",
"(",
"'username'",
",",
"'root'",
")",
"]",
"passwords",
"=",
"__pillar__",
"[",
"'proxy'",
"]",
"[",
"'passwords'",
"]",
"for",
"use... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _grains | Helper function to the grains from the proxied device. | salt/proxy/esxi.py | def _grains(host, protocol=None, port=None):
'''
Helper function to the grains from the proxied device.
'''
username, password = find_credentials(DETAILS['host'])
ret = __salt__['vsphere.system_info'](host=host,
username=username,
... | def _grains(host, protocol=None, port=None):
'''
Helper function to the grains from the proxied device.
'''
username, password = find_credentials(DETAILS['host'])
ret = __salt__['vsphere.system_info'](host=host,
username=username,
... | [
"Helper",
"function",
"to",
"the",
"grains",
"from",
"the",
"proxied",
"device",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/esxi.py#L534-L545 | [
"def",
"_grains",
"(",
"host",
",",
"protocol",
"=",
"None",
",",
"port",
"=",
"None",
")",
":",
"username",
",",
"password",
"=",
"find_credentials",
"(",
"DETAILS",
"[",
"'host'",
"]",
")",
"ret",
"=",
"__salt__",
"[",
"'vsphere.system_info'",
"]",
"("... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | post_message | Send a message to a Telegram chat.
:param message: The message to send to the Telegram chat.
:param chat_id: (optional) The Telegram chat id.
:param token: (optional) The Telegram API token.
:return: Boolean if message was sent successfully.
CLI Example:
.. code-block:: bash
... | salt/modules/telegram.py | def post_message(message, chat_id=None, token=None):
'''
Send a message to a Telegram chat.
:param message: The message to send to the Telegram chat.
:param chat_id: (optional) The Telegram chat id.
:param token: (optional) The Telegram API token.
:return: Boolean if message was sent s... | def post_message(message, chat_id=None, token=None):
'''
Send a message to a Telegram chat.
:param message: The message to send to the Telegram chat.
:param chat_id: (optional) The Telegram chat id.
:param token: (optional) The Telegram API token.
:return: Boolean if message was sent s... | [
"Send",
"a",
"message",
"to",
"a",
"Telegram",
"chat",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/telegram.py#L71-L97 | [
"def",
"post_message",
"(",
"message",
",",
"chat_id",
"=",
"None",
",",
"token",
"=",
"None",
")",
":",
"if",
"not",
"chat_id",
":",
"chat_id",
"=",
"_get_chat_id",
"(",
")",
"if",
"not",
"token",
":",
"token",
"=",
"_get_token",
"(",
")",
"if",
"no... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _post_message | Send a message to a Telegram chat.
:param chat_id: The chat id.
:param message: The message to send to the telegram chat.
:param token: The Telegram API token.
:return: Boolean if message was sent successfully. | salt/modules/telegram.py | def _post_message(message, chat_id, token):
'''
Send a message to a Telegram chat.
:param chat_id: The chat id.
:param message: The message to send to the telegram chat.
:param token: The Telegram API token.
:return: Boolean if message was sent successfully.
'''
... | def _post_message(message, chat_id, token):
'''
Send a message to a Telegram chat.
:param chat_id: The chat id.
:param message: The message to send to the telegram chat.
:param token: The Telegram API token.
:return: Boolean if message was sent successfully.
'''
... | [
"Send",
"a",
"message",
"to",
"a",
"Telegram",
"chat",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/telegram.py#L100-L140 | [
"def",
"_post_message",
"(",
"message",
",",
"chat_id",
",",
"token",
")",
":",
"url",
"=",
"'https://api.telegram.org/bot{0}/sendMessage'",
".",
"format",
"(",
"token",
")",
"parameters",
"=",
"dict",
"(",
")",
"if",
"chat_id",
":",
"parameters",
"[",
"'chat_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | targets | Return the targets from the ansible inventory_file
Default: /etc/salt/roster | salt/roster/ansible.py | def targets(tgt, tgt_type='glob', **kwargs):
'''
Return the targets from the ansible inventory_file
Default: /etc/salt/roster
'''
inventory = __runner__['salt.cmd']('cmd.run', 'ansible-inventory -i {0} --list'.format(get_roster_file(__opts__)))
__context__['inventory'] = __utils__['json.loads'](... | def targets(tgt, tgt_type='glob', **kwargs):
'''
Return the targets from the ansible inventory_file
Default: /etc/salt/roster
'''
inventory = __runner__['salt.cmd']('cmd.run', 'ansible-inventory -i {0} --list'.format(get_roster_file(__opts__)))
__context__['inventory'] = __utils__['json.loads'](... | [
"Return",
"the",
"targets",
"from",
"the",
"ansible",
"inventory_file",
"Default",
":",
"/",
"etc",
"/",
"salt",
"/",
"roster"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/ansible.py#L115-L127 | [
"def",
"targets",
"(",
"tgt",
",",
"tgt_type",
"=",
"'glob'",
",",
"*",
"*",
"kwargs",
")",
":",
"inventory",
"=",
"__runner__",
"[",
"'salt.cmd'",
"]",
"(",
"'cmd.run'",
",",
"'ansible-inventory -i {0} --list'",
".",
"format",
"(",
"get_roster_file",
"(",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_ | Set a key/value pair in the cache service | salt/sdb/cache.py | def set_(key, value, service=None, profile=None): # pylint: disable=W0613
'''
Set a key/value pair in the cache service
'''
key, profile = _parse_key(key, profile)
cache = salt.cache.Cache(__opts__)
cache.store(profile['bank'], key, value)
return get(key, service, profile) | def set_(key, value, service=None, profile=None): # pylint: disable=W0613
'''
Set a key/value pair in the cache service
'''
key, profile = _parse_key(key, profile)
cache = salt.cache.Cache(__opts__)
cache.store(profile['bank'], key, value)
return get(key, service, profile) | [
"Set",
"a",
"key",
"/",
"value",
"pair",
"in",
"the",
"cache",
"service"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/cache.py#L66-L73 | [
"def",
"set_",
"(",
"key",
",",
"value",
",",
"service",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"# pylint: disable=W0613",
"key",
",",
"profile",
"=",
"_parse_key",
"(",
"key",
",",
"profile",
")",
"cache",
"=",
"salt",
".",
"cache",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get | Get a value from the cache service | salt/sdb/cache.py | def get(key, service=None, profile=None): # pylint: disable=W0613
'''
Get a value from the cache service
'''
key, profile = _parse_key(key, profile)
cache = salt.cache.Cache(__opts__)
return cache.fetch(profile['bank'], key=key) | def get(key, service=None, profile=None): # pylint: disable=W0613
'''
Get a value from the cache service
'''
key, profile = _parse_key(key, profile)
cache = salt.cache.Cache(__opts__)
return cache.fetch(profile['bank'], key=key) | [
"Get",
"a",
"value",
"from",
"the",
"cache",
"service"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/cache.py#L76-L82 | [
"def",
"get",
"(",
"key",
",",
"service",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"# pylint: disable=W0613",
"key",
",",
"profile",
"=",
"_parse_key",
"(",
"key",
",",
"profile",
")",
"cache",
"=",
"salt",
".",
"cache",
".",
"Cache",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete | Get a value from the cache service | salt/sdb/cache.py | def delete(key, service=None, profile=None): # pylint: disable=W0613
'''
Get a value from the cache service
'''
key, profile = _parse_key(key, profile)
cache = salt.cache.Cache(__opts__)
try:
cache.flush(profile['bank'], key=key)
return True
except Exception:
return ... | def delete(key, service=None, profile=None): # pylint: disable=W0613
'''
Get a value from the cache service
'''
key, profile = _parse_key(key, profile)
cache = salt.cache.Cache(__opts__)
try:
cache.flush(profile['bank'], key=key)
return True
except Exception:
return ... | [
"Get",
"a",
"value",
"from",
"the",
"cache",
"service"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/cache.py#L85-L95 | [
"def",
"delete",
"(",
"key",
",",
"service",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"# pylint: disable=W0613",
"key",
",",
"profile",
"=",
"_parse_key",
"(",
"key",
",",
"profile",
")",
"cache",
"=",
"salt",
".",
"cache",
".",
"Cache",
"("... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_key | Parse out a key and update the opts with any override data | salt/sdb/cache.py | def _parse_key(key, profile):
'''
Parse out a key and update the opts with any override data
'''
comps = key.split('?')
if len(comps) > 1:
for item in comps[1].split('&'):
newkey, newval = item.split('=')
profile[newkey] = newval
if 'cachedir' in profile:
... | def _parse_key(key, profile):
'''
Parse out a key and update the opts with any override data
'''
comps = key.split('?')
if len(comps) > 1:
for item in comps[1].split('&'):
newkey, newval = item.split('=')
profile[newkey] = newval
if 'cachedir' in profile:
... | [
"Parse",
"out",
"a",
"key",
"and",
"update",
"the",
"opts",
"with",
"any",
"override",
"data"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/cache.py#L98-L109 | [
"def",
"_parse_key",
"(",
"key",
",",
"profile",
")",
":",
"comps",
"=",
"key",
".",
"split",
"(",
"'?'",
")",
"if",
"len",
"(",
"comps",
")",
">",
"1",
":",
"for",
"item",
"in",
"comps",
"[",
"1",
"]",
".",
"split",
"(",
"'&'",
")",
":",
"ne... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _redis_client | Connect to the redis host and return a StrictRedisCluster client object.
If connection fails then return None. | salt/tokens/rediscluster.py | def _redis_client(opts):
'''
Connect to the redis host and return a StrictRedisCluster client object.
If connection fails then return None.
'''
redis_host = opts.get("eauth_redis_host", "localhost")
redis_port = opts.get("eauth_redis_port", 6379)
try:
return rediscluster.StrictRedisC... | def _redis_client(opts):
'''
Connect to the redis host and return a StrictRedisCluster client object.
If connection fails then return None.
'''
redis_host = opts.get("eauth_redis_host", "localhost")
redis_port = opts.get("eauth_redis_port", 6379)
try:
return rediscluster.StrictRedisC... | [
"Connect",
"to",
"the",
"redis",
"host",
"and",
"return",
"a",
"StrictRedisCluster",
"client",
"object",
".",
"If",
"connection",
"fails",
"then",
"return",
"None",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/tokens/rediscluster.py#L48-L62 | [
"def",
"_redis_client",
"(",
"opts",
")",
":",
"redis_host",
"=",
"opts",
".",
"get",
"(",
"\"eauth_redis_host\"",
",",
"\"localhost\"",
")",
"redis_port",
"=",
"opts",
".",
"get",
"(",
"\"eauth_redis_port\"",
",",
"6379",
")",
"try",
":",
"return",
"rediscl... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | mk_token | Mint a new token using the config option hash_type and store tdata with 'token' attribute set
to the token.
This module uses the hash of random 512 bytes as a token.
:param opts: Salt master config options
:param tdata: Token data to be stored with 'token' attirbute of this dict set to the token.
:... | salt/tokens/rediscluster.py | def mk_token(opts, tdata):
'''
Mint a new token using the config option hash_type and store tdata with 'token' attribute set
to the token.
This module uses the hash of random 512 bytes as a token.
:param opts: Salt master config options
:param tdata: Token data to be stored with 'token' attirbu... | def mk_token(opts, tdata):
'''
Mint a new token using the config option hash_type and store tdata with 'token' attribute set
to the token.
This module uses the hash of random 512 bytes as a token.
:param opts: Salt master config options
:param tdata: Token data to be stored with 'token' attirbu... | [
"Mint",
"a",
"new",
"token",
"using",
"the",
"config",
"option",
"hash_type",
"and",
"store",
"tdata",
"with",
"token",
"attribute",
"set",
"to",
"the",
"token",
".",
"This",
"module",
"uses",
"the",
"hash",
"of",
"random",
"512",
"bytes",
"as",
"a",
"to... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/tokens/rediscluster.py#L65-L99 | [
"def",
"mk_token",
"(",
"opts",
",",
"tdata",
")",
":",
"redis_client",
"=",
"_redis_client",
"(",
"opts",
")",
"if",
"not",
"redis_client",
":",
"return",
"{",
"}",
"hash_type",
"=",
"getattr",
"(",
"hashlib",
",",
"opts",
".",
"get",
"(",
"'hash_type'"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_token | Fetch the token data from the store.
:param opts: Salt master config options
:param tok: Token value to get
:returns: Token data if successful. Empty dict if failed. | salt/tokens/rediscluster.py | def get_token(opts, tok):
'''
Fetch the token data from the store.
:param opts: Salt master config options
:param tok: Token value to get
:returns: Token data if successful. Empty dict if failed.
'''
redis_client = _redis_client(opts)
if not redis_client:
return {}
serial = ... | def get_token(opts, tok):
'''
Fetch the token data from the store.
:param opts: Salt master config options
:param tok: Token value to get
:returns: Token data if successful. Empty dict if failed.
'''
redis_client = _redis_client(opts)
if not redis_client:
return {}
serial = ... | [
"Fetch",
"the",
"token",
"data",
"from",
"the",
"store",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/tokens/rediscluster.py#L102-L122 | [
"def",
"get_token",
"(",
"opts",
",",
"tok",
")",
":",
"redis_client",
"=",
"_redis_client",
"(",
"opts",
")",
"if",
"not",
"redis_client",
":",
"return",
"{",
"}",
"serial",
"=",
"salt",
".",
"payload",
".",
"Serial",
"(",
"opts",
")",
"try",
":",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | rm_token | Remove token from the store.
:param opts: Salt master config options
:param tok: Token to remove
:returns: Empty dict if successful. None if failed. | salt/tokens/rediscluster.py | def rm_token(opts, tok):
'''
Remove token from the store.
:param opts: Salt master config options
:param tok: Token to remove
:returns: Empty dict if successful. None if failed.
'''
redis_client = _redis_client(opts)
if not redis_client:
return
try:
redis_client.dele... | def rm_token(opts, tok):
'''
Remove token from the store.
:param opts: Salt master config options
:param tok: Token to remove
:returns: Empty dict if successful. None if failed.
'''
redis_client = _redis_client(opts)
if not redis_client:
return
try:
redis_client.dele... | [
"Remove",
"token",
"from",
"the",
"store",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/tokens/rediscluster.py#L125-L140 | [
"def",
"rm_token",
"(",
"opts",
",",
"tok",
")",
":",
"redis_client",
"=",
"_redis_client",
"(",
"opts",
")",
"if",
"not",
"redis_client",
":",
"return",
"try",
":",
"redis_client",
".",
"delete",
"(",
"tok",
")",
"return",
"{",
"}",
"except",
"Exception... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_tokens | List all tokens in the store.
:param opts: Salt master config options
:returns: List of dicts (token_data) | salt/tokens/rediscluster.py | def list_tokens(opts):
'''
List all tokens in the store.
:param opts: Salt master config options
:returns: List of dicts (token_data)
'''
ret = []
redis_client = _redis_client(opts)
if not redis_client:
return []
serial = salt.payload.Serial(opts)
try:
return [k.... | def list_tokens(opts):
'''
List all tokens in the store.
:param opts: Salt master config options
:returns: List of dicts (token_data)
'''
ret = []
redis_client = _redis_client(opts)
if not redis_client:
return []
serial = salt.payload.Serial(opts)
try:
return [k.... | [
"List",
"all",
"tokens",
"in",
"the",
"store",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/tokens/rediscluster.py#L143-L159 | [
"def",
"list_tokens",
"(",
"opts",
")",
":",
"ret",
"=",
"[",
"]",
"redis_client",
"=",
"_redis_client",
"(",
"opts",
")",
"if",
"not",
"redis_client",
":",
"return",
"[",
"]",
"serial",
"=",
"salt",
".",
"payload",
".",
"Serial",
"(",
"opts",
")",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | installed | Run the initial setup of wordpress
name
path to the wordpress installation
user
user that owns the files for the wordpress installation
admin_user
username for wordpress website administrator user
admin_password
password for wordpress website administrator user
a... | salt/states/wordpress.py | def installed(name, user, admin_user, admin_password, admin_email, title, url):
'''
Run the initial setup of wordpress
name
path to the wordpress installation
user
user that owns the files for the wordpress installation
admin_user
username for wordpress website administrat... | def installed(name, user, admin_user, admin_password, admin_email, title, url):
'''
Run the initial setup of wordpress
name
path to the wordpress installation
user
user that owns the files for the wordpress installation
admin_user
username for wordpress website administrat... | [
"Run",
"the",
"initial",
"setup",
"of",
"wordpress"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/wordpress.py#L16-L78 | [
"def",
"installed",
"(",
"name",
",",
"user",
",",
"admin_user",
",",
"admin_password",
",",
"admin_email",
",",
"title",
",",
"url",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
",",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | activated | Activate wordpress plugins
name
name of plugin to activate
path
path to wordpress installation
user
user who should own the files in the wordpress installation
.. code-block:: yaml
HyperDB:
wordpress.activated:
- path: /var/www/html
... | salt/states/wordpress.py | def activated(name, path, user):
'''
Activate wordpress plugins
name
name of plugin to activate
path
path to wordpress installation
user
user who should own the files in the wordpress installation
.. code-block:: yaml
HyperDB:
wordpress.activated:
... | def activated(name, path, user):
'''
Activate wordpress plugins
name
name of plugin to activate
path
path to wordpress installation
user
user who should own the files in the wordpress installation
.. code-block:: yaml
HyperDB:
wordpress.activated:
... | [
"Activate",
"wordpress",
"plugins"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/wordpress.py#L81-L135 | [
"def",
"activated",
"(",
"name",
",",
"path",
",",
"user",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
",",
"'result'",
":",
"False",
"}",
"check",
"=",
"__salt__",
"[",
"'wordpres... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _prepare_connection | Prepare the underlying SSH connection with the remote target. | salt/modules/scp_mod.py | def _prepare_connection(**kwargs):
'''
Prepare the underlying SSH connection with the remote target.
'''
paramiko_kwargs, scp_kwargs = _select_kwargs(**kwargs)
ssh = paramiko.SSHClient()
if paramiko_kwargs.pop('auto_add_policy', False):
ssh.set_missing_host_key_policy(paramiko.AutoAddPol... | def _prepare_connection(**kwargs):
'''
Prepare the underlying SSH connection with the remote target.
'''
paramiko_kwargs, scp_kwargs = _select_kwargs(**kwargs)
ssh = paramiko.SSHClient()
if paramiko_kwargs.pop('auto_add_policy', False):
ssh.set_missing_host_key_policy(paramiko.AutoAddPol... | [
"Prepare",
"the",
"underlying",
"SSH",
"connection",
"with",
"the",
"remote",
"target",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/scp_mod.py#L55-L66 | [
"def",
"_prepare_connection",
"(",
"*",
"*",
"kwargs",
")",
":",
"paramiko_kwargs",
",",
"scp_kwargs",
"=",
"_select_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"ssh",
"=",
"paramiko",
".",
"SSHClient",
"(",
")",
"if",
"paramiko_kwargs",
".",
"pop",
"(",
"'auto... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get | Transfer files and directories from remote host to the localhost of the
Minion.
remote_path
Path to retrieve from remote host. Since this is evaluated by scp on the
remote host, shell wildcards and environment variables may be used.
recursive: ``False``
Transfer files and directori... | salt/modules/scp_mod.py | def get(remote_path,
local_path='',
recursive=False,
preserve_times=False,
**kwargs):
'''
Transfer files and directories from remote host to the localhost of the
Minion.
remote_path
Path to retrieve from remote host. Since this is evaluated by scp on the
... | def get(remote_path,
local_path='',
recursive=False,
preserve_times=False,
**kwargs):
'''
Transfer files and directories from remote host to the localhost of the
Minion.
remote_path
Path to retrieve from remote host. Since this is evaluated by scp on the
... | [
"Transfer",
"files",
"and",
"directories",
"from",
"remote",
"host",
"to",
"the",
"localhost",
"of",
"the",
"Minion",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/scp_mod.py#L69-L151 | [
"def",
"get",
"(",
"remote_path",
",",
"local_path",
"=",
"''",
",",
"recursive",
"=",
"False",
",",
"preserve_times",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"scp_client",
"=",
"_prepare_connection",
"(",
"*",
"*",
"kwargs",
")",
"get_kwargs",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | put | Transfer files and directories to remote host.
files
A single path or a list of paths to be transferred.
remote_path
The path on the remote device where to store the files.
recursive: ``True``
Transfer files and directories recursively.
preserve_times: ``False``
Prese... | salt/modules/scp_mod.py | def put(files,
remote_path=None,
recursive=False,
preserve_times=False,
saltenv='base',
**kwargs):
'''
Transfer files and directories to remote host.
files
A single path or a list of paths to be transferred.
remote_path
The path on the remote dev... | def put(files,
remote_path=None,
recursive=False,
preserve_times=False,
saltenv='base',
**kwargs):
'''
Transfer files and directories to remote host.
files
A single path or a list of paths to be transferred.
remote_path
The path on the remote dev... | [
"Transfer",
"files",
"and",
"directories",
"to",
"remote",
"host",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/scp_mod.py#L154-L244 | [
"def",
"put",
"(",
"files",
",",
"remote_path",
"=",
"None",
",",
"recursive",
"=",
"False",
",",
"preserve_times",
"=",
"False",
",",
"saltenv",
"=",
"'base'",
",",
"*",
"*",
"kwargs",
")",
":",
"scp_client",
"=",
"_prepare_connection",
"(",
"*",
"*",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _build_session | Create a session to be used when connecting to iControl REST. | salt/modules/bigip.py | def _build_session(username, password, trans_label=None):
'''
Create a session to be used when connecting to iControl REST.
'''
bigip = requests.session()
bigip.auth = (username, password)
bigip.verify = False
bigip.headers.update({'Content-Type': 'application/json'})
if trans_label:
... | def _build_session(username, password, trans_label=None):
'''
Create a session to be used when connecting to iControl REST.
'''
bigip = requests.session()
bigip.auth = (username, password)
bigip.verify = False
bigip.headers.update({'Content-Type': 'application/json'})
if trans_label:
... | [
"Create",
"a",
"session",
"to",
"be",
"used",
"when",
"connecting",
"to",
"iControl",
"REST",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L43-L62 | [
"def",
"_build_session",
"(",
"username",
",",
"password",
",",
"trans_label",
"=",
"None",
")",
":",
"bigip",
"=",
"requests",
".",
"session",
"(",
")",
"bigip",
".",
"auth",
"=",
"(",
"username",
",",
"password",
")",
"bigip",
".",
"verify",
"=",
"Fa... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _load_response | Load the response from json data, return the dictionary or raw text | salt/modules/bigip.py | def _load_response(response):
'''
Load the response from json data, return the dictionary or raw text
'''
try:
data = salt.utils.json.loads(response.text)
except ValueError:
data = response.text
ret = {'code': response.status_code, 'content': data}
return ret | def _load_response(response):
'''
Load the response from json data, return the dictionary or raw text
'''
try:
data = salt.utils.json.loads(response.text)
except ValueError:
data = response.text
ret = {'code': response.status_code, 'content': data}
return ret | [
"Load",
"the",
"response",
"from",
"json",
"data",
"return",
"the",
"dictionary",
"or",
"raw",
"text"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L65-L77 | [
"def",
"_load_response",
"(",
"response",
")",
":",
"try",
":",
"data",
"=",
"salt",
".",
"utils",
".",
"json",
".",
"loads",
"(",
"response",
".",
"text",
")",
"except",
"ValueError",
":",
"data",
"=",
"response",
".",
"text",
"ret",
"=",
"{",
"'cod... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _load_connection_error | Format and Return a connection error | salt/modules/bigip.py | def _load_connection_error(hostname, error):
'''
Format and Return a connection error
'''
ret = {'code': None, 'content': 'Error: Unable to connect to the bigip device: {host}\n{error}'.format(host=hostname, error=error)}
return ret | def _load_connection_error(hostname, error):
'''
Format and Return a connection error
'''
ret = {'code': None, 'content': 'Error: Unable to connect to the bigip device: {host}\n{error}'.format(host=hostname, error=error)}
return ret | [
"Format",
"and",
"Return",
"a",
"connection",
"error"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L80-L87 | [
"def",
"_load_connection_error",
"(",
"hostname",
",",
"error",
")",
":",
"ret",
"=",
"{",
"'code'",
":",
"None",
",",
"'content'",
":",
"'Error: Unable to connect to the bigip device: {host}\\n{error}'",
".",
"format",
"(",
"host",
"=",
"hostname",
",",
"error",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _loop_payload | Pass in a dictionary of parameters, loop through them and build a payload containing,
parameters who's values are not None. | salt/modules/bigip.py | def _loop_payload(params):
'''
Pass in a dictionary of parameters, loop through them and build a payload containing,
parameters who's values are not None.
'''
#construct the payload
payload = {}
#set the payload
for param, value in six.iteritems(params):
if value is not None:
... | def _loop_payload(params):
'''
Pass in a dictionary of parameters, loop through them and build a payload containing,
parameters who's values are not None.
'''
#construct the payload
payload = {}
#set the payload
for param, value in six.iteritems(params):
if value is not None:
... | [
"Pass",
"in",
"a",
"dictionary",
"of",
"parameters",
"loop",
"through",
"them",
"and",
"build",
"a",
"payload",
"containing",
"parameters",
"who",
"s",
"values",
"are",
"not",
"None",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L90-L104 | [
"def",
"_loop_payload",
"(",
"params",
")",
":",
"#construct the payload",
"payload",
"=",
"{",
"}",
"#set the payload",
"for",
"param",
",",
"value",
"in",
"six",
".",
"iteritems",
"(",
"params",
")",
":",
"if",
"value",
"is",
"not",
"None",
":",
"payload... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _build_list | pass in an option to check for a list of items, create a list of dictionary of items to set
for this option | salt/modules/bigip.py | def _build_list(option_value, item_kind):
'''
pass in an option to check for a list of items, create a list of dictionary of items to set
for this option
'''
#specify profiles if provided
if option_value is not None:
items = []
#if user specified none, return an empty list
... | def _build_list(option_value, item_kind):
'''
pass in an option to check for a list of items, create a list of dictionary of items to set
for this option
'''
#specify profiles if provided
if option_value is not None:
items = []
#if user specified none, return an empty list
... | [
"pass",
"in",
"an",
"option",
"to",
"check",
"for",
"a",
"list",
"of",
"items",
"create",
"a",
"list",
"of",
"dictionary",
"of",
"items",
"to",
"set",
"for",
"this",
"option"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L107-L135 | [
"def",
"_build_list",
"(",
"option_value",
",",
"item_kind",
")",
":",
"#specify profiles if provided",
"if",
"option_value",
"is",
"not",
"None",
":",
"items",
"=",
"[",
"]",
"#if user specified none, return an empty list",
"if",
"option_value",
"==",
"'none'",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _determine_toggles | BigIP can't make up its mind if it likes yes / no or true or false.
Figure out what it likes to hear without confusing the user. | salt/modules/bigip.py | def _determine_toggles(payload, toggles):
'''
BigIP can't make up its mind if it likes yes / no or true or false.
Figure out what it likes to hear without confusing the user.
'''
for toggle, definition in six.iteritems(toggles):
#did the user specify anything?
if definition['value']... | def _determine_toggles(payload, toggles):
'''
BigIP can't make up its mind if it likes yes / no or true or false.
Figure out what it likes to hear without confusing the user.
'''
for toggle, definition in six.iteritems(toggles):
#did the user specify anything?
if definition['value']... | [
"BigIP",
"can",
"t",
"make",
"up",
"its",
"mind",
"if",
"it",
"likes",
"yes",
"/",
"no",
"or",
"true",
"or",
"false",
".",
"Figure",
"out",
"what",
"it",
"likes",
"to",
"hear",
"without",
"confusing",
"the",
"user",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L138-L159 | [
"def",
"_determine_toggles",
"(",
"payload",
",",
"toggles",
")",
":",
"for",
"toggle",
",",
"definition",
"in",
"six",
".",
"iteritems",
"(",
"toggles",
")",
":",
"#did the user specify anything?",
"if",
"definition",
"[",
"'value'",
"]",
"is",
"not",
"None",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _set_value | A function to detect if user is trying to pass a dictionary or list. parse it and return a
dictionary list or a string | salt/modules/bigip.py | def _set_value(value):
'''
A function to detect if user is trying to pass a dictionary or list. parse it and return a
dictionary list or a string
'''
#don't continue if already an acceptable data-type
if isinstance(value, bool) or isinstance(value, dict) or isinstance(value, list):
retu... | def _set_value(value):
'''
A function to detect if user is trying to pass a dictionary or list. parse it and return a
dictionary list or a string
'''
#don't continue if already an acceptable data-type
if isinstance(value, bool) or isinstance(value, dict) or isinstance(value, list):
retu... | [
"A",
"function",
"to",
"detect",
"if",
"user",
"is",
"trying",
"to",
"pass",
"a",
"dictionary",
"or",
"list",
".",
"parse",
"it",
"and",
"return",
"a",
"dictionary",
"list",
"or",
"a",
"string"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L162-L219 | [
"def",
"_set_value",
"(",
"value",
")",
":",
"#don't continue if already an acceptable data-type",
"if",
"isinstance",
"(",
"value",
",",
"bool",
")",
"or",
"isinstance",
"(",
"value",
",",
"dict",
")",
"or",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | start_transaction | A function to connect to a bigip device and start a new transaction.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
label
The name / alias for this transaction. The actual transaction
id will... | salt/modules/bigip.py | def start_transaction(hostname, username, password, label):
'''
A function to connect to a bigip device and start a new transaction.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
label
The na... | def start_transaction(hostname, username, password, label):
'''
A function to connect to a bigip device and start a new transaction.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
label
The na... | [
"A",
"function",
"to",
"connect",
"to",
"a",
"bigip",
"device",
"and",
"start",
"a",
"new",
"transaction",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L222-L268 | [
"def",
"start_transaction",
"(",
"hostname",
",",
"username",
",",
"password",
",",
"label",
")",
":",
"#build the session",
"bigip_session",
"=",
"_build_session",
"(",
"username",
",",
"password",
")",
"payload",
"=",
"{",
"}",
"#post to REST to get trans id",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_transaction | A function to connect to a bigip device and list an existing transaction.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
label
the label of this transaction stored within the grain:
``bigip_f5... | salt/modules/bigip.py | def list_transaction(hostname, username, password, label):
'''
A function to connect to a bigip device and list an existing transaction.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
label
th... | def list_transaction(hostname, username, password, label):
'''
A function to connect to a bigip device and list an existing transaction.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
label
th... | [
"A",
"function",
"to",
"connect",
"to",
"a",
"bigip",
"device",
"and",
"list",
"an",
"existing",
"transaction",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L271-L307 | [
"def",
"list_transaction",
"(",
"hostname",
",",
"username",
",",
"password",
",",
"label",
")",
":",
"#build the session",
"bigip_session",
"=",
"_build_session",
"(",
"username",
",",
"password",
")",
"#pull the trans id from the grain",
"trans_id",
"=",
"__salt__",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_node | A function to connect to a bigip device and create a node.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
name
The name of the node
address
The address of the node
trans_label
... | salt/modules/bigip.py | def create_node(hostname, username, password, name, address, trans_label=None):
'''
A function to connect to a bigip device and create a node.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
name
... | def create_node(hostname, username, password, name, address, trans_label=None):
'''
A function to connect to a bigip device and create a node.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
name
... | [
"A",
"function",
"to",
"connect",
"to",
"a",
"bigip",
"device",
"and",
"create",
"a",
"node",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L430-L469 | [
"def",
"create_node",
"(",
"hostname",
",",
"username",
",",
"password",
",",
"name",
",",
"address",
",",
"trans_label",
"=",
"None",
")",
":",
"#build session",
"bigip_session",
"=",
"_build_session",
"(",
"username",
",",
"password",
",",
"trans_label",
")"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | modify_node | A function to connect to a bigip device and modify an existing node.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
name
The name of the node to modify
connection_limit
[integer]
descr... | salt/modules/bigip.py | def modify_node(hostname, username, password, name,
connection_limit=None,
description=None,
dynamic_ratio=None,
logging=None,
monitor=None,
rate_limit=None,
ratio=None,
session=None,
... | def modify_node(hostname, username, password, name,
connection_limit=None,
description=None,
dynamic_ratio=None,
logging=None,
monitor=None,
rate_limit=None,
ratio=None,
session=None,
... | [
"A",
"function",
"to",
"connect",
"to",
"a",
"bigip",
"device",
"and",
"modify",
"an",
"existing",
"node",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L472-L549 | [
"def",
"modify_node",
"(",
"hostname",
",",
"username",
",",
"password",
",",
"name",
",",
"connection_limit",
"=",
"None",
",",
"description",
"=",
"None",
",",
"dynamic_ratio",
"=",
"None",
",",
"logging",
"=",
"None",
",",
"monitor",
"=",
"None",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_pool | A function to connect to a bigip device and create a pool.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
name
The name of the pool to create.
members
List of comma delimited pool members ... | salt/modules/bigip.py | def create_pool(hostname, username, password, name, members=None,
allow_nat=None,
allow_snat=None,
description=None,
gateway_failsafe_device=None,
ignore_persisted_weight=None,
ip_tos_to_client=None,
ip_tos_t... | def create_pool(hostname, username, password, name, members=None,
allow_nat=None,
allow_snat=None,
description=None,
gateway_failsafe_device=None,
ignore_persisted_weight=None,
ip_tos_to_client=None,
ip_tos_t... | [
"A",
"function",
"to",
"connect",
"to",
"a",
"bigip",
"device",
"and",
"create",
"a",
"pool",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L622-L773 | [
"def",
"create_pool",
"(",
"hostname",
",",
"username",
",",
"password",
",",
"name",
",",
"members",
"=",
"None",
",",
"allow_nat",
"=",
"None",
",",
"allow_snat",
"=",
"None",
",",
"description",
"=",
"None",
",",
"gateway_failsafe_device",
"=",
"None",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | replace_pool_members | A function to connect to a bigip device and replace members of an existing pool with new members.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
name
The name of the pool to modify
members
... | salt/modules/bigip.py | def replace_pool_members(hostname, username, password, name, members):
'''
A function to connect to a bigip device and replace members of an existing pool with new members.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iContro... | def replace_pool_members(hostname, username, password, name, members):
'''
A function to connect to a bigip device and replace members of an existing pool with new members.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iContro... | [
"A",
"function",
"to",
"connect",
"to",
"a",
"bigip",
"device",
"and",
"replace",
"members",
"of",
"an",
"existing",
"pool",
"with",
"new",
"members",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L956-L1020 | [
"def",
"replace_pool_members",
"(",
"hostname",
",",
"username",
",",
"password",
",",
"name",
",",
"members",
")",
":",
"payload",
"=",
"{",
"}",
"payload",
"[",
"'name'",
"]",
"=",
"name",
"#specify members if provided",
"if",
"members",
"is",
"not",
"None... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | add_pool_member | A function to connect to a bigip device and add a new member to an existing pool.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
name
The name of the pool to modify
member
The name of the ... | salt/modules/bigip.py | def add_pool_member(hostname, username, password, name, member):
'''
A function to connect to a bigip device and add a new member to an existing pool.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
na... | def add_pool_member(hostname, username, password, name, member):
'''
A function to connect to a bigip device and add a new member to an existing pool.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
na... | [
"A",
"function",
"to",
"connect",
"to",
"a",
"bigip",
"device",
"and",
"add",
"a",
"new",
"member",
"to",
"an",
"existing",
"pool",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L1023-L1076 | [
"def",
"add_pool_member",
"(",
"hostname",
",",
"username",
",",
"password",
",",
"name",
",",
"member",
")",
":",
"# for states",
"if",
"isinstance",
"(",
"member",
",",
"dict",
")",
":",
"#check for state alternative name 'member_state', replace with state",
"if",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_virtual | r'''
A function to connect to a bigip device and create a virtual server.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
name
The name of the virtual to create
destination
[ [virtual_a... | salt/modules/bigip.py | def create_virtual(hostname, username, password, name, destination,
pool=None,
address_status=None,
auto_lasthop=None,
bwc_policy=None,
cmp_enabled=None,
connection_limit=None,
dhcp_relay... | def create_virtual(hostname, username, password, name, destination,
pool=None,
address_status=None,
auto_lasthop=None,
bwc_policy=None,
cmp_enabled=None,
connection_limit=None,
dhcp_relay... | [
"r",
"A",
"function",
"to",
"connect",
"to",
"a",
"bigip",
"device",
"and",
"create",
"a",
"virtual",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L1237-L1523 | [
"def",
"create_virtual",
"(",
"hostname",
",",
"username",
",",
"password",
",",
"name",
",",
"destination",
",",
"pool",
"=",
"None",
",",
"address_status",
"=",
"None",
",",
"auto_lasthop",
"=",
"None",
",",
"bwc_policy",
"=",
"None",
",",
"cmp_enabled",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_profile | A function to connect to a bigip device and list an existing profile. If no name is provided than all
profiles of the specified type will be listed.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
profile... | salt/modules/bigip.py | def list_profile(hostname, username, password, profile_type, name=None, ):
'''
A function to connect to a bigip device and list an existing profile. If no name is provided than all
profiles of the specified type will be listed.
hostname
The host/address of the bigip device
username
... | def list_profile(hostname, username, password, profile_type, name=None, ):
'''
A function to connect to a bigip device and list an existing profile. If no name is provided than all
profiles of the specified type will be listed.
hostname
The host/address of the bigip device
username
... | [
"A",
"function",
"to",
"connect",
"to",
"a",
"bigip",
"device",
"and",
"list",
"an",
"existing",
"profile",
".",
"If",
"no",
"name",
"is",
"provided",
"than",
"all",
"profiles",
"of",
"the",
"specified",
"type",
"will",
"be",
"listed",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L2004-L2038 | [
"def",
"list_profile",
"(",
"hostname",
",",
"username",
",",
"password",
",",
"profile_type",
",",
"name",
"=",
"None",
",",
")",
":",
"#build sessions",
"bigip_session",
"=",
"_build_session",
"(",
"username",
",",
"password",
")",
"#get to REST",
"try",
":"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_profile | r'''
A function to connect to a bigip device and create a profile.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
profile_type
The type of profile to create
name
The name of the profil... | salt/modules/bigip.py | def create_profile(hostname, username, password, profile_type, name, **kwargs):
r'''
A function to connect to a bigip device and create a profile.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
profil... | def create_profile(hostname, username, password, profile_type, name, **kwargs):
r'''
A function to connect to a bigip device and create a profile.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
profil... | [
"r",
"A",
"function",
"to",
"connect",
"to",
"a",
"bigip",
"device",
"and",
"create",
"a",
"profile",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L2041-L2119 | [
"def",
"create_profile",
"(",
"hostname",
",",
"username",
",",
"password",
",",
"profile_type",
",",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"#build session",
"bigip_session",
"=",
"_build_session",
"(",
"username",
",",
"password",
")",
"#construct the payl... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_profile | A function to connect to a bigip device and delete an existing profile.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
profile_type
The type of profile to delete
name
The name of the profi... | salt/modules/bigip.py | def delete_profile(hostname, username, password, profile_type, name):
'''
A function to connect to a bigip device and delete an existing profile.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
profile... | def delete_profile(hostname, username, password, profile_type, name):
'''
A function to connect to a bigip device and delete an existing profile.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
profile... | [
"A",
"function",
"to",
"connect",
"to",
"a",
"bigip",
"device",
"and",
"delete",
"an",
"existing",
"profile",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L2210-L2243 | [
"def",
"delete_profile",
"(",
"hostname",
",",
"username",
",",
"password",
",",
"profile_type",
",",
"name",
")",
":",
"#build sessions",
"bigip_session",
"=",
"_build_session",
"(",
"username",
",",
"password",
")",
"#delete to REST",
"try",
":",
"response",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_ | List the beacons currently configured on the minion.
Args:
return_yaml (bool):
Whether to return YAML formatted output, default ``True``.
include_pillar (bool):
Whether to include beacons that are configured in pillar, default
is ``True``.
include_opts... | salt/modules/beacons.py | def list_(return_yaml=True,
include_pillar=True,
include_opts=True,
**kwargs):
'''
List the beacons currently configured on the minion.
Args:
return_yaml (bool):
Whether to return YAML formatted output, default ``True``.
include_pillar (bool):
... | def list_(return_yaml=True,
include_pillar=True,
include_opts=True,
**kwargs):
'''
List the beacons currently configured on the minion.
Args:
return_yaml (bool):
Whether to return YAML formatted output, default ``True``.
include_pillar (bool):
... | [
"List",
"the",
"beacons",
"currently",
"configured",
"on",
"the",
"minion",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/beacons.py#L30-L89 | [
"def",
"list_",
"(",
"return_yaml",
"=",
"True",
",",
"include_pillar",
"=",
"True",
",",
"include_opts",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"beacons",
"=",
"None",
"try",
":",
"eventer",
"=",
"salt",
".",
"utils",
".",
"event",
".",
"ge... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | add | Add a beacon on the minion
Args:
name (str):
Name of the beacon to configure
beacon_data (dict):
Dictionary or list containing configuration for beacon.
Returns:
dict: Boolean and status message on success or failure of add.
CLI Example:
.. code-bloc... | salt/modules/beacons.py | def add(name, beacon_data, **kwargs):
'''
Add a beacon on the minion
Args:
name (str):
Name of the beacon to configure
beacon_data (dict):
Dictionary or list containing configuration for beacon.
Returns:
dict: Boolean and status message on success or f... | def add(name, beacon_data, **kwargs):
'''
Add a beacon on the minion
Args:
name (str):
Name of the beacon to configure
beacon_data (dict):
Dictionary or list containing configuration for beacon.
Returns:
dict: Boolean and status message on success or f... | [
"Add",
"a",
"beacon",
"on",
"the",
"minion"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/beacons.py#L141-L241 | [
"def",
"add",
"(",
"name",
",",
"beacon_data",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'comment'",
":",
"'Failed to add beacon {0}.'",
".",
"format",
"(",
"name",
")",
",",
"'result'",
":",
"False",
"}",
"if",
"name",
"in",
"list_",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | modify | Modify an existing beacon.
Args:
name (str):
Name of the beacon to configure.
beacon_data (dict):
Dictionary or list containing updated configuration for beacon.
Returns:
dict: Boolean and status message on success or failure of modify.
CLI Example:
... | salt/modules/beacons.py | def modify(name, beacon_data, **kwargs):
'''
Modify an existing beacon.
Args:
name (str):
Name of the beacon to configure.
beacon_data (dict):
Dictionary or list containing updated configuration for beacon.
Returns:
dict: Boolean and status message on ... | def modify(name, beacon_data, **kwargs):
'''
Modify an existing beacon.
Args:
name (str):
Name of the beacon to configure.
beacon_data (dict):
Dictionary or list containing updated configuration for beacon.
Returns:
dict: Boolean and status message on ... | [
"Modify",
"an",
"existing",
"beacon",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/beacons.py#L244-L361 | [
"def",
"modify",
"(",
"name",
",",
"beacon_data",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'comment'",
":",
"''",
",",
"'result'",
":",
"True",
"}",
"current_beacons",
"=",
"list_",
"(",
"return_yaml",
"=",
"False",
",",
"*",
"*",
"kwargs... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | save | Save all configured beacons to the minion config.
Returns:
dict: Boolean and status message on success or failure of save.
CLI Example:
.. code-block:: bash
salt '*' beacons.save | salt/modules/beacons.py | def save(**kwargs):
'''
Save all configured beacons to the minion config.
Returns:
dict: Boolean and status message on success or failure of save.
CLI Example:
.. code-block:: bash
salt '*' beacons.save
'''
ret = {'comment': [],
'result': True}
beacons = ... | def save(**kwargs):
'''
Save all configured beacons to the minion config.
Returns:
dict: Boolean and status message on success or failure of save.
CLI Example:
.. code-block:: bash
salt '*' beacons.save
'''
ret = {'comment': [],
'result': True}
beacons = ... | [
"Save",
"all",
"configured",
"beacons",
"to",
"the",
"minion",
"config",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/beacons.py#L422-L459 | [
"def",
"save",
"(",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'comment'",
":",
"[",
"]",
",",
"'result'",
":",
"True",
"}",
"beacons",
"=",
"list_",
"(",
"return_yaml",
"=",
"False",
",",
"include_pillar",
"=",
"False",
",",
"*",
"*",
"kwargs... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | enable_beacon | Enable a beacon on the minion.
Args:
name (str): Name of the beacon to enable.
Returns:
dict: Boolean and status message on success or failure of enable.
CLI Example:
.. code-block:: bash
salt '*' beacons.enable_beacon ps | salt/modules/beacons.py | def enable_beacon(name, **kwargs):
'''
Enable a beacon on the minion.
Args:
name (str): Name of the beacon to enable.
Returns:
dict: Boolean and status message on success or failure of enable.
CLI Example:
.. code-block:: bash
salt '*' beacons.enable_beacon ps
''... | def enable_beacon(name, **kwargs):
'''
Enable a beacon on the minion.
Args:
name (str): Name of the beacon to enable.
Returns:
dict: Boolean and status message on success or failure of enable.
CLI Example:
.. code-block:: bash
salt '*' beacons.enable_beacon ps
''... | [
"Enable",
"a",
"beacon",
"on",
"the",
"minion",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/beacons.py#L563-L634 | [
"def",
"enable_beacon",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'comment'",
":",
"[",
"]",
",",
"'result'",
":",
"True",
"}",
"if",
"not",
"name",
":",
"ret",
"[",
"'comment'",
"]",
"=",
"'Beacon name is required.'",
"ret",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_ | Set a key/value pair in the REST interface | salt/sdb/rest.py | def set_(key, value, service=None, profile=None): # pylint: disable=W0613
'''
Set a key/value pair in the REST interface
'''
return query(key, value, service, profile) | def set_(key, value, service=None, profile=None): # pylint: disable=W0613
'''
Set a key/value pair in the REST interface
'''
return query(key, value, service, profile) | [
"Set",
"a",
"key",
"/",
"value",
"pair",
"in",
"the",
"REST",
"interface"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/rest.py#L83-L87 | [
"def",
"set_",
"(",
"key",
",",
"value",
",",
"service",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"# pylint: disable=W0613",
"return",
"query",
"(",
"key",
",",
"value",
",",
"service",
",",
"profile",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | query | Get a value from the REST interface | salt/sdb/rest.py | def query(key, value=None, service=None, profile=None): # pylint: disable=W0613
'''
Get a value from the REST interface
'''
comps = key.split('?')
key = comps[0]
key_vars = {}
for pair in comps[1].split('&'):
pair_key, pair_val = pair.split('=')
key_vars[pair_key] = pair_val... | def query(key, value=None, service=None, profile=None): # pylint: disable=W0613
'''
Get a value from the REST interface
'''
comps = key.split('?')
key = comps[0]
key_vars = {}
for pair in comps[1].split('&'):
pair_key, pair_val = pair.split('=')
key_vars[pair_key] = pair_val... | [
"Get",
"a",
"value",
"from",
"the",
"REST",
"interface"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/rest.py#L97-L133 | [
"def",
"query",
"(",
"key",
",",
"value",
"=",
"None",
",",
"service",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"# pylint: disable=W0613",
"comps",
"=",
"key",
".",
"split",
"(",
"'?'",
")",
"key",
"=",
"comps",
"[",
"0",
"]",
"key_vars",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | send | Send an event to the Salt Master
.. versionadded:: 2014.7.0
Accepts the same arguments as the :py:func:`event.send
<salt.modules.event.send>` execution module of the same name,
with the additional argument:
:param show_changed: If ``True``, state will show as changed with the data
argumen... | salt/states/event.py | def send(name,
data=None,
preload=None,
with_env=False,
with_grains=False,
with_pillar=False,
show_changed=True,
**kwargs):
'''
Send an event to the Salt Master
.. versionadded:: 2014.7.0
Accepts the same arguments as the :py:func:`event.s... | def send(name,
data=None,
preload=None,
with_env=False,
with_grains=False,
with_pillar=False,
show_changed=True,
**kwargs):
'''
Send an event to the Salt Master
.. versionadded:: 2014.7.0
Accepts the same arguments as the :py:func:`event.s... | [
"Send",
"an",
"event",
"to",
"the",
"Salt",
"Master"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/event.py#L13-L66 | [
"def",
"send",
"(",
"name",
",",
"data",
"=",
"None",
",",
"preload",
"=",
"None",
",",
"with_env",
"=",
"False",
",",
"with_grains",
"=",
"False",
",",
"with_pillar",
"=",
"False",
",",
"show_changed",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _rule_compare | Compare the common keys between security group rules against eachother | salt/states/neutron_secgroup_rule.py | def _rule_compare(rule1, rule2):
'''
Compare the common keys between security group rules against eachother
'''
commonkeys = set(rule1.keys()).intersection(rule2.keys())
for key in commonkeys:
if rule1[key] != rule2[key]:
return False
return True | def _rule_compare(rule1, rule2):
'''
Compare the common keys between security group rules against eachother
'''
commonkeys = set(rule1.keys()).intersection(rule2.keys())
for key in commonkeys:
if rule1[key] != rule2[key]:
return False
return True | [
"Compare",
"the",
"common",
"keys",
"between",
"security",
"group",
"rules",
"against",
"eachother"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/neutron_secgroup_rule.py#L44-L53 | [
"def",
"_rule_compare",
"(",
"rule1",
",",
"rule2",
")",
":",
"commonkeys",
"=",
"set",
"(",
"rule1",
".",
"keys",
"(",
")",
")",
".",
"intersection",
"(",
"rule2",
".",
"keys",
"(",
")",
")",
"for",
"key",
"in",
"commonkeys",
":",
"if",
"rule1",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | present | Ensure a security group rule exists
defaults: port_range_min=None, port_range_max=None, protocol=None,
remote_ip_prefix=None, remote_group_id=None, direction='ingress',
ethertype='IPv4', project_id=None
name
Name of the security group to associate with this rule
projec... | salt/states/neutron_secgroup_rule.py | def present(name, auth=None, **kwargs):
'''
Ensure a security group rule exists
defaults: port_range_min=None, port_range_max=None, protocol=None,
remote_ip_prefix=None, remote_group_id=None, direction='ingress',
ethertype='IPv4', project_id=None
name
Name of the se... | def present(name, auth=None, **kwargs):
'''
Ensure a security group rule exists
defaults: port_range_min=None, port_range_max=None, protocol=None,
remote_ip_prefix=None, remote_group_id=None, direction='ingress',
ethertype='IPv4', project_id=None
name
Name of the se... | [
"Ensure",
"a",
"security",
"group",
"rule",
"exists"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/neutron_secgroup_rule.py#L56-L128 | [
"def",
"present",
"(",
"name",
",",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"kwargs",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | absent | Ensure a security group rule does not exist
name
name or id of the security group rule to delete
rule_id
uuid of the rule to delete
project_id
id of project to delete rule from | salt/states/neutron_secgroup_rule.py | def absent(name, auth=None, **kwargs):
'''
Ensure a security group rule does not exist
name
name or id of the security group rule to delete
rule_id
uuid of the rule to delete
project_id
id of project to delete rule from
'''
rule_id = kwargs['rule_id']
ret = {'n... | def absent(name, auth=None, **kwargs):
'''
Ensure a security group rule does not exist
name
name or id of the security group rule to delete
rule_id
uuid of the rule to delete
project_id
id of project to delete rule from
'''
rule_id = kwargs['rule_id']
ret = {'n... | [
"Ensure",
"a",
"security",
"group",
"rule",
"does",
"not",
"exist"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/neutron_secgroup_rule.py#L131-L180 | [
"def",
"absent",
"(",
"name",
",",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"rule_id",
"=",
"kwargs",
"[",
"'rule_id'",
"]",
"ret",
"=",
"{",
"'name'",
":",
"rule_id",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | query | Perform an HTTP query and statefully return the result
Passes through all the parameters described in the
:py:func:`utils.http.query function <salt.utils.http.query>`:
name
The name of the query.
match
Specifies a pattern to look for in the return text. By default, this will
p... | salt/states/http.py | def query(name, match=None, match_type='string', status=None, status_type='string', wait_for=None, **kwargs):
'''
Perform an HTTP query and statefully return the result
Passes through all the parameters described in the
:py:func:`utils.http.query function <salt.utils.http.query>`:
name
The... | def query(name, match=None, match_type='string', status=None, status_type='string', wait_for=None, **kwargs):
'''
Perform an HTTP query and statefully return the result
Passes through all the parameters described in the
:py:func:`utils.http.query function <salt.utils.http.query>`:
name
The... | [
"Perform",
"an",
"HTTP",
"query",
"and",
"statefully",
"return",
"the",
"result"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/http.py#L23-L153 | [
"def",
"query",
"(",
"name",
",",
"match",
"=",
"None",
",",
"match_type",
"=",
"'string'",
",",
"status",
"=",
"None",
",",
"status_type",
"=",
"'string'",
",",
"wait_for",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# Monitoring state, but changes m... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | wait_for_successful_query | Like query but, repeat and wait until match/match_type or status is fulfilled. State returns result from last
query state in case of success or if no successful query was made within wait_for timeout.
name
The name of the query.
wait_for
Total time to wait for requests that succeed.
r... | salt/states/http.py | def wait_for_successful_query(name, wait_for=300, **kwargs):
'''
Like query but, repeat and wait until match/match_type or status is fulfilled. State returns result from last
query state in case of success or if no successful query was made within wait_for timeout.
name
The name of the query.
... | def wait_for_successful_query(name, wait_for=300, **kwargs):
'''
Like query but, repeat and wait until match/match_type or status is fulfilled. State returns result from last
query state in case of success or if no successful query was made within wait_for timeout.
name
The name of the query.
... | [
"Like",
"query",
"but",
"repeat",
"and",
"wait",
"until",
"match",
"/",
"match_type",
"or",
"status",
"is",
"fulfilled",
".",
"State",
"returns",
"result",
"from",
"last",
"query",
"state",
"in",
"case",
"of",
"success",
"or",
"if",
"no",
"successful",
"qu... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/http.py#L156-L195 | [
"def",
"wait_for_successful_query",
"(",
"name",
",",
"wait_for",
"=",
"300",
",",
"*",
"*",
"kwargs",
")",
":",
"starttime",
"=",
"time",
".",
"time",
"(",
")",
"while",
"True",
":",
"caught_exception",
"=",
"None",
"ret",
"=",
"None",
"try",
":",
"re... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __parse_drac | Parse Dell DRAC output | salt/modules/dracr.py | def __parse_drac(output):
'''
Parse Dell DRAC output
'''
drac = {}
section = ''
for i in output.splitlines():
if i.strip().endswith(':') and '=' not in i:
section = i[0:-1]
drac[section] = {}
if i.rstrip() and '=' in i:
if section in drac:
... | def __parse_drac(output):
'''
Parse Dell DRAC output
'''
drac = {}
section = ''
for i in output.splitlines():
if i.strip().endswith(':') and '=' not in i:
section = i[0:-1]
drac[section] = {}
if i.rstrip() and '=' in i:
if section in drac:
... | [
"Parse",
"Dell",
"DRAC",
"output"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dracr.py#L43-L64 | [
"def",
"__parse_drac",
"(",
"output",
")",
":",
"drac",
"=",
"{",
"}",
"section",
"=",
"''",
"for",
"i",
"in",
"output",
".",
"splitlines",
"(",
")",
":",
"if",
"i",
".",
"strip",
"(",
")",
".",
"endswith",
"(",
"':'",
")",
"and",
"'='",
"not",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __execute_cmd | Execute rac commands | salt/modules/dracr.py | def __execute_cmd(command, host=None,
admin_username=None, admin_password=None,
module=None):
'''
Execute rac commands
'''
if module:
# -a takes 'server' or 'switch' to represent all servers
# or all switches in a chassis. Allow
# user to say ... | def __execute_cmd(command, host=None,
admin_username=None, admin_password=None,
module=None):
'''
Execute rac commands
'''
if module:
# -a takes 'server' or 'switch' to represent all servers
# or all switches in a chassis. Allow
# user to say ... | [
"Execute",
"rac",
"commands"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dracr.py#L67-L101 | [
"def",
"__execute_cmd",
"(",
"command",
",",
"host",
"=",
"None",
",",
"admin_username",
"=",
"None",
",",
"admin_password",
"=",
"None",
",",
"module",
"=",
"None",
")",
":",
"if",
"module",
":",
"# -a takes 'server' or 'switch' to represent all servers",
"# or a... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __execute_ret | Execute rac commands | salt/modules/dracr.py | def __execute_ret(command, host=None,
admin_username=None, admin_password=None,
module=None):
'''
Execute rac commands
'''
if module:
if module == 'ALL':
modswitch = '-a '
else:
modswitch = '-m {0}'.format(module)
else:
... | def __execute_ret(command, host=None,
admin_username=None, admin_password=None,
module=None):
'''
Execute rac commands
'''
if module:
if module == 'ALL':
modswitch = '-a '
else:
modswitch = '-m {0}'.format(module)
else:
... | [
"Execute",
"rac",
"commands"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dracr.py#L104-L151 | [
"def",
"__execute_ret",
"(",
"command",
",",
"host",
"=",
"None",
",",
"admin_username",
"=",
"None",
",",
"admin_password",
"=",
"None",
",",
"module",
"=",
"None",
")",
":",
"if",
"module",
":",
"if",
"module",
"==",
"'ALL'",
":",
"modswitch",
"=",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_property | .. versionadded:: Fluorine
Return specific property
host
The chassis host.
admin_username
The username used to access the chassis.
admin_password
The password used to access the chassis.
property:
The property which should be get.
CLI Example:
.. code-b... | salt/modules/dracr.py | def get_property(host=None, admin_username=None, admin_password=None, property=None):
'''
.. versionadded:: Fluorine
Return specific property
host
The chassis host.
admin_username
The username used to access the chassis.
admin_password
The password used to access the ... | def get_property(host=None, admin_username=None, admin_password=None, property=None):
'''
.. versionadded:: Fluorine
Return specific property
host
The chassis host.
admin_username
The username used to access the chassis.
admin_password
The password used to access the ... | [
"..",
"versionadded",
"::",
"Fluorine"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dracr.py#L154-L183 | [
"def",
"get_property",
"(",
"host",
"=",
"None",
",",
"admin_username",
"=",
"None",
",",
"admin_password",
"=",
"None",
",",
"property",
"=",
"None",
")",
":",
"if",
"property",
"is",
"None",
":",
"raise",
"SaltException",
"(",
"'No property specified!'",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_property | .. versionadded:: Fluorine
Set specific property
host
The chassis host.
admin_username
The username used to access the chassis.
admin_password
The password used to access the chassis.
property:
The property which should be set.
value:
The value which... | salt/modules/dracr.py | def set_property(host=None, admin_username=None, admin_password=None, property=None, value=None):
'''
.. versionadded:: Fluorine
Set specific property
host
The chassis host.
admin_username
The username used to access the chassis.
admin_password
The password used to ac... | def set_property(host=None, admin_username=None, admin_password=None, property=None, value=None):
'''
.. versionadded:: Fluorine
Set specific property
host
The chassis host.
admin_username
The username used to access the chassis.
admin_password
The password used to ac... | [
"..",
"versionadded",
"::",
"Fluorine"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dracr.py#L186-L220 | [
"def",
"set_property",
"(",
"host",
"=",
"None",
",",
"admin_username",
"=",
"None",
",",
"admin_password",
"=",
"None",
",",
"property",
"=",
"None",
",",
"value",
"=",
"None",
")",
":",
"if",
"property",
"is",
"None",
":",
"raise",
"SaltException",
"("... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ensure_property_set | .. versionadded:: Fluorine
Ensure that property is set to specific value
host
The chassis host.
admin_username
The username used to access the chassis.
admin_password
The password used to access the chassis.
property:
The property which should be set.
value:... | salt/modules/dracr.py | def ensure_property_set(host=None, admin_username=None, admin_password=None, property=None, value=None):
'''
.. versionadded:: Fluorine
Ensure that property is set to specific value
host
The chassis host.
admin_username
The username used to access the chassis.
admin_password
... | def ensure_property_set(host=None, admin_username=None, admin_password=None, property=None, value=None):
'''
.. versionadded:: Fluorine
Ensure that property is set to specific value
host
The chassis host.
admin_username
The username used to access the chassis.
admin_password
... | [
"..",
"versionadded",
"::",
"Fluorine"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dracr.py#L223-L255 | [
"def",
"ensure_property_set",
"(",
"host",
"=",
"None",
",",
"admin_username",
"=",
"None",
",",
"admin_password",
"=",
"None",
",",
"property",
"=",
"None",
",",
"value",
"=",
"None",
")",
":",
"ret",
"=",
"get_property",
"(",
"host",
",",
"admin_username... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | system_info | Return System information
CLI Example:
.. code-block:: bash
salt dell dracr.system_info | salt/modules/dracr.py | def system_info(host=None,
admin_username=None, admin_password=None,
module=None):
'''
Return System information
CLI Example:
.. code-block:: bash
salt dell dracr.system_info
'''
cmd = __execute_ret('getsysinfo', host=host,
admin... | def system_info(host=None,
admin_username=None, admin_password=None,
module=None):
'''
Return System information
CLI Example:
.. code-block:: bash
salt dell dracr.system_info
'''
cmd = __execute_ret('getsysinfo', host=host,
admin... | [
"Return",
"System",
"information"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dracr.py#L280-L301 | [
"def",
"system_info",
"(",
"host",
"=",
"None",
",",
"admin_username",
"=",
"None",
",",
"admin_password",
"=",
"None",
",",
"module",
"=",
"None",
")",
":",
"cmd",
"=",
"__execute_ret",
"(",
"'getsysinfo'",
",",
"host",
"=",
"host",
",",
"admin_username",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.