id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
36,200 | saltstack/salt | salt/pillar/nsot.py | _get_token | def _get_token(url, email, secret_key):
'''
retrieve the auth_token from nsot
:param url: str
:param email: str
:param secret_key: str
:return: str
'''
url = urlparse.urljoin(url, 'authenticate')
data_dict = {"email": email, "secret_key": secret_key}
query = salt.utils.http.quer... | python | def _get_token(url, email, secret_key):
'''
retrieve the auth_token from nsot
:param url: str
:param email: str
:param secret_key: str
:return: str
'''
url = urlparse.urljoin(url, 'authenticate')
data_dict = {"email": email, "secret_key": secret_key}
query = salt.utils.http.quer... | [
"def",
"_get_token",
"(",
"url",
",",
"email",
",",
"secret_key",
")",
":",
"url",
"=",
"urlparse",
".",
"urljoin",
"(",
"url",
",",
"'authenticate'",
")",
"data_dict",
"=",
"{",
"\"email\"",
":",
"email",
",",
"\"secret_key\"",
":",
"secret_key",
"}",
"... | retrieve the auth_token from nsot
:param url: str
:param email: str
:param secret_key: str
:return: str | [
"retrieve",
"the",
"auth_token",
"from",
"nsot"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/nsot.py#L80-L100 |
36,201 | saltstack/salt | salt/pillar/nsot.py | _check_regex | def _check_regex(minion_id, regex):
'''
check whether or not this minion should have this external pillar returned
:param minion_id: str
:param minion_regex: list
:return: bool
'''
get_pillar = False
for pattern in regex:
log.debug('nsot external pillar comparing %s with %s', mi... | python | def _check_regex(minion_id, regex):
'''
check whether or not this minion should have this external pillar returned
:param minion_id: str
:param minion_regex: list
:return: bool
'''
get_pillar = False
for pattern in regex:
log.debug('nsot external pillar comparing %s with %s', mi... | [
"def",
"_check_regex",
"(",
"minion_id",
",",
"regex",
")",
":",
"get_pillar",
"=",
"False",
"for",
"pattern",
"in",
"regex",
":",
"log",
".",
"debug",
"(",
"'nsot external pillar comparing %s with %s'",
",",
"minion_id",
",",
"regex",
")",
"match",
"=",
"re",... | check whether or not this minion should have this external pillar returned
:param minion_id: str
:param minion_regex: list
:return: bool | [
"check",
"whether",
"or",
"not",
"this",
"minion",
"should",
"have",
"this",
"external",
"pillar",
"returned"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/nsot.py#L103-L120 |
36,202 | saltstack/salt | salt/pillar/nsot.py | _query_nsot | def _query_nsot(url, headers, device=None):
'''
if a device is given, query nsot for that specific device, otherwise return
all devices
:param url: str
:param headers: dict
:param device: None or str
:return:
'''
url = urlparse.urljoin(url, 'devices')
ret = {}
if not device:... | python | def _query_nsot(url, headers, device=None):
'''
if a device is given, query nsot for that specific device, otherwise return
all devices
:param url: str
:param headers: dict
:param device: None or str
:return:
'''
url = urlparse.urljoin(url, 'devices')
ret = {}
if not device:... | [
"def",
"_query_nsot",
"(",
"url",
",",
"headers",
",",
"device",
"=",
"None",
")",
":",
"url",
"=",
"urlparse",
".",
"urljoin",
"(",
"url",
",",
"'devices'",
")",
"ret",
"=",
"{",
"}",
"if",
"not",
"device",
":",
"query",
"=",
"salt",
".",
"utils",... | if a device is given, query nsot for that specific device, otherwise return
all devices
:param url: str
:param headers: dict
:param device: None or str
:return: | [
"if",
"a",
"device",
"is",
"given",
"query",
"nsot",
"for",
"that",
"specific",
"device",
"otherwise",
"return",
"all",
"devices"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/nsot.py#L123-L147 |
36,203 | saltstack/salt | salt/pillar/nsot.py | _proxy_info | def _proxy_info(minion_id, api_url, email, secret_key, fqdn_separator):
'''
retrieve a dict of a device that exists in nsot
:param minion_id: str
:param api_url: str
:param email: str
:param secret_key: str
:param fqdn_separator: str
:return: dict
'''
device_info = {}
if fqd... | python | def _proxy_info(minion_id, api_url, email, secret_key, fqdn_separator):
'''
retrieve a dict of a device that exists in nsot
:param minion_id: str
:param api_url: str
:param email: str
:param secret_key: str
:param fqdn_separator: str
:return: dict
'''
device_info = {}
if fqd... | [
"def",
"_proxy_info",
"(",
"minion_id",
",",
"api_url",
",",
"email",
",",
"secret_key",
",",
"fqdn_separator",
")",
":",
"device_info",
"=",
"{",
"}",
"if",
"fqdn_separator",
":",
"minion_id",
"=",
"minion_id",
".",
"replace",
"(",
"'.'",
",",
"fqdn_separat... | retrieve a dict of a device that exists in nsot
:param minion_id: str
:param api_url: str
:param email: str
:param secret_key: str
:param fqdn_separator: str
:return: dict | [
"retrieve",
"a",
"dict",
"of",
"a",
"device",
"that",
"exists",
"in",
"nsot"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/nsot.py#L150-L169 |
36,204 | saltstack/salt | salt/pillar/nsot.py | _all_nsot_devices | def _all_nsot_devices(api_url, email, secret_key):
'''
retrieve a list of all devices that exist in nsot
:param api_url: str
:param email: str
:param secret_key: str
:return: dict
'''
token = _get_token(api_url, email, secret_key)
all_devices = {}
if token:
headers = {'A... | python | def _all_nsot_devices(api_url, email, secret_key):
'''
retrieve a list of all devices that exist in nsot
:param api_url: str
:param email: str
:param secret_key: str
:return: dict
'''
token = _get_token(api_url, email, secret_key)
all_devices = {}
if token:
headers = {'A... | [
"def",
"_all_nsot_devices",
"(",
"api_url",
",",
"email",
",",
"secret_key",
")",
":",
"token",
"=",
"_get_token",
"(",
"api_url",
",",
"email",
",",
"secret_key",
")",
"all_devices",
"=",
"{",
"}",
"if",
"token",
":",
"headers",
"=",
"{",
"'Authorization'... | retrieve a list of all devices that exist in nsot
:param api_url: str
:param email: str
:param secret_key: str
:return: dict | [
"retrieve",
"a",
"list",
"of",
"all",
"devices",
"that",
"exist",
"in",
"nsot"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/nsot.py#L172-L187 |
36,205 | saltstack/salt | salt/pillar/nsot.py | ext_pillar | def ext_pillar(minion_id,
pillar,
api_url,
email,
secret_key,
fqdn_separator=None,
all_devices_regex=None,
minion_regex=None):
'''
Query NSoT API for network devices
'''
ret = {}
if minion_id == ... | python | def ext_pillar(minion_id,
pillar,
api_url,
email,
secret_key,
fqdn_separator=None,
all_devices_regex=None,
minion_regex=None):
'''
Query NSoT API for network devices
'''
ret = {}
if minion_id == ... | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"pillar",
",",
"api_url",
",",
"email",
",",
"secret_key",
",",
"fqdn_separator",
"=",
"None",
",",
"all_devices_regex",
"=",
"None",
",",
"minion_regex",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"min... | Query NSoT API for network devices | [
"Query",
"NSoT",
"API",
"for",
"network",
"devices"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/nsot.py#L190-L224 |
36,206 | saltstack/salt | salt/runners/queue.py | list_queues | def list_queues(backend='sqlite'):
'''
Return a list of Salt Queues on the backend
CLI Example:
.. code-block:: bash
salt-run queue.list_queues
salt-run queue.list_queues backend=sqlite
'''
queue_funcs = salt.loader.queues(__opts__)
cmd = '{0}.list_queues'.format(backend)
... | python | def list_queues(backend='sqlite'):
'''
Return a list of Salt Queues on the backend
CLI Example:
.. code-block:: bash
salt-run queue.list_queues
salt-run queue.list_queues backend=sqlite
'''
queue_funcs = salt.loader.queues(__opts__)
cmd = '{0}.list_queues'.format(backend)
... | [
"def",
"list_queues",
"(",
"backend",
"=",
"'sqlite'",
")",
":",
"queue_funcs",
"=",
"salt",
".",
"loader",
".",
"queues",
"(",
"__opts__",
")",
"cmd",
"=",
"'{0}.list_queues'",
".",
"format",
"(",
"backend",
")",
"if",
"cmd",
"not",
"in",
"queue_funcs",
... | Return a list of Salt Queues on the backend
CLI Example:
.. code-block:: bash
salt-run queue.list_queues
salt-run queue.list_queues backend=sqlite | [
"Return",
"a",
"list",
"of",
"Salt",
"Queues",
"on",
"the",
"backend"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/queue.py#L116-L132 |
36,207 | saltstack/salt | salt/runners/queue.py | list_length | def list_length(queue, backend='sqlite'):
'''
Provide the number of items in a queue
CLI Example:
.. code-block:: bash
salt-run queue.list_length myqueue
salt-run queue.list_length myqueue backend=sqlite
'''
queue_funcs = salt.loader.queues(__opts__)
cmd = '{0}.list_length... | python | def list_length(queue, backend='sqlite'):
'''
Provide the number of items in a queue
CLI Example:
.. code-block:: bash
salt-run queue.list_length myqueue
salt-run queue.list_length myqueue backend=sqlite
'''
queue_funcs = salt.loader.queues(__opts__)
cmd = '{0}.list_length... | [
"def",
"list_length",
"(",
"queue",
",",
"backend",
"=",
"'sqlite'",
")",
":",
"queue_funcs",
"=",
"salt",
".",
"loader",
".",
"queues",
"(",
"__opts__",
")",
"cmd",
"=",
"'{0}.list_length'",
".",
"format",
"(",
"backend",
")",
"if",
"cmd",
"not",
"in",
... | Provide the number of items in a queue
CLI Example:
.. code-block:: bash
salt-run queue.list_length myqueue
salt-run queue.list_length myqueue backend=sqlite | [
"Provide",
"the",
"number",
"of",
"items",
"in",
"a",
"queue"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/queue.py#L135-L151 |
36,208 | saltstack/salt | salt/runners/queue.py | pop | def pop(queue, quantity=1, backend='sqlite', is_runner=False):
'''
Pop one or more or all items from a queue
CLI Example:
.. code-block:: bash
salt-run queue.pop myqueue
salt-run queue.pop myqueue 6
salt-run queue.pop myqueue all
salt-run queue.pop myqueue 6 backend=sq... | python | def pop(queue, quantity=1, backend='sqlite', is_runner=False):
'''
Pop one or more or all items from a queue
CLI Example:
.. code-block:: bash
salt-run queue.pop myqueue
salt-run queue.pop myqueue 6
salt-run queue.pop myqueue all
salt-run queue.pop myqueue 6 backend=sq... | [
"def",
"pop",
"(",
"queue",
",",
"quantity",
"=",
"1",
",",
"backend",
"=",
"'sqlite'",
",",
"is_runner",
"=",
"False",
")",
":",
"queue_funcs",
"=",
"salt",
".",
"loader",
".",
"queues",
"(",
"__opts__",
")",
"cmd",
"=",
"'{0}.pop'",
".",
"format",
... | Pop one or more or all items from a queue
CLI Example:
.. code-block:: bash
salt-run queue.pop myqueue
salt-run queue.pop myqueue 6
salt-run queue.pop myqueue all
salt-run queue.pop myqueue 6 backend=sqlite
salt-run queue.pop myqueue all backend=sqlite | [
"Pop",
"one",
"or",
"more",
"or",
"all",
"items",
"from",
"a",
"queue"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/queue.py#L173-L192 |
36,209 | saltstack/salt | salt/runners/queue.py | process_queue | def process_queue(queue, quantity=1, backend='sqlite', is_runner=False):
'''
Pop items off a queue and create an event on the Salt event bus to be
processed by a Reactor.
CLI Example:
.. code-block:: bash
salt-run queue.process_queue myqueue
salt-run queue.process_queue myqueue 6
... | python | def process_queue(queue, quantity=1, backend='sqlite', is_runner=False):
'''
Pop items off a queue and create an event on the Salt event bus to be
processed by a Reactor.
CLI Example:
.. code-block:: bash
salt-run queue.process_queue myqueue
salt-run queue.process_queue myqueue 6
... | [
"def",
"process_queue",
"(",
"queue",
",",
"quantity",
"=",
"1",
",",
"backend",
"=",
"'sqlite'",
",",
"is_runner",
"=",
"False",
")",
":",
"# get ready to send an event",
"event",
"=",
"get_event",
"(",
"'master'",
",",
"__opts__",
"[",
"'sock_dir'",
"]",
"... | Pop items off a queue and create an event on the Salt event bus to be
processed by a Reactor.
CLI Example:
.. code-block:: bash
salt-run queue.process_queue myqueue
salt-run queue.process_queue myqueue 6
salt-run queue.process_queue myqueue all backend=sqlite | [
"Pop",
"items",
"off",
"a",
"queue",
"and",
"create",
"an",
"event",
"on",
"the",
"Salt",
"event",
"bus",
"to",
"be",
"processed",
"by",
"a",
"Reactor",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/queue.py#L195-L227 |
36,210 | saltstack/salt | salt/runners/queue.py | __get_queue_opts | def __get_queue_opts(queue=None, backend=None):
'''
Get consistent opts for the queued runners
'''
if queue is None:
queue = __opts__.get('runner_queue', {}).get('queue')
if backend is None:
backend = __opts__.get('runner_queue', {}).get('backend', 'pgjsonb')
return {'backend': b... | python | def __get_queue_opts(queue=None, backend=None):
'''
Get consistent opts for the queued runners
'''
if queue is None:
queue = __opts__.get('runner_queue', {}).get('queue')
if backend is None:
backend = __opts__.get('runner_queue', {}).get('backend', 'pgjsonb')
return {'backend': b... | [
"def",
"__get_queue_opts",
"(",
"queue",
"=",
"None",
",",
"backend",
"=",
"None",
")",
":",
"if",
"queue",
"is",
"None",
":",
"queue",
"=",
"__opts__",
".",
"get",
"(",
"'runner_queue'",
",",
"{",
"}",
")",
".",
"get",
"(",
"'queue'",
")",
"if",
"... | Get consistent opts for the queued runners | [
"Get",
"consistent",
"opts",
"for",
"the",
"queued",
"runners"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/queue.py#L230-L239 |
36,211 | saltstack/salt | salt/runners/queue.py | insert_runner | def insert_runner(fun, args=None, kwargs=None, queue=None, backend=None):
'''
Insert a reference to a runner into the queue so that it can be run later.
fun
The runner function that is going to be run
args
list or comma-seperated string of args to send to fun
kwargs
dictio... | python | def insert_runner(fun, args=None, kwargs=None, queue=None, backend=None):
'''
Insert a reference to a runner into the queue so that it can be run later.
fun
The runner function that is going to be run
args
list or comma-seperated string of args to send to fun
kwargs
dictio... | [
"def",
"insert_runner",
"(",
"fun",
",",
"args",
"=",
"None",
",",
"kwargs",
"=",
"None",
",",
"queue",
"=",
"None",
",",
"backend",
"=",
"None",
")",
":",
"if",
"args",
"is",
"None",
":",
"args",
"=",
"[",
"]",
"elif",
"isinstance",
"(",
"args",
... | Insert a reference to a runner into the queue so that it can be run later.
fun
The runner function that is going to be run
args
list or comma-seperated string of args to send to fun
kwargs
dictionary of keyword arguments to send to fun
queue
queue to insert the runner... | [
"Insert",
"a",
"reference",
"to",
"a",
"runner",
"into",
"the",
"queue",
"so",
"that",
"it",
"can",
"be",
"run",
"later",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/queue.py#L242-L277 |
36,212 | saltstack/salt | salt/runners/queue.py | process_runner | def process_runner(quantity=1, queue=None, backend=None):
'''
Process queued runners
quantity
number of runners to process
queue
queue to insert the runner reference into
backend
backend that to use for the queue
CLI Example:
.. code-block:: bash
salt-ru... | python | def process_runner(quantity=1, queue=None, backend=None):
'''
Process queued runners
quantity
number of runners to process
queue
queue to insert the runner reference into
backend
backend that to use for the queue
CLI Example:
.. code-block:: bash
salt-ru... | [
"def",
"process_runner",
"(",
"quantity",
"=",
"1",
",",
"queue",
"=",
"None",
",",
"backend",
"=",
"None",
")",
":",
"queue_kwargs",
"=",
"__get_queue_opts",
"(",
"queue",
"=",
"queue",
",",
"backend",
"=",
"backend",
")",
"data",
"=",
"process_queue",
... | Process queued runners
quantity
number of runners to process
queue
queue to insert the runner reference into
backend
backend that to use for the queue
CLI Example:
.. code-block:: bash
salt-run queue.process_runner
salt-run queue.process_runner 5 | [
"Process",
"queued",
"runners"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/queue.py#L280-L304 |
36,213 | saltstack/salt | salt/modules/publish.py | _parse_args | def _parse_args(arg):
'''
yamlify `arg` and ensure it's outermost datatype is a list
'''
yaml_args = salt.utils.args.yamlify_arg(arg)
if yaml_args is None:
return []
elif not isinstance(yaml_args, list):
return [yaml_args]
else:
return yaml_args | python | def _parse_args(arg):
'''
yamlify `arg` and ensure it's outermost datatype is a list
'''
yaml_args = salt.utils.args.yamlify_arg(arg)
if yaml_args is None:
return []
elif not isinstance(yaml_args, list):
return [yaml_args]
else:
return yaml_args | [
"def",
"_parse_args",
"(",
"arg",
")",
":",
"yaml_args",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"yamlify_arg",
"(",
"arg",
")",
"if",
"yaml_args",
"is",
"None",
":",
"return",
"[",
"]",
"elif",
"not",
"isinstance",
"(",
"yaml_args",
",",
"list",
... | yamlify `arg` and ensure it's outermost datatype is a list | [
"yamlify",
"arg",
"and",
"ensure",
"it",
"s",
"outermost",
"datatype",
"is",
"a",
"list"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/publish.py#L27-L38 |
36,214 | saltstack/salt | salt/modules/publish.py | publish | def publish(tgt,
fun,
arg=None,
tgt_type='glob',
returner='',
timeout=5,
via_master=None):
'''
Publish a command from the minion out to other minions.
Publications need to be enabled on the Salt master and the minion
needs to have ... | python | def publish(tgt,
fun,
arg=None,
tgt_type='glob',
returner='',
timeout=5,
via_master=None):
'''
Publish a command from the minion out to other minions.
Publications need to be enabled on the Salt master and the minion
needs to have ... | [
"def",
"publish",
"(",
"tgt",
",",
"fun",
",",
"arg",
"=",
"None",
",",
"tgt_type",
"=",
"'glob'",
",",
"returner",
"=",
"''",
",",
"timeout",
"=",
"5",
",",
"via_master",
"=",
"None",
")",
":",
"return",
"_publish",
"(",
"tgt",
",",
"fun",
",",
... | Publish a command from the minion out to other minions.
Publications need to be enabled on the Salt master and the minion
needs to have permission to publish the command. The Salt master
will also prevent a recursive publication loop, this means that a
minion cannot command another minion to command an... | [
"Publish",
"a",
"command",
"from",
"the",
"minion",
"out",
"to",
"other",
"minions",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/publish.py#L182-L263 |
36,215 | saltstack/salt | salt/modules/publish.py | full_data | def full_data(tgt,
fun,
arg=None,
tgt_type='glob',
returner='',
timeout=5):
'''
Return the full data about the publication, this is invoked in the same
way as the publish function
CLI Example:
.. code-block:: bash
salt ... | python | def full_data(tgt,
fun,
arg=None,
tgt_type='glob',
returner='',
timeout=5):
'''
Return the full data about the publication, this is invoked in the same
way as the publish function
CLI Example:
.. code-block:: bash
salt ... | [
"def",
"full_data",
"(",
"tgt",
",",
"fun",
",",
"arg",
"=",
"None",
",",
"tgt_type",
"=",
"'glob'",
",",
"returner",
"=",
"''",
",",
"timeout",
"=",
"5",
")",
":",
"return",
"_publish",
"(",
"tgt",
",",
"fun",
",",
"arg",
"=",
"arg",
",",
"tgt_t... | Return the full data about the publication, this is invoked in the same
way as the publish function
CLI Example:
.. code-block:: bash
salt system.example.com publish.full_data '*' cmd.run 'ls -la /tmp'
.. admonition:: Attention
If you need to pass a value to a function argument and ... | [
"Return",
"the",
"full",
"data",
"about",
"the",
"publication",
"this",
"is",
"invoked",
"in",
"the",
"same",
"way",
"as",
"the",
"publish",
"function"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/publish.py#L266-L300 |
36,216 | saltstack/salt | salt/modules/publish.py | runner | def runner(fun, arg=None, timeout=5):
'''
Execute a runner on the master and return the data from the runner
function
CLI Example:
.. code-block:: bash
salt publish.runner manage.down
'''
arg = _parse_args(arg)
if 'master_uri' not in __opts__:
return 'No access to mas... | python | def runner(fun, arg=None, timeout=5):
'''
Execute a runner on the master and return the data from the runner
function
CLI Example:
.. code-block:: bash
salt publish.runner manage.down
'''
arg = _parse_args(arg)
if 'master_uri' not in __opts__:
return 'No access to mas... | [
"def",
"runner",
"(",
"fun",
",",
"arg",
"=",
"None",
",",
"timeout",
"=",
"5",
")",
":",
"arg",
"=",
"_parse_args",
"(",
"arg",
")",
"if",
"'master_uri'",
"not",
"in",
"__opts__",
":",
"return",
"'No access to master. If using salt-call with --local, please rem... | Execute a runner on the master and return the data from the runner
function
CLI Example:
.. code-block:: bash
salt publish.runner manage.down | [
"Execute",
"a",
"runner",
"on",
"the",
"master",
"and",
"return",
"the",
"data",
"from",
"the",
"runner",
"function"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/publish.py#L303-L335 |
36,217 | saltstack/salt | salt/modules/kerberos.py | __execute_kadmin | def __execute_kadmin(cmd):
'''
Execute kadmin commands
'''
ret = {}
auth_keytab = __opts__.get('auth_keytab', None)
auth_principal = __opts__.get('auth_principal', None)
if __salt__['file.file_exists'](auth_keytab) and auth_principal:
return __salt__['cmd.run_all'](
'ka... | python | def __execute_kadmin(cmd):
'''
Execute kadmin commands
'''
ret = {}
auth_keytab = __opts__.get('auth_keytab', None)
auth_principal = __opts__.get('auth_principal', None)
if __salt__['file.file_exists'](auth_keytab) and auth_principal:
return __salt__['cmd.run_all'](
'ka... | [
"def",
"__execute_kadmin",
"(",
"cmd",
")",
":",
"ret",
"=",
"{",
"}",
"auth_keytab",
"=",
"__opts__",
".",
"get",
"(",
"'auth_keytab'",
",",
"None",
")",
"auth_principal",
"=",
"__opts__",
".",
"get",
"(",
"'auth_principal'",
",",
"None",
")",
"if",
"__... | Execute kadmin commands | [
"Execute",
"kadmin",
"commands"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kerberos.py#L40-L60 |
36,218 | saltstack/salt | salt/modules/kerberos.py | list_principals | def list_principals():
'''
Get all principals
CLI Example:
.. code-block:: bash
salt 'kde.example.com' kerberos.list_principals
'''
ret = {}
cmd = __execute_kadmin('list_principals')
if cmd['retcode'] != 0 or cmd['stderr']:
ret['comment'] = cmd['stderr'].splitlines()... | python | def list_principals():
'''
Get all principals
CLI Example:
.. code-block:: bash
salt 'kde.example.com' kerberos.list_principals
'''
ret = {}
cmd = __execute_kadmin('list_principals')
if cmd['retcode'] != 0 or cmd['stderr']:
ret['comment'] = cmd['stderr'].splitlines()... | [
"def",
"list_principals",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"__execute_kadmin",
"(",
"'list_principals'",
")",
"if",
"cmd",
"[",
"'retcode'",
"]",
"!=",
"0",
"or",
"cmd",
"[",
"'stderr'",
"]",
":",
"ret",
"[",
"'comment'",
"]",
"=",
"c... | Get all principals
CLI Example:
.. code-block:: bash
salt 'kde.example.com' kerberos.list_principals | [
"Get",
"all",
"principals"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kerberos.py#L63-L88 |
36,219 | saltstack/salt | salt/modules/kerberos.py | get_principal | def get_principal(name):
'''
Get princial details
CLI Example:
.. code-block:: bash
salt 'kdc.example.com' kerberos.get_principal root/admin
'''
ret = {}
cmd = __execute_kadmin('get_principal {0}'.format(name))
if cmd['retcode'] != 0 or cmd['stderr']:
ret['comment'] ... | python | def get_principal(name):
'''
Get princial details
CLI Example:
.. code-block:: bash
salt 'kdc.example.com' kerberos.get_principal root/admin
'''
ret = {}
cmd = __execute_kadmin('get_principal {0}'.format(name))
if cmd['retcode'] != 0 or cmd['stderr']:
ret['comment'] ... | [
"def",
"get_principal",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"__execute_kadmin",
"(",
"'get_principal {0}'",
".",
"format",
"(",
"name",
")",
")",
"if",
"cmd",
"[",
"'retcode'",
"]",
"!=",
"0",
"or",
"cmd",
"[",
"'stderr'",
"]",
"... | Get princial details
CLI Example:
.. code-block:: bash
salt 'kdc.example.com' kerberos.get_principal root/admin | [
"Get",
"princial",
"details"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kerberos.py#L91-L116 |
36,220 | saltstack/salt | salt/states/host.py | present | def present(name, ip, clean=False): # pylint: disable=C0103
'''
Ensures that the named host is present with the given ip
name
The host to assign an ip to
ip
The ip addr(s) to apply to the host. Can be a single IP or a list of IP
addresses.
clean : False
Remove any... | python | def present(name, ip, clean=False): # pylint: disable=C0103
'''
Ensures that the named host is present with the given ip
name
The host to assign an ip to
ip
The ip addr(s) to apply to the host. Can be a single IP or a list of IP
addresses.
clean : False
Remove any... | [
"def",
"present",
"(",
"name",
",",
"ip",
",",
"clean",
"=",
"False",
")",
":",
"# pylint: disable=C0103",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
"if",
"__opts__",
"[",
"'test'",
"]",
"e... | Ensures that the named host is present with the given ip
name
The host to assign an ip to
ip
The ip addr(s) to apply to the host. Can be a single IP or a list of IP
addresses.
clean : False
Remove any entries which don't match those configured in the ``ip``
option.... | [
"Ensures",
"that",
"the",
"named",
"host",
"is",
"present",
"with",
"the",
"given",
"ip"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/host.py#L70-L165 |
36,221 | saltstack/salt | salt/states/host.py | absent | def absent(name, ip): # pylint: disable=C0103
'''
Ensure that the named host is absent
name
The host to remove
ip
The ip addr(s) of the host to remove
'''
ret = {'name': name,
'changes': {},
'result': None,
'comment': ''}
if not isinstance... | python | def absent(name, ip): # pylint: disable=C0103
'''
Ensure that the named host is absent
name
The host to remove
ip
The ip addr(s) of the host to remove
'''
ret = {'name': name,
'changes': {},
'result': None,
'comment': ''}
if not isinstance... | [
"def",
"absent",
"(",
"name",
",",
"ip",
")",
":",
"# pylint: disable=C0103",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"if",
"not",
"isinstance",
"(",
"ip... | Ensure that the named host is absent
name
The host to remove
ip
The ip addr(s) of the host to remove | [
"Ensure",
"that",
"the",
"named",
"host",
"is",
"absent"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/host.py#L168-L203 |
36,222 | saltstack/salt | salt/states/host.py | only | def only(name, hostnames):
'''
Ensure that only the given hostnames are associated with the
given IP address.
.. versionadded:: 2016.3.0
name
The IP address to associate with the given hostnames.
hostnames
Either a single hostname or a list of hostnames to associate
wi... | python | def only(name, hostnames):
'''
Ensure that only the given hostnames are associated with the
given IP address.
.. versionadded:: 2016.3.0
name
The IP address to associate with the given hostnames.
hostnames
Either a single hostname or a list of hostnames to associate
wi... | [
"def",
"only",
"(",
"name",
",",
"hostnames",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"if",
"isinstance",
"(",
"hostnames",
",",
"six",
".",
... | Ensure that only the given hostnames are associated with the
given IP address.
.. versionadded:: 2016.3.0
name
The IP address to associate with the given hostnames.
hostnames
Either a single hostname or a list of hostnames to associate
with the given IP address in the given or... | [
"Ensure",
"that",
"only",
"the",
"given",
"hostnames",
"are",
"associated",
"with",
"the",
"given",
"IP",
"address",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/host.py#L206-L254 |
36,223 | saltstack/salt | salt/fileserver/svnfs.py | _rev | def _rev(repo):
'''
Returns revision ID of repo
'''
try:
repo_info = dict(six.iteritems(CLIENT.info(repo['repo'])))
except (pysvn._pysvn.ClientError, TypeError,
KeyError, AttributeError) as exc:
log.error(
'Error retrieving revision ID for svnfs remote %s '
... | python | def _rev(repo):
'''
Returns revision ID of repo
'''
try:
repo_info = dict(six.iteritems(CLIENT.info(repo['repo'])))
except (pysvn._pysvn.ClientError, TypeError,
KeyError, AttributeError) as exc:
log.error(
'Error retrieving revision ID for svnfs remote %s '
... | [
"def",
"_rev",
"(",
"repo",
")",
":",
"try",
":",
"repo_info",
"=",
"dict",
"(",
"six",
".",
"iteritems",
"(",
"CLIENT",
".",
"info",
"(",
"repo",
"[",
"'repo'",
"]",
")",
")",
")",
"except",
"(",
"pysvn",
".",
"_pysvn",
".",
"ClientError",
",",
... | Returns revision ID of repo | [
"Returns",
"revision",
"ID",
"of",
"repo"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/svnfs.py#L103-L118 |
36,224 | saltstack/salt | salt/fileserver/svnfs.py | clear_cache | def clear_cache():
'''
Completely clear svnfs cache
'''
fsb_cachedir = os.path.join(__opts__['cachedir'], 'svnfs')
list_cachedir = os.path.join(__opts__['cachedir'], 'file_lists/svnfs')
errors = []
for rdir in (fsb_cachedir, list_cachedir):
if os.path.exists(rdir):
try:
... | python | def clear_cache():
'''
Completely clear svnfs cache
'''
fsb_cachedir = os.path.join(__opts__['cachedir'], 'svnfs')
list_cachedir = os.path.join(__opts__['cachedir'], 'file_lists/svnfs')
errors = []
for rdir in (fsb_cachedir, list_cachedir):
if os.path.exists(rdir):
try:
... | [
"def",
"clear_cache",
"(",
")",
":",
"fsb_cachedir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'cachedir'",
"]",
",",
"'svnfs'",
")",
"list_cachedir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'cachedir'",
"]",
",",
... | Completely clear svnfs cache | [
"Completely",
"clear",
"svnfs",
"cache"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/svnfs.py#L296-L309 |
36,225 | saltstack/salt | salt/fileserver/svnfs.py | update | def update():
'''
Execute an svn update on all of the repos
'''
# data for the fileserver event
data = {'changed': False,
'backend': 'svnfs'}
# _clear_old_remotes runs init(), so use the value from there to avoid a
# second init()
data['changed'], repos = _clear_old_remotes()... | python | def update():
'''
Execute an svn update on all of the repos
'''
# data for the fileserver event
data = {'changed': False,
'backend': 'svnfs'}
# _clear_old_remotes runs init(), so use the value from there to avoid a
# second init()
data['changed'], repos = _clear_old_remotes()... | [
"def",
"update",
"(",
")",
":",
"# data for the fileserver event",
"data",
"=",
"{",
"'changed'",
":",
"False",
",",
"'backend'",
":",
"'svnfs'",
"}",
"# _clear_old_remotes runs init(), so use the value from there to avoid a",
"# second init()",
"data",
"[",
"'changed'",
... | Execute an svn update on all of the repos | [
"Execute",
"an",
"svn",
"update",
"on",
"all",
"of",
"the",
"repos"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/svnfs.py#L415-L488 |
36,226 | saltstack/salt | salt/fileserver/svnfs.py | _env_root | def _env_root(repo, saltenv):
'''
Return the root of the directory corresponding to the desired environment,
or None if the environment was not found.
'''
# If 'base' is desired, look for the trunk
if saltenv == 'base':
trunk = os.path.join(repo['repo'], repo['trunk'])
if os.path... | python | def _env_root(repo, saltenv):
'''
Return the root of the directory corresponding to the desired environment,
or None if the environment was not found.
'''
# If 'base' is desired, look for the trunk
if saltenv == 'base':
trunk = os.path.join(repo['repo'], repo['trunk'])
if os.path... | [
"def",
"_env_root",
"(",
"repo",
",",
"saltenv",
")",
":",
"# If 'base' is desired, look for the trunk",
"if",
"saltenv",
"==",
"'base'",
":",
"trunk",
"=",
"os",
".",
"path",
".",
"join",
"(",
"repo",
"[",
"'repo'",
"]",
",",
"repo",
"[",
"'trunk'",
"]",
... | Return the root of the directory corresponding to the desired environment,
or None if the environment was not found. | [
"Return",
"the",
"root",
"of",
"the",
"directory",
"corresponding",
"to",
"the",
"desired",
"environment",
"or",
"None",
"if",
"the",
"environment",
"was",
"not",
"found",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/svnfs.py#L565-L588 |
36,227 | saltstack/salt | salt/fileserver/svnfs.py | find_file | def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613
'''
Find the first file to match the path and ref. This operates similarly to
the roots file sever but with assumptions of the directory structure
based on svn standard practices.
'''
fnd = {'path': '',
'rel': ''}... | python | def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613
'''
Find the first file to match the path and ref. This operates similarly to
the roots file sever but with assumptions of the directory structure
based on svn standard practices.
'''
fnd = {'path': '',
'rel': ''}... | [
"def",
"find_file",
"(",
"path",
",",
"tgt_env",
"=",
"'base'",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=W0613",
"fnd",
"=",
"{",
"'path'",
":",
"''",
",",
"'rel'",
":",
"''",
"}",
"if",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")... | Find the first file to match the path and ref. This operates similarly to
the roots file sever but with assumptions of the directory structure
based on svn standard practices. | [
"Find",
"the",
"first",
"file",
"to",
"match",
"the",
"path",
"and",
"ref",
".",
"This",
"operates",
"similarly",
"to",
"the",
"roots",
"file",
"sever",
"but",
"with",
"assumptions",
"of",
"the",
"directory",
"structure",
"based",
"on",
"svn",
"standard",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/svnfs.py#L591-L635 |
36,228 | saltstack/salt | salt/fileserver/svnfs.py | _file_lists | def _file_lists(load, form):
'''
Return a dict containing the file lists for files, dirs, emptydirs and symlinks
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if 'saltenv' not in load or load['saltenv'] not in envs():
return []
list_cach... | python | def _file_lists(load, form):
'''
Return a dict containing the file lists for files, dirs, emptydirs and symlinks
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if 'saltenv' not in load or load['saltenv'] not in envs():
return []
list_cach... | [
"def",
"_file_lists",
"(",
"load",
",",
"form",
")",
":",
"if",
"'env'",
"in",
"load",
":",
"# \"env\" is not supported; Use \"saltenv\".",
"load",
".",
"pop",
"(",
"'env'",
")",
"if",
"'saltenv'",
"not",
"in",
"load",
"or",
"load",
"[",
"'saltenv'",
"]",
... | Return a dict containing the file lists for files, dirs, emptydirs and symlinks | [
"Return",
"a",
"dict",
"containing",
"the",
"file",
"lists",
"for",
"files",
"dirs",
"emptydirs",
"and",
"symlinks"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/svnfs.py#L721-L789 |
36,229 | saltstack/salt | salt/auth/pam.py | authenticate | def authenticate(username, password):
'''
Returns True if the given username and password authenticate for the
given service. Returns False otherwise
``username``: the username to authenticate
``password``: the password in plain text
'''
service = __opts__.get('auth.pam.service', 'login')... | python | def authenticate(username, password):
'''
Returns True if the given username and password authenticate for the
given service. Returns False otherwise
``username``: the username to authenticate
``password``: the password in plain text
'''
service = __opts__.get('auth.pam.service', 'login')... | [
"def",
"authenticate",
"(",
"username",
",",
"password",
")",
":",
"service",
"=",
"__opts__",
".",
"get",
"(",
"'auth.pam.service'",
",",
"'login'",
")",
"if",
"isinstance",
"(",
"username",
",",
"six",
".",
"text_type",
")",
":",
"username",
"=",
"userna... | Returns True if the given username and password authenticate for the
given service. Returns False otherwise
``username``: the username to authenticate
``password``: the password in plain text | [
"Returns",
"True",
"if",
"the",
"given",
"username",
"and",
"password",
"authenticate",
"for",
"the",
"given",
"service",
".",
"Returns",
"False",
"otherwise"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/pam.py#L168-L216 |
36,230 | saltstack/salt | salt/grains/napalm.py | _retrieve_grains_cache | def _retrieve_grains_cache(proxy=None):
'''
Retrieves the grains from the network device if not cached already.
'''
global GRAINS_CACHE
if not GRAINS_CACHE:
if proxy and salt.utils.napalm.is_proxy(__opts__):
# if proxy var passed and is NAPALM-type proxy minion
GRAINS... | python | def _retrieve_grains_cache(proxy=None):
'''
Retrieves the grains from the network device if not cached already.
'''
global GRAINS_CACHE
if not GRAINS_CACHE:
if proxy and salt.utils.napalm.is_proxy(__opts__):
# if proxy var passed and is NAPALM-type proxy minion
GRAINS... | [
"def",
"_retrieve_grains_cache",
"(",
"proxy",
"=",
"None",
")",
":",
"global",
"GRAINS_CACHE",
"if",
"not",
"GRAINS_CACHE",
":",
"if",
"proxy",
"and",
"salt",
".",
"utils",
".",
"napalm",
".",
"is_proxy",
"(",
"__opts__",
")",
":",
"# if proxy var passed and ... | Retrieves the grains from the network device if not cached already. | [
"Retrieves",
"the",
"grains",
"from",
"the",
"network",
"device",
"if",
"not",
"cached",
"already",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/napalm.py#L63-L79 |
36,231 | saltstack/salt | salt/grains/napalm.py | _retrieve_device_cache | def _retrieve_device_cache(proxy=None):
'''
Loads the network device details if not cached already.
'''
global DEVICE_CACHE
if not DEVICE_CACHE:
if proxy and salt.utils.napalm.is_proxy(__opts__):
# if proxy var passed and is NAPALM-type proxy minion
if 'napalm.get_dev... | python | def _retrieve_device_cache(proxy=None):
'''
Loads the network device details if not cached already.
'''
global DEVICE_CACHE
if not DEVICE_CACHE:
if proxy and salt.utils.napalm.is_proxy(__opts__):
# if proxy var passed and is NAPALM-type proxy minion
if 'napalm.get_dev... | [
"def",
"_retrieve_device_cache",
"(",
"proxy",
"=",
"None",
")",
":",
"global",
"DEVICE_CACHE",
"if",
"not",
"DEVICE_CACHE",
":",
"if",
"proxy",
"and",
"salt",
".",
"utils",
".",
"napalm",
".",
"is_proxy",
"(",
"__opts__",
")",
":",
"# if proxy var passed and ... | Loads the network device details if not cached already. | [
"Loads",
"the",
"network",
"device",
"details",
"if",
"not",
"cached",
"already",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/napalm.py#L82-L95 |
36,232 | saltstack/salt | salt/grains/napalm.py | _get_grain | def _get_grain(name, proxy=None):
'''
Retrieves the grain value from the cached dictionary.
'''
grains = _retrieve_grains_cache(proxy=proxy)
if grains.get('result', False) and grains.get('out', {}):
return grains.get('out').get(name) | python | def _get_grain(name, proxy=None):
'''
Retrieves the grain value from the cached dictionary.
'''
grains = _retrieve_grains_cache(proxy=proxy)
if grains.get('result', False) and grains.get('out', {}):
return grains.get('out').get(name) | [
"def",
"_get_grain",
"(",
"name",
",",
"proxy",
"=",
"None",
")",
":",
"grains",
"=",
"_retrieve_grains_cache",
"(",
"proxy",
"=",
"proxy",
")",
"if",
"grains",
".",
"get",
"(",
"'result'",
",",
"False",
")",
"and",
"grains",
".",
"get",
"(",
"'out'",
... | Retrieves the grain value from the cached dictionary. | [
"Retrieves",
"the",
"grain",
"value",
"from",
"the",
"cached",
"dictionary",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/napalm.py#L98-L104 |
36,233 | saltstack/salt | salt/grains/napalm.py | _get_device_grain | def _get_device_grain(name, proxy=None):
'''
Retrieves device-specific grains.
'''
device = _retrieve_device_cache(proxy=proxy)
return device.get(name.upper()) | python | def _get_device_grain(name, proxy=None):
'''
Retrieves device-specific grains.
'''
device = _retrieve_device_cache(proxy=proxy)
return device.get(name.upper()) | [
"def",
"_get_device_grain",
"(",
"name",
",",
"proxy",
"=",
"None",
")",
":",
"device",
"=",
"_retrieve_device_cache",
"(",
"proxy",
"=",
"proxy",
")",
"return",
"device",
".",
"get",
"(",
"name",
".",
"upper",
"(",
")",
")"
] | Retrieves device-specific grains. | [
"Retrieves",
"device",
"-",
"specific",
"grains",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/napalm.py#L107-L112 |
36,234 | saltstack/salt | salt/grains/napalm.py | optional_args | def optional_args(proxy=None):
'''
Return the connection optional args.
.. note::
Sensible data will not be returned.
.. versionadded:: 2017.7.0
CLI Example - select all devices connecting via port 1234:
.. code-block:: bash
salt -G 'optional_args:port:1234' test.ping
... | python | def optional_args(proxy=None):
'''
Return the connection optional args.
.. note::
Sensible data will not be returned.
.. versionadded:: 2017.7.0
CLI Example - select all devices connecting via port 1234:
.. code-block:: bash
salt -G 'optional_args:port:1234' test.ping
... | [
"def",
"optional_args",
"(",
"proxy",
"=",
"None",
")",
":",
"opt_args",
"=",
"_get_device_grain",
"(",
"'optional_args'",
",",
"proxy",
"=",
"proxy",
")",
"or",
"{",
"}",
"if",
"opt_args",
"and",
"_FORBIDDEN_OPT_ARGS",
":",
"for",
"arg",
"in",
"_FORBIDDEN_O... | Return the connection optional args.
.. note::
Sensible data will not be returned.
.. versionadded:: 2017.7.0
CLI Example - select all devices connecting via port 1234:
.. code-block:: bash
salt -G 'optional_args:port:1234' test.ping
Output:
.. code-block:: yaml
... | [
"Return",
"the",
"connection",
"optional",
"args",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/napalm.py#L425-L454 |
36,235 | saltstack/salt | salt/states/pkgbuild.py | _get_missing_results | def _get_missing_results(results, dest_dir):
'''
Return a list of the filenames specified in the ``results`` argument, which
are not present in the dest_dir.
'''
try:
present = set(os.listdir(dest_dir))
except OSError as exc:
if exc.errno == errno.ENOENT:
log.debug('p... | python | def _get_missing_results(results, dest_dir):
'''
Return a list of the filenames specified in the ``results`` argument, which
are not present in the dest_dir.
'''
try:
present = set(os.listdir(dest_dir))
except OSError as exc:
if exc.errno == errno.ENOENT:
log.debug('p... | [
"def",
"_get_missing_results",
"(",
"results",
",",
"dest_dir",
")",
":",
"try",
":",
"present",
"=",
"set",
"(",
"os",
".",
"listdir",
"(",
"dest_dir",
")",
")",
"except",
"OSError",
"as",
"exc",
":",
"if",
"exc",
".",
"errno",
"==",
"errno",
".",
"... | Return a list of the filenames specified in the ``results`` argument, which
are not present in the dest_dir. | [
"Return",
"a",
"list",
"of",
"the",
"filenames",
"specified",
"in",
"the",
"results",
"argument",
"which",
"are",
"not",
"present",
"in",
"the",
"dest_dir",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkgbuild.py#L57-L70 |
36,236 | saltstack/salt | salt/states/pkgbuild.py | built | def built(name,
runas,
dest_dir,
spec,
sources,
tgt,
template=None,
deps=None,
env=None,
results=None,
force=False,
saltenv='base',
log_dir='/var/log/salt/pkgbuild'):
'''
Ensure that the named... | python | def built(name,
runas,
dest_dir,
spec,
sources,
tgt,
template=None,
deps=None,
env=None,
results=None,
force=False,
saltenv='base',
log_dir='/var/log/salt/pkgbuild'):
'''
Ensure that the named... | [
"def",
"built",
"(",
"name",
",",
"runas",
",",
"dest_dir",
",",
"spec",
",",
"sources",
",",
"tgt",
",",
"template",
"=",
"None",
",",
"deps",
"=",
"None",
",",
"env",
"=",
"None",
",",
"results",
"=",
"None",
",",
"force",
"=",
"False",
",",
"s... | Ensure that the named package is built and exists in the named directory
name
The name to track the build, the name value is otherwise unused
runas
The user to run the build process as
dest_dir
The directory on the minion to place the built package(s)
spec
The locatio... | [
"Ensure",
"that",
"the",
"named",
"package",
"is",
"built",
"and",
"exists",
"in",
"the",
"named",
"directory"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkgbuild.py#L73-L220 |
36,237 | saltstack/salt | salt/template.py | compile_template | def compile_template(template,
renderers,
default,
blacklist,
whitelist,
saltenv='base',
sls='',
input_data='',
**kwargs):
'''
Take the path to ... | python | def compile_template(template,
renderers,
default,
blacklist,
whitelist,
saltenv='base',
sls='',
input_data='',
**kwargs):
'''
Take the path to ... | [
"def",
"compile_template",
"(",
"template",
",",
"renderers",
",",
"default",
",",
"blacklist",
",",
"whitelist",
",",
"saltenv",
"=",
"'base'",
",",
"sls",
"=",
"''",
",",
"input_data",
"=",
"''",
",",
"*",
"*",
"kwargs",
")",
":",
"# if any error occurs,... | Take the path to a template and return the high data structure
derived from the template.
Helpers:
:param mask_value:
Mask value for debugging purposes (prevent sensitive information etc)
example: "mask_value="pass*". All "passwd", "password", "pass" will
be masked (as text). | [
"Take",
"the",
"path",
"to",
"a",
"template",
"and",
"return",
"the",
"high",
"data",
"structure",
"derived",
"from",
"the",
"template",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/template.py#L35-L139 |
36,238 | saltstack/salt | salt/template.py | compile_template_str | def compile_template_str(template, renderers, default, blacklist, whitelist):
'''
Take template as a string and return the high data structure
derived from the template.
'''
fn_ = salt.utils.files.mkstemp()
with salt.utils.files.fopen(fn_, 'wb') as ofile:
ofile.write(SLS_ENCODER(template... | python | def compile_template_str(template, renderers, default, blacklist, whitelist):
'''
Take template as a string and return the high data structure
derived from the template.
'''
fn_ = salt.utils.files.mkstemp()
with salt.utils.files.fopen(fn_, 'wb') as ofile:
ofile.write(SLS_ENCODER(template... | [
"def",
"compile_template_str",
"(",
"template",
",",
"renderers",
",",
"default",
",",
"blacklist",
",",
"whitelist",
")",
":",
"fn_",
"=",
"salt",
".",
"utils",
".",
"files",
".",
"mkstemp",
"(",
")",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"... | Take template as a string and return the high data structure
derived from the template. | [
"Take",
"template",
"as",
"a",
"string",
"and",
"return",
"the",
"high",
"data",
"structure",
"derived",
"from",
"the",
"template",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/template.py#L142-L150 |
36,239 | saltstack/salt | salt/template.py | template_shebang | def template_shebang(template, renderers, default, blacklist, whitelist, input_data):
'''
Check the template shebang line and return the list of renderers specified
in the pipe.
Example shebang lines::
#!yaml_jinja
#!yaml_mako
#!mako|yaml
#!jinja|yaml
#!jinja|mako|yaml
... | python | def template_shebang(template, renderers, default, blacklist, whitelist, input_data):
'''
Check the template shebang line and return the list of renderers specified
in the pipe.
Example shebang lines::
#!yaml_jinja
#!yaml_mako
#!mako|yaml
#!jinja|yaml
#!jinja|mako|yaml
... | [
"def",
"template_shebang",
"(",
"template",
",",
"renderers",
",",
"default",
",",
"blacklist",
",",
"whitelist",
",",
"input_data",
")",
":",
"line",
"=",
"''",
"# Open up the first line of the sls template",
"if",
"template",
"==",
"':string:'",
":",
"line",
"="... | Check the template shebang line and return the list of renderers specified
in the pipe.
Example shebang lines::
#!yaml_jinja
#!yaml_mako
#!mako|yaml
#!jinja|yaml
#!jinja|mako|yaml
#!mako|yaml|stateconf
#!jinja|yaml|stateconf
#!mako|yaml_odict
#!mako|yaml_o... | [
"Check",
"the",
"template",
"shebang",
"line",
"and",
"return",
"the",
"list",
"of",
"renderers",
"specified",
"in",
"the",
"pipe",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/template.py#L153-L186 |
36,240 | saltstack/salt | salt/modules/twilio_notify.py | _get_twilio | def _get_twilio(profile):
'''
Return the twilio connection
'''
creds = __salt__['config.option'](profile)
client = TwilioRestClient(
creds.get('twilio.account_sid'),
creds.get('twilio.auth_token'),
)
return client | python | def _get_twilio(profile):
'''
Return the twilio connection
'''
creds = __salt__['config.option'](profile)
client = TwilioRestClient(
creds.get('twilio.account_sid'),
creds.get('twilio.auth_token'),
)
return client | [
"def",
"_get_twilio",
"(",
"profile",
")",
":",
"creds",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"profile",
")",
"client",
"=",
"TwilioRestClient",
"(",
"creds",
".",
"get",
"(",
"'twilio.account_sid'",
")",
",",
"creds",
".",
"get",
"(",
"'twil... | Return the twilio connection | [
"Return",
"the",
"twilio",
"connection"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/twilio_notify.py#L57-L67 |
36,241 | saltstack/salt | salt/modules/twilio_notify.py | send_sms | def send_sms(profile, body, to, from_):
'''
Send an sms
CLI Example:
twilio.send_sms twilio-account 'Test sms' '+18019999999' '+18011111111'
'''
ret = {}
ret['message'] = {}
ret['message']['sid'] = None
client = _get_twilio(profile)
try:
if TWILIO_5:
mes... | python | def send_sms(profile, body, to, from_):
'''
Send an sms
CLI Example:
twilio.send_sms twilio-account 'Test sms' '+18019999999' '+18011111111'
'''
ret = {}
ret['message'] = {}
ret['message']['sid'] = None
client = _get_twilio(profile)
try:
if TWILIO_5:
mes... | [
"def",
"send_sms",
"(",
"profile",
",",
"body",
",",
"to",
",",
"from_",
")",
":",
"ret",
"=",
"{",
"}",
"ret",
"[",
"'message'",
"]",
"=",
"{",
"}",
"ret",
"[",
"'message'",
"]",
"[",
"'sid'",
"]",
"=",
"None",
"client",
"=",
"_get_twilio",
"(",... | Send an sms
CLI Example:
twilio.send_sms twilio-account 'Test sms' '+18019999999' '+18011111111' | [
"Send",
"an",
"sms"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/twilio_notify.py#L70-L104 |
36,242 | saltstack/salt | salt/client/ssh/state.py | SSHState.load_modules | def load_modules(self, data=None, proxy=None):
'''
Load up the modules for remote compilation via ssh
'''
self.functions = self.wrapper
self.utils = salt.loader.utils(self.opts)
self.serializers = salt.loader.serializers(self.opts)
locals_ = salt.loader.minion_mod... | python | def load_modules(self, data=None, proxy=None):
'''
Load up the modules for remote compilation via ssh
'''
self.functions = self.wrapper
self.utils = salt.loader.utils(self.opts)
self.serializers = salt.loader.serializers(self.opts)
locals_ = salt.loader.minion_mod... | [
"def",
"load_modules",
"(",
"self",
",",
"data",
"=",
"None",
",",
"proxy",
"=",
"None",
")",
":",
"self",
".",
"functions",
"=",
"self",
".",
"wrapper",
"self",
".",
"utils",
"=",
"salt",
".",
"loader",
".",
"utils",
"(",
"self",
".",
"opts",
")",... | Load up the modules for remote compilation via ssh | [
"Load",
"up",
"the",
"modules",
"for",
"remote",
"compilation",
"via",
"ssh"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/state.py#L43-L52 |
36,243 | saltstack/salt | salt/client/ssh/state.py | SSHHighState._master_tops | def _master_tops(self):
'''
Evaluate master_tops locally
'''
if 'id' not in self.opts:
log.error('Received call for external nodes without an id')
return {}
if not salt.utils.verify.valid_id(self.opts, self.opts['id']):
return {}
# Eval... | python | def _master_tops(self):
'''
Evaluate master_tops locally
'''
if 'id' not in self.opts:
log.error('Received call for external nodes without an id')
return {}
if not salt.utils.verify.valid_id(self.opts, self.opts['id']):
return {}
# Eval... | [
"def",
"_master_tops",
"(",
"self",
")",
":",
"if",
"'id'",
"not",
"in",
"self",
".",
"opts",
":",
"log",
".",
"error",
"(",
"'Received call for external nodes without an id'",
")",
"return",
"{",
"}",
"if",
"not",
"salt",
".",
"utils",
".",
"verify",
".",... | Evaluate master_tops locally | [
"Evaluate",
"master_tops",
"locally"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/state.py#L92-L119 |
36,244 | saltstack/salt | salt/cloud/clouds/azurearm.py | get_api_versions | def get_api_versions(call=None, kwargs=None): # pylint: disable=unused-argument
'''
Get a resource type api versions
'''
if kwargs is None:
kwargs = {}
if 'resource_provider' not in kwargs:
raise SaltCloudSystemExit(
'A resource_provider must be specified'
)
... | python | def get_api_versions(call=None, kwargs=None): # pylint: disable=unused-argument
'''
Get a resource type api versions
'''
if kwargs is None:
kwargs = {}
if 'resource_provider' not in kwargs:
raise SaltCloudSystemExit(
'A resource_provider must be specified'
)
... | [
"def",
"get_api_versions",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"# pylint: disable=unused-argument",
"if",
"kwargs",
"is",
"None",
":",
"kwargs",
"=",
"{",
"}",
"if",
"'resource_provider'",
"not",
"in",
"kwargs",
":",
"raise",
"Sal... | Get a resource type api versions | [
"Get",
"a",
"resource",
"type",
"api",
"versions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L157-L189 |
36,245 | saltstack/salt | salt/cloud/clouds/azurearm.py | get_resource_by_id | def get_resource_by_id(resource_id, api_version, extract_value=None):
'''
Get an AzureARM resource by id
'''
ret = {}
try:
resconn = get_conn(client_type='resource')
resource_query = resconn.resources.get_by_id(
resource_id=resource_id,
api_version=api_versio... | python | def get_resource_by_id(resource_id, api_version, extract_value=None):
'''
Get an AzureARM resource by id
'''
ret = {}
try:
resconn = get_conn(client_type='resource')
resource_query = resconn.resources.get_by_id(
resource_id=resource_id,
api_version=api_versio... | [
"def",
"get_resource_by_id",
"(",
"resource_id",
",",
"api_version",
",",
"extract_value",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"try",
":",
"resconn",
"=",
"get_conn",
"(",
"client_type",
"=",
"'resource'",
")",
"resource_query",
"=",
"resconn",
".",... | Get an AzureARM resource by id | [
"Get",
"an",
"AzureARM",
"resource",
"by",
"id"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L192-L213 |
36,246 | saltstack/salt | salt/cloud/clouds/azurearm.py | get_configured_provider | def get_configured_provider():
'''
Return the first configured provider instance.
'''
def __is_provider_configured(opts, provider, required_keys=()):
'''
Check if the provider is configured.
'''
if ':' in provider:
alias, driver = provider.split(':')
... | python | def get_configured_provider():
'''
Return the first configured provider instance.
'''
def __is_provider_configured(opts, provider, required_keys=()):
'''
Check if the provider is configured.
'''
if ':' in provider:
alias, driver = provider.split(':')
... | [
"def",
"get_configured_provider",
"(",
")",
":",
"def",
"__is_provider_configured",
"(",
"opts",
",",
"provider",
",",
"required_keys",
"=",
"(",
")",
")",
":",
"'''\n Check if the provider is configured.\n '''",
"if",
"':'",
"in",
"provider",
":",
"alia... | Return the first configured provider instance. | [
"Return",
"the",
"first",
"configured",
"provider",
"instance",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L216-L275 |
36,247 | saltstack/salt | salt/cloud/clouds/azurearm.py | get_conn | def get_conn(client_type):
'''
Return a connection object for a client type.
'''
conn_kwargs = {}
conn_kwargs['subscription_id'] = salt.utils.stringutils.to_str(
config.get_cloud_config_value(
'subscription_id',
get_configured_provider(), __opts__, search_global=Fals... | python | def get_conn(client_type):
'''
Return a connection object for a client type.
'''
conn_kwargs = {}
conn_kwargs['subscription_id'] = salt.utils.stringutils.to_str(
config.get_cloud_config_value(
'subscription_id',
get_configured_provider(), __opts__, search_global=Fals... | [
"def",
"get_conn",
"(",
"client_type",
")",
":",
"conn_kwargs",
"=",
"{",
"}",
"conn_kwargs",
"[",
"'subscription_id'",
"]",
"=",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_str",
"(",
"config",
".",
"get_cloud_config_value",
"(",
"'subscription_id'",
"... | Return a connection object for a client type. | [
"Return",
"a",
"connection",
"object",
"for",
"a",
"client",
"type",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L288-L342 |
36,248 | saltstack/salt | salt/cloud/clouds/azurearm.py | get_location | def get_location(call=None, kwargs=None): # pylint: disable=unused-argument
'''
Return the location that is configured for this provider
'''
if not kwargs:
kwargs = {}
vm_dict = get_configured_provider()
vm_dict.update(kwargs)
return config.get_cloud_config_value(
'location'... | python | def get_location(call=None, kwargs=None): # pylint: disable=unused-argument
'''
Return the location that is configured for this provider
'''
if not kwargs:
kwargs = {}
vm_dict = get_configured_provider()
vm_dict.update(kwargs)
return config.get_cloud_config_value(
'location'... | [
"def",
"get_location",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"# pylint: disable=unused-argument",
"if",
"not",
"kwargs",
":",
"kwargs",
"=",
"{",
"}",
"vm_dict",
"=",
"get_configured_provider",
"(",
")",
"vm_dict",
".",
"update",
"(... | Return the location that is configured for this provider | [
"Return",
"the",
"location",
"that",
"is",
"configured",
"for",
"this",
"provider"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L345-L356 |
36,249 | saltstack/salt | salt/cloud/clouds/azurearm.py | avail_locations | def avail_locations(call=None):
'''
Return a dict of all available regions.
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_locations function must be called with '
'-f or --function, or with the --list-locations option'
)
ret = {}
ret['loc... | python | def avail_locations(call=None):
'''
Return a dict of all available regions.
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_locations function must be called with '
'-f or --function, or with the --list-locations option'
)
ret = {}
ret['loc... | [
"def",
"avail_locations",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_locations function must be called with '",
"'-f or --function, or with the --list-locations option'",
")",
"ret",
"=",
"{",
... | Return a dict of all available regions. | [
"Return",
"a",
"dict",
"of",
"all",
"available",
"regions",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L359-L389 |
36,250 | saltstack/salt | salt/cloud/clouds/azurearm.py | avail_images | def avail_images(call=None):
'''
Return a dict of all available images on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-images option'
)
compconn = get_co... | python | def avail_images(call=None):
'''
Return a dict of all available images on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-images option'
)
compconn = get_co... | [
"def",
"avail_images",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_images function must be called with '",
"'-f or --function, or with the --list-images option'",
")",
"compconn",
"=",
"get_conn",... | Return a dict of all available images on the provider | [
"Return",
"a",
"dict",
"of",
"all",
"available",
"images",
"on",
"the",
"provider"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L392-L467 |
36,251 | saltstack/salt | salt/cloud/clouds/azurearm.py | avail_sizes | def avail_sizes(call=None):
'''
Return a list of sizes available from the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_sizes function must be called with '
'-f or --function, or with the --list-sizes option'
)
compconn = get_conn(cl... | python | def avail_sizes(call=None):
'''
Return a list of sizes available from the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_sizes function must be called with '
'-f or --function, or with the --list-sizes option'
)
compconn = get_conn(cl... | [
"def",
"avail_sizes",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_sizes function must be called with '",
"'-f or --function, or with the --list-sizes option'",
")",
"compconn",
"=",
"get_conn",
... | Return a list of sizes available from the provider | [
"Return",
"a",
"list",
"of",
"sizes",
"available",
"from",
"the",
"provider"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L470-L496 |
36,252 | saltstack/salt | salt/cloud/clouds/azurearm.py | list_nodes | def list_nodes(call=None):
'''
List VMs on this Azure account
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
ret = {}
nodes = list_nodes_full()
for node in nodes:
ret[node] = {'name':... | python | def list_nodes(call=None):
'''
List VMs on this Azure account
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
ret = {}
nodes = list_nodes_full()
for node in nodes:
ret[node] = {'name':... | [
"def",
"list_nodes",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_nodes function must be called with -f or --function.'",
")",
"ret",
"=",
"{",
"}",
"nodes",
"=",
"list_nodes_full",
"(",
"... | List VMs on this Azure account | [
"List",
"VMs",
"on",
"this",
"Azure",
"account"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L499-L515 |
36,253 | saltstack/salt | salt/cloud/clouds/azurearm.py | list_nodes_full | def list_nodes_full(call=None):
'''
List all VMs on the subscription with full information
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_full function must be called with -f or --function.'
)
netapi_versions = get_api_versions(kwargs={
'reso... | python | def list_nodes_full(call=None):
'''
List all VMs on the subscription with full information
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_full function must be called with -f or --function.'
)
netapi_versions = get_api_versions(kwargs={
'reso... | [
"def",
"list_nodes_full",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_nodes_full function must be called with -f or --function.'",
")",
"netapi_versions",
"=",
"get_api_versions",
"(",
"kwargs",
... | List all VMs on the subscription with full information | [
"List",
"all",
"VMs",
"on",
"the",
"subscription",
"with",
"full",
"information"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L518-L600 |
36,254 | saltstack/salt | salt/cloud/clouds/azurearm.py | list_resource_groups | def list_resource_groups(call=None):
'''
List resource groups associated with the subscription
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_hosted_services function must be called with '
'-f or --function'
)
resconn = get_conn(client_type='re... | python | def list_resource_groups(call=None):
'''
List resource groups associated with the subscription
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_hosted_services function must be called with '
'-f or --function'
)
resconn = get_conn(client_type='re... | [
"def",
"list_resource_groups",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_hosted_services function must be called with '",
"'-f or --function'",
")",
"resconn",
"=",
"get_conn",
"(",
"client_t... | List resource groups associated with the subscription | [
"List",
"resource",
"groups",
"associated",
"with",
"the",
"subscription"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L603-L625 |
36,255 | saltstack/salt | salt/cloud/clouds/azurearm.py | show_instance | def show_instance(name, call=None):
'''
Show the details from AzureARM concerning an instance
'''
if call != 'action':
raise SaltCloudSystemExit(
'The show_instance action must be called with -a or --action.'
)
try:
node = list_nodes_full('function')[name]
exc... | python | def show_instance(name, call=None):
'''
Show the details from AzureARM concerning an instance
'''
if call != 'action':
raise SaltCloudSystemExit(
'The show_instance action must be called with -a or --action.'
)
try:
node = list_nodes_full('function')[name]
exc... | [
"def",
"show_instance",
"(",
"name",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"!=",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The show_instance action must be called with -a or --action.'",
")",
"try",
":",
"node",
"=",
"list_nodes_full",
"(",... | Show the details from AzureARM concerning an instance | [
"Show",
"the",
"details",
"from",
"AzureARM",
"concerning",
"an",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L628-L644 |
36,256 | saltstack/salt | salt/cloud/clouds/azurearm.py | _get_public_ip | def _get_public_ip(name, resource_group):
'''
Get the public ip address details by name.
'''
netconn = get_conn(client_type='network')
try:
pubip_query = netconn.public_ip_addresses.get(
resource_group_name=resource_group,
public_ip_address_name=name
)
... | python | def _get_public_ip(name, resource_group):
'''
Get the public ip address details by name.
'''
netconn = get_conn(client_type='network')
try:
pubip_query = netconn.public_ip_addresses.get(
resource_group_name=resource_group,
public_ip_address_name=name
)
... | [
"def",
"_get_public_ip",
"(",
"name",
",",
"resource_group",
")",
":",
"netconn",
"=",
"get_conn",
"(",
"client_type",
"=",
"'network'",
")",
"try",
":",
"pubip_query",
"=",
"netconn",
".",
"public_ip_addresses",
".",
"get",
"(",
"resource_group_name",
"=",
"r... | Get the public ip address details by name. | [
"Get",
"the",
"public",
"ip",
"address",
"details",
"by",
"name",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L683-L698 |
36,257 | saltstack/salt | salt/cloud/clouds/azurearm.py | _get_network_interface | def _get_network_interface(name, resource_group):
'''
Get a network interface.
'''
public_ips = []
private_ips = []
netapi_versions = get_api_versions(kwargs={
'resource_provider': 'Microsoft.Network',
'resource_type': 'publicIPAddresses'
}
)
netapi_version = neta... | python | def _get_network_interface(name, resource_group):
'''
Get a network interface.
'''
public_ips = []
private_ips = []
netapi_versions = get_api_versions(kwargs={
'resource_provider': 'Microsoft.Network',
'resource_type': 'publicIPAddresses'
}
)
netapi_version = neta... | [
"def",
"_get_network_interface",
"(",
"name",
",",
"resource_group",
")",
":",
"public_ips",
"=",
"[",
"]",
"private_ips",
"=",
"[",
"]",
"netapi_versions",
"=",
"get_api_versions",
"(",
"kwargs",
"=",
"{",
"'resource_provider'",
":",
"'Microsoft.Network'",
",",
... | Get a network interface. | [
"Get",
"a",
"network",
"interface",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L701-L733 |
36,258 | saltstack/salt | salt/cloud/clouds/azurearm.py | list_storage_accounts | def list_storage_accounts(call=None):
'''
List storage accounts within the subscription.
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_storage_accounts function must be called with '
'-f or --function'
)
storconn = get_conn(client_type='storag... | python | def list_storage_accounts(call=None):
'''
List storage accounts within the subscription.
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_storage_accounts function must be called with '
'-f or --function'
)
storconn = get_conn(client_type='storag... | [
"def",
"list_storage_accounts",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_storage_accounts function must be called with '",
"'-f or --function'",
")",
"storconn",
"=",
"get_conn",
"(",
"clien... | List storage accounts within the subscription. | [
"List",
"storage",
"accounts",
"within",
"the",
"subscription",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L1654-L1676 |
36,259 | saltstack/salt | salt/cloud/clouds/azurearm.py | _get_cloud_environment | def _get_cloud_environment():
'''
Get the cloud environment object.
'''
cloud_environment = config.get_cloud_config_value(
'cloud_environment',
get_configured_provider(), __opts__, search_global=False
)
try:
clou... | python | def _get_cloud_environment():
'''
Get the cloud environment object.
'''
cloud_environment = config.get_cloud_config_value(
'cloud_environment',
get_configured_provider(), __opts__, search_global=False
)
try:
clou... | [
"def",
"_get_cloud_environment",
"(",
")",
":",
"cloud_environment",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'cloud_environment'",
",",
"get_configured_provider",
"(",
")",
",",
"__opts__",
",",
"search_global",
"=",
"False",
")",
"try",
":",
"cloud_env_... | Get the cloud environment object. | [
"Get",
"the",
"cloud",
"environment",
"object",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L1679-L1695 |
36,260 | saltstack/salt | salt/cloud/clouds/azurearm.py | _get_block_blob_service | def _get_block_blob_service(kwargs=None):
'''
Get the block blob storage service.
'''
resource_group = kwargs.get('resource_group') or config.get_cloud_config_value(
'resource_group',
get_configured_provider(), __opts__, search_global=False
... | python | def _get_block_blob_service(kwargs=None):
'''
Get the block blob storage service.
'''
resource_group = kwargs.get('resource_group') or config.get_cloud_config_value(
'resource_group',
get_configured_provider(), __opts__, search_global=False
... | [
"def",
"_get_block_blob_service",
"(",
"kwargs",
"=",
"None",
")",
":",
"resource_group",
"=",
"kwargs",
".",
"get",
"(",
"'resource_group'",
")",
"or",
"config",
".",
"get_cloud_config_value",
"(",
"'resource_group'",
",",
"get_configured_provider",
"(",
")",
","... | Get the block blob storage service. | [
"Get",
"the",
"block",
"blob",
"storage",
"service",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L1698-L1741 |
36,261 | saltstack/salt | salt/cloud/clouds/azurearm.py | list_blobs | def list_blobs(call=None, kwargs=None): # pylint: disable=unused-argument
'''
List blobs.
'''
if kwargs is None:
kwargs = {}
if 'container' not in kwargs:
raise SaltCloudSystemExit(
'A container must be specified'
)
storageservice = _get_block_blob_service(... | python | def list_blobs(call=None, kwargs=None): # pylint: disable=unused-argument
'''
List blobs.
'''
if kwargs is None:
kwargs = {}
if 'container' not in kwargs:
raise SaltCloudSystemExit(
'A container must be specified'
)
storageservice = _get_block_blob_service(... | [
"def",
"list_blobs",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"# pylint: disable=unused-argument",
"if",
"kwargs",
"is",
"None",
":",
"kwargs",
"=",
"{",
"}",
"if",
"'container'",
"not",
"in",
"kwargs",
":",
"raise",
"SaltCloudSystemEx... | List blobs. | [
"List",
"blobs",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L1744-L1769 |
36,262 | saltstack/salt | salt/cloud/clouds/azurearm.py | delete_blob | def delete_blob(call=None, kwargs=None): # pylint: disable=unused-argument
'''
Delete a blob from a container.
'''
if kwargs is None:
kwargs = {}
if 'container' not in kwargs:
raise SaltCloudSystemExit(
'A container must be specified'
)
if 'blob' not in kwa... | python | def delete_blob(call=None, kwargs=None): # pylint: disable=unused-argument
'''
Delete a blob from a container.
'''
if kwargs is None:
kwargs = {}
if 'container' not in kwargs:
raise SaltCloudSystemExit(
'A container must be specified'
)
if 'blob' not in kwa... | [
"def",
"delete_blob",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"# pylint: disable=unused-argument",
"if",
"kwargs",
"is",
"None",
":",
"kwargs",
"=",
"{",
"}",
"if",
"'container'",
"not",
"in",
"kwargs",
":",
"raise",
"SaltCloudSystemE... | Delete a blob from a container. | [
"Delete",
"a",
"blob",
"from",
"a",
"container",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L1772-L1792 |
36,263 | saltstack/salt | salt/cloud/clouds/azurearm.py | delete_managed_disk | def delete_managed_disk(call=None, kwargs=None): # pylint: disable=unused-argument
'''
Delete a managed disk from a resource group.
'''
compconn = get_conn(client_type='compute')
try:
compconn.disks.delete(kwargs['resource_group'], kwargs['blob'])
except Exception as exc:
log.... | python | def delete_managed_disk(call=None, kwargs=None): # pylint: disable=unused-argument
'''
Delete a managed disk from a resource group.
'''
compconn = get_conn(client_type='compute')
try:
compconn.disks.delete(kwargs['resource_group'], kwargs['blob'])
except Exception as exc:
log.... | [
"def",
"delete_managed_disk",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"# pylint: disable=unused-argument",
"compconn",
"=",
"get_conn",
"(",
"client_type",
"=",
"'compute'",
")",
"try",
":",
"compconn",
".",
"disks",
".",
"delete",
"(",... | Delete a managed disk from a resource group. | [
"Delete",
"a",
"managed",
"disk",
"from",
"a",
"resource",
"group",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L1795-L1808 |
36,264 | saltstack/salt | salt/cloud/clouds/azurearm.py | list_virtual_networks | def list_virtual_networks(call=None, kwargs=None):
'''
List virtual networks.
'''
if kwargs is None:
kwargs = {}
if call == 'action':
raise SaltCloudSystemExit(
'The avail_sizes function must be called with '
'-f or --function'
)
netconn = get_co... | python | def list_virtual_networks(call=None, kwargs=None):
'''
List virtual networks.
'''
if kwargs is None:
kwargs = {}
if call == 'action':
raise SaltCloudSystemExit(
'The avail_sizes function must be called with '
'-f or --function'
)
netconn = get_co... | [
"def",
"list_virtual_networks",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"kwargs",
"is",
"None",
":",
"kwargs",
"=",
"{",
"}",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_sizes function m... | List virtual networks. | [
"List",
"virtual",
"networks",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L1811-L1842 |
36,265 | saltstack/salt | salt/cloud/clouds/azurearm.py | list_subnets | def list_subnets(call=None, kwargs=None):
'''
List subnets in a virtual network.
'''
if kwargs is None:
kwargs = {}
if call == 'action':
raise SaltCloudSystemExit(
'The avail_sizes function must be called with '
'-f or --function'
)
netconn = get... | python | def list_subnets(call=None, kwargs=None):
'''
List subnets in a virtual network.
'''
if kwargs is None:
kwargs = {}
if call == 'action':
raise SaltCloudSystemExit(
'The avail_sizes function must be called with '
'-f or --function'
)
netconn = get... | [
"def",
"list_subnets",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"kwargs",
"is",
"None",
":",
"kwargs",
"=",
"{",
"}",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_sizes function must be ca... | List subnets in a virtual network. | [
"List",
"subnets",
"in",
"a",
"virtual",
"network",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L1845-L1894 |
36,266 | saltstack/salt | salt/states/powerpath.py | license_present | def license_present(name):
'''
Ensures that the specified PowerPath license key is present
on the host.
name
The license key to ensure is present
'''
ret = {'name': name,
'changes': {},
'result': False,
'comment': ''}
if not __salt__['powerpath.has_... | python | def license_present(name):
'''
Ensures that the specified PowerPath license key is present
on the host.
name
The license key to ensure is present
'''
ret = {'name': name,
'changes': {},
'result': False,
'comment': ''}
if not __salt__['powerpath.has_... | [
"def",
"license_present",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"if",
"not",
"__salt__",
"[",
"'powerpath.has_powerpath'",
"]",
"... | Ensures that the specified PowerPath license key is present
on the host.
name
The license key to ensure is present | [
"Ensures",
"that",
"the",
"specified",
"PowerPath",
"license",
"key",
"is",
"present",
"on",
"the",
"host",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/powerpath.py#L19-L58 |
36,267 | saltstack/salt | salt/modules/rpmbuild_pkgbuild.py | _create_rpmmacros | def _create_rpmmacros(runas='root'):
'''
Create the .rpmmacros file in user's home directory
'''
home = os.path.expanduser('~')
rpmbuilddir = os.path.join(home, 'rpmbuild')
if not os.path.isdir(rpmbuilddir):
__salt__['file.makedirs_perms'](name=rpmbuilddir, user=runas, group='mock')
... | python | def _create_rpmmacros(runas='root'):
'''
Create the .rpmmacros file in user's home directory
'''
home = os.path.expanduser('~')
rpmbuilddir = os.path.join(home, 'rpmbuild')
if not os.path.isdir(rpmbuilddir):
__salt__['file.makedirs_perms'](name=rpmbuilddir, user=runas, group='mock')
... | [
"def",
"_create_rpmmacros",
"(",
"runas",
"=",
"'root'",
")",
":",
"home",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"'~'",
")",
"rpmbuilddir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"home",
",",
"'rpmbuild'",
")",
"if",
"not",
"os",
".",
... | Create the .rpmmacros file in user's home directory | [
"Create",
"the",
".",
"rpmmacros",
"file",
"in",
"user",
"s",
"home",
"directory"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpmbuild_pkgbuild.py#L72-L93 |
36,268 | saltstack/salt | salt/modules/rpmbuild_pkgbuild.py | _mk_tree | def _mk_tree(runas='root'):
'''
Create the rpm build tree
'''
basedir = tempfile.mkdtemp()
paths = ['BUILD', 'RPMS', 'SOURCES', 'SPECS', 'SRPMS']
for path in paths:
full = os.path.join(basedir, path)
__salt__['file.makedirs_perms'](name=full, user=runas, group='mock')
return ... | python | def _mk_tree(runas='root'):
'''
Create the rpm build tree
'''
basedir = tempfile.mkdtemp()
paths = ['BUILD', 'RPMS', 'SOURCES', 'SPECS', 'SRPMS']
for path in paths:
full = os.path.join(basedir, path)
__salt__['file.makedirs_perms'](name=full, user=runas, group='mock')
return ... | [
"def",
"_mk_tree",
"(",
"runas",
"=",
"'root'",
")",
":",
"basedir",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"paths",
"=",
"[",
"'BUILD'",
",",
"'RPMS'",
",",
"'SOURCES'",
",",
"'SPECS'",
",",
"'SRPMS'",
"]",
"for",
"path",
"in",
"paths",
":",
"fu... | Create the rpm build tree | [
"Create",
"the",
"rpm",
"build",
"tree"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpmbuild_pkgbuild.py#L96-L105 |
36,269 | saltstack/salt | salt/modules/rpmbuild_pkgbuild.py | _get_spec | def _get_spec(tree_base, spec, template, saltenv='base'):
'''
Get the spec file and place it in the SPECS dir
'''
spec_tgt = os.path.basename(spec)
dest = os.path.join(tree_base, 'SPECS', spec_tgt)
return __salt__['cp.get_url'](
spec,
dest,
saltenv=saltenv) | python | def _get_spec(tree_base, spec, template, saltenv='base'):
'''
Get the spec file and place it in the SPECS dir
'''
spec_tgt = os.path.basename(spec)
dest = os.path.join(tree_base, 'SPECS', spec_tgt)
return __salt__['cp.get_url'](
spec,
dest,
saltenv=saltenv) | [
"def",
"_get_spec",
"(",
"tree_base",
",",
"spec",
",",
"template",
",",
"saltenv",
"=",
"'base'",
")",
":",
"spec_tgt",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"spec",
")",
"dest",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tree_base",
",",
... | Get the spec file and place it in the SPECS dir | [
"Get",
"the",
"spec",
"file",
"and",
"place",
"it",
"in",
"the",
"SPECS",
"dir"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpmbuild_pkgbuild.py#L108-L117 |
36,270 | saltstack/salt | salt/modules/rpmbuild_pkgbuild.py | _get_distset | def _get_distset(tgt):
'''
Get the distribution string for use with rpmbuild and mock
'''
# Centos adds 'centos' string to rpm names, removing that to have
# consistent naming on Centos and Redhat, and allow for Amazon naming
tgtattrs = tgt.split('-')
if tgtattrs[0] == 'amzn':
distse... | python | def _get_distset(tgt):
'''
Get the distribution string for use with rpmbuild and mock
'''
# Centos adds 'centos' string to rpm names, removing that to have
# consistent naming on Centos and Redhat, and allow for Amazon naming
tgtattrs = tgt.split('-')
if tgtattrs[0] == 'amzn':
distse... | [
"def",
"_get_distset",
"(",
"tgt",
")",
":",
"# Centos adds 'centos' string to rpm names, removing that to have",
"# consistent naming on Centos and Redhat, and allow for Amazon naming",
"tgtattrs",
"=",
"tgt",
".",
"split",
"(",
"'-'",
")",
"if",
"tgtattrs",
"[",
"0",
"]",
... | Get the distribution string for use with rpmbuild and mock | [
"Get",
"the",
"distribution",
"string",
"for",
"use",
"with",
"rpmbuild",
"and",
"mock"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpmbuild_pkgbuild.py#L134-L148 |
36,271 | saltstack/salt | salt/modules/rpmbuild_pkgbuild.py | _get_deps | def _get_deps(deps, tree_base, saltenv='base'):
'''
Get include string for list of dependent rpms to build package
'''
deps_list = ''
if deps is None:
return deps_list
if not isinstance(deps, list):
raise SaltInvocationError(
'\'deps\' must be a Python list or comma-s... | python | def _get_deps(deps, tree_base, saltenv='base'):
'''
Get include string for list of dependent rpms to build package
'''
deps_list = ''
if deps is None:
return deps_list
if not isinstance(deps, list):
raise SaltInvocationError(
'\'deps\' must be a Python list or comma-s... | [
"def",
"_get_deps",
"(",
"deps",
",",
"tree_base",
",",
"saltenv",
"=",
"'base'",
")",
":",
"deps_list",
"=",
"''",
"if",
"deps",
"is",
"None",
":",
"return",
"deps_list",
"if",
"not",
"isinstance",
"(",
"deps",
",",
"list",
")",
":",
"raise",
"SaltInv... | Get include string for list of dependent rpms to build package | [
"Get",
"include",
"string",
"for",
"list",
"of",
"dependent",
"rpms",
"to",
"build",
"package"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpmbuild_pkgbuild.py#L151-L173 |
36,272 | saltstack/salt | salt/modules/rpmbuild_pkgbuild.py | make_src_pkg | def make_src_pkg(dest_dir, spec, sources, env=None, template=None, saltenv='base', runas='root'):
'''
Create a source rpm from the given spec file and sources
CLI Example:
.. code-block:: bash
salt '*' pkgbuild.make_src_pkg /var/www/html/
https://raw.githubusercontent.com/salt... | python | def make_src_pkg(dest_dir, spec, sources, env=None, template=None, saltenv='base', runas='root'):
'''
Create a source rpm from the given spec file and sources
CLI Example:
.. code-block:: bash
salt '*' pkgbuild.make_src_pkg /var/www/html/
https://raw.githubusercontent.com/salt... | [
"def",
"make_src_pkg",
"(",
"dest_dir",
",",
"spec",
",",
"sources",
",",
"env",
"=",
"None",
",",
"template",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
",",
"runas",
"=",
"'root'",
")",
":",
"_create_rpmmacros",
"(",
"runas",
")",
"tree_base",
"=",
... | Create a source rpm from the given spec file and sources
CLI Example:
.. code-block:: bash
salt '*' pkgbuild.make_src_pkg /var/www/html/
https://raw.githubusercontent.com/saltstack/libnacl/master/pkg/rpm/python-libnacl.spec
https://pypi.python.org/packages/source/l/lib... | [
"Create",
"a",
"source",
"rpm",
"from",
"the",
"given",
"spec",
"file",
"and",
"sources"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpmbuild_pkgbuild.py#L176-L257 |
36,273 | saltstack/salt | salt/engines/thorium.py | start | def start(grains=False, grain_keys=None, pillar=False, pillar_keys=None):
'''
Execute the Thorium runtime
'''
state = salt.thorium.ThorState(
__opts__,
grains,
grain_keys,
pillar,
pillar_keys)
state.start_runtime() | python | def start(grains=False, grain_keys=None, pillar=False, pillar_keys=None):
'''
Execute the Thorium runtime
'''
state = salt.thorium.ThorState(
__opts__,
grains,
grain_keys,
pillar,
pillar_keys)
state.start_runtime() | [
"def",
"start",
"(",
"grains",
"=",
"False",
",",
"grain_keys",
"=",
"None",
",",
"pillar",
"=",
"False",
",",
"pillar_keys",
"=",
"None",
")",
":",
"state",
"=",
"salt",
".",
"thorium",
".",
"ThorState",
"(",
"__opts__",
",",
"grains",
",",
"grain_key... | Execute the Thorium runtime | [
"Execute",
"the",
"Thorium",
"runtime"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/thorium.py#L11-L21 |
36,274 | saltstack/salt | salt/proxy/junos.py | init | def init(opts):
'''
Open the connection to the Junos device, login, and bind to the
Resource class
'''
opts['multiprocessing'] = False
log.debug('Opening connection to junos')
args = {"host": opts['proxy']['host']}
optional_args = ['user',
'username',
... | python | def init(opts):
'''
Open the connection to the Junos device, login, and bind to the
Resource class
'''
opts['multiprocessing'] = False
log.debug('Opening connection to junos')
args = {"host": opts['proxy']['host']}
optional_args = ['user',
'username',
... | [
"def",
"init",
"(",
"opts",
")",
":",
"opts",
"[",
"'multiprocessing'",
"]",
"=",
"False",
"log",
".",
"debug",
"(",
"'Opening connection to junos'",
")",
"args",
"=",
"{",
"\"host\"",
":",
"opts",
"[",
"'proxy'",
"]",
"[",
"'host'",
"]",
"}",
"optional_... | Open the connection to the Junos device, login, and bind to the
Resource class | [
"Open",
"the",
"connection",
"to",
"the",
"Junos",
"device",
"login",
"and",
"bind",
"to",
"the",
"Resource",
"class"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/junos.py#L76-L134 |
36,275 | saltstack/salt | salt/proxy/junos.py | alive | def alive(opts):
'''
Validate and return the connection status with the remote device.
.. versionadded:: 2018.3.0
'''
dev = conn()
thisproxy['conn'].connected = ping()
if not dev.connected:
__salt__['event.fire_master']({}, 'junos/proxy/{}/stop'.format(
opts['proxy'][... | python | def alive(opts):
'''
Validate and return the connection status with the remote device.
.. versionadded:: 2018.3.0
'''
dev = conn()
thisproxy['conn'].connected = ping()
if not dev.connected:
__salt__['event.fire_master']({}, 'junos/proxy/{}/stop'.format(
opts['proxy'][... | [
"def",
"alive",
"(",
"opts",
")",
":",
"dev",
"=",
"conn",
"(",
")",
"thisproxy",
"[",
"'conn'",
"]",
".",
"connected",
"=",
"ping",
"(",
")",
"if",
"not",
"dev",
".",
"connected",
":",
"__salt__",
"[",
"'event.fire_master'",
"]",
"(",
"{",
"}",
",... | Validate and return the connection status with the remote device.
.. versionadded:: 2018.3.0 | [
"Validate",
"and",
"return",
"the",
"connection",
"status",
"with",
"the",
"remote",
"device",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/junos.py#L145-L159 |
36,276 | saltstack/salt | salt/utils/iam.py | _retry_get_url | def _retry_get_url(url, num_retries=10, timeout=5):
'''
Retry grabbing a URL.
Based heavily on boto.utils.retry_url
'''
for i in range(0, num_retries):
try:
result = requests.get(url, timeout=timeout, proxies={'http': ''})
if hasattr(result, 'text'):
r... | python | def _retry_get_url(url, num_retries=10, timeout=5):
'''
Retry grabbing a URL.
Based heavily on boto.utils.retry_url
'''
for i in range(0, num_retries):
try:
result = requests.get(url, timeout=timeout, proxies={'http': ''})
if hasattr(result, 'text'):
r... | [
"def",
"_retry_get_url",
"(",
"url",
",",
"num_retries",
"=",
"10",
",",
"timeout",
"=",
"5",
")",
":",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"num_retries",
")",
":",
"try",
":",
"result",
"=",
"requests",
".",
"get",
"(",
"url",
",",
"timeout"... | Retry grabbing a URL.
Based heavily on boto.utils.retry_url | [
"Retry",
"grabbing",
"a",
"URL",
".",
"Based",
"heavily",
"on",
"boto",
".",
"utils",
".",
"retry_url"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/iam.py#L26-L53 |
36,277 | saltstack/salt | salt/utils/iam.py | _convert_key_to_str | def _convert_key_to_str(key):
'''
Stolen completely from boto.providers
'''
# IMPORTANT: on PY2, the secret key must be str and not unicode to work
# properly with hmac.new (see http://bugs.python.org/issue5285)
#
# pylint: disable=incompatible-py3-code,undefined-variable
return salt.uti... | python | def _convert_key_to_str(key):
'''
Stolen completely from boto.providers
'''
# IMPORTANT: on PY2, the secret key must be str and not unicode to work
# properly with hmac.new (see http://bugs.python.org/issue5285)
#
# pylint: disable=incompatible-py3-code,undefined-variable
return salt.uti... | [
"def",
"_convert_key_to_str",
"(",
"key",
")",
":",
"# IMPORTANT: on PY2, the secret key must be str and not unicode to work",
"# properly with hmac.new (see http://bugs.python.org/issue5285)",
"#",
"# pylint: disable=incompatible-py3-code,undefined-variable",
"return",
"salt",
".",
"utils... | Stolen completely from boto.providers | [
"Stolen",
"completely",
"from",
"boto",
".",
"providers"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/iam.py#L56-L66 |
36,278 | saltstack/salt | salt/cli/caller.py | BaseCaller.print_docs | def print_docs(self):
'''
Pick up the documentation for all of the modules and print it out.
'''
docs = {}
for name, func in six.iteritems(self.minion.functions):
if name not in docs:
if func.__doc__:
docs[name] = func.__doc__
... | python | def print_docs(self):
'''
Pick up the documentation for all of the modules and print it out.
'''
docs = {}
for name, func in six.iteritems(self.minion.functions):
if name not in docs:
if func.__doc__:
docs[name] = func.__doc__
... | [
"def",
"print_docs",
"(",
"self",
")",
":",
"docs",
"=",
"{",
"}",
"for",
"name",
",",
"func",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"minion",
".",
"functions",
")",
":",
"if",
"name",
"not",
"in",
"docs",
":",
"if",
"func",
".",
"__do... | Pick up the documentation for all of the modules and print it out. | [
"Pick",
"up",
"the",
"documentation",
"for",
"all",
"of",
"the",
"modules",
"and",
"print",
"it",
"out",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/caller.py#L91-L102 |
36,279 | saltstack/salt | salt/cli/caller.py | BaseCaller.print_grains | def print_grains(self):
'''
Print out the grains
'''
grains = self.minion.opts.get('grains') or salt.loader.grains(self.opts)
salt.output.display_output({'local': grains}, 'grains', self.opts) | python | def print_grains(self):
'''
Print out the grains
'''
grains = self.minion.opts.get('grains') or salt.loader.grains(self.opts)
salt.output.display_output({'local': grains}, 'grains', self.opts) | [
"def",
"print_grains",
"(",
"self",
")",
":",
"grains",
"=",
"self",
".",
"minion",
".",
"opts",
".",
"get",
"(",
"'grains'",
")",
"or",
"salt",
".",
"loader",
".",
"grains",
"(",
"self",
".",
"opts",
")",
"salt",
".",
"output",
".",
"display_output"... | Print out the grains | [
"Print",
"out",
"the",
"grains"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/caller.py#L104-L109 |
36,280 | saltstack/salt | salt/cli/caller.py | BaseCaller.run | def run(self):
'''
Execute the salt call logic
'''
profiling_enabled = self.opts.get('profiling_enabled', False)
try:
pr = salt.utils.profile.activate_profile(profiling_enabled)
try:
ret = self.call()
finally:
sa... | python | def run(self):
'''
Execute the salt call logic
'''
profiling_enabled = self.opts.get('profiling_enabled', False)
try:
pr = salt.utils.profile.activate_profile(profiling_enabled)
try:
ret = self.call()
finally:
sa... | [
"def",
"run",
"(",
"self",
")",
":",
"profiling_enabled",
"=",
"self",
".",
"opts",
".",
"get",
"(",
"'profiling_enabled'",
",",
"False",
")",
"try",
":",
"pr",
"=",
"salt",
".",
"utils",
".",
"profile",
".",
"activate_profile",
"(",
"profiling_enabled",
... | Execute the salt call logic | [
"Execute",
"the",
"salt",
"call",
"logic"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/caller.py#L111-L142 |
36,281 | saltstack/salt | salt/cli/caller.py | ZeroMQCaller.return_pub | def return_pub(self, ret):
'''
Return the data up to the master
'''
channel = salt.transport.client.ReqChannel.factory(self.opts, usage='salt_call')
load = {'cmd': '_return', 'id': self.opts['id']}
for key, value in six.iteritems(ret):
load[key] = value
... | python | def return_pub(self, ret):
'''
Return the data up to the master
'''
channel = salt.transport.client.ReqChannel.factory(self.opts, usage='salt_call')
load = {'cmd': '_return', 'id': self.opts['id']}
for key, value in six.iteritems(ret):
load[key] = value
... | [
"def",
"return_pub",
"(",
"self",
",",
"ret",
")",
":",
"channel",
"=",
"salt",
".",
"transport",
".",
"client",
".",
"ReqChannel",
".",
"factory",
"(",
"self",
".",
"opts",
",",
"usage",
"=",
"'salt_call'",
")",
"load",
"=",
"{",
"'cmd'",
":",
"'_re... | Return the data up to the master | [
"Return",
"the",
"data",
"up",
"to",
"the",
"master"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/caller.py#L308-L319 |
36,282 | saltstack/salt | salt/thorium/local.py | cmd | def cmd(name,
tgt,
func,
arg=(),
tgt_type='glob',
ret='',
kwarg=None,
**kwargs):
'''
Execute a remote execution command
USAGE:
.. code-block:: yaml
run_remote_ex:
local.cmd:
- tgt: '*'
- func: test.ping
... | python | def cmd(name,
tgt,
func,
arg=(),
tgt_type='glob',
ret='',
kwarg=None,
**kwargs):
'''
Execute a remote execution command
USAGE:
.. code-block:: yaml
run_remote_ex:
local.cmd:
- tgt: '*'
- func: test.ping
... | [
"def",
"cmd",
"(",
"name",
",",
"tgt",
",",
"func",
",",
"arg",
"=",
"(",
")",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"kwarg",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
... | Execute a remote execution command
USAGE:
.. code-block:: yaml
run_remote_ex:
local.cmd:
- tgt: '*'
- func: test.ping
run_remote_ex:
local.cmd:
- tgt: '*'
- func: test.sleep
- arg:
- 30
run... | [
"Execute",
"a",
"remote",
"execution",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/thorium/local.py#L12-L59 |
36,283 | saltstack/salt | salt/states/keystone.py | _api_version | def _api_version(profile=None, **connection_args):
'''
Sets global variables _OS_IDENTITY_API_VERSION and _TENANT_ID
depending on API version.
'''
global _TENANT_ID
global _OS_IDENTITY_API_VERSION
try:
if float(__salt__['keystone.api_version'](profile=profile, **connection_args).stri... | python | def _api_version(profile=None, **connection_args):
'''
Sets global variables _OS_IDENTITY_API_VERSION and _TENANT_ID
depending on API version.
'''
global _TENANT_ID
global _OS_IDENTITY_API_VERSION
try:
if float(__salt__['keystone.api_version'](profile=profile, **connection_args).stri... | [
"def",
"_api_version",
"(",
"profile",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"global",
"_TENANT_ID",
"global",
"_OS_IDENTITY_API_VERSION",
"try",
":",
"if",
"float",
"(",
"__salt__",
"[",
"'keystone.api_version'",
"]",
"(",
"profile",
"=",
"... | Sets global variables _OS_IDENTITY_API_VERSION and _TENANT_ID
depending on API version. | [
"Sets",
"global",
"variables",
"_OS_IDENTITY_API_VERSION",
"and",
"_TENANT_ID",
"depending",
"on",
"API",
"version",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keystone.py#L83-L95 |
36,284 | saltstack/salt | salt/states/keystone.py | user_absent | def user_absent(name, profile=None, **connection_args):
'''
Ensure that the keystone user is absent.
name
The name of the user that should not exist
'''
ret = {'name': name,
'changes': {},
'result': True,
'comment': 'User "{0}" is already absent'.format(name... | python | def user_absent(name, profile=None, **connection_args):
'''
Ensure that the keystone user is absent.
name
The name of the user that should not exist
'''
ret = {'name': name,
'changes': {},
'result': True,
'comment': 'User "{0}" is already absent'.format(name... | [
"def",
"user_absent",
"(",
"name",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"'User \"{0}\" is ... | Ensure that the keystone user is absent.
name
The name of the user that should not exist | [
"Ensure",
"that",
"the",
"keystone",
"user",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keystone.py#L301-L327 |
36,285 | saltstack/salt | salt/states/keystone.py | tenant_present | def tenant_present(name, description=None, enabled=True, profile=None,
**connection_args):
'''
Ensures that the keystone tenant exists
name
The name of the tenant to manage
description
The description to use for this tenant
enabled
Availability state for... | python | def tenant_present(name, description=None, enabled=True, profile=None,
**connection_args):
'''
Ensures that the keystone tenant exists
name
The name of the tenant to manage
description
The description to use for this tenant
enabled
Availability state for... | [
"def",
"tenant_present",
"(",
"name",
",",
"description",
"=",
"None",
",",
"enabled",
"=",
"True",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",... | Ensures that the keystone tenant exists
name
The name of the tenant to manage
description
The description to use for this tenant
enabled
Availability state for this tenant | [
"Ensures",
"that",
"the",
"keystone",
"tenant",
"exists"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keystone.py#L330-L399 |
36,286 | saltstack/salt | salt/states/keystone.py | tenant_absent | def tenant_absent(name, profile=None, **connection_args):
'''
Ensure that the keystone tenant is absent.
name
The name of the tenant that should not exist
'''
ret = {'name': name,
'changes': {},
'result': True,
'comment': 'Tenant / project "{0}" is already a... | python | def tenant_absent(name, profile=None, **connection_args):
'''
Ensure that the keystone tenant is absent.
name
The name of the tenant that should not exist
'''
ret = {'name': name,
'changes': {},
'result': True,
'comment': 'Tenant / project "{0}" is already a... | [
"def",
"tenant_absent",
"(",
"name",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"'Tenant / proje... | Ensure that the keystone tenant is absent.
name
The name of the tenant that should not exist | [
"Ensure",
"that",
"the",
"keystone",
"tenant",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keystone.py#L402-L429 |
36,287 | saltstack/salt | salt/states/keystone.py | project_present | def project_present(name, description=None, enabled=True, profile=None,
**connection_args):
'''
Ensures that the keystone project exists
Alias for tenant_present from V2 API to fulfill
V3 API naming convention.
.. versionadded:: 2016.11.0
name
The name of the projec... | python | def project_present(name, description=None, enabled=True, profile=None,
**connection_args):
'''
Ensures that the keystone project exists
Alias for tenant_present from V2 API to fulfill
V3 API naming convention.
.. versionadded:: 2016.11.0
name
The name of the projec... | [
"def",
"project_present",
"(",
"name",
",",
"description",
"=",
"None",
",",
"enabled",
"=",
"True",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"return",
"tenant_present",
"(",
"name",
",",
"description",
"=",
"description",
"... | Ensures that the keystone project exists
Alias for tenant_present from V2 API to fulfill
V3 API naming convention.
.. versionadded:: 2016.11.0
name
The name of the project to manage
description
The description to use for this project
enabled
Availability state for thi... | [
"Ensures",
"that",
"the",
"keystone",
"project",
"exists",
"Alias",
"for",
"tenant_present",
"from",
"V2",
"API",
"to",
"fulfill",
"V3",
"API",
"naming",
"convention",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keystone.py#L432-L460 |
36,288 | saltstack/salt | salt/states/keystone.py | role_present | def role_present(name, profile=None, **connection_args):
''''
Ensures that the keystone role exists
name
The name of the role that should be present
'''
ret = {'name': name,
'changes': {},
'result': True,
'comment': 'Role "{0}" already exists'.format(name)}
... | python | def role_present(name, profile=None, **connection_args):
''''
Ensures that the keystone role exists
name
The name of the role that should be present
'''
ret = {'name': name,
'changes': {},
'result': True,
'comment': 'Role "{0}" already exists'.format(name)}
... | [
"def",
"role_present",
"(",
"name",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"'Role \"{0}\" al... | Ensures that the keystone role exists
name
The name of the role that should be present | [
"Ensures",
"that",
"the",
"keystone",
"role",
"exists"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keystone.py#L484-L512 |
36,289 | saltstack/salt | salt/states/keystone.py | service_present | def service_present(name, service_type, description=None,
profile=None, **connection_args):
'''
Ensure service present in Keystone catalog
name
The name of the service
service_type
The type of Openstack Service
description (optional)
Description of the ... | python | def service_present(name, service_type, description=None,
profile=None, **connection_args):
'''
Ensure service present in Keystone catalog
name
The name of the service
service_type
The type of Openstack Service
description (optional)
Description of the ... | [
"def",
"service_present",
"(",
"name",
",",
"service_type",
",",
"description",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result... | Ensure service present in Keystone catalog
name
The name of the service
service_type
The type of Openstack Service
description (optional)
Description of the service | [
"Ensure",
"service",
"present",
"in",
"Keystone",
"catalog"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keystone.py#L544-L583 |
36,290 | saltstack/salt | salt/states/keystone.py | endpoint_absent | def endpoint_absent(name, region=None, profile=None, interface=None, **connection_args):
'''
Ensure that the endpoint for a service doesn't exist in Keystone catalog
name
The name of the service whose endpoints should not exist
region (optional)
The region of the endpoint. Defaults to... | python | def endpoint_absent(name, region=None, profile=None, interface=None, **connection_args):
'''
Ensure that the endpoint for a service doesn't exist in Keystone catalog
name
The name of the service whose endpoints should not exist
region (optional)
The region of the endpoint. Defaults to... | [
"def",
"endpoint_absent",
"(",
"name",
",",
"region",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"interface",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
... | Ensure that the endpoint for a service doesn't exist in Keystone catalog
name
The name of the service whose endpoints should not exist
region (optional)
The region of the endpoint. Defaults to ``RegionOne``.
interface
The interface type, which describes the visibility
of ... | [
"Ensure",
"that",
"the",
"endpoint",
"for",
"a",
"service",
"doesn",
"t",
"exist",
"in",
"Keystone",
"catalog"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keystone.py#L774-L814 |
36,291 | saltstack/salt | salt/modules/rh_service.py | _service_is_chkconfig | def _service_is_chkconfig(name):
'''
Return True if the service is managed by chkconfig.
'''
cmdline = '/sbin/chkconfig --list {0}'.format(name)
return __salt__['cmd.retcode'](cmdline, python_shell=False, ignore_retcode=True) == 0 | python | def _service_is_chkconfig(name):
'''
Return True if the service is managed by chkconfig.
'''
cmdline = '/sbin/chkconfig --list {0}'.format(name)
return __salt__['cmd.retcode'](cmdline, python_shell=False, ignore_retcode=True) == 0 | [
"def",
"_service_is_chkconfig",
"(",
"name",
")",
":",
"cmdline",
"=",
"'/sbin/chkconfig --list {0}'",
".",
"format",
"(",
"name",
")",
"return",
"__salt__",
"[",
"'cmd.retcode'",
"]",
"(",
"cmdline",
",",
"python_shell",
"=",
"False",
",",
"ignore_retcode",
"="... | Return True if the service is managed by chkconfig. | [
"Return",
"True",
"if",
"the",
"service",
"is",
"managed",
"by",
"chkconfig",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_service.py#L161-L166 |
36,292 | saltstack/salt | salt/modules/rh_service.py | _chkconfig_is_enabled | def _chkconfig_is_enabled(name, runlevel=None):
'''
Return ``True`` if the service is enabled according to chkconfig; otherwise
return ``False``. If ``runlevel`` is ``None``, then use the current
runlevel.
'''
cmdline = '/sbin/chkconfig --list {0}'.format(name)
result = __salt__['cmd.run_al... | python | def _chkconfig_is_enabled(name, runlevel=None):
'''
Return ``True`` if the service is enabled according to chkconfig; otherwise
return ``False``. If ``runlevel`` is ``None``, then use the current
runlevel.
'''
cmdline = '/sbin/chkconfig --list {0}'.format(name)
result = __salt__['cmd.run_al... | [
"def",
"_chkconfig_is_enabled",
"(",
"name",
",",
"runlevel",
"=",
"None",
")",
":",
"cmdline",
"=",
"'/sbin/chkconfig --list {0}'",
".",
"format",
"(",
"name",
")",
"result",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmdline",
",",
"python_shell",
"="... | Return ``True`` if the service is enabled according to chkconfig; otherwise
return ``False``. If ``runlevel`` is ``None``, then use the current
runlevel. | [
"Return",
"True",
"if",
"the",
"service",
"is",
"enabled",
"according",
"to",
"chkconfig",
";",
"otherwise",
"return",
"False",
".",
"If",
"runlevel",
"is",
"None",
"then",
"use",
"the",
"current",
"runlevel",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_service.py#L186-L204 |
36,293 | saltstack/salt | salt/modules/rh_service.py | _sysv_enable | def _sysv_enable(name):
'''
Enable the named sysv service to start at boot. The service will be enabled
using chkconfig with default run-levels if the service is chkconfig
compatible. If chkconfig is not available, then this will fail.
'''
if not _service_is_chkconfig(name) and not _chkconfig_... | python | def _sysv_enable(name):
'''
Enable the named sysv service to start at boot. The service will be enabled
using chkconfig with default run-levels if the service is chkconfig
compatible. If chkconfig is not available, then this will fail.
'''
if not _service_is_chkconfig(name) and not _chkconfig_... | [
"def",
"_sysv_enable",
"(",
"name",
")",
":",
"if",
"not",
"_service_is_chkconfig",
"(",
"name",
")",
"and",
"not",
"_chkconfig_add",
"(",
"name",
")",
":",
"return",
"False",
"cmd",
"=",
"'/sbin/chkconfig {0} on'",
".",
"format",
"(",
"name",
")",
"return",... | Enable the named sysv service to start at boot. The service will be enabled
using chkconfig with default run-levels if the service is chkconfig
compatible. If chkconfig is not available, then this will fail. | [
"Enable",
"the",
"named",
"sysv",
"service",
"to",
"start",
"at",
"boot",
".",
"The",
"service",
"will",
"be",
"enabled",
"using",
"chkconfig",
"with",
"default",
"run",
"-",
"levels",
"if",
"the",
"service",
"is",
"chkconfig",
"compatible",
".",
"If",
"ch... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_service.py#L207-L216 |
36,294 | saltstack/salt | salt/modules/rh_service.py | _sysv_delete | def _sysv_delete(name):
'''
Delete the named sysv service from the system. The service will be
deleted using chkconfig.
'''
if not _service_is_chkconfig(name):
return False
cmd = '/sbin/chkconfig --del {0}'.format(name)
return not __salt__['cmd.retcode'](cmd) | python | def _sysv_delete(name):
'''
Delete the named sysv service from the system. The service will be
deleted using chkconfig.
'''
if not _service_is_chkconfig(name):
return False
cmd = '/sbin/chkconfig --del {0}'.format(name)
return not __salt__['cmd.retcode'](cmd) | [
"def",
"_sysv_delete",
"(",
"name",
")",
":",
"if",
"not",
"_service_is_chkconfig",
"(",
"name",
")",
":",
"return",
"False",
"cmd",
"=",
"'/sbin/chkconfig --del {0}'",
".",
"format",
"(",
"name",
")",
"return",
"not",
"__salt__",
"[",
"'cmd.retcode'",
"]",
... | Delete the named sysv service from the system. The service will be
deleted using chkconfig. | [
"Delete",
"the",
"named",
"sysv",
"service",
"from",
"the",
"system",
".",
"The",
"service",
"will",
"be",
"deleted",
"using",
"chkconfig",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_service.py#L232-L240 |
36,295 | saltstack/salt | salt/modules/rh_service.py | _upstart_delete | def _upstart_delete(name):
'''
Delete an upstart service. This will only rename the .conf file
'''
if HAS_UPSTART:
if os.path.exists('/etc/init/{0}.conf'.format(name)):
os.rename('/etc/init/{0}.conf'.format(name),
'/etc/init/{0}.conf.removed'.format(name))
r... | python | def _upstart_delete(name):
'''
Delete an upstart service. This will only rename the .conf file
'''
if HAS_UPSTART:
if os.path.exists('/etc/init/{0}.conf'.format(name)):
os.rename('/etc/init/{0}.conf'.format(name),
'/etc/init/{0}.conf.removed'.format(name))
r... | [
"def",
"_upstart_delete",
"(",
"name",
")",
":",
"if",
"HAS_UPSTART",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"'/etc/init/{0}.conf'",
".",
"format",
"(",
"name",
")",
")",
":",
"os",
".",
"rename",
"(",
"'/etc/init/{0}.conf'",
".",
"format",
"(... | Delete an upstart service. This will only rename the .conf file | [
"Delete",
"an",
"upstart",
"service",
".",
"This",
"will",
"only",
"rename",
"the",
".",
"conf",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_service.py#L243-L251 |
36,296 | saltstack/salt | salt/modules/rh_service.py | _sysv_services | def _sysv_services():
'''
Return list of sysv services.
'''
_services = []
output = __salt__['cmd.run'](['chkconfig', '--list'], python_shell=False)
for line in output.splitlines():
comps = line.split()
try:
if comps[1].startswith('0:'):
_services.appe... | python | def _sysv_services():
'''
Return list of sysv services.
'''
_services = []
output = __salt__['cmd.run'](['chkconfig', '--list'], python_shell=False)
for line in output.splitlines():
comps = line.split()
try:
if comps[1].startswith('0:'):
_services.appe... | [
"def",
"_sysv_services",
"(",
")",
":",
"_services",
"=",
"[",
"]",
"output",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"[",
"'chkconfig'",
",",
"'--list'",
"]",
",",
"python_shell",
"=",
"False",
")",
"for",
"line",
"in",
"output",
".",
"splitlines",... | Return list of sysv services. | [
"Return",
"list",
"of",
"sysv",
"services",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_service.py#L265-L279 |
36,297 | saltstack/salt | salt/modules/rh_service.py | get_enabled | def get_enabled(limit=''):
'''
Return the enabled services. Use the ``limit`` param to restrict results
to services of that type.
CLI Examples:
.. code-block:: bash
salt '*' service.get_enabled
salt '*' service.get_enabled limit=upstart
salt '*' service.get_enabled limit=s... | python | def get_enabled(limit=''):
'''
Return the enabled services. Use the ``limit`` param to restrict results
to services of that type.
CLI Examples:
.. code-block:: bash
salt '*' service.get_enabled
salt '*' service.get_enabled limit=upstart
salt '*' service.get_enabled limit=s... | [
"def",
"get_enabled",
"(",
"limit",
"=",
"''",
")",
":",
"limit",
"=",
"limit",
".",
"lower",
"(",
")",
"if",
"limit",
"==",
"'upstart'",
":",
"return",
"sorted",
"(",
"name",
"for",
"name",
"in",
"_upstart_services",
"(",
")",
"if",
"_upstart_is_enabled... | Return the enabled services. Use the ``limit`` param to restrict results
to services of that type.
CLI Examples:
.. code-block:: bash
salt '*' service.get_enabled
salt '*' service.get_enabled limit=upstart
salt '*' service.get_enabled limit=sysvinit | [
"Return",
"the",
"enabled",
"services",
".",
"Use",
"the",
"limit",
"param",
"to",
"restrict",
"results",
"to",
"services",
"of",
"that",
"type",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_service.py#L282-L309 |
36,298 | saltstack/salt | salt/modules/rh_service.py | get_all | def get_all(limit=''):
'''
Return all installed services. Use the ``limit`` param to restrict results
to services of that type.
CLI Example:
.. code-block:: bash
salt '*' service.get_all
salt '*' service.get_all limit=upstart
salt '*' service.get_all limit=sysvinit
'''... | python | def get_all(limit=''):
'''
Return all installed services. Use the ``limit`` param to restrict results
to services of that type.
CLI Example:
.. code-block:: bash
salt '*' service.get_all
salt '*' service.get_all limit=upstart
salt '*' service.get_all limit=sysvinit
'''... | [
"def",
"get_all",
"(",
"limit",
"=",
"''",
")",
":",
"limit",
"=",
"limit",
".",
"lower",
"(",
")",
"if",
"limit",
"==",
"'upstart'",
":",
"return",
"sorted",
"(",
"_upstart_services",
"(",
")",
")",
"elif",
"limit",
"==",
"'sysvinit'",
":",
"return",
... | Return all installed services. Use the ``limit`` param to restrict results
to services of that type.
CLI Example:
.. code-block:: bash
salt '*' service.get_all
salt '*' service.get_all limit=upstart
salt '*' service.get_all limit=sysvinit | [
"Return",
"all",
"installed",
"services",
".",
"Use",
"the",
"limit",
"param",
"to",
"restrict",
"results",
"to",
"services",
"of",
"that",
"type",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_service.py#L342-L361 |
36,299 | saltstack/salt | salt/modules/rh_service.py | available | def available(name, limit=''):
'''
Return True if the named service is available. Use the ``limit`` param to
restrict results to services of that type.
CLI Examples:
.. code-block:: bash
salt '*' service.available sshd
salt '*' service.available sshd limit=upstart
salt '*... | python | def available(name, limit=''):
'''
Return True if the named service is available. Use the ``limit`` param to
restrict results to services of that type.
CLI Examples:
.. code-block:: bash
salt '*' service.available sshd
salt '*' service.available sshd limit=upstart
salt '*... | [
"def",
"available",
"(",
"name",
",",
"limit",
"=",
"''",
")",
":",
"if",
"limit",
"==",
"'upstart'",
":",
"return",
"_service_is_upstart",
"(",
"name",
")",
"elif",
"limit",
"==",
"'sysvinit'",
":",
"return",
"_service_is_sysv",
"(",
"name",
")",
"else",
... | Return True if the named service is available. Use the ``limit`` param to
restrict results to services of that type.
CLI Examples:
.. code-block:: bash
salt '*' service.available sshd
salt '*' service.available sshd limit=upstart
salt '*' service.available sshd limit=sysvinit | [
"Return",
"True",
"if",
"the",
"named",
"service",
"is",
"available",
".",
"Use",
"the",
"limit",
"param",
"to",
"restrict",
"results",
"to",
"services",
"of",
"that",
"type",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_service.py#L364-L382 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.