repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
saltstack/salt
salt/modules/napalm_network.py
_explicit_close
def _explicit_close(napalm_device): ''' Will explicily close the config session with the network device, when running in a now-always-alive proxy minion or regular minion. This helper must be used in configuration-related functions, as the session is preserved and not closed before making any change...
python
def _explicit_close(napalm_device): ''' Will explicily close the config session with the network device, when running in a now-always-alive proxy minion or regular minion. This helper must be used in configuration-related functions, as the session is preserved and not closed before making any change...
[ "def", "_explicit_close", "(", "napalm_device", ")", ":", "if", "salt", ".", "utils", ".", "napalm", ".", "not_always_alive", "(", "__opts__", ")", ":", "# force closing the configuration session", "# when running in a non-always-alive proxy", "# or regular minion", "try", ...
Will explicily close the config session with the network device, when running in a now-always-alive proxy minion or regular minion. This helper must be used in configuration-related functions, as the session is preserved and not closed before making any changes.
[ "Will", "explicily", "close", "the", "config", "session", "with", "the", "network", "device", "when", "running", "in", "a", "now", "-", "always", "-", "alive", "proxy", "minion", "or", "regular", "minion", ".", "This", "helper", "must", "be", "used", "in",...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_network.py#L142-L158
train
saltstack/salt
salt/modules/napalm_network.py
_config_logic
def _config_logic(napalm_device, loaded_result, test=False, debug=False, replace=False, commit_config=True, loaded_config=None, commit_in=None, commit_at=None, ...
python
def _config_logic(napalm_device, loaded_result, test=False, debug=False, replace=False, commit_config=True, loaded_config=None, commit_in=None, commit_at=None, ...
[ "def", "_config_logic", "(", "napalm_device", ",", "loaded_result", ",", "test", "=", "False", ",", "debug", "=", "False", ",", "replace", "=", "False", ",", "commit_config", "=", "True", ",", "loaded_config", "=", "None", ",", "commit_in", "=", "None", ",...
Builds the config logic for `load_config` and `load_template` functions.
[ "Builds", "the", "config", "logic", "for", "load_config", "and", "load_template", "functions", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_network.py#L161-L345
train
saltstack/salt
salt/modules/napalm_network.py
cli
def cli(*commands, **kwargs): # pylint: disable=unused-argument ''' Returns a dictionary with the raw output of all commands passed as arguments. commands List of commands to be executed on the device. textfsm_parse: ``False`` Try parsing the outputs using the TextFSM templates. ...
python
def cli(*commands, **kwargs): # pylint: disable=unused-argument ''' Returns a dictionary with the raw output of all commands passed as arguments. commands List of commands to be executed on the device. textfsm_parse: ``False`` Try parsing the outputs using the TextFSM templates. ...
[ "def", "cli", "(", "*", "commands", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "raw_cli_outputs", "=", "salt", ".", "utils", ".", "napalm", ".", "call", "(", "napalm_device", ",", "# pylint: disable=undefined-variable", "'cli'", ",", ...
Returns a dictionary with the raw output of all commands passed as arguments. commands List of commands to be executed on the device. textfsm_parse: ``False`` Try parsing the outputs using the TextFSM templates. .. versionadded:: 2018.3.0 .. note:: This option can...
[ "Returns", "a", "dictionary", "with", "the", "raw", "output", "of", "all", "commands", "passed", "as", "arguments", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_network.py#L492-L783
train
saltstack/salt
salt/modules/napalm_network.py
traceroute
def traceroute(destination, source=None, ttl=None, timeout=None, vrf=None, **kwargs): # pylint: disable=unused-argument ''' Calls the method traceroute from the NAPALM driver object and returns a dictionary with the result of the traceroute command executed on the device. destination Hostname...
python
def traceroute(destination, source=None, ttl=None, timeout=None, vrf=None, **kwargs): # pylint: disable=unused-argument ''' Calls the method traceroute from the NAPALM driver object and returns a dictionary with the result of the traceroute command executed on the device. destination Hostname...
[ "def", "traceroute", "(", "destination", ",", "source", "=", "None", ",", "ttl", "=", "None", ",", "timeout", "=", "None", ",", "vrf", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "return", "salt", ".", "utils", "....
Calls the method traceroute from the NAPALM driver object and returns a dictionary with the result of the traceroute command executed on the device. destination Hostname or address of remote host source Source address to use in outgoing traceroute packets ttl IP maximum time-t...
[ "Calls", "the", "method", "traceroute", "from", "the", "NAPALM", "driver", "object", "and", "returns", "a", "dictionary", "with", "the", "result", "of", "the", "traceroute", "command", "executed", "on", "the", "device", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_network.py#L787-L828
train
saltstack/salt
salt/modules/napalm_network.py
ping
def ping(destination, source=None, ttl=None, timeout=None, size=None, count=None, vrf=None, **kwargs): # pylint: disable=unused-argument ''' Executes a ping on the network device and returns a dictionary as a result. destination Hostname or IP address of remote host source Source add...
python
def ping(destination, source=None, ttl=None, timeout=None, size=None, count=None, vrf=None, **kwargs): # pylint: disable=unused-argument ''' Executes a ping on the network device and returns a dictionary as a result. destination Hostname or IP address of remote host source Source add...
[ "def", "ping", "(", "destination", ",", "source", "=", "None", ",", "ttl", "=", "None", ",", "timeout", "=", "None", ",", "size", "=", "None", ",", "count", "=", "None", ",", "vrf", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable...
Executes a ping on the network device and returns a dictionary as a result. destination Hostname or IP address of remote host source Source address of echo request ttl IP time-to-live value (IPv6 hop-limit value) (1..255 hops) timeout Maximum wait time after sending f...
[ "Executes", "a", "ping", "on", "the", "network", "device", "and", "returns", "a", "dictionary", "as", "a", "result", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_network.py#L832-L881
train
saltstack/salt
salt/modules/napalm_network.py
arp
def arp(interface='', ipaddr='', macaddr='', **kwargs): # pylint: disable=unused-argument ''' NAPALM returns a list of dictionaries with details of the ARP entries. :param interface: interface name to filter on :param ipaddr: IP address to filter on :param macaddr: MAC address to filter on :r...
python
def arp(interface='', ipaddr='', macaddr='', **kwargs): # pylint: disable=unused-argument ''' NAPALM returns a list of dictionaries with details of the ARP entries. :param interface: interface name to filter on :param ipaddr: IP address to filter on :param macaddr: MAC address to filter on :r...
[ "def", "arp", "(", "interface", "=", "''", ",", "ipaddr", "=", "''", ",", "macaddr", "=", "''", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "proxy_output", "=", "salt", ".", "utils", ".", "napalm", ".", "call", "(", "napalm_de...
NAPALM returns a list of dictionaries with details of the ARP entries. :param interface: interface name to filter on :param ipaddr: IP address to filter on :param macaddr: MAC address to filter on :return: List of the entries in the ARP table CLI Example: .. code-block:: bash salt '*...
[ "NAPALM", "returns", "a", "list", "of", "dictionaries", "with", "details", "of", "the", "ARP", "entries", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_network.py#L885-L947
train
saltstack/salt
salt/modules/napalm_network.py
lldp
def lldp(interface='', **kwargs): # pylint: disable=unused-argument ''' Returns a detailed view of the LLDP neighbors. :param interface: interface name to filter on :return: A dictionary with the LLDL neighbors. The keys are the interfaces with LLDP activated on. CLI Example: ...
python
def lldp(interface='', **kwargs): # pylint: disable=unused-argument ''' Returns a detailed view of the LLDP neighbors. :param interface: interface name to filter on :return: A dictionary with the LLDL neighbors. The keys are the interfaces with LLDP activated on. CLI Example: ...
[ "def", "lldp", "(", "interface", "=", "''", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "proxy_output", "=", "salt", ".", "utils", ".", "napalm", ".", "call", "(", "napalm_device", ",", "# pylint: disable=undefined-variable", "'get_lldp...
Returns a detailed view of the LLDP neighbors. :param interface: interface name to filter on :return: A dictionary with the LLDL neighbors. The keys are the interfaces with LLDP activated on. CLI Example: .. code-block:: bash salt '*' net.lldp salt '*' net.lldp inte...
[ "Returns", "a", "detailed", "view", "of", "the", "LLDP", "neighbors", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_network.py#L1058-L1117
train
saltstack/salt
salt/modules/napalm_network.py
mac
def mac(address='', interface='', vlan=0, **kwargs): # pylint: disable=unused-argument ''' Returns the MAC Address Table on the device. :param address: MAC address to filter on :param interface: Interface name to filter on :param vlan: VLAN identifier :return: A list of dictio...
python
def mac(address='', interface='', vlan=0, **kwargs): # pylint: disable=unused-argument ''' Returns the MAC Address Table on the device. :param address: MAC address to filter on :param interface: Interface name to filter on :param vlan: VLAN identifier :return: A list of dictio...
[ "def", "mac", "(", "address", "=", "''", ",", "interface", "=", "''", ",", "vlan", "=", "0", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "proxy_output", "=", "salt", ".", "utils", ".", "napalm", ".", "call", "(", "napalm_devic...
Returns the MAC Address Table on the device. :param address: MAC address to filter on :param interface: Interface name to filter on :param vlan: VLAN identifier :return: A list of dictionaries representing the entries in the MAC Address Table CLI Example: .. code-block:: bash ...
[ "Returns", "the", "MAC", "Address", "Table", "on", "the", "device", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_network.py#L1121-L1190
train
saltstack/salt
salt/modules/napalm_network.py
load_config
def load_config(filename=None, text=None, test=False, commit=True, debug=False, replace=False, commit_in=None, commit_at=None, revert_in=None, revert_at=None, c...
python
def load_config(filename=None, text=None, test=False, commit=True, debug=False, replace=False, commit_in=None, commit_at=None, revert_in=None, revert_at=None, c...
[ "def", "load_config", "(", "filename", "=", "None", ",", "text", "=", "None", ",", "test", "=", "False", ",", "commit", "=", "True", ",", "debug", "=", "False", ",", "replace", "=", "False", ",", "commit_in", "=", "None", ",", "commit_at", "=", "None...
Applies configuration changes on the device. It can be loaded from a file or from inline string. If you send both a filename and a string containing the configuration, the file has higher precedence. By default this function will commit the changes. If there are no changes, it does not commit and the flag ...
[ "Applies", "configuration", "changes", "on", "the", "device", ".", "It", "can", "be", "loaded", "from", "a", "file", "or", "from", "inline", "string", ".", "If", "you", "send", "both", "a", "filename", "and", "a", "string", "containing", "the", "configurat...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_network.py#L1296-L1551
train
saltstack/salt
salt/modules/napalm_network.py
load_template
def load_template(template_name=None, template_source=None, context=None, defaults=None, template_engine='jinja', saltenv='base', template_hash=None, template_hash_name=None, s...
python
def load_template(template_name=None, template_source=None, context=None, defaults=None, template_engine='jinja', saltenv='base', template_hash=None, template_hash_name=None, s...
[ "def", "load_template", "(", "template_name", "=", "None", ",", "template_source", "=", "None", ",", "context", "=", "None", ",", "defaults", "=", "None", ",", "template_engine", "=", "'jinja'", ",", "saltenv", "=", "'base'", ",", "template_hash", "=", "None...
Renders a configuration template (default: Jinja) and loads the result on the device. By default this function will commit the changes. If there are no changes, it does not commit, discards he config and the flag ``already_configured`` will be set as ``True`` to point this out. To avoid committing the...
[ "Renders", "a", "configuration", "template", "(", "default", ":", "Jinja", ")", "and", "loads", "the", "result", "on", "the", "device", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_network.py#L1555-L2082
train
saltstack/salt
salt/modules/napalm_network.py
config_changed
def config_changed(inherit_napalm_device=None, **kwargs): # pylint: disable=unused-argument ''' Will prompt if the configuration has been changed. :return: A tuple with a boolean that specifies if the config was changed on the device.\ And a string that provides more details of the reason why the con...
python
def config_changed(inherit_napalm_device=None, **kwargs): # pylint: disable=unused-argument ''' Will prompt if the configuration has been changed. :return: A tuple with a boolean that specifies if the config was changed on the device.\ And a string that provides more details of the reason why the con...
[ "def", "config_changed", "(", "inherit_napalm_device", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "is_config_changed", "=", "False", "reason", "=", "''", "try_compare", "=", "compare_config", "(", "inherit_napalm_device", "=",...
Will prompt if the configuration has been changed. :return: A tuple with a boolean that specifies if the config was changed on the device.\ And a string that provides more details of the reason why the configuration was not changed. CLI Example: .. code-block:: bash salt '*' net.config_chang...
[ "Will", "prompt", "if", "the", "configuration", "has", "been", "changed", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_network.py#L2166-L2193
train
saltstack/salt
salt/modules/napalm_network.py
config_control
def config_control(inherit_napalm_device=None, **kwargs): # pylint: disable=unused-argument ''' Will check if the configuration was changed. If differences found, will try to commit. In case commit unsuccessful, will try to rollback. :return: A tuple with a boolean that specifies if the config wa...
python
def config_control(inherit_napalm_device=None, **kwargs): # pylint: disable=unused-argument ''' Will check if the configuration was changed. If differences found, will try to commit. In case commit unsuccessful, will try to rollback. :return: A tuple with a boolean that specifies if the config wa...
[ "def", "config_control", "(", "inherit_napalm_device", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "result", "=", "True", "comment", "=", "''", "changed", ",", "not_changed_rsn", "=", "config_changed", "(", "inherit_napalm_de...
Will check if the configuration was changed. If differences found, will try to commit. In case commit unsuccessful, will try to rollback. :return: A tuple with a boolean that specifies if the config was changed/committed/rollbacked on the device.\ And a string that provides more details of the reason w...
[ "Will", "check", "if", "the", "configuration", "was", "changed", ".", "If", "differences", "found", "will", "try", "to", "commit", ".", "In", "case", "commit", "unsuccessful", "will", "try", "to", "rollback", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_network.py#L2197-L2235
train
saltstack/salt
salt/modules/napalm_network.py
cancel_commit
def cancel_commit(jid): ''' .. versionadded:: 2019.2.0 Cancel a commit scheduled to be executed via the ``commit_in`` and ``commit_at`` arguments from the :py:func:`net.load_template <salt.modules.napalm_network.load_template>` or :py:func:`net.load_config <salt.modules.napalm_network.load_conf...
python
def cancel_commit(jid): ''' .. versionadded:: 2019.2.0 Cancel a commit scheduled to be executed via the ``commit_in`` and ``commit_at`` arguments from the :py:func:`net.load_template <salt.modules.napalm_network.load_template>` or :py:func:`net.load_config <salt.modules.napalm_network.load_conf...
[ "def", "cancel_commit", "(", "jid", ")", ":", "job_name", "=", "'__napalm_commit_{}'", ".", "format", "(", "jid", ")", "removed", "=", "__salt__", "[", "'schedule.delete'", "]", "(", "job_name", ")", "if", "removed", "[", "'result'", "]", ":", "saved", "="...
.. versionadded:: 2019.2.0 Cancel a commit scheduled to be executed via the ``commit_in`` and ``commit_at`` arguments from the :py:func:`net.load_template <salt.modules.napalm_network.load_template>` or :py:func:`net.load_config <salt.modules.napalm_network.load_config>` execution functions. The co...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_network.py#L2238-L2262
train
saltstack/salt
salt/modules/napalm_network.py
confirm_commit
def confirm_commit(jid): ''' .. versionadded:: 2019.2.0 Confirm a commit scheduled to be reverted via the ``revert_in`` and ``revert_at`` arguments from the :mod:`net.load_template <salt.modules.napalm_network.load_template>` or :mod:`net.load_config <salt.modules.napalm_network.load_config>` ...
python
def confirm_commit(jid): ''' .. versionadded:: 2019.2.0 Confirm a commit scheduled to be reverted via the ``revert_in`` and ``revert_at`` arguments from the :mod:`net.load_template <salt.modules.napalm_network.load_template>` or :mod:`net.load_config <salt.modules.napalm_network.load_config>` ...
[ "def", "confirm_commit", "(", "jid", ")", ":", "if", "__grains__", "[", "'os'", "]", "==", "'junos'", ":", "# Confirm the commit, by committing (i.e., invoking the RPC call)", "confirmed", "=", "__salt__", "[", "'napalm.junos_commit'", "]", "(", ")", "confirmed", "[",...
.. versionadded:: 2019.2.0 Confirm a commit scheduled to be reverted via the ``revert_in`` and ``revert_at`` arguments from the :mod:`net.load_template <salt.modules.napalm_network.load_template>` or :mod:`net.load_config <salt.modules.napalm_network.load_config>` execution functions. The commit I...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_network.py#L2265-L2291
train
saltstack/salt
salt/modules/napalm_network.py
save_config
def save_config(source=None, path=None): ''' .. versionadded:: 2019.2.0 Save the configuration to a file on the local file system. source: ``running`` The configuration source. Choose from: ``running``, ``candidate``, ``startup``. Default: ``running``. path ...
python
def save_config(source=None, path=None): ''' .. versionadded:: 2019.2.0 Save the configuration to a file on the local file system. source: ``running`` The configuration source. Choose from: ``running``, ``candidate``, ``startup``. Default: ``running``. path ...
[ "def", "save_config", "(", "source", "=", "None", ",", "path", "=", "None", ")", ":", "if", "not", "source", ":", "source", "=", "'running'", "if", "not", "path", ":", "path", "=", "salt", ".", "utils", ".", "files", ".", "mkstemp", "(", ")", "runn...
.. versionadded:: 2019.2.0 Save the configuration to a file on the local file system. source: ``running`` The configuration source. Choose from: ``running``, ``candidate``, ``startup``. Default: ``running``. path Absolute path to file where to save the configuration. To pu...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_network.py#L2294-L2330
train
saltstack/salt
salt/modules/napalm_network.py
replace_pattern
def replace_pattern(pattern, repl, count=0, flags=8, bufsize=1, append_if_not_found=False, prepend_if_not_found=False, not_found_content=None, search_only=False...
python
def replace_pattern(pattern, repl, count=0, flags=8, bufsize=1, append_if_not_found=False, prepend_if_not_found=False, not_found_content=None, search_only=False...
[ "def", "replace_pattern", "(", "pattern", ",", "repl", ",", "count", "=", "0", ",", "flags", "=", "8", ",", "bufsize", "=", "1", ",", "append_if_not_found", "=", "False", ",", "prepend_if_not_found", "=", "False", ",", "not_found_content", "=", "None", ","...
.. versionadded:: 2019.2.0 Replace occurrences of a pattern in the configuration source. If ``show_changes`` is ``True``, then a diff of what changed will be returned, otherwise a ``True`` will be returned when changes are made, and ``False`` when no changes are made. This is a pure Python implemen...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_network.py#L2333-L2473
train
saltstack/salt
salt/modules/napalm_network.py
blockreplace
def blockreplace(marker_start, marker_end, content='', append_if_not_found=False, prepend_if_not_found=False, show_changes=True, append_newline=False, source='running', path=None, ...
python
def blockreplace(marker_start, marker_end, content='', append_if_not_found=False, prepend_if_not_found=False, show_changes=True, append_newline=False, source='running', path=None, ...
[ "def", "blockreplace", "(", "marker_start", ",", "marker_end", ",", "content", "=", "''", ",", "append_if_not_found", "=", "False", ",", "prepend_if_not_found", "=", "False", ",", "show_changes", "=", "True", ",", "append_newline", "=", "False", ",", "source", ...
.. versionadded:: 2019.2.0 Replace content of the configuration source, delimited by the line markers. A block of content delimited by comments can help you manage several lines without worrying about old entries removal. marker_start The line content identifying a line as the start of the co...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_network.py#L2476-L2582
train
saltstack/salt
salt/modules/napalm_network.py
patch
def patch(patchfile, options='', saltenv='base', source_hash=None, show_changes=True, source='running', path=None, test=False, commit=True, debug=False, replace=True): ''' .. versionadded:: 2019.2.0 Apply a ...
python
def patch(patchfile, options='', saltenv='base', source_hash=None, show_changes=True, source='running', path=None, test=False, commit=True, debug=False, replace=True): ''' .. versionadded:: 2019.2.0 Apply a ...
[ "def", "patch", "(", "patchfile", ",", "options", "=", "''", ",", "saltenv", "=", "'base'", ",", "source_hash", "=", "None", ",", "show_changes", "=", "True", ",", "source", "=", "'running'", ",", "path", "=", "None", ",", "test", "=", "False", ",", ...
.. versionadded:: 2019.2.0 Apply a patch to the configuration source, and load the result into the running config of the device. patchfile A patch file to apply to the configuration source. options Options to pass to patch. source_hash If the patch file (specified via the...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_network.py#L2585-L2670
train
saltstack/salt
salt/cli/run.py
SaltRun.run
def run(self): ''' Execute salt-run ''' import salt.runner self.parse_args() # Setup file logging! self.setup_logfile_logger() verify_log(self.config) profiling_enabled = self.options.profiling_enabled runner = salt.runner.Runner(self.con...
python
def run(self): ''' Execute salt-run ''' import salt.runner self.parse_args() # Setup file logging! self.setup_logfile_logger() verify_log(self.config) profiling_enabled = self.options.profiling_enabled runner = salt.runner.Runner(self.con...
[ "def", "run", "(", "self", ")", ":", "import", "salt", ".", "runner", "self", ".", "parse_args", "(", ")", "# Setup file logging!", "self", ".", "setup_logfile_logger", "(", ")", "verify_log", "(", "self", ".", "config", ")", "profiling_enabled", "=", "self"...
Execute salt-run
[ "Execute", "salt", "-", "run" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/run.py#L17-L58
train
saltstack/salt
salt/states/dellchassis.py
blade_idrac
def blade_idrac(name, idrac_password=None, idrac_ipmi=None, idrac_ip=None, idrac_netmask=None, idrac_gateway=None, idrac_dnsname=None, idrac_dhcp=None): ''' Set parameters for iDRAC in a blade. :param idrac_password: Password to use to connect to the iDRACs d...
python
def blade_idrac(name, idrac_password=None, idrac_ipmi=None, idrac_ip=None, idrac_netmask=None, idrac_gateway=None, idrac_dnsname=None, idrac_dhcp=None): ''' Set parameters for iDRAC in a blade. :param idrac_password: Password to use to connect to the iDRACs d...
[ "def", "blade_idrac", "(", "name", ",", "idrac_password", "=", "None", ",", "idrac_ipmi", "=", "None", ",", "idrac_ip", "=", "None", ",", "idrac_netmask", "=", "None", ",", "idrac_gateway", "=", "None", ",", "idrac_dnsname", "=", "None", ",", "idrac_dhcp", ...
Set parameters for iDRAC in a blade. :param idrac_password: Password to use to connect to the iDRACs directly (idrac_ipmi and idrac_dnsname must be set directly on the iDRAC. They can't be set through the CMC. If this password is present, use it instead of the CMC password) :param idr...
[ "Set", "parameters", "for", "iDRAC", "in", "a", "blade", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/dellchassis.py#L174-L317
train
saltstack/salt
salt/states/dellchassis.py
chassis
def chassis(name, chassis_name=None, password=None, datacenter=None, location=None, mode=None, idrac_launch=None, slot_names=None, blade_power_states=None): ''' Manage a Dell Chassis. chassis_name The name of the chassis. datacenter The datacenter in which the c...
python
def chassis(name, chassis_name=None, password=None, datacenter=None, location=None, mode=None, idrac_launch=None, slot_names=None, blade_power_states=None): ''' Manage a Dell Chassis. chassis_name The name of the chassis. datacenter The datacenter in which the c...
[ "def", "chassis", "(", "name", ",", "chassis_name", "=", "None", ",", "password", "=", "None", ",", "datacenter", "=", "None", ",", "location", "=", "None", ",", "mode", "=", "None", ",", "idrac_launch", "=", "None", ",", "slot_names", "=", "None", ","...
Manage a Dell Chassis. chassis_name The name of the chassis. datacenter The datacenter in which the chassis is located location The location of the chassis. password Password for the chassis. Note: If this password is set for the chassis, the current implement...
[ "Manage", "a", "Dell", "Chassis", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/dellchassis.py#L320-L546
train
saltstack/salt
salt/states/dellchassis.py
switch
def switch(name, ip=None, netmask=None, gateway=None, dhcp=None, password=None, snmp=None): ''' Manage switches in a Dell Chassis. name The switch designation (e.g. switch-1, switch-2) ip The Static IP Address of the switch netmask The netmask for the stati...
python
def switch(name, ip=None, netmask=None, gateway=None, dhcp=None, password=None, snmp=None): ''' Manage switches in a Dell Chassis. name The switch designation (e.g. switch-1, switch-2) ip The Static IP Address of the switch netmask The netmask for the stati...
[ "def", "switch", "(", "name", ",", "ip", "=", "None", ",", "netmask", "=", "None", ",", "gateway", "=", "None", ",", "dhcp", "=", "None", ",", "password", "=", "None", ",", "snmp", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ...
Manage switches in a Dell Chassis. name The switch designation (e.g. switch-1, switch-2) ip The Static IP Address of the switch netmask The netmask for the static IP gateway The gateway for the static IP dhcp True: Enable DHCP False: Do not change...
[ "Manage", "switches", "in", "a", "Dell", "Chassis", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/dellchassis.py#L549-L664
train
saltstack/salt
salt/states/dellchassis.py
_firmware_update
def _firmware_update(firmwarefile='', host='', directory=''): ''' Update firmware for a single host ''' dest = os.path.join(directory, firmwarefile[7:]) __salt__['cp.get_file'](firmwarefile, dest) username = __pillar__['proxy']['admin_user'] password = __pillar__['prox...
python
def _firmware_update(firmwarefile='', host='', directory=''): ''' Update firmware for a single host ''' dest = os.path.join(directory, firmwarefile[7:]) __salt__['cp.get_file'](firmwarefile, dest) username = __pillar__['proxy']['admin_user'] password = __pillar__['prox...
[ "def", "_firmware_update", "(", "firmwarefile", "=", "''", ",", "host", "=", "''", ",", "directory", "=", "''", ")", ":", "dest", "=", "os", ".", "path", ".", "join", "(", "directory", ",", "firmwarefile", "[", "7", ":", "]", ")", "__salt__", "[", ...
Update firmware for a single host
[ "Update", "firmware", "for", "a", "single", "host" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/dellchassis.py#L667-L681
train
saltstack/salt
salt/states/dellchassis.py
firmware_update
def firmware_update(hosts=None, directory=''): ''' State to update the firmware on host using the ``racadm`` command firmwarefile filename (string) starting with ``salt://`` host string representing the hostname supplied to the ``racadm`` command ...
python
def firmware_update(hosts=None, directory=''): ''' State to update the firmware on host using the ``racadm`` command firmwarefile filename (string) starting with ``salt://`` host string representing the hostname supplied to the ``racadm`` command ...
[ "def", "firmware_update", "(", "hosts", "=", "None", ",", "directory", "=", "''", ")", ":", "ret", "=", "{", "}", "ret", ".", "changes", "=", "{", "}", "success", "=", "True", "for", "host", ",", "firmwarefile", "in", "hosts", ":", "try", ":", "_fi...
State to update the firmware on host using the ``racadm`` command firmwarefile filename (string) starting with ``salt://`` host string representing the hostname supplied to the ``racadm`` command directory Directory name where firmwarefile...
[ "State", "to", "update", "the", "firmware", "on", "host", "using", "the", "racadm", "command" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/dellchassis.py#L684-L731
train
saltstack/salt
salt/transport/tcp.py
_set_tcp_keepalive
def _set_tcp_keepalive(sock, opts): ''' Ensure that TCP keepalives are set for the socket. ''' if hasattr(socket, 'SO_KEEPALIVE'): if opts.get('tcp_keepalive', False): sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) if hasattr(socket, 'SOL_TCP'): ...
python
def _set_tcp_keepalive(sock, opts): ''' Ensure that TCP keepalives are set for the socket. ''' if hasattr(socket, 'SO_KEEPALIVE'): if opts.get('tcp_keepalive', False): sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) if hasattr(socket, 'SOL_TCP'): ...
[ "def", "_set_tcp_keepalive", "(", "sock", ",", "opts", ")", ":", "if", "hasattr", "(", "socket", ",", "'SO_KEEPALIVE'", ")", ":", "if", "opts", ".", "get", "(", "'tcp_keepalive'", ",", "False", ")", ":", "sock", ".", "setsockopt", "(", "socket", ".", "...
Ensure that TCP keepalives are set for the socket.
[ "Ensure", "that", "TCP", "keepalives", "are", "set", "for", "the", "socket", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L83-L135
train
saltstack/salt
salt/transport/tcp.py
AsyncTCPReqChannel._crypted_transfer
def _crypted_transfer(self, load, tries=3, timeout=60): ''' In case of authentication errors, try to renegotiate authentication and retry the method. Indeed, we can fail too early in case of a master restart during a minion state execution call ''' @tornado.gen.co...
python
def _crypted_transfer(self, load, tries=3, timeout=60): ''' In case of authentication errors, try to renegotiate authentication and retry the method. Indeed, we can fail too early in case of a master restart during a minion state execution call ''' @tornado.gen.co...
[ "def", "_crypted_transfer", "(", "self", ",", "load", ",", "tries", "=", "3", ",", "timeout", "=", "60", ")", ":", "@", "tornado", ".", "gen", ".", "coroutine", "def", "_do_transfer", "(", ")", ":", "data", "=", "yield", "self", ".", "message_client", ...
In case of authentication errors, try to renegotiate authentication and retry the method. Indeed, we can fail too early in case of a master restart during a minion state execution call
[ "In", "case", "of", "authentication", "errors", "try", "to", "renegotiate", "authentication", "and", "retry", "the", "method", ".", "Indeed", "we", "can", "fail", "too", "early", "in", "case", "of", "a", "master", "restart", "during", "a", "minion", "state",...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L361-L391
train
saltstack/salt
salt/transport/tcp.py
AsyncTCPPubChannel.send_id
def send_id(self, tok, force_auth): ''' Send the minion id to the master so that the master may better track the connection state of the minion. In case of authentication errors, try to renegotiate authentication and retry the method. ''' load = {'id': self.opts['...
python
def send_id(self, tok, force_auth): ''' Send the minion id to the master so that the master may better track the connection state of the minion. In case of authentication errors, try to renegotiate authentication and retry the method. ''' load = {'id': self.opts['...
[ "def", "send_id", "(", "self", ",", "tok", ",", "force_auth", ")", ":", "load", "=", "{", "'id'", ":", "self", ".", "opts", "[", "'id'", "]", ",", "'tok'", ":", "tok", "}", "@", "tornado", ".", "gen", ".", "coroutine", "def", "_do_transfer", "(", ...
Send the minion id to the master so that the master may better track the connection state of the minion. In case of authentication errors, try to renegotiate authentication and retry the method.
[ "Send", "the", "minion", "id", "to", "the", "master", "so", "that", "the", "master", "may", "better", "track", "the", "connection", "state", "of", "the", "minion", ".", "In", "case", "of", "authentication", "errors", "try", "to", "renegotiate", "authenticati...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L451-L482
train
saltstack/salt
salt/transport/tcp.py
AsyncTCPPubChannel.on_recv
def on_recv(self, callback): ''' Register an on_recv callback ''' if callback is None: return self.message_client.on_recv(callback) @tornado.gen.coroutine def wrap_callback(body): if not isinstance(body, dict): # TODO: For some rea...
python
def on_recv(self, callback): ''' Register an on_recv callback ''' if callback is None: return self.message_client.on_recv(callback) @tornado.gen.coroutine def wrap_callback(body): if not isinstance(body, dict): # TODO: For some rea...
[ "def", "on_recv", "(", "self", ",", "callback", ")", ":", "if", "callback", "is", "None", ":", "return", "self", ".", "message_client", ".", "on_recv", "(", "callback", ")", "@", "tornado", ".", "gen", ".", "coroutine", "def", "wrap_callback", "(", "body...
Register an on_recv callback
[ "Register", "an", "on_recv", "callback" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L579-L596
train
saltstack/salt
salt/transport/tcp.py
TCPReqServerChannel.pre_fork
def pre_fork(self, process_manager): ''' Pre-fork we need to create the zmq router device ''' salt.transport.mixins.auth.AESReqServerMixin.pre_fork(self, process_manager) if USE_LOAD_BALANCER: self.socket_queue = multiprocessing.Queue() process_manager.add...
python
def pre_fork(self, process_manager): ''' Pre-fork we need to create the zmq router device ''' salt.transport.mixins.auth.AESReqServerMixin.pre_fork(self, process_manager) if USE_LOAD_BALANCER: self.socket_queue = multiprocessing.Queue() process_manager.add...
[ "def", "pre_fork", "(", "self", ",", "process_manager", ")", ":", "salt", ".", "transport", ".", "mixins", ".", "auth", ".", "AESReqServerMixin", ".", "pre_fork", "(", "self", ",", "process_manager", ")", "if", "USE_LOAD_BALANCER", ":", "self", ".", "socket_...
Pre-fork we need to create the zmq router device
[ "Pre", "-", "fork", "we", "need", "to", "create", "the", "zmq", "router", "device" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L633-L648
train
saltstack/salt
salt/transport/tcp.py
TCPReqServerChannel.post_fork
def post_fork(self, payload_handler, io_loop): ''' After forking we need to create all of the local sockets to listen to the router payload_handler: function to call with your payloads ''' self.payload_handler = payload_handler self.io_loop = io_loop self...
python
def post_fork(self, payload_handler, io_loop): ''' After forking we need to create all of the local sockets to listen to the router payload_handler: function to call with your payloads ''' self.payload_handler = payload_handler self.io_loop = io_loop self...
[ "def", "post_fork", "(", "self", ",", "payload_handler", ",", "io_loop", ")", ":", "self", ".", "payload_handler", "=", "payload_handler", "self", ".", "io_loop", "=", "io_loop", "self", ".", "serial", "=", "salt", ".", "payload", ".", "Serial", "(", "self...
After forking we need to create all of the local sockets to listen to the router payload_handler: function to call with your payloads
[ "After", "forking", "we", "need", "to", "create", "all", "of", "the", "local", "sockets", "to", "listen", "to", "the", "router" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L650-L676
train
saltstack/salt
salt/transport/tcp.py
TCPReqServerChannel.handle_message
def handle_message(self, stream, header, payload): ''' Handle incoming messages from underylying tcp streams ''' try: try: payload = self._decode_payload(payload) except Exception: stream.write(salt.transport.frame.frame_msg('bad lo...
python
def handle_message(self, stream, header, payload): ''' Handle incoming messages from underylying tcp streams ''' try: try: payload = self._decode_payload(payload) except Exception: stream.write(salt.transport.frame.frame_msg('bad lo...
[ "def", "handle_message", "(", "self", ",", "stream", ",", "header", ",", "payload", ")", ":", "try", ":", "try", ":", "payload", "=", "self", ".", "_decode_payload", "(", "payload", ")", "except", "Exception", ":", "stream", ".", "write", "(", "salt", ...
Handle incoming messages from underylying tcp streams
[ "Handle", "incoming", "messages", "from", "underylying", "tcp", "streams" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L679-L750
train
saltstack/salt
salt/transport/tcp.py
SaltMessageServer.handle_stream
def handle_stream(self, stream, address): ''' Handle incoming streams and add messages to the incoming queue ''' log.trace('Req client %s connected', address) self.clients.append((stream, address)) unpacker = msgpack.Unpacker() try: while True: ...
python
def handle_stream(self, stream, address): ''' Handle incoming streams and add messages to the incoming queue ''' log.trace('Req client %s connected', address) self.clients.append((stream, address)) unpacker = msgpack.Unpacker() try: while True: ...
[ "def", "handle_stream", "(", "self", ",", "stream", ",", "address", ")", ":", "log", ".", "trace", "(", "'Req client %s connected'", ",", "address", ")", "self", ".", "clients", ".", "append", "(", "(", "stream", ",", "address", ")", ")", "unpacker", "="...
Handle incoming streams and add messages to the incoming queue
[ "Handle", "incoming", "streams", "and", "add", "messages", "to", "the", "incoming", "queue" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L766-L791
train
saltstack/salt
salt/transport/tcp.py
SaltMessageServer.shutdown
def shutdown(self): ''' Shutdown the whole server ''' for item in self.clients: client, address = item client.close() self.clients.remove(item)
python
def shutdown(self): ''' Shutdown the whole server ''' for item in self.clients: client, address = item client.close() self.clients.remove(item)
[ "def", "shutdown", "(", "self", ")", ":", "for", "item", "in", "self", ".", "clients", ":", "client", ",", "address", "=", "item", "client", ".", "close", "(", ")", "self", ".", "clients", ".", "remove", "(", "item", ")" ]
Shutdown the whole server
[ "Shutdown", "the", "whole", "server" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L793-L800
train
saltstack/salt
salt/transport/tcp.py
TCPClientKeepAlive._create_stream
def _create_stream(self, max_buffer_size, af, addr, **kwargs): # pylint: disable=unused-argument ''' Override _create_stream() in TCPClient. Tornado 4.5 added the kwargs 'source_ip' and 'source_port'. Due to this, use **kwargs to swallow these and any future kwargs to maintain ...
python
def _create_stream(self, max_buffer_size, af, addr, **kwargs): # pylint: disable=unused-argument ''' Override _create_stream() in TCPClient. Tornado 4.5 added the kwargs 'source_ip' and 'source_port'. Due to this, use **kwargs to swallow these and any future kwargs to maintain ...
[ "def", "_create_stream", "(", "self", ",", "max_buffer_size", ",", "af", ",", "addr", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "# Always connect in plaintext; we'll convert to ssl if necessary", "# after one connection has completed.", "sock", "...
Override _create_stream() in TCPClient. Tornado 4.5 added the kwargs 'source_ip' and 'source_port'. Due to this, use **kwargs to swallow these and any future kwargs to maintain compatibility.
[ "Override", "_create_stream", "()", "in", "TCPClient", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L849-L866
train
saltstack/salt
salt/transport/tcp.py
SaltMessageClient._connect
def _connect(self): ''' Try to connect for the rest of time! ''' while True: if self._closing: break try: kwargs = {} if self.source_ip or self.source_port: if tornado.version_info >= (4, 5): ...
python
def _connect(self): ''' Try to connect for the rest of time! ''' while True: if self._closing: break try: kwargs = {} if self.source_ip or self.source_port: if tornado.version_info >= (4, 5): ...
[ "def", "_connect", "(", "self", ")", ":", "while", "True", ":", "if", "self", ".", "_closing", ":", "break", "try", ":", "kwargs", "=", "{", "}", "if", "self", ".", "source_ip", "or", "self", ".", "source_port", ":", "if", "tornado", ".", "version_in...
Try to connect for the rest of time!
[ "Try", "to", "connect", "for", "the", "rest", "of", "time!" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L1007-L1033
train
saltstack/salt
salt/transport/tcp.py
SaltMessageClient.on_recv
def on_recv(self, callback): ''' Register a callback for received messages (that we didn't initiate) ''' if callback is None: self._on_recv = callback else: def wrap_recv(header, body): callback(body) self._on_recv = wrap_recv
python
def on_recv(self, callback): ''' Register a callback for received messages (that we didn't initiate) ''' if callback is None: self._on_recv = callback else: def wrap_recv(header, body): callback(body) self._on_recv = wrap_recv
[ "def", "on_recv", "(", "self", ",", "callback", ")", ":", "if", "callback", "is", "None", ":", "self", ".", "_on_recv", "=", "callback", "else", ":", "def", "wrap_recv", "(", "header", ",", "body", ")", ":", "callback", "(", "body", ")", "self", ".",...
Register a callback for received messages (that we didn't initiate)
[ "Register", "a", "callback", "for", "received", "messages", "(", "that", "we", "didn", "t", "initiate", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L1142-L1151
train
saltstack/salt
salt/transport/tcp.py
SaltMessageClient.send
def send(self, msg, timeout=None, callback=None, raw=False): ''' Send given message, and return a future ''' message_id = self._message_id() header = {'mid': message_id} future = tornado.concurrent.Future() if callback is not None: def handle_future(f...
python
def send(self, msg, timeout=None, callback=None, raw=False): ''' Send given message, and return a future ''' message_id = self._message_id() header = {'mid': message_id} future = tornado.concurrent.Future() if callback is not None: def handle_future(f...
[ "def", "send", "(", "self", ",", "msg", ",", "timeout", "=", "None", ",", "callback", "=", "None", ",", "raw", "=", "False", ")", ":", "message_id", "=", "self", ".", "_message_id", "(", ")", "header", "=", "{", "'mid'", ":", "message_id", "}", "fu...
Send given message, and return a future
[ "Send", "given", "message", "and", "return", "a", "future" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L1167-L1194
train
saltstack/salt
salt/transport/tcp.py
TCPPubServerChannel._publish_daemon
def _publish_daemon(self, **kwargs): ''' Bind to the interface specified in the configuration file ''' salt.utils.process.appendproctitle(self.__class__.__name__) log_queue = kwargs.get('log_queue') if log_queue is not None: salt.log.setup.set_multiprocessing...
python
def _publish_daemon(self, **kwargs): ''' Bind to the interface specified in the configuration file ''' salt.utils.process.appendproctitle(self.__class__.__name__) log_queue = kwargs.get('log_queue') if log_queue is not None: salt.log.setup.set_multiprocessing...
[ "def", "_publish_daemon", "(", "self", ",", "*", "*", "kwargs", ")", ":", "salt", ".", "utils", ".", "process", ".", "appendproctitle", "(", "self", ".", "__class__", ".", "__name__", ")", "log_queue", "=", "kwargs", ".", "get", "(", "'log_queue'", ")", ...
Bind to the interface specified in the configuration file
[ "Bind", "to", "the", "interface", "specified", "in", "the", "configuration", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L1418-L1469
train
saltstack/salt
salt/transport/tcp.py
TCPPubServerChannel.pre_fork
def pre_fork(self, process_manager, kwargs=None): ''' Do anything necessary pre-fork. Since this is on the master side this will primarily be used to create IPC channels and create our daemon process to do the actual publishing ''' process_manager.add_process(self._publis...
python
def pre_fork(self, process_manager, kwargs=None): ''' Do anything necessary pre-fork. Since this is on the master side this will primarily be used to create IPC channels and create our daemon process to do the actual publishing ''' process_manager.add_process(self._publis...
[ "def", "pre_fork", "(", "self", ",", "process_manager", ",", "kwargs", "=", "None", ")", ":", "process_manager", ".", "add_process", "(", "self", ".", "_publish_daemon", ",", "kwargs", "=", "kwargs", ")" ]
Do anything necessary pre-fork. Since this is on the master side this will primarily be used to create IPC channels and create our daemon process to do the actual publishing
[ "Do", "anything", "necessary", "pre", "-", "fork", ".", "Since", "this", "is", "on", "the", "master", "side", "this", "will", "primarily", "be", "used", "to", "create", "IPC", "channels", "and", "create", "our", "daemon", "process", "to", "do", "the", "a...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L1471-L1477
train
saltstack/salt
salt/transport/tcp.py
TCPPubServerChannel.publish
def publish(self, load): ''' Publish "load" to minions ''' payload = {'enc': 'aes'} crypticle = salt.crypt.Crypticle(self.opts, salt.master.SMaster.secrets['aes']['secret'].value) payload['load'] = crypticle.dumps(load) if self.opts['sign_pub_messages']: ...
python
def publish(self, load): ''' Publish "load" to minions ''' payload = {'enc': 'aes'} crypticle = salt.crypt.Crypticle(self.opts, salt.master.SMaster.secrets['aes']['secret'].value) payload['load'] = crypticle.dumps(load) if self.opts['sign_pub_messages']: ...
[ "def", "publish", "(", "self", ",", "load", ")", ":", "payload", "=", "{", "'enc'", ":", "'aes'", "}", "crypticle", "=", "salt", ".", "crypt", ".", "Crypticle", "(", "self", ".", "opts", ",", "salt", ".", "master", ".", "SMaster", ".", "secrets", "...
Publish "load" to minions
[ "Publish", "load", "to", "minions" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L1479-L1520
train
saltstack/salt
salt/fileserver/gitfs.py
find_file
def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613 ''' Find the first file to match the path and ref, read the file out of git and send the path to the newly cached file ''' return _gitfs().find_file(path, tgt_env=tgt_env, **kwargs)
python
def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613 ''' Find the first file to match the path and ref, read the file out of git and send the path to the newly cached file ''' return _gitfs().find_file(path, tgt_env=tgt_env, **kwargs)
[ "def", "find_file", "(", "path", ",", "tgt_env", "=", "'base'", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=W0613", "return", "_gitfs", "(", ")", ".", "find_file", "(", "path", ",", "tgt_env", "=", "tgt_env", ",", "*", "*", "kwargs", ")" ]
Find the first file to match the path and ref, read the file out of git and send the path to the newly cached file
[ "Find", "the", "first", "file", "to", "match", "the", "path", "and", "ref", "read", "the", "file", "out", "of", "git", "and", "send", "the", "path", "to", "the", "newly", "cached", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/gitfs.py#L150-L155
train
saltstack/salt
salt/modules/debian_ip.py
_error_msg_iface
def _error_msg_iface(iface, option, expected): ''' Build an appropriate error message from a given option and a list of expected values. ''' msg = 'Invalid option -- Interface: {0}, Option: {1}, Expected: [{2}]' return msg.format(iface, option, '|'.join(str(e) for e in expected))
python
def _error_msg_iface(iface, option, expected): ''' Build an appropriate error message from a given option and a list of expected values. ''' msg = 'Invalid option -- Interface: {0}, Option: {1}, Expected: [{2}]' return msg.format(iface, option, '|'.join(str(e) for e in expected))
[ "def", "_error_msg_iface", "(", "iface", ",", "option", ",", "expected", ")", ":", "msg", "=", "'Invalid option -- Interface: {0}, Option: {1}, Expected: [{2}]'", "return", "msg", ".", "format", "(", "iface", ",", "option", ",", "'|'", ".", "join", "(", "str", "...
Build an appropriate error message from a given option and a list of expected values.
[ "Build", "an", "appropriate", "error", "message", "from", "a", "given", "option", "and", "a", "list", "of", "expected", "values", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L155-L161
train
saltstack/salt
salt/modules/debian_ip.py
_error_msg_routes
def _error_msg_routes(iface, option, expected): ''' Build an appropriate error message from a given option and a list of expected values. ''' msg = 'Invalid option -- Route interface: {0}, Option: {1}, Expected: [{2}]' return msg.format(iface, option, expected)
python
def _error_msg_routes(iface, option, expected): ''' Build an appropriate error message from a given option and a list of expected values. ''' msg = 'Invalid option -- Route interface: {0}, Option: {1}, Expected: [{2}]' return msg.format(iface, option, expected)
[ "def", "_error_msg_routes", "(", "iface", ",", "option", ",", "expected", ")", ":", "msg", "=", "'Invalid option -- Route interface: {0}, Option: {1}, Expected: [{2}]'", "return", "msg", ".", "format", "(", "iface", ",", "option", ",", "expected", ")" ]
Build an appropriate error message from a given option and a list of expected values.
[ "Build", "an", "appropriate", "error", "message", "from", "a", "given", "option", "and", "a", "list", "of", "expected", "values", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L164-L170
train
saltstack/salt
salt/modules/debian_ip.py
_error_msg_network
def _error_msg_network(option, expected): ''' Build an appropriate error message from a given option and a list of expected values. ''' msg = 'Invalid network setting -- Setting: {0}, Expected: [{1}]' return msg.format(option, '|'.join(str(e) for e in expected))
python
def _error_msg_network(option, expected): ''' Build an appropriate error message from a given option and a list of expected values. ''' msg = 'Invalid network setting -- Setting: {0}, Expected: [{1}]' return msg.format(option, '|'.join(str(e) for e in expected))
[ "def", "_error_msg_network", "(", "option", ",", "expected", ")", ":", "msg", "=", "'Invalid network setting -- Setting: {0}, Expected: [{1}]'", "return", "msg", ".", "format", "(", "option", ",", "'|'", ".", "join", "(", "str", "(", "e", ")", "for", "e", "in"...
Build an appropriate error message from a given option and a list of expected values.
[ "Build", "an", "appropriate", "error", "message", "from", "a", "given", "option", "and", "a", "list", "of", "expected", "values", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L180-L186
train
saltstack/salt
salt/modules/debian_ip.py
_raise_error_iface
def _raise_error_iface(iface, option, expected): ''' Log and raise an error with a logical formatted message. ''' msg = _error_msg_iface(iface, option, expected) log.error(msg) raise AttributeError(msg)
python
def _raise_error_iface(iface, option, expected): ''' Log and raise an error with a logical formatted message. ''' msg = _error_msg_iface(iface, option, expected) log.error(msg) raise AttributeError(msg)
[ "def", "_raise_error_iface", "(", "iface", ",", "option", ",", "expected", ")", ":", "msg", "=", "_error_msg_iface", "(", "iface", ",", "option", ",", "expected", ")", "log", ".", "error", "(", "msg", ")", "raise", "AttributeError", "(", "msg", ")" ]
Log and raise an error with a logical formatted message.
[ "Log", "and", "raise", "an", "error", "with", "a", "logical", "formatted", "message", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L193-L199
train
saltstack/salt
salt/modules/debian_ip.py
_raise_error_network
def _raise_error_network(option, expected): ''' Log and raise an error with a logical formatted message. ''' msg = _error_msg_network(option, expected) log.error(msg) raise AttributeError(msg)
python
def _raise_error_network(option, expected): ''' Log and raise an error with a logical formatted message. ''' msg = _error_msg_network(option, expected) log.error(msg) raise AttributeError(msg)
[ "def", "_raise_error_network", "(", "option", ",", "expected", ")", ":", "msg", "=", "_error_msg_network", "(", "option", ",", "expected", ")", "log", ".", "error", "(", "msg", ")", "raise", "AttributeError", "(", "msg", ")" ]
Log and raise an error with a logical formatted message.
[ "Log", "and", "raise", "an", "error", "with", "a", "logical", "formatted", "message", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L202-L208
train
saltstack/salt
salt/modules/debian_ip.py
_raise_error_routes
def _raise_error_routes(iface, option, expected): ''' Log and raise an error with a logical formatted message. ''' msg = _error_msg_routes(iface, option, expected) log.error(msg) raise AttributeError(msg)
python
def _raise_error_routes(iface, option, expected): ''' Log and raise an error with a logical formatted message. ''' msg = _error_msg_routes(iface, option, expected) log.error(msg) raise AttributeError(msg)
[ "def", "_raise_error_routes", "(", "iface", ",", "option", ",", "expected", ")", ":", "msg", "=", "_error_msg_routes", "(", "iface", ",", "option", ",", "expected", ")", "log", ".", "error", "(", "msg", ")", "raise", "AttributeError", "(", "msg", ")" ]
Log and raise an error with a logical formatted message.
[ "Log", "and", "raise", "an", "error", "with", "a", "logical", "formatted", "message", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L211-L217
train
saltstack/salt
salt/modules/debian_ip.py
_read_file
def _read_file(path): ''' Reads and returns the contents of a text file ''' try: with salt.utils.files.flopen(path, 'rb') as contents: return [salt.utils.stringutils.to_str(line) for line in contents.readlines()] except (OSError, IOError): return ''
python
def _read_file(path): ''' Reads and returns the contents of a text file ''' try: with salt.utils.files.flopen(path, 'rb') as contents: return [salt.utils.stringutils.to_str(line) for line in contents.readlines()] except (OSError, IOError): return ''
[ "def", "_read_file", "(", "path", ")", ":", "try", ":", "with", "salt", ".", "utils", ".", "files", ".", "flopen", "(", "path", ",", "'rb'", ")", "as", "contents", ":", "return", "[", "salt", ".", "utils", ".", "stringutils", ".", "to_str", "(", "l...
Reads and returns the contents of a text file
[ "Reads", "and", "returns", "the", "contents", "of", "a", "text", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L220-L228
train
saltstack/salt
salt/modules/debian_ip.py
_parse_current_network_settings
def _parse_current_network_settings(): ''' Parse /etc/default/networking and return current configuration ''' opts = salt.utils.odict.OrderedDict() opts['networking'] = '' if os.path.isfile(_DEB_NETWORKING_FILE): with salt.utils.files.fopen(_DEB_NETWORKING_FILE) as contents: ...
python
def _parse_current_network_settings(): ''' Parse /etc/default/networking and return current configuration ''' opts = salt.utils.odict.OrderedDict() opts['networking'] = '' if os.path.isfile(_DEB_NETWORKING_FILE): with salt.utils.files.fopen(_DEB_NETWORKING_FILE) as contents: ...
[ "def", "_parse_current_network_settings", "(", ")", ":", "opts", "=", "salt", ".", "utils", ".", "odict", ".", "OrderedDict", "(", ")", "opts", "[", "'networking'", "]", "=", "''", "if", "os", ".", "path", ".", "isfile", "(", "_DEB_NETWORKING_FILE", ")", ...
Parse /etc/default/networking and return current configuration
[ "Parse", "/", "etc", "/", "default", "/", "networking", "and", "return", "current", "configuration" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L263-L286
train
saltstack/salt
salt/modules/debian_ip.py
__int
def __int(value): '''validate an integer''' valid, _value = False, value try: _value = int(value) valid = True except ValueError: pass return (valid, _value, 'integer')
python
def __int(value): '''validate an integer''' valid, _value = False, value try: _value = int(value) valid = True except ValueError: pass return (valid, _value, 'integer')
[ "def", "__int", "(", "value", ")", ":", "valid", ",", "_value", "=", "False", ",", "value", "try", ":", "_value", "=", "int", "(", "value", ")", "valid", "=", "True", "except", "ValueError", ":", "pass", "return", "(", "valid", ",", "_value", ",", ...
validate an integer
[ "validate", "an", "integer" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L315-L323
train
saltstack/salt
salt/modules/debian_ip.py
__float
def __float(value): '''validate a float''' valid, _value = False, value try: _value = float(value) valid = True except ValueError: pass return (valid, _value, 'float')
python
def __float(value): '''validate a float''' valid, _value = False, value try: _value = float(value) valid = True except ValueError: pass return (valid, _value, 'float')
[ "def", "__float", "(", "value", ")", ":", "valid", ",", "_value", "=", "False", ",", "value", "try", ":", "_value", "=", "float", "(", "value", ")", "valid", "=", "True", "except", "ValueError", ":", "pass", "return", "(", "valid", ",", "_value", ","...
validate a float
[ "validate", "a", "float" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L326-L334
train
saltstack/salt
salt/modules/debian_ip.py
__ipv4_netmask
def __ipv4_netmask(value): '''validate an IPv4 dotted quad or integer CIDR netmask''' valid, errmsg = False, 'dotted quad or integer CIDR (0->32)' valid, value, _ = __int(value) if not (valid and 0 <= value <= 32): valid = salt.utils.validate.net.netmask(value) return (valid, value, errmsg)
python
def __ipv4_netmask(value): '''validate an IPv4 dotted quad or integer CIDR netmask''' valid, errmsg = False, 'dotted quad or integer CIDR (0->32)' valid, value, _ = __int(value) if not (valid and 0 <= value <= 32): valid = salt.utils.validate.net.netmask(value) return (valid, value, errmsg)
[ "def", "__ipv4_netmask", "(", "value", ")", ":", "valid", ",", "errmsg", "=", "False", ",", "'dotted quad or integer CIDR (0->32)'", "valid", ",", "value", ",", "_", "=", "__int", "(", "value", ")", "if", "not", "(", "valid", "and", "0", "<=", "value", "...
validate an IPv4 dotted quad or integer CIDR netmask
[ "validate", "an", "IPv4", "dotted", "quad", "or", "integer", "CIDR", "netmask" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L337-L343
train
saltstack/salt
salt/modules/debian_ip.py
__ipv6_netmask
def __ipv6_netmask(value): '''validate an IPv6 integer netmask''' valid, errmsg = False, 'IPv6 netmask (0->128)' valid, value, _ = __int(value) valid = (valid and 0 <= value <= 128) return (valid, value, errmsg)
python
def __ipv6_netmask(value): '''validate an IPv6 integer netmask''' valid, errmsg = False, 'IPv6 netmask (0->128)' valid, value, _ = __int(value) valid = (valid and 0 <= value <= 128) return (valid, value, errmsg)
[ "def", "__ipv6_netmask", "(", "value", ")", ":", "valid", ",", "errmsg", "=", "False", ",", "'IPv6 netmask (0->128)'", "valid", ",", "value", ",", "_", "=", "__int", "(", "value", ")", "valid", "=", "(", "valid", "and", "0", "<=", "value", "<=", "128",...
validate an IPv6 integer netmask
[ "validate", "an", "IPv6", "integer", "netmask" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L346-L351
train
saltstack/salt
salt/modules/debian_ip.py
__within2
def __within2(value, within=None, errmsg=None, dtype=None): '''validate that a value is in ``within`` and optionally a ``dtype``''' valid, _value = False, value if dtype: try: _value = dtype(value) # TODO: this is a bit loose when dtype is a class valid = _value in within ...
python
def __within2(value, within=None, errmsg=None, dtype=None): '''validate that a value is in ``within`` and optionally a ``dtype``''' valid, _value = False, value if dtype: try: _value = dtype(value) # TODO: this is a bit loose when dtype is a class valid = _value in within ...
[ "def", "__within2", "(", "value", ",", "within", "=", "None", ",", "errmsg", "=", "None", ",", "dtype", "=", "None", ")", ":", "valid", ",", "_value", "=", "False", ",", "value", "if", "dtype", ":", "try", ":", "_value", "=", "dtype", "(", "value",...
validate that a value is in ``within`` and optionally a ``dtype``
[ "validate", "that", "a", "value", "is", "in", "within", "and", "optionally", "a", "dtype" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L354-L373
train
saltstack/salt
salt/modules/debian_ip.py
__space_delimited_list
def __space_delimited_list(value): '''validate that a value contains one or more space-delimited values''' if isinstance(value, six.string_types): value = value.strip().split() if hasattr(value, '__iter__') and value != []: return (True, value, 'space-delimited string') else: re...
python
def __space_delimited_list(value): '''validate that a value contains one or more space-delimited values''' if isinstance(value, six.string_types): value = value.strip().split() if hasattr(value, '__iter__') and value != []: return (True, value, 'space-delimited string') else: re...
[ "def", "__space_delimited_list", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", ":", "value", "=", "value", ".", "strip", "(", ")", ".", "split", "(", ")", "if", "hasattr", "(", "value", ",", "'__iter__'...
validate that a value contains one or more space-delimited values
[ "validate", "that", "a", "value", "contains", "one", "or", "more", "space", "-", "delimited", "values" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L381-L389
train
saltstack/salt
salt/modules/debian_ip.py
_validate_interface_option
def _validate_interface_option(attr, value, addrfam='inet'): '''lookup the validation function for a [addrfam][attr] and return the results :param attr: attribute name :param value: raw setting value :param addrfam: address family (inet, inet6, ''' valid, _value, errmsg = False, value, 'Unk...
python
def _validate_interface_option(attr, value, addrfam='inet'): '''lookup the validation function for a [addrfam][attr] and return the results :param attr: attribute name :param value: raw setting value :param addrfam: address family (inet, inet6, ''' valid, _value, errmsg = False, value, 'Unk...
[ "def", "_validate_interface_option", "(", "attr", ",", "value", ",", "addrfam", "=", "'inet'", ")", ":", "valid", ",", "_value", ",", "errmsg", "=", "False", ",", "value", ",", "'Unknown validator'", "attrmaps", "=", "ATTRMAPS", ".", "get", "(", "addrfam", ...
lookup the validation function for a [addrfam][attr] and return the results :param attr: attribute name :param value: raw setting value :param addrfam: address family (inet, inet6,
[ "lookup", "the", "validation", "function", "for", "a", "[", "addrfam", "]", "[", "attr", "]", "and", "return", "the", "results" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L523-L538
train
saltstack/salt
salt/modules/debian_ip.py
_parse_interfaces
def _parse_interfaces(interface_files=None): ''' Parse /etc/network/interfaces and return current configured interfaces ''' if interface_files is None: interface_files = [] # Add this later. if os.path.exists(_DEB_NETWORK_DIR): interface_files += ['{0}/{1}'.format(_DE...
python
def _parse_interfaces(interface_files=None): ''' Parse /etc/network/interfaces and return current configured interfaces ''' if interface_files is None: interface_files = [] # Add this later. if os.path.exists(_DEB_NETWORK_DIR): interface_files += ['{0}/{1}'.format(_DE...
[ "def", "_parse_interfaces", "(", "interface_files", "=", "None", ")", ":", "if", "interface_files", "is", "None", ":", "interface_files", "=", "[", "]", "# Add this later.", "if", "os", ".", "path", ".", "exists", "(", "_DEB_NETWORK_DIR", ")", ":", "interface_...
Parse /etc/network/interfaces and return current configured interfaces
[ "Parse", "/", "etc", "/", "network", "/", "interfaces", "and", "return", "current", "configured", "interfaces" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L548-L692
train
saltstack/salt
salt/modules/debian_ip.py
_parse_ethtool_opts
def _parse_ethtool_opts(opts, iface): ''' Filters given options and outputs valid settings for ETHTOOLS_OPTS If an option has a value that is not expected, this function will log what the Interface, Setting and what it was expecting. ''' config = {} if 'autoneg' in opts: if opts...
python
def _parse_ethtool_opts(opts, iface): ''' Filters given options and outputs valid settings for ETHTOOLS_OPTS If an option has a value that is not expected, this function will log what the Interface, Setting and what it was expecting. ''' config = {} if 'autoneg' in opts: if opts...
[ "def", "_parse_ethtool_opts", "(", "opts", ",", "iface", ")", ":", "config", "=", "{", "}", "if", "'autoneg'", "in", "opts", ":", "if", "opts", "[", "'autoneg'", "]", "in", "_CONFIG_TRUE", ":", "config", ".", "update", "(", "{", "'autoneg'", ":", "'on'...
Filters given options and outputs valid settings for ETHTOOLS_OPTS If an option has a value that is not expected, this function will log what the Interface, Setting and what it was expecting.
[ "Filters", "given", "options", "and", "outputs", "valid", "settings", "for", "ETHTOOLS_OPTS", "If", "an", "option", "has", "a", "value", "that", "is", "not", "expected", "this", "function", "will", "log", "what", "the", "Interface", "Setting", "and", "what", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L695-L736
train
saltstack/salt
salt/modules/debian_ip.py
_parse_ethtool_pppoe_opts
def _parse_ethtool_pppoe_opts(opts, iface): ''' Filters given options and outputs valid settings for ETHTOOLS_PPPOE_OPTS If an option has a value that is not expected, this function will log what the Interface, Setting and what it was expecting. ''' config = {} for opt in _DEB_CONFIG_PP...
python
def _parse_ethtool_pppoe_opts(opts, iface): ''' Filters given options and outputs valid settings for ETHTOOLS_PPPOE_OPTS If an option has a value that is not expected, this function will log what the Interface, Setting and what it was expecting. ''' config = {} for opt in _DEB_CONFIG_PP...
[ "def", "_parse_ethtool_pppoe_opts", "(", "opts", ",", "iface", ")", ":", "config", "=", "{", "}", "for", "opt", "in", "_DEB_CONFIG_PPPOE_OPTS", ":", "if", "opt", "in", "opts", ":", "config", "[", "opt", "]", "=", "opts", "[", "opt", "]", "if", "'provid...
Filters given options and outputs valid settings for ETHTOOLS_PPPOE_OPTS If an option has a value that is not expected, this function will log what the Interface, Setting and what it was expecting.
[ "Filters", "given", "options", "and", "outputs", "valid", "settings", "for", "ETHTOOLS_PPPOE_OPTS", "If", "an", "option", "has", "a", "value", "that", "is", "not", "expected", "this", "function", "will", "log", "what", "the", "Interface", "Setting", "and", "wh...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L739-L765
train
saltstack/salt
salt/modules/debian_ip.py
_parse_settings_bond
def _parse_settings_bond(opts, iface): ''' Filters given options and outputs valid settings for requested operation. If an option has a value that is not expected, this function will log what the Interface, Setting and what it was expecting. ''' bond_def = { # 803.ad aggregation sel...
python
def _parse_settings_bond(opts, iface): ''' Filters given options and outputs valid settings for requested operation. If an option has a value that is not expected, this function will log what the Interface, Setting and what it was expecting. ''' bond_def = { # 803.ad aggregation sel...
[ "def", "_parse_settings_bond", "(", "opts", ",", "iface", ")", ":", "bond_def", "=", "{", "# 803.ad aggregation selection logic", "# 0 for stable (default)", "# 1 for bandwidth", "# 2 for count", "'ad_select'", ":", "'0'", ",", "# Max number of transmit queues (default = 16)", ...
Filters given options and outputs valid settings for requested operation. If an option has a value that is not expected, this function will log what the Interface, Setting and what it was expecting.
[ "Filters", "given", "options", "and", "outputs", "valid", "settings", "for", "requested", "operation", ".", "If", "an", "option", "has", "a", "value", "that", "is", "not", "expected", "this", "function", "will", "log", "what", "the", "Interface", "Setting", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L768-L835
train
saltstack/salt
salt/modules/debian_ip.py
_parse_settings_bond_2
def _parse_settings_bond_2(opts, iface, bond_def): ''' Filters given options and outputs valid settings for bond2. If an option has a value that is not expected, this function will log what the Interface, Setting and what it was expecting. ''' bond = {'mode': '2'} valid = ['list of ips...
python
def _parse_settings_bond_2(opts, iface, bond_def): ''' Filters given options and outputs valid settings for bond2. If an option has a value that is not expected, this function will log what the Interface, Setting and what it was expecting. ''' bond = {'mode': '2'} valid = ['list of ips...
[ "def", "_parse_settings_bond_2", "(", "opts", ",", "iface", ",", "bond_def", ")", ":", "bond", "=", "{", "'mode'", ":", "'2'", "}", "valid", "=", "[", "'list of ips (up to 16)'", "]", "if", "'arp_ip_target'", "in", "opts", ":", "if", "isinstance", "(", "op...
Filters given options and outputs valid settings for bond2. If an option has a value that is not expected, this function will log what the Interface, Setting and what it was expecting.
[ "Filters", "given", "options", "and", "outputs", "valid", "settings", "for", "bond2", ".", "If", "an", "option", "has", "a", "value", "that", "is", "not", "expected", "this", "function", "will", "log", "what", "the", "Interface", "Setting", "and", "what", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L918-L962
train
saltstack/salt
salt/modules/debian_ip.py
_parse_bridge_opts
def _parse_bridge_opts(opts, iface): ''' Filters given options and outputs valid settings for BRIDGING_OPTS If an option has a value that is not expected, this function will log the Interface, Setting and what was expected. ''' config = {} if 'ports' in opts: if isinstance(opts['por...
python
def _parse_bridge_opts(opts, iface): ''' Filters given options and outputs valid settings for BRIDGING_OPTS If an option has a value that is not expected, this function will log the Interface, Setting and what was expected. ''' config = {} if 'ports' in opts: if isinstance(opts['por...
[ "def", "_parse_bridge_opts", "(", "opts", ",", "iface", ")", ":", "config", "=", "{", "}", "if", "'ports'", "in", "opts", ":", "if", "isinstance", "(", "opts", "[", "'ports'", "]", ",", "list", ")", ":", "opts", "[", "'ports'", "]", "=", "' '", "."...
Filters given options and outputs valid settings for BRIDGING_OPTS If an option has a value that is not expected, this function will log the Interface, Setting and what was expected.
[ "Filters", "given", "options", "and", "outputs", "valid", "settings", "for", "BRIDGING_OPTS", "If", "an", "option", "has", "a", "value", "that", "is", "not", "expected", "this", "function", "will", "log", "the", "Interface", "Setting", "and", "what", "was", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1130-L1198
train
saltstack/salt
salt/modules/debian_ip.py
_parse_settings_eth
def _parse_settings_eth(opts, iface_type, enabled, iface): ''' Filters given options and outputs valid settings for a network interface. ''' adapters = salt.utils.odict.OrderedDict() adapters[iface] = salt.utils.odict.OrderedDict() adapters[iface]['type'] = iface_type adapters[iface]['...
python
def _parse_settings_eth(opts, iface_type, enabled, iface): ''' Filters given options and outputs valid settings for a network interface. ''' adapters = salt.utils.odict.OrderedDict() adapters[iface] = salt.utils.odict.OrderedDict() adapters[iface]['type'] = iface_type adapters[iface]['...
[ "def", "_parse_settings_eth", "(", "opts", ",", "iface_type", ",", "enabled", ",", "iface", ")", ":", "adapters", "=", "salt", ".", "utils", ".", "odict", ".", "OrderedDict", "(", ")", "adapters", "[", "iface", "]", "=", "salt", ".", "utils", ".", "odi...
Filters given options and outputs valid settings for a network interface.
[ "Filters", "given", "options", "and", "outputs", "valid", "settings", "for", "a", "network", "interface", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1201-L1312
train
saltstack/salt
salt/modules/debian_ip.py
_parse_settings_source
def _parse_settings_source(opts, iface_type, enabled, iface): ''' Filters given options and outputs valid settings for a network interface. ''' adapters = salt.utils.odict.OrderedDict() adapters[iface] = salt.utils.odict.OrderedDict() adapters[iface]['type'] = iface_type adapters[iface...
python
def _parse_settings_source(opts, iface_type, enabled, iface): ''' Filters given options and outputs valid settings for a network interface. ''' adapters = salt.utils.odict.OrderedDict() adapters[iface] = salt.utils.odict.OrderedDict() adapters[iface]['type'] = iface_type adapters[iface...
[ "def", "_parse_settings_source", "(", "opts", ",", "iface_type", ",", "enabled", ",", "iface", ")", ":", "adapters", "=", "salt", ".", "utils", ".", "odict", ".", "OrderedDict", "(", ")", "adapters", "[", "iface", "]", "=", "salt", ".", "utils", ".", "...
Filters given options and outputs valid settings for a network interface.
[ "Filters", "given", "options", "and", "outputs", "valid", "settings", "for", "a", "network", "interface", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1315-L1329
train
saltstack/salt
salt/modules/debian_ip.py
_parse_network_settings
def _parse_network_settings(opts, current): ''' Filters given options and outputs valid settings for the global network settings file. ''' # Normalize keys opts = dict((k.lower(), v) for (k, v) in six.iteritems(opts)) current = dict((k.lower(), v) for (k, v) in six.iteritems(current)) re...
python
def _parse_network_settings(opts, current): ''' Filters given options and outputs valid settings for the global network settings file. ''' # Normalize keys opts = dict((k.lower(), v) for (k, v) in six.iteritems(opts)) current = dict((k.lower(), v) for (k, v) in six.iteritems(current)) re...
[ "def", "_parse_network_settings", "(", "opts", ",", "current", ")", ":", "# Normalize keys", "opts", "=", "dict", "(", "(", "k", ".", "lower", "(", ")", ",", "v", ")", "for", "(", "k", ",", "v", ")", "in", "six", ".", "iteritems", "(", "opts", ")",...
Filters given options and outputs valid settings for the global network settings file.
[ "Filters", "given", "options", "and", "outputs", "valid", "settings", "for", "the", "global", "network", "settings", "file", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1332-L1375
train
saltstack/salt
salt/modules/debian_ip.py
_parse_routes
def _parse_routes(iface, opts): ''' Filters given options and outputs valid settings for the route settings file. ''' # Normalize keys opts = dict((k.lower(), v) for (k, v) in six.iteritems(opts)) result = {} if 'routes' not in opts: _raise_error_routes(iface, 'routes', 'List of ...
python
def _parse_routes(iface, opts): ''' Filters given options and outputs valid settings for the route settings file. ''' # Normalize keys opts = dict((k.lower(), v) for (k, v) in six.iteritems(opts)) result = {} if 'routes' not in opts: _raise_error_routes(iface, 'routes', 'List of ...
[ "def", "_parse_routes", "(", "iface", ",", "opts", ")", ":", "# Normalize keys", "opts", "=", "dict", "(", "(", "k", ".", "lower", "(", ")", ",", "v", ")", "for", "(", "k", ",", "v", ")", "in", "six", ".", "iteritems", "(", "opts", ")", ")", "r...
Filters given options and outputs valid settings for the route settings file.
[ "Filters", "given", "options", "and", "outputs", "valid", "settings", "for", "the", "route", "settings", "file", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1378-L1392
train
saltstack/salt
salt/modules/debian_ip.py
_write_file
def _write_file(iface, data, folder, pattern): ''' Writes a file to disk ''' filename = os.path.join(folder, pattern.format(iface)) if not os.path.exists(folder): msg = '{0} cannot be written. {1} does not exist' msg = msg.format(filename, folder) log.error(msg) raise...
python
def _write_file(iface, data, folder, pattern): ''' Writes a file to disk ''' filename = os.path.join(folder, pattern.format(iface)) if not os.path.exists(folder): msg = '{0} cannot be written. {1} does not exist' msg = msg.format(filename, folder) log.error(msg) raise...
[ "def", "_write_file", "(", "iface", ",", "data", ",", "folder", ",", "pattern", ")", ":", "filename", "=", "os", ".", "path", ".", "join", "(", "folder", ",", "pattern", ".", "format", "(", "iface", ")", ")", "if", "not", "os", ".", "path", ".", ...
Writes a file to disk
[ "Writes", "a", "file", "to", "disk" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1395-L1407
train
saltstack/salt
salt/modules/debian_ip.py
_write_file_network
def _write_file_network(data, filename, create=False): ''' Writes a file to disk If file does not exist, only create if create argument is True ''' if not os.path.exists(filename) and not create: msg = '{0} cannot be written. {0} does not exist\ and create is set to False...
python
def _write_file_network(data, filename, create=False): ''' Writes a file to disk If file does not exist, only create if create argument is True ''' if not os.path.exists(filename) and not create: msg = '{0} cannot be written. {0} does not exist\ and create is set to False...
[ "def", "_write_file_network", "(", "data", ",", "filename", ",", "create", "=", "False", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "filename", ")", "and", "not", "create", ":", "msg", "=", "'{0} cannot be written. {0} does not exist\\\n ...
Writes a file to disk If file does not exist, only create if create argument is True
[ "Writes", "a", "file", "to", "disk", "If", "file", "does", "not", "exist", "only", "create", "if", "create", "argument", "is", "True" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1437-L1450
train
saltstack/salt
salt/modules/debian_ip.py
_read_temp
def _read_temp(data): ''' Return what would be written to disk ''' tout = StringIO() tout.write(data) tout.seek(0) output = tout.readlines() tout.close() return output
python
def _read_temp(data): ''' Return what would be written to disk ''' tout = StringIO() tout.write(data) tout.seek(0) output = tout.readlines() tout.close() return output
[ "def", "_read_temp", "(", "data", ")", ":", "tout", "=", "StringIO", "(", ")", "tout", ".", "write", "(", "data", ")", "tout", ".", "seek", "(", "0", ")", "output", "=", "tout", ".", "readlines", "(", ")", "tout", ".", "close", "(", ")", "return"...
Return what would be written to disk
[ "Return", "what", "would", "be", "written", "to", "disk" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1453-L1463
train
saltstack/salt
salt/modules/debian_ip.py
_read_temp_ifaces
def _read_temp_ifaces(iface, data): ''' Return what would be written to disk for interfaces ''' try: template = JINJA.get_template('debian_eth.jinja') except jinja2.exceptions.TemplateNotFound: log.error('Could not load template debian_eth.jinja') return '' ifcfg = templ...
python
def _read_temp_ifaces(iface, data): ''' Return what would be written to disk for interfaces ''' try: template = JINJA.get_template('debian_eth.jinja') except jinja2.exceptions.TemplateNotFound: log.error('Could not load template debian_eth.jinja') return '' ifcfg = templ...
[ "def", "_read_temp_ifaces", "(", "iface", ",", "data", ")", ":", "try", ":", "template", "=", "JINJA", ".", "get_template", "(", "'debian_eth.jinja'", ")", "except", "jinja2", ".", "exceptions", ".", "TemplateNotFound", ":", "log", ".", "error", "(", "'Could...
Return what would be written to disk for interfaces
[ "Return", "what", "would", "be", "written", "to", "disk", "for", "interfaces" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1466-L1478
train
saltstack/salt
salt/modules/debian_ip.py
_write_file_ifaces
def _write_file_ifaces(iface, data, **settings): ''' Writes a file to disk ''' try: eth_template = JINJA.get_template('debian_eth.jinja') source_template = JINJA.get_template('debian_source.jinja') except jinja2.exceptions.TemplateNotFound: log.error('Could not load template ...
python
def _write_file_ifaces(iface, data, **settings): ''' Writes a file to disk ''' try: eth_template = JINJA.get_template('debian_eth.jinja') source_template = JINJA.get_template('debian_source.jinja') except jinja2.exceptions.TemplateNotFound: log.error('Could not load template ...
[ "def", "_write_file_ifaces", "(", "iface", ",", "data", ",", "*", "*", "settings", ")", ":", "try", ":", "eth_template", "=", "JINJA", ".", "get_template", "(", "'debian_eth.jinja'", ")", "source_template", "=", "JINJA", ".", "get_template", "(", "'debian_sour...
Writes a file to disk
[ "Writes", "a", "file", "to", "disk" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1481-L1532
train
saltstack/salt
salt/modules/debian_ip.py
_write_file_ppp_ifaces
def _write_file_ppp_ifaces(iface, data): ''' Writes a file to disk ''' try: template = JINJA.get_template('debian_ppp_eth.jinja') except jinja2.exceptions.TemplateNotFound: log.error('Could not load template debian_ppp_eth.jinja') return '' adapters = _parse_interfaces()...
python
def _write_file_ppp_ifaces(iface, data): ''' Writes a file to disk ''' try: template = JINJA.get_template('debian_ppp_eth.jinja') except jinja2.exceptions.TemplateNotFound: log.error('Could not load template debian_ppp_eth.jinja') return '' adapters = _parse_interfaces()...
[ "def", "_write_file_ppp_ifaces", "(", "iface", ",", "data", ")", ":", "try", ":", "template", "=", "JINJA", ".", "get_template", "(", "'debian_ppp_eth.jinja'", ")", "except", "jinja2", ".", "exceptions", ".", "TemplateNotFound", ":", "log", ".", "error", "(", ...
Writes a file to disk
[ "Writes", "a", "file", "to", "disk" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1535-L1562
train
saltstack/salt
salt/modules/debian_ip.py
build_bond
def build_bond(iface, **settings): ''' Create a bond script in /etc/modprobe.d with the passed settings and load the bonding kernel module. CLI Example: .. code-block:: bash salt '*' ip.build_bond bond0 mode=balance-alb ''' deb_major = __grains__['osrelease'][:1] opts = _pars...
python
def build_bond(iface, **settings): ''' Create a bond script in /etc/modprobe.d with the passed settings and load the bonding kernel module. CLI Example: .. code-block:: bash salt '*' ip.build_bond bond0 mode=balance-alb ''' deb_major = __grains__['osrelease'][:1] opts = _pars...
[ "def", "build_bond", "(", "iface", ",", "*", "*", "settings", ")", ":", "deb_major", "=", "__grains__", "[", "'osrelease'", "]", "[", ":", "1", "]", "opts", "=", "_parse_settings_bond", "(", "settings", ",", "iface", ")", "try", ":", "template", "=", "...
Create a bond script in /etc/modprobe.d with the passed settings and load the bonding kernel module. CLI Example: .. code-block:: bash salt '*' ip.build_bond bond0 mode=balance-alb
[ "Create", "a", "bond", "script", "in", "/", "etc", "/", "modprobe", ".", "d", "with", "the", "passed", "settings", "and", "load", "the", "bonding", "kernel", "module", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1565-L1604
train
saltstack/salt
salt/modules/debian_ip.py
build_interface
def build_interface(iface, iface_type, enabled, **settings): ''' Build an interface script for a network interface. CLI Example: .. code-block:: bash salt '*' ip.build_interface eth0 eth <settings> ''' iface_type = iface_type.lower() if iface_type not in _IFACE_TYPES: _r...
python
def build_interface(iface, iface_type, enabled, **settings): ''' Build an interface script for a network interface. CLI Example: .. code-block:: bash salt '*' ip.build_interface eth0 eth <settings> ''' iface_type = iface_type.lower() if iface_type not in _IFACE_TYPES: _r...
[ "def", "build_interface", "(", "iface", ",", "iface_type", ",", "enabled", ",", "*", "*", "settings", ")", ":", "iface_type", "=", "iface_type", ".", "lower", "(", ")", "if", "iface_type", "not", "in", "_IFACE_TYPES", ":", "_raise_error_iface", "(", "iface",...
Build an interface script for a network interface. CLI Example: .. code-block:: bash salt '*' ip.build_interface eth0 eth <settings>
[ "Build", "an", "interface", "script", "for", "a", "network", "interface", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1607-L1670
train
saltstack/salt
salt/modules/debian_ip.py
build_routes
def build_routes(iface, **settings): ''' Add route scripts for a network interface using up commands. CLI Example: .. code-block:: bash salt '*' ip.build_routes eth0 <settings> ''' opts = _parse_routes(iface, settings) try: template = JINJA.get_template('route_eth.jinja')...
python
def build_routes(iface, **settings): ''' Add route scripts for a network interface using up commands. CLI Example: .. code-block:: bash salt '*' ip.build_routes eth0 <settings> ''' opts = _parse_routes(iface, settings) try: template = JINJA.get_template('route_eth.jinja')...
[ "def", "build_routes", "(", "iface", ",", "*", "*", "settings", ")", ":", "opts", "=", "_parse_routes", "(", "iface", ",", "settings", ")", "try", ":", "template", "=", "JINJA", ".", "get_template", "(", "'route_eth.jinja'", ")", "except", "jinja2", ".", ...
Add route scripts for a network interface using up commands. CLI Example: .. code-block:: bash salt '*' ip.build_routes eth0 <settings>
[ "Add", "route", "scripts", "for", "a", "network", "interface", "using", "up", "commands", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1673-L1714
train
saltstack/salt
salt/modules/debian_ip.py
get_bond
def get_bond(iface): ''' Return the content of a bond script CLI Example: .. code-block:: bash salt '*' ip.get_bond bond0 ''' path = os.path.join(_DEB_NETWORK_CONF_FILES, '{0}.conf'.format(iface)) return _read_file(path)
python
def get_bond(iface): ''' Return the content of a bond script CLI Example: .. code-block:: bash salt '*' ip.get_bond bond0 ''' path = os.path.join(_DEB_NETWORK_CONF_FILES, '{0}.conf'.format(iface)) return _read_file(path)
[ "def", "get_bond", "(", "iface", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "_DEB_NETWORK_CONF_FILES", ",", "'{0}.conf'", ".", "format", "(", "iface", ")", ")", "return", "_read_file", "(", "path", ")" ]
Return the content of a bond script CLI Example: .. code-block:: bash salt '*' ip.get_bond bond0
[ "Return", "the", "content", "of", "a", "bond", "script" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1734-L1745
train
saltstack/salt
salt/modules/debian_ip.py
get_interface
def get_interface(iface): ''' Return the contents of an interface script CLI Example: .. code-block:: bash salt '*' ip.get_interface eth0 ''' adapters = _parse_interfaces() if iface in adapters: try: if iface == 'source': template = JINJA.get_t...
python
def get_interface(iface): ''' Return the contents of an interface script CLI Example: .. code-block:: bash salt '*' ip.get_interface eth0 ''' adapters = _parse_interfaces() if iface in adapters: try: if iface == 'source': template = JINJA.get_t...
[ "def", "get_interface", "(", "iface", ")", ":", "adapters", "=", "_parse_interfaces", "(", ")", "if", "iface", "in", "adapters", ":", "try", ":", "if", "iface", "==", "'source'", ":", "template", "=", "JINJA", ".", "get_template", "(", "'debian_source.jinja'...
Return the contents of an interface script CLI Example: .. code-block:: bash salt '*' ip.get_interface eth0
[ "Return", "the", "contents", "of", "an", "interface", "script" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1748-L1775
train
saltstack/salt
salt/modules/debian_ip.py
get_network_settings
def get_network_settings(): ''' Return the contents of the global network script. CLI Example: .. code-block:: bash salt '*' ip.get_network_settings ''' skip_etc_default_networking = ( __grains__['osfullname'] == 'Ubuntu' and int(__grains__['osrelease'].split('.')[0]) ...
python
def get_network_settings(): ''' Return the contents of the global network script. CLI Example: .. code-block:: bash salt '*' ip.get_network_settings ''' skip_etc_default_networking = ( __grains__['osfullname'] == 'Ubuntu' and int(__grains__['osrelease'].split('.')[0]) ...
[ "def", "get_network_settings", "(", ")", ":", "skip_etc_default_networking", "=", "(", "__grains__", "[", "'osfullname'", "]", "==", "'Ubuntu'", "and", "int", "(", "__grains__", "[", "'osrelease'", "]", ".", "split", "(", "'.'", ")", "[", "0", "]", ")", ">...
Return the contents of the global network script. CLI Example: .. code-block:: bash salt '*' ip.get_network_settings
[ "Return", "the", "contents", "of", "the", "global", "network", "script", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1795-L1837
train
saltstack/salt
salt/modules/debian_ip.py
get_routes
def get_routes(iface): ''' Return the routes for the interface CLI Example: .. code-block:: bash salt '*' ip.get_routes eth0 ''' filename = os.path.join(_DEB_NETWORK_UP_DIR, 'route-{0}'.format(iface)) results = _read_file(filename) filename = os.path.join(_DEB_NETWORK_DOWN_D...
python
def get_routes(iface): ''' Return the routes for the interface CLI Example: .. code-block:: bash salt '*' ip.get_routes eth0 ''' filename = os.path.join(_DEB_NETWORK_UP_DIR, 'route-{0}'.format(iface)) results = _read_file(filename) filename = os.path.join(_DEB_NETWORK_DOWN_D...
[ "def", "get_routes", "(", "iface", ")", ":", "filename", "=", "os", ".", "path", ".", "join", "(", "_DEB_NETWORK_UP_DIR", ",", "'route-{0}'", ".", "format", "(", "iface", ")", ")", "results", "=", "_read_file", "(", "filename", ")", "filename", "=", "os"...
Return the routes for the interface CLI Example: .. code-block:: bash salt '*' ip.get_routes eth0
[ "Return", "the", "routes", "for", "the", "interface" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1840-L1857
train
saltstack/salt
salt/modules/debian_ip.py
apply_network_settings
def apply_network_settings(**settings): ''' Apply global network configuration. CLI Example: .. code-block:: bash salt '*' ip.apply_network_settings ''' if 'require_reboot' not in settings: settings['require_reboot'] = False if 'apply_hostname' not in settings: se...
python
def apply_network_settings(**settings): ''' Apply global network configuration. CLI Example: .. code-block:: bash salt '*' ip.apply_network_settings ''' if 'require_reboot' not in settings: settings['require_reboot'] = False if 'apply_hostname' not in settings: se...
[ "def", "apply_network_settings", "(", "*", "*", "settings", ")", ":", "if", "'require_reboot'", "not", "in", "settings", ":", "settings", "[", "'require_reboot'", "]", "=", "False", "if", "'apply_hostname'", "not", "in", "settings", ":", "settings", "[", "'app...
Apply global network configuration. CLI Example: .. code-block:: bash salt '*' ip.apply_network_settings
[ "Apply", "global", "network", "configuration", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1860-L1899
train
saltstack/salt
salt/modules/debian_ip.py
build_network_settings
def build_network_settings(**settings): ''' Build the global network script. CLI Example: .. code-block:: bash salt '*' ip.build_network_settings <settings> ''' changes = [] # Read current configuration and store default values current_network_settings = _parse_current_networ...
python
def build_network_settings(**settings): ''' Build the global network script. CLI Example: .. code-block:: bash salt '*' ip.build_network_settings <settings> ''' changes = [] # Read current configuration and store default values current_network_settings = _parse_current_networ...
[ "def", "build_network_settings", "(", "*", "*", "settings", ")", ":", "changes", "=", "[", "]", "# Read current configuration and store default values", "current_network_settings", "=", "_parse_current_network_settings", "(", ")", "# Build settings", "opts", "=", "_parse_ne...
Build the global network script. CLI Example: .. code-block:: bash salt '*' ip.build_network_settings <settings>
[ "Build", "the", "global", "network", "script", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1902-L2024
train
saltstack/salt
salt/modules/environ.py
setval
def setval(key, val, false_unsets=False, permanent=False): ''' Set a single salt process environment variable. Returns True on success. key The environment key to set. Must be a string. val The value to set. Must be a string or False. Refer to the 'false_unsets' parameter f...
python
def setval(key, val, false_unsets=False, permanent=False): ''' Set a single salt process environment variable. Returns True on success. key The environment key to set. Must be a string. val The value to set. Must be a string or False. Refer to the 'false_unsets' parameter f...
[ "def", "setval", "(", "key", ",", "val", ",", "false_unsets", "=", "False", ",", "permanent", "=", "False", ")", ":", "is_windows", "=", "salt", ".", "utils", ".", "platform", ".", "is_windows", "(", ")", "if", "is_windows", ":", "permanent_hive", "=", ...
Set a single salt process environment variable. Returns True on success. key The environment key to set. Must be a string. val The value to set. Must be a string or False. Refer to the 'false_unsets' parameter for behavior when set to False. false_unsets If val is Fals...
[ "Set", "a", "single", "salt", "process", "environment", "variable", ".", "Returns", "True", "on", "success", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/environ.py#L27-L105
train
saltstack/salt
salt/modules/environ.py
setenv
def setenv(environ, false_unsets=False, clear_all=False, update_minion=False, permanent=False): ''' Set multiple salt process environment variables from a dict. Returns a dict. environ Must be a dict. The top-level keys of the dict are the names of the environment variables to set. Each...
python
def setenv(environ, false_unsets=False, clear_all=False, update_minion=False, permanent=False): ''' Set multiple salt process environment variables from a dict. Returns a dict. environ Must be a dict. The top-level keys of the dict are the names of the environment variables to set. Each...
[ "def", "setenv", "(", "environ", ",", "false_unsets", "=", "False", ",", "clear_all", "=", "False", ",", "update_minion", "=", "False", ",", "permanent", "=", "False", ")", ":", "ret", "=", "{", "}", "if", "not", "isinstance", "(", "environ", ",", "dic...
Set multiple salt process environment variables from a dict. Returns a dict. environ Must be a dict. The top-level keys of the dict are the names of the environment variables to set. Each key's value must be a string or False. Refer to the 'false_unsets' parameter for behavior w...
[ "Set", "multiple", "salt", "process", "environment", "variables", "from", "a", "dict", ".", "Returns", "a", "dict", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/environ.py#L108-L186
train
saltstack/salt
salt/modules/environ.py
get
def get(key, default=''): ''' Get a single salt process environment variable. key String used as the key for environment lookup. default If the key is not found in the environment, return this value. Default: '' CLI Example: .. code-block:: bash salt '*' env...
python
def get(key, default=''): ''' Get a single salt process environment variable. key String used as the key for environment lookup. default If the key is not found in the environment, return this value. Default: '' CLI Example: .. code-block:: bash salt '*' env...
[ "def", "get", "(", "key", ",", "default", "=", "''", ")", ":", "if", "not", "isinstance", "(", "key", ",", "six", ".", "string_types", ")", ":", "log", ".", "debug", "(", "'%s: \\'key\\' argument is not a string type: \\'%s\\''", ",", "__name__", ",", "key",...
Get a single salt process environment variable. key String used as the key for environment lookup. default If the key is not found in the environment, return this value. Default: '' CLI Example: .. code-block:: bash salt '*' environ.get foo salt '*' environ....
[ "Get", "a", "single", "salt", "process", "environment", "variable", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/environ.py#L189-L211
train
saltstack/salt
salt/modules/environ.py
has_value
def has_value(key, value=None): ''' Determine whether the key exists in the current salt process environment dictionary. Optionally compare the current value of the environment against the supplied value string. key Must be a string. Used as key for environment lookup. value: O...
python
def has_value(key, value=None): ''' Determine whether the key exists in the current salt process environment dictionary. Optionally compare the current value of the environment against the supplied value string. key Must be a string. Used as key for environment lookup. value: O...
[ "def", "has_value", "(", "key", ",", "value", "=", "None", ")", ":", "if", "not", "isinstance", "(", "key", ",", "six", ".", "string_types", ")", ":", "log", ".", "debug", "(", "'%s: \\'key\\' argument is not a string type: \\'%s\\''", ",", "__name__", ",", ...
Determine whether the key exists in the current salt process environment dictionary. Optionally compare the current value of the environment against the supplied value string. key Must be a string. Used as key for environment lookup. value: Optional. If key exists in the environment, c...
[ "Determine", "whether", "the", "key", "exists", "in", "the", "current", "salt", "process", "environment", "dictionary", ".", "Optionally", "compare", "the", "current", "value", "of", "the", "environment", "against", "the", "supplied", "value", "string", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/environ.py#L214-L245
train
saltstack/salt
salt/modules/environ.py
item
def item(keys, default=''): ''' Get one or more salt process environment variables. Returns a dict. keys Either a string or a list of strings that will be used as the keys for environment lookup. default If the key is not found in the environment, return this value. ...
python
def item(keys, default=''): ''' Get one or more salt process environment variables. Returns a dict. keys Either a string or a list of strings that will be used as the keys for environment lookup. default If the key is not found in the environment, return this value. ...
[ "def", "item", "(", "keys", ",", "default", "=", "''", ")", ":", "ret", "=", "{", "}", "key_list", "=", "[", "]", "if", "isinstance", "(", "keys", ",", "six", ".", "string_types", ")", ":", "key_list", ".", "append", "(", "keys", ")", "elif", "is...
Get one or more salt process environment variables. Returns a dict. keys Either a string or a list of strings that will be used as the keys for environment lookup. default If the key is not found in the environment, return this value. Default: '' CLI Example: .. c...
[ "Get", "one", "or", "more", "salt", "process", "environment", "variables", ".", "Returns", "a", "dict", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/environ.py#L248-L281
train
saltstack/salt
salt/pillar/svn_pillar.py
_extract_key_val
def _extract_key_val(kv, delimiter='='): '''Extract key and value from key=val string. Example: >>> _extract_key_val('foo=bar') ('foo', 'bar') ''' pieces = kv.split(delimiter) key = pieces[0] val = delimiter.join(pieces[1:]) return key, val
python
def _extract_key_val(kv, delimiter='='): '''Extract key and value from key=val string. Example: >>> _extract_key_val('foo=bar') ('foo', 'bar') ''' pieces = kv.split(delimiter) key = pieces[0] val = delimiter.join(pieces[1:]) return key, val
[ "def", "_extract_key_val", "(", "kv", ",", "delimiter", "=", "'='", ")", ":", "pieces", "=", "kv", ".", "split", "(", "delimiter", ")", "key", "=", "pieces", "[", "0", "]", "val", "=", "delimiter", ".", "join", "(", "pieces", "[", "1", ":", "]", ...
Extract key and value from key=val string. Example: >>> _extract_key_val('foo=bar') ('foo', 'bar')
[ "Extract", "key", "and", "value", "from", "key", "=", "val", "string", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/svn_pillar.py#L148-L158
train
saltstack/salt
salt/pillar/svn_pillar.py
ext_pillar
def ext_pillar(minion_id, pillar, # pylint: disable=W0613 repo_string): ''' Execute a command and read the output as YAML ''' # split the branch, repo name and optional extra (key=val) parameters. options = repo_string.strip().split() branch = options[0] repo_l...
python
def ext_pillar(minion_id, pillar, # pylint: disable=W0613 repo_string): ''' Execute a command and read the output as YAML ''' # split the branch, repo name and optional extra (key=val) parameters. options = repo_string.strip().split() branch = options[0] repo_l...
[ "def", "ext_pillar", "(", "minion_id", ",", "pillar", ",", "# pylint: disable=W0613", "repo_string", ")", ":", "# split the branch, repo name and optional extra (key=val) parameters.", "options", "=", "repo_string", ".", "strip", "(", ")", ".", "split", "(", ")", "branc...
Execute a command and read the output as YAML
[ "Execute", "a", "command", "and", "read", "the", "output", "as", "YAML" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/svn_pillar.py#L161-L201
train
saltstack/salt
salt/pillar/svn_pillar.py
SvnPillar.pillar_dir
def pillar_dir(self): ''' Returns the directory of the pillars (repo cache + branch + root) ''' repo_dir = self.repo_dir root = self.root branch = self.branch if branch == 'trunk' or branch == 'base': working_dir = os.path.join(repo_dir, 'trunk', root)...
python
def pillar_dir(self): ''' Returns the directory of the pillars (repo cache + branch + root) ''' repo_dir = self.repo_dir root = self.root branch = self.branch if branch == 'trunk' or branch == 'base': working_dir = os.path.join(repo_dir, 'trunk', root)...
[ "def", "pillar_dir", "(", "self", ")", ":", "repo_dir", "=", "self", ".", "repo_dir", "root", "=", "self", ".", "root", "branch", "=", "self", ".", "branch", "if", "branch", "==", "'trunk'", "or", "branch", "==", "'base'", ":", "working_dir", "=", "os"...
Returns the directory of the pillars (repo cache + branch + root)
[ "Returns", "the", "directory", "of", "the", "pillars", "(", "repo", "cache", "+", "branch", "+", "root", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/svn_pillar.py#L125-L145
train
saltstack/salt
salt/pillar/virtkey.py
ext_pillar
def ext_pillar(hyper_id, pillar, name, key): ''' Accept the key for the VM on the hyper, if authorized. ''' vk = salt.utils.virt.VirtKey(hyper_id, name, __opts__) ok = vk.accept(key) pillar['virtkey'] = {name: ok} return {}
python
def ext_pillar(hyper_id, pillar, name, key): ''' Accept the key for the VM on the hyper, if authorized. ''' vk = salt.utils.virt.VirtKey(hyper_id, name, __opts__) ok = vk.accept(key) pillar['virtkey'] = {name: ok} return {}
[ "def", "ext_pillar", "(", "hyper_id", ",", "pillar", ",", "name", ",", "key", ")", ":", "vk", "=", "salt", ".", "utils", ".", "virt", ".", "VirtKey", "(", "hyper_id", ",", "name", ",", "__opts__", ")", "ok", "=", "vk", ".", "accept", "(", "key", ...
Accept the key for the VM on the hyper, if authorized.
[ "Accept", "the", "key", "for", "the", "VM", "on", "the", "hyper", "if", "authorized", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/virtkey.py#L21-L28
train
saltstack/salt
salt/states/lvm.py
pv_present
def pv_present(name, **kwargs): ''' Set a Physical Device to be used as an LVM Physical Volume name The device name to initialize. kwargs Any supported options to pvcreate. See :mod:`linux_lvm <salt.modules.linux_lvm>` for more details. ''' ret = {'changes': {}, ...
python
def pv_present(name, **kwargs): ''' Set a Physical Device to be used as an LVM Physical Volume name The device name to initialize. kwargs Any supported options to pvcreate. See :mod:`linux_lvm <salt.modules.linux_lvm>` for more details. ''' ret = {'changes': {}, ...
[ "def", "pv_present", "(", "name", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'changes'", ":", "{", "}", ",", "'comment'", ":", "''", ",", "'name'", ":", "name", ",", "'result'", ":", "True", "}", "if", "__salt__", "[", "'lvm.pvdisplay'", ...
Set a Physical Device to be used as an LVM Physical Volume name The device name to initialize. kwargs Any supported options to pvcreate. See :mod:`linux_lvm <salt.modules.linux_lvm>` for more details.
[ "Set", "a", "Physical", "Device", "to", "be", "used", "as", "an", "LVM", "Physical", "Volume" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/lvm.py#L43-L74
train
saltstack/salt
salt/states/lvm.py
pv_absent
def pv_absent(name): ''' Ensure that a Physical Device is not being used by lvm name The device name to initialize. ''' ret = {'changes': {}, 'comment': '', 'name': name, 'result': True} if not __salt__['lvm.pvdisplay'](name, quiet=True): ret['c...
python
def pv_absent(name): ''' Ensure that a Physical Device is not being used by lvm name The device name to initialize. ''' ret = {'changes': {}, 'comment': '', 'name': name, 'result': True} if not __salt__['lvm.pvdisplay'](name, quiet=True): ret['c...
[ "def", "pv_absent", "(", "name", ")", ":", "ret", "=", "{", "'changes'", ":", "{", "}", ",", "'comment'", ":", "''", ",", "'name'", ":", "name", ",", "'result'", ":", "True", "}", "if", "not", "__salt__", "[", "'lvm.pvdisplay'", "]", "(", "name", "...
Ensure that a Physical Device is not being used by lvm name The device name to initialize.
[ "Ensure", "that", "a", "Physical", "Device", "is", "not", "being", "used", "by", "lvm" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/lvm.py#L77-L104
train
saltstack/salt
salt/states/lvm.py
vg_present
def vg_present(name, devices=None, **kwargs): ''' Create an LVM Volume Group name The Volume Group name to create devices A list of devices that will be added to the Volume Group kwargs Any supported options to vgcreate. See :mod:`linux_lvm <salt.modules.linux_lvm>...
python
def vg_present(name, devices=None, **kwargs): ''' Create an LVM Volume Group name The Volume Group name to create devices A list of devices that will be added to the Volume Group kwargs Any supported options to vgcreate. See :mod:`linux_lvm <salt.modules.linux_lvm>...
[ "def", "vg_present", "(", "name", ",", "devices", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'changes'", ":", "{", "}", ",", "'comment'", ":", "''", ",", "'name'", ":", "name", ",", "'result'", ":", "True", "}", "if", "isin...
Create an LVM Volume Group name The Volume Group name to create devices A list of devices that will be added to the Volume Group kwargs Any supported options to vgcreate. See :mod:`linux_lvm <salt.modules.linux_lvm>` for more details.
[ "Create", "an", "LVM", "Volume", "Group" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/lvm.py#L107-L173
train
saltstack/salt
salt/states/lvm.py
lv_present
def lv_present(name, vgname=None, size=None, extents=None, snapshot=None, pv='', thinvolume=False, thinpool=False, force=False, **kwargs): ''' Create a new Logical Volume n...
python
def lv_present(name, vgname=None, size=None, extents=None, snapshot=None, pv='', thinvolume=False, thinpool=False, force=False, **kwargs): ''' Create a new Logical Volume n...
[ "def", "lv_present", "(", "name", ",", "vgname", "=", "None", ",", "size", "=", "None", ",", "extents", "=", "None", ",", "snapshot", "=", "None", ",", "pv", "=", "''", ",", "thinvolume", "=", "False", ",", "thinpool", "=", "False", ",", "force", "...
Create a new Logical Volume name The name of the Logical Volume vgname The name of the Volume Group on which the Logical Volume resides size The initial size of the Logical Volume extents The number of logical extents to allocate snapshot The name of the ...
[ "Create", "a", "new", "Logical", "Volume" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/lvm.py#L206-L295
train
saltstack/salt
salt/states/lvm.py
lv_absent
def lv_absent(name, vgname=None): ''' Remove a given existing Logical Volume from a named existing volume group name The Logical Volume to remove vgname The name of the Volume Group on which the Logical Volume resides ''' ret = {'changes': {}, 'comment': '', ...
python
def lv_absent(name, vgname=None): ''' Remove a given existing Logical Volume from a named existing volume group name The Logical Volume to remove vgname The name of the Volume Group on which the Logical Volume resides ''' ret = {'changes': {}, 'comment': '', ...
[ "def", "lv_absent", "(", "name", ",", "vgname", "=", "None", ")", ":", "ret", "=", "{", "'changes'", ":", "{", "}", ",", "'comment'", ":", "''", ",", "'name'", ":", "name", ",", "'result'", ":", "True", "}", "lvpath", "=", "'/dev/{0}/{1}'", ".", "f...
Remove a given existing Logical Volume from a named existing volume group name The Logical Volume to remove vgname The name of the Volume Group on which the Logical Volume resides
[ "Remove", "a", "given", "existing", "Logical", "Volume", "from", "a", "named", "existing", "volume", "group" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/lvm.py#L298-L329
train
saltstack/salt
salt/sdb/consul.py
get_conn
def get_conn(profile): ''' Return a client object for accessing consul ''' params = {} for key in ('host', 'port', 'token', 'scheme', 'consistency', 'dc', 'verify'): if key in profile: params[key] = profile[key] if HAS_CONSUL: return consul.Consul(**params) else:...
python
def get_conn(profile): ''' Return a client object for accessing consul ''' params = {} for key in ('host', 'port', 'token', 'scheme', 'consistency', 'dc', 'verify'): if key in profile: params[key] = profile[key] if HAS_CONSUL: return consul.Consul(**params) else:...
[ "def", "get_conn", "(", "profile", ")", ":", "params", "=", "{", "}", "for", "key", "in", "(", "'host'", ",", "'port'", ",", "'token'", ",", "'scheme'", ",", "'consistency'", ",", "'dc'", ",", "'verify'", ")", ":", "if", "key", "in", "profile", ":", ...
Return a client object for accessing consul
[ "Return", "a", "client", "object", "for", "accessing", "consul" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/consul.py#L66-L81
train
saltstack/salt
salt/returners/kafka_return.py
_delivery_report
def _delivery_report(err, msg): ''' Called once for each message produced to indicate delivery result. Triggered by poll() or flush(). ''' if err is not None: log.error('Message delivery failed: %s', err) else: log.debug('Message delivered to %s [%s]', msg.topic(), msg.partition())
python
def _delivery_report(err, msg): ''' Called once for each message produced to indicate delivery result. Triggered by poll() or flush(). ''' if err is not None: log.error('Message delivery failed: %s', err) else: log.debug('Message delivered to %s [%s]', msg.topic(), msg.partition())
[ "def", "_delivery_report", "(", "err", ",", "msg", ")", ":", "if", "err", "is", "not", "None", ":", "log", ".", "error", "(", "'Message delivery failed: %s'", ",", "err", ")", "else", ":", "log", ".", "debug", "(", "'Message delivered to %s [%s]'", ",", "m...
Called once for each message produced to indicate delivery result. Triggered by poll() or flush().
[ "Called", "once", "for", "each", "message", "produced", "to", "indicate", "delivery", "result", ".", "Triggered", "by", "poll", "()", "or", "flush", "()", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/kafka_return.py#L61-L67
train
saltstack/salt
salt/returners/kafka_return.py
returner
def returner(ret): ''' Return information to a Kafka server ''' if __salt__['config.option']('returner.kafka.topic'): topic = __salt__['config.option']('returner.kafka.topic') conn = _get_conn() producer = Producer({'bootstrap.servers': conn}) producer.poll(0) pr...
python
def returner(ret): ''' Return information to a Kafka server ''' if __salt__['config.option']('returner.kafka.topic'): topic = __salt__['config.option']('returner.kafka.topic') conn = _get_conn() producer = Producer({'bootstrap.servers': conn}) producer.poll(0) pr...
[ "def", "returner", "(", "ret", ")", ":", "if", "__salt__", "[", "'config.option'", "]", "(", "'returner.kafka.topic'", ")", ":", "topic", "=", "__salt__", "[", "'config.option'", "]", "(", "'returner.kafka.topic'", ")", "conn", "=", "_get_conn", "(", ")", "p...
Return information to a Kafka server
[ "Return", "information", "to", "a", "Kafka", "server" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/kafka_return.py#L70-L84
train
saltstack/salt
salt/states/composer.py
installed
def installed(name, composer=None, php=None, user=None, prefer_source=None, prefer_dist=None, no_scripts=None, no_plugins=None, optimize=None, no_dev=None, quiet=False, ...
python
def installed(name, composer=None, php=None, user=None, prefer_source=None, prefer_dist=None, no_scripts=None, no_plugins=None, optimize=None, no_dev=None, quiet=False, ...
[ "def", "installed", "(", "name", ",", "composer", "=", "None", ",", "php", "=", "None", ",", "user", "=", "None", ",", "prefer_source", "=", "None", ",", "prefer_dist", "=", "None", ",", "no_scripts", "=", "None", ",", "no_plugins", "=", "None", ",", ...
Verify that the correct versions of composer dependencies are present. name Directory location of the ``composer.json`` file. composer Location of the ``composer.phar`` file. If not set composer will just execute ``composer`` as if it is installed globally. (i.e. ``/path/to/com...
[ "Verify", "that", "the", "correct", "versions", "of", "composer", "dependencies", "are", "present", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/composer.py#L53-L182
train
saltstack/salt
salt/states/composer.py
update
def update(name, composer=None, php=None, user=None, prefer_source=None, prefer_dist=None, no_scripts=None, no_plugins=None, optimize=None, no_dev=None, quiet=False, composer_home='/root', ...
python
def update(name, composer=None, php=None, user=None, prefer_source=None, prefer_dist=None, no_scripts=None, no_plugins=None, optimize=None, no_dev=None, quiet=False, composer_home='/root', ...
[ "def", "update", "(", "name", ",", "composer", "=", "None", ",", "php", "=", "None", ",", "user", "=", "None", ",", "prefer_source", "=", "None", ",", "prefer_dist", "=", "None", ",", "no_scripts", "=", "None", ",", "no_plugins", "=", "None", ",", "o...
Composer update the directory to ensure we have the latest versions of all project dependencies. name Directory location of the ``composer.json`` file. composer Location of the ``composer.phar`` file. If not set composer will just execute ``composer`` as if it is installed globally...
[ "Composer", "update", "the", "directory", "to", "ensure", "we", "have", "the", "latest", "versions", "of", "all", "project", "dependencies", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/composer.py#L185-L301
train