id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
34,000 | saltstack/salt | salt/states/kubernetes.py | node_label_folder_absent | 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': ''... | python | 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",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"labels",
"=",
... | Ensures the label folder doesn't exist on the specified node.
name
The name of label folder
node
The name of the node | [
"Ensures",
"the",
"label",
"folder",
"doesn",
"t",
"exist",
"on",
"the",
"specified",
"node",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L895-L946 |
34,001 | saltstack/salt | salt/states/kubernetes.py | node_label_present | 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
... | python | 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",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"label... | 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. | [
"Ensures",
"that",
"the",
"named",
"label",
"is",
"set",
"on",
"the",
"named",
"node",
"with",
"the",
"given",
"value",
".",
"If",
"the",
"label",
"exists",
"it",
"will",
"be",
"replaced",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L949-L1009 |
34,002 | saltstack/salt | salt/modules/devmap.py | multipath_flush | 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_... | python | 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",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"device",
")",
":",
"return",
"'{0} does not exist'",
".",
"format",
"(",
"device",
")",
"cmd",
"=",
"'multipath -f {0}'",
".",
"format",
"(",
"device",
... | Device-Mapper Multipath flush
CLI Example:
.. code-block:: bash
salt '*' devmap.multipath_flush mpath1 | [
"Device",
"-",
"Mapper",
"Multipath",
"flush"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/devmap.py#L23-L37 |
34,003 | saltstack/salt | salt/states/debconfmod.py | 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:
... | python | 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",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",... | 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>:
... | [
"Set",
"debconf",
"selections",
"from",
"a",
"file",
"or",
"a",
"template"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/debconfmod.py#L85-L155 |
34,004 | saltstack/salt | salt/states/debconfmod.py | set | 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... | python | 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",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"current",
"=",
"__salt__",
"[",
... | 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:
... | [
"Set",
"debconf",
"selections"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/debconfmod.py#L158-L234 |
34,005 | saltstack/salt | salt/engines/docker_events.py | start | 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... | python | 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",
")",
":",
"if",
"__opts__",
".",
"get",
"(",
"'__role'",
")",
"==",
"'m... | 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
... | [
"Scan",
"for",
"Docker",
"events",
"and",
"fire",
"events"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/docker_events.py#L42-L105 |
34,006 | saltstack/salt | salt/modules/infoblox.py | _get_config | 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... | python | 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",
")",
":",
"config",
"=",
"{",
"'api_sslverify'",
":",
"True",
",",
"'api_url'",
":",
"'https://INFOBLOX/wapi/v1.2.1'",
",",
"'api_user'",
":",
"''",
",",
"'api_key'",
":",
"''",
",",
"}",
"if",
"'__salt__'",
... | Return configuration
user passed api_opts override salt config.get vars | [
"Return",
"configuration",
"user",
"passed",
"api_opts",
"override",
"salt",
"config",
".",
"get",
"vars"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L58-L75 |
34,007 | saltstack/salt | salt/modules/infoblox.py | update_host | 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... | python | 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",
")",
":",
"o",
"=",
"get_host",
"(",
"name",
"=",
"name",
",",
"*",
"*",
"api_opts",
")",
"return",
"update_object",
"(",
"objref",
"=",
"o",
"[",
"'_ref'",
"]",
",",
"data"... | 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={} | [
"Update",
"host",
"record",
".",
"This",
"is",
"a",
"helper",
"call",
"to",
"update_object",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L120-L133 |
34,008 | saltstack/salt | salt/modules/infoblox.py | update_object | 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... | python | 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",
")",
":",
"if",
"'__opts__'",
"in",
"globals",
"(",
")",
"and",
"__opts__",
"[",
"'test'",
"]",
":",
"return",
"{",
"'Test'",
":",
"'Would attempt to update object: {0}'",
".",
... | 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={} | [
"Update",
"raw",
"infoblox",
"object",
".",
"This",
"is",
"a",
"low",
"level",
"api",
"call",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L136-L149 |
34,009 | saltstack/salt | salt/modules/infoblox.py | delete_object | 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... | python | 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",
")",
":",
"if",
"'__opts__'",
"in",
"globals",
"(",
")",
"and",
"__opts__",
"[",
"'test'",
"]",
":",
"return",
"{",
"'Test'",
":",
"'Would attempt to delete object: {0}'",
".",
"format",
"(",
... | Delete infoblox object. This is a low level api call.
CLI Example:
.. code-block:: bash
salt-call infoblox.delete_object objref=[ref_of_object] | [
"Delete",
"infoblox",
"object",
".",
"This",
"is",
"a",
"low",
"level",
"api",
"call",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L152-L165 |
34,010 | saltstack/salt | salt/modules/infoblox.py | create_object | 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... | python | 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",
")",
":",
"if",
"'__opts__'",
"in",
"globals",
"(",
")",
"and",
"__opts__",
"[",
"'test'",
"]",
":",
"return",
"{",
"'Test'",
":",
"'Would attempt to create object: {0}'",
".... | 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={} | [
"Create",
"raw",
"infoblox",
"object",
".",
"This",
"is",
"a",
"low",
"level",
"api",
"call",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L168-L181 |
34,011 | saltstack/salt | salt/modules/infoblox.py | get_object | 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... | python | 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",
")",
":",
"if",
"not",
"data",
":",
"data",
"=",
... | 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] | [
"Get",
"raw",
"infoblox",
"object",
".",
"This",
"is",
"a",
"low",
"level",
"api",
"call",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L184-L199 |
34,012 | saltstack/salt | salt/modules/infoblox.py | create_cname | 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": "... | python | 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",
")",
":",
"infoblox",
"=",
"_get_infoblox",
"(",
"*",
"*",
"api_opts",
")",
"host",
"=",
"infoblox",
".",
"create_cname",
"(",
"data",
"=",
"data",
")",
"return",
"host"
] | 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... | [
"Create",
"a",
"cname",
"record",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L202-L220 |
34,013 | saltstack/salt | salt/modules/infoblox.py | get_cname | 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... | python | 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",
")",
":",
"infoblox",
"=",
"_get_infoblox",
"(",
"*",
"*",
"api_opts",
")",
"o",
"=",
"infoblox",
".",
"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 | [
"Get",
"CNAME",
"information",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L223-L236 |
34,014 | saltstack/salt | salt/modules/infoblox.py | update_cname | 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... | python | 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",
")",
":",
"o",
"=",
"get_cname",
"(",
"name",
"=",
"name",
",",
"*",
"*",
"api_opts",
")",
"if",
"not",
"o",
":",
"raise",
"Exception",
"(",
"'CNAME record not found'",
")",
... | 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... | [
"Update",
"CNAME",
".",
"This",
"is",
"a",
"helper",
"call",
"to",
"update_object",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L239-L258 |
34,015 | saltstack/salt | salt/modules/infoblox.py | delete_cname | 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... | python | 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",
")",
":",
"cname",
"=",
"get_cname",
"(",
"name",
"=",
"name",
",",
"canonical",
"=",
"canonical",
",",
"*",
"*",
"api_opts",
")",
"if",
"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 | [
"Delete",
"CNAME",
".",
"This",
"is",
"a",
"helper",
"call",
"to",
"delete_object",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L261-L277 |
34,016 | saltstack/salt | salt/modules/infoblox.py | get_host | 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... | python | 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",
")",
":",
"infoblox",
"=",
"_get_infoblox",
"(",
"*",
"*",
"api_opts",
")",
"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 | [
"Get",
"host",
"information"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L280-L294 |
34,017 | saltstack/salt | salt/modules/infoblox.py | get_host_advanced | 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... | python | 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",
")",
":",
"infoblox",
"=",
"_get_infoblox",
"(",
"*",
"*",
"api_opts",
")",
"host",
"=",
"infoblox",
".",
"get_host_... | Get all host information
CLI Example:
.. code-block:: bash
salt-call infoblox.get_host_advanced hostname.domain.ca | [
"Get",
"all",
"host",
"information"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L297-L309 |
34,018 | saltstack/salt | salt/modules/infoblox.py | get_host_domainname | 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
... | python | 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",
")",
":",
"name",
"=",
"name",
".",
"lower",
"(",
")",
".",
"rstrip",
"(",
"'.'",
")",
"if",
"not",
"domains",
":",
"data",
"=",
"get_host",
"(",
"na... | 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... | [
"Get",
"host",
"domain",
"name"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L312-L348 |
34,019 | saltstack/salt | salt/modules/infoblox.py | get_host_mac | 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... | python | 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",
")",
":",
"data",
"=",
"get_host",
"(",
"name",
"=",
"name",
",",
"*",
"*",
"api_opts",
")",
"if",
"data",
"and",
"'ipv4addrs'",
"in",
"data... | 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 | [
"Get",
"mac",
"address",
"from",
"host",
"record",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L385-L407 |
34,020 | saltstack/salt | salt/modules/infoblox.py | get_host_ipv4 | 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... | python | 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",
")",
":",
"data",
"=",
"get_host",
"(",
"name",
"=",
"name",
",",
"mac",
"=",
"mac",
",",
"*",
"*",
"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_host_ipv4 mac=00:50:56:84:6e:ae | [
"Get",
"ipv4",
"address",
"from",
"host",
"record",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L410-L433 |
34,021 | saltstack/salt | salt/modules/infoblox.py | get_host_ipv4addr_info | 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... | python | 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",
")",
":",
"infoblox",
"=",
"_get_infoblox",
"(",
"*",
"*",
"api_opts"... | 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... | [
"Get",
"host",
"ipv4addr",
"information"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L436-L451 |
34,022 | saltstack/salt | salt/modules/infoblox.py | get_host_ipv6addr_info | 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... | python | 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",
")",
":",
"infoblox",
"=",
"_get_infoblox",
"(",
"*",
"*",
"api_opts"... | 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 | [
"Get",
"host",
"ipv6addr",
"information"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L454-L467 |
34,023 | saltstack/salt | salt/modules/infoblox.py | get_ipv4_range | 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... | python | 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",
")",
":",
"infoblox",
"=",
"_get_infoblox",
"(",
"*",
"*",
"api_opts",
")",
"return",
"infoblox",
".",
"g... | Get ip range
CLI Example:
.. code-block:: bash
salt-call infoblox.get_ipv4_range start_addr=123.123.122.12 | [
"Get",
"ip",
"range"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L541-L552 |
34,024 | saltstack/salt | salt/modules/infoblox.py | delete_ipv4_range | 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['_... | python | 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",
")",
":",
"r",
"=",
"get_ipv4_range",
"(",
"start_addr",
",",
"end_addr",
",",
"*",
"*",
"api_opts",
")",
"if",
"r",
":",
"return",
"de... | Delete ip range.
CLI Example:
.. code-block:: bash
salt-call infoblox.delete_ipv4_range start_addr=123.123.122.12 | [
"Delete",
"ip",
"range",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L555-L569 |
34,025 | saltstack/salt | salt/modules/infoblox.py | get_a | 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... | python | 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",
")",
":",
"data",
"=",
"{",
"}",
"if",
"name",
":",
"data",
"[",
"'name'",
"]",
"=",
"name",
"if",
"ipv4addr",
":"... | 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 | [
"Get",
"A",
"record"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L610-L629 |
34,026 | saltstack/salt | salt/modules/infoblox.py | delete_a | 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... | python | 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",
")",
":",
"r",
"=",
"get_a",
"(",
"name",
",",
"ipv4addr",
",",
"allow_array",
"=",
"False",
",",
"*",
"*",
"api... | 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... | [
"Delete",
"A",
"record"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/infoblox.py#L632-L655 |
34,027 | saltstack/salt | salt/states/infoblox_a.py | present | 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
... | python | 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",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"False",
",",
... | 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:
... | [
"Ensure",
"infoblox",
"A",
"record",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/infoblox_a.py#L17-L90 |
34,028 | saltstack/salt | salt/states/infoblox_a.py | absent | 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 = {... | python | 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",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}"... | 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 | [
"Ensure",
"infoblox",
"A",
"record",
"is",
"removed",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/infoblox_a.py#L93-L124 |
34,029 | saltstack/salt | salt/modules/kapacitor.py | _get_url | 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) | python | 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",
"(",
")",
":",
"protocol",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'kapacitor.protocol'",
",",
"'http'",
")",
"host",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'kapacitor.host'",
",",
"'localhost'",
")",
"port",
"=",
... | Get the kapacitor URL. | [
"Get",
"the",
"kapacitor",
"URL",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kapacitor.py#L55-L63 |
34,030 | saltstack/salt | salt/modules/kapacitor.py | get_task | 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... | python | 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",
")",
":",
"url",
"=",
"_get_url",
"(",
")",
"if",
"version",
"(",
")",
"<",
"'0.13'",
":",
"task_url",
"=",
"'{0}/task?name={1}'",
".",
"format",
"(",
"url",
",",
"name",
")",
"else",
":",
"task_url",
"=",
"'{0}/kapacito... | 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 | [
"Get",
"a",
"dict",
"of",
"data",
"on",
"a",
"task",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kapacitor.py#L66-L106 |
34,031 | saltstack/salt | salt/modules/kapacitor.py | _run_cmd | 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... | python | 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",
")",
":",
"ret",
"=",
"{",
"}",
"env_vars",
"=",
"{",
"'KAPACITOR_URL'",
":",
"_get_url",
"(",
")",
",",
"'KAPACITOR_UNSAFE_SSL'",
":",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'kapacitor.unsafe_ssl'",
",",
"'false'",
")"... | Run a Kapacitor task and return a dictionary of info. | [
"Run",
"a",
"Kapacitor",
"task",
"and",
"return",
"a",
"dictionary",
"of",
"info",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kapacitor.py#L109-L126 |
34,032 | saltstack/salt | salt/modules/linux_ip.py | _ip_ifaces | 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... | python | 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",
"(",
")",
":",
"tmp",
"=",
"{",
"}",
"ret",
"=",
"{",
"}",
"if_",
"=",
"None",
"at_",
"=",
"None",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'ip a'",
")",
"for",
"line",
"in",
"out",
".",
"splitlines",
"(",
")",
... | Parse output from 'ip a' | [
"Parse",
"output",
"from",
"ip",
"a"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/linux_ip.py#L67-L103 |
34,033 | saltstack/salt | salt/modules/nilrt_ip.py | _get_state | 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)) | python | 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",
"(",
")",
":",
"try",
":",
"return",
"pyconnman",
".",
"ConnManager",
"(",
")",
".",
"get_property",
"(",
"'State'",
")",
"except",
"KeyError",
":",
"return",
"'offline'",
"except",
"dbus",
".",
"DBusException",
"as",
"exc",
":",
"rais... | Returns the state of connman | [
"Returns",
"the",
"state",
"of",
"connman"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L85-L94 |
34,034 | saltstack/salt | salt/modules/nilrt_ip.py | _get_technologies | 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... | python | 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",
"(",
")",
":",
"tech",
"=",
"''",
"technologies",
"=",
"pyconnman",
".",
"ConnManager",
"(",
")",
".",
"get_technologies",
"(",
")",
"for",
"path",
",",
"params",
"in",
"technologies",
":",
"tech",
"+=",
"'{0}\\n\\tName = {1}\\n\\tT... | Returns the technologies of connman | [
"Returns",
"the",
"technologies",
"of",
"connman"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L97-L106 |
34,035 | saltstack/salt | salt/modules/nilrt_ip.py | _get_services | 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 | python | 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",
"(",
")",
":",
"serv",
"=",
"[",
"]",
"services",
"=",
"pyconnman",
".",
"ConnManager",
"(",
")",
".",
"get_services",
"(",
")",
"for",
"path",
",",
"_",
"in",
"services",
":",
"serv",
".",
"append",
"(",
"six",
".",
"text_typ... | Returns a list with all connman services | [
"Returns",
"a",
"list",
"with",
"all",
"connman",
"services"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L109-L117 |
34,036 | saltstack/salt | salt/modules/nilrt_ip.py | _connected | 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' | python | 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",
")",
":",
"state",
"=",
"pyconnman",
".",
"ConnService",
"(",
"os",
".",
"path",
".",
"join",
"(",
"SERVICE_PATH",
",",
"service",
")",
")",
".",
"get_property",
"(",
"'State'",
")",
"return",
"state",
"==",
"'online'... | Verify if a connman service is connected | [
"Verify",
"if",
"a",
"connman",
"service",
"is",
"connected"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L120-L125 |
34,037 | saltstack/salt | salt/modules/nilrt_ip.py | _validate_ipv4 | 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()):
... | python | 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",
")",
":",
"if",
"len",
"(",
"value",
")",
"==",
"3",
":",
"if",
"not",
"salt",
".",
"utils",
".",
"validate",
".",
"net",
".",
"ipv4_addr",
"(",
"value",
"[",
"0",
"]",
".",
"strip",
"(",
")",
")",
":",
"r... | validate ipv4 values | [
"validate",
"ipv4",
"values"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L143-L156 |
34,038 | saltstack/salt | salt/modules/nilrt_ip.py | _interface_to_service | 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']... | python | 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",
")",
":",
"for",
"_service",
"in",
"_get_services",
"(",
")",
":",
"service_info",
"=",
"pyconnman",
".",
"ConnService",
"(",
"os",
".",
"path",
".",
"join",
"(",
"SERVICE_PATH",
",",
"_service",
")",
")",
"if"... | returns the coresponding service to given interface if exists, otherwise return None | [
"returns",
"the",
"coresponding",
"service",
"to",
"given",
"interface",
"if",
"exists",
"otherwise",
"return",
"None"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L159-L167 |
34,039 | saltstack/salt | salt/modules/nilrt_ip.py | _get_service_info | 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... | python | 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",
")",
":",
"service_info",
"=",
"pyconnman",
".",
"ConnService",
"(",
"os",
".",
"path",
".",
"join",
"(",
"SERVICE_PATH",
",",
"service",
")",
")",
"data",
"=",
"{",
"'label'",
":",
"service",
",",
"'wireless'",
... | return details about given connman service | [
"return",
"details",
"about",
"given",
"connman",
"service"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L170-L230 |
34,040 | saltstack/salt | salt/modules/nilrt_ip.py | _get_dns_info | 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(... | python | 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",
"(",
")",
":",
"dns_list",
"=",
"[",
"]",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"'/etc/resolv.conf'",
",",
"'r+'",
")",
"as",
"dns_info",
":",
"lines",
"=",
"dns_info",
".",
"readlines",
"(",... | return dns list | [
"return",
"dns",
"list"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L233-L248 |
34,041 | saltstack/salt | salt/modules/nilrt_ip.py | _load_config | 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... | python | 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",
")",
":",
"results",
"=",
"{",
"}",
"if",
"not",
"options",
":",
"return",
"results",
"with",
"salt",
".",
"utils",
".",
"files",
... | 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: | [
"Get",
"values",
"for",
"some",
"options",
"and",
"a",
"given",
"section",
"from",
"a",
"config",
"file",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L261-L281 |
34,042 | saltstack/salt | salt/modules/nilrt_ip.py | _get_request_mode_info | 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:
... | python | 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",
")",
":",
"settings",
"=",
"_load_config",
"(",
"interface",
",",
"[",
"'linklocalenabled'",
",",
"'dhcpenabled'",
"]",
",",
"-",
"1",
")",
"link_local_enabled",
"=",
"int",
"(",
"settings",
"[",
"'linklocalenab... | return requestmode for given interface | [
"return",
"requestmode",
"for",
"given",
"interface"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L284-L303 |
34,043 | saltstack/salt | salt/modules/nilrt_ip.py | _get_possible_adapter_modes | 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... | python | 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",
")",
":",
"adapter_modes",
"=",
"[",
"]",
"protocols",
"=",
"_load_config",
"(",
"'lvrt'",
",",
"[",
"'AdditionalNetworkProtocols'",
"]",
")",
"[",
"'AdditionalNetworkProtocols'",
"]",
".",
... | 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 | [
"Return",
"possible",
"adapter",
"modes",
"for",
"a",
"given",
"interface",
"using",
"a",
"blacklist",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L314-L345 |
34,044 | saltstack/salt | salt/modules/nilrt_ip.py | _get_static_info | 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': {
... | python | 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",
")",
":",
"data",
"=",
"{",
"'connectionid'",
":",
"interface",
".",
"name",
",",
"'label'",
":",
"interface",
".",
"name",
",",
"'hwaddr'",
":",
"interface",
".",
"hwaddr",
"[",
":",
"-",
"1",
"]",
",",
"'u... | Return information about an interface from config file.
:param interface: interface label | [
"Return",
"information",
"about",
"an",
"interface",
"from",
"config",
"file",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L348-L374 |
34,045 | saltstack/salt | salt/modules/nilrt_ip.py | _get_base_interface_info | def _get_base_interface_info(interface):
'''
return base details about given interface
'''
blacklist = {
'tcpip': {
'name': [],
'type': [],
'additional_protocol': False
},
'disabled': {
'name': ['eth0'],
'type': ['gadget... | python | 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",
")",
":",
"blacklist",
"=",
"{",
"'tcpip'",
":",
"{",
"'name'",
":",
"[",
"]",
",",
"'type'",
":",
"[",
"]",
",",
"'additional_protocol'",
":",
"False",
"}",
",",
"'disabled'",
":",
"{",
"'name'",
":",... | return base details about given interface | [
"return",
"base",
"details",
"about",
"given",
"interface"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L377-L414 |
34,046 | saltstack/salt | salt/modules/nilrt_ip.py | _get_ethercat_interface_info | 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 | python | 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",
")",
":",
"base_information",
"=",
"_get_base_interface_info",
"(",
"interface",
")",
"base_information",
"[",
"'ethercat'",
"]",
"=",
"{",
"'masterid'",
":",
"_load_config",
"(",
"interface",
".",
"name",
","... | return details about given ethercat interface | [
"return",
"details",
"about",
"given",
"ethercat",
"interface"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L417-L425 |
34,047 | saltstack/salt | salt/modules/nilrt_ip.py | _get_tcpip_interface_info | 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... | python | 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",
")",
":",
"base_information",
"=",
"_get_base_interface_info",
"(",
"interface",
")",
"if",
"base_information",
"[",
"'ipv4'",
"]",
"[",
"'requestmode'",
"]",
"==",
"'static'",
":",
"settings",
"=",
"_load_config... | return details about given tcpip interface | [
"return",
"details",
"about",
"given",
"tcpip",
"interface"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L428-L452 |
34,048 | saltstack/salt | salt/modules/nilrt_ip.py | _get_interface_info | 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... | python | 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",
")",
":",
"adapter_mode",
"=",
"_get_adapter_mode_info",
"(",
"interface",
".",
"name",
")",
"if",
"adapter_mode",
"==",
"'disabled'",
":",
"return",
"_get_base_interface_info",
"(",
"interface",
")",
"elif",
"adapter_... | return details about given interface | [
"return",
"details",
"about",
"given",
"interface"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L455-L464 |
34,049 | saltstack/salt | salt/modules/nilrt_ip.py | _dict_to_string | 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... | python | 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",
")",
":",
"ret",
"=",
"''",
"for",
"key",
",",
"val",
"in",
"sorted",
"(",
"dictionary",
".",
"items",
"(",
")",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"dict",
")",
":",
"for",
"line",
"in",
"_di... | converts a dictionary object into a list of strings | [
"converts",
"a",
"dictionary",
"object",
"into",
"a",
"list",
"of",
"strings"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L467-L481 |
34,050 | saltstack/salt | salt/modules/nilrt_ip.py | get_interfaces_details | 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 ... | python | 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",
"(",
")",
":",
"_interfaces",
"=",
"[",
"interface",
"for",
"interface",
"in",
"pyiface",
".",
"getIfaces",
"(",
")",
"if",
"interface",
".",
"flags",
"&",
"IFF_LOOPBACK",
"==",
"0",
"]",
"if",
"__grains__",
"[",
"'lsb_distri... | 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 | [
"Get",
"details",
"about",
"all",
"the",
"interfaces",
"on",
"the",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L494-L512 |
34,051 | saltstack/salt | salt/modules/nilrt_ip.py | _change_state_legacy | 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... | python | 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",
")",
":",
"initial_mode",
"=",
"_get_adapter_mode_info",
"(",
"interface",
")",
"_save_config",
"(",
"interface",
",",
"'Mode'",
",",
"'TCPIP'",
"if",
"new_state",
"==",
"'up'",
"else",
"'Disabled'... | 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... | [
"Enable",
"or",
"disable",
"an",
"interface",
"on",
"a",
"legacy",
"distro"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L515-L536 |
34,052 | saltstack/salt | salt/modules/nilrt_ip.py | _change_state | 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... | python | 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",
")",
":",
"if",
"__grains__",
"[",
"'lsb_distrib_id'",
"]",
"==",
"'nilrt'",
":",
"return",
"_change_state_legacy",
"(",
"interface",
",",
"new_state",
")",
"service",
"=",
"_interface_to_service",
"(",
... | 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 | [
"Enable",
"or",
"disable",
"an",
"interface"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L539-L564 |
34,053 | saltstack/salt | salt/modules/nilrt_ip.py | _save_config | 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... | python | 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",
")",
":",
"cmd",
"=",
"NIRTCFG_PATH",
"cmd",
"+=",
"' --set section={0},token=\\'{1}\\',value=\\'{2}\\''",
".",
"format",
"(",
"section",
",",
"token",
",",
"value",
")",
"if",
"__salt__",
"[",
... | Helper function to persist a configuration in the ini file | [
"Helper",
"function",
"to",
"persist",
"a",
"configuration",
"in",
"the",
"ini",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L643-L651 |
34,054 | saltstack/salt | salt/modules/nilrt_ip.py | set_ethercat | 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... | python | 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",
")",
":",
"if",
"__grains__",
"[",
"'lsb_distrib_id'",
"]",
"==",
"'nilrt'",
":",
"initial_mode",
"=",
"_get_adapter_mode_info",
"(",
"interface",
")",
"_save_config",
"(",
"interface",
",",
"'Mode'",
",... | 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 ... | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L654-L676 |
34,055 | saltstack/salt | salt/modules/nilrt_ip.py | set_dhcp_linklocal_all | 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 ... | python | 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",
")",
":",
"if",
"__grains__",
"[",
"'lsb_distrib_id'",
"]",
"==",
"'nilrt'",
":",
"initial_mode",
"=",
"_get_adapter_mode_info",
"(",
"interface",
")",
"_save_config",
"(",
"interface",
",",
"'Mode'",
",",
"'TCPIP... | 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
... | [
"Configure",
"specified",
"adapter",
"to",
"use",
"DHCP",
"with",
"linklocal",
"fallback"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L687-L728 |
34,056 | saltstack/salt | salt/modules/nilrt_ip.py | set_dhcp_only_all | 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... | python | 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",
")",
":",
"if",
"not",
"__grains__",
"[",
"'lsb_distrib_id'",
"]",
"==",
"'nilrt'",
":",
"raise",
"salt",
".",
"exceptions",
".",
"CommandExecutionError",
"(",
"'Not supported in this version'",
")",
"initial_mode",
"=",... | 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:
.... | [
"Configure",
"specified",
"adapter",
"to",
"use",
"DHCP",
"only"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L731-L757 |
34,057 | saltstack/salt | salt/modules/nilrt_ip.py | set_static_all | 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 ... | python | 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",
")",
":",
"validate",
",",
"msg",
"=",
"_validate_ipv4",
"(",
"[",
"address",
",",
"netmask",
",",
"gateway",
"]",
")",
"if",
"not... | 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... | [
"Configure",
"specified",
"adapter",
"to",
"use",
"ipv4",
"manual",
"settings"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L831-L895 |
34,058 | saltstack/salt | salt/modules/nilrt_ip.py | get_interface | 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:
... | python | 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",
")",
":",
"_interfaces",
"=",
"get_interfaces_details",
"(",
")",
"for",
"_interface",
"in",
"_interfaces",
"[",
"'interfaces'",
"]",
":",
"if",
"_interface",
"[",
"'connectionid'",
"]",
"==",
"iface",
":",
"return",
"_dic... | Returns details about given interface.
CLI Example:
.. code-block:: bash
salt '*' ip.get_interface eth0 | [
"Returns",
"details",
"about",
"given",
"interface",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nilrt_ip.py#L898-L912 |
34,059 | saltstack/salt | salt/utils/event.py | fire_args | 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... | python | 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",
"=",
"''",
")",
":",
"try",
":",
"tag_suffix",
"=",
"[",
"jid",
",",
"'args'",
"]",
"except",
"NameError",
":",
"pass",
"else",
":",
"tag",
"=",
"tagify",
"(",
"tag_suffix",... | Fire an event containing the arguments passed to an orchestration job | [
"Fire",
"an",
"event",
"containing",
"the",
"arguments",
"passed",
"to",
"an",
"orchestration",
"job"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L157-L175 |
34,060 | saltstack/salt | salt/utils/event.py | tagify | 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... | python | 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",
")",
":",
"parts",
"=",
"[",
"base",
",",
"TAGS",
".",
"get",
"(",
"prefix",
",",
"prefix",
")",
"]",
"if",
"hasattr",
"(",
"suffix",
",",
"'append'",
... | 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... | [
"convenience",
"function",
"to",
"build",
"a",
"namespaced",
"event",
"tag",
"string",
"from",
"joining",
"with",
"the",
"TABPART",
"character",
"the",
"base",
"prefix",
"and",
"suffix"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L178-L201 |
34,061 | saltstack/salt | salt/utils/event.py | update_stats | 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_... | python | 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",
")",
":",
"end_time",
"=",
"time",
".",
"time",
"(",
")",
"cmd",
"=",
"data",
"[",
"'cmd'",
"]",
"# the jid is used as the create time",
"try",
":",
"jid",
"=",
"data",
"[",
"'jid'",
"]... | Calculate the master stats and return the updated stat info | [
"Calculate",
"the",
"master",
"stats",
"and",
"return",
"the",
"updated",
"stat",
"info"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L204-L227 |
34,062 | saltstack/salt | salt/utils/event.py | SaltEvent.__load_uri | 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... | python | 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",
")",
":",
"if",
"node",
"==",
"'master'",
":",
"if",
"self",
".",
"opts",
"[",
"'ipc_mode'",
"]",
"==",
"'tcp'",
":",
"puburi",
"=",
"int",
"(",
"self",
".",
"opts",
"[",
"'tcp_master_pu... | Return the string URI for the location of the pull and pub sockets to
use for firing and listening to events | [
"Return",
"the",
"string",
"URI",
"for",
"the",
"location",
"of",
"the",
"pull",
"and",
"pub",
"sockets",
"to",
"use",
"for",
"firing",
"and",
"listening",
"to",
"events"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L302-L339 |
34,063 | saltstack/salt | salt/utils/event.py | SaltEvent.subscribe | 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... | python | 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",
")",
":",
"if",
"tag",
"is",
"None",
":",
"return",
"match_func",
"=",
"self",
".",
"_get_match_func",
"(",
"match_type",
")",
"self",
".",
"pending_tags",
".",
"... | 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... | [
"Subscribe",
"to",
"events",
"matching",
"the",
"passed",
"tag",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L341-L354 |
34,064 | saltstack/salt | salt/utils/event.py | SaltEvent.unsubscribe | 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
... | python | 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",
")",
":",
"if",
"tag",
"is",
"None",
":",
"return",
"match_func",
"=",
"self",
".",
"_get_match_func",
"(",
"match_type",
")",
"self",
".",
"pending_tags",
".",
"remove",
"(",... | Un-subscribe to events matching the passed tag. | [
"Un",
"-",
"subscribe",
"to",
"events",
"matching",
"the",
"passed",
"tag",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L356-L370 |
34,065 | saltstack/salt | salt/utils/event.py | SaltEvent.connect_pub | 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... | python | 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",
")",
":",
"if",
"self",
".",
"cpub",
":",
"return",
"True",
"if",
"self",
".",
"_run_io_loop_sync",
":",
"with",
"salt",
".",
"utils",
".",
"asynchronous",
".",
"current_ioloop",
"(",
"self"... | Establish the publish connection | [
"Establish",
"the",
"publish",
"connection"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L372-L402 |
34,066 | saltstack/salt | salt/utils/event.py | SaltEvent.connect_pull | 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... | python | 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",
")",
":",
"if",
"self",
".",
"cpush",
":",
"return",
"True",
"if",
"self",
".",
"_run_io_loop_sync",
":",
"with",
"salt",
".",
"utils",
".",
"asynchronous",
".",
"current_ioloop",
"(",
"self",... | Establish a connection with the event pull socket
Default timeout is 1 s | [
"Establish",
"a",
"connection",
"with",
"the",
"event",
"pull",
"socket",
"Default",
"timeout",
"is",
"1",
"s"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L416-L446 |
34,067 | saltstack/salt | salt/utils/event.py | SaltEvent._check_pending | 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:
... | python | 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",
")",
":",
"if",
"match_func",
"is",
"None",
":",
"match_func",
"=",
"self",
".",
"_get_match_func",
"(",
")",
"old_events",
"=",
"self",
".",
"pending_events",
"self",
".",
... | 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"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L467-L492 |
34,068 | saltstack/salt | salt/utils/event.py | SaltEvent.get_event | 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 `... | python | 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",
")",
":",
"assert",
"self",
".",
"_run_io_lo... | 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... | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L590-L667 |
34,069 | saltstack/salt | salt/utils/event.py | SaltEvent.get_event_noblock | 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... | python | 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",
")",
":",
"assert",
"self",
".",
"_run_io_loop_sync",
"if",
"not",
"self",
".",
"cpub",
":",
"if",
"not",
"self",
".",
"connect_pub",
"(",
")",
":",
"return",
"None",
"raw",
"=",
"self",
".",
"subscriber",
".",
... | Get the raw event without blocking or any other niceties | [
"Get",
"the",
"raw",
"event",
"without",
"blocking",
"or",
"any",
"other",
"niceties"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L669-L682 |
34,070 | saltstack/salt | salt/utils/event.py | SaltEvent.iter_events | 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... | python | 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",
")",
":",
"while",
"True",
":",
"data",
"=",
"self",
".",
"get_event",
"(",
"tag",
"=",
"tag",
... | Creates a generator that continuously listens for events | [
"Creates",
"a",
"generator",
"that",
"continuously",
"listens",
"for",
"events"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L700-L709 |
34,071 | saltstack/salt | salt/utils/event.py | SaltEvent.fire_event | 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.')
... | python | 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",
")",
":",
"if",
"not",
"six",
".",
"text_type",
"(",
"tag",
")",
":",
"# no empty tags allowed",
"raise",
"ValueError",
"(",
"'Empty tag.'",
")",
"if",
"not",
"isinst... | Send a single event into the publisher with payload dict "data" and
event identifier "tag"
The default is 1000 ms | [
"Send",
"a",
"single",
"event",
"into",
"the",
"publisher",
"with",
"payload",
"dict",
"data",
"and",
"event",
"identifier",
"tag"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L711-L767 |
34,072 | saltstack/salt | salt/utils/event.py | SaltEvent.fire_master | 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,
... | python | 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",
")",
":",
"msg",
"=",
"{",
"'tag'",
":",
"tag",
",",
"'data'",
":",
"data",
",",
"'events'",
":",
"None",
",",
"'pretag'",
":",
"None",
"}",
"return",
"self",
... | Send a single event to the master, with the payload "data" and the
event identifier "tag".
Default timeout is 1000ms | [
"Send",
"a",
"single",
"event",
"to",
"the",
"master",
"with",
"the",
"payload",
"data",
"and",
"the",
"event",
"identifier",
"tag",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L769-L782 |
34,073 | saltstack/salt | salt/utils/event.py | SaltEvent._fire_ret_load_specific_fun | 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
... | python | 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",
")",
":",
"if",
"isinstance",
"(",
"load",
"[",
"'fun'",
"]",
",",
"list",
")",
":",
"# Multi-function job",
"fun",
"=",
"load",
"[",
"'fun'",
"]",
"[",
"fun_inde... | Helper function for fire_ret_load | [
"Helper",
"function",
"for",
"fire_ret_load"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L792-L844 |
34,074 | saltstack/salt | salt/utils/event.py | SaltEvent.fire_ret_load | 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):
... | python | 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",
")",
":",
"if",
"load",
".",
"get",
"(",
"'retcode'",
")",
"and",
"load",
".",
"get",
"(",
"'fun'",
")",
":",
"if",
"isinstance",
"(",
"load",
"[",
"'fun'",
"]",
",",
"list",
")",
":",
"# Multi-func... | Fire events based on information in the return load | [
"Fire",
"events",
"based",
"on",
"information",
"in",
"the",
"return",
"load"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L846-L874 |
34,075 | saltstack/salt | salt/utils/event.py | SaltEvent.set_event_handler | 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... | python | 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",
")",
":",
"assert",
"not",
"self",
".",
"_run_io_loop_sync",
"if",
"not",
"self",
".",
"cpub",
":",
"self",
".",
"connect_pub",
"(",
")",
"self",
".",
"subscriber",
".",
"callbacks",
".",
"add"... | Invoke the event_handler callback each time an event arrives. | [
"Invoke",
"the",
"event_handler",
"callback",
"each",
"time",
"an",
"event",
"arrives",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L880-L892 |
34,076 | saltstack/salt | salt/utils/event.py | EventPublisher.run | def run(self):
'''
Bind the pub and pull sockets for events
'''
salt.utils.process.appendproctitle(self.__class__.__name__)
self.io_loop = tornado.ioloop.IOLoop()
with salt.utils.asynchronous.current_ioloop(self.io_loop):
if self.opts['ipc_mode'] == 'tcp':
... | python | def run(self):
'''
Bind the pub and pull sockets for events
'''
salt.utils.process.appendproctitle(self.__class__.__name__)
self.io_loop = tornado.ioloop.IOLoop()
with salt.utils.asynchronous.current_ioloop(self.io_loop):
if self.opts['ipc_mode'] == 'tcp':
... | [
"def",
"run",
"(",
"self",
")",
":",
"salt",
".",
"utils",
".",
"process",
".",
"appendproctitle",
"(",
"self",
".",
"__class__",
".",
"__name__",
")",
"self",
".",
"io_loop",
"=",
"tornado",
".",
"ioloop",
".",
"IOLoop",
"(",
")",
"with",
"salt",
".... | Bind the pub and pull sockets for events | [
"Bind",
"the",
"pub",
"and",
"pull",
"sockets",
"for",
"events"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L1100-L1147 |
34,077 | saltstack/salt | salt/utils/event.py | EventReturn.run | def run(self):
'''
Spin up the multiprocess event returner
'''
salt.utils.process.appendproctitle(self.__class__.__name__)
self.event = get_event('master', opts=self.opts, listen=True)
events = self.event.iter_events(full=True)
self.event.fire_event({}, 'salt/even... | python | def run(self):
'''
Spin up the multiprocess event returner
'''
salt.utils.process.appendproctitle(self.__class__.__name__)
self.event = get_event('master', opts=self.opts, listen=True)
events = self.event.iter_events(full=True)
self.event.fire_event({}, 'salt/even... | [
"def",
"run",
"(",
"self",
")",
":",
"salt",
".",
"utils",
".",
"process",
".",
"appendproctitle",
"(",
"self",
".",
"__class__",
".",
"__name__",
")",
"self",
".",
"event",
"=",
"get_event",
"(",
"'master'",
",",
"opts",
"=",
"self",
".",
"opts",
",... | Spin up the multiprocess event returner | [
"Spin",
"up",
"the",
"multiprocess",
"event",
"returner"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L1270-L1290 |
34,078 | saltstack/salt | salt/utils/event.py | EventReturn._filter | def _filter(self, event):
'''
Take an event and run it through configured filters.
Returns True if event should be stored, else False
'''
tag = event['tag']
if self.opts['event_return_whitelist']:
ret = False
else:
ret = True
for w... | python | def _filter(self, event):
'''
Take an event and run it through configured filters.
Returns True if event should be stored, else False
'''
tag = event['tag']
if self.opts['event_return_whitelist']:
ret = False
else:
ret = True
for w... | [
"def",
"_filter",
"(",
"self",
",",
"event",
")",
":",
"tag",
"=",
"event",
"[",
"'tag'",
"]",
"if",
"self",
".",
"opts",
"[",
"'event_return_whitelist'",
"]",
":",
"ret",
"=",
"False",
"else",
":",
"ret",
"=",
"True",
"for",
"whitelist_match",
"in",
... | Take an event and run it through configured filters.
Returns True if event should be stored, else False | [
"Take",
"an",
"event",
"and",
"run",
"it",
"through",
"configured",
"filters",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L1292-L1311 |
34,079 | saltstack/salt | salt/utils/event.py | StateFire.fire_master | def fire_master(self, data, tag, preload=None):
'''
Fire an event off on the master server
CLI Example:
.. code-block:: bash
salt '*' event.fire_master 'stuff to be in the event' 'tag'
'''
load = {}
if preload:
load.update(preload)
... | python | def fire_master(self, data, tag, preload=None):
'''
Fire an event off on the master server
CLI Example:
.. code-block:: bash
salt '*' event.fire_master 'stuff to be in the event' 'tag'
'''
load = {}
if preload:
load.update(preload)
... | [
"def",
"fire_master",
"(",
"self",
",",
"data",
",",
"tag",
",",
"preload",
"=",
"None",
")",
":",
"load",
"=",
"{",
"}",
"if",
"preload",
":",
"load",
".",
"update",
"(",
"preload",
")",
"load",
".",
"update",
"(",
"{",
"'id'",
":",
"self",
".",... | Fire an event off on the master server
CLI Example:
.. code-block:: bash
salt '*' event.fire_master 'stuff to be in the event' 'tag' | [
"Fire",
"an",
"event",
"off",
"on",
"the",
"master",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L1327-L1356 |
34,080 | saltstack/salt | salt/utils/event.py | StateFire.fire_running | def fire_running(self, running):
'''
Pass in a state "running" dict, this is the return dict from a state
call. The dict will be processed and fire events.
By default yellows and reds fire events on the master and minion, but
this can be configured.
'''
load = {'... | python | def fire_running(self, running):
'''
Pass in a state "running" dict, this is the return dict from a state
call. The dict will be processed and fire events.
By default yellows and reds fire events on the master and minion, but
this can be configured.
'''
load = {'... | [
"def",
"fire_running",
"(",
"self",
",",
"running",
")",
":",
"load",
"=",
"{",
"'id'",
":",
"self",
".",
"opts",
"[",
"'id'",
"]",
",",
"'events'",
":",
"[",
"]",
",",
"'cmd'",
":",
"'_minion_event'",
"}",
"for",
"stag",
"in",
"sorted",
"(",
"runn... | Pass in a state "running" dict, this is the return dict from a state
call. The dict will be processed and fire events.
By default yellows and reds fire events on the master and minion, but
this can be configured. | [
"Pass",
"in",
"a",
"state",
"running",
"dict",
"this",
"is",
"the",
"return",
"dict",
"from",
"a",
"state",
"call",
".",
"The",
"dict",
"will",
"be",
"processed",
"and",
"fire",
"events",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/event.py#L1358-L1388 |
34,081 | saltstack/salt | salt/modules/inspectlib/kiwiproc.py | KiwiExporter.load | def load(self, **descr):
'''
Load data by keys.
:param data:
:return:
'''
for obj, data in descr.items():
setattr(self._data, obj, data)
return self | python | def load(self, **descr):
'''
Load data by keys.
:param data:
:return:
'''
for obj, data in descr.items():
setattr(self._data, obj, data)
return self | [
"def",
"load",
"(",
"self",
",",
"*",
"*",
"descr",
")",
":",
"for",
"obj",
",",
"data",
"in",
"descr",
".",
"items",
"(",
")",
":",
"setattr",
"(",
"self",
".",
"_data",
",",
"obj",
",",
"data",
")",
"return",
"self"
] | Load data by keys.
:param data:
:return: | [
"Load",
"data",
"by",
"keys",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/kiwiproc.py#L50-L60 |
34,082 | saltstack/salt | salt/modules/inspectlib/kiwiproc.py | KiwiExporter.export | def export(self, name):
'''
Export to the Kiwi config.xml as text.
:return:
'''
self.name = name
root = self._create_doc()
self._set_description(root)
self._set_preferences(root)
self._set_repositories(root)
self._set_users(root)
... | python | def export(self, name):
'''
Export to the Kiwi config.xml as text.
:return:
'''
self.name = name
root = self._create_doc()
self._set_description(root)
self._set_preferences(root)
self._set_repositories(root)
self._set_users(root)
... | [
"def",
"export",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"name",
"=",
"name",
"root",
"=",
"self",
".",
"_create_doc",
"(",
")",
"self",
".",
"_set_description",
"(",
"root",
")",
"self",
".",
"_set_preferences",
"(",
"root",
")",
"self",
".... | Export to the Kiwi config.xml as text.
:return: | [
"Export",
"to",
"the",
"Kiwi",
"config",
".",
"xml",
"as",
"text",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/kiwiproc.py#L62-L79 |
34,083 | saltstack/salt | salt/modules/inspectlib/kiwiproc.py | KiwiExporter._get_package_manager | def _get_package_manager(self):
'''
Get package manager.
:return:
'''
ret = None
if self.__grains__.get('os_family') in ('Kali', 'Debian'):
ret = 'apt-get'
elif self.__grains__.get('os_family', '') == 'Suse':
ret = 'zypper'
elif se... | python | def _get_package_manager(self):
'''
Get package manager.
:return:
'''
ret = None
if self.__grains__.get('os_family') in ('Kali', 'Debian'):
ret = 'apt-get'
elif self.__grains__.get('os_family', '') == 'Suse':
ret = 'zypper'
elif se... | [
"def",
"_get_package_manager",
"(",
"self",
")",
":",
"ret",
"=",
"None",
"if",
"self",
".",
"__grains__",
".",
"get",
"(",
"'os_family'",
")",
"in",
"(",
"'Kali'",
",",
"'Debian'",
")",
":",
"ret",
"=",
"'apt-get'",
"elif",
"self",
".",
"__grains__",
... | Get package manager.
:return: | [
"Get",
"package",
"manager",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/kiwiproc.py#L81-L98 |
34,084 | saltstack/salt | salt/modules/inspectlib/kiwiproc.py | KiwiExporter._set_preferences | def _set_preferences(self, node):
'''
Set preferences.
:return:
'''
pref = etree.SubElement(node, 'preferences')
pacman = etree.SubElement(pref, 'packagemanager')
pacman.text = self._get_package_manager()
p_version = etree.SubElement(pref, 'version')
... | python | def _set_preferences(self, node):
'''
Set preferences.
:return:
'''
pref = etree.SubElement(node, 'preferences')
pacman = etree.SubElement(pref, 'packagemanager')
pacman.text = self._get_package_manager()
p_version = etree.SubElement(pref, 'version')
... | [
"def",
"_set_preferences",
"(",
"self",
",",
"node",
")",
":",
"pref",
"=",
"etree",
".",
"SubElement",
"(",
"node",
",",
"'preferences'",
")",
"pacman",
"=",
"etree",
".",
"SubElement",
"(",
"pref",
",",
"'packagemanager'",
")",
"pacman",
".",
"text",
"... | Set preferences.
:return: | [
"Set",
"preferences",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/kiwiproc.py#L100-L126 |
34,085 | saltstack/salt | salt/modules/inspectlib/kiwiproc.py | KiwiExporter._get_user_groups | def _get_user_groups(self, user):
'''
Get user groups.
:param user:
:return:
'''
return [g.gr_name for g in grp.getgrall()
if user in g.gr_mem] + [grp.getgrgid(pwd.getpwnam(user).pw_gid).gr_name] | python | def _get_user_groups(self, user):
'''
Get user groups.
:param user:
:return:
'''
return [g.gr_name for g in grp.getgrall()
if user in g.gr_mem] + [grp.getgrgid(pwd.getpwnam(user).pw_gid).gr_name] | [
"def",
"_get_user_groups",
"(",
"self",
",",
"user",
")",
":",
"return",
"[",
"g",
".",
"gr_name",
"for",
"g",
"in",
"grp",
".",
"getgrall",
"(",
")",
"if",
"user",
"in",
"g",
".",
"gr_mem",
"]",
"+",
"[",
"grp",
".",
"getgrgid",
"(",
"pwd",
".",... | Get user groups.
:param user:
:return: | [
"Get",
"user",
"groups",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/kiwiproc.py#L128-L136 |
34,086 | saltstack/salt | salt/modules/inspectlib/kiwiproc.py | KiwiExporter._set_users | def _set_users(self, node):
'''
Create existing local users.
<users group="root">
<user password="$1$wYJUgpM5$RXMMeASDc035eX.NbYWFl0" home="/root" name="root"/>
</users>
:param node:
:return:
'''
# Get real local users with the local passwords
... | python | def _set_users(self, node):
'''
Create existing local users.
<users group="root">
<user password="$1$wYJUgpM5$RXMMeASDc035eX.NbYWFl0" home="/root" name="root"/>
</users>
:param node:
:return:
'''
# Get real local users with the local passwords
... | [
"def",
"_set_users",
"(",
"self",
",",
"node",
")",
":",
"# Get real local users with the local passwords",
"shadow",
"=",
"{",
"}",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"'/etc/shadow'",
")",
"as",
"rfh",
":",
"for",
"sh_line",
"in"... | Create existing local users.
<users group="root">
<user password="$1$wYJUgpM5$RXMMeASDc035eX.NbYWFl0" home="/root" name="root"/>
</users>
:param node:
:return: | [
"Create",
"existing",
"local",
"users",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/kiwiproc.py#L138-L177 |
34,087 | saltstack/salt | salt/modules/inspectlib/kiwiproc.py | KiwiExporter._set_repositories | def _set_repositories(self, node):
'''
Create repositories.
:param node:
:return:
'''
priority = 99
for repo_id, repo_data in self._data.software.get('repositories', {}).items():
if type(repo_data) == list:
repo_data = repo_data[0]
... | python | def _set_repositories(self, node):
'''
Create repositories.
:param node:
:return:
'''
priority = 99
for repo_id, repo_data in self._data.software.get('repositories', {}).items():
if type(repo_data) == list:
repo_data = repo_data[0]
... | [
"def",
"_set_repositories",
"(",
"self",
",",
"node",
")",
":",
"priority",
"=",
"99",
"for",
"repo_id",
",",
"repo_data",
"in",
"self",
".",
"_data",
".",
"software",
".",
"get",
"(",
"'repositories'",
",",
"{",
"}",
")",
".",
"items",
"(",
")",
":"... | Create repositories.
:param node:
:return: | [
"Create",
"repositories",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/kiwiproc.py#L179-L206 |
34,088 | saltstack/salt | salt/modules/inspectlib/kiwiproc.py | KiwiExporter._set_packages | def _set_packages(self, node):
'''
Set packages and collections.
:param node:
:return:
'''
pkgs = etree.SubElement(node, 'packages')
for pkg_name, pkg_version in sorted(self._data.software.get('packages', {}).items()):
pkg = etree.SubElement(pkgs, 'pa... | python | def _set_packages(self, node):
'''
Set packages and collections.
:param node:
:return:
'''
pkgs = etree.SubElement(node, 'packages')
for pkg_name, pkg_version in sorted(self._data.software.get('packages', {}).items()):
pkg = etree.SubElement(pkgs, 'pa... | [
"def",
"_set_packages",
"(",
"self",
",",
"node",
")",
":",
"pkgs",
"=",
"etree",
".",
"SubElement",
"(",
"node",
",",
"'packages'",
")",
"for",
"pkg_name",
",",
"pkg_version",
"in",
"sorted",
"(",
"self",
".",
"_data",
".",
"software",
".",
"get",
"("... | Set packages and collections.
:param node:
:return: | [
"Set",
"packages",
"and",
"collections",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/kiwiproc.py#L208-L227 |
34,089 | saltstack/salt | salt/modules/inspectlib/kiwiproc.py | KiwiExporter._set_description | def _set_description(self, node):
'''
Create a system description.
:return:
'''
hostname = socket.getfqdn() or platform.node()
descr = etree.SubElement(node, 'description')
author = etree.SubElement(descr, 'author')
author.text = "salt.modules.node on {0... | python | def _set_description(self, node):
'''
Create a system description.
:return:
'''
hostname = socket.getfqdn() or platform.node()
descr = etree.SubElement(node, 'description')
author = etree.SubElement(descr, 'author')
author.text = "salt.modules.node on {0... | [
"def",
"_set_description",
"(",
"self",
",",
"node",
")",
":",
"hostname",
"=",
"socket",
".",
"getfqdn",
"(",
")",
"or",
"platform",
".",
"node",
"(",
")",
"descr",
"=",
"etree",
".",
"SubElement",
"(",
"node",
",",
"'description'",
")",
"author",
"="... | Create a system description.
:return: | [
"Create",
"a",
"system",
"description",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/kiwiproc.py#L229-L245 |
34,090 | saltstack/salt | salt/modules/inspectlib/kiwiproc.py | KiwiExporter._create_doc | def _create_doc(self):
'''
Create document.
:return:
'''
root = etree.Element('image')
root.set('schemaversion', '6.3')
root.set('name', self.name)
return root | python | def _create_doc(self):
'''
Create document.
:return:
'''
root = etree.Element('image')
root.set('schemaversion', '6.3')
root.set('name', self.name)
return root | [
"def",
"_create_doc",
"(",
"self",
")",
":",
"root",
"=",
"etree",
".",
"Element",
"(",
"'image'",
")",
"root",
".",
"set",
"(",
"'schemaversion'",
",",
"'6.3'",
")",
"root",
".",
"set",
"(",
"'name'",
",",
"self",
".",
"name",
")",
"return",
"root"
... | Create document.
:return: | [
"Create",
"document",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/kiwiproc.py#L247-L257 |
34,091 | saltstack/salt | salt/thorium/timer.py | hold | def hold(name, seconds):
'''
Wait for a given period of time, then fire a result of True, requiring
this state allows for an action to be blocked for evaluation based on
time
USAGE:
.. code-block:: yaml
hold_on_a_moment:
timer.hold:
- seconds: 30
'''
ret ... | python | def hold(name, seconds):
'''
Wait for a given period of time, then fire a result of True, requiring
this state allows for an action to be blocked for evaluation based on
time
USAGE:
.. code-block:: yaml
hold_on_a_moment:
timer.hold:
- seconds: 30
'''
ret ... | [
"def",
"hold",
"(",
"name",
",",
"seconds",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"start",
"=",
"time",
".",
"time",
"(",
")",
"if",
"... | Wait for a given period of time, then fire a result of True, requiring
this state allows for an action to be blocked for evaluation based on
time
USAGE:
.. code-block:: yaml
hold_on_a_moment:
timer.hold:
- seconds: 30 | [
"Wait",
"for",
"a",
"given",
"period",
"of",
"time",
"then",
"fire",
"a",
"result",
"of",
"True",
"requiring",
"this",
"state",
"allows",
"for",
"an",
"action",
"to",
"be",
"blocked",
"for",
"evaluation",
"based",
"on",
"time"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/thorium/timer.py#L11-L37 |
34,092 | saltstack/salt | salt/modules/mongodb.py | _to_dict | def _to_dict(objects):
'''
Potentially interprets a string as JSON for usage with mongo
'''
try:
if isinstance(objects, six.string_types):
objects = salt.utils.json.loads(objects)
except ValueError as err:
log.error("Could not parse objects: %s", err)
raise err
... | python | def _to_dict(objects):
'''
Potentially interprets a string as JSON for usage with mongo
'''
try:
if isinstance(objects, six.string_types):
objects = salt.utils.json.loads(objects)
except ValueError as err:
log.error("Could not parse objects: %s", err)
raise err
... | [
"def",
"_to_dict",
"(",
"objects",
")",
":",
"try",
":",
"if",
"isinstance",
"(",
"objects",
",",
"six",
".",
"string_types",
")",
":",
"objects",
"=",
"salt",
".",
"utils",
".",
"json",
".",
"loads",
"(",
"objects",
")",
"except",
"ValueError",
"as",
... | Potentially interprets a string as JSON for usage with mongo | [
"Potentially",
"interprets",
"a",
"string",
"as",
"JSON",
"for",
"usage",
"with",
"mongo"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mongodb.py#L77-L88 |
34,093 | saltstack/salt | salt/modules/mongodb.py | db_list | def db_list(user=None, password=None, host=None, port=None, authdb=None):
'''
List all MongoDB databases
CLI Example:
.. code-block:: bash
salt '*' mongodb.db_list <user> <password> <host> <port>
'''
conn = _connect(user, password, host, port, authdb=authdb)
if not conn:
r... | python | def db_list(user=None, password=None, host=None, port=None, authdb=None):
'''
List all MongoDB databases
CLI Example:
.. code-block:: bash
salt '*' mongodb.db_list <user> <password> <host> <port>
'''
conn = _connect(user, password, host, port, authdb=authdb)
if not conn:
r... | [
"def",
"db_list",
"(",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"authdb",
"=",
"None",
")",
":",
"conn",
"=",
"_connect",
"(",
"user",
",",
"password",
",",
"host",
",",
"port",
"... | List all MongoDB databases
CLI Example:
.. code-block:: bash
salt '*' mongodb.db_list <user> <password> <host> <port> | [
"List",
"all",
"MongoDB",
"databases"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mongodb.py#L91-L110 |
34,094 | saltstack/salt | salt/modules/mongodb.py | db_exists | def db_exists(name, user=None, password=None, host=None, port=None, authdb=None):
'''
Checks if a database exists in MongoDB
CLI Example:
.. code-block:: bash
salt '*' mongodb.db_exists <name> <user> <password> <host> <port>
'''
dbs = db_list(user, password, host, port, authdb=authdb)... | python | def db_exists(name, user=None, password=None, host=None, port=None, authdb=None):
'''
Checks if a database exists in MongoDB
CLI Example:
.. code-block:: bash
salt '*' mongodb.db_exists <name> <user> <password> <host> <port>
'''
dbs = db_list(user, password, host, port, authdb=authdb)... | [
"def",
"db_exists",
"(",
"name",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"authdb",
"=",
"None",
")",
":",
"dbs",
"=",
"db_list",
"(",
"user",
",",
"password",
",",
"host",
"... | Checks if a database exists in MongoDB
CLI Example:
.. code-block:: bash
salt '*' mongodb.db_exists <name> <user> <password> <host> <port> | [
"Checks",
"if",
"a",
"database",
"exists",
"in",
"MongoDB"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mongodb.py#L113-L128 |
34,095 | saltstack/salt | salt/modules/mongodb.py | db_remove | def db_remove(name, user=None, password=None, host=None, port=None, authdb=None):
'''
Remove a MongoDB database
CLI Example:
.. code-block:: bash
salt '*' mongodb.db_remove <name> <user> <password> <host> <port>
'''
conn = _connect(user, password, host, port, authdb=authdb)
if not... | python | def db_remove(name, user=None, password=None, host=None, port=None, authdb=None):
'''
Remove a MongoDB database
CLI Example:
.. code-block:: bash
salt '*' mongodb.db_remove <name> <user> <password> <host> <port>
'''
conn = _connect(user, password, host, port, authdb=authdb)
if not... | [
"def",
"db_remove",
"(",
"name",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"authdb",
"=",
"None",
")",
":",
"conn",
"=",
"_connect",
"(",
"user",
",",
"password",
",",
"host",
... | Remove a MongoDB database
CLI Example:
.. code-block:: bash
salt '*' mongodb.db_remove <name> <user> <password> <host> <port> | [
"Remove",
"a",
"MongoDB",
"database"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mongodb.py#L131-L152 |
34,096 | saltstack/salt | salt/modules/mongodb.py | version | def version(user=None, password=None, host=None, port=None, database='admin', authdb=None):
'''
Get MongoDB instance version
CLI Example:
.. code-block:: bash
salt '*' mongodb.version <user> <password> <host> <port> <database>
'''
conn = _connect(user, password, host, port, authdb=aut... | python | def version(user=None, password=None, host=None, port=None, database='admin', authdb=None):
'''
Get MongoDB instance version
CLI Example:
.. code-block:: bash
salt '*' mongodb.version <user> <password> <host> <port> <database>
'''
conn = _connect(user, password, host, port, authdb=aut... | [
"def",
"version",
"(",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"database",
"=",
"'admin'",
",",
"authdb",
"=",
"None",
")",
":",
"conn",
"=",
"_connect",
"(",
"user",
",",
"passwor... | Get MongoDB instance version
CLI Example:
.. code-block:: bash
salt '*' mongodb.version <user> <password> <host> <port> <database> | [
"Get",
"MongoDB",
"instance",
"version"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mongodb.py#L159-L180 |
34,097 | saltstack/salt | salt/modules/mongodb.py | user_list | def user_list(user=None, password=None, host=None, port=None, database='admin', authdb=None):
'''
List users of a MongoDB database
CLI Example:
.. code-block:: bash
salt '*' mongodb.user_list <user> <password> <host> <port> <database>
'''
conn = _connect(user, password, host, port, au... | python | def user_list(user=None, password=None, host=None, port=None, database='admin', authdb=None):
'''
List users of a MongoDB database
CLI Example:
.. code-block:: bash
salt '*' mongodb.user_list <user> <password> <host> <port> <database>
'''
conn = _connect(user, password, host, port, au... | [
"def",
"user_list",
"(",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"database",
"=",
"'admin'",
",",
"authdb",
"=",
"None",
")",
":",
"conn",
"=",
"_connect",
"(",
"user",
",",
"passw... | List users of a MongoDB database
CLI Example:
.. code-block:: bash
salt '*' mongodb.user_list <user> <password> <host> <port> <database> | [
"List",
"users",
"of",
"a",
"MongoDB",
"database"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mongodb.py#L208-L245 |
34,098 | saltstack/salt | salt/modules/mongodb.py | user_exists | def user_exists(name, user=None, password=None, host=None, port=None,
database='admin', authdb=None):
'''
Checks if a user exists in MongoDB
CLI Example:
.. code-block:: bash
salt '*' mongodb.user_exists <name> <user> <password> <host> <port> <database>
'''
users = use... | python | def user_exists(name, user=None, password=None, host=None, port=None,
database='admin', authdb=None):
'''
Checks if a user exists in MongoDB
CLI Example:
.. code-block:: bash
salt '*' mongodb.user_exists <name> <user> <password> <host> <port> <database>
'''
users = use... | [
"def",
"user_exists",
"(",
"name",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"database",
"=",
"'admin'",
",",
"authdb",
"=",
"None",
")",
":",
"users",
"=",
"user_list",
"(",
"u... | Checks if a user exists in MongoDB
CLI Example:
.. code-block:: bash
salt '*' mongodb.user_exists <name> <user> <password> <host> <port> <database> | [
"Checks",
"if",
"a",
"user",
"exists",
"in",
"MongoDB"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mongodb.py#L248-L268 |
34,099 | saltstack/salt | salt/modules/mongodb.py | user_create | def user_create(name, passwd, user=None, password=None, host=None, port=None,
database='admin', authdb=None, roles=None):
'''
Create a MongoDB user
CLI Example:
.. code-block:: bash
salt '*' mongodb.user_create <user_name> <user_password> <roles> <user> <password> <host> <port... | python | def user_create(name, passwd, user=None, password=None, host=None, port=None,
database='admin', authdb=None, roles=None):
'''
Create a MongoDB user
CLI Example:
.. code-block:: bash
salt '*' mongodb.user_create <user_name> <user_password> <roles> <user> <password> <host> <port... | [
"def",
"user_create",
"(",
"name",
",",
"passwd",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"database",
"=",
"'admin'",
",",
"authdb",
"=",
"None",
",",
"roles",
"=",
"None",
")... | Create a MongoDB user
CLI Example:
.. code-block:: bash
salt '*' mongodb.user_create <user_name> <user_password> <roles> <user> <password> <host> <port> <database> | [
"Create",
"a",
"MongoDB",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mongodb.py#L271-L296 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.