repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/launchctl_service.py | get_all | def get_all():
'''
Return all installed services
CLI Example:
.. code-block:: bash
salt '*' service.get_all
'''
cmd = 'launchctl list'
service_lines = [
line for line in __salt__['cmd.run'](cmd).splitlines()
if not line.startswith('PID')
]
service_labels_... | python | def get_all():
'''
Return all installed services
CLI Example:
.. code-block:: bash
salt '*' service.get_all
'''
cmd = 'launchctl list'
service_lines = [
line for line in __salt__['cmd.run'](cmd).splitlines()
if not line.startswith('PID')
]
service_labels_... | [
"def",
"get_all",
"(",
")",
":",
"cmd",
"=",
"'launchctl list'",
"service_lines",
"=",
"[",
"line",
"for",
"line",
"in",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
")",
".",
"splitlines",
"(",
")",
"if",
"not",
"line",
".",
"startswith",
"(",
"'PID... | Return all installed services
CLI Example:
.. code-block:: bash
salt '*' service.get_all | [
"Return",
"all",
"installed",
"services"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/launchctl_service.py#L151-L173 | train |
saltstack/salt | salt/modules/launchctl_service.py | status | def status(name, runas=None):
'''
Return the status for a service via systemd.
If the name contains globbing, a dict mapping service name to True/False
values is returned.
.. versionchanged:: 2018.3.0
The service name can now be a glob (e.g. ``salt*``)
Args:
name (str): The nam... | python | def status(name, runas=None):
'''
Return the status for a service via systemd.
If the name contains globbing, a dict mapping service name to True/False
values is returned.
.. versionchanged:: 2018.3.0
The service name can now be a glob (e.g. ``salt*``)
Args:
name (str): The nam... | [
"def",
"status",
"(",
"name",
",",
"runas",
"=",
"None",
")",
":",
"contains_globbing",
"=",
"bool",
"(",
"re",
".",
"search",
"(",
"r'\\*|\\?|\\[.+\\]'",
",",
"name",
")",
")",
"if",
"contains_globbing",
":",
"services",
"=",
"fnmatch",
".",
"filter",
"... | Return the status for a service via systemd.
If the name contains globbing, a dict mapping service name to True/False
values is returned.
.. versionchanged:: 2018.3.0
The service name can now be a glob (e.g. ``salt*``)
Args:
name (str): The name of the service to check
runas (s... | [
"Return",
"the",
"status",
"for",
"a",
"service",
"via",
"systemd",
".",
"If",
"the",
"name",
"contains",
"globbing",
"a",
"dict",
"mapping",
"service",
"name",
"to",
"True",
"/",
"False",
"values",
"is",
"returned",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/launchctl_service.py#L222-L271 | train |
saltstack/salt | salt/modules/launchctl_service.py | start | def start(job_label, runas=None):
'''
Start the specified service
CLI Example:
.. code-block:: bash
salt '*' service.start <service label>
salt '*' service.start org.ntp.ntpd
salt '*' service.start /System/Library/LaunchDaemons/org.ntp.ntpd.plist
'''
service = _service... | python | def start(job_label, runas=None):
'''
Start the specified service
CLI Example:
.. code-block:: bash
salt '*' service.start <service label>
salt '*' service.start org.ntp.ntpd
salt '*' service.start /System/Library/LaunchDaemons/org.ntp.ntpd.plist
'''
service = _service... | [
"def",
"start",
"(",
"job_label",
",",
"runas",
"=",
"None",
")",
":",
"service",
"=",
"_service_by_name",
"(",
"job_label",
")",
"if",
"service",
":",
"cmd",
"=",
"'launchctl load -w {0}'",
".",
"format",
"(",
"service",
"[",
"'file_path'",
"]",
",",
"run... | Start the specified service
CLI Example:
.. code-block:: bash
salt '*' service.start <service label>
salt '*' service.start org.ntp.ntpd
salt '*' service.start /System/Library/LaunchDaemons/org.ntp.ntpd.plist | [
"Start",
"the",
"specified",
"service"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/launchctl_service.py#L295-L312 | train |
saltstack/salt | salt/modules/launchctl_service.py | restart | def restart(job_label, runas=None):
'''
Restart the named service
CLI Example:
.. code-block:: bash
salt '*' service.restart <service label>
'''
stop(job_label, runas=runas)
return start(job_label, runas=runas) | python | def restart(job_label, runas=None):
'''
Restart the named service
CLI Example:
.. code-block:: bash
salt '*' service.restart <service label>
'''
stop(job_label, runas=runas)
return start(job_label, runas=runas) | [
"def",
"restart",
"(",
"job_label",
",",
"runas",
"=",
"None",
")",
":",
"stop",
"(",
"job_label",
",",
"runas",
"=",
"runas",
")",
"return",
"start",
"(",
"job_label",
",",
"runas",
"=",
"runas",
")"
] | Restart the named service
CLI Example:
.. code-block:: bash
salt '*' service.restart <service label> | [
"Restart",
"the",
"named",
"service"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/launchctl_service.py#L315-L326 | train |
saltstack/salt | salt/modules/launchctl_service.py | enabled | def enabled(job_label, runas=None):
'''
Return True if the named service is enabled, false otherwise
CLI Example:
.. code-block:: bash
salt '*' service.enabled <service label>
'''
overrides_data = dict(plistlib.readPlist(
'/var/db/launchd.db/com.apple.launchd/overrides.plist'
... | python | def enabled(job_label, runas=None):
'''
Return True if the named service is enabled, false otherwise
CLI Example:
.. code-block:: bash
salt '*' service.enabled <service label>
'''
overrides_data = dict(plistlib.readPlist(
'/var/db/launchd.db/com.apple.launchd/overrides.plist'
... | [
"def",
"enabled",
"(",
"job_label",
",",
"runas",
"=",
"None",
")",
":",
"overrides_data",
"=",
"dict",
"(",
"plistlib",
".",
"readPlist",
"(",
"'/var/db/launchd.db/com.apple.launchd/overrides.plist'",
")",
")",
"if",
"overrides_data",
".",
"get",
"(",
"job_label"... | Return True if the named service is enabled, false otherwise
CLI Example:
.. code-block:: bash
salt '*' service.enabled <service label> | [
"Return",
"True",
"if",
"the",
"named",
"service",
"is",
"enabled",
"false",
"otherwise"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/launchctl_service.py#L329-L348 | train |
saltstack/salt | salt/modules/mandrill.py | _get_api_params | def _get_api_params(api_url=None,
api_version=None,
api_key=None):
'''
Retrieve the API params from the config file.
'''
mandrill_cfg = __salt__['config.merge']('mandrill')
if not mandrill_cfg:
mandrill_cfg = {}
return {
'api_url': api_url ... | python | def _get_api_params(api_url=None,
api_version=None,
api_key=None):
'''
Retrieve the API params from the config file.
'''
mandrill_cfg = __salt__['config.merge']('mandrill')
if not mandrill_cfg:
mandrill_cfg = {}
return {
'api_url': api_url ... | [
"def",
"_get_api_params",
"(",
"api_url",
"=",
"None",
",",
"api_version",
"=",
"None",
",",
"api_key",
"=",
"None",
")",
":",
"mandrill_cfg",
"=",
"__salt__",
"[",
"'config.merge'",
"]",
"(",
"'mandrill'",
")",
"if",
"not",
"mandrill_cfg",
":",
"mandrill_cf... | Retrieve the API params from the config file. | [
"Retrieve",
"the",
"API",
"params",
"from",
"the",
"config",
"file",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mandrill.py#L64-L77 | train |
saltstack/salt | salt/modules/mandrill.py | _get_url | def _get_url(method,
api_url,
api_version):
'''
Build the API URL.
'''
return '{url}/{version}/{method}.json'.format(url=api_url,
version=float(api_version),
method=method) | python | def _get_url(method,
api_url,
api_version):
'''
Build the API URL.
'''
return '{url}/{version}/{method}.json'.format(url=api_url,
version=float(api_version),
method=method) | [
"def",
"_get_url",
"(",
"method",
",",
"api_url",
",",
"api_version",
")",
":",
"return",
"'{url}/{version}/{method}.json'",
".",
"format",
"(",
"url",
"=",
"api_url",
",",
"version",
"=",
"float",
"(",
"api_version",
")",
",",
"method",
"=",
"method",
")"
] | Build the API URL. | [
"Build",
"the",
"API",
"URL",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mandrill.py#L80-L88 | train |
saltstack/salt | salt/modules/mandrill.py | _http_request | def _http_request(url,
headers=None,
data=None):
'''
Make the HTTP request and return the body as python object.
'''
if not headers:
headers = _get_headers()
session = requests.session()
log.debug('Querying %s', url)
req = session.post(url,
... | python | def _http_request(url,
headers=None,
data=None):
'''
Make the HTTP request and return the body as python object.
'''
if not headers:
headers = _get_headers()
session = requests.session()
log.debug('Querying %s', url)
req = session.post(url,
... | [
"def",
"_http_request",
"(",
"url",
",",
"headers",
"=",
"None",
",",
"data",
"=",
"None",
")",
":",
"if",
"not",
"headers",
":",
"headers",
"=",
"_get_headers",
"(",
")",
"session",
"=",
"requests",
".",
"session",
"(",
")",
"log",
".",
"debug",
"("... | Make the HTTP request and return the body as python object. | [
"Make",
"the",
"HTTP",
"request",
"and",
"return",
"the",
"body",
"as",
"python",
"object",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mandrill.py#L101-L132 | train |
saltstack/salt | salt/modules/mandrill.py | send | def send(message,
asynchronous=False,
ip_pool=None,
send_at=None,
api_url=None,
api_version=None,
api_key=None,
**kwargs):
'''
Send out the email using the details from the ``message`` argument.
message
The information on the message to... | python | def send(message,
asynchronous=False,
ip_pool=None,
send_at=None,
api_url=None,
api_version=None,
api_key=None,
**kwargs):
'''
Send out the email using the details from the ``message`` argument.
message
The information on the message to... | [
"def",
"send",
"(",
"message",
",",
"asynchronous",
"=",
"False",
",",
"ip_pool",
"=",
"None",
",",
"send_at",
"=",
"None",
",",
"api_url",
"=",
"None",
",",
"api_version",
"=",
"None",
",",
"api_key",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
... | Send out the email using the details from the ``message`` argument.
message
The information on the message to send. This argument must be
sent as dictionary with at fields as specified in the Mandrill API
documentation.
asynchronous: ``False``
Enable a background sending mode t... | [
"Send",
"out",
"the",
"email",
"using",
"the",
"details",
"from",
"the",
"message",
"argument",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mandrill.py#L140-L252 | train |
saltstack/salt | salt/states/modjk_worker.py | _send_command | def _send_command(cmd,
worker,
lbn,
target,
profile='default',
tgt_type='glob'):
'''
Send a command to the modjk loadbalancer
The minion need to be able to publish the commands to the load balancer
cmd:
wo... | python | def _send_command(cmd,
worker,
lbn,
target,
profile='default',
tgt_type='glob'):
'''
Send a command to the modjk loadbalancer
The minion need to be able to publish the commands to the load balancer
cmd:
wo... | [
"def",
"_send_command",
"(",
"cmd",
",",
"worker",
",",
"lbn",
",",
"target",
",",
"profile",
"=",
"'default'",
",",
"tgt_type",
"=",
"'glob'",
")",
":",
"ret",
"=",
"{",
"'code'",
":",
"False",
",",
"'msg'",
":",
"'OK'",
",",
"'minions'",
":",
"[",
... | Send a command to the modjk loadbalancer
The minion need to be able to publish the commands to the load balancer
cmd:
worker_stop - won't get any traffic from the lbn
worker_activate - activate the worker
worker_disable - will get traffic only for current sessions | [
"Send",
"a",
"command",
"to",
"the",
"modjk",
"loadbalancer",
"The",
"minion",
"need",
"to",
"be",
"able",
"to",
"publish",
"the",
"commands",
"to",
"the",
"load",
"balancer"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/modjk_worker.py#L31-L80 | train |
saltstack/salt | salt/states/modjk_worker.py | _worker_status | def _worker_status(target,
worker,
activation,
profile='default',
tgt_type='glob'):
'''
Check if the worker is in `activation` state in the targeted load balancers
The function will return the following dictionary:
result -... | python | def _worker_status(target,
worker,
activation,
profile='default',
tgt_type='glob'):
'''
Check if the worker is in `activation` state in the targeted load balancers
The function will return the following dictionary:
result -... | [
"def",
"_worker_status",
"(",
"target",
",",
"worker",
",",
"activation",
",",
"profile",
"=",
"'default'",
",",
"tgt_type",
"=",
"'glob'",
")",
":",
"ret",
"=",
"{",
"'result'",
":",
"True",
",",
"'errors'",
":",
"[",
"]",
",",
"'wrong_state'",
":",
"... | Check if the worker is in `activation` state in the targeted load balancers
The function will return the following dictionary:
result - False if no server returned from the published command
errors - list of servers that couldn't find the worker
wrong_state - list of servers that the worker... | [
"Check",
"if",
"the",
"worker",
"is",
"in",
"activation",
"state",
"in",
"the",
"targeted",
"load",
"balancers"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/modjk_worker.py#L83-L121 | train |
saltstack/salt | salt/states/modjk_worker.py | _talk2modjk | def _talk2modjk(name, lbn, target, action, profile='default', tgt_type='glob'):
'''
Wrapper function for the stop/disable/activate functions
'''
ret = {'name': name,
'result': True,
'changes': {},
'comment': ''}
action_map = {
'worker_stop': 'STP',
... | python | def _talk2modjk(name, lbn, target, action, profile='default', tgt_type='glob'):
'''
Wrapper function for the stop/disable/activate functions
'''
ret = {'name': name,
'result': True,
'changes': {},
'comment': ''}
action_map = {
'worker_stop': 'STP',
... | [
"def",
"_talk2modjk",
"(",
"name",
",",
"lbn",
",",
"target",
",",
"action",
",",
"profile",
"=",
"'default'",
",",
"tgt_type",
"=",
"'glob'",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'changes'",
":",
"{",... | Wrapper function for the stop/disable/activate functions | [
"Wrapper",
"function",
"for",
"the",
"stop",
"/",
"disable",
"/",
"activate",
"functions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/modjk_worker.py#L124-L171 | train |
saltstack/salt | salt/states/modjk_worker.py | stop | def stop(name, lbn, target, profile='default', tgt_type='glob'):
'''
.. versionchanged:: 2017.7.0
The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
releases must use ``expr_form``.
Stop the named worker from the lbn load balancers at the targeted minions
The worker wo... | python | def stop(name, lbn, target, profile='default', tgt_type='glob'):
'''
.. versionchanged:: 2017.7.0
The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
releases must use ``expr_form``.
Stop the named worker from the lbn load balancers at the targeted minions
The worker wo... | [
"def",
"stop",
"(",
"name",
",",
"lbn",
",",
"target",
",",
"profile",
"=",
"'default'",
",",
"tgt_type",
"=",
"'glob'",
")",
":",
"return",
"_talk2modjk",
"(",
"name",
",",
"lbn",
",",
"target",
",",
"'worker_stop'",
",",
"profile",
",",
"tgt_type",
"... | .. versionchanged:: 2017.7.0
The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
releases must use ``expr_form``.
Stop the named worker from the lbn load balancers at the targeted minions
The worker won't get any traffic from the lbn
Example:
.. code-block:: yaml
... | [
"..",
"versionchanged",
"::",
"2017",
".",
"7",
".",
"0",
"The",
"expr_form",
"argument",
"has",
"been",
"renamed",
"to",
"tgt_type",
"earlier",
"releases",
"must",
"use",
"expr_form",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/modjk_worker.py#L174-L194 | train |
saltstack/salt | salt/states/modjk_worker.py | activate | def activate(name, lbn, target, profile='default', tgt_type='glob'):
'''
.. versionchanged:: 2017.7.0
The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
releases must use ``expr_form``.
Activate the named worker from the lbn load balancers at the targeted
minions
... | python | def activate(name, lbn, target, profile='default', tgt_type='glob'):
'''
.. versionchanged:: 2017.7.0
The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
releases must use ``expr_form``.
Activate the named worker from the lbn load balancers at the targeted
minions
... | [
"def",
"activate",
"(",
"name",
",",
"lbn",
",",
"target",
",",
"profile",
"=",
"'default'",
",",
"tgt_type",
"=",
"'glob'",
")",
":",
"return",
"_talk2modjk",
"(",
"name",
",",
"lbn",
",",
"target",
",",
"'worker_activate'",
",",
"profile",
",",
"tgt_ty... | .. versionchanged:: 2017.7.0
The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
releases must use ``expr_form``.
Activate the named worker from the lbn load balancers at the targeted
minions
Example:
.. code-block:: yaml
disable-before-deploy:
modj... | [
"..",
"versionchanged",
"::",
"2017",
".",
"7",
".",
"0",
"The",
"expr_form",
"argument",
"has",
"been",
"renamed",
"to",
"tgt_type",
"earlier",
"releases",
"must",
"use",
"expr_form",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/modjk_worker.py#L197-L217 | train |
saltstack/salt | salt/states/modjk_worker.py | disable | def disable(name, lbn, target, profile='default', tgt_type='glob'):
'''
.. versionchanged:: 2017.7.0
The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
releases must use ``expr_form``.
Disable the named worker from the lbn load balancers at the targeted
minions. The wo... | python | def disable(name, lbn, target, profile='default', tgt_type='glob'):
'''
.. versionchanged:: 2017.7.0
The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
releases must use ``expr_form``.
Disable the named worker from the lbn load balancers at the targeted
minions. The wo... | [
"def",
"disable",
"(",
"name",
",",
"lbn",
",",
"target",
",",
"profile",
"=",
"'default'",
",",
"tgt_type",
"=",
"'glob'",
")",
":",
"return",
"_talk2modjk",
"(",
"name",
",",
"lbn",
",",
"target",
",",
"'worker_disable'",
",",
"profile",
",",
"tgt_type... | .. versionchanged:: 2017.7.0
The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
releases must use ``expr_form``.
Disable the named worker from the lbn load balancers at the targeted
minions. The worker will get traffic only for current sessions and won't
get new ones.
... | [
"..",
"versionchanged",
"::",
"2017",
".",
"7",
".",
"0",
"The",
"expr_form",
"argument",
"has",
"been",
"renamed",
"to",
"tgt_type",
"earlier",
"releases",
"must",
"use",
"expr_form",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/modjk_worker.py#L220-L241 | train |
saltstack/salt | salt/grains/metadata.py | _search | def _search(prefix="latest/"):
'''
Recursively look up all grains in the metadata server
'''
ret = {}
linedata = http.query(os.path.join(HOST, prefix), headers=True)
if 'body' not in linedata:
return ret
body = salt.utils.stringutils.to_unicode(linedata['body'])
if linedata['head... | python | def _search(prefix="latest/"):
'''
Recursively look up all grains in the metadata server
'''
ret = {}
linedata = http.query(os.path.join(HOST, prefix), headers=True)
if 'body' not in linedata:
return ret
body = salt.utils.stringutils.to_unicode(linedata['body'])
if linedata['head... | [
"def",
"_search",
"(",
"prefix",
"=",
"\"latest/\"",
")",
":",
"ret",
"=",
"{",
"}",
"linedata",
"=",
"http",
".",
"query",
"(",
"os",
".",
"path",
".",
"join",
"(",
"HOST",
",",
"prefix",
")",
",",
"headers",
"=",
"True",
")",
"if",
"'body'",
"n... | Recursively look up all grains in the metadata server | [
"Recursively",
"look",
"up",
"all",
"grains",
"in",
"the",
"metadata",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/metadata.py#L49-L84 | train |
saltstack/salt | salt/client/ssh/wrapper/grains.py | has_value | def has_value(key):
'''
Determine whether a named value exists in the grains dictionary.
Given a grains dictionary that contains the following structure::
{'pkg': {'apache': 'httpd'}}
One would determine if the apache key in the pkg dict exists by::
pkg:apache
CLI Example:
... | python | def has_value(key):
'''
Determine whether a named value exists in the grains dictionary.
Given a grains dictionary that contains the following structure::
{'pkg': {'apache': 'httpd'}}
One would determine if the apache key in the pkg dict exists by::
pkg:apache
CLI Example:
... | [
"def",
"has_value",
"(",
"key",
")",
":",
"return",
"True",
"if",
"salt",
".",
"utils",
".",
"data",
".",
"traverse_dict_and_list",
"(",
"__grains__",
",",
"key",
",",
"False",
")",
"else",
"False"
] | Determine whether a named value exists in the grains dictionary.
Given a grains dictionary that contains the following structure::
{'pkg': {'apache': 'httpd'}}
One would determine if the apache key in the pkg dict exists by::
pkg:apache
CLI Example:
.. code-block:: bash
sa... | [
"Determine",
"whether",
"a",
"named",
"value",
"exists",
"in",
"the",
"grains",
"dictionary",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/grains.py#L85-L105 | train |
saltstack/salt | salt/client/ssh/wrapper/grains.py | item | def item(*args, **kwargs):
'''
Return one or more grains
CLI Example:
.. code-block:: bash
salt '*' grains.item os
salt '*' grains.item os osrelease oscodename
Sanitized CLI Example:
.. code-block:: bash
salt '*' grains.item host sanitize=True
'''
ret = {}
... | python | def item(*args, **kwargs):
'''
Return one or more grains
CLI Example:
.. code-block:: bash
salt '*' grains.item os
salt '*' grains.item os osrelease oscodename
Sanitized CLI Example:
.. code-block:: bash
salt '*' grains.item host sanitize=True
'''
ret = {}
... | [
"def",
"item",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"arg",
"in",
"args",
":",
"try",
":",
"ret",
"[",
"arg",
"]",
"=",
"__grains__",
"[",
"arg",
"]",
"except",
"KeyError",
":",
"pass",
"if",
"salt",
... | Return one or more grains
CLI Example:
.. code-block:: bash
salt '*' grains.item os
salt '*' grains.item os osrelease oscodename
Sanitized CLI Example:
.. code-block:: bash
salt '*' grains.item host sanitize=True | [
"Return",
"one",
"or",
"more",
"grains"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/grains.py#L134-L161 | train |
saltstack/salt | salt/client/ssh/wrapper/grains.py | filter_by | def filter_by(lookup_dict,
grain='os_family',
merge=None,
default='default',
base=None):
'''
.. versionadded:: 0.17.0
Look up the given grain in a given dictionary for the current OS and return
the result
Although this may occasionally be use... | python | def filter_by(lookup_dict,
grain='os_family',
merge=None,
default='default',
base=None):
'''
.. versionadded:: 0.17.0
Look up the given grain in a given dictionary for the current OS and return
the result
Although this may occasionally be use... | [
"def",
"filter_by",
"(",
"lookup_dict",
",",
"grain",
"=",
"'os_family'",
",",
"merge",
"=",
"None",
",",
"default",
"=",
"'default'",
",",
"base",
"=",
"None",
")",
":",
"ret",
"=",
"lookup_dict",
".",
"get",
"(",
"__grains__",
".",
"get",
"(",
"grain... | .. versionadded:: 0.17.0
Look up the given grain in a given dictionary for the current OS and return
the result
Although this may occasionally be useful at the CLI, the primary intent of
this function is for use in Jinja to make short work of creating lookup
tables for OS-specific data. For exampl... | [
"..",
"versionadded",
"::",
"0",
".",
"17",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/grains.py#L177-L286 | train |
saltstack/salt | salt/states/boto_vpc.py | present | def present(name, cidr_block, instance_tenancy=None, dns_support=None,
dns_hostnames=None, tags=None, region=None, key=None, keyid=None,
profile=None):
'''
Ensure VPC exists.
name
Name of the VPC.
cidr_block
The range of IPs in CIDR format, for example: 10.0.0.0... | python | def present(name, cidr_block, instance_tenancy=None, dns_support=None,
dns_hostnames=None, tags=None, region=None, key=None, keyid=None,
profile=None):
'''
Ensure VPC exists.
name
Name of the VPC.
cidr_block
The range of IPs in CIDR format, for example: 10.0.0.0... | [
"def",
"present",
"(",
"name",
",",
"cidr_block",
",",
"instance_tenancy",
"=",
"None",
",",
"dns_support",
"=",
"None",
",",
"dns_hostnames",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"="... | Ensure VPC exists.
name
Name of the VPC.
cidr_block
The range of IPs in CIDR format, for example: 10.0.0.0/24. Block
size must be between /16 and /28 netmask.
instance_tenancy
Instances launched in this VPC will be ingle-tenant or dedicated
hardware.
dns_suppo... | [
"Ensure",
"VPC",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_vpc.py#L172-L245 | train |
saltstack/salt | salt/states/boto_vpc.py | absent | def absent(name, tags=None, region=None, key=None, keyid=None, profile=None):
'''
Ensure VPC with passed properties is absent.
name
Name of the VPC.
tags
A list of tags. All tags must match.
region
Region to connect to.
key
Secret key to be used.
keyid
... | python | def absent(name, tags=None, region=None, key=None, keyid=None, profile=None):
'''
Ensure VPC with passed properties is absent.
name
Name of the VPC.
tags
A list of tags. All tags must match.
region
Region to connect to.
key
Secret key to be used.
keyid
... | [
"def",
"absent",
"(",
"name",
",",
"tags",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
... | Ensure VPC with passed properties is absent.
name
Name of the VPC.
tags
A list of tags. All tags must match.
region
Region to connect to.
key
Secret key to be used.
keyid
Access key to be used.
profile
A dict with region, key and keyid, or a ... | [
"Ensure",
"VPC",
"with",
"passed",
"properties",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_vpc.py#L248-L304 | train |
saltstack/salt | salt/states/boto_vpc.py | dhcp_options_present | def dhcp_options_present(name, dhcp_options_id=None, vpc_name=None, vpc_id=None,
domain_name=None, domain_name_servers=None, ntp_servers=None,
netbios_name_servers=None, netbios_node_type=None,
tags=None, region=None, key=None, keyid=None, profi... | python | def dhcp_options_present(name, dhcp_options_id=None, vpc_name=None, vpc_id=None,
domain_name=None, domain_name_servers=None, ntp_servers=None,
netbios_name_servers=None, netbios_node_type=None,
tags=None, region=None, key=None, keyid=None, profi... | [
"def",
"dhcp_options_present",
"(",
"name",
",",
"dhcp_options_id",
"=",
"None",
",",
"vpc_name",
"=",
"None",
",",
"vpc_id",
"=",
"None",
",",
"domain_name",
"=",
"None",
",",
"domain_name_servers",
"=",
"None",
",",
"ntp_servers",
"=",
"None",
",",
"netbio... | Ensure a set of DHCP options with the given settings exist.
Note that the current implementation only SETS values during option set
creation. It is unable to update option sets in place, and thus merely
verifies the set exists via the given name and/or dhcp_options_id param.
name
(string)
... | [
"Ensure",
"a",
"set",
"of",
"DHCP",
"options",
"with",
"the",
"given",
"settings",
"exist",
".",
"Note",
"that",
"the",
"current",
"implementation",
"only",
"SETS",
"values",
"during",
"option",
"set",
"creation",
".",
"It",
"is",
"unable",
"to",
"update",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_vpc.py#L307-L428 | train |
saltstack/salt | salt/states/boto_vpc.py | dhcp_options_absent | def dhcp_options_absent(name=None, dhcp_options_id=None, region=None, key=None, keyid=None, profile=None):
'''
Ensure a set of DHCP options with the given settings exist.
name
(string)
Name of the DHCP options set.
dhcp_options_id
(string)
Id of the DHCP options set.
... | python | def dhcp_options_absent(name=None, dhcp_options_id=None, region=None, key=None, keyid=None, profile=None):
'''
Ensure a set of DHCP options with the given settings exist.
name
(string)
Name of the DHCP options set.
dhcp_options_id
(string)
Id of the DHCP options set.
... | [
"def",
"dhcp_options_absent",
"(",
"name",
"=",
"None",
",",
"dhcp_options_id",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name"... | Ensure a set of DHCP options with the given settings exist.
name
(string)
Name of the DHCP options set.
dhcp_options_id
(string)
Id of the DHCP options set.
region
(string)
Region to connect to.
key
(string)
Secret key to be used.
... | [
"Ensure",
"a",
"set",
"of",
"DHCP",
"options",
"with",
"the",
"given",
"settings",
"exist",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_vpc.py#L431-L497 | train |
saltstack/salt | salt/states/boto_vpc.py | subnet_present | def subnet_present(name, cidr_block, vpc_name=None, vpc_id=None,
availability_zone=None, tags=None,
region=None, key=None,
keyid=None, profile=None,
route_table_id=None, route_table_name=None, auto_assign_public_ipv4=False):
'''
Ensure... | python | def subnet_present(name, cidr_block, vpc_name=None, vpc_id=None,
availability_zone=None, tags=None,
region=None, key=None,
keyid=None, profile=None,
route_table_id=None, route_table_name=None, auto_assign_public_ipv4=False):
'''
Ensure... | [
"def",
"subnet_present",
"(",
"name",
",",
"cidr_block",
",",
"vpc_name",
"=",
"None",
",",
"vpc_id",
"=",
"None",
",",
"availability_zone",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
... | Ensure a subnet exists.
name
Name of the subnet.
cidr_block
The range if IPs for the subnet, in CIDR format. For example:
10.0.0.0/24. Block size must be between /16 and /28 netmask.
vpc_name
Name of the VPC in which the subnet should be placed. Either
vpc_name or ... | [
"Ensure",
"a",
"subnet",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_vpc.py#L500-L671 | train |
saltstack/salt | salt/states/boto_vpc.py | _verify_subnet_association | def _verify_subnet_association(route_table_desc, subnet_id):
'''
Helper function verify a subnet's route table association
route_table_desc
the description of a route table, as returned from boto_vpc.describe_route_table
subnet_id
the subnet id to verify
.. versionadded:: 2016.11.... | python | def _verify_subnet_association(route_table_desc, subnet_id):
'''
Helper function verify a subnet's route table association
route_table_desc
the description of a route table, as returned from boto_vpc.describe_route_table
subnet_id
the subnet id to verify
.. versionadded:: 2016.11.... | [
"def",
"_verify_subnet_association",
"(",
"route_table_desc",
",",
"subnet_id",
")",
":",
"if",
"route_table_desc",
":",
"if",
"'associations'",
"in",
"route_table_desc",
":",
"for",
"association",
"in",
"route_table_desc",
"[",
"'associations'",
"]",
":",
"if",
"as... | Helper function verify a subnet's route table association
route_table_desc
the description of a route table, as returned from boto_vpc.describe_route_table
subnet_id
the subnet id to verify
.. versionadded:: 2016.11.0 | [
"Helper",
"function",
"verify",
"a",
"subnet",
"s",
"route",
"table",
"association"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_vpc.py#L674-L691 | train |
saltstack/salt | salt/states/boto_vpc.py | subnet_absent | def subnet_absent(name=None, subnet_id=None, region=None, key=None, keyid=None, profile=None):
'''
Ensure subnet with passed properties is absent.
name
Name of the subnet.
region
Region to connect to.
key
Secret key to be used.
keyid
Access key to be used.
... | python | def subnet_absent(name=None, subnet_id=None, region=None, key=None, keyid=None, profile=None):
'''
Ensure subnet with passed properties is absent.
name
Name of the subnet.
region
Region to connect to.
key
Secret key to be used.
keyid
Access key to be used.
... | [
"def",
"subnet_absent",
"(",
"name",
"=",
"None",
",",
"subnet_id",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"... | Ensure subnet with passed properties is absent.
name
Name of the subnet.
region
Region to connect to.
key
Secret key to be used.
keyid
Access key to be used.
profile
A dict with region, key and keyid, or a pillar key (string) that
contains a dict ... | [
"Ensure",
"subnet",
"with",
"passed",
"properties",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_vpc.py#L694-L751 | train |
saltstack/salt | salt/states/boto_vpc.py | internet_gateway_present | def internet_gateway_present(name, vpc_name=None, vpc_id=None,
tags=None, region=None, key=None,
keyid=None, profile=None):
'''
Ensure an internet gateway exists.
name
Name of the internet gateway.
vpc_name
Name of the VPC to wh... | python | def internet_gateway_present(name, vpc_name=None, vpc_id=None,
tags=None, region=None, key=None,
keyid=None, profile=None):
'''
Ensure an internet gateway exists.
name
Name of the internet gateway.
vpc_name
Name of the VPC to wh... | [
"def",
"internet_gateway_present",
"(",
"name",
",",
"vpc_name",
"=",
"None",
",",
"vpc_id",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",... | Ensure an internet gateway exists.
name
Name of the internet gateway.
vpc_name
Name of the VPC to which the internet gateway should be attached.
vpc_id
Id of the VPC to which the internet_gateway should be attached.
Only one of vpc_name or vpc_id may be provided.
tags... | [
"Ensure",
"an",
"internet",
"gateway",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_vpc.py#L754-L821 | train |
saltstack/salt | salt/states/boto_vpc.py | internet_gateway_absent | def internet_gateway_absent(name, detach=False, region=None,
key=None, keyid=None, profile=None):
'''
Ensure the named internet gateway is absent.
name
Name of the internet gateway.
detach
First detach the internet gateway from a VPC, if attached.
regio... | python | def internet_gateway_absent(name, detach=False, region=None,
key=None, keyid=None, profile=None):
'''
Ensure the named internet gateway is absent.
name
Name of the internet gateway.
detach
First detach the internet gateway from a VPC, if attached.
regio... | [
"def",
"internet_gateway_absent",
"(",
"name",
",",
"detach",
"=",
"False",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'"... | Ensure the named internet gateway is absent.
name
Name of the internet gateway.
detach
First detach the internet gateway from a VPC, if attached.
region
Region to connect to.
key
Secret key to be used.
keyid
Access key to be used.
profile
A d... | [
"Ensure",
"the",
"named",
"internet",
"gateway",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_vpc.py#L824-L883 | train |
saltstack/salt | salt/states/boto_vpc.py | route_table_present | def route_table_present(name, vpc_name=None, vpc_id=None, routes=None,
subnet_ids=None, subnet_names=None, tags=None,
region=None, key=None, keyid=None, profile=None):
'''
Ensure route table with routes exists and is associated to a VPC.
This function require... | python | def route_table_present(name, vpc_name=None, vpc_id=None, routes=None,
subnet_ids=None, subnet_names=None, tags=None,
region=None, key=None, keyid=None, profile=None):
'''
Ensure route table with routes exists and is associated to a VPC.
This function require... | [
"def",
"route_table_present",
"(",
"name",
",",
"vpc_name",
"=",
"None",
",",
"vpc_id",
"=",
"None",
",",
"routes",
"=",
"None",
",",
"subnet_ids",
"=",
"None",
",",
"subnet_names",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"region",
"=",
"None",
","... | Ensure route table with routes exists and is associated to a VPC.
This function requires boto3 to be installed if nat gatewyas are specified.
Example:
.. code-block:: yaml
boto_vpc.route_table_present:
- name: my_route_table
- vpc_id: vpc-123456
- routes:
... | [
"Ensure",
"route",
"table",
"with",
"routes",
"exists",
"and",
"is",
"associated",
"to",
"a",
"VPC",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_vpc.py#L886-L983 | train |
saltstack/salt | salt/states/boto_vpc.py | route_table_absent | def route_table_absent(name, region=None,
key=None, keyid=None, profile=None):
'''
Ensure the named route table is absent.
name
Name of the route table.
region
Region to connect to.
key
Secret key to be used.
keyid
Access key to be used.... | python | def route_table_absent(name, region=None,
key=None, keyid=None, profile=None):
'''
Ensure the named route table is absent.
name
Name of the route table.
region
Region to connect to.
key
Secret key to be used.
keyid
Access key to be used.... | [
"def",
"route_table_absent",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'comment'",
... | Ensure the named route table is absent.
name
Name of the route table.
region
Region to connect to.
key
Secret key to be used.
keyid
Access key to be used.
profile
A dict with region, key and keyid, or a pillar key (string) that
contains a dict wit... | [
"Ensure",
"the",
"named",
"route",
"table",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_vpc.py#L1235-L1293 | train |
saltstack/salt | salt/states/boto_vpc.py | nat_gateway_present | def nat_gateway_present(name, subnet_name=None, subnet_id=None,
region=None, key=None, keyid=None, profile=None, allocation_id=None):
'''
Ensure a nat gateway exists within the specified subnet
This function requires boto3.
.. versionadded:: 2016.11.0
Example:
.. code... | python | def nat_gateway_present(name, subnet_name=None, subnet_id=None,
region=None, key=None, keyid=None, profile=None, allocation_id=None):
'''
Ensure a nat gateway exists within the specified subnet
This function requires boto3.
.. versionadded:: 2016.11.0
Example:
.. code... | [
"def",
"nat_gateway_present",
"(",
"name",
",",
"subnet_name",
"=",
"None",
",",
"subnet_id",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"allocation_id",
"=",
"None",
"... | Ensure a nat gateway exists within the specified subnet
This function requires boto3.
.. versionadded:: 2016.11.0
Example:
.. code-block:: yaml
boto_vpc.nat_gateway_present:
- subnet_name: my-subnet
name
Name of the state
subnet_name
Name of the subnet wi... | [
"Ensure",
"a",
"nat",
"gateway",
"exists",
"within",
"the",
"specified",
"subnet"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_vpc.py#L1296-L1374 | train |
saltstack/salt | salt/states/boto_vpc.py | nat_gateway_absent | def nat_gateway_absent(name=None, subnet_name=None, subnet_id=None,
region=None, key=None, keyid=None, profile=None,
wait_for_delete_retries=0):
'''
Ensure the nat gateway in the named subnet is absent.
This function requires boto3.
.. versionadded:: 2016.... | python | def nat_gateway_absent(name=None, subnet_name=None, subnet_id=None,
region=None, key=None, keyid=None, profile=None,
wait_for_delete_retries=0):
'''
Ensure the nat gateway in the named subnet is absent.
This function requires boto3.
.. versionadded:: 2016.... | [
"def",
"nat_gateway_absent",
"(",
"name",
"=",
"None",
",",
"subnet_name",
"=",
"None",
",",
"subnet_id",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"wait_for_delete_retr... | Ensure the nat gateway in the named subnet is absent.
This function requires boto3.
.. versionadded:: 2016.11.0
name
Name of the state.
subnet_name
Name of the subnet within which the nat gateway should exist
subnet_id
Id of the subnet within which the nat gateway should... | [
"Ensure",
"the",
"nat",
"gateway",
"in",
"the",
"named",
"subnet",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_vpc.py#L1377-L1454 | train |
saltstack/salt | salt/states/boto_vpc.py | accept_vpc_peering_connection | def accept_vpc_peering_connection(name=None, conn_id=None, conn_name=None,
region=None, key=None, keyid=None, profile=None):
'''
Accept a VPC pending requested peering connection between two VPCs.
name
Name of this state
conn_id
The connection ID to ac... | python | def accept_vpc_peering_connection(name=None, conn_id=None, conn_name=None,
region=None, key=None, keyid=None, profile=None):
'''
Accept a VPC pending requested peering connection between two VPCs.
name
Name of this state
conn_id
The connection ID to ac... | [
"def",
"accept_vpc_peering_connection",
"(",
"name",
"=",
"None",
",",
"conn_id",
"=",
"None",
",",
"conn_name",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"log",
... | Accept a VPC pending requested peering connection between two VPCs.
name
Name of this state
conn_id
The connection ID to accept. Exclusive with conn_name. String type.
conn_name
The name of the VPC peering connection to accept. Exclusive with conn_id. String type.
region
... | [
"Accept",
"a",
"VPC",
"pending",
"requested",
"peering",
"connection",
"between",
"two",
"VPCs",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_vpc.py#L1458-L1534 | train |
saltstack/salt | salt/states/boto_vpc.py | request_vpc_peering_connection | def request_vpc_peering_connection(name, requester_vpc_id=None, requester_vpc_name=None,
peer_vpc_id=None, peer_vpc_name=None, conn_name=None,
peer_owner_id=None, peer_region=None, region=None,
key=None, keyid=None,... | python | def request_vpc_peering_connection(name, requester_vpc_id=None, requester_vpc_name=None,
peer_vpc_id=None, peer_vpc_name=None, conn_name=None,
peer_owner_id=None, peer_region=None, region=None,
key=None, keyid=None,... | [
"def",
"request_vpc_peering_connection",
"(",
"name",
",",
"requester_vpc_id",
"=",
"None",
",",
"requester_vpc_name",
"=",
"None",
",",
"peer_vpc_id",
"=",
"None",
",",
"peer_vpc_name",
"=",
"None",
",",
"conn_name",
"=",
"None",
",",
"peer_owner_id",
"=",
"Non... | name
Name of the state
requester_vpc_id
ID of the requesting VPC. Exclusive with requester_vpc_name. String type.
requester_vpc_name
Name tag of the requesting VPC. Exclusive with requester_vpc_id. String type.
peer_vpc_id
ID of the VPC tp crete VPC peering connection wi... | [
"name",
"Name",
"of",
"the",
"state"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_vpc.py#L1538-L1646 | train |
saltstack/salt | salt/states/boto_vpc.py | vpc_peering_connection_present | def vpc_peering_connection_present(name, requester_vpc_id=None, requester_vpc_name=None,
peer_vpc_id=None, peer_vpc_name=None, conn_name=None,
peer_owner_id=None, peer_region=None, region=None,
key=None, keyid=None,... | python | def vpc_peering_connection_present(name, requester_vpc_id=None, requester_vpc_name=None,
peer_vpc_id=None, peer_vpc_name=None, conn_name=None,
peer_owner_id=None, peer_region=None, region=None,
key=None, keyid=None,... | [
"def",
"vpc_peering_connection_present",
"(",
"name",
",",
"requester_vpc_id",
"=",
"None",
",",
"requester_vpc_name",
"=",
"None",
",",
"peer_vpc_id",
"=",
"None",
",",
"peer_vpc_name",
"=",
"None",
",",
"conn_name",
"=",
"None",
",",
"peer_owner_id",
"=",
"Non... | name
Name of the state
requester_vpc_id
ID of the requesting VPC. Exclusive with requester_vpc_name.
requester_vpc_name
Name tag of the requesting VPC. Exclusive with requester_vpc_id.
peer_vpc_id
ID of the VPC tp crete VPC peering connection with. This can be a VPC in
... | [
"name",
"Name",
"of",
"the",
"state"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_vpc.py#L1649-L1736 | train |
saltstack/salt | salt/states/boto_vpc.py | delete_vpc_peering_connection | def delete_vpc_peering_connection(name, conn_id=None, conn_name=None,
region=None, key=None, keyid=None, profile=None):
'''
name
Name of the state
conn_id
ID of the peering connection to delete. Exclusive with conn_name.
conn_name
The name of ... | python | def delete_vpc_peering_connection(name, conn_id=None, conn_name=None,
region=None, key=None, keyid=None, profile=None):
'''
name
Name of the state
conn_id
ID of the peering connection to delete. Exclusive with conn_name.
conn_name
The name of ... | [
"def",
"delete_vpc_peering_connection",
"(",
"name",
",",
"conn_id",
"=",
"None",
",",
"conn_name",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"log",
".",
"debug",... | name
Name of the state
conn_id
ID of the peering connection to delete. Exclusive with conn_name.
conn_name
The name of the peering connection to delete. Exclusive with conn_id.
region
Region to connect to.
key
Secret key to be used.
keyid
Access... | [
"name",
"Name",
"of",
"the",
"state"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_vpc.py#L1745-L1829 | train |
saltstack/salt | salt/modules/ceph.py | zap | def zap(target=None, **kwargs):
'''
Destroy the partition table and content of a given disk.
.. code-block:: bash
salt '*' ceph.osd_prepare 'dev'='/dev/vdc' \\
'cluster_name'='ceph' \\
'cluster_uuid'='cluster_uuid'
dev
The block device to format.
c... | python | def zap(target=None, **kwargs):
'''
Destroy the partition table and content of a given disk.
.. code-block:: bash
salt '*' ceph.osd_prepare 'dev'='/dev/vdc' \\
'cluster_name'='ceph' \\
'cluster_uuid'='cluster_uuid'
dev
The block device to format.
c... | [
"def",
"zap",
"(",
"target",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"target",
"is",
"not",
"None",
":",
"log",
".",
"warning",
"(",
"\"Depricated use of function, use kwargs\"",
")",
"target",
"=",
"kwargs",
".",
"get",
"(",
"\"dev\"",
","... | Destroy the partition table and content of a given disk.
.. code-block:: bash
salt '*' ceph.osd_prepare 'dev'='/dev/vdc' \\
'cluster_name'='ceph' \\
'cluster_uuid'='cluster_uuid'
dev
The block device to format.
cluster_name
The cluster name. Defaul... | [
"Destroy",
"the",
"partition",
"table",
"and",
"content",
"of",
"a",
"given",
"disk",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ceph.py#L98-L121 | train |
saltstack/salt | salt/runners/f5.py | create_vs | def create_vs(lb, name, ip, port, protocol, profile, pool_name):
'''
Create a virtual server
CLI Examples:
.. code-block:: bash
salt-run f5.create_vs lbalancer vs_name 10.0.0.1 80 tcp http poolname
'''
if __opts__['load_balancers'].get(lb, None):
(username, password) = list(__... | python | def create_vs(lb, name, ip, port, protocol, profile, pool_name):
'''
Create a virtual server
CLI Examples:
.. code-block:: bash
salt-run f5.create_vs lbalancer vs_name 10.0.0.1 80 tcp http poolname
'''
if __opts__['load_balancers'].get(lb, None):
(username, password) = list(__... | [
"def",
"create_vs",
"(",
"lb",
",",
"name",
",",
"ip",
",",
"port",
",",
"protocol",
",",
"profile",
",",
"pool_name",
")",
":",
"if",
"__opts__",
"[",
"'load_balancers'",
"]",
".",
"get",
"(",
"lb",
",",
"None",
")",
":",
"(",
"username",
",",
"pa... | Create a virtual server
CLI Examples:
.. code-block:: bash
salt-run f5.create_vs lbalancer vs_name 10.0.0.1 80 tcp http poolname | [
"Create",
"a",
"virtual",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/f5.py#L235-L252 | train |
saltstack/salt | salt/runners/f5.py | create_pool | def create_pool(lb, name, method='ROUND_ROBIN'):
'''
Create a pool on the F5 load balancer
CLI Examples:
.. code-block:: bash
salt-run f5.create_pool load_balancer pool_name loadbalance_method
salt-run f5.create_pool load_balancer my_pool ROUND_ROBIN
'''
if __opts__['load_bala... | python | def create_pool(lb, name, method='ROUND_ROBIN'):
'''
Create a pool on the F5 load balancer
CLI Examples:
.. code-block:: bash
salt-run f5.create_pool load_balancer pool_name loadbalance_method
salt-run f5.create_pool load_balancer my_pool ROUND_ROBIN
'''
if __opts__['load_bala... | [
"def",
"create_pool",
"(",
"lb",
",",
"name",
",",
"method",
"=",
"'ROUND_ROBIN'",
")",
":",
"if",
"__opts__",
"[",
"'load_balancers'",
"]",
".",
"get",
"(",
"lb",
",",
"None",
")",
":",
"(",
"username",
",",
"password",
")",
"=",
"list",
"(",
"__opt... | Create a pool on the F5 load balancer
CLI Examples:
.. code-block:: bash
salt-run f5.create_pool load_balancer pool_name loadbalance_method
salt-run f5.create_pool load_balancer my_pool ROUND_ROBIN | [
"Create",
"a",
"pool",
"on",
"the",
"F5",
"load",
"balancer"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/f5.py#L255-L272 | train |
saltstack/salt | salt/runners/f5.py | add_pool_member | def add_pool_member(lb, name, port, pool_name):
'''
Add a node to a pool
CLI Examples:
.. code-block:: bash
salt-run f5.add_pool_member load_balancer 10.0.0.1 80 my_pool
'''
if __opts__['load_balancers'].get(lb, None):
(username, password) = list(__opts__['load_balancers'][lb]... | python | def add_pool_member(lb, name, port, pool_name):
'''
Add a node to a pool
CLI Examples:
.. code-block:: bash
salt-run f5.add_pool_member load_balancer 10.0.0.1 80 my_pool
'''
if __opts__['load_balancers'].get(lb, None):
(username, password) = list(__opts__['load_balancers'][lb]... | [
"def",
"add_pool_member",
"(",
"lb",
",",
"name",
",",
"port",
",",
"pool_name",
")",
":",
"if",
"__opts__",
"[",
"'load_balancers'",
"]",
".",
"get",
"(",
"lb",
",",
"None",
")",
":",
"(",
"username",
",",
"password",
")",
"=",
"list",
"(",
"__opts_... | Add a node to a pool
CLI Examples:
.. code-block:: bash
salt-run f5.add_pool_member load_balancer 10.0.0.1 80 my_pool | [
"Add",
"a",
"node",
"to",
"a",
"pool"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/f5.py#L275-L291 | train |
saltstack/salt | salt/runners/f5.py | check_pool | def check_pool(lb, name):
'''
Check to see if a pool exists
CLI Examples:
.. code-block:: bash
salt-run f5.check_pool load_balancer pool_name
'''
if __opts__['load_balancers'].get(lb, None):
(username, password) = list(__opts__['load_balancers'][lb].values())
else:
... | python | def check_pool(lb, name):
'''
Check to see if a pool exists
CLI Examples:
.. code-block:: bash
salt-run f5.check_pool load_balancer pool_name
'''
if __opts__['load_balancers'].get(lb, None):
(username, password) = list(__opts__['load_balancers'][lb].values())
else:
... | [
"def",
"check_pool",
"(",
"lb",
",",
"name",
")",
":",
"if",
"__opts__",
"[",
"'load_balancers'",
"]",
".",
"get",
"(",
"lb",
",",
"None",
")",
":",
"(",
"username",
",",
"password",
")",
"=",
"list",
"(",
"__opts__",
"[",
"'load_balancers'",
"]",
"[... | Check to see if a pool exists
CLI Examples:
.. code-block:: bash
salt-run f5.check_pool load_balancer pool_name | [
"Check",
"to",
"see",
"if",
"a",
"pool",
"exists"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/f5.py#L294-L309 | train |
saltstack/salt | salt/runners/f5.py | check_member_pool | def check_member_pool(lb, member, pool_name):
'''
Check a pool member exists in a specific pool
CLI Examples:
.. code-block:: bash
salt-run f5.check_member_pool load_balancer 10.0.0.1 my_pool
'''
if __opts__['load_balancers'].get(lb, None):
(username, password) = list(__opts__... | python | def check_member_pool(lb, member, pool_name):
'''
Check a pool member exists in a specific pool
CLI Examples:
.. code-block:: bash
salt-run f5.check_member_pool load_balancer 10.0.0.1 my_pool
'''
if __opts__['load_balancers'].get(lb, None):
(username, password) = list(__opts__... | [
"def",
"check_member_pool",
"(",
"lb",
",",
"member",
",",
"pool_name",
")",
":",
"if",
"__opts__",
"[",
"'load_balancers'",
"]",
".",
"get",
"(",
"lb",
",",
"None",
")",
":",
"(",
"username",
",",
"password",
")",
"=",
"list",
"(",
"__opts__",
"[",
... | Check a pool member exists in a specific pool
CLI Examples:
.. code-block:: bash
salt-run f5.check_member_pool load_balancer 10.0.0.1 my_pool | [
"Check",
"a",
"pool",
"member",
"exists",
"in",
"a",
"specific",
"pool"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/f5.py#L330-L345 | train |
saltstack/salt | salt/runners/f5.py | F5Mgmt._connect | def _connect(self):
'''
Connect to F5
'''
try:
self.bigIP = f5.BIGIP(hostname=self.lb,
username=self.username,
password=self.password,
fromurl=True,
... | python | def _connect(self):
'''
Connect to F5
'''
try:
self.bigIP = f5.BIGIP(hostname=self.lb,
username=self.username,
password=self.password,
fromurl=True,
... | [
"def",
"_connect",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"bigIP",
"=",
"f5",
".",
"BIGIP",
"(",
"hostname",
"=",
"self",
".",
"lb",
",",
"username",
"=",
"self",
".",
"username",
",",
"password",
"=",
"self",
".",
"password",
",",
"fromur... | Connect to F5 | [
"Connect",
"to",
"F5"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/f5.py#L45-L61 | train |
saltstack/salt | salt/runners/f5.py | F5Mgmt.create_vs | def create_vs(self, name, ip, port, protocol, profile, pool_name):
'''
Create a virtual server
'''
vs = self.bigIP.LocalLB.VirtualServer
vs_def = vs.typefactory.create('Common.VirtualServerDefinition')
vs_def.name = name
vs_def.address = ip
vs_def.port = ... | python | def create_vs(self, name, ip, port, protocol, profile, pool_name):
'''
Create a virtual server
'''
vs = self.bigIP.LocalLB.VirtualServer
vs_def = vs.typefactory.create('Common.VirtualServerDefinition')
vs_def.name = name
vs_def.address = ip
vs_def.port = ... | [
"def",
"create_vs",
"(",
"self",
",",
"name",
",",
"ip",
",",
"port",
",",
"protocol",
",",
"profile",
",",
"pool_name",
")",
":",
"vs",
"=",
"self",
".",
"bigIP",
".",
"LocalLB",
".",
"VirtualServer",
"vs_def",
"=",
"vs",
".",
"typefactory",
".",
"c... | Create a virtual server | [
"Create",
"a",
"virtual",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/f5.py#L63-L134 | train |
saltstack/salt | salt/runners/f5.py | F5Mgmt.create_pool | def create_pool(self, name, method='ROUND_ROBIN'):
'''
Create a pool on the F5 load balancer
'''
lbmethods = self.bigIP.LocalLB.Pool.typefactory.create(
'LocalLB.LBMethod'
)
supported_method = [i[0] for i in lbmethods if (
i[0].split('_', 2)[-1] =... | python | def create_pool(self, name, method='ROUND_ROBIN'):
'''
Create a pool on the F5 load balancer
'''
lbmethods = self.bigIP.LocalLB.Pool.typefactory.create(
'LocalLB.LBMethod'
)
supported_method = [i[0] for i in lbmethods if (
i[0].split('_', 2)[-1] =... | [
"def",
"create_pool",
"(",
"self",
",",
"name",
",",
"method",
"=",
"'ROUND_ROBIN'",
")",
":",
"lbmethods",
"=",
"self",
".",
"bigIP",
".",
"LocalLB",
".",
"Pool",
".",
"typefactory",
".",
"create",
"(",
"'LocalLB.LBMethod'",
")",
"supported_method",
"=",
... | Create a pool on the F5 load balancer | [
"Create",
"a",
"pool",
"on",
"the",
"F5",
"load",
"balancer"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/f5.py#L136-L159 | train |
saltstack/salt | salt/runners/f5.py | F5Mgmt.add_pool_member | def add_pool_member(self, name, port, pool_name):
'''
Add a node to a pool
'''
if not self.check_pool(pool_name):
raise CommandExecutionError(
'{0} pool does not exists'.format(pool_name)
)
members_seq = self.bigIP.LocalLB.Pool.typefactory... | python | def add_pool_member(self, name, port, pool_name):
'''
Add a node to a pool
'''
if not self.check_pool(pool_name):
raise CommandExecutionError(
'{0} pool does not exists'.format(pool_name)
)
members_seq = self.bigIP.LocalLB.Pool.typefactory... | [
"def",
"add_pool_member",
"(",
"self",
",",
"name",
",",
"port",
",",
"pool_name",
")",
":",
"if",
"not",
"self",
".",
"check_pool",
"(",
"pool_name",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'{0} pool does not exists'",
".",
"format",
"(",
"pool_name... | Add a node to a pool | [
"Add",
"a",
"node",
"to",
"a",
"pool"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/f5.py#L161-L193 | train |
saltstack/salt | salt/runners/f5.py | F5Mgmt.check_pool | def check_pool(self, name):
'''
Check to see if a pool exists
'''
pools = self.bigIP.LocalLB.Pool
for pool in pools.get_list():
if pool.split('/')[-1] == name:
return True
return False | python | def check_pool(self, name):
'''
Check to see if a pool exists
'''
pools = self.bigIP.LocalLB.Pool
for pool in pools.get_list():
if pool.split('/')[-1] == name:
return True
return False | [
"def",
"check_pool",
"(",
"self",
",",
"name",
")",
":",
"pools",
"=",
"self",
".",
"bigIP",
".",
"LocalLB",
".",
"Pool",
"for",
"pool",
"in",
"pools",
".",
"get_list",
"(",
")",
":",
"if",
"pool",
".",
"split",
"(",
"'/'",
")",
"[",
"-",
"1",
... | Check to see if a pool exists | [
"Check",
"to",
"see",
"if",
"a",
"pool",
"exists"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/f5.py#L195-L203 | train |
saltstack/salt | salt/runners/f5.py | F5Mgmt.check_virtualserver | def check_virtualserver(self, name):
'''
Check to see if a virtual server exists
'''
vs = self.bigIP.LocalLB.VirtualServer
for v in vs.get_list():
if v.split('/')[-1] == name:
return True
return False | python | def check_virtualserver(self, name):
'''
Check to see if a virtual server exists
'''
vs = self.bigIP.LocalLB.VirtualServer
for v in vs.get_list():
if v.split('/')[-1] == name:
return True
return False | [
"def",
"check_virtualserver",
"(",
"self",
",",
"name",
")",
":",
"vs",
"=",
"self",
".",
"bigIP",
".",
"LocalLB",
".",
"VirtualServer",
"for",
"v",
"in",
"vs",
".",
"get_list",
"(",
")",
":",
"if",
"v",
".",
"split",
"(",
"'/'",
")",
"[",
"-",
"... | Check to see if a virtual server exists | [
"Check",
"to",
"see",
"if",
"a",
"virtual",
"server",
"exists"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/f5.py#L205-L213 | train |
saltstack/salt | salt/runners/f5.py | F5Mgmt.check_member_pool | def check_member_pool(self, member, pool_name):
'''
Check a pool member exists in a specific pool
'''
members = self.bigIP.LocalLB.Pool.get_member(pool_names=[pool_name])[0]
for mem in members:
if member == mem.address:
return True
return False | python | def check_member_pool(self, member, pool_name):
'''
Check a pool member exists in a specific pool
'''
members = self.bigIP.LocalLB.Pool.get_member(pool_names=[pool_name])[0]
for mem in members:
if member == mem.address:
return True
return False | [
"def",
"check_member_pool",
"(",
"self",
",",
"member",
",",
"pool_name",
")",
":",
"members",
"=",
"self",
".",
"bigIP",
".",
"LocalLB",
".",
"Pool",
".",
"get_member",
"(",
"pool_names",
"=",
"[",
"pool_name",
"]",
")",
"[",
"0",
"]",
"for",
"mem",
... | Check a pool member exists in a specific pool | [
"Check",
"a",
"pool",
"member",
"exists",
"in",
"a",
"specific",
"pool"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/f5.py#L215-L223 | train |
saltstack/salt | salt/runners/f5.py | F5Mgmt.lbmethods | def lbmethods(self):
'''
List all the load balancer methods
'''
methods = self.bigIP.LocalLB.Pool.typefactory.create(
'LocalLB.LBMethod'
)
return [method[0].split('_', 2)[-1] for method in methods] | python | def lbmethods(self):
'''
List all the load balancer methods
'''
methods = self.bigIP.LocalLB.Pool.typefactory.create(
'LocalLB.LBMethod'
)
return [method[0].split('_', 2)[-1] for method in methods] | [
"def",
"lbmethods",
"(",
"self",
")",
":",
"methods",
"=",
"self",
".",
"bigIP",
".",
"LocalLB",
".",
"Pool",
".",
"typefactory",
".",
"create",
"(",
"'LocalLB.LBMethod'",
")",
"return",
"[",
"method",
"[",
"0",
"]",
".",
"split",
"(",
"'_'",
",",
"2... | List all the load balancer methods | [
"List",
"all",
"the",
"load",
"balancer",
"methods"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/f5.py#L225-L232 | train |
saltstack/salt | salt/cloud/clouds/softlayer.py | get_conn | def get_conn(service='SoftLayer_Virtual_Guest'):
'''
Return a conn object for the passed VM data
'''
client = SoftLayer.Client(
username=config.get_cloud_config_value(
'user', get_configured_provider(), __opts__, search_global=False
),
api_key=config.get_cloud_config_... | python | def get_conn(service='SoftLayer_Virtual_Guest'):
'''
Return a conn object for the passed VM data
'''
client = SoftLayer.Client(
username=config.get_cloud_config_value(
'user', get_configured_provider(), __opts__, search_global=False
),
api_key=config.get_cloud_config_... | [
"def",
"get_conn",
"(",
"service",
"=",
"'SoftLayer_Virtual_Guest'",
")",
":",
"client",
"=",
"SoftLayer",
".",
"Client",
"(",
"username",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'user'",
",",
"get_configured_provider",
"(",
")",
",",
"__opts__",
","... | Return a conn object for the passed VM data | [
"Return",
"a",
"conn",
"object",
"for",
"the",
"passed",
"VM",
"data"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/softlayer.py#L104-L116 | train |
saltstack/salt | salt/cloud/clouds/softlayer.py | avail_locations | def avail_locations(call=None):
'''
List all available locations
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_locations function must be called with '
'-f or --function, or with the --list-locations option'
)
ret = {}
conn = get_conn()
... | python | def avail_locations(call=None):
'''
List all available locations
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_locations function must be called with '
'-f or --function, or with the --list-locations option'
)
ret = {}
conn = get_conn()
... | [
"def",
"avail_locations",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_locations function must be called with '",
"'-f or --function, or with the --list-locations option'",
")",
"ret",
"=",
"{",
... | List all available locations | [
"List",
"all",
"available",
"locations"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/softlayer.py#L119-L138 | train |
saltstack/salt | salt/cloud/clouds/softlayer.py | avail_sizes | def avail_sizes(call=None):
'''
Return a dict of all available VM sizes on the cloud provider with
relevant data. This data is provided in three dicts.
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_sizes function must be called with '
'-f or --functio... | python | def avail_sizes(call=None):
'''
Return a dict of all available VM sizes on the cloud provider with
relevant data. This data is provided in three dicts.
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_sizes function must be called with '
'-f or --functio... | [
"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'",
")",
"ret",
"=",
"{",
"'block devi... | Return a dict of all available VM sizes on the cloud provider with
relevant data. This data is provided in three dicts. | [
"Return",
"a",
"dict",
"of",
"all",
"available",
"VM",
"sizes",
"on",
"the",
"cloud",
"provider",
"with",
"relevant",
"data",
".",
"This",
"data",
"is",
"provided",
"in",
"three",
"dicts",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/softlayer.py#L141-L176 | train |
saltstack/salt | salt/cloud/clouds/softlayer.py | avail_images | def avail_images(call=None):
'''
Return a dict of all available VM images on the cloud provider.
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-images option'
)
ret = ... | python | def avail_images(call=None):
'''
Return a dict of all available VM images on the cloud provider.
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-images option'
)
ret = ... | [
"def",
"avail_images",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_images function must be called with '",
"'-f or --function, or with the --list-images option'",
")",
"ret",
"=",
"{",
"}",
"c... | Return a dict of all available VM images on the cloud provider. | [
"Return",
"a",
"dict",
"of",
"all",
"available",
"VM",
"images",
"on",
"the",
"cloud",
"provider",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/softlayer.py#L179-L197 | train |
saltstack/salt | salt/cloud/clouds/softlayer.py | list_custom_images | def list_custom_images(call=None):
'''
Return a dict of all custom VM images on the cloud provider.
'''
if call != 'function':
raise SaltCloudSystemExit(
'The list_vlans function must be called with -f or --function.'
)
ret = {}
conn = get_conn('SoftLayer_Account')
... | python | def list_custom_images(call=None):
'''
Return a dict of all custom VM images on the cloud provider.
'''
if call != 'function':
raise SaltCloudSystemExit(
'The list_vlans function must be called with -f or --function.'
)
ret = {}
conn = get_conn('SoftLayer_Account')
... | [
"def",
"list_custom_images",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"!=",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_vlans function must be called with -f or --function.'",
")",
"ret",
"=",
"{",
"}",
"conn",
"=",
"get_conn",
"(",
... | Return a dict of all custom VM images on the cloud provider. | [
"Return",
"a",
"dict",
"of",
"all",
"custom",
"VM",
"images",
"on",
"the",
"cloud",
"provider",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/softlayer.py#L200-L222 | train |
saltstack/salt | salt/cloud/clouds/softlayer.py | create | def create(vm_):
'''
Create a single VM from a data dict
'''
try:
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'sof... | python | def create(vm_):
'''
Create a single VM from a data dict
'''
try:
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'sof... | [
"def",
"create",
"(",
"vm_",
")",
":",
"try",
":",
"# Check for required profile parameters before sending any API calls.",
"if",
"vm_",
"[",
"'profile'",
"]",
"and",
"config",
".",
"is_profile_configured",
"(",
"__opts__",
",",
"__active_provider_name__",
"or",
"'softl... | Create a single VM from a data dict | [
"Create",
"a",
"single",
"VM",
"from",
"a",
"data",
"dict"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/softlayer.py#L244-L523 | train |
saltstack/salt | salt/cloud/clouds/softlayer.py | list_nodes_full | def list_nodes_full(mask='mask[id]', call=None):
'''
Return a list of the VMs that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_full function must be called with -f or --function.'
)
ret = {}
conn = get_conn(service='SoftLay... | python | def list_nodes_full(mask='mask[id]', call=None):
'''
Return a list of the VMs that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_full function must be called with -f or --function.'
)
ret = {}
conn = get_conn(service='SoftLay... | [
"def",
"list_nodes_full",
"(",
"mask",
"=",
"'mask[id]'",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_nodes_full function must be called with -f or --function.'",
")",
"ret",
"=",
"{",
"}",... | Return a list of the VMs that are on the provider | [
"Return",
"a",
"list",
"of",
"the",
"VMs",
"that",
"are",
"on",
"the",
"provider"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/softlayer.py#L526-L542 | train |
saltstack/salt | salt/cloud/clouds/softlayer.py | list_nodes | def list_nodes(call=None):
'''
Return a list of the VMs that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
ret = {}
nodes = list_nodes_full()
if 'error' in nodes:
... | python | def list_nodes(call=None):
'''
Return a list of the VMs that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
ret = {}
nodes = list_nodes_full()
if 'error' in nodes:
... | [
"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",
"(",
"... | Return a list of the VMs that are on the provider | [
"Return",
"a",
"list",
"of",
"the",
"VMs",
"that",
"are",
"on",
"the",
"provider"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/softlayer.py#L545-L574 | train |
saltstack/salt | salt/cloud/clouds/softlayer.py | destroy | def destroy(name, call=None):
'''
Destroy a node.
CLI Example:
.. code-block:: bash
salt-cloud --destroy mymachine
'''
if call == 'function':
raise SaltCloudSystemExit(
'The destroy action must be called with -d, --destroy, '
'-a or --action.'
)... | python | def destroy(name, call=None):
'''
Destroy a node.
CLI Example:
.. code-block:: bash
salt-cloud --destroy mymachine
'''
if call == 'function':
raise SaltCloudSystemExit(
'The destroy action must be called with -d, --destroy, '
'-a or --action.'
)... | [
"def",
"destroy",
"(",
"name",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The destroy action must be called with -d, --destroy, '",
"'-a or --action.'",
")",
"__utils__",
"[",
"'cloud.fire_event'",
... | Destroy a node.
CLI Example:
.. code-block:: bash
salt-cloud --destroy mymachine | [
"Destroy",
"a",
"node",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/softlayer.py#L600-L640 | train |
saltstack/salt | salt/modules/ipset.py | new_set | def new_set(set=None, set_type=None, family='ipv4', comment=False, **kwargs):
'''
.. versionadded:: 2014.7.0
Create new custom set
CLI Example:
.. code-block:: bash
salt '*' ipset.new_set custom_set list:set
salt '*' ipset.new_set custom_set list:set comment=True
IPv6:
... | python | def new_set(set=None, set_type=None, family='ipv4', comment=False, **kwargs):
'''
.. versionadded:: 2014.7.0
Create new custom set
CLI Example:
.. code-block:: bash
salt '*' ipset.new_set custom_set list:set
salt '*' ipset.new_set custom_set list:set comment=True
IPv6:
... | [
"def",
"new_set",
"(",
"set",
"=",
"None",
",",
"set_type",
"=",
"None",
",",
"family",
"=",
"'ipv4'",
",",
"comment",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"ipset_family",
"=",
"_IPSET_FAMILIES",
"[",
"family",
"]",
"if",
"not",
"set",
":... | .. versionadded:: 2014.7.0
Create new custom set
CLI Example:
.. code-block:: bash
salt '*' ipset.new_set custom_set list:set
salt '*' ipset.new_set custom_set list:set comment=True
IPv6:
salt '*' ipset.new_set custom_set list:set family=ipv6 | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ipset.py#L146-L199 | train |
saltstack/salt | salt/modules/ipset.py | delete_set | def delete_set(set=None, family='ipv4'):
'''
.. versionadded:: 2014.7.0
Delete ipset set.
CLI Example:
.. code-block:: bash
salt '*' ipset.delete_set custom_set
IPv6:
salt '*' ipset.delete_set custom_set family=ipv6
'''
if not set:
return 'Error: Set nee... | python | def delete_set(set=None, family='ipv4'):
'''
.. versionadded:: 2014.7.0
Delete ipset set.
CLI Example:
.. code-block:: bash
salt '*' ipset.delete_set custom_set
IPv6:
salt '*' ipset.delete_set custom_set family=ipv6
'''
if not set:
return 'Error: Set nee... | [
"def",
"delete_set",
"(",
"set",
"=",
"None",
",",
"family",
"=",
"'ipv4'",
")",
":",
"if",
"not",
"set",
":",
"return",
"'Error: Set needs to be specified'",
"cmd",
"=",
"'{0} destroy {1}'",
".",
"format",
"(",
"_ipset_cmd",
"(",
")",
",",
"set",
")",
"ou... | .. versionadded:: 2014.7.0
Delete ipset set.
CLI Example:
.. code-block:: bash
salt '*' ipset.delete_set custom_set
IPv6:
salt '*' ipset.delete_set custom_set family=ipv6 | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ipset.py#L202-L226 | train |
saltstack/salt | salt/modules/ipset.py | rename_set | def rename_set(set=None, new_set=None, family='ipv4'):
'''
.. versionadded:: 2014.7.0
Delete ipset set.
CLI Example:
.. code-block:: bash
salt '*' ipset.rename_set custom_set new_set=new_set_name
IPv6:
salt '*' ipset.rename_set custom_set new_set=new_set_name family=ipv6... | python | def rename_set(set=None, new_set=None, family='ipv4'):
'''
.. versionadded:: 2014.7.0
Delete ipset set.
CLI Example:
.. code-block:: bash
salt '*' ipset.rename_set custom_set new_set=new_set_name
IPv6:
salt '*' ipset.rename_set custom_set new_set=new_set_name family=ipv6... | [
"def",
"rename_set",
"(",
"set",
"=",
"None",
",",
"new_set",
"=",
"None",
",",
"family",
"=",
"'ipv4'",
")",
":",
"if",
"not",
"set",
":",
"return",
"'Error: Set needs to be specified'",
"if",
"not",
"new_set",
":",
"return",
"'Error: New name for set needs to ... | .. versionadded:: 2014.7.0
Delete ipset set.
CLI Example:
.. code-block:: bash
salt '*' ipset.rename_set custom_set new_set=new_set_name
IPv6:
salt '*' ipset.rename_set custom_set new_set=new_set_name family=ipv6 | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ipset.py#L229-L264 | train |
saltstack/salt | salt/modules/ipset.py | list_sets | def list_sets(family='ipv4'):
'''
.. versionadded:: 2014.7.0
List all ipset sets.
CLI Example:
.. code-block:: bash
salt '*' ipset.list_sets
'''
cmd = '{0} list -t'.format(_ipset_cmd())
out = __salt__['cmd.run'](cmd, python_shell=False)
_tmp = out.split('\n')
count... | python | def list_sets(family='ipv4'):
'''
.. versionadded:: 2014.7.0
List all ipset sets.
CLI Example:
.. code-block:: bash
salt '*' ipset.list_sets
'''
cmd = '{0} list -t'.format(_ipset_cmd())
out = __salt__['cmd.run'](cmd, python_shell=False)
_tmp = out.split('\n')
count... | [
"def",
"list_sets",
"(",
"family",
"=",
"'ipv4'",
")",
":",
"cmd",
"=",
"'{0} list -t'",
".",
"format",
"(",
"_ipset_cmd",
"(",
")",
")",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
",",
"python_shell",
"=",
"False",
")",
"_tmp",
"=",
... | .. versionadded:: 2014.7.0
List all ipset sets.
CLI Example:
.. code-block:: bash
salt '*' ipset.list_sets | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ipset.py#L267-L295 | train |
saltstack/salt | salt/modules/ipset.py | check_set | def check_set(set=None, family='ipv4'):
'''
Check that given ipset set exists.
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' ipset.check_set setname
'''
if not set:
return 'Error: Set needs to be specified'
setinfo = _find_set_info(set)
i... | python | def check_set(set=None, family='ipv4'):
'''
Check that given ipset set exists.
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' ipset.check_set setname
'''
if not set:
return 'Error: Set needs to be specified'
setinfo = _find_set_info(set)
i... | [
"def",
"check_set",
"(",
"set",
"=",
"None",
",",
"family",
"=",
"'ipv4'",
")",
":",
"if",
"not",
"set",
":",
"return",
"'Error: Set needs to be specified'",
"setinfo",
"=",
"_find_set_info",
"(",
"set",
")",
"if",
"not",
"setinfo",
":",
"return",
"False",
... | Check that given ipset set exists.
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' ipset.check_set setname | [
"Check",
"that",
"given",
"ipset",
"set",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ipset.py#L298-L317 | train |
saltstack/salt | salt/modules/ipset.py | add | def add(setname=None, entry=None, family='ipv4', **kwargs):
'''
Append an entry to the specified set.
CLI Example:
.. code-block:: bash
salt '*' ipset.add setname 192.168.1.26
salt '*' ipset.add setname 192.168.0.3,AA:BB:CC:DD:EE:FF
'''
if not setname:
return 'Error:... | python | def add(setname=None, entry=None, family='ipv4', **kwargs):
'''
Append an entry to the specified set.
CLI Example:
.. code-block:: bash
salt '*' ipset.add setname 192.168.1.26
salt '*' ipset.add setname 192.168.0.3,AA:BB:CC:DD:EE:FF
'''
if not setname:
return 'Error:... | [
"def",
"add",
"(",
"setname",
"=",
"None",
",",
"entry",
"=",
"None",
",",
"family",
"=",
"'ipv4'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"setname",
":",
"return",
"'Error: Set needs to be specified'",
"if",
"not",
"entry",
":",
"return",
"'Err... | Append an entry to the specified set.
CLI Example:
.. code-block:: bash
salt '*' ipset.add setname 192.168.1.26
salt '*' ipset.add setname 192.168.0.3,AA:BB:CC:DD:EE:FF | [
"Append",
"an",
"entry",
"to",
"the",
"specified",
"set",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ipset.py#L320-L378 | train |
saltstack/salt | salt/modules/ipset.py | check | def check(set=None, entry=None, family='ipv4'):
'''
Check that an entry exists in the specified set.
set
The ipset name
entry
An entry in the ipset. This parameter can be a single IP address, a
range of IP addresses, or a subnet block. Example:
.. code-block:: cfg
... | python | def check(set=None, entry=None, family='ipv4'):
'''
Check that an entry exists in the specified set.
set
The ipset name
entry
An entry in the ipset. This parameter can be a single IP address, a
range of IP addresses, or a subnet block. Example:
.. code-block:: cfg
... | [
"def",
"check",
"(",
"set",
"=",
"None",
",",
"entry",
"=",
"None",
",",
"family",
"=",
"'ipv4'",
")",
":",
"if",
"not",
"set",
":",
"return",
"'Error: Set needs to be specified'",
"if",
"not",
"entry",
":",
"return",
"'Error: Entry needs to be specified'",
"s... | Check that an entry exists in the specified set.
set
The ipset name
entry
An entry in the ipset. This parameter can be a single IP address, a
range of IP addresses, or a subnet block. Example:
.. code-block:: cfg
192.168.0.1
192.168.0.2-192.168.0.19
... | [
"Check",
"that",
"an",
"entry",
"exists",
"in",
"the",
"specified",
"set",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ipset.py#L410-L461 | train |
saltstack/salt | salt/modules/ipset.py | flush | def flush(set=None, family='ipv4'):
'''
Flush entries in the specified set,
Flush all sets if set is not specified.
CLI Example:
.. code-block:: bash
salt '*' ipset.flush
salt '*' ipset.flush set
IPv6:
salt '*' ipset.flush
salt '*' ipset.flush set
''... | python | def flush(set=None, family='ipv4'):
'''
Flush entries in the specified set,
Flush all sets if set is not specified.
CLI Example:
.. code-block:: bash
salt '*' ipset.flush
salt '*' ipset.flush set
IPv6:
salt '*' ipset.flush
salt '*' ipset.flush set
''... | [
"def",
"flush",
"(",
"set",
"=",
"None",
",",
"family",
"=",
"'ipv4'",
")",
":",
"settype",
"=",
"_find_set_type",
"(",
"set",
")",
"if",
"not",
"settype",
":",
"return",
"'Error: Set {0} does not exist'",
".",
"format",
"(",
"set",
")",
"ipset_family",
"=... | Flush entries in the specified set,
Flush all sets if set is not specified.
CLI Example:
.. code-block:: bash
salt '*' ipset.flush
salt '*' ipset.flush set
IPv6:
salt '*' ipset.flush
salt '*' ipset.flush set | [
"Flush",
"entries",
"in",
"the",
"specified",
"set",
"Flush",
"all",
"sets",
"if",
"set",
"is",
"not",
"specified",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ipset.py#L496-L526 | train |
saltstack/salt | salt/modules/ipset.py | _find_set_members | def _find_set_members(set):
'''
Return list of members for a set
'''
cmd = '{0} list {1}'.format(_ipset_cmd(), set)
out = __salt__['cmd.run_all'](cmd, python_shell=False)
if out['retcode'] > 0:
# Set doesn't exist return false
return False
_tmp = out['stdout'].split('\n')
... | python | def _find_set_members(set):
'''
Return list of members for a set
'''
cmd = '{0} list {1}'.format(_ipset_cmd(), set)
out = __salt__['cmd.run_all'](cmd, python_shell=False)
if out['retcode'] > 0:
# Set doesn't exist return false
return False
_tmp = out['stdout'].split('\n')
... | [
"def",
"_find_set_members",
"(",
"set",
")",
":",
"cmd",
"=",
"'{0} list {1}'",
".",
"format",
"(",
"_ipset_cmd",
"(",
")",
",",
"set",
")",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"python_shell",
"=",
"False",
")",
"if",
"o... | Return list of members for a set | [
"Return",
"list",
"of",
"members",
"for",
"a",
"set"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ipset.py#L529-L549 | train |
saltstack/salt | salt/modules/ipset.py | _find_set_info | def _find_set_info(set):
'''
Return information about the set
'''
cmd = '{0} list -t {1}'.format(_ipset_cmd(), set)
out = __salt__['cmd.run_all'](cmd, python_shell=False)
if out['retcode'] > 0:
# Set doesn't exist return false
return False
setinfo = {}
_tmp = out['stdo... | python | def _find_set_info(set):
'''
Return information about the set
'''
cmd = '{0} list -t {1}'.format(_ipset_cmd(), set)
out = __salt__['cmd.run_all'](cmd, python_shell=False)
if out['retcode'] > 0:
# Set doesn't exist return false
return False
setinfo = {}
_tmp = out['stdo... | [
"def",
"_find_set_info",
"(",
"set",
")",
":",
"cmd",
"=",
"'{0} list -t {1}'",
".",
"format",
"(",
"_ipset_cmd",
"(",
")",
",",
"set",
")",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"python_shell",
"=",
"False",
")",
"if",
"o... | Return information about the set | [
"Return",
"information",
"about",
"the",
"set"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ipset.py#L552-L571 | train |
saltstack/salt | salt/runners/http.py | query | def query(url, output=True, **kwargs):
'''
Query a resource, and decode the return data
Passes through all the parameters described in the
:py:func:`utils.http.query function <salt.utils.http.query>`:
CLI Example:
.. code-block:: bash
salt-run http.query http://somelink.com/
... | python | def query(url, output=True, **kwargs):
'''
Query a resource, and decode the return data
Passes through all the parameters described in the
:py:func:`utils.http.query function <salt.utils.http.query>`:
CLI Example:
.. code-block:: bash
salt-run http.query http://somelink.com/
... | [
"def",
"query",
"(",
"url",
",",
"output",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"output",
"is",
"not",
"True",
":",
"log",
".",
"warning",
"(",
"'Output option has been deprecated. Please use --quiet.'",
")",
"if",
"'node'",
"not",
"in",
"... | Query a resource, and decode the return data
Passes through all the parameters described in the
:py:func:`utils.http.query function <salt.utils.http.query>`:
CLI Example:
.. code-block:: bash
salt-run http.query http://somelink.com/
salt-run http.query http://somelink.com/ method=POS... | [
"Query",
"a",
"resource",
"and",
"decode",
"the",
"return",
"data"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/http.py#L18-L45 | train |
saltstack/salt | salt/runners/http.py | update_ca_bundle | def update_ca_bundle(target=None, source=None, merge_files=None):
'''
Update the local CA bundle file from a URL
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt-run http.update_ca_bundle
salt-run http.update_ca_bundle target=/path/to/cacerts.pem
salt-run... | python | def update_ca_bundle(target=None, source=None, merge_files=None):
'''
Update the local CA bundle file from a URL
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt-run http.update_ca_bundle
salt-run http.update_ca_bundle target=/path/to/cacerts.pem
salt-run... | [
"def",
"update_ca_bundle",
"(",
"target",
"=",
"None",
",",
"source",
"=",
"None",
",",
"merge_files",
"=",
"None",
")",
":",
"return",
"salt",
".",
"utils",
".",
"http",
".",
"update_ca_bundle",
"(",
"target",
",",
"source",
",",
"__opts__",
",",
"merge... | Update the local CA bundle file from a URL
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt-run http.update_ca_bundle
salt-run http.update_ca_bundle target=/path/to/cacerts.pem
salt-run http.update_ca_bundle source=https://example.com/cacerts.pem
If the ``ta... | [
"Update",
"the",
"local",
"CA",
"bundle",
"file",
"from",
"a",
"URL"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/http.py#L48-L83 | train |
saltstack/salt | salt/states/grafana4_user.py | present | def present(name,
password,
email=None,
is_admin=False,
fullname=None,
theme=None,
default_organization=None,
organizations=None,
profile='grafana'):
'''
Ensure that a user is present.
name
Name of the u... | python | def present(name,
password,
email=None,
is_admin=False,
fullname=None,
theme=None,
default_organization=None,
organizations=None,
profile='grafana'):
'''
Ensure that a user is present.
name
Name of the u... | [
"def",
"present",
"(",
"name",
",",
"password",
",",
"email",
"=",
"None",
",",
"is_admin",
"=",
"False",
",",
"fullname",
"=",
"None",
",",
"theme",
"=",
"None",
",",
"default_organization",
"=",
"None",
",",
"organizations",
"=",
"None",
",",
"profile"... | Ensure that a user is present.
name
Name of the user.
password
Password of the user.
email
Optional - Email of the user.
is_admin
Optional - Set user as admin user. Default: False
fullname
Optional - Full name of the user.
theme
Optional - Se... | [
"Ensure",
"that",
"a",
"user",
"is",
"present",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana4_user.py#L55-L187 | train |
saltstack/salt | salt/states/grafana4_user.py | absent | def absent(name, profile='grafana'):
'''
Ensure that a user is present.
name
Name of the user to remove.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
'''
if isinstance(profile, string_types):
profile = __salt__['co... | python | def absent(name, profile='grafana'):
'''
Ensure that a user is present.
name
Name of the user to remove.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
'''
if isinstance(profile, string_types):
profile = __salt__['co... | [
"def",
"absent",
"(",
"name",
",",
"profile",
"=",
"'grafana'",
")",
":",
"if",
"isinstance",
"(",
"profile",
",",
"string_types",
")",
":",
"profile",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"profile",
")",
"ret",
"=",
"{",
"'name'",
":",
"... | Ensure that a user is present.
name
Name of the user to remove.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'. | [
"Ensure",
"that",
"a",
"user",
"is",
"present",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana4_user.py#L190-L231 | train |
saltstack/salt | salt/modules/saltcloudmod.py | create | def create(name, profile):
'''
Create the named vm
CLI Example:
.. code-block:: bash
salt <minion-id> saltcloud.create webserver rackspace_centos_512
'''
cmd = 'salt-cloud --out json -p {0} {1}'.format(profile, name)
out = __salt__['cmd.run_stdout'](cmd, python_shell=False)
tr... | python | def create(name, profile):
'''
Create the named vm
CLI Example:
.. code-block:: bash
salt <minion-id> saltcloud.create webserver rackspace_centos_512
'''
cmd = 'salt-cloud --out json -p {0} {1}'.format(profile, name)
out = __salt__['cmd.run_stdout'](cmd, python_shell=False)
tr... | [
"def",
"create",
"(",
"name",
",",
"profile",
")",
":",
"cmd",
"=",
"'salt-cloud --out json -p {0} {1}'",
".",
"format",
"(",
"profile",
",",
"name",
")",
"out",
"=",
"__salt__",
"[",
"'cmd.run_stdout'",
"]",
"(",
"cmd",
",",
"python_shell",
"=",
"False",
... | Create the named vm
CLI Example:
.. code-block:: bash
salt <minion-id> saltcloud.create webserver rackspace_centos_512 | [
"Create",
"the",
"named",
"vm"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcloudmod.py#L32-L48 | train |
saltstack/salt | salt/states/postgres_database.py | present | def present(name,
tablespace=None,
encoding=None,
lc_collate=None,
lc_ctype=None,
owner=None,
owner_recurse=False,
template=None,
user=None,
maintenance_db=None,
db_password=None,
db_host=... | python | def present(name,
tablespace=None,
encoding=None,
lc_collate=None,
lc_ctype=None,
owner=None,
owner_recurse=False,
template=None,
user=None,
maintenance_db=None,
db_password=None,
db_host=... | [
"def",
"present",
"(",
"name",
",",
"tablespace",
"=",
"None",
",",
"encoding",
"=",
"None",
",",
"lc_collate",
"=",
"None",
",",
"lc_ctype",
"=",
"None",
",",
"owner",
"=",
"None",
",",
"owner_recurse",
"=",
"False",
",",
"template",
"=",
"None",
",",... | Ensure that the named database is present with the specified properties.
For more information about all of these options see man createdb(1)
name
The name of the database to manage
tablespace
Default tablespace for the database
encoding
The character encoding scheme to be used... | [
"Ensure",
"that",
"the",
"named",
"database",
"is",
"present",
"with",
"the",
"specified",
"properties",
".",
"For",
"more",
"information",
"about",
"all",
"of",
"these",
"options",
"see",
"man",
"createdb",
"(",
"1",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/postgres_database.py#L26-L161 | train |
saltstack/salt | salt/modules/rbac_solaris.py | profile_list | def profile_list(default_only=False):
'''
List all available profiles
default_only : boolean
return only default profile
CLI Example:
.. code-block:: bash
salt '*' rbac.profile_list
'''
profiles = {}
default_profiles = ['All']
## lookup default profile(s)
wit... | python | def profile_list(default_only=False):
'''
List all available profiles
default_only : boolean
return only default profile
CLI Example:
.. code-block:: bash
salt '*' rbac.profile_list
'''
profiles = {}
default_profiles = ['All']
## lookup default profile(s)
wit... | [
"def",
"profile_list",
"(",
"default_only",
"=",
"False",
")",
":",
"profiles",
"=",
"{",
"}",
"default_profiles",
"=",
"[",
"'All'",
"]",
"## lookup default profile(s)",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"'/etc/security/policy.conf'... | List all available profiles
default_only : boolean
return only default profile
CLI Example:
.. code-block:: bash
salt '*' rbac.profile_list | [
"List",
"all",
"available",
"profiles"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbac_solaris.py#L34-L76 | train |
saltstack/salt | salt/modules/rbac_solaris.py | profile_get | def profile_get(user, default_hidden=True):
'''
List profiles for user
user : string
username
default_hidden : boolean
hide default profiles
CLI Example:
.. code-block:: bash
salt '*' rbac.profile_get leo
salt '*' rbac.profile_get leo default_hidden=False
... | python | def profile_get(user, default_hidden=True):
'''
List profiles for user
user : string
username
default_hidden : boolean
hide default profiles
CLI Example:
.. code-block:: bash
salt '*' rbac.profile_get leo
salt '*' rbac.profile_get leo default_hidden=False
... | [
"def",
"profile_get",
"(",
"user",
",",
"default_hidden",
"=",
"True",
")",
":",
"user_profiles",
"=",
"[",
"]",
"## read user_attr file (user:qualifier:res1:res2:attr)",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"'/etc/user_attr'",
",",
"'r'"... | List profiles for user
user : string
username
default_hidden : boolean
hide default profiles
CLI Example:
.. code-block:: bash
salt '*' rbac.profile_get leo
salt '*' rbac.profile_get leo default_hidden=False | [
"List",
"profiles",
"for",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbac_solaris.py#L79-L128 | train |
saltstack/salt | salt/modules/rbac_solaris.py | profile_add | def profile_add(user, profile):
'''
Add profile to user
user : string
username
profile : string
profile name
CLI Example:
.. code-block:: bash
salt '*' rbac.profile_add martine 'Primary Administrator'
salt '*' rbac.profile_add martine 'User Management,User Sec... | python | def profile_add(user, profile):
'''
Add profile to user
user : string
username
profile : string
profile name
CLI Example:
.. code-block:: bash
salt '*' rbac.profile_add martine 'Primary Administrator'
salt '*' rbac.profile_add martine 'User Management,User Sec... | [
"def",
"profile_add",
"(",
"user",
",",
"profile",
")",
":",
"ret",
"=",
"{",
"}",
"## validate profiles",
"profiles",
"=",
"profile",
".",
"split",
"(",
"','",
")",
"known_profiles",
"=",
"profile_list",
"(",
")",
".",
"keys",
"(",
")",
"valid_profiles",
... | Add profile to user
user : string
username
profile : string
profile name
CLI Example:
.. code-block:: bash
salt '*' rbac.profile_add martine 'Primary Administrator'
salt '*' rbac.profile_add martine 'User Management,User Security' | [
"Add",
"profile",
"to",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbac_solaris.py#L131-L183 | train |
saltstack/salt | salt/modules/rbac_solaris.py | role_list | def role_list():
'''
List all available roles
CLI Example:
.. code-block:: bash
salt '*' rbac.role_list
'''
roles = {}
## read user_attr file (user:qualifier:res1:res2:attr)
with salt.utils.files.fopen('/etc/user_attr', 'r') as user_attr:
for role in user_attr:
... | python | def role_list():
'''
List all available roles
CLI Example:
.. code-block:: bash
salt '*' rbac.role_list
'''
roles = {}
## read user_attr file (user:qualifier:res1:res2:attr)
with salt.utils.files.fopen('/etc/user_attr', 'r') as user_attr:
for role in user_attr:
... | [
"def",
"role_list",
"(",
")",
":",
"roles",
"=",
"{",
"}",
"## read user_attr file (user:qualifier:res1:res2:attr)",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"'/etc/user_attr'",
",",
"'r'",
")",
"as",
"user_attr",
":",
"for",
"role",
"in"... | List all available roles
CLI Example:
.. code-block:: bash
salt '*' rbac.role_list | [
"List",
"all",
"available",
"roles"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbac_solaris.py#L241-L278 | train |
saltstack/salt | salt/modules/rbac_solaris.py | role_get | def role_get(user):
'''
List roles for user
user : string
username
CLI Example:
.. code-block:: bash
salt '*' rbac.role_get leo
'''
user_roles = []
## read user_attr file (user:qualifier:res1:res2:attr)
with salt.utils.files.fopen('/etc/user_attr', 'r') as user_a... | python | def role_get(user):
'''
List roles for user
user : string
username
CLI Example:
.. code-block:: bash
salt '*' rbac.role_get leo
'''
user_roles = []
## read user_attr file (user:qualifier:res1:res2:attr)
with salt.utils.files.fopen('/etc/user_attr', 'r') as user_a... | [
"def",
"role_get",
"(",
"user",
")",
":",
"user_roles",
"=",
"[",
"]",
"## read user_attr file (user:qualifier:res1:res2:attr)",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"'/etc/user_attr'",
",",
"'r'",
")",
"as",
"user_attr",
":",
"for",
... | List roles for user
user : string
username
CLI Example:
.. code-block:: bash
salt '*' rbac.role_get leo | [
"List",
"roles",
"for",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbac_solaris.py#L281-L321 | train |
saltstack/salt | salt/modules/rbac_solaris.py | role_add | def role_add(user, role):
'''
Add role to user
user : string
username
role : string
role name
CLI Example:
.. code-block:: bash
salt '*' rbac.role_add martine netcfg
salt '*' rbac.role_add martine netcfg,zfssnap
'''
ret = {}
## validate roles
... | python | def role_add(user, role):
'''
Add role to user
user : string
username
role : string
role name
CLI Example:
.. code-block:: bash
salt '*' rbac.role_add martine netcfg
salt '*' rbac.role_add martine netcfg,zfssnap
'''
ret = {}
## validate roles
... | [
"def",
"role_add",
"(",
"user",
",",
"role",
")",
":",
"ret",
"=",
"{",
"}",
"## validate roles",
"roles",
"=",
"role",
".",
"split",
"(",
"','",
")",
"known_roles",
"=",
"role_list",
"(",
")",
".",
"keys",
"(",
")",
"valid_roles",
"=",
"[",
"r",
"... | Add role to user
user : string
username
role : string
role name
CLI Example:
.. code-block:: bash
salt '*' rbac.role_add martine netcfg
salt '*' rbac.role_add martine netcfg,zfssnap | [
"Add",
"role",
"to",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbac_solaris.py#L324-L376 | train |
saltstack/salt | salt/modules/rbac_solaris.py | auth_list | def auth_list():
'''
List all available authorization
CLI Example:
.. code-block:: bash
salt '*' rbac.auth_list
'''
auths = {}
## read auth_attr file (name:res1:res2:short_desc:long_desc:attr)
with salt.utils.files.fopen('/etc/security/auth_attr', 'r') as auth_attr:
f... | python | def auth_list():
'''
List all available authorization
CLI Example:
.. code-block:: bash
salt '*' rbac.auth_list
'''
auths = {}
## read auth_attr file (name:res1:res2:short_desc:long_desc:attr)
with salt.utils.files.fopen('/etc/security/auth_attr', 'r') as auth_attr:
f... | [
"def",
"auth_list",
"(",
")",
":",
"auths",
"=",
"{",
"}",
"## read auth_attr file (name:res1:res2:short_desc:long_desc:attr)",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"'/etc/security/auth_attr'",
",",
"'r'",
")",
"as",
"auth_attr",
":",
"fo... | List all available authorization
CLI Example:
.. code-block:: bash
salt '*' rbac.auth_list | [
"List",
"all",
"available",
"authorization"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbac_solaris.py#L434-L461 | train |
saltstack/salt | salt/modules/rbac_solaris.py | auth_get | def auth_get(user, computed=True):
'''
List authorization for user
user : string
username
computed : boolean
merge results from `auths` command into data from user_attr
CLI Example:
.. code-block:: bash
salt '*' rbac.auth_get leo
'''
user_auths = []
## re... | python | def auth_get(user, computed=True):
'''
List authorization for user
user : string
username
computed : boolean
merge results from `auths` command into data from user_attr
CLI Example:
.. code-block:: bash
salt '*' rbac.auth_get leo
'''
user_auths = []
## re... | [
"def",
"auth_get",
"(",
"user",
",",
"computed",
"=",
"True",
")",
":",
"user_auths",
"=",
"[",
"]",
"## read user_attr file (user:qualifier:res1:res2:attr)",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"'/etc/user_attr'",
",",
"'r'",
")",
"... | List authorization for user
user : string
username
computed : boolean
merge results from `auths` command into data from user_attr
CLI Example:
.. code-block:: bash
salt '*' rbac.auth_get leo | [
"List",
"authorization",
"for",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbac_solaris.py#L464-L516 | train |
saltstack/salt | salt/modules/rbac_solaris.py | auth_add | def auth_add(user, auth):
'''
Add authorization to user
user : string
username
auth : string
authorization name
CLI Example:
.. code-block:: bash
salt '*' rbac.auth_add martine solaris.zone.manage
salt '*' rbac.auth_add martine solaris.zone.manage,solaris.mail... | python | def auth_add(user, auth):
'''
Add authorization to user
user : string
username
auth : string
authorization name
CLI Example:
.. code-block:: bash
salt '*' rbac.auth_add martine solaris.zone.manage
salt '*' rbac.auth_add martine solaris.zone.manage,solaris.mail... | [
"def",
"auth_add",
"(",
"user",
",",
"auth",
")",
":",
"ret",
"=",
"{",
"}",
"## validate auths",
"auths",
"=",
"auth",
".",
"split",
"(",
"','",
")",
"known_auths",
"=",
"auth_list",
"(",
")",
".",
"keys",
"(",
")",
"valid_auths",
"=",
"[",
"r",
"... | Add authorization to user
user : string
username
auth : string
authorization name
CLI Example:
.. code-block:: bash
salt '*' rbac.auth_add martine solaris.zone.manage
salt '*' rbac.auth_add martine solaris.zone.manage,solaris.mail.mailq | [
"Add",
"authorization",
"to",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbac_solaris.py#L519-L571 | train |
saltstack/salt | salt/states/netacl.py | term | def term(name,
filter_name,
term_name,
filter_options=None,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merge_pillar=False,
revision_id=None,
revision_no=None,
revision_date=True,
revision_date_format='%Y/%m/%d',
... | python | def term(name,
filter_name,
term_name,
filter_options=None,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merge_pillar=False,
revision_id=None,
revision_no=None,
revision_date=True,
revision_date_format='%Y/%m/%d',
... | [
"def",
"term",
"(",
"name",
",",
"filter_name",
",",
"term_name",
",",
"filter_options",
"=",
"None",
",",
"pillar_key",
"=",
"'acl'",
",",
"pillarenv",
"=",
"None",
",",
"saltenv",
"=",
"None",
",",
"merge_pillar",
"=",
"False",
",",
"revision_id",
"=",
... | Manage the configuration of a specific policy term.
filter_name
The name of the policy filter.
term_name
The name of the term.
filter_options
Additional filter options. These options are platform-specific.
See the complete list of options_.
.. _options: https://gi... | [
"Manage",
"the",
"configuration",
"of",
"a",
"specific",
"policy",
"term",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netacl.py#L89-L441 | train |
saltstack/salt | salt/states/netacl.py | filter | def filter(name, # pylint: disable=redefined-builtin
filter_name,
filter_options=None,
terms=None,
prepend=True,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merge_pillar=False,
only_lower_merge=False,
revi... | python | def filter(name, # pylint: disable=redefined-builtin
filter_name,
filter_options=None,
terms=None,
prepend=True,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merge_pillar=False,
only_lower_merge=False,
revi... | [
"def",
"filter",
"(",
"name",
",",
"# pylint: disable=redefined-builtin",
"filter_name",
",",
"filter_options",
"=",
"None",
",",
"terms",
"=",
"None",
",",
"prepend",
"=",
"True",
",",
"pillar_key",
"=",
"'acl'",
",",
"pillarenv",
"=",
"None",
",",
"saltenv",... | Generate and load the configuration of a policy filter.
filter_name
The name of the policy filter.
filter_options
Additional filter options. These options are platform-specific.
See the complete list of options_.
.. _options: https://github.com/google/capirca/wiki/Policy-forma... | [
"Generate",
"and",
"load",
"the",
"configuration",
"of",
"a",
"policy",
"filter",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netacl.py#L444-L672 | train |
saltstack/salt | salt/modules/keyboard.py | get_sys | def get_sys():
'''
Get current system keyboard setting
CLI Example:
.. code-block:: bash
salt '*' keyboard.get_sys
'''
cmd = ''
if salt.utils.path.which('localectl'):
cmd = 'localectl | grep Keymap | sed -e"s/: /=/" -e"s/^[ \t]*//"'
elif 'RedHat' in __grains__['os_fami... | python | def get_sys():
'''
Get current system keyboard setting
CLI Example:
.. code-block:: bash
salt '*' keyboard.get_sys
'''
cmd = ''
if salt.utils.path.which('localectl'):
cmd = 'localectl | grep Keymap | sed -e"s/: /=/" -e"s/^[ \t]*//"'
elif 'RedHat' in __grains__['os_fami... | [
"def",
"get_sys",
"(",
")",
":",
"cmd",
"=",
"''",
"if",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'localectl'",
")",
":",
"cmd",
"=",
"'localectl | grep Keymap | sed -e\"s/: /=/\" -e\"s/^[ \\t]*//\"'",
"elif",
"'RedHat'",
"in",
"__grains__",
"[",
... | Get current system keyboard setting
CLI Example:
.. code-block:: bash
salt '*' keyboard.get_sys | [
"Get",
"current",
"system",
"keyboard",
"setting"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keyboard.py#L28-L49 | train |
saltstack/salt | salt/modules/keyboard.py | set_sys | def set_sys(layout):
'''
Set current system keyboard setting
CLI Example:
.. code-block:: bash
salt '*' keyboard.set_sys dvorak
'''
if salt.utils.path.which('localectl'):
__salt__['cmd.run']('localectl set-keymap {0}'.format(layout))
elif 'RedHat' in __grains__['os_family'... | python | def set_sys(layout):
'''
Set current system keyboard setting
CLI Example:
.. code-block:: bash
salt '*' keyboard.set_sys dvorak
'''
if salt.utils.path.which('localectl'):
__salt__['cmd.run']('localectl set-keymap {0}'.format(layout))
elif 'RedHat' in __grains__['os_family'... | [
"def",
"set_sys",
"(",
"layout",
")",
":",
"if",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'localectl'",
")",
":",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'localectl set-keymap {0}'",
".",
"format",
"(",
"layout",
")",
")",
"elif",
"'RedHat... | Set current system keyboard setting
CLI Example:
.. code-block:: bash
salt '*' keyboard.set_sys dvorak | [
"Set",
"current",
"system",
"keyboard",
"setting"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keyboard.py#L52-L76 | train |
saltstack/salt | salt/modules/keyboard.py | get_x | def get_x():
'''
Get current X keyboard setting
CLI Example:
.. code-block:: bash
salt '*' keyboard.get_x
'''
cmd = 'setxkbmap -query | grep layout'
out = __salt__['cmd.run'](cmd, python_shell=True).split(':')
return out[1].strip() | python | def get_x():
'''
Get current X keyboard setting
CLI Example:
.. code-block:: bash
salt '*' keyboard.get_x
'''
cmd = 'setxkbmap -query | grep layout'
out = __salt__['cmd.run'](cmd, python_shell=True).split(':')
return out[1].strip() | [
"def",
"get_x",
"(",
")",
":",
"cmd",
"=",
"'setxkbmap -query | grep layout'",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
",",
"python_shell",
"=",
"True",
")",
".",
"split",
"(",
"':'",
")",
"return",
"out",
"[",
"1",
"]",
".",
"strip"... | Get current X keyboard setting
CLI Example:
.. code-block:: bash
salt '*' keyboard.get_x | [
"Get",
"current",
"X",
"keyboard",
"setting"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keyboard.py#L79-L91 | train |
saltstack/salt | salt/utils/pycrypto.py | secure_password | def secure_password(length=20, use_random=True):
'''
Generate a secure password.
'''
try:
length = int(length)
pw = ''
while len(pw) < length:
if HAS_RANDOM and use_random:
while True:
try:
char = salt.utils.... | python | def secure_password(length=20, use_random=True):
'''
Generate a secure password.
'''
try:
length = int(length)
pw = ''
while len(pw) < length:
if HAS_RANDOM and use_random:
while True:
try:
char = salt.utils.... | [
"def",
"secure_password",
"(",
"length",
"=",
"20",
",",
"use_random",
"=",
"True",
")",
":",
"try",
":",
"length",
"=",
"int",
"(",
"length",
")",
"pw",
"=",
"''",
"while",
"len",
"(",
"pw",
")",
"<",
"length",
":",
"if",
"HAS_RANDOM",
"and",
"use... | Generate a secure password. | [
"Generate",
"a",
"secure",
"password",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pycrypto.py#L41-L66 | train |
saltstack/salt | salt/utils/pycrypto.py | gen_hash | def gen_hash(crypt_salt=None, password=None, algorithm='sha512'):
'''
Generate /etc/shadow hash
'''
if not HAS_CRYPT:
raise SaltInvocationError('No crypt module for windows')
hash_algorithms = dict(
md5='$1$', blowfish='$2a$', sha256='$5$', sha512='$6$'
)
if algorithm not in... | python | def gen_hash(crypt_salt=None, password=None, algorithm='sha512'):
'''
Generate /etc/shadow hash
'''
if not HAS_CRYPT:
raise SaltInvocationError('No crypt module for windows')
hash_algorithms = dict(
md5='$1$', blowfish='$2a$', sha256='$5$', sha512='$6$'
)
if algorithm not in... | [
"def",
"gen_hash",
"(",
"crypt_salt",
"=",
"None",
",",
"password",
"=",
"None",
",",
"algorithm",
"=",
"'sha512'",
")",
":",
"if",
"not",
"HAS_CRYPT",
":",
"raise",
"SaltInvocationError",
"(",
"'No crypt module for windows'",
")",
"hash_algorithms",
"=",
"dict"... | Generate /etc/shadow hash | [
"Generate",
"/",
"etc",
"/",
"shadow",
"hash"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pycrypto.py#L69-L92 | train |
saltstack/salt | salt/executors/splay.py | _get_hash | def _get_hash():
'''
Jenkins One-At-A-Time Hash Function
More Info: http://en.wikipedia.org/wiki/Jenkins_hash_function#one-at-a-time
'''
# Using bitmask to emulate rollover behavior of C unsigned 32 bit int
bitmask = 0xffffffff
h = 0
for i in bytearray(salt.utils.stringutils.to_bytes(__... | python | def _get_hash():
'''
Jenkins One-At-A-Time Hash Function
More Info: http://en.wikipedia.org/wiki/Jenkins_hash_function#one-at-a-time
'''
# Using bitmask to emulate rollover behavior of C unsigned 32 bit int
bitmask = 0xffffffff
h = 0
for i in bytearray(salt.utils.stringutils.to_bytes(__... | [
"def",
"_get_hash",
"(",
")",
":",
"# Using bitmask to emulate rollover behavior of C unsigned 32 bit int",
"bitmask",
"=",
"0xffffffff",
"h",
"=",
"0",
"for",
"i",
"in",
"bytearray",
"(",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_bytes",
"(",
"__grains__",... | Jenkins One-At-A-Time Hash Function
More Info: http://en.wikipedia.org/wiki/Jenkins_hash_function#one-at-a-time | [
"Jenkins",
"One",
"-",
"At",
"-",
"A",
"-",
"Time",
"Hash",
"Function",
"More",
"Info",
":",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Jenkins_hash_function#one",
"-",
"at",
"-",
"a",
"-",
"time"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/executors/splay.py#L24-L42 | train |
saltstack/salt | salt/executors/splay.py | execute | def execute(opts, data, func, args, kwargs):
'''
Splay a salt function call execution time across minions over
a number of seconds (default: 300)
.. note::
You *probably* want to use --async here and look up the job results later.
If you're dead set on getting the output from the CLI co... | python | def execute(opts, data, func, args, kwargs):
'''
Splay a salt function call execution time across minions over
a number of seconds (default: 300)
.. note::
You *probably* want to use --async here and look up the job results later.
If you're dead set on getting the output from the CLI co... | [
"def",
"execute",
"(",
"opts",
",",
"data",
",",
"func",
",",
"args",
",",
"kwargs",
")",
":",
"if",
"'executor_opts'",
"in",
"data",
"and",
"'splaytime'",
"in",
"data",
"[",
"'executor_opts'",
"]",
":",
"splaytime",
"=",
"data",
"[",
"'executor_opts'",
... | Splay a salt function call execution time across minions over
a number of seconds (default: 300)
.. note::
You *probably* want to use --async here and look up the job results later.
If you're dead set on getting the output from the CLI command, then make
sure to set the timeout (with th... | [
"Splay",
"a",
"salt",
"function",
"call",
"execution",
"time",
"across",
"minions",
"over",
"a",
"number",
"of",
"seconds",
"(",
"default",
":",
"300",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/executors/splay.py#L49-L84 | train |
saltstack/salt | salt/states/elasticsearch_index.py | absent | def absent(name):
'''
Ensure that the named index is absent.
name
Name of the index to remove
'''
ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''}
try:
index = __salt__['elasticsearch.index_get'](index=name)
if index and name in index:
if ... | python | def absent(name):
'''
Ensure that the named index is absent.
name
Name of the index to remove
'''
ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''}
try:
index = __salt__['elasticsearch.index_get'](index=name)
if index and name in index:
if ... | [
"def",
"absent",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"try",
":",
"index",
"=",
"__salt__",
"[",
"'elasticsearch.index_get'",
"... | Ensure that the named index is absent.
name
Name of the index to remove | [
"Ensure",
"that",
"the",
"named",
"index",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/elasticsearch_index.py#L19-L49 | train |
saltstack/salt | salt/states/elasticsearch_index.py | present | def present(name, definition=None):
'''
.. versionadded:: 2015.8.0
.. versionchanged:: 2017.3.0
Marked ``definition`` as optional.
Ensure that the named index is present.
name
Name of the index to add
definition
Optional dict for creation parameters as per https://www.... | python | def present(name, definition=None):
'''
.. versionadded:: 2015.8.0
.. versionchanged:: 2017.3.0
Marked ``definition`` as optional.
Ensure that the named index is present.
name
Name of the index to add
definition
Optional dict for creation parameters as per https://www.... | [
"def",
"present",
"(",
"name",
",",
"definition",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"try",
":",
"index_exists",
"=",
"__sa... | .. versionadded:: 2015.8.0
.. versionchanged:: 2017.3.0
Marked ``definition`` as optional.
Ensure that the named index is present.
name
Name of the index to add
definition
Optional dict for creation parameters as per https://www.elastic.co/guide/en/elasticsearch/reference/curr... | [
"..",
"versionadded",
"::",
"2015",
".",
"8",
".",
"0",
"..",
"versionchanged",
"::",
"2017",
".",
"3",
".",
"0",
"Marked",
"definition",
"as",
"optional",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/elasticsearch_index.py#L52-L106 | train |
saltstack/salt | salt/modules/freebsdservice.py | _cmd | def _cmd(jail=None):
'''
Return full path to service command
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) keyword argument in kwargs
'''
service = salt.utils.path.which('service')
if not service:
raise CommandNotFoundError('\'service\' command not f... | python | def _cmd(jail=None):
'''
Return full path to service command
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) keyword argument in kwargs
'''
service = salt.utils.path.which('service')
if not service:
raise CommandNotFoundError('\'service\' command not f... | [
"def",
"_cmd",
"(",
"jail",
"=",
"None",
")",
":",
"service",
"=",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'service'",
")",
"if",
"not",
"service",
":",
"raise",
"CommandNotFoundError",
"(",
"'\\'service\\' command not found'",
")",
"if",
"j... | Return full path to service command
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) keyword argument in kwargs | [
"Return",
"full",
"path",
"to",
"service",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsdservice.py#L46-L62 | train |
saltstack/salt | salt/modules/freebsdservice.py | _get_jail_path | def _get_jail_path(jail):
'''
.. versionadded:: 2016.3.4
Return the jail's root directory (path) as shown in jls
jail
The jid or jail name
'''
jls = salt.utils.path.which('jls')
if not jls:
raise CommandNotFoundError('\'jls\' command not found')
jails = __salt__['cmd.ru... | python | def _get_jail_path(jail):
'''
.. versionadded:: 2016.3.4
Return the jail's root directory (path) as shown in jls
jail
The jid or jail name
'''
jls = salt.utils.path.which('jls')
if not jls:
raise CommandNotFoundError('\'jls\' command not found')
jails = __salt__['cmd.ru... | [
"def",
"_get_jail_path",
"(",
"jail",
")",
":",
"jls",
"=",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'jls'",
")",
"if",
"not",
"jls",
":",
"raise",
"CommandNotFoundError",
"(",
"'\\'jls\\' command not found'",
")",
"jails",
"=",
"__salt__",
"... | .. versionadded:: 2016.3.4
Return the jail's root directory (path) as shown in jls
jail
The jid or jail name | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"4"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsdservice.py#L65-L83 | train |
saltstack/salt | salt/modules/freebsdservice.py | _get_rcscript | def _get_rcscript(name, jail=None):
'''
Return full path to service rc script
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) keyword argument in kwargs
'''
cmd = '{0} -r'.format(_cmd(jail))
prf = _get_jail_path(jail) if jail else ''
for line in __salt__['... | python | def _get_rcscript(name, jail=None):
'''
Return full path to service rc script
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) keyword argument in kwargs
'''
cmd = '{0} -r'.format(_cmd(jail))
prf = _get_jail_path(jail) if jail else ''
for line in __salt__['... | [
"def",
"_get_rcscript",
"(",
"name",
",",
"jail",
"=",
"None",
")",
":",
"cmd",
"=",
"'{0} -r'",
".",
"format",
"(",
"_cmd",
"(",
"jail",
")",
")",
"prf",
"=",
"_get_jail_path",
"(",
"jail",
")",
"if",
"jail",
"else",
"''",
"for",
"line",
"in",
"__... | Return full path to service rc script
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) keyword argument in kwargs | [
"Return",
"full",
"path",
"to",
"service",
"rc",
"script"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsdservice.py#L86-L99 | train |
saltstack/salt | salt/modules/freebsdservice.py | _get_rcvar | def _get_rcvar(name, jail=None):
'''
Return rcvar
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) keyword argument in kwargs
'''
if not available(name, jail):
log.error('Service %s not found', name)
return False
cmd = '{0} {1} rcvar'.format(_c... | python | def _get_rcvar(name, jail=None):
'''
Return rcvar
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) keyword argument in kwargs
'''
if not available(name, jail):
log.error('Service %s not found', name)
return False
cmd = '{0} {1} rcvar'.format(_c... | [
"def",
"_get_rcvar",
"(",
"name",
",",
"jail",
"=",
"None",
")",
":",
"if",
"not",
"available",
"(",
"name",
",",
"jail",
")",
":",
"log",
".",
"error",
"(",
"'Service %s not found'",
",",
"name",
")",
"return",
"False",
"cmd",
"=",
"'{0} {1} rcvar'",
... | Return rcvar
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) keyword argument in kwargs | [
"Return",
"rcvar"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsdservice.py#L102-L122 | train |
saltstack/salt | salt/modules/freebsdservice.py | get_enabled | def get_enabled(jail=None):
'''
Return what services are set to run on boot
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) keyword argument in kwargs
CLI Example:
.. code-block:: bash
salt '*' service.get_enabled
'''
ret = []
service = _cmd... | python | def get_enabled(jail=None):
'''
Return what services are set to run on boot
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) keyword argument in kwargs
CLI Example:
.. code-block:: bash
salt '*' service.get_enabled
'''
ret = []
service = _cmd... | [
"def",
"get_enabled",
"(",
"jail",
"=",
"None",
")",
":",
"ret",
"=",
"[",
"]",
"service",
"=",
"_cmd",
"(",
"jail",
")",
"prf",
"=",
"_get_jail_path",
"(",
"jail",
")",
"if",
"jail",
"else",
"''",
"for",
"svc",
"in",
"__salt__",
"[",
"'cmd.run'",
... | Return what services are set to run on boot
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) keyword argument in kwargs
CLI Example:
.. code-block:: bash
salt '*' service.get_enabled | [
"Return",
"what",
"services",
"are",
"set",
"to",
"run",
"on",
"boot"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsdservice.py#L125-L154 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.