partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | configmap_absent | Ensures that the named configmap is absent from the given namespace.
name
The name of the configmap
namespace
The namespace holding the configmap. The 'default' one is going to be
used unless a different one is specified. | salt/states/kubernetes.py | def configmap_absent(name, namespace='default', **kwargs):
'''
Ensures that the named configmap is absent from the given namespace.
name
The name of the configmap
namespace
The namespace holding the configmap. The 'default' one is going to be
used unless a different one is spec... | def configmap_absent(name, namespace='default', **kwargs):
'''
Ensures that the named configmap is absent from the given namespace.
name
The name of the configmap
namespace
The namespace holding the configmap. The 'default' one is going to be
used unless a different one is spec... | [
"Ensures",
"that",
"the",
"named",
"configmap",
"is",
"absent",
"from",
"the",
"given",
"namespace",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L595-L634 | [
"def",
"configmap_absent",
"(",
"name",
",",
"namespace",
"=",
"'default'",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | configmap_present | Ensures that the named configmap is present inside of the specified namespace
with the given data.
If the configmap exists it will be replaced.
name
The name of the configmap.
namespace
The namespace holding the configmap. The 'default' one is going to be
used unless a differen... | salt/states/kubernetes.py | def configmap_present(
name,
namespace='default',
data=None,
source=None,
template=None,
**kwargs):
'''
Ensures that the named configmap is present inside of the specified namespace
with the given data.
If the configmap exists it will be replaced.
nam... | def configmap_present(
name,
namespace='default',
data=None,
source=None,
template=None,
**kwargs):
'''
Ensures that the named configmap is present inside of the specified namespace
with the given data.
If the configmap exists it will be replaced.
nam... | [
"Ensures",
"that",
"the",
"named",
"configmap",
"is",
"present",
"inside",
"of",
"the",
"specified",
"namespace",
"with",
"the",
"given",
"data",
".",
"If",
"the",
"configmap",
"exists",
"it",
"will",
"be",
"replaced",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L637-L717 | [
"def",
"configmap_present",
"(",
"name",
",",
"namespace",
"=",
"'default'",
",",
"data",
"=",
"None",
",",
"source",
"=",
"None",
",",
"template",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | pod_absent | Ensures that the named pod is absent from the given namespace.
name
The name of the pod
namespace
The name of the namespace | salt/states/kubernetes.py | def pod_absent(name, namespace='default', **kwargs):
'''
Ensures that the named pod is absent from the given namespace.
name
The name of the pod
namespace
The name of the namespace
'''
ret = {'name': name,
'changes': {},
'result': False,
'comme... | def pod_absent(name, namespace='default', **kwargs):
'''
Ensures that the named pod is absent from the given namespace.
name
The name of the pod
namespace
The name of the namespace
'''
ret = {'name': name,
'changes': {},
'result': False,
'comme... | [
"Ensures",
"that",
"the",
"named",
"pod",
"is",
"absent",
"from",
"the",
"given",
"namespace",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L720-L761 | [
"def",
"pod_absent",
"(",
"name",
",",
"namespace",
"=",
"'default'",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"pod"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | pod_present | Ensures that the named pod is present inside of the specified
namespace with the given metadata and spec.
If the pod exists it will be replaced.
name
The name of the pod.
namespace
The namespace holding the pod. The 'default' one is going to be
used unless a different one is sp... | salt/states/kubernetes.py | def pod_present(
name,
namespace='default',
metadata=None,
spec=None,
source='',
template='',
**kwargs):
'''
Ensures that the named pod is present inside of the specified
namespace with the given metadata and spec.
If the pod exists it will be repl... | def pod_present(
name,
namespace='default',
metadata=None,
spec=None,
source='',
template='',
**kwargs):
'''
Ensures that the named pod is present inside of the specified
namespace with the given metadata and spec.
If the pod exists it will be repl... | [
"Ensures",
"that",
"the",
"named",
"pod",
"is",
"present",
"inside",
"of",
"the",
"specified",
"namespace",
"with",
"the",
"given",
"metadata",
"and",
"spec",
".",
"If",
"the",
"pod",
"exists",
"it",
"will",
"be",
"replaced",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L764-L850 | [
"def",
"pod_present",
"(",
"name",
",",
"namespace",
"=",
"'default'",
",",
"metadata",
"=",
"None",
",",
"spec",
"=",
"None",
",",
"source",
"=",
"''",
",",
"template",
"=",
"''",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | node_label_absent | Ensures that the named label is absent from the node.
name
The name of the label
node
The name of the node | salt/states/kubernetes.py | def node_label_absent(name, node, **kwargs):
'''
Ensures that the named label is absent from the node.
name
The name of the label
node
The name of the node
'''
ret = {'name': name,
'changes': {},
'result': False,
'comment': ''}
labels = __... | def node_label_absent(name, node, **kwargs):
'''
Ensures that the named label is absent from the node.
name
The name of the label
node
The name of the node
'''
ret = {'name': name,
'changes': {},
'result': False,
'comment': ''}
labels = __... | [
"Ensures",
"that",
"the",
"named",
"label",
"is",
"absent",
"from",
"the",
"node",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L853-L892 | [
"def",
"node_label_absent",
"(",
"name",
",",
"node",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"labels",
"=",
"__sal... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | node_label_folder_absent | Ensures the label folder doesn't exist on the specified node.
name
The name of label folder
node
The name of the node | salt/states/kubernetes.py | def node_label_folder_absent(name, node, **kwargs):
'''
Ensures the label folder doesn't exist on the specified node.
name
The name of label folder
node
The name of the node
'''
ret = {'name': name,
'changes': {},
'result': False,
'comment': ''... | def node_label_folder_absent(name, node, **kwargs):
'''
Ensures the label folder doesn't exist on the specified node.
name
The name of label folder
node
The name of the node
'''
ret = {'name': name,
'changes': {},
'result': False,
'comment': ''... | [
"Ensures",
"the",
"label",
"folder",
"doesn",
"t",
"exist",
"on",
"the",
"specified",
"node",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L895-L946 | [
"def",
"node_label_folder_absent",
"(",
"name",
",",
"node",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"labels",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | node_label_present | Ensures that the named label is set on the named node
with the given value.
If the label exists it will be replaced.
name
The name of the label.
value
Value of the label.
node
Node to change. | salt/states/kubernetes.py | def node_label_present(
name,
node,
value,
**kwargs):
'''
Ensures that the named label is set on the named node
with the given value.
If the label exists it will be replaced.
name
The name of the label.
value
Value of the label.
node
... | def node_label_present(
name,
node,
value,
**kwargs):
'''
Ensures that the named label is set on the named node
with the given value.
If the label exists it will be replaced.
name
The name of the label.
value
Value of the label.
node
... | [
"Ensures",
"that",
"the",
"named",
"label",
"is",
"set",
"on",
"the",
"named",
"node",
"with",
"the",
"given",
"value",
".",
"If",
"the",
"label",
"exists",
"it",
"will",
"be",
"replaced",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L949-L1009 | [
"def",
"node_label_present",
"(",
"name",
",",
"node",
",",
"value",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"label... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | init | This function gets called when the proxy starts up. For
login the protocol and port are cached. | salt/proxy/esxvm.py | def init(opts):
'''
This function gets called when the proxy starts up. For
login the protocol and port are cached.
'''
log.debug('Initting esxvm proxy module in process %s', os.getpid())
log.debug('Validating esxvm proxy input')
proxy_conf = merge(opts.get('proxy', {}), __pillar__.get('prox... | def init(opts):
'''
This function gets called when the proxy starts up. For
login the protocol and port are cached.
'''
log.debug('Initting esxvm proxy module in process %s', os.getpid())
log.debug('Validating esxvm proxy input')
proxy_conf = merge(opts.get('proxy', {}), __pillar__.get('prox... | [
"This",
"function",
"gets",
"called",
"when",
"the",
"proxy",
"starts",
"up",
".",
"For",
"login",
"the",
"protocol",
"and",
"port",
"are",
"cached",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/esxvm.py#L180-L234 | [
"def",
"init",
"(",
"opts",
")",
":",
"log",
".",
"debug",
"(",
"'Initting esxvm proxy module in process %s'",
",",
"os",
".",
"getpid",
"(",
")",
")",
"log",
".",
"debug",
"(",
"'Validating esxvm proxy input'",
")",
"proxy_conf",
"=",
"merge",
"(",
"opts",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | find_credentials | Cycle through all the possible credentials and return the first one that
works. | salt/proxy/esxvm.py | def find_credentials():
'''
Cycle through all the possible credentials and return the first one that
works.
'''
# if the username and password were already found don't go through the
# connection process again
if 'username' in DETAILS and 'password' in DETAILS:
return DETAILS['usern... | def find_credentials():
'''
Cycle through all the possible credentials and return the first one that
works.
'''
# if the username and password were already found don't go through the
# connection process again
if 'username' in DETAILS and 'password' in DETAILS:
return DETAILS['usern... | [
"Cycle",
"through",
"all",
"the",
"possible",
"credentials",
"and",
"return",
"the",
"first",
"one",
"that",
"works",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/esxvm.py#L258-L279 | [
"def",
"find_credentials",
"(",
")",
":",
"# if the username and password were already found don't go through the",
"# connection process again",
"if",
"'username'",
"in",
"DETAILS",
"and",
"'password'",
"in",
"DETAILS",
":",
"return",
"DETAILS",
"[",
"'username'",
"]",
","... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | multipath_flush | Device-Mapper Multipath flush
CLI Example:
.. code-block:: bash
salt '*' devmap.multipath_flush mpath1 | salt/modules/devmap.py | def multipath_flush(device):
'''
Device-Mapper Multipath flush
CLI Example:
.. code-block:: bash
salt '*' devmap.multipath_flush mpath1
'''
if not os.path.exists(device):
return '{0} does not exist'.format(device)
cmd = 'multipath -f {0}'.format(device)
return __salt_... | def multipath_flush(device):
'''
Device-Mapper Multipath flush
CLI Example:
.. code-block:: bash
salt '*' devmap.multipath_flush mpath1
'''
if not os.path.exists(device):
return '{0} does not exist'.format(device)
cmd = 'multipath -f {0}'.format(device)
return __salt_... | [
"Device",
"-",
"Mapper",
"Multipath",
"flush"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/devmap.py#L23-L37 | [
"def",
"multipath_flush",
"(",
"device",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"device",
")",
":",
"return",
"'{0} does not exist'",
".",
"format",
"(",
"device",
")",
"cmd",
"=",
"'multipath -f {0}'",
".",
"format",
"(",
"device",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_file | Set debconf selections from a file or a template
.. code-block:: yaml
<state_id>:
debconf.set_file:
- source: salt://pathto/pkg.selections
<state_id>:
debconf.set_file:
- source: salt://pathto/pkg.selections?saltenv=myenvironment
<state_id>:
... | salt/states/debconfmod.py | def set_file(name, source, template=None, context=None, defaults=None, **kwargs):
'''
Set debconf selections from a file or a template
.. code-block:: yaml
<state_id>:
debconf.set_file:
- source: salt://pathto/pkg.selections
<state_id>:
debconf.set_file:
... | def set_file(name, source, template=None, context=None, defaults=None, **kwargs):
'''
Set debconf selections from a file or a template
.. code-block:: yaml
<state_id>:
debconf.set_file:
- source: salt://pathto/pkg.selections
<state_id>:
debconf.set_file:
... | [
"Set",
"debconf",
"selections",
"from",
"a",
"file",
"or",
"a",
"template"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/debconfmod.py#L85-L155 | [
"def",
"set_file",
"(",
"name",
",",
"source",
",",
"template",
"=",
"None",
",",
"context",
"=",
"None",
",",
"defaults",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set | Set debconf selections
.. code-block:: yaml
<state_id>:
debconf.set:
- name: <name>
- data:
<question>: {'type': <type>, 'value': <value>}
<question>: {'type': <type>, 'value': <value>}
<state_id>:
debconf.set:
... | salt/states/debconfmod.py | def set(name, data, **kwargs):
'''
Set debconf selections
.. code-block:: yaml
<state_id>:
debconf.set:
- name: <name>
- data:
<question>: {'type': <type>, 'value': <value>}
<question>: {'type': <type>, 'value': <value>}
<s... | def set(name, data, **kwargs):
'''
Set debconf selections
.. code-block:: yaml
<state_id>:
debconf.set:
- name: <name>
- data:
<question>: {'type': <type>, 'value': <value>}
<question>: {'type': <type>, 'value': <value>}
<s... | [
"Set",
"debconf",
"selections"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/debconfmod.py#L158-L234 | [
"def",
"set",
"(",
"name",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"current",
"=",
"__salt__",
"[",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | start | Scan for Docker events and fire events
Example Config
.. code-block:: yaml
engines:
- docker_events:
docker_url: unix://var/run/docker.sock
filters:
event:
- start
- stop
- die
- oom
... | salt/engines/docker_events.py | def start(docker_url='unix://var/run/docker.sock',
timeout=CLIENT_TIMEOUT,
tag='salt/engines/docker_events',
filters=None):
'''
Scan for Docker events and fire events
Example Config
.. code-block:: yaml
engines:
- docker_events:
docker_url... | def start(docker_url='unix://var/run/docker.sock',
timeout=CLIENT_TIMEOUT,
tag='salt/engines/docker_events',
filters=None):
'''
Scan for Docker events and fire events
Example Config
.. code-block:: yaml
engines:
- docker_events:
docker_url... | [
"Scan",
"for",
"Docker",
"events",
"and",
"fire",
"events"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/docker_events.py#L42-L105 | [
"def",
"start",
"(",
"docker_url",
"=",
"'unix://var/run/docker.sock'",
",",
"timeout",
"=",
"CLIENT_TIMEOUT",
",",
"tag",
"=",
"'salt/engines/docker_events'",
",",
"filters",
"=",
"None",
")",
":",
"if",
"__opts__",
".",
"get",
"(",
"'__role'",
")",
"==",
"'m... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_config | Return configuration
user passed api_opts override salt config.get vars | salt/modules/infoblox.py | def _get_config(**api_opts):
'''
Return configuration
user passed api_opts override salt config.get vars
'''
config = {
'api_sslverify': True,
'api_url': 'https://INFOBLOX/wapi/v1.2.1',
'api_user': '',
'api_key': '',
}
if '__salt__' in globals():
confi... | def _get_config(**api_opts):
'''
Return configuration
user passed api_opts override salt config.get vars
'''
config = {
'api_sslverify': True,
'api_url': 'https://INFOBLOX/wapi/v1.2.1',
'api_user': '',
'api_key': '',
}
if '__salt__' in globals():
confi... | [
"Return",
"configuration",
"user",
"passed",
"api_opts",
"override",
"salt",
"config",
".",
"get",
"vars"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L58-L75 | [
"def",
"_get_config",
"(",
"*",
"*",
"api_opts",
")",
":",
"config",
"=",
"{",
"'api_sslverify'",
":",
"True",
",",
"'api_url'",
":",
"'https://INFOBLOX/wapi/v1.2.1'",
",",
"'api_user'",
":",
"''",
",",
"'api_key'",
":",
"''",
",",
"}",
"if",
"'__salt__'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update_host | Update host record. This is a helper call to update_object.
Find a hosts ``_ref`` then call update_object with the record data.
CLI Example:
.. code-block:: bash
salt-call infoblox.update_host name=fqdn data={} | salt/modules/infoblox.py | def update_host(name, data, **api_opts):
'''
Update host record. This is a helper call to update_object.
Find a hosts ``_ref`` then call update_object with the record data.
CLI Example:
.. code-block:: bash
salt-call infoblox.update_host name=fqdn data={}
'''
o = get_host(name=na... | def update_host(name, data, **api_opts):
'''
Update host record. This is a helper call to update_object.
Find a hosts ``_ref`` then call update_object with the record data.
CLI Example:
.. code-block:: bash
salt-call infoblox.update_host name=fqdn data={}
'''
o = get_host(name=na... | [
"Update",
"host",
"record",
".",
"This",
"is",
"a",
"helper",
"call",
"to",
"update_object",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L120-L133 | [
"def",
"update_host",
"(",
"name",
",",
"data",
",",
"*",
"*",
"api_opts",
")",
":",
"o",
"=",
"get_host",
"(",
"name",
"=",
"name",
",",
"*",
"*",
"api_opts",
")",
"return",
"update_object",
"(",
"objref",
"=",
"o",
"[",
"'_ref'",
"]",
",",
"data"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update_object | Update raw infoblox object. This is a low level api call.
CLI Example:
.. code-block:: bash
salt-call infoblox.update_object objref=[ref_of_object] data={} | salt/modules/infoblox.py | def update_object(objref, data, **api_opts):
'''
Update raw infoblox object. This is a low level api call.
CLI Example:
.. code-block:: bash
salt-call infoblox.update_object objref=[ref_of_object] data={}
'''
if '__opts__' in globals() and __opts__['test']:
return {'Test': 'Wo... | def update_object(objref, data, **api_opts):
'''
Update raw infoblox object. This is a low level api call.
CLI Example:
.. code-block:: bash
salt-call infoblox.update_object objref=[ref_of_object] data={}
'''
if '__opts__' in globals() and __opts__['test']:
return {'Test': 'Wo... | [
"Update",
"raw",
"infoblox",
"object",
".",
"This",
"is",
"a",
"low",
"level",
"api",
"call",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L136-L149 | [
"def",
"update_object",
"(",
"objref",
",",
"data",
",",
"*",
"*",
"api_opts",
")",
":",
"if",
"'__opts__'",
"in",
"globals",
"(",
")",
"and",
"__opts__",
"[",
"'test'",
"]",
":",
"return",
"{",
"'Test'",
":",
"'Would attempt to update object: {0}'",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_object | Delete infoblox object. This is a low level api call.
CLI Example:
.. code-block:: bash
salt-call infoblox.delete_object objref=[ref_of_object] | salt/modules/infoblox.py | def delete_object(objref, **api_opts):
'''
Delete infoblox object. This is a low level api call.
CLI Example:
.. code-block:: bash
salt-call infoblox.delete_object objref=[ref_of_object]
'''
if '__opts__' in globals() and __opts__['test']:
return {'Test': 'Would attempt to del... | def delete_object(objref, **api_opts):
'''
Delete infoblox object. This is a low level api call.
CLI Example:
.. code-block:: bash
salt-call infoblox.delete_object objref=[ref_of_object]
'''
if '__opts__' in globals() and __opts__['test']:
return {'Test': 'Would attempt to del... | [
"Delete",
"infoblox",
"object",
".",
"This",
"is",
"a",
"low",
"level",
"api",
"call",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L152-L165 | [
"def",
"delete_object",
"(",
"objref",
",",
"*",
"*",
"api_opts",
")",
":",
"if",
"'__opts__'",
"in",
"globals",
"(",
")",
"and",
"__opts__",
"[",
"'test'",
"]",
":",
"return",
"{",
"'Test'",
":",
"'Would attempt to delete object: {0}'",
".",
"format",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_object | Create raw infoblox object. This is a low level api call.
CLI Example:
.. code-block:: bash
salt-call infoblox.update_object object_type=record:host data={} | salt/modules/infoblox.py | def create_object(object_type, data, **api_opts):
'''
Create raw infoblox object. This is a low level api call.
CLI Example:
.. code-block:: bash
salt-call infoblox.update_object object_type=record:host data={}
'''
if '__opts__' in globals() and __opts__['test']:
return {'Tes... | def create_object(object_type, data, **api_opts):
'''
Create raw infoblox object. This is a low level api call.
CLI Example:
.. code-block:: bash
salt-call infoblox.update_object object_type=record:host data={}
'''
if '__opts__' in globals() and __opts__['test']:
return {'Tes... | [
"Create",
"raw",
"infoblox",
"object",
".",
"This",
"is",
"a",
"low",
"level",
"api",
"call",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L168-L181 | [
"def",
"create_object",
"(",
"object_type",
",",
"data",
",",
"*",
"*",
"api_opts",
")",
":",
"if",
"'__opts__'",
"in",
"globals",
"(",
")",
"and",
"__opts__",
"[",
"'test'",
"]",
":",
"return",
"{",
"'Test'",
":",
"'Would attempt to create object: {0}'",
".... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_object | Get raw infoblox object. This is a low level api call.
CLI Example:
.. code-block:: bash
salt-call infoblox.get_object objref=[_ref of object] | salt/modules/infoblox.py | def get_object(objref, data=None, return_fields=None, max_results=None,
ensure_none_or_one_result=False, **api_opts):
'''
Get raw infoblox object. This is a low level api call.
CLI Example:
.. code-block:: bash
salt-call infoblox.get_object objref=[_ref of object]
'''
i... | def get_object(objref, data=None, return_fields=None, max_results=None,
ensure_none_or_one_result=False, **api_opts):
'''
Get raw infoblox object. This is a low level api call.
CLI Example:
.. code-block:: bash
salt-call infoblox.get_object objref=[_ref of object]
'''
i... | [
"Get",
"raw",
"infoblox",
"object",
".",
"This",
"is",
"a",
"low",
"level",
"api",
"call",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L184-L199 | [
"def",
"get_object",
"(",
"objref",
",",
"data",
"=",
"None",
",",
"return_fields",
"=",
"None",
",",
"max_results",
"=",
"None",
",",
"ensure_none_or_one_result",
"=",
"False",
",",
"*",
"*",
"api_opts",
")",
":",
"if",
"not",
"data",
":",
"data",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_cname | Create a cname record.
CLI Example:
.. code-block:: bash
salt-call infoblox.create_cname data={ \
"comment": "cname to example server", \
"name": "example.example.com", \
"zone": "example.com", \
"view": "Internal", \
"canonical": "example-h... | salt/modules/infoblox.py | def create_cname(data, **api_opts):
'''
Create a cname record.
CLI Example:
.. code-block:: bash
salt-call infoblox.create_cname data={ \
"comment": "cname to example server", \
"name": "example.example.com", \
"zone": "example.com", \
"view": "... | def create_cname(data, **api_opts):
'''
Create a cname record.
CLI Example:
.. code-block:: bash
salt-call infoblox.create_cname data={ \
"comment": "cname to example server", \
"name": "example.example.com", \
"zone": "example.com", \
"view": "... | [
"Create",
"a",
"cname",
"record",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L202-L220 | [
"def",
"create_cname",
"(",
"data",
",",
"*",
"*",
"api_opts",
")",
":",
"infoblox",
"=",
"_get_infoblox",
"(",
"*",
"*",
"api_opts",
")",
"host",
"=",
"infoblox",
".",
"create_cname",
"(",
"data",
"=",
"data",
")",
"return",
"host"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_cname | Get CNAME information.
CLI Examples:
.. code-block:: bash
salt-call infoblox.get_cname name=example.example.com
salt-call infoblox.get_cname canonical=example-ha-0.example.com | salt/modules/infoblox.py | def get_cname(name=None, canonical=None, return_fields=None, **api_opts):
'''
Get CNAME information.
CLI Examples:
.. code-block:: bash
salt-call infoblox.get_cname name=example.example.com
salt-call infoblox.get_cname canonical=example-ha-0.example.com
'''
infoblox = _get_inf... | def get_cname(name=None, canonical=None, return_fields=None, **api_opts):
'''
Get CNAME information.
CLI Examples:
.. code-block:: bash
salt-call infoblox.get_cname name=example.example.com
salt-call infoblox.get_cname canonical=example-ha-0.example.com
'''
infoblox = _get_inf... | [
"Get",
"CNAME",
"information",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L223-L236 | [
"def",
"get_cname",
"(",
"name",
"=",
"None",
",",
"canonical",
"=",
"None",
",",
"return_fields",
"=",
"None",
",",
"*",
"*",
"api_opts",
")",
":",
"infoblox",
"=",
"_get_infoblox",
"(",
"*",
"*",
"api_opts",
")",
"o",
"=",
"infoblox",
".",
"get_cname... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update_cname | Update CNAME. This is a helper call to update_object.
Find a CNAME ``_ref`` then call update_object with the record data.
CLI Example:
.. code-block:: bash
salt-call infoblox.update_cname name=example.example.com data="{
'canonical':'example-ha-0.example.com',
'us... | salt/modules/infoblox.py | def update_cname(name, data, **api_opts):
'''
Update CNAME. This is a helper call to update_object.
Find a CNAME ``_ref`` then call update_object with the record data.
CLI Example:
.. code-block:: bash
salt-call infoblox.update_cname name=example.example.com data="{
'cano... | def update_cname(name, data, **api_opts):
'''
Update CNAME. This is a helper call to update_object.
Find a CNAME ``_ref`` then call update_object with the record data.
CLI Example:
.. code-block:: bash
salt-call infoblox.update_cname name=example.example.com data="{
'cano... | [
"Update",
"CNAME",
".",
"This",
"is",
"a",
"helper",
"call",
"to",
"update_object",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L239-L258 | [
"def",
"update_cname",
"(",
"name",
",",
"data",
",",
"*",
"*",
"api_opts",
")",
":",
"o",
"=",
"get_cname",
"(",
"name",
"=",
"name",
",",
"*",
"*",
"api_opts",
")",
"if",
"not",
"o",
":",
"raise",
"Exception",
"(",
"'CNAME record not found'",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_cname | Delete CNAME. This is a helper call to delete_object.
If record is not found, return True
CLI Examples:
.. code-block:: bash
salt-call infoblox.delete_cname name=example.example.com
salt-call infoblox.delete_cname canonical=example-ha-0.example.com | salt/modules/infoblox.py | def delete_cname(name=None, canonical=None, **api_opts):
'''
Delete CNAME. This is a helper call to delete_object.
If record is not found, return True
CLI Examples:
.. code-block:: bash
salt-call infoblox.delete_cname name=example.example.com
salt-call infoblox.delete_cname canon... | def delete_cname(name=None, canonical=None, **api_opts):
'''
Delete CNAME. This is a helper call to delete_object.
If record is not found, return True
CLI Examples:
.. code-block:: bash
salt-call infoblox.delete_cname name=example.example.com
salt-call infoblox.delete_cname canon... | [
"Delete",
"CNAME",
".",
"This",
"is",
"a",
"helper",
"call",
"to",
"delete_object",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L261-L277 | [
"def",
"delete_cname",
"(",
"name",
"=",
"None",
",",
"canonical",
"=",
"None",
",",
"*",
"*",
"api_opts",
")",
":",
"cname",
"=",
"get_cname",
"(",
"name",
"=",
"name",
",",
"canonical",
"=",
"canonical",
",",
"*",
"*",
"api_opts",
")",
"if",
"cname... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_host | Get host information
CLI Examples:
.. code-block:: bash
salt-call infoblox.get_host hostname.domain.ca
salt-call infoblox.get_host ipv4addr=123.123.122.12
salt-call infoblox.get_host mac=00:50:56:84:6e:ae | salt/modules/infoblox.py | def get_host(name=None, ipv4addr=None, mac=None, return_fields=None, **api_opts):
'''
Get host information
CLI Examples:
.. code-block:: bash
salt-call infoblox.get_host hostname.domain.ca
salt-call infoblox.get_host ipv4addr=123.123.122.12
salt-call infoblox.get_host mac=00:5... | def get_host(name=None, ipv4addr=None, mac=None, return_fields=None, **api_opts):
'''
Get host information
CLI Examples:
.. code-block:: bash
salt-call infoblox.get_host hostname.domain.ca
salt-call infoblox.get_host ipv4addr=123.123.122.12
salt-call infoblox.get_host mac=00:5... | [
"Get",
"host",
"information"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L280-L294 | [
"def",
"get_host",
"(",
"name",
"=",
"None",
",",
"ipv4addr",
"=",
"None",
",",
"mac",
"=",
"None",
",",
"return_fields",
"=",
"None",
",",
"*",
"*",
"api_opts",
")",
":",
"infoblox",
"=",
"_get_infoblox",
"(",
"*",
"*",
"api_opts",
")",
"host",
"=",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_host_advanced | Get all host information
CLI Example:
.. code-block:: bash
salt-call infoblox.get_host_advanced hostname.domain.ca | salt/modules/infoblox.py | def get_host_advanced(name=None, ipv4addr=None, mac=None, **api_opts):
'''
Get all host information
CLI Example:
.. code-block:: bash
salt-call infoblox.get_host_advanced hostname.domain.ca
'''
infoblox = _get_infoblox(**api_opts)
host = infoblox.get_host_advanced(name=name, mac=m... | def get_host_advanced(name=None, ipv4addr=None, mac=None, **api_opts):
'''
Get all host information
CLI Example:
.. code-block:: bash
salt-call infoblox.get_host_advanced hostname.domain.ca
'''
infoblox = _get_infoblox(**api_opts)
host = infoblox.get_host_advanced(name=name, mac=m... | [
"Get",
"all",
"host",
"information"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L297-L309 | [
"def",
"get_host_advanced",
"(",
"name",
"=",
"None",
",",
"ipv4addr",
"=",
"None",
",",
"mac",
"=",
"None",
",",
"*",
"*",
"api_opts",
")",
":",
"infoblox",
"=",
"_get_infoblox",
"(",
"*",
"*",
"api_opts",
")",
"host",
"=",
"infoblox",
".",
"get_host_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_host_domainname | Get host domain name
If no domains are passed, the hostname is checked for a zone in infoblox,
if no zone split on first dot.
If domains are provided, the best match out of the list is returned.
If none are found the return is None
dots at end of names are ignored.
CLI Example:
.. code... | salt/modules/infoblox.py | def get_host_domainname(name, domains=None, **api_opts):
'''
Get host domain name
If no domains are passed, the hostname is checked for a zone in infoblox,
if no zone split on first dot.
If domains are provided, the best match out of the list is returned.
If none are found the return is None
... | def get_host_domainname(name, domains=None, **api_opts):
'''
Get host domain name
If no domains are passed, the hostname is checked for a zone in infoblox,
if no zone split on first dot.
If domains are provided, the best match out of the list is returned.
If none are found the return is None
... | [
"Get",
"host",
"domain",
"name"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L312-L348 | [
"def",
"get_host_domainname",
"(",
"name",
",",
"domains",
"=",
"None",
",",
"*",
"*",
"api_opts",
")",
":",
"name",
"=",
"name",
".",
"lower",
"(",
")",
".",
"rstrip",
"(",
"'.'",
")",
"if",
"not",
"domains",
":",
"data",
"=",
"get_host",
"(",
"na... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_host_hostname | Get hostname
If no domains are passed, the hostname is checked for a zone in infoblox,
if no zone split on first dot.
If domains are provided, the best match out of the list is truncated from
the fqdn leaving the hostname.
If no matching domains are found the fqdn is returned.
dots at end of... | salt/modules/infoblox.py | def get_host_hostname(name, domains=None, **api_opts):
'''
Get hostname
If no domains are passed, the hostname is checked for a zone in infoblox,
if no zone split on first dot.
If domains are provided, the best match out of the list is truncated from
the fqdn leaving the hostname.
If no m... | def get_host_hostname(name, domains=None, **api_opts):
'''
Get hostname
If no domains are passed, the hostname is checked for a zone in infoblox,
if no zone split on first dot.
If domains are provided, the best match out of the list is truncated from
the fqdn leaving the hostname.
If no m... | [
"Get",
"hostname"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L351-L382 | [
"def",
"get_host_hostname",
"(",
"name",
",",
"domains",
"=",
"None",
",",
"*",
"*",
"api_opts",
")",
":",
"name",
"=",
"name",
".",
"lower",
"(",
")",
".",
"rstrip",
"(",
"'.'",
")",
"if",
"not",
"domains",
":",
"return",
"name",
".",
"split",
"("... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_host_mac | Get mac address from host record.
Use `allow_array` to return possible multiple values.
CLI Example:
.. code-block:: bash
salt-call infoblox.get_host_mac host=localhost.domain.com | salt/modules/infoblox.py | def get_host_mac(name=None, allow_array=False, **api_opts):
'''
Get mac address from host record.
Use `allow_array` to return possible multiple values.
CLI Example:
.. code-block:: bash
salt-call infoblox.get_host_mac host=localhost.domain.com
'''
data = get_host(name=name, **api... | def get_host_mac(name=None, allow_array=False, **api_opts):
'''
Get mac address from host record.
Use `allow_array` to return possible multiple values.
CLI Example:
.. code-block:: bash
salt-call infoblox.get_host_mac host=localhost.domain.com
'''
data = get_host(name=name, **api... | [
"Get",
"mac",
"address",
"from",
"host",
"record",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L385-L407 | [
"def",
"get_host_mac",
"(",
"name",
"=",
"None",
",",
"allow_array",
"=",
"False",
",",
"*",
"*",
"api_opts",
")",
":",
"data",
"=",
"get_host",
"(",
"name",
"=",
"name",
",",
"*",
"*",
"api_opts",
")",
"if",
"data",
"and",
"'ipv4addrs'",
"in",
"data... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_host_ipv4 | Get ipv4 address from host record.
Use `allow_array` to return possible multiple values.
CLI Examples:
.. code-block:: bash
salt-call infoblox.get_host_ipv4 host=localhost.domain.com
salt-call infoblox.get_host_ipv4 mac=00:50:56:84:6e:ae | salt/modules/infoblox.py | def get_host_ipv4(name=None, mac=None, allow_array=False, **api_opts):
'''
Get ipv4 address from host record.
Use `allow_array` to return possible multiple values.
CLI Examples:
.. code-block:: bash
salt-call infoblox.get_host_ipv4 host=localhost.domain.com
salt-call infoblox.get... | def get_host_ipv4(name=None, mac=None, allow_array=False, **api_opts):
'''
Get ipv4 address from host record.
Use `allow_array` to return possible multiple values.
CLI Examples:
.. code-block:: bash
salt-call infoblox.get_host_ipv4 host=localhost.domain.com
salt-call infoblox.get... | [
"Get",
"ipv4",
"address",
"from",
"host",
"record",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L410-L433 | [
"def",
"get_host_ipv4",
"(",
"name",
"=",
"None",
",",
"mac",
"=",
"None",
",",
"allow_array",
"=",
"False",
",",
"*",
"*",
"api_opts",
")",
":",
"data",
"=",
"get_host",
"(",
"name",
"=",
"name",
",",
"mac",
"=",
"mac",
",",
"*",
"*",
"api_opts",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_host_ipv4addr_info | Get host ipv4addr information
CLI Examples:
.. code-block:: bash
salt-call infoblox.get_ipv4addr ipv4addr=123.123.122.12
salt-call infoblox.get_ipv4addr mac=00:50:56:84:6e:ae
salt-call infoblox.get_ipv4addr mac=00:50:56:84:6e:ae return_fields=host return_fields='mac,host,configure_for... | salt/modules/infoblox.py | def get_host_ipv4addr_info(ipv4addr=None, mac=None,
discovered_data=None,
return_fields=None, **api_opts):
'''
Get host ipv4addr information
CLI Examples:
.. code-block:: bash
salt-call infoblox.get_ipv4addr ipv4a... | def get_host_ipv4addr_info(ipv4addr=None, mac=None,
discovered_data=None,
return_fields=None, **api_opts):
'''
Get host ipv4addr information
CLI Examples:
.. code-block:: bash
salt-call infoblox.get_ipv4addr ipv4a... | [
"Get",
"host",
"ipv4addr",
"information"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L436-L451 | [
"def",
"get_host_ipv4addr_info",
"(",
"ipv4addr",
"=",
"None",
",",
"mac",
"=",
"None",
",",
"discovered_data",
"=",
"None",
",",
"return_fields",
"=",
"None",
",",
"*",
"*",
"api_opts",
")",
":",
"infoblox",
"=",
"_get_infoblox",
"(",
"*",
"*",
"api_opts"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_host_ipv6addr_info | Get host ipv6addr information
CLI Example:
.. code-block:: bash
salt-call infoblox.get_host_ipv6addr_info ipv6addr=2001:db8:85a3:8d3:1349:8a2e:370:7348 | salt/modules/infoblox.py | def get_host_ipv6addr_info(ipv6addr=None, mac=None,
discovered_data=None,
return_fields=None, **api_opts):
'''
Get host ipv6addr information
CLI Example:
.. code-block:: bash
salt-call infoblox.get_host_ipv6addr_i... | def get_host_ipv6addr_info(ipv6addr=None, mac=None,
discovered_data=None,
return_fields=None, **api_opts):
'''
Get host ipv6addr information
CLI Example:
.. code-block:: bash
salt-call infoblox.get_host_ipv6addr_i... | [
"Get",
"host",
"ipv6addr",
"information"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L454-L467 | [
"def",
"get_host_ipv6addr_info",
"(",
"ipv6addr",
"=",
"None",
",",
"mac",
"=",
"None",
",",
"discovered_data",
"=",
"None",
",",
"return_fields",
"=",
"None",
",",
"*",
"*",
"api_opts",
")",
":",
"infoblox",
"=",
"_get_infoblox",
"(",
"*",
"*",
"api_opts"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_network | Get list of all networks. This is helpful when looking up subnets to use
with func:nextavailableip
This call is offen slow and not cached!
some return_fields
comment,network,network_view,ddns_domainname,disable,enable_ddns
CLI Example:
.. code-block:: bash
salt-call infoblox.get_net... | salt/modules/infoblox.py | def get_network(ipv4addr=None, network=None, return_fields=None, **api_opts):
'''
Get list of all networks. This is helpful when looking up subnets to use
with func:nextavailableip
This call is offen slow and not cached!
some return_fields
comment,network,network_view,ddns_domainname,disable,e... | def get_network(ipv4addr=None, network=None, return_fields=None, **api_opts):
'''
Get list of all networks. This is helpful when looking up subnets to use
with func:nextavailableip
This call is offen slow and not cached!
some return_fields
comment,network,network_view,ddns_domainname,disable,e... | [
"Get",
"list",
"of",
"all",
"networks",
".",
"This",
"is",
"helpful",
"when",
"looking",
"up",
"subnets",
"to",
"use",
"with",
"func",
":",
"nextavailableip"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L470-L487 | [
"def",
"get_network",
"(",
"ipv4addr",
"=",
"None",
",",
"network",
"=",
"None",
",",
"return_fields",
"=",
"None",
",",
"*",
"*",
"api_opts",
")",
":",
"infoblox",
"=",
"_get_infoblox",
"(",
"*",
"*",
"api_opts",
")",
"return",
"infoblox",
".",
"get_net... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_host | Delete host
CLI Example:
.. code-block:: bash
salt-call infoblox.delete_host name=example.domain.com
salt-call infoblox.delete_host ipv4addr=123.123.122.12
salt-call infoblox.delete_host ipv4addr=123.123.122.12 mac=00:50:56:84:6e:ae | salt/modules/infoblox.py | def delete_host(name=None, mac=None, ipv4addr=None, **api_opts):
'''
Delete host
CLI Example:
.. code-block:: bash
salt-call infoblox.delete_host name=example.domain.com
salt-call infoblox.delete_host ipv4addr=123.123.122.12
salt-call infoblox.delete_host ipv4addr=123.123.122.... | def delete_host(name=None, mac=None, ipv4addr=None, **api_opts):
'''
Delete host
CLI Example:
.. code-block:: bash
salt-call infoblox.delete_host name=example.domain.com
salt-call infoblox.delete_host ipv4addr=123.123.122.12
salt-call infoblox.delete_host ipv4addr=123.123.122.... | [
"Delete",
"host"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L490-L505 | [
"def",
"delete_host",
"(",
"name",
"=",
"None",
",",
"mac",
"=",
"None",
",",
"ipv4addr",
"=",
"None",
",",
"*",
"*",
"api_opts",
")",
":",
"if",
"'__opts__'",
"in",
"globals",
"(",
")",
"and",
"__opts__",
"[",
"'test'",
"]",
":",
"return",
"{",
"'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_ipv4_range | Get ip range
CLI Example:
.. code-block:: bash
salt-call infoblox.get_ipv4_range start_addr=123.123.122.12 | salt/modules/infoblox.py | def get_ipv4_range(start_addr=None, end_addr=None, return_fields=None, **api_opts):
'''
Get ip range
CLI Example:
.. code-block:: bash
salt-call infoblox.get_ipv4_range start_addr=123.123.122.12
'''
infoblox = _get_infoblox(**api_opts)
return infoblox.get_range(start_addr, end_add... | def get_ipv4_range(start_addr=None, end_addr=None, return_fields=None, **api_opts):
'''
Get ip range
CLI Example:
.. code-block:: bash
salt-call infoblox.get_ipv4_range start_addr=123.123.122.12
'''
infoblox = _get_infoblox(**api_opts)
return infoblox.get_range(start_addr, end_add... | [
"Get",
"ip",
"range"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L541-L552 | [
"def",
"get_ipv4_range",
"(",
"start_addr",
"=",
"None",
",",
"end_addr",
"=",
"None",
",",
"return_fields",
"=",
"None",
",",
"*",
"*",
"api_opts",
")",
":",
"infoblox",
"=",
"_get_infoblox",
"(",
"*",
"*",
"api_opts",
")",
"return",
"infoblox",
".",
"g... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_ipv4_range | Delete ip range.
CLI Example:
.. code-block:: bash
salt-call infoblox.delete_ipv4_range start_addr=123.123.122.12 | salt/modules/infoblox.py | def delete_ipv4_range(start_addr=None, end_addr=None, **api_opts):
'''
Delete ip range.
CLI Example:
.. code-block:: bash
salt-call infoblox.delete_ipv4_range start_addr=123.123.122.12
'''
r = get_ipv4_range(start_addr, end_addr, **api_opts)
if r:
return delete_object(r['_... | def delete_ipv4_range(start_addr=None, end_addr=None, **api_opts):
'''
Delete ip range.
CLI Example:
.. code-block:: bash
salt-call infoblox.delete_ipv4_range start_addr=123.123.122.12
'''
r = get_ipv4_range(start_addr, end_addr, **api_opts)
if r:
return delete_object(r['_... | [
"Delete",
"ip",
"range",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L555-L569 | [
"def",
"delete_ipv4_range",
"(",
"start_addr",
"=",
"None",
",",
"end_addr",
"=",
"None",
",",
"*",
"*",
"api_opts",
")",
":",
"r",
"=",
"get_ipv4_range",
"(",
"start_addr",
",",
"end_addr",
",",
"*",
"*",
"api_opts",
")",
"if",
"r",
":",
"return",
"de... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_a | Get A record
CLI Examples:
.. code-block:: bash
salt-call infoblox.get_a name=abc.example.com
salt-call infoblox.get_a ipv4addr=192.168.3.5 | salt/modules/infoblox.py | def get_a(name=None, ipv4addr=None, allow_array=True, **api_opts):
'''
Get A record
CLI Examples:
.. code-block:: bash
salt-call infoblox.get_a name=abc.example.com
salt-call infoblox.get_a ipv4addr=192.168.3.5
'''
data = {}
if name:
data['name'] = name
if ipv4... | def get_a(name=None, ipv4addr=None, allow_array=True, **api_opts):
'''
Get A record
CLI Examples:
.. code-block:: bash
salt-call infoblox.get_a name=abc.example.com
salt-call infoblox.get_a ipv4addr=192.168.3.5
'''
data = {}
if name:
data['name'] = name
if ipv4... | [
"Get",
"A",
"record"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L610-L629 | [
"def",
"get_a",
"(",
"name",
"=",
"None",
",",
"ipv4addr",
"=",
"None",
",",
"allow_array",
"=",
"True",
",",
"*",
"*",
"api_opts",
")",
":",
"data",
"=",
"{",
"}",
"if",
"name",
":",
"data",
"[",
"'name'",
"]",
"=",
"name",
"if",
"ipv4addr",
":"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_a | Delete A record
If the A record is used as a round robin you can set ``allow_array=True`` to
delete all records for the hostname.
CLI Examples:
.. code-block:: bash
salt-call infoblox.delete_a name=abc.example.com
salt-call infoblox.delete_a ipv4addr=192.168.3.5
salt-call inf... | salt/modules/infoblox.py | def delete_a(name=None, ipv4addr=None, allow_array=False, **api_opts):
'''
Delete A record
If the A record is used as a round robin you can set ``allow_array=True`` to
delete all records for the hostname.
CLI Examples:
.. code-block:: bash
salt-call infoblox.delete_a name=abc.example... | def delete_a(name=None, ipv4addr=None, allow_array=False, **api_opts):
'''
Delete A record
If the A record is used as a round robin you can set ``allow_array=True`` to
delete all records for the hostname.
CLI Examples:
.. code-block:: bash
salt-call infoblox.delete_a name=abc.example... | [
"Delete",
"A",
"record"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L632-L655 | [
"def",
"delete_a",
"(",
"name",
"=",
"None",
",",
"ipv4addr",
"=",
"None",
",",
"allow_array",
"=",
"False",
",",
"*",
"*",
"api_opts",
")",
":",
"r",
"=",
"get_a",
"(",
"name",
",",
"ipv4addr",
",",
"allow_array",
"=",
"False",
",",
"*",
"*",
"api... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | present | Ensure infoblox A record.
When you wish to update a hostname ensure `name` is set to the hostname
of the current record. You can give a new name in the `data.name`.
State example:
.. code-block:: yaml
infoblox_a.present:
- name: example-ha-0.domain.com
- data:
... | salt/states/infoblox_a.py | def present(name=None, ipv4addr=None, data=None, ensure_data=True, **api_opts):
'''
Ensure infoblox A record.
When you wish to update a hostname ensure `name` is set to the hostname
of the current record. You can give a new name in the `data.name`.
State example:
.. code-block:: yaml
... | def present(name=None, ipv4addr=None, data=None, ensure_data=True, **api_opts):
'''
Ensure infoblox A record.
When you wish to update a hostname ensure `name` is set to the hostname
of the current record. You can give a new name in the `data.name`.
State example:
.. code-block:: yaml
... | [
"Ensure",
"infoblox",
"A",
"record",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/infoblox_a.py#L17-L90 | [
"def",
"present",
"(",
"name",
"=",
"None",
",",
"ipv4addr",
"=",
"None",
",",
"data",
"=",
"None",
",",
"ensure_data",
"=",
"True",
",",
"*",
"*",
"api_opts",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"False",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | absent | Ensure infoblox A record is removed.
State example:
.. code-block:: yaml
infoblox_a.absent:
- name: example-ha-0.domain.com
infoblox_a.absent:
- name:
- ipv4addr: 127.0.23.23 | salt/states/infoblox_a.py | def absent(name=None, ipv4addr=None, **api_opts):
'''
Ensure infoblox A record is removed.
State example:
.. code-block:: yaml
infoblox_a.absent:
- name: example-ha-0.domain.com
infoblox_a.absent:
- name:
- ipv4addr: 127.0.23.23
'''
ret = {... | def absent(name=None, ipv4addr=None, **api_opts):
'''
Ensure infoblox A record is removed.
State example:
.. code-block:: yaml
infoblox_a.absent:
- name: example-ha-0.domain.com
infoblox_a.absent:
- name:
- ipv4addr: 127.0.23.23
'''
ret = {... | [
"Ensure",
"infoblox",
"A",
"record",
"is",
"removed",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/infoblox_a.py#L93-L124 | [
"def",
"absent",
"(",
"name",
"=",
"None",
",",
"ipv4addr",
"=",
"None",
",",
"*",
"*",
"api_opts",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_url | Get the kapacitor URL. | salt/modules/kapacitor.py | def _get_url():
'''
Get the kapacitor URL.
'''
protocol = __salt__['config.option']('kapacitor.protocol', 'http')
host = __salt__['config.option']('kapacitor.host', 'localhost')
port = __salt__['config.option']('kapacitor.port', 9092)
return '{0}://{1}:{2}'.format(protocol, host, port) | def _get_url():
'''
Get the kapacitor URL.
'''
protocol = __salt__['config.option']('kapacitor.protocol', 'http')
host = __salt__['config.option']('kapacitor.host', 'localhost')
port = __salt__['config.option']('kapacitor.port', 9092)
return '{0}://{1}:{2}'.format(protocol, host, port) | [
"Get",
"the",
"kapacitor",
"URL",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kapacitor.py#L55-L63 | [
"def",
"_get_url",
"(",
")",
":",
"protocol",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'kapacitor.protocol'",
",",
"'http'",
")",
"host",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'kapacitor.host'",
",",
"'localhost'",
")",
"port",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_task | Get a dict of data on a task.
name
Name of the task to get information about.
CLI Example:
.. code-block:: bash
salt '*' kapacitor.get_task cpu | salt/modules/kapacitor.py | def get_task(name):
'''
Get a dict of data on a task.
name
Name of the task to get information about.
CLI Example:
.. code-block:: bash
salt '*' kapacitor.get_task cpu
'''
url = _get_url()
if version() < '0.13':
task_url = '{0}/task?name={1}'.format(url, name... | def get_task(name):
'''
Get a dict of data on a task.
name
Name of the task to get information about.
CLI Example:
.. code-block:: bash
salt '*' kapacitor.get_task cpu
'''
url = _get_url()
if version() < '0.13':
task_url = '{0}/task?name={1}'.format(url, name... | [
"Get",
"a",
"dict",
"of",
"data",
"on",
"a",
"task",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kapacitor.py#L66-L106 | [
"def",
"get_task",
"(",
"name",
")",
":",
"url",
"=",
"_get_url",
"(",
")",
"if",
"version",
"(",
")",
"<",
"'0.13'",
":",
"task_url",
"=",
"'{0}/task?name={1}'",
".",
"format",
"(",
"url",
",",
"name",
")",
"else",
":",
"task_url",
"=",
"'{0}/kapacito... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _run_cmd | Run a Kapacitor task and return a dictionary of info. | salt/modules/kapacitor.py | def _run_cmd(cmd):
'''
Run a Kapacitor task and return a dictionary of info.
'''
ret = {}
env_vars = {
'KAPACITOR_URL': _get_url(),
'KAPACITOR_UNSAFE_SSL': __salt__['config.option']('kapacitor.unsafe_ssl', 'false'),
}
result = __salt__['cmd.run_all'](cmd, env=env_vars)
i... | def _run_cmd(cmd):
'''
Run a Kapacitor task and return a dictionary of info.
'''
ret = {}
env_vars = {
'KAPACITOR_URL': _get_url(),
'KAPACITOR_UNSAFE_SSL': __salt__['config.option']('kapacitor.unsafe_ssl', 'false'),
}
result = __salt__['cmd.run_all'](cmd, env=env_vars)
i... | [
"Run",
"a",
"Kapacitor",
"task",
"and",
"return",
"a",
"dictionary",
"of",
"info",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kapacitor.py#L109-L126 | [
"def",
"_run_cmd",
"(",
"cmd",
")",
":",
"ret",
"=",
"{",
"}",
"env_vars",
"=",
"{",
"'KAPACITOR_URL'",
":",
"_get_url",
"(",
")",
",",
"'KAPACITOR_UNSAFE_SSL'",
":",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'kapacitor.unsafe_ssl'",
",",
"'false'",
")"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | define_task | Define a task. Serves as both create/update.
name
Name of the task.
tick_script
Path to the TICK script for the task. Can be a salt:// source.
task_type
Task type. Defaults to 'stream'
dbrps
A list of databases and retention policies in "dbname"."rpname" format
... | salt/modules/kapacitor.py | def define_task(name,
tick_script,
task_type='stream',
database=None,
retention_policy='default',
dbrps=None):
'''
Define a task. Serves as both create/update.
name
Name of the task.
tick_script
Path to the... | def define_task(name,
tick_script,
task_type='stream',
database=None,
retention_policy='default',
dbrps=None):
'''
Define a task. Serves as both create/update.
name
Name of the task.
tick_script
Path to the... | [
"Define",
"a",
"task",
".",
"Serves",
"as",
"both",
"create",
"/",
"update",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kapacitor.py#L129-L194 | [
"def",
"define_task",
"(",
"name",
",",
"tick_script",
",",
"task_type",
"=",
"'stream'",
",",
"database",
"=",
"None",
",",
"retention_policy",
"=",
"'default'",
",",
"dbrps",
"=",
"None",
")",
":",
"if",
"not",
"database",
"and",
"not",
"dbrps",
":",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _ip_ifaces | Parse output from 'ip a' | salt/modules/linux_ip.py | def _ip_ifaces():
'''
Parse output from 'ip a'
'''
tmp = {}
ret = {}
if_ = None
at_ = None
out = __salt__['cmd.run']('ip a')
for line in out.splitlines():
if not line.startswith(' '):
comps = line.split(':')
if_ = comps[1].strip()
opts_comp... | def _ip_ifaces():
'''
Parse output from 'ip a'
'''
tmp = {}
ret = {}
if_ = None
at_ = None
out = __salt__['cmd.run']('ip a')
for line in out.splitlines():
if not line.startswith(' '):
comps = line.split(':')
if_ = comps[1].strip()
opts_comp... | [
"Parse",
"output",
"from",
"ip",
"a"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/linux_ip.py#L67-L103 | [
"def",
"_ip_ifaces",
"(",
")",
":",
"tmp",
"=",
"{",
"}",
"ret",
"=",
"{",
"}",
"if_",
"=",
"None",
"at_",
"=",
"None",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'ip a'",
")",
"for",
"line",
"in",
"out",
".",
"splitlines",
"(",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_routes | Parse the contents of ``/proc/net/route`` | salt/modules/linux_ip.py | def _parse_routes():
'''
Parse the contents of ``/proc/net/route``
'''
with salt.utils.files.fopen('/proc/net/route', 'r') as fp_:
out = salt.utils.stringutils.to_unicode(fp_.read())
ret = {}
for line in out.splitlines():
tmp = {}
if not line.strip():
continu... | def _parse_routes():
'''
Parse the contents of ``/proc/net/route``
'''
with salt.utils.files.fopen('/proc/net/route', 'r') as fp_:
out = salt.utils.stringutils.to_unicode(fp_.read())
ret = {}
for line in out.splitlines():
tmp = {}
if not line.strip():
continu... | [
"Parse",
"the",
"contents",
"of",
"/",
"proc",
"/",
"net",
"/",
"route"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/linux_ip.py#L139-L168 | [
"def",
"_parse_routes",
"(",
")",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"'/proc/net/route'",
",",
"'r'",
")",
"as",
"fp_",
":",
"out",
"=",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_unicode",
"(",
"fp_",
".",
"r... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _hex_to_octets | Convert hex fields from /proc/net/route to octects | salt/modules/linux_ip.py | def _hex_to_octets(addr):
'''
Convert hex fields from /proc/net/route to octects
'''
return '{0}:{1}:{2}:{3}'.format(
int(addr[6:8], 16),
int(addr[4:6], 16),
int(addr[2:4], 16),
int(addr[0:2], 16),
) | def _hex_to_octets(addr):
'''
Convert hex fields from /proc/net/route to octects
'''
return '{0}:{1}:{2}:{3}'.format(
int(addr[6:8], 16),
int(addr[4:6], 16),
int(addr[2:4], 16),
int(addr[0:2], 16),
) | [
"Convert",
"hex",
"fields",
"from",
"/",
"proc",
"/",
"net",
"/",
"route",
"to",
"octects"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/linux_ip.py#L171-L180 | [
"def",
"_hex_to_octets",
"(",
"addr",
")",
":",
"return",
"'{0}:{1}:{2}:{3}'",
".",
"format",
"(",
"int",
"(",
"addr",
"[",
"6",
":",
"8",
"]",
",",
"16",
")",
",",
"int",
"(",
"addr",
"[",
"4",
":",
"6",
"]",
",",
"16",
")",
",",
"int",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _route_flags | https://github.com/torvalds/linux/blob/master/include/uapi/linux/route.h
https://github.com/torvalds/linux/blob/master/include/uapi/linux/ipv6_route.h | salt/modules/linux_ip.py | def _route_flags(rflags):
'''
https://github.com/torvalds/linux/blob/master/include/uapi/linux/route.h
https://github.com/torvalds/linux/blob/master/include/uapi/linux/ipv6_route.h
'''
flags = ''
fmap = {
0x0001: 'U', # RTF_UP, route is up
0x0002: 'G', # RTF_GATEWAY, use gatewa... | def _route_flags(rflags):
'''
https://github.com/torvalds/linux/blob/master/include/uapi/linux/route.h
https://github.com/torvalds/linux/blob/master/include/uapi/linux/ipv6_route.h
'''
flags = ''
fmap = {
0x0001: 'U', # RTF_UP, route is up
0x0002: 'G', # RTF_GATEWAY, use gatewa... | [
"https",
":",
"//",
"github",
".",
"com",
"/",
"torvalds",
"/",
"linux",
"/",
"blob",
"/",
"master",
"/",
"include",
"/",
"uapi",
"/",
"linux",
"/",
"route",
".",
"h",
"https",
":",
"//",
"github",
".",
"com",
"/",
"torvalds",
"/",
"linux",
"/",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/linux_ip.py#L183-L203 | [
"def",
"_route_flags",
"(",
"rflags",
")",
":",
"flags",
"=",
"''",
"fmap",
"=",
"{",
"0x0001",
":",
"'U'",
",",
"# RTF_UP, route is up",
"0x0002",
":",
"'G'",
",",
"# RTF_GATEWAY, use gateway",
"0x0004",
":",
"'H'",
",",
"# RTF_HOST, target is a host",
"0x0008"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_state | Returns the state of connman | salt/modules/nilrt_ip.py | def _get_state():
'''
Returns the state of connman
'''
try:
return pyconnman.ConnManager().get_property('State')
except KeyError:
return 'offline'
except dbus.DBusException as exc:
raise salt.exceptions.CommandExecutionError('Connman daemon error: {0}'.format(exc)) | def _get_state():
'''
Returns the state of connman
'''
try:
return pyconnman.ConnManager().get_property('State')
except KeyError:
return 'offline'
except dbus.DBusException as exc:
raise salt.exceptions.CommandExecutionError('Connman daemon error: {0}'.format(exc)) | [
"Returns",
"the",
"state",
"of",
"connman"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L85-L94 | [
"def",
"_get_state",
"(",
")",
":",
"try",
":",
"return",
"pyconnman",
".",
"ConnManager",
"(",
")",
".",
"get_property",
"(",
"'State'",
")",
"except",
"KeyError",
":",
"return",
"'offline'",
"except",
"dbus",
".",
"DBusException",
"as",
"exc",
":",
"rais... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_technologies | Returns the technologies of connman | salt/modules/nilrt_ip.py | def _get_technologies():
'''
Returns the technologies of connman
'''
tech = ''
technologies = pyconnman.ConnManager().get_technologies()
for path, params in technologies:
tech += '{0}\n\tName = {1}\n\tType = {2}\n\tPowered = {3}\n\tConnected = {4}\n'.format(
path, params['Nam... | def _get_technologies():
'''
Returns the technologies of connman
'''
tech = ''
technologies = pyconnman.ConnManager().get_technologies()
for path, params in technologies:
tech += '{0}\n\tName = {1}\n\tType = {2}\n\tPowered = {3}\n\tConnected = {4}\n'.format(
path, params['Nam... | [
"Returns",
"the",
"technologies",
"of",
"connman"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L97-L106 | [
"def",
"_get_technologies",
"(",
")",
":",
"tech",
"=",
"''",
"technologies",
"=",
"pyconnman",
".",
"ConnManager",
"(",
")",
".",
"get_technologies",
"(",
")",
"for",
"path",
",",
"params",
"in",
"technologies",
":",
"tech",
"+=",
"'{0}\\n\\tName = {1}\\n\\tT... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_services | Returns a list with all connman services | salt/modules/nilrt_ip.py | def _get_services():
'''
Returns a list with all connman services
'''
serv = []
services = pyconnman.ConnManager().get_services()
for path, _ in services:
serv.append(six.text_type(path[len(SERVICE_PATH):]))
return serv | def _get_services():
'''
Returns a list with all connman services
'''
serv = []
services = pyconnman.ConnManager().get_services()
for path, _ in services:
serv.append(six.text_type(path[len(SERVICE_PATH):]))
return serv | [
"Returns",
"a",
"list",
"with",
"all",
"connman",
"services"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L109-L117 | [
"def",
"_get_services",
"(",
")",
":",
"serv",
"=",
"[",
"]",
"services",
"=",
"pyconnman",
".",
"ConnManager",
"(",
")",
".",
"get_services",
"(",
")",
"for",
"path",
",",
"_",
"in",
"services",
":",
"serv",
".",
"append",
"(",
"six",
".",
"text_typ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _connected | Verify if a connman service is connected | salt/modules/nilrt_ip.py | def _connected(service):
'''
Verify if a connman service is connected
'''
state = pyconnman.ConnService(os.path.join(SERVICE_PATH, service)).get_property('State')
return state == 'online' or state == 'ready' | def _connected(service):
'''
Verify if a connman service is connected
'''
state = pyconnman.ConnService(os.path.join(SERVICE_PATH, service)).get_property('State')
return state == 'online' or state == 'ready' | [
"Verify",
"if",
"a",
"connman",
"service",
"is",
"connected"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L120-L125 | [
"def",
"_connected",
"(",
"service",
")",
":",
"state",
"=",
"pyconnman",
".",
"ConnService",
"(",
"os",
".",
"path",
".",
"join",
"(",
"SERVICE_PATH",
",",
"service",
")",
")",
".",
"get_property",
"(",
"'State'",
")",
"return",
"state",
"==",
"'online'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _space_delimited_list | validate that a value contains one or more space-delimited values | salt/modules/nilrt_ip.py | def _space_delimited_list(value):
'''
validate that a value contains one or more space-delimited values
'''
if isinstance(value, six.string_types):
items = value.split(' ')
valid = items and all(items)
else:
valid = hasattr(value, '__iter__') and (value != [])
if valid:
... | def _space_delimited_list(value):
'''
validate that a value contains one or more space-delimited values
'''
if isinstance(value, six.string_types):
items = value.split(' ')
valid = items and all(items)
else:
valid = hasattr(value, '__iter__') and (value != [])
if valid:
... | [
"validate",
"that",
"a",
"value",
"contains",
"one",
"or",
"more",
"space",
"-",
"delimited",
"values"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L128-L140 | [
"def",
"_space_delimited_list",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"six",
".",
"string_types",
")",
":",
"items",
"=",
"value",
".",
"split",
"(",
"' '",
")",
"valid",
"=",
"items",
"and",
"all",
"(",
"items",
")",
"else",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _validate_ipv4 | validate ipv4 values | salt/modules/nilrt_ip.py | def _validate_ipv4(value):
'''
validate ipv4 values
'''
if len(value) == 3:
if not salt.utils.validate.net.ipv4_addr(value[0].strip()):
return False, 'Invalid ip address: {0} for ipv4 option'.format(value[0])
if not salt.utils.validate.net.netmask(value[1].strip()):
... | def _validate_ipv4(value):
'''
validate ipv4 values
'''
if len(value) == 3:
if not salt.utils.validate.net.ipv4_addr(value[0].strip()):
return False, 'Invalid ip address: {0} for ipv4 option'.format(value[0])
if not salt.utils.validate.net.netmask(value[1].strip()):
... | [
"validate",
"ipv4",
"values"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L143-L156 | [
"def",
"_validate_ipv4",
"(",
"value",
")",
":",
"if",
"len",
"(",
"value",
")",
"==",
"3",
":",
"if",
"not",
"salt",
".",
"utils",
".",
"validate",
".",
"net",
".",
"ipv4_addr",
"(",
"value",
"[",
"0",
"]",
".",
"strip",
"(",
")",
")",
":",
"r... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _interface_to_service | returns the coresponding service to given interface if exists, otherwise return None | salt/modules/nilrt_ip.py | def _interface_to_service(iface):
'''
returns the coresponding service to given interface if exists, otherwise return None
'''
for _service in _get_services():
service_info = pyconnman.ConnService(os.path.join(SERVICE_PATH, _service))
if service_info.get_property('Ethernet')['Interface']... | def _interface_to_service(iface):
'''
returns the coresponding service to given interface if exists, otherwise return None
'''
for _service in _get_services():
service_info = pyconnman.ConnService(os.path.join(SERVICE_PATH, _service))
if service_info.get_property('Ethernet')['Interface']... | [
"returns",
"the",
"coresponding",
"service",
"to",
"given",
"interface",
"if",
"exists",
"otherwise",
"return",
"None"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L159-L167 | [
"def",
"_interface_to_service",
"(",
"iface",
")",
":",
"for",
"_service",
"in",
"_get_services",
"(",
")",
":",
"service_info",
"=",
"pyconnman",
".",
"ConnService",
"(",
"os",
".",
"path",
".",
"join",
"(",
"SERVICE_PATH",
",",
"_service",
")",
")",
"if"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_service_info | return details about given connman service | salt/modules/nilrt_ip.py | def _get_service_info(service):
'''
return details about given connman service
'''
service_info = pyconnman.ConnService(os.path.join(SERVICE_PATH, service))
data = {
'label': service,
'wireless': service_info.get_property('Type') == 'wifi',
'connectionid': six.text_type(servi... | def _get_service_info(service):
'''
return details about given connman service
'''
service_info = pyconnman.ConnService(os.path.join(SERVICE_PATH, service))
data = {
'label': service,
'wireless': service_info.get_property('Type') == 'wifi',
'connectionid': six.text_type(servi... | [
"return",
"details",
"about",
"given",
"connman",
"service"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L170-L230 | [
"def",
"_get_service_info",
"(",
"service",
")",
":",
"service_info",
"=",
"pyconnman",
".",
"ConnService",
"(",
"os",
".",
"path",
".",
"join",
"(",
"SERVICE_PATH",
",",
"service",
")",
")",
"data",
"=",
"{",
"'label'",
":",
"service",
",",
"'wireless'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_dns_info | return dns list | salt/modules/nilrt_ip.py | def _get_dns_info():
'''
return dns list
'''
dns_list = []
try:
with salt.utils.files.fopen('/etc/resolv.conf', 'r+') as dns_info:
lines = dns_info.readlines()
for line in lines:
if 'nameserver' in line:
dns = line.split()[1].strip(... | def _get_dns_info():
'''
return dns list
'''
dns_list = []
try:
with salt.utils.files.fopen('/etc/resolv.conf', 'r+') as dns_info:
lines = dns_info.readlines()
for line in lines:
if 'nameserver' in line:
dns = line.split()[1].strip(... | [
"return",
"dns",
"list"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L233-L248 | [
"def",
"_get_dns_info",
"(",
")",
":",
"dns_list",
"=",
"[",
"]",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"'/etc/resolv.conf'",
",",
"'r+'",
")",
"as",
"dns_info",
":",
"lines",
"=",
"dns_info",
".",
"readlines",
"(",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _load_config | Get values for some options and a given section from a config file.
:param section: Section Name
:param options: List of options
:param default_value: Default value if an option doesn't have a value. Default is empty string.
:param filename: config file. Default is INI_FILE.
:return: | salt/modules/nilrt_ip.py | def _load_config(section, options, default_value='', filename=INI_FILE):
'''
Get values for some options and a given section from a config file.
:param section: Section Name
:param options: List of options
:param default_value: Default value if an option doesn't have a value. Default is empty strin... | def _load_config(section, options, default_value='', filename=INI_FILE):
'''
Get values for some options and a given section from a config file.
:param section: Section Name
:param options: List of options
:param default_value: Default value if an option doesn't have a value. Default is empty strin... | [
"Get",
"values",
"for",
"some",
"options",
"and",
"a",
"given",
"section",
"from",
"a",
"config",
"file",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L261-L281 | [
"def",
"_load_config",
"(",
"section",
",",
"options",
",",
"default_value",
"=",
"''",
",",
"filename",
"=",
"INI_FILE",
")",
":",
"results",
"=",
"{",
"}",
"if",
"not",
"options",
":",
"return",
"results",
"with",
"salt",
".",
"utils",
".",
"files",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_request_mode_info | return requestmode for given interface | salt/modules/nilrt_ip.py | def _get_request_mode_info(interface):
'''
return requestmode for given interface
'''
settings = _load_config(interface, ['linklocalenabled', 'dhcpenabled'], -1)
link_local_enabled = int(settings['linklocalenabled'])
dhcp_enabled = int(settings['dhcpenabled'])
if dhcp_enabled == 1:
... | def _get_request_mode_info(interface):
'''
return requestmode for given interface
'''
settings = _load_config(interface, ['linklocalenabled', 'dhcpenabled'], -1)
link_local_enabled = int(settings['linklocalenabled'])
dhcp_enabled = int(settings['dhcpenabled'])
if dhcp_enabled == 1:
... | [
"return",
"requestmode",
"for",
"given",
"interface"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L284-L303 | [
"def",
"_get_request_mode_info",
"(",
"interface",
")",
":",
"settings",
"=",
"_load_config",
"(",
"interface",
",",
"[",
"'linklocalenabled'",
",",
"'dhcpenabled'",
"]",
",",
"-",
"1",
")",
"link_local_enabled",
"=",
"int",
"(",
"settings",
"[",
"'linklocalenab... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_possible_adapter_modes | Return possible adapter modes for a given interface using a blacklist.
:param interface: interface name
:param blacklist: given blacklist
:return: list of possible adapter modes | salt/modules/nilrt_ip.py | def _get_possible_adapter_modes(interface, blacklist):
'''
Return possible adapter modes for a given interface using a blacklist.
:param interface: interface name
:param blacklist: given blacklist
:return: list of possible adapter modes
'''
adapter_modes = []
protocols = _load_config('l... | def _get_possible_adapter_modes(interface, blacklist):
'''
Return possible adapter modes for a given interface using a blacklist.
:param interface: interface name
:param blacklist: given blacklist
:return: list of possible adapter modes
'''
adapter_modes = []
protocols = _load_config('l... | [
"Return",
"possible",
"adapter",
"modes",
"for",
"a",
"given",
"interface",
"using",
"a",
"blacklist",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L314-L345 | [
"def",
"_get_possible_adapter_modes",
"(",
"interface",
",",
"blacklist",
")",
":",
"adapter_modes",
"=",
"[",
"]",
"protocols",
"=",
"_load_config",
"(",
"'lvrt'",
",",
"[",
"'AdditionalNetworkProtocols'",
"]",
")",
"[",
"'AdditionalNetworkProtocols'",
"]",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_static_info | Return information about an interface from config file.
:param interface: interface label | salt/modules/nilrt_ip.py | def _get_static_info(interface):
'''
Return information about an interface from config file.
:param interface: interface label
'''
data = {
'connectionid': interface.name,
'label': interface.name,
'hwaddr': interface.hwaddr[:-1],
'up': False,
'ipv4': {
... | def _get_static_info(interface):
'''
Return information about an interface from config file.
:param interface: interface label
'''
data = {
'connectionid': interface.name,
'label': interface.name,
'hwaddr': interface.hwaddr[:-1],
'up': False,
'ipv4': {
... | [
"Return",
"information",
"about",
"an",
"interface",
"from",
"config",
"file",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L348-L374 | [
"def",
"_get_static_info",
"(",
"interface",
")",
":",
"data",
"=",
"{",
"'connectionid'",
":",
"interface",
".",
"name",
",",
"'label'",
":",
"interface",
".",
"name",
",",
"'hwaddr'",
":",
"interface",
".",
"hwaddr",
"[",
":",
"-",
"1",
"]",
",",
"'u... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_base_interface_info | return base details about given interface | salt/modules/nilrt_ip.py | def _get_base_interface_info(interface):
'''
return base details about given interface
'''
blacklist = {
'tcpip': {
'name': [],
'type': [],
'additional_protocol': False
},
'disabled': {
'name': ['eth0'],
'type': ['gadget... | def _get_base_interface_info(interface):
'''
return base details about given interface
'''
blacklist = {
'tcpip': {
'name': [],
'type': [],
'additional_protocol': False
},
'disabled': {
'name': ['eth0'],
'type': ['gadget... | [
"return",
"base",
"details",
"about",
"given",
"interface"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L377-L414 | [
"def",
"_get_base_interface_info",
"(",
"interface",
")",
":",
"blacklist",
"=",
"{",
"'tcpip'",
":",
"{",
"'name'",
":",
"[",
"]",
",",
"'type'",
":",
"[",
"]",
",",
"'additional_protocol'",
":",
"False",
"}",
",",
"'disabled'",
":",
"{",
"'name'",
":",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_ethercat_interface_info | return details about given ethercat interface | salt/modules/nilrt_ip.py | def _get_ethercat_interface_info(interface):
'''
return details about given ethercat interface
'''
base_information = _get_base_interface_info(interface)
base_information['ethercat'] = {
'masterid': _load_config(interface.name, ['MasterID'])['MasterID']
}
return base_information | def _get_ethercat_interface_info(interface):
'''
return details about given ethercat interface
'''
base_information = _get_base_interface_info(interface)
base_information['ethercat'] = {
'masterid': _load_config(interface.name, ['MasterID'])['MasterID']
}
return base_information | [
"return",
"details",
"about",
"given",
"ethercat",
"interface"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L417-L425 | [
"def",
"_get_ethercat_interface_info",
"(",
"interface",
")",
":",
"base_information",
"=",
"_get_base_interface_info",
"(",
"interface",
")",
"base_information",
"[",
"'ethercat'",
"]",
"=",
"{",
"'masterid'",
":",
"_load_config",
"(",
"interface",
".",
"name",
","... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_tcpip_interface_info | return details about given tcpip interface | salt/modules/nilrt_ip.py | def _get_tcpip_interface_info(interface):
'''
return details about given tcpip interface
'''
base_information = _get_base_interface_info(interface)
if base_information['ipv4']['requestmode'] == 'static':
settings = _load_config(interface.name, ['IP_Address', 'Subnet_Mask', 'Gateway', 'DNS_Ad... | def _get_tcpip_interface_info(interface):
'''
return details about given tcpip interface
'''
base_information = _get_base_interface_info(interface)
if base_information['ipv4']['requestmode'] == 'static':
settings = _load_config(interface.name, ['IP_Address', 'Subnet_Mask', 'Gateway', 'DNS_Ad... | [
"return",
"details",
"about",
"given",
"tcpip",
"interface"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L428-L452 | [
"def",
"_get_tcpip_interface_info",
"(",
"interface",
")",
":",
"base_information",
"=",
"_get_base_interface_info",
"(",
"interface",
")",
"if",
"base_information",
"[",
"'ipv4'",
"]",
"[",
"'requestmode'",
"]",
"==",
"'static'",
":",
"settings",
"=",
"_load_config... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_interface_info | return details about given interface | salt/modules/nilrt_ip.py | def _get_interface_info(interface):
'''
return details about given interface
'''
adapter_mode = _get_adapter_mode_info(interface.name)
if adapter_mode == 'disabled':
return _get_base_interface_info(interface)
elif adapter_mode == 'ethercat':
return _get_ethercat_interface_info(in... | def _get_interface_info(interface):
'''
return details about given interface
'''
adapter_mode = _get_adapter_mode_info(interface.name)
if adapter_mode == 'disabled':
return _get_base_interface_info(interface)
elif adapter_mode == 'ethercat':
return _get_ethercat_interface_info(in... | [
"return",
"details",
"about",
"given",
"interface"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L455-L464 | [
"def",
"_get_interface_info",
"(",
"interface",
")",
":",
"adapter_mode",
"=",
"_get_adapter_mode_info",
"(",
"interface",
".",
"name",
")",
"if",
"adapter_mode",
"==",
"'disabled'",
":",
"return",
"_get_base_interface_info",
"(",
"interface",
")",
"elif",
"adapter_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _dict_to_string | converts a dictionary object into a list of strings | salt/modules/nilrt_ip.py | def _dict_to_string(dictionary):
'''
converts a dictionary object into a list of strings
'''
ret = ''
for key, val in sorted(dictionary.items()):
if isinstance(val, dict):
for line in _dict_to_string(val):
ret += six.text_type(key) + '-' + line + '\n'
elif... | def _dict_to_string(dictionary):
'''
converts a dictionary object into a list of strings
'''
ret = ''
for key, val in sorted(dictionary.items()):
if isinstance(val, dict):
for line in _dict_to_string(val):
ret += six.text_type(key) + '-' + line + '\n'
elif... | [
"converts",
"a",
"dictionary",
"object",
"into",
"a",
"list",
"of",
"strings"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L467-L481 | [
"def",
"_dict_to_string",
"(",
"dictionary",
")",
":",
"ret",
"=",
"''",
"for",
"key",
",",
"val",
"in",
"sorted",
"(",
"dictionary",
".",
"items",
"(",
")",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"dict",
")",
":",
"for",
"line",
"in",
"_di... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_interfaces_details | Get details about all the interfaces on the minion
:return: information about all interfaces omitting loopback
:rtype: dictionary
CLI Example:
.. code-block:: bash
salt '*' ip.get_interfaces_details | salt/modules/nilrt_ip.py | def get_interfaces_details():
'''
Get details about all the interfaces on the minion
:return: information about all interfaces omitting loopback
:rtype: dictionary
CLI Example:
.. code-block:: bash
salt '*' ip.get_interfaces_details
'''
_interfaces = [interface for interface ... | def get_interfaces_details():
'''
Get details about all the interfaces on the minion
:return: information about all interfaces omitting loopback
:rtype: dictionary
CLI Example:
.. code-block:: bash
salt '*' ip.get_interfaces_details
'''
_interfaces = [interface for interface ... | [
"Get",
"details",
"about",
"all",
"the",
"interfaces",
"on",
"the",
"minion"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L494-L512 | [
"def",
"get_interfaces_details",
"(",
")",
":",
"_interfaces",
"=",
"[",
"interface",
"for",
"interface",
"in",
"pyiface",
".",
"getIfaces",
"(",
")",
"if",
"interface",
".",
"flags",
"&",
"IFF_LOOPBACK",
"==",
"0",
"]",
"if",
"__grains__",
"[",
"'lsb_distri... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _change_state_legacy | Enable or disable an interface on a legacy distro
Change adapter mode to TCP/IP. If previous adapter mode was EtherCAT, the target will need reboot.
:param interface: interface label
:param new_state: up or down
:return: True if the service was enabled, otherwise an exception will be thrown.
:rtyp... | salt/modules/nilrt_ip.py | def _change_state_legacy(interface, new_state):
'''
Enable or disable an interface on a legacy distro
Change adapter mode to TCP/IP. If previous adapter mode was EtherCAT, the target will need reboot.
:param interface: interface label
:param new_state: up or down
:return: True if the service w... | def _change_state_legacy(interface, new_state):
'''
Enable or disable an interface on a legacy distro
Change adapter mode to TCP/IP. If previous adapter mode was EtherCAT, the target will need reboot.
:param interface: interface label
:param new_state: up or down
:return: True if the service w... | [
"Enable",
"or",
"disable",
"an",
"interface",
"on",
"a",
"legacy",
"distro"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L515-L536 | [
"def",
"_change_state_legacy",
"(",
"interface",
",",
"new_state",
")",
":",
"initial_mode",
"=",
"_get_adapter_mode_info",
"(",
"interface",
")",
"_save_config",
"(",
"interface",
",",
"'Mode'",
",",
"'TCPIP'",
"if",
"new_state",
"==",
"'up'",
"else",
"'Disabled'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _change_state | Enable or disable an interface
Change adapter mode to TCP/IP. If previous adapter mode was EtherCAT, the target will need reboot.
:param interface: interface label
:param new_state: up or down
:return: True if the service was enabled, otherwise an exception will be thrown.
:rtype: bool | salt/modules/nilrt_ip.py | def _change_state(interface, new_state):
'''
Enable or disable an interface
Change adapter mode to TCP/IP. If previous adapter mode was EtherCAT, the target will need reboot.
:param interface: interface label
:param new_state: up or down
:return: True if the service was enabled, otherwise an e... | def _change_state(interface, new_state):
'''
Enable or disable an interface
Change adapter mode to TCP/IP. If previous adapter mode was EtherCAT, the target will need reboot.
:param interface: interface label
:param new_state: up or down
:return: True if the service was enabled, otherwise an e... | [
"Enable",
"or",
"disable",
"an",
"interface"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L539-L564 | [
"def",
"_change_state",
"(",
"interface",
",",
"new_state",
")",
":",
"if",
"__grains__",
"[",
"'lsb_distrib_id'",
"]",
"==",
"'nilrt'",
":",
"return",
"_change_state_legacy",
"(",
"interface",
",",
"new_state",
")",
"service",
"=",
"_interface_to_service",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _save_config | Helper function to persist a configuration in the ini file | salt/modules/nilrt_ip.py | def _save_config(section, token, value):
'''
Helper function to persist a configuration in the ini file
'''
cmd = NIRTCFG_PATH
cmd += ' --set section={0},token=\'{1}\',value=\'{2}\''.format(section, token, value)
if __salt__['cmd.run_all'](cmd)['retcode'] != 0:
exc_msg = 'Error: could no... | def _save_config(section, token, value):
'''
Helper function to persist a configuration in the ini file
'''
cmd = NIRTCFG_PATH
cmd += ' --set section={0},token=\'{1}\',value=\'{2}\''.format(section, token, value)
if __salt__['cmd.run_all'](cmd)['retcode'] != 0:
exc_msg = 'Error: could no... | [
"Helper",
"function",
"to",
"persist",
"a",
"configuration",
"in",
"the",
"ini",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L643-L651 | [
"def",
"_save_config",
"(",
"section",
",",
"token",
",",
"value",
")",
":",
"cmd",
"=",
"NIRTCFG_PATH",
"cmd",
"+=",
"' --set section={0},token=\\'{1}\\',value=\\'{2}\\''",
".",
"format",
"(",
"section",
",",
"token",
",",
"value",
")",
"if",
"__salt__",
"[",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_ethercat | Configure specified adapter to use EtherCAT adapter mode. If successful, the target will need reboot if it doesn't
already use EtherCAT adapter mode, otherwise will return true.
:param interface: interface label
:param master_id: EtherCAT Master ID
:return: True if the settings were applied, otherwise ... | salt/modules/nilrt_ip.py | def set_ethercat(interface, master_id):
'''
Configure specified adapter to use EtherCAT adapter mode. If successful, the target will need reboot if it doesn't
already use EtherCAT adapter mode, otherwise will return true.
:param interface: interface label
:param master_id: EtherCAT Master ID
:r... | def set_ethercat(interface, master_id):
'''
Configure specified adapter to use EtherCAT adapter mode. If successful, the target will need reboot if it doesn't
already use EtherCAT adapter mode, otherwise will return true.
:param interface: interface label
:param master_id: EtherCAT Master ID
:r... | [
"Configure",
"specified",
"adapter",
"to",
"use",
"EtherCAT",
"adapter",
"mode",
".",
"If",
"successful",
"the",
"target",
"will",
"need",
"reboot",
"if",
"it",
"doesn",
"t",
"already",
"use",
"EtherCAT",
"adapter",
"mode",
"otherwise",
"will",
"return",
"true... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L654-L676 | [
"def",
"set_ethercat",
"(",
"interface",
",",
"master_id",
")",
":",
"if",
"__grains__",
"[",
"'lsb_distrib_id'",
"]",
"==",
"'nilrt'",
":",
"initial_mode",
"=",
"_get_adapter_mode_info",
"(",
"interface",
")",
"_save_config",
"(",
"interface",
",",
"'Mode'",
",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_dhcp_linklocal_all | Configure specified adapter to use DHCP with linklocal fallback
Change adapter mode to TCP/IP. If previous adapter mode was EtherCAT, the target will need reboot.
:param str interface: interface label
:return: True if the settings were applied, otherwise an exception will be thrown.
:rtype: bool
... | salt/modules/nilrt_ip.py | def set_dhcp_linklocal_all(interface):
'''
Configure specified adapter to use DHCP with linklocal fallback
Change adapter mode to TCP/IP. If previous adapter mode was EtherCAT, the target will need reboot.
:param str interface: interface label
:return: True if the settings were applied, otherwise ... | def set_dhcp_linklocal_all(interface):
'''
Configure specified adapter to use DHCP with linklocal fallback
Change adapter mode to TCP/IP. If previous adapter mode was EtherCAT, the target will need reboot.
:param str interface: interface label
:return: True if the settings were applied, otherwise ... | [
"Configure",
"specified",
"adapter",
"to",
"use",
"DHCP",
"with",
"linklocal",
"fallback"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L687-L728 | [
"def",
"set_dhcp_linklocal_all",
"(",
"interface",
")",
":",
"if",
"__grains__",
"[",
"'lsb_distrib_id'",
"]",
"==",
"'nilrt'",
":",
"initial_mode",
"=",
"_get_adapter_mode_info",
"(",
"interface",
")",
"_save_config",
"(",
"interface",
",",
"'Mode'",
",",
"'TCPIP... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_dhcp_only_all | Configure specified adapter to use DHCP only
Change adapter mode to TCP/IP. If previous adapter mode was EtherCAT, the target will need reboot.
:param str interface: interface label
:return: True if the settings were applied, otherwise an exception will be thrown.
:rtype: bool
CLI Example:
.... | salt/modules/nilrt_ip.py | def set_dhcp_only_all(interface):
'''
Configure specified adapter to use DHCP only
Change adapter mode to TCP/IP. If previous adapter mode was EtherCAT, the target will need reboot.
:param str interface: interface label
:return: True if the settings were applied, otherwise an exception will be thr... | def set_dhcp_only_all(interface):
'''
Configure specified adapter to use DHCP only
Change adapter mode to TCP/IP. If previous adapter mode was EtherCAT, the target will need reboot.
:param str interface: interface label
:return: True if the settings were applied, otherwise an exception will be thr... | [
"Configure",
"specified",
"adapter",
"to",
"use",
"DHCP",
"only"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L731-L757 | [
"def",
"set_dhcp_only_all",
"(",
"interface",
")",
":",
"if",
"not",
"__grains__",
"[",
"'lsb_distrib_id'",
"]",
"==",
"'nilrt'",
":",
"raise",
"salt",
".",
"exceptions",
".",
"CommandExecutionError",
"(",
"'Not supported in this version'",
")",
"initial_mode",
"=",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _configure_static_interface | Configure an interface that is not detected as a service by Connman (i.e. link is down)
:param interface: interface label
:param settings:
- ip
- netmask
- gateway
- dns
- name
:return: True if settings were applied successfully.
:rtype: bool | salt/modules/nilrt_ip.py | def _configure_static_interface(interface, **settings):
'''
Configure an interface that is not detected as a service by Connman (i.e. link is down)
:param interface: interface label
:param settings:
- ip
- netmask
- gateway
- dns
- name
:r... | def _configure_static_interface(interface, **settings):
'''
Configure an interface that is not detected as a service by Connman (i.e. link is down)
:param interface: interface label
:param settings:
- ip
- netmask
- gateway
- dns
- name
:r... | [
"Configure",
"an",
"interface",
"that",
"is",
"not",
"detected",
"as",
"a",
"service",
"by",
"Connman",
"(",
"i",
".",
"e",
".",
"link",
"is",
"down",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L789-L828 | [
"def",
"_configure_static_interface",
"(",
"interface",
",",
"*",
"*",
"settings",
")",
":",
"interface",
"=",
"pyiface",
".",
"Interface",
"(",
"name",
"=",
"interface",
")",
"parser",
"=",
"configparser",
".",
"ConfigParser",
"(",
")",
"if",
"os",
".",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_static_all | Configure specified adapter to use ipv4 manual settings
Change adapter mode to TCP/IP. If previous adapter mode was EtherCAT, the target will need reboot.
:param str interface: interface label
:param str address: ipv4 address
:param str netmask: ipv4 netmask
:param str gateway: ipv4 gateway
:p... | salt/modules/nilrt_ip.py | def set_static_all(interface, address, netmask, gateway, nameservers=None):
'''
Configure specified adapter to use ipv4 manual settings
Change adapter mode to TCP/IP. If previous adapter mode was EtherCAT, the target will need reboot.
:param str interface: interface label
:param str address: ipv4 ... | def set_static_all(interface, address, netmask, gateway, nameservers=None):
'''
Configure specified adapter to use ipv4 manual settings
Change adapter mode to TCP/IP. If previous adapter mode was EtherCAT, the target will need reboot.
:param str interface: interface label
:param str address: ipv4 ... | [
"Configure",
"specified",
"adapter",
"to",
"use",
"ipv4",
"manual",
"settings"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L831-L895 | [
"def",
"set_static_all",
"(",
"interface",
",",
"address",
",",
"netmask",
",",
"gateway",
",",
"nameservers",
"=",
"None",
")",
":",
"validate",
",",
"msg",
"=",
"_validate_ipv4",
"(",
"[",
"address",
",",
"netmask",
",",
"gateway",
"]",
")",
"if",
"not... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_interface | Returns details about given interface.
CLI Example:
.. code-block:: bash
salt '*' ip.get_interface eth0 | salt/modules/nilrt_ip.py | def get_interface(iface):
'''
Returns details about given interface.
CLI Example:
.. code-block:: bash
salt '*' ip.get_interface eth0
'''
_interfaces = get_interfaces_details()
for _interface in _interfaces['interfaces']:
if _interface['connectionid'] == iface:
... | def get_interface(iface):
'''
Returns details about given interface.
CLI Example:
.. code-block:: bash
salt '*' ip.get_interface eth0
'''
_interfaces = get_interfaces_details()
for _interface in _interfaces['interfaces']:
if _interface['connectionid'] == iface:
... | [
"Returns",
"details",
"about",
"given",
"interface",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L898-L912 | [
"def",
"get_interface",
"(",
"iface",
")",
":",
"_interfaces",
"=",
"get_interfaces_details",
"(",
")",
"for",
"_interface",
"in",
"_interfaces",
"[",
"'interfaces'",
"]",
":",
"if",
"_interface",
"[",
"'connectionid'",
"]",
"==",
"iface",
":",
"return",
"_dic... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | build_interface | Build an interface script for a network interface.
CLI Example:
.. code-block:: bash
salt '*' ip.build_interface eth0 eth <settings> | salt/modules/nilrt_ip.py | def build_interface(iface, iface_type, enabled, **settings):
'''
Build an interface script for a network interface.
CLI Example:
.. code-block:: bash
salt '*' ip.build_interface eth0 eth <settings>
'''
if __grains__['lsb_distrib_id'] == 'nilrt':
raise salt.exceptions.CommandEx... | def build_interface(iface, iface_type, enabled, **settings):
'''
Build an interface script for a network interface.
CLI Example:
.. code-block:: bash
salt '*' ip.build_interface eth0 eth <settings>
'''
if __grains__['lsb_distrib_id'] == 'nilrt':
raise salt.exceptions.CommandEx... | [
"Build",
"an",
"interface",
"script",
"for",
"a",
"network",
"interface",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L915-L948 | [
"def",
"build_interface",
"(",
"iface",
",",
"iface_type",
",",
"enabled",
",",
"*",
"*",
"settings",
")",
":",
"if",
"__grains__",
"[",
"'lsb_distrib_id'",
"]",
"==",
"'nilrt'",
":",
"raise",
"salt",
".",
"exceptions",
".",
"CommandExecutionError",
"(",
"'N... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | build_network_settings | Build the global network script.
CLI Example:
.. code-block:: bash
salt '*' ip.build_network_settings <settings> | salt/modules/nilrt_ip.py | def build_network_settings(**settings):
'''
Build the global network script.
CLI Example:
.. code-block:: bash
salt '*' ip.build_network_settings <settings>
'''
if __grains__['lsb_distrib_id'] == 'nilrt':
raise salt.exceptions.CommandExecutionError('Not supported in this versi... | def build_network_settings(**settings):
'''
Build the global network script.
CLI Example:
.. code-block:: bash
salt '*' ip.build_network_settings <settings>
'''
if __grains__['lsb_distrib_id'] == 'nilrt':
raise salt.exceptions.CommandExecutionError('Not supported in this versi... | [
"Build",
"the",
"global",
"network",
"script",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L951-L978 | [
"def",
"build_network_settings",
"(",
"*",
"*",
"settings",
")",
":",
"if",
"__grains__",
"[",
"'lsb_distrib_id'",
"]",
"==",
"'nilrt'",
":",
"raise",
"salt",
".",
"exceptions",
".",
"CommandExecutionError",
"(",
"'Not supported in this version.'",
")",
"changes",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_network_settings | Return the contents of the global network script.
CLI Example:
.. code-block:: bash
salt '*' ip.get_network_settings | salt/modules/nilrt_ip.py | def get_network_settings():
'''
Return the contents of the global network script.
CLI Example:
.. code-block:: bash
salt '*' ip.get_network_settings
'''
if __grains__['lsb_distrib_id'] == 'nilrt':
raise salt.exceptions.CommandExecutionError('Not supported in this version.')
... | def get_network_settings():
'''
Return the contents of the global network script.
CLI Example:
.. code-block:: bash
salt '*' ip.get_network_settings
'''
if __grains__['lsb_distrib_id'] == 'nilrt':
raise salt.exceptions.CommandExecutionError('Not supported in this version.')
... | [
"Return",
"the",
"contents",
"of",
"the",
"global",
"network",
"script",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L981-L998 | [
"def",
"get_network_settings",
"(",
")",
":",
"if",
"__grains__",
"[",
"'lsb_distrib_id'",
"]",
"==",
"'nilrt'",
":",
"raise",
"salt",
".",
"exceptions",
".",
"CommandExecutionError",
"(",
"'Not supported in this version.'",
")",
"settings",
"=",
"[",
"]",
"networ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | apply_network_settings | Apply global network configuration.
CLI Example:
.. code-block:: bash
salt '*' ip.apply_network_settings | salt/modules/nilrt_ip.py | def apply_network_settings(**settings):
'''
Apply global network configuration.
CLI Example:
.. code-block:: bash
salt '*' ip.apply_network_settings
'''
if __grains__['lsb_distrib_id'] == 'nilrt':
raise salt.exceptions.CommandExecutionError('Not supported in this version.')
... | def apply_network_settings(**settings):
'''
Apply global network configuration.
CLI Example:
.. code-block:: bash
salt '*' ip.apply_network_settings
'''
if __grains__['lsb_distrib_id'] == 'nilrt':
raise salt.exceptions.CommandExecutionError('Not supported in this version.')
... | [
"Apply",
"global",
"network",
"configuration",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L1001-L1042 | [
"def",
"apply_network_settings",
"(",
"*",
"*",
"settings",
")",
":",
"if",
"__grains__",
"[",
"'lsb_distrib_id'",
"]",
"==",
"'nilrt'",
":",
"raise",
"salt",
".",
"exceptions",
".",
"CommandExecutionError",
"(",
"'Not supported in this version.'",
")",
"if",
"'re... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_event | Return an event object suitable for the named transport
:param IOLoop io_loop: Pass in an io_loop if you want asynchronous
operation for obtaining events. Eg use of
set_event_handler() API. Otherwise, operation
will be synchronous. | salt/utils/event.py | def get_event(
node, sock_dir=None, transport='zeromq',
opts=None, listen=True, io_loop=None, keep_loop=False, raise_errors=False):
'''
Return an event object suitable for the named transport
:param IOLoop io_loop: Pass in an io_loop if you want asynchronous
opera... | def get_event(
node, sock_dir=None, transport='zeromq',
opts=None, listen=True, io_loop=None, keep_loop=False, raise_errors=False):
'''
Return an event object suitable for the named transport
:param IOLoop io_loop: Pass in an io_loop if you want asynchronous
opera... | [
"Return",
"an",
"event",
"object",
"suitable",
"for",
"the",
"named",
"transport"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L119-L145 | [
"def",
"get_event",
"(",
"node",
",",
"sock_dir",
"=",
"None",
",",
"transport",
"=",
"'zeromq'",
",",
"opts",
"=",
"None",
",",
"listen",
"=",
"True",
",",
"io_loop",
"=",
"None",
",",
"keep_loop",
"=",
"False",
",",
"raise_errors",
"=",
"False",
")",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_master_event | Return an event object suitable for the named transport | salt/utils/event.py | def get_master_event(opts, sock_dir, listen=True, io_loop=None, raise_errors=False, keep_loop=False):
'''
Return an event object suitable for the named transport
'''
# TODO: AIO core is separate from transport
if opts['transport'] in ('zeromq', 'tcp', 'detect'):
return MasterEvent(sock_dir, ... | def get_master_event(opts, sock_dir, listen=True, io_loop=None, raise_errors=False, keep_loop=False):
'''
Return an event object suitable for the named transport
'''
# TODO: AIO core is separate from transport
if opts['transport'] in ('zeromq', 'tcp', 'detect'):
return MasterEvent(sock_dir, ... | [
"Return",
"an",
"event",
"object",
"suitable",
"for",
"the",
"named",
"transport"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L148-L154 | [
"def",
"get_master_event",
"(",
"opts",
",",
"sock_dir",
",",
"listen",
"=",
"True",
",",
"io_loop",
"=",
"None",
",",
"raise_errors",
"=",
"False",
",",
"keep_loop",
"=",
"False",
")",
":",
"# TODO: AIO core is separate from transport",
"if",
"opts",
"[",
"'t... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | fire_args | Fire an event containing the arguments passed to an orchestration job | salt/utils/event.py | def fire_args(opts, jid, tag_data, prefix=''):
'''
Fire an event containing the arguments passed to an orchestration job
'''
try:
tag_suffix = [jid, 'args']
except NameError:
pass
else:
tag = tagify(tag_suffix, prefix)
try:
_event = get_master_event(op... | def fire_args(opts, jid, tag_data, prefix=''):
'''
Fire an event containing the arguments passed to an orchestration job
'''
try:
tag_suffix = [jid, 'args']
except NameError:
pass
else:
tag = tagify(tag_suffix, prefix)
try:
_event = get_master_event(op... | [
"Fire",
"an",
"event",
"containing",
"the",
"arguments",
"passed",
"to",
"an",
"orchestration",
"job"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L157-L175 | [
"def",
"fire_args",
"(",
"opts",
",",
"jid",
",",
"tag_data",
",",
"prefix",
"=",
"''",
")",
":",
"try",
":",
"tag_suffix",
"=",
"[",
"jid",
",",
"'args'",
"]",
"except",
"NameError",
":",
"pass",
"else",
":",
"tag",
"=",
"tagify",
"(",
"tag_suffix",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | tagify | convenience function to build a namespaced event tag string
from joining with the TABPART character the base, prefix and suffix
If string prefix is a valid key in TAGS Then use the value of key prefix
Else use prefix string
If suffix is a list Then join all string elements of suffix individually
E... | salt/utils/event.py | def tagify(suffix='', prefix='', base=SALT):
'''
convenience function to build a namespaced event tag string
from joining with the TABPART character the base, prefix and suffix
If string prefix is a valid key in TAGS Then use the value of key prefix
Else use prefix string
If suffix is a list T... | def tagify(suffix='', prefix='', base=SALT):
'''
convenience function to build a namespaced event tag string
from joining with the TABPART character the base, prefix and suffix
If string prefix is a valid key in TAGS Then use the value of key prefix
Else use prefix string
If suffix is a list T... | [
"convenience",
"function",
"to",
"build",
"a",
"namespaced",
"event",
"tag",
"string",
"from",
"joining",
"with",
"the",
"TABPART",
"character",
"the",
"base",
"prefix",
"and",
"suffix"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L178-L201 | [
"def",
"tagify",
"(",
"suffix",
"=",
"''",
",",
"prefix",
"=",
"''",
",",
"base",
"=",
"SALT",
")",
":",
"parts",
"=",
"[",
"base",
",",
"TAGS",
".",
"get",
"(",
"prefix",
",",
"prefix",
")",
"]",
"if",
"hasattr",
"(",
"suffix",
",",
"'append'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update_stats | Calculate the master stats and return the updated stat info | salt/utils/event.py | def update_stats(stats, start_time, data):
'''
Calculate the master stats and return the updated stat info
'''
end_time = time.time()
cmd = data['cmd']
# the jid is used as the create time
try:
jid = data['jid']
except KeyError:
try:
jid = data['data']['__pub_... | def update_stats(stats, start_time, data):
'''
Calculate the master stats and return the updated stat info
'''
end_time = time.time()
cmd = data['cmd']
# the jid is used as the create time
try:
jid = data['jid']
except KeyError:
try:
jid = data['data']['__pub_... | [
"Calculate",
"the",
"master",
"stats",
"and",
"return",
"the",
"updated",
"stat",
"info"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L204-L227 | [
"def",
"update_stats",
"(",
"stats",
",",
"start_time",
",",
"data",
")",
":",
"end_time",
"=",
"time",
".",
"time",
"(",
")",
"cmd",
"=",
"data",
"[",
"'cmd'",
"]",
"# the jid is used as the create time",
"try",
":",
"jid",
"=",
"data",
"[",
"'jid'",
"]... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltEvent.__load_uri | Return the string URI for the location of the pull and pub sockets to
use for firing and listening to events | salt/utils/event.py | def __load_uri(self, sock_dir, node):
'''
Return the string URI for the location of the pull and pub sockets to
use for firing and listening to events
'''
if node == 'master':
if self.opts['ipc_mode'] == 'tcp':
puburi = int(self.opts['tcp_master_pub_po... | def __load_uri(self, sock_dir, node):
'''
Return the string URI for the location of the pull and pub sockets to
use for firing and listening to events
'''
if node == 'master':
if self.opts['ipc_mode'] == 'tcp':
puburi = int(self.opts['tcp_master_pub_po... | [
"Return",
"the",
"string",
"URI",
"for",
"the",
"location",
"of",
"the",
"pull",
"and",
"pub",
"sockets",
"to",
"use",
"for",
"firing",
"and",
"listening",
"to",
"events"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L302-L339 | [
"def",
"__load_uri",
"(",
"self",
",",
"sock_dir",
",",
"node",
")",
":",
"if",
"node",
"==",
"'master'",
":",
"if",
"self",
".",
"opts",
"[",
"'ipc_mode'",
"]",
"==",
"'tcp'",
":",
"puburi",
"=",
"int",
"(",
"self",
".",
"opts",
"[",
"'tcp_master_pu... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltEvent.subscribe | Subscribe to events matching the passed tag.
If you do not subscribe to a tag, events will be discarded by calls to
get_event that request a different tag. In contexts where many different
jobs are outstanding it is important to subscribe to prevent one call
to get_event from discarding... | salt/utils/event.py | def subscribe(self, tag=None, match_type=None):
'''
Subscribe to events matching the passed tag.
If you do not subscribe to a tag, events will be discarded by calls to
get_event that request a different tag. In contexts where many different
jobs are outstanding it is important t... | def subscribe(self, tag=None, match_type=None):
'''
Subscribe to events matching the passed tag.
If you do not subscribe to a tag, events will be discarded by calls to
get_event that request a different tag. In contexts where many different
jobs are outstanding it is important t... | [
"Subscribe",
"to",
"events",
"matching",
"the",
"passed",
"tag",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L341-L354 | [
"def",
"subscribe",
"(",
"self",
",",
"tag",
"=",
"None",
",",
"match_type",
"=",
"None",
")",
":",
"if",
"tag",
"is",
"None",
":",
"return",
"match_func",
"=",
"self",
".",
"_get_match_func",
"(",
"match_type",
")",
"self",
".",
"pending_tags",
".",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltEvent.unsubscribe | Un-subscribe to events matching the passed tag. | salt/utils/event.py | def unsubscribe(self, tag, match_type=None):
'''
Un-subscribe to events matching the passed tag.
'''
if tag is None:
return
match_func = self._get_match_func(match_type)
self.pending_tags.remove([tag, match_func])
old_events = self.pending_events
... | def unsubscribe(self, tag, match_type=None):
'''
Un-subscribe to events matching the passed tag.
'''
if tag is None:
return
match_func = self._get_match_func(match_type)
self.pending_tags.remove([tag, match_func])
old_events = self.pending_events
... | [
"Un",
"-",
"subscribe",
"to",
"events",
"matching",
"the",
"passed",
"tag",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L356-L370 | [
"def",
"unsubscribe",
"(",
"self",
",",
"tag",
",",
"match_type",
"=",
"None",
")",
":",
"if",
"tag",
"is",
"None",
":",
"return",
"match_func",
"=",
"self",
".",
"_get_match_func",
"(",
"match_type",
")",
"self",
".",
"pending_tags",
".",
"remove",
"(",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltEvent.connect_pub | Establish the publish connection | salt/utils/event.py | def connect_pub(self, timeout=None):
'''
Establish the publish connection
'''
if self.cpub:
return True
if self._run_io_loop_sync:
with salt.utils.asynchronous.current_ioloop(self.io_loop):
if self.subscriber is None:
s... | def connect_pub(self, timeout=None):
'''
Establish the publish connection
'''
if self.cpub:
return True
if self._run_io_loop_sync:
with salt.utils.asynchronous.current_ioloop(self.io_loop):
if self.subscriber is None:
s... | [
"Establish",
"the",
"publish",
"connection"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L372-L402 | [
"def",
"connect_pub",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"if",
"self",
".",
"cpub",
":",
"return",
"True",
"if",
"self",
".",
"_run_io_loop_sync",
":",
"with",
"salt",
".",
"utils",
".",
"asynchronous",
".",
"current_ioloop",
"(",
"self"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltEvent.close_pub | Close the publish connection (if established) | salt/utils/event.py | def close_pub(self):
'''
Close the publish connection (if established)
'''
if not self.cpub:
return
self.subscriber.close()
self.subscriber = None
self.pending_events = []
self.cpub = False | def close_pub(self):
'''
Close the publish connection (if established)
'''
if not self.cpub:
return
self.subscriber.close()
self.subscriber = None
self.pending_events = []
self.cpub = False | [
"Close",
"the",
"publish",
"connection",
"(",
"if",
"established",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L404-L414 | [
"def",
"close_pub",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"cpub",
":",
"return",
"self",
".",
"subscriber",
".",
"close",
"(",
")",
"self",
".",
"subscriber",
"=",
"None",
"self",
".",
"pending_events",
"=",
"[",
"]",
"self",
".",
"cpub",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltEvent.connect_pull | Establish a connection with the event pull socket
Default timeout is 1 s | salt/utils/event.py | def connect_pull(self, timeout=1):
'''
Establish a connection with the event pull socket
Default timeout is 1 s
'''
if self.cpush:
return True
if self._run_io_loop_sync:
with salt.utils.asynchronous.current_ioloop(self.io_loop):
if... | def connect_pull(self, timeout=1):
'''
Establish a connection with the event pull socket
Default timeout is 1 s
'''
if self.cpush:
return True
if self._run_io_loop_sync:
with salt.utils.asynchronous.current_ioloop(self.io_loop):
if... | [
"Establish",
"a",
"connection",
"with",
"the",
"event",
"pull",
"socket",
"Default",
"timeout",
"is",
"1",
"s"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L416-L446 | [
"def",
"connect_pull",
"(",
"self",
",",
"timeout",
"=",
"1",
")",
":",
"if",
"self",
".",
"cpush",
":",
"return",
"True",
"if",
"self",
".",
"_run_io_loop_sync",
":",
"with",
"salt",
".",
"utils",
".",
"asynchronous",
".",
"current_ioloop",
"(",
"self",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltEvent._check_pending | Check the pending_events list for events that match the tag
:param tag: The tag to search for
:type tag: str
:param tags_regex: List of re expressions to search for also
:type tags_regex: list[re.compile()]
:return: | salt/utils/event.py | def _check_pending(self, tag, match_func=None):
"""Check the pending_events list for events that match the tag
:param tag: The tag to search for
:type tag: str
:param tags_regex: List of re expressions to search for also
:type tags_regex: list[re.compile()]
:return:
... | def _check_pending(self, tag, match_func=None):
"""Check the pending_events list for events that match the tag
:param tag: The tag to search for
:type tag: str
:param tags_regex: List of re expressions to search for also
:type tags_regex: list[re.compile()]
:return:
... | [
"Check",
"the",
"pending_events",
"list",
"for",
"events",
"that",
"match",
"the",
"tag"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L467-L492 | [
"def",
"_check_pending",
"(",
"self",
",",
"tag",
",",
"match_func",
"=",
"None",
")",
":",
"if",
"match_func",
"is",
"None",
":",
"match_func",
"=",
"self",
".",
"_get_match_func",
"(",
")",
"old_events",
"=",
"self",
".",
"pending_events",
"self",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltEvent._match_tag_regex | Check if the event_tag matches the search check.
Uses regular expression search to check.
Return True (matches) or False (no match) | salt/utils/event.py | def _match_tag_regex(self, event_tag, search_tag):
'''
Check if the event_tag matches the search check.
Uses regular expression search to check.
Return True (matches) or False (no match)
'''
return self.cache_regex.get(search_tag).search(event_tag) is not None | def _match_tag_regex(self, event_tag, search_tag):
'''
Check if the event_tag matches the search check.
Uses regular expression search to check.
Return True (matches) or False (no match)
'''
return self.cache_regex.get(search_tag).search(event_tag) is not None | [
"Check",
"if",
"the",
"event_tag",
"matches",
"the",
"search",
"check",
".",
"Uses",
"regular",
"expression",
"search",
"to",
"check",
".",
"Return",
"True",
"(",
"matches",
")",
"or",
"False",
"(",
"no",
"match",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L521-L527 | [
"def",
"_match_tag_regex",
"(",
"self",
",",
"event_tag",
",",
"search_tag",
")",
":",
"return",
"self",
".",
"cache_regex",
".",
"get",
"(",
"search_tag",
")",
".",
"search",
"(",
"event_tag",
")",
"is",
"not",
"None"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltEvent.get_event | Get a single publication.
If no publication is available, then block for up to ``wait`` seconds.
Return publication if it is available or ``None`` if no publication is
available.
If wait is 0, then block forever.
tag
Only return events matching the given tag. If not... | salt/utils/event.py | def get_event(self,
wait=5,
tag='',
full=False,
match_type=None,
no_block=False,
auto_reconnect=False):
'''
Get a single publication.
If no publication is available, then block for up to `... | def get_event(self,
wait=5,
tag='',
full=False,
match_type=None,
no_block=False,
auto_reconnect=False):
'''
Get a single publication.
If no publication is available, then block for up to `... | [
"Get",
"a",
"single",
"publication",
".",
"If",
"no",
"publication",
"is",
"available",
"then",
"block",
"for",
"up",
"to",
"wait",
"seconds",
".",
"Return",
"publication",
"if",
"it",
"is",
"available",
"or",
"None",
"if",
"no",
"publication",
"is",
"avai... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L590-L667 | [
"def",
"get_event",
"(",
"self",
",",
"wait",
"=",
"5",
",",
"tag",
"=",
"''",
",",
"full",
"=",
"False",
",",
"match_type",
"=",
"None",
",",
"no_block",
"=",
"False",
",",
"auto_reconnect",
"=",
"False",
")",
":",
"assert",
"self",
".",
"_run_io_lo... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltEvent.get_event_noblock | Get the raw event without blocking or any other niceties | salt/utils/event.py | def get_event_noblock(self):
'''
Get the raw event without blocking or any other niceties
'''
assert self._run_io_loop_sync
if not self.cpub:
if not self.connect_pub():
return None
raw = self.subscriber.read_sync(timeout=0)
if raw is N... | def get_event_noblock(self):
'''
Get the raw event without blocking or any other niceties
'''
assert self._run_io_loop_sync
if not self.cpub:
if not self.connect_pub():
return None
raw = self.subscriber.read_sync(timeout=0)
if raw is N... | [
"Get",
"the",
"raw",
"event",
"without",
"blocking",
"or",
"any",
"other",
"niceties"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L669-L682 | [
"def",
"get_event_noblock",
"(",
"self",
")",
":",
"assert",
"self",
".",
"_run_io_loop_sync",
"if",
"not",
"self",
".",
"cpub",
":",
"if",
"not",
"self",
".",
"connect_pub",
"(",
")",
":",
"return",
"None",
"raw",
"=",
"self",
".",
"subscriber",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltEvent.iter_events | Creates a generator that continuously listens for events | salt/utils/event.py | def iter_events(self, tag='', full=False, match_type=None, auto_reconnect=False):
'''
Creates a generator that continuously listens for events
'''
while True:
data = self.get_event(tag=tag, full=full, match_type=match_type,
auto_reconnect=aut... | def iter_events(self, tag='', full=False, match_type=None, auto_reconnect=False):
'''
Creates a generator that continuously listens for events
'''
while True:
data = self.get_event(tag=tag, full=full, match_type=match_type,
auto_reconnect=aut... | [
"Creates",
"a",
"generator",
"that",
"continuously",
"listens",
"for",
"events"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L700-L709 | [
"def",
"iter_events",
"(",
"self",
",",
"tag",
"=",
"''",
",",
"full",
"=",
"False",
",",
"match_type",
"=",
"None",
",",
"auto_reconnect",
"=",
"False",
")",
":",
"while",
"True",
":",
"data",
"=",
"self",
".",
"get_event",
"(",
"tag",
"=",
"tag",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltEvent.fire_event | Send a single event into the publisher with payload dict "data" and
event identifier "tag"
The default is 1000 ms | salt/utils/event.py | def fire_event(self, data, tag, timeout=1000):
'''
Send a single event into the publisher with payload dict "data" and
event identifier "tag"
The default is 1000 ms
'''
if not six.text_type(tag): # no empty tags allowed
raise ValueError('Empty tag.')
... | def fire_event(self, data, tag, timeout=1000):
'''
Send a single event into the publisher with payload dict "data" and
event identifier "tag"
The default is 1000 ms
'''
if not six.text_type(tag): # no empty tags allowed
raise ValueError('Empty tag.')
... | [
"Send",
"a",
"single",
"event",
"into",
"the",
"publisher",
"with",
"payload",
"dict",
"data",
"and",
"event",
"identifier",
"tag"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L711-L767 | [
"def",
"fire_event",
"(",
"self",
",",
"data",
",",
"tag",
",",
"timeout",
"=",
"1000",
")",
":",
"if",
"not",
"six",
".",
"text_type",
"(",
"tag",
")",
":",
"# no empty tags allowed",
"raise",
"ValueError",
"(",
"'Empty tag.'",
")",
"if",
"not",
"isinst... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltEvent.fire_master | Send a single event to the master, with the payload "data" and the
event identifier "tag".
Default timeout is 1000ms | salt/utils/event.py | def fire_master(self, data, tag, timeout=1000):
''''
Send a single event to the master, with the payload "data" and the
event identifier "tag".
Default timeout is 1000ms
'''
msg = {
'tag': tag,
'data': data,
'events': None,
... | def fire_master(self, data, tag, timeout=1000):
''''
Send a single event to the master, with the payload "data" and the
event identifier "tag".
Default timeout is 1000ms
'''
msg = {
'tag': tag,
'data': data,
'events': None,
... | [
"Send",
"a",
"single",
"event",
"to",
"the",
"master",
"with",
"the",
"payload",
"data",
"and",
"the",
"event",
"identifier",
"tag",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L769-L782 | [
"def",
"fire_master",
"(",
"self",
",",
"data",
",",
"tag",
",",
"timeout",
"=",
"1000",
")",
":",
"msg",
"=",
"{",
"'tag'",
":",
"tag",
",",
"'data'",
":",
"data",
",",
"'events'",
":",
"None",
",",
"'pretag'",
":",
"None",
"}",
"return",
"self",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltEvent._fire_ret_load_specific_fun | Helper function for fire_ret_load | salt/utils/event.py | def _fire_ret_load_specific_fun(self, load, fun_index=0):
'''
Helper function for fire_ret_load
'''
if isinstance(load['fun'], list):
# Multi-function job
fun = load['fun'][fun_index]
# 'retcode' was already validated to exist and be non-zero
... | def _fire_ret_load_specific_fun(self, load, fun_index=0):
'''
Helper function for fire_ret_load
'''
if isinstance(load['fun'], list):
# Multi-function job
fun = load['fun'][fun_index]
# 'retcode' was already validated to exist and be non-zero
... | [
"Helper",
"function",
"for",
"fire_ret_load"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L792-L844 | [
"def",
"_fire_ret_load_specific_fun",
"(",
"self",
",",
"load",
",",
"fun_index",
"=",
"0",
")",
":",
"if",
"isinstance",
"(",
"load",
"[",
"'fun'",
"]",
",",
"list",
")",
":",
"# Multi-function job",
"fun",
"=",
"load",
"[",
"'fun'",
"]",
"[",
"fun_inde... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltEvent.fire_ret_load | Fire events based on information in the return load | salt/utils/event.py | def fire_ret_load(self, load):
'''
Fire events based on information in the return load
'''
if load.get('retcode') and load.get('fun'):
if isinstance(load['fun'], list):
# Multi-function job
if isinstance(load['retcode'], list):
... | def fire_ret_load(self, load):
'''
Fire events based on information in the return load
'''
if load.get('retcode') and load.get('fun'):
if isinstance(load['fun'], list):
# Multi-function job
if isinstance(load['retcode'], list):
... | [
"Fire",
"events",
"based",
"on",
"information",
"in",
"the",
"return",
"load"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L846-L874 | [
"def",
"fire_ret_load",
"(",
"self",
",",
"load",
")",
":",
"if",
"load",
".",
"get",
"(",
"'retcode'",
")",
"and",
"load",
".",
"get",
"(",
"'fun'",
")",
":",
"if",
"isinstance",
"(",
"load",
"[",
"'fun'",
"]",
",",
"list",
")",
":",
"# Multi-func... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltEvent.set_event_handler | Invoke the event_handler callback each time an event arrives. | salt/utils/event.py | def set_event_handler(self, event_handler):
'''
Invoke the event_handler callback each time an event arrives.
'''
assert not self._run_io_loop_sync
if not self.cpub:
self.connect_pub()
self.subscriber.callbacks.add(event_handler)
if not self.subscrib... | def set_event_handler(self, event_handler):
'''
Invoke the event_handler callback each time an event arrives.
'''
assert not self._run_io_loop_sync
if not self.cpub:
self.connect_pub()
self.subscriber.callbacks.add(event_handler)
if not self.subscrib... | [
"Invoke",
"the",
"event_handler",
"callback",
"each",
"time",
"an",
"event",
"arrives",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L880-L892 | [
"def",
"set_event_handler",
"(",
"self",
",",
"event_handler",
")",
":",
"assert",
"not",
"self",
".",
"_run_io_loop_sync",
"if",
"not",
"self",
".",
"cpub",
":",
"self",
".",
"connect_pub",
"(",
")",
"self",
".",
"subscriber",
".",
"callbacks",
".",
"add"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.