id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
33,500
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
33,501
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
33,502
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
33,503
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
33,504
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
33,505
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
33,506
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
33,507
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
33,508
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
33,509
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
33,510
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
33,511
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
33,512
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
33,513
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
33,514
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
33,515
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
33,516
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
33,517
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
33,518
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
33,519
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
33,520
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
33,521
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
33,522
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
33,523
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
33,524
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
33,525
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
33,526
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
33,527
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
33,528
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
33,529
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
33,530
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
33,531
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
33,532
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
33,533
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
33,534
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
33,535
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
33,536
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
33,537
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
33,538
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
33,539
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
33,540
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
33,541
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
33,542
saltstack/salt
salt/modules/boto_elasticache.py
create_replication_group
def create_replication_group(name, primary_cluster_id, replication_group_description, wait=None, region=None, key=None, keyid=None, profile=None): ''' Create replication group. CLI example:: salt myminion boto_elasticache.create_replication...
python
def create_replication_group(name, primary_cluster_id, replication_group_description, wait=None, region=None, key=None, keyid=None, profile=None): ''' Create replication group. CLI example:: salt myminion boto_elasticache.create_replication...
[ "def", "create_replication_group", "(", "name", ",", "primary_cluster_id", ",", "replication_group_description", ",", "wait", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", ...
Create replication group. CLI example:: salt myminion boto_elasticache.create_replication_group myelasticache myprimarycluster description
[ "Create", "replication", "group", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L123-L154
33,543
saltstack/salt
salt/modules/boto_elasticache.py
describe_replication_group
def describe_replication_group(name, region=None, key=None, keyid=None, profile=None, parameter=None): ''' Get replication group information. CLI example:: salt myminion boto_elasticache.describe_replication_group mygroup ''' conn = _get_conn(region=region, k...
python
def describe_replication_group(name, region=None, key=None, keyid=None, profile=None, parameter=None): ''' Get replication group information. CLI example:: salt myminion boto_elasticache.describe_replication_group mygroup ''' conn = _get_conn(region=region, k...
[ "def", "describe_replication_group", "(", "name", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ",", "parameter", "=", "None", ")", ":", "conn", "=", "_get_conn", "(", "region", "=", "regio...
Get replication group information. CLI example:: salt myminion boto_elasticache.describe_replication_group mygroup
[ "Get", "replication", "group", "information", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L181-L241
33,544
saltstack/salt
salt/modules/boto_elasticache.py
get_config
def get_config(name, region=None, key=None, keyid=None, profile=None): ''' Get the configuration for a cache cluster. CLI example:: salt myminion boto_elasticache.get_config myelasticache ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) if not conn: r...
python
def get_config(name, region=None, key=None, keyid=None, profile=None): ''' Get the configuration for a cache cluster. CLI example:: salt myminion boto_elasticache.get_config myelasticache ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) if not conn: r...
[ "def", "get_config", "(", "name", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "conn", "=", "_get_conn", "(", "region", "=", "region", ",", "key", "=", "key", ",", "keyid", ...
Get the configuration for a cache cluster. CLI example:: salt myminion boto_elasticache.get_config myelasticache
[ "Get", "the", "configuration", "for", "a", "cache", "cluster", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L244-L307
33,545
saltstack/salt
salt/modules/boto_elasticache.py
get_node_host
def get_node_host(name, region=None, key=None, keyid=None, profile=None): ''' Get hostname from cache node CLI example:: salt myminion boto_elasticache.get_node_host myelasticache ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) if not conn: return No...
python
def get_node_host(name, region=None, key=None, keyid=None, profile=None): ''' Get hostname from cache node CLI example:: salt myminion boto_elasticache.get_node_host myelasticache ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) if not conn: return No...
[ "def", "get_node_host", "(", "name", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "conn", "=", "_get_conn", "(", "region", "=", "region", ",", "key", "=", "key", ",", "keyid"...
Get hostname from cache node CLI example:: salt myminion boto_elasticache.get_node_host myelasticache
[ "Get", "hostname", "from", "cache", "node" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L310-L333
33,546
saltstack/salt
salt/modules/boto_elasticache.py
get_group_host
def get_group_host(name, region=None, key=None, keyid=None, profile=None): ''' Get hostname from replication cache group CLI example:: salt myminion boto_elasticache.get_group_host myelasticachegroup ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) if not con...
python
def get_group_host(name, region=None, key=None, keyid=None, profile=None): ''' Get hostname from replication cache group CLI example:: salt myminion boto_elasticache.get_group_host myelasticachegroup ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) if not con...
[ "def", "get_group_host", "(", "name", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "conn", "=", "_get_conn", "(", "region", "=", "region", ",", "key", "=", "key", ",", "keyid...
Get hostname from replication cache group CLI example:: salt myminion boto_elasticache.get_group_host myelasticachegroup
[ "Get", "hostname", "from", "replication", "cache", "group" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L336-L359
33,547
saltstack/salt
salt/modules/boto_elasticache.py
get_all_cache_subnet_groups
def get_all_cache_subnet_groups(name=None, region=None, key=None, keyid=None, profile=None): ''' Return a list of all cache subnet groups with details CLI example:: salt myminion boto_elasticache.get_all_subnet_groups region=us-east-1 ''' conn = _get_conn(re...
python
def get_all_cache_subnet_groups(name=None, region=None, key=None, keyid=None, profile=None): ''' Return a list of all cache subnet groups with details CLI example:: salt myminion boto_elasticache.get_all_subnet_groups region=us-east-1 ''' conn = _get_conn(re...
[ "def", "get_all_cache_subnet_groups", "(", "name", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "conn", "=", "_get_conn", "(", "region", "=", "region", ",", "key", ...
Return a list of all cache subnet groups with details CLI example:: salt myminion boto_elasticache.get_all_subnet_groups region=us-east-1
[ "Return", "a", "list", "of", "all", "cache", "subnet", "groups", "with", "details" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L362-L387
33,548
saltstack/salt
salt/modules/boto_elasticache.py
get_cache_subnet_group
def get_cache_subnet_group(name, region=None, key=None, keyid=None, profile=None): ''' Get information about a cache subnet group. CLI example:: salt myminion boto_elasticache.get_cache_subnet_group mycache_subnet_group ''' conn = _get_conn(region=region, key=key...
python
def get_cache_subnet_group(name, region=None, key=None, keyid=None, profile=None): ''' Get information about a cache subnet group. CLI example:: salt myminion boto_elasticache.get_cache_subnet_group mycache_subnet_group ''' conn = _get_conn(region=region, key=key...
[ "def", "get_cache_subnet_group", "(", "name", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "conn", "=", "_get_conn", "(", "region", "=", "region", ",", "key", "=", "key", ",", ...
Get information about a cache subnet group. CLI example:: salt myminion boto_elasticache.get_cache_subnet_group mycache_subnet_group
[ "Get", "information", "about", "a", "cache", "subnet", "group", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L471-L513
33,549
saltstack/salt
salt/modules/boto_elasticache.py
delete_subnet_group
def delete_subnet_group(name, region=None, key=None, keyid=None, profile=None): ''' Delete an ElastiCache subnet group. CLI example:: salt myminion boto_elasticache.delete_subnet_group my-subnet-group \ region=us-east-1 ''' conn = _get_conn(region=region, key=key, keyid=key...
python
def delete_subnet_group(name, region=None, key=None, keyid=None, profile=None): ''' Delete an ElastiCache subnet group. CLI example:: salt myminion boto_elasticache.delete_subnet_group my-subnet-group \ region=us-east-1 ''' conn = _get_conn(region=region, key=key, keyid=key...
[ "def", "delete_subnet_group", "(", "name", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "conn", "=", "_get_conn", "(", "region", "=", "region", ",", "key", "=", "key", ",", "...
Delete an ElastiCache subnet group. CLI example:: salt myminion boto_elasticache.delete_subnet_group my-subnet-group \ region=us-east-1
[ "Delete", "an", "ElastiCache", "subnet", "group", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L516-L537
33,550
saltstack/salt
salt/modules/boto_elasticache.py
delete
def delete(name, wait=False, region=None, key=None, keyid=None, profile=None): ''' Delete a cache cluster. CLI example:: salt myminion boto_elasticache.delete myelasticache ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) try: conn.delete_cache_cluste...
python
def delete(name, wait=False, region=None, key=None, keyid=None, profile=None): ''' Delete a cache cluster. CLI example:: salt myminion boto_elasticache.delete myelasticache ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) try: conn.delete_cache_cluste...
[ "def", "delete", "(", "name", ",", "wait", "=", "False", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "conn", "=", "_get_conn", "(", "region", "=", "region", ",", "key", "=...
Delete a cache cluster. CLI example:: salt myminion boto_elasticache.delete myelasticache
[ "Delete", "a", "cache", "cluster", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L584-L612
33,551
saltstack/salt
salt/output/__init__.py
try_printout
def try_printout(data, out, opts, **kwargs): ''' Safely get the string to print out, try the configured outputter, then fall back to nested and then to raw ''' try: printout = get_printout(out, opts)(data, **kwargs) if printout is not None: return printout.rstrip() ex...
python
def try_printout(data, out, opts, **kwargs): ''' Safely get the string to print out, try the configured outputter, then fall back to nested and then to raw ''' try: printout = get_printout(out, opts)(data, **kwargs) if printout is not None: return printout.rstrip() ex...
[ "def", "try_printout", "(", "data", ",", "out", ",", "opts", ",", "*", "*", "kwargs", ")", ":", "try", ":", "printout", "=", "get_printout", "(", "out", ",", "opts", ")", "(", "data", ",", "*", "*", "kwargs", ")", "if", "printout", "is", "not", "...
Safely get the string to print out, try the configured outputter, then fall back to nested and then to raw
[ "Safely", "get", "the", "string", "to", "print", "out", "try", "the", "configured", "outputter", "then", "fall", "back", "to", "nested", "and", "then", "to", "raw" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/__init__.py#L37-L56
33,552
saltstack/salt
salt/output/__init__.py
get_progress
def get_progress(opts, out, progress): ''' Get the progress bar from the given outputter ''' return salt.loader.raw_mod(opts, out, 'rawmodule', mod='output')['{0}.progress_iter'.format(out)](progress)
python
def get_progress(opts, out, progress): ''' Get the progress bar from the given outputter ''' return salt.loader.raw_mod(opts, out, 'rawmodule', mod='output')['{0}.progress_iter'.format(out)](progress)
[ "def", "get_progress", "(", "opts", ",", "out", ",", "progress", ")", ":", "return", "salt", ".", "loader", ".", "raw_mod", "(", "opts", ",", "out", ",", "'rawmodule'", ",", "mod", "=", "'output'", ")", "[", "'{0}.progress_iter'", ".", "format", "(", "...
Get the progress bar from the given outputter
[ "Get", "the", "progress", "bar", "from", "the", "given", "outputter" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/__init__.py#L59-L66
33,553
saltstack/salt
salt/output/__init__.py
update_progress
def update_progress(opts, progress, progress_iter, out): ''' Update the progress iterator for the given outputter ''' # Look up the outputter try: progress_outputter = salt.loader.outputters(opts)[out] except KeyError: # Outputter is not loaded log.warning('Progress outputter no...
python
def update_progress(opts, progress, progress_iter, out): ''' Update the progress iterator for the given outputter ''' # Look up the outputter try: progress_outputter = salt.loader.outputters(opts)[out] except KeyError: # Outputter is not loaded log.warning('Progress outputter no...
[ "def", "update_progress", "(", "opts", ",", "progress", ",", "progress_iter", ",", "out", ")", ":", "# Look up the outputter", "try", ":", "progress_outputter", "=", "salt", ".", "loader", ".", "outputters", "(", "opts", ")", "[", "out", "]", "except", "KeyE...
Update the progress iterator for the given outputter
[ "Update", "the", "progress", "iterator", "for", "the", "given", "outputter" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/__init__.py#L69-L79
33,554
saltstack/salt
salt/output/__init__.py
display_output
def display_output(data, out=None, opts=None, **kwargs): ''' Print the passed data using the desired output ''' if opts is None: opts = {} display_data = try_printout(data, out, opts, **kwargs) output_filename = opts.get('output_file', None) log.trace('data = %s', data) try: ...
python
def display_output(data, out=None, opts=None, **kwargs): ''' Print the passed data using the desired output ''' if opts is None: opts = {} display_data = try_printout(data, out, opts, **kwargs) output_filename = opts.get('output_file', None) log.trace('data = %s', data) try: ...
[ "def", "display_output", "(", "data", ",", "out", "=", "None", ",", "opts", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "opts", "is", "None", ":", "opts", "=", "{", "}", "display_data", "=", "try_printout", "(", "data", ",", "out", ",", ...
Print the passed data using the desired output
[ "Print", "the", "passed", "data", "using", "the", "desired", "output" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/__init__.py#L90-L132
33,555
saltstack/salt
salt/output/__init__.py
get_printout
def get_printout(out, opts=None, **kwargs): ''' Return a printer function ''' if opts is None: opts = {} if 'output' in opts and opts['output'] != 'highstate': # new --out option, but don't choke when using --out=highstate at CLI # See Issue #29796 for more information. ...
python
def get_printout(out, opts=None, **kwargs): ''' Return a printer function ''' if opts is None: opts = {} if 'output' in opts and opts['output'] != 'highstate': # new --out option, but don't choke when using --out=highstate at CLI # See Issue #29796 for more information. ...
[ "def", "get_printout", "(", "out", ",", "opts", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "opts", "is", "None", ":", "opts", "=", "{", "}", "if", "'output'", "in", "opts", "and", "opts", "[", "'output'", "]", "!=", "'highstate'", ":", ...
Return a printer function
[ "Return", "a", "printer", "function" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/__init__.py#L135-L198
33,556
saltstack/salt
salt/output/__init__.py
out_format
def out_format(data, out, opts=None, **kwargs): ''' Return the formatted outputter string for the passed data ''' return try_printout(data, out, opts, **kwargs)
python
def out_format(data, out, opts=None, **kwargs): ''' Return the formatted outputter string for the passed data ''' return try_printout(data, out, opts, **kwargs)
[ "def", "out_format", "(", "data", ",", "out", ",", "opts", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "try_printout", "(", "data", ",", "out", ",", "opts", ",", "*", "*", "kwargs", ")" ]
Return the formatted outputter string for the passed data
[ "Return", "the", "formatted", "outputter", "string", "for", "the", "passed", "data" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/__init__.py#L201-L205
33,557
saltstack/salt
salt/output/__init__.py
string_format
def string_format(data, out, opts=None, **kwargs): ''' Return the formatted outputter string, removing the ANSI escape sequences. ''' raw_output = try_printout(data, out, opts, **kwargs) ansi_escape = re.compile(r'\x1b[^m]*m') return ansi_escape.sub('', raw_output)
python
def string_format(data, out, opts=None, **kwargs): ''' Return the formatted outputter string, removing the ANSI escape sequences. ''' raw_output = try_printout(data, out, opts, **kwargs) ansi_escape = re.compile(r'\x1b[^m]*m') return ansi_escape.sub('', raw_output)
[ "def", "string_format", "(", "data", ",", "out", ",", "opts", "=", "None", ",", "*", "*", "kwargs", ")", ":", "raw_output", "=", "try_printout", "(", "data", ",", "out", ",", "opts", ",", "*", "*", "kwargs", ")", "ansi_escape", "=", "re", ".", "com...
Return the formatted outputter string, removing the ANSI escape sequences.
[ "Return", "the", "formatted", "outputter", "string", "removing", "the", "ANSI", "escape", "sequences", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/__init__.py#L208-L214
33,558
saltstack/salt
salt/utils/dns.py
_tree
def _tree(domain, tld=False): ''' Split out a domain in its parents Leverages tldextract to take the TLDs from publicsuffix.org or makes a valiant approximation of that :param domain: dc2.ams2.example.com :param tld: Include TLD in list :return: [ 'dc2.ams2.example.com', 'ams2.example.com'...
python
def _tree(domain, tld=False): ''' Split out a domain in its parents Leverages tldextract to take the TLDs from publicsuffix.org or makes a valiant approximation of that :param domain: dc2.ams2.example.com :param tld: Include TLD in list :return: [ 'dc2.ams2.example.com', 'ams2.example.com'...
[ "def", "_tree", "(", "domain", ",", "tld", "=", "False", ")", ":", "domain", "=", "domain", ".", "rstrip", "(", "'.'", ")", "assert", "'.'", "in", "domain", ",", "'Provide a decent domain'", "if", "not", "tld", ":", "if", "HAS_TLDEXTRACT", ":", "tld", ...
Split out a domain in its parents Leverages tldextract to take the TLDs from publicsuffix.org or makes a valiant approximation of that :param domain: dc2.ams2.example.com :param tld: Include TLD in list :return: [ 'dc2.ams2.example.com', 'ams2.example.com', 'example.com']
[ "Split", "out", "a", "domain", "in", "its", "parents" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dns.py#L134-L166
33,559
saltstack/salt
salt/utils/dns.py
lookup
def lookup( name, rdtype, method=None, servers=None, timeout=None, walk=False, walk_tld=False, secure=None ): ''' Lookup DNS records and return their data :param name: name to lookup :param rdtype: DNS record type :param method: gai (getaddrinfo()), dnspython, dig, d...
python
def lookup( name, rdtype, method=None, servers=None, timeout=None, walk=False, walk_tld=False, secure=None ): ''' Lookup DNS records and return their data :param name: name to lookup :param rdtype: DNS record type :param method: gai (getaddrinfo()), dnspython, dig, d...
[ "def", "lookup", "(", "name", ",", "rdtype", ",", "method", "=", "None", ",", "servers", "=", "None", ",", "timeout", "=", "None", ",", "walk", "=", "False", ",", "walk_tld", "=", "False", ",", "secure", "=", "None", ")", ":", "# opts = __opts__.get('d...
Lookup DNS records and return their data :param name: name to lookup :param rdtype: DNS record type :param method: gai (getaddrinfo()), dnspython, dig, drill, host, nslookup or auto (default) :param servers: (list of) server(s) to try in-order :param timeout: query timeout or a valiant approximatio...
[ "Lookup", "DNS", "records", "and", "return", "their", "data" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dns.py#L546-L654
33,560
saltstack/salt
salt/utils/dns.py
host
def host(name, ip4=True, ip6=True, **kwargs): ''' Return a list of addresses for name ip6: Return IPv6 addresses ip4: Return IPv4 addresses the rest is passed on to lookup() ''' res = {} if ip6: ip6 = lookup(name, 'AAAA', **kwargs) if ip6: re...
python
def host(name, ip4=True, ip6=True, **kwargs): ''' Return a list of addresses for name ip6: Return IPv6 addresses ip4: Return IPv4 addresses the rest is passed on to lookup() ''' res = {} if ip6: ip6 = lookup(name, 'AAAA', **kwargs) if ip6: re...
[ "def", "host", "(", "name", ",", "ip4", "=", "True", ",", "ip6", "=", "True", ",", "*", "*", "kwargs", ")", ":", "res", "=", "{", "}", "if", "ip6", ":", "ip6", "=", "lookup", "(", "name", ",", "'AAAA'", ",", "*", "*", "kwargs", ")", "if", "...
Return a list of addresses for name ip6: Return IPv6 addresses ip4: Return IPv4 addresses the rest is passed on to lookup()
[ "Return", "a", "list", "of", "addresses", "for", "name" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dns.py#L726-L747
33,561
saltstack/salt
salt/returners/__init__.py
get_returner_options
def get_returner_options(virtualname=None, ret=None, attrs=None, **kwargs): ''' Get the returner options from salt. :param str virtualname: The returner virtualname (as returned by __virtual__() :param ret: result of the...
python
def get_returner_options(virtualname=None, ret=None, attrs=None, **kwargs): ''' Get the returner options from salt. :param str virtualname: The returner virtualname (as returned by __virtual__() :param ret: result of the...
[ "def", "get_returner_options", "(", "virtualname", "=", "None", ",", "ret", "=", "None", ",", "attrs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret_config", "=", "_fetch_ret_config", "(", "ret", ")", "attrs", "=", "attrs", "or", "{", "}", "prof...
Get the returner options from salt. :param str virtualname: The returner virtualname (as returned by __virtual__() :param ret: result of the module that ran. dict-like object May contain a `ret_config` key pointing to a string If a `ret_config` is specified, config options are read fro...
[ "Get", "the", "returner", "options", "from", "salt", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/__init__.py#L16-L107
33,562
saltstack/salt
salt/returners/__init__.py
_fetch_option
def _fetch_option(cfg, ret_config, virtualname, attr_name): """ Fetch a given option value from the config. @see :func:`get_returner_options` """ # c_cfg is a dictionary returned from config.option for # any options configured for this returner. if isinstance(cfg, dict): c_cfg = cfg...
python
def _fetch_option(cfg, ret_config, virtualname, attr_name): """ Fetch a given option value from the config. @see :func:`get_returner_options` """ # c_cfg is a dictionary returned from config.option for # any options configured for this returner. if isinstance(cfg, dict): c_cfg = cfg...
[ "def", "_fetch_option", "(", "cfg", ",", "ret_config", ",", "virtualname", ",", "attr_name", ")", ":", "# c_cfg is a dictionary returned from config.option for", "# any options configured for this returner.", "if", "isinstance", "(", "cfg", ",", "dict", ")", ":", "c_cfg",...
Fetch a given option value from the config. @see :func:`get_returner_options`
[ "Fetch", "a", "given", "option", "value", "from", "the", "config", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/__init__.py#L123-L166
33,563
saltstack/salt
salt/returners/__init__.py
_options_browser
def _options_browser(cfg, ret_config, defaults, virtualname, options): """ Iterator generating all duples ```option name -> value``` @see :func:`get_returner_options` """ for option in options: # default place for the option in the config value = _fetch_option(cfg, ret_config, vir...
python
def _options_browser(cfg, ret_config, defaults, virtualname, options): """ Iterator generating all duples ```option name -> value``` @see :func:`get_returner_options` """ for option in options: # default place for the option in the config value = _fetch_option(cfg, ret_config, vir...
[ "def", "_options_browser", "(", "cfg", ",", "ret_config", ",", "defaults", ",", "virtualname", ",", "options", ")", ":", "for", "option", "in", "options", ":", "# default place for the option in the config", "value", "=", "_fetch_option", "(", "cfg", ",", "ret_con...
Iterator generating all duples ```option name -> value``` @see :func:`get_returner_options`
[ "Iterator", "generating", "all", "duples", "option", "name", "-", ">", "value" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/__init__.py#L169-L193
33,564
saltstack/salt
salt/returners/__init__.py
_fetch_profile_opts
def _fetch_profile_opts( cfg, virtualname, __salt__, _options, profile_attr, profile_attrs ): """ Fetches profile specific options if applicable @see :func:`get_returner_options` :return: a options dict """ if (not profile_attr) or (profile_attr not...
python
def _fetch_profile_opts( cfg, virtualname, __salt__, _options, profile_attr, profile_attrs ): """ Fetches profile specific options if applicable @see :func:`get_returner_options` :return: a options dict """ if (not profile_attr) or (profile_attr not...
[ "def", "_fetch_profile_opts", "(", "cfg", ",", "virtualname", ",", "__salt__", ",", "_options", ",", "profile_attr", ",", "profile_attrs", ")", ":", "if", "(", "not", "profile_attr", ")", "or", "(", "profile_attr", "not", "in", "_options", ")", ":", "return"...
Fetches profile specific options if applicable @see :func:`get_returner_options` :return: a options dict
[ "Fetches", "profile", "specific", "options", "if", "applicable" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/__init__.py#L196-L235
33,565
saltstack/salt
salt/states/rabbitmq_plugin.py
enabled
def enabled(name, runas=None): ''' Ensure the RabbitMQ plugin is enabled. name The name of the plugin runas The user to run the rabbitmq-plugin command as ''' ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} try: plugin_enabled = __salt__['rabbitm...
python
def enabled(name, runas=None): ''' Ensure the RabbitMQ plugin is enabled. name The name of the plugin runas The user to run the rabbitmq-plugin command as ''' ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} try: plugin_enabled = __salt__['rabbitm...
[ "def", "enabled", "(", "name", ",", "runas", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", "}", "try", ":", "plugin_enabled", "=", "__salt_...
Ensure the RabbitMQ plugin is enabled. name The name of the plugin runas The user to run the rabbitmq-plugin command as
[ "Ensure", "the", "RabbitMQ", "plugin", "is", "enabled", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/rabbitmq_plugin.py#L35-L73
33,566
saltstack/salt
salt/states/git.py
_get_branch_opts
def _get_branch_opts(branch, local_branch, all_local_branches, desired_upstream, git_ver=None): ''' DRY helper to build list of opts for git.branch, for the purposes of setting upstream tracking branch ''' if branch is not None and branch not in all_local_branches: # We ...
python
def _get_branch_opts(branch, local_branch, all_local_branches, desired_upstream, git_ver=None): ''' DRY helper to build list of opts for git.branch, for the purposes of setting upstream tracking branch ''' if branch is not None and branch not in all_local_branches: # We ...
[ "def", "_get_branch_opts", "(", "branch", ",", "local_branch", ",", "all_local_branches", ",", "desired_upstream", ",", "git_ver", "=", "None", ")", ":", "if", "branch", "is", "not", "None", "and", "branch", "not", "in", "all_local_branches", ":", "# We won't be...
DRY helper to build list of opts for git.branch, for the purposes of setting upstream tracking branch
[ "DRY", "helper", "to", "build", "list", "of", "opts", "for", "git", ".", "branch", "for", "the", "purposes", "of", "setting", "upstream", "tracking", "branch" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/git.py#L87-L110
33,567
saltstack/salt
salt/modules/pushbullet.py
push_note
def push_note(device=None, title=None, body=None): ''' Pushing a text note. :param device: Pushbullet target device :param title: Note title :param body: Note body :return: Boolean if message was sent successfully. CLI Example: .. code-block:: bash salt "...
python
def push_note(device=None, title=None, body=None): ''' Pushing a text note. :param device: Pushbullet target device :param title: Note title :param body: Note body :return: Boolean if message was sent successfully. CLI Example: .. code-block:: bash salt "...
[ "def", "push_note", "(", "device", "=", "None", ",", "title", "=", "None", ",", "body", "=", "None", ")", ":", "spb", "=", "_SaltPushbullet", "(", "device", ")", "res", "=", "spb", ".", "push_note", "(", "title", ",", "body", ")", "return", "res" ]
Pushing a text note. :param device: Pushbullet target device :param title: Note title :param body: Note body :return: Boolean if message was sent successfully. CLI Example: .. code-block:: bash salt "*" pushbullet.push_note device="Chrome" title="Example title" b...
[ "Pushing", "a", "text", "note", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pushbullet.py#L65-L84
33,568
saltstack/salt
salt/modules/travisci.py
verify_webhook
def verify_webhook(signature, body): ''' Verify the webhook signature from travisci signature The signature header from the webhook header body The full payload body from the webhook post .. note:: The body needs to be the urlencoded version of the body. CLI Example: .. ...
python
def verify_webhook(signature, body): ''' Verify the webhook signature from travisci signature The signature header from the webhook header body The full payload body from the webhook post .. note:: The body needs to be the urlencoded version of the body. CLI Example: .. ...
[ "def", "verify_webhook", "(", "signature", ",", "body", ")", ":", "# get public key setup", "public_key", "=", "__utils__", "[", "'http.query'", "]", "(", "'https://api.travis-ci.org/config'", ")", "[", "'config'", "]", "[", "'notifications'", "]", "[", "'webhook'",...
Verify the webhook signature from travisci signature The signature header from the webhook header body The full payload body from the webhook post .. note:: The body needs to be the urlencoded version of the body. CLI Example: .. code-block:: bash salt '*' travisci.veri...
[ "Verify", "the", "webhook", "signature", "from", "travisci" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/travisci.py#L42-L77
33,569
saltstack/salt
salt/states/network.py
routes
def routes(name, **kwargs): ''' Manage network interface static routes. name Interface name to apply the route to. kwargs Named routes ''' ret = { 'name': name, 'changes': {}, 'result': True, 'comment': 'Interface {0} routes are up to date.'.form...
python
def routes(name, **kwargs): ''' Manage network interface static routes. name Interface name to apply the route to. kwargs Named routes ''' ret = { 'name': name, 'changes': {}, 'result': True, 'comment': 'Interface {0} routes are up to date.'.form...
[ "def", "routes", "(", "name", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "'Interface {0} routes are up to date.'", ".", "format", "(", ...
Manage network interface static routes. name Interface name to apply the route to. kwargs Named routes
[ "Manage", "network", "interface", "static", "routes", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/network.py#L554-L614
33,570
saltstack/salt
salt/states/network.py
system
def system(name, **kwargs): ''' Ensure that global network settings are configured properly. name Custom name to represent this configuration change. kwargs The global parameters for the system. ''' ret = { 'name': name, 'changes': {}, 'result': True, ...
python
def system(name, **kwargs): ''' Ensure that global network settings are configured properly. name Custom name to represent this configuration change. kwargs The global parameters for the system. ''' ret = { 'name': name, 'changes': {}, 'result': True, ...
[ "def", "system", "(", "name", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "'Global network settings are up to date.'", ",", "}", "apply_n...
Ensure that global network settings are configured properly. name Custom name to represent this configuration change. kwargs The global parameters for the system.
[ "Ensure", "that", "global", "network", "settings", "are", "configured", "properly", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/network.py#L617-L678
33,571
saltstack/salt
salt/utils/network.py
isportopen
def isportopen(host, port): ''' Return status of a port ''' if not 1 <= int(port) <= 65535: return False sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) out = sock.connect_ex((sanitize_host(host), int(port))) return out
python
def isportopen(host, port): ''' Return status of a port ''' if not 1 <= int(port) <= 65535: return False sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) out = sock.connect_ex((sanitize_host(host), int(port))) return out
[ "def", "isportopen", "(", "host", ",", "port", ")", ":", "if", "not", "1", "<=", "int", "(", "port", ")", "<=", "65535", ":", "return", "False", "sock", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_STREAM", ...
Return status of a port
[ "Return", "status", "of", "a", "port" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L67-L78
33,572
saltstack/salt
salt/utils/network.py
host_to_ips
def host_to_ips(host): ''' Returns a list of IP addresses of a given hostname or None if not found. ''' ips = [] try: for family, socktype, proto, canonname, sockaddr in socket.getaddrinfo( host, 0, socket.AF_UNSPEC, socket.SOCK_STREAM): if family == socket.AF_INE...
python
def host_to_ips(host): ''' Returns a list of IP addresses of a given hostname or None if not found. ''' ips = [] try: for family, socktype, proto, canonname, sockaddr in socket.getaddrinfo( host, 0, socket.AF_UNSPEC, socket.SOCK_STREAM): if family == socket.AF_INE...
[ "def", "host_to_ips", "(", "host", ")", ":", "ips", "=", "[", "]", "try", ":", "for", "family", ",", "socktype", ",", "proto", ",", "canonname", ",", "sockaddr", "in", "socket", ".", "getaddrinfo", "(", "host", ",", "0", ",", "socket", ".", "AF_UNSPE...
Returns a list of IP addresses of a given hostname or None if not found.
[ "Returns", "a", "list", "of", "IP", "addresses", "of", "a", "given", "hostname", "or", "None", "if", "not", "found", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L81-L98
33,573
saltstack/salt
salt/utils/network.py
_generate_minion_id
def _generate_minion_id(): ''' Get list of possible host names and convention names. :return: ''' # There are three types of hostnames: # 1. Network names. How host is accessed from the network. # 2. Host aliases. They might be not available in all the network or only locally (/etc/hosts) ...
python
def _generate_minion_id(): ''' Get list of possible host names and convention names. :return: ''' # There are three types of hostnames: # 1. Network names. How host is accessed from the network. # 2. Host aliases. They might be not available in all the network or only locally (/etc/hosts) ...
[ "def", "_generate_minion_id", "(", ")", ":", "# There are three types of hostnames:", "# 1. Network names. How host is accessed from the network.", "# 2. Host aliases. They might be not available in all the network or only locally (/etc/hosts)", "# 3. Convention names, an internal nodename.", "cla...
Get list of possible host names and convention names. :return:
[ "Get", "list", "of", "possible", "host", "names", "and", "convention", "names", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L101-L170
33,574
saltstack/salt
salt/utils/network.py
generate_minion_id
def generate_minion_id(): ''' Return only first element of the hostname from all possible list. :return: ''' try: ret = salt.utils.stringutils.to_unicode(_generate_minion_id().first()) except TypeError: ret = None return ret or 'localhost'
python
def generate_minion_id(): ''' Return only first element of the hostname from all possible list. :return: ''' try: ret = salt.utils.stringutils.to_unicode(_generate_minion_id().first()) except TypeError: ret = None return ret or 'localhost'
[ "def", "generate_minion_id", "(", ")", ":", "try", ":", "ret", "=", "salt", ".", "utils", ".", "stringutils", ".", "to_unicode", "(", "_generate_minion_id", "(", ")", ".", "first", "(", ")", ")", "except", "TypeError", ":", "ret", "=", "None", "return", ...
Return only first element of the hostname from all possible list. :return:
[ "Return", "only", "first", "element", "of", "the", "hostname", "from", "all", "possible", "list", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L173-L183
33,575
saltstack/salt
salt/utils/network.py
get_socket
def get_socket(addr, type=socket.SOCK_STREAM, proto=0): ''' Return a socket object for the addr IP-version agnostic ''' version = ipaddress.ip_address(addr).version if version == 4: family = socket.AF_INET elif version == 6: family = socket.AF_INET6 return socket.socket(...
python
def get_socket(addr, type=socket.SOCK_STREAM, proto=0): ''' Return a socket object for the addr IP-version agnostic ''' version = ipaddress.ip_address(addr).version if version == 4: family = socket.AF_INET elif version == 6: family = socket.AF_INET6 return socket.socket(...
[ "def", "get_socket", "(", "addr", ",", "type", "=", "socket", ".", "SOCK_STREAM", ",", "proto", "=", "0", ")", ":", "version", "=", "ipaddress", ".", "ip_address", "(", "addr", ")", ".", "version", "if", "version", "==", "4", ":", "family", "=", "soc...
Return a socket object for the addr IP-version agnostic
[ "Return", "a", "socket", "object", "for", "the", "addr", "IP", "-", "version", "agnostic" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L186-L197
33,576
saltstack/salt
salt/utils/network.py
get_fqhostname
def get_fqhostname(): ''' Returns the fully qualified hostname ''' # try getaddrinfo() fqdn = None try: addrinfo = socket.getaddrinfo( socket.gethostname(), 0, socket.AF_UNSPEC, socket.SOCK_STREAM, socket.SOL_TCP, socket.AI_CANONNAME ) for info in ...
python
def get_fqhostname(): ''' Returns the fully qualified hostname ''' # try getaddrinfo() fqdn = None try: addrinfo = socket.getaddrinfo( socket.gethostname(), 0, socket.AF_UNSPEC, socket.SOCK_STREAM, socket.SOL_TCP, socket.AI_CANONNAME ) for info in ...
[ "def", "get_fqhostname", "(", ")", ":", "# try getaddrinfo()", "fqdn", "=", "None", "try", ":", "addrinfo", "=", "socket", ".", "getaddrinfo", "(", "socket", ".", "gethostname", "(", ")", ",", "0", ",", "socket", ".", "AF_UNSPEC", ",", "socket", ".", "SO...
Returns the fully qualified hostname
[ "Returns", "the", "fully", "qualified", "hostname" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L200-L224
33,577
saltstack/salt
salt/utils/network.py
ip_to_host
def ip_to_host(ip): ''' Returns the hostname of a given IP ''' try: hostname, aliaslist, ipaddrlist = socket.gethostbyaddr(ip) except Exception as exc: log.debug('salt.utils.network.ip_to_host(%r) failed: %s', ip, exc) hostname = None return hostname
python
def ip_to_host(ip): ''' Returns the hostname of a given IP ''' try: hostname, aliaslist, ipaddrlist = socket.gethostbyaddr(ip) except Exception as exc: log.debug('salt.utils.network.ip_to_host(%r) failed: %s', ip, exc) hostname = None return hostname
[ "def", "ip_to_host", "(", "ip", ")", ":", "try", ":", "hostname", ",", "aliaslist", ",", "ipaddrlist", "=", "socket", ".", "gethostbyaddr", "(", "ip", ")", "except", "Exception", "as", "exc", ":", "log", ".", "debug", "(", "'salt.utils.network.ip_to_host(%r)...
Returns the hostname of a given IP
[ "Returns", "the", "hostname", "of", "a", "given", "IP" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L227-L236
33,578
saltstack/salt
salt/utils/network.py
is_ip_filter
def is_ip_filter(ip, options=None): ''' Returns a bool telling if the passed IP is a valid IPv4 or IPv6 address. ''' return is_ipv4_filter(ip, options=options) or is_ipv6_filter(ip, options=options)
python
def is_ip_filter(ip, options=None): ''' Returns a bool telling if the passed IP is a valid IPv4 or IPv6 address. ''' return is_ipv4_filter(ip, options=options) or is_ipv6_filter(ip, options=options)
[ "def", "is_ip_filter", "(", "ip", ",", "options", "=", "None", ")", ":", "return", "is_ipv4_filter", "(", "ip", ",", "options", "=", "options", ")", "or", "is_ipv6_filter", "(", "ip", ",", "options", "=", "options", ")" ]
Returns a bool telling if the passed IP is a valid IPv4 or IPv6 address.
[ "Returns", "a", "bool", "telling", "if", "the", "passed", "IP", "is", "a", "valid", "IPv4", "or", "IPv6", "address", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L311-L315
33,579
saltstack/salt
salt/utils/network.py
is_ipv4_filter
def is_ipv4_filter(ip, options=None): ''' Returns a bool telling if the value passed to it was a valid IPv4 address. ip The IP address. net: False Consider IP addresses followed by netmask. options CSV of options regarding the nature of the IP address. E.g.: loopback, mult...
python
def is_ipv4_filter(ip, options=None): ''' Returns a bool telling if the value passed to it was a valid IPv4 address. ip The IP address. net: False Consider IP addresses followed by netmask. options CSV of options regarding the nature of the IP address. E.g.: loopback, mult...
[ "def", "is_ipv4_filter", "(", "ip", ",", "options", "=", "None", ")", ":", "_is_ipv4", "=", "_is_ipv", "(", "ip", ",", "4", ",", "options", "=", "options", ")", "return", "isinstance", "(", "_is_ipv4", ",", "six", ".", "string_types", ")" ]
Returns a bool telling if the value passed to it was a valid IPv4 address. ip The IP address. net: False Consider IP addresses followed by netmask. options CSV of options regarding the nature of the IP address. E.g.: loopback, multicast, private etc.
[ "Returns", "a", "bool", "telling", "if", "the", "value", "passed", "to", "it", "was", "a", "valid", "IPv4", "address", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L414-L428
33,580
saltstack/salt
salt/utils/network.py
is_ipv6_filter
def is_ipv6_filter(ip, options=None): ''' Returns a bool telling if the value passed to it was a valid IPv6 address. ip The IP address. net: False Consider IP addresses followed by netmask. options CSV of options regarding the nature of the IP address. E.g.: loopback, mult...
python
def is_ipv6_filter(ip, options=None): ''' Returns a bool telling if the value passed to it was a valid IPv6 address. ip The IP address. net: False Consider IP addresses followed by netmask. options CSV of options regarding the nature of the IP address. E.g.: loopback, mult...
[ "def", "is_ipv6_filter", "(", "ip", ",", "options", "=", "None", ")", ":", "_is_ipv6", "=", "_is_ipv", "(", "ip", ",", "6", ",", "options", "=", "options", ")", "return", "isinstance", "(", "_is_ipv6", ",", "six", ".", "string_types", ")" ]
Returns a bool telling if the value passed to it was a valid IPv6 address. ip The IP address. net: False Consider IP addresses followed by netmask. options CSV of options regarding the nature of the IP address. E.g.: loopback, multicast, private etc.
[ "Returns", "a", "bool", "telling", "if", "the", "value", "passed", "to", "it", "was", "a", "valid", "IPv6", "address", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L432-L446
33,581
saltstack/salt
salt/utils/network.py
ipaddr
def ipaddr(value, options=None): ''' Filters and returns only valid IP objects. ''' ipv4_obj = ipv4(value, options=options) ipv6_obj = ipv6(value, options=options) if ipv4_obj is None or ipv6_obj is None: # an IP address can be either IPv4 either IPv6 # therefofe if the value pas...
python
def ipaddr(value, options=None): ''' Filters and returns only valid IP objects. ''' ipv4_obj = ipv4(value, options=options) ipv6_obj = ipv6(value, options=options) if ipv4_obj is None or ipv6_obj is None: # an IP address can be either IPv4 either IPv6 # therefofe if the value pas...
[ "def", "ipaddr", "(", "value", ",", "options", "=", "None", ")", ":", "ipv4_obj", "=", "ipv4", "(", "value", ",", "options", "=", "options", ")", "ipv6_obj", "=", "ipv6", "(", "value", ",", "options", "=", "options", ")", "if", "ipv4_obj", "is", "Non...
Filters and returns only valid IP objects.
[ "Filters", "and", "returns", "only", "valid", "IP", "objects", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L484-L496
33,582
saltstack/salt
salt/utils/network.py
network_hosts
def network_hosts(value, options=None, version=None): ''' Return the list of hosts within a network. .. note:: When running this command with a large IPv6 network, the command will take a long time to gather all of the hosts. ''' ipaddr_filter_out = _filter_ipaddr(value, options=op...
python
def network_hosts(value, options=None, version=None): ''' Return the list of hosts within a network. .. note:: When running this command with a large IPv6 network, the command will take a long time to gather all of the hosts. ''' ipaddr_filter_out = _filter_ipaddr(value, options=op...
[ "def", "network_hosts", "(", "value", ",", "options", "=", "None", ",", "version", "=", "None", ")", ":", "ipaddr_filter_out", "=", "_filter_ipaddr", "(", "value", ",", "options", "=", "options", ",", "version", "=", "version", ")", "if", "not", "ipaddr_fi...
Return the list of hosts within a network. .. note:: When running this command with a large IPv6 network, the command will take a long time to gather all of the hosts.
[ "Return", "the", "list", "of", "hosts", "within", "a", "network", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L536-L553
33,583
saltstack/salt
salt/utils/network.py
network_size
def network_size(value, options=None, version=None): ''' Get the size of a network. ''' ipaddr_filter_out = _filter_ipaddr(value, options=options, version=version) if not ipaddr_filter_out: return if not isinstance(value, (list, tuple, types.GeneratorType)): return _network_size(...
python
def network_size(value, options=None, version=None): ''' Get the size of a network. ''' ipaddr_filter_out = _filter_ipaddr(value, options=options, version=version) if not ipaddr_filter_out: return if not isinstance(value, (list, tuple, types.GeneratorType)): return _network_size(...
[ "def", "network_size", "(", "value", ",", "options", "=", "None", ",", "version", "=", "None", ")", ":", "ipaddr_filter_out", "=", "_filter_ipaddr", "(", "value", ",", "options", "=", "options", ",", "version", "=", "version", ")", "if", "not", "ipaddr_fil...
Get the size of a network.
[ "Get", "the", "size", "of", "a", "network", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L561-L573
33,584
saltstack/salt
salt/utils/network.py
natural_ipv4_netmask
def natural_ipv4_netmask(ip, fmt='prefixlen'): ''' Returns the "natural" mask of an IPv4 address ''' bits = _ipv4_to_bits(ip) if bits.startswith('11'): mask = '24' elif bits.startswith('1'): mask = '16' else: mask = '8' if fmt == 'netmask': return cidr_t...
python
def natural_ipv4_netmask(ip, fmt='prefixlen'): ''' Returns the "natural" mask of an IPv4 address ''' bits = _ipv4_to_bits(ip) if bits.startswith('11'): mask = '24' elif bits.startswith('1'): mask = '16' else: mask = '8' if fmt == 'netmask': return cidr_t...
[ "def", "natural_ipv4_netmask", "(", "ip", ",", "fmt", "=", "'prefixlen'", ")", ":", "bits", "=", "_ipv4_to_bits", "(", "ip", ")", "if", "bits", ".", "startswith", "(", "'11'", ")", ":", "mask", "=", "'24'", "elif", "bits", ".", "startswith", "(", "'1'"...
Returns the "natural" mask of an IPv4 address
[ "Returns", "the", "natural", "mask", "of", "an", "IPv4", "address" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L576-L592
33,585
saltstack/salt
salt/utils/network.py
cidr_to_ipv4_netmask
def cidr_to_ipv4_netmask(cidr_bits): ''' Returns an IPv4 netmask ''' try: cidr_bits = int(cidr_bits) if not 1 <= cidr_bits <= 32: return '' except ValueError: return '' netmask = '' for idx in range(4): if idx: netmask += '.' i...
python
def cidr_to_ipv4_netmask(cidr_bits): ''' Returns an IPv4 netmask ''' try: cidr_bits = int(cidr_bits) if not 1 <= cidr_bits <= 32: return '' except ValueError: return '' netmask = '' for idx in range(4): if idx: netmask += '.' i...
[ "def", "cidr_to_ipv4_netmask", "(", "cidr_bits", ")", ":", "try", ":", "cidr_bits", "=", "int", "(", "cidr_bits", ")", "if", "not", "1", "<=", "cidr_bits", "<=", "32", ":", "return", "''", "except", "ValueError", ":", "return", "''", "netmask", "=", "''"...
Returns an IPv4 netmask
[ "Returns", "an", "IPv4", "netmask" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L606-L627
33,586
saltstack/salt
salt/utils/network.py
_number_of_set_bits
def _number_of_set_bits(x): ''' Returns the number of bits that are set in a 32bit int ''' # Taken from http://stackoverflow.com/a/4912729. Many thanks! x -= (x >> 1) & 0x55555555 x = ((x >> 2) & 0x33333333) + (x & 0x33333333) x = ((x >> 4) + x) & 0x0f0f0f0f x += x >> 8 x += x >> 16 ...
python
def _number_of_set_bits(x): ''' Returns the number of bits that are set in a 32bit int ''' # Taken from http://stackoverflow.com/a/4912729. Many thanks! x -= (x >> 1) & 0x55555555 x = ((x >> 2) & 0x33333333) + (x & 0x33333333) x = ((x >> 4) + x) & 0x0f0f0f0f x += x >> 8 x += x >> 16 ...
[ "def", "_number_of_set_bits", "(", "x", ")", ":", "# Taken from http://stackoverflow.com/a/4912729. Many thanks!", "x", "-=", "(", "x", ">>", "1", ")", "&", "0x55555555", "x", "=", "(", "(", "x", ">>", "2", ")", "&", "0x33333333", ")", "+", "(", "x", "&", ...
Returns the number of bits that are set in a 32bit int
[ "Returns", "the", "number", "of", "bits", "that", "are", "set", "in", "a", "32bit", "int" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L640-L650
33,587
saltstack/salt
salt/utils/network.py
win_interfaces
def win_interfaces(): ''' Obtain interface information for Windows systems ''' with salt.utils.winapi.Com(): c = wmi.WMI() ifaces = {} for iface in c.Win32_NetworkAdapterConfiguration(IPEnabled=1): ifaces[iface.Description] = dict() if iface.MACAddress: ...
python
def win_interfaces(): ''' Obtain interface information for Windows systems ''' with salt.utils.winapi.Com(): c = wmi.WMI() ifaces = {} for iface in c.Win32_NetworkAdapterConfiguration(IPEnabled=1): ifaces[iface.Description] = dict() if iface.MACAddress: ...
[ "def", "win_interfaces", "(", ")", ":", "with", "salt", ".", "utils", ".", "winapi", ".", "Com", "(", ")", ":", "c", "=", "wmi", ".", "WMI", "(", ")", "ifaces", "=", "{", "}", "for", "iface", "in", "c", ".", "Win32_NetworkAdapterConfiguration", "(", ...
Obtain interface information for Windows systems
[ "Obtain", "interface", "information", "for", "Windows", "systems" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1005-L1048
33,588
saltstack/salt
salt/utils/network.py
interfaces
def interfaces(): ''' Return a dictionary of information about all the interfaces on the minion ''' if salt.utils.platform.is_windows(): return win_interfaces() elif salt.utils.platform.is_netbsd(): return netbsd_interfaces() else: return linux_interfaces()
python
def interfaces(): ''' Return a dictionary of information about all the interfaces on the minion ''' if salt.utils.platform.is_windows(): return win_interfaces() elif salt.utils.platform.is_netbsd(): return netbsd_interfaces() else: return linux_interfaces()
[ "def", "interfaces", "(", ")", ":", "if", "salt", ".", "utils", ".", "platform", ".", "is_windows", "(", ")", ":", "return", "win_interfaces", "(", ")", "elif", "salt", ".", "utils", ".", "platform", ".", "is_netbsd", "(", ")", ":", "return", "netbsd_i...
Return a dictionary of information about all the interfaces on the minion
[ "Return", "a", "dictionary", "of", "information", "about", "all", "the", "interfaces", "on", "the", "minion" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1051-L1060
33,589
saltstack/salt
salt/utils/network.py
get_net_start
def get_net_start(ipaddr, netmask): ''' Return the address of the network ''' net = ipaddress.ip_network('{0}/{1}'.format(ipaddr, netmask), strict=False) return six.text_type(net.network_address)
python
def get_net_start(ipaddr, netmask): ''' Return the address of the network ''' net = ipaddress.ip_network('{0}/{1}'.format(ipaddr, netmask), strict=False) return six.text_type(net.network_address)
[ "def", "get_net_start", "(", "ipaddr", ",", "netmask", ")", ":", "net", "=", "ipaddress", ".", "ip_network", "(", "'{0}/{1}'", ".", "format", "(", "ipaddr", ",", "netmask", ")", ",", "strict", "=", "False", ")", "return", "six", ".", "text_type", "(", ...
Return the address of the network
[ "Return", "the", "address", "of", "the", "network" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1063-L1068
33,590
saltstack/salt
salt/utils/network.py
_ipv4_to_bits
def _ipv4_to_bits(ipaddr): ''' Accepts an IPv4 dotted quad and returns a string representing its binary counterpart ''' return ''.join([bin(int(x))[2:].rjust(8, '0') for x in ipaddr.split('.')])
python
def _ipv4_to_bits(ipaddr): ''' Accepts an IPv4 dotted quad and returns a string representing its binary counterpart ''' return ''.join([bin(int(x))[2:].rjust(8, '0') for x in ipaddr.split('.')])
[ "def", "_ipv4_to_bits", "(", "ipaddr", ")", ":", "return", "''", ".", "join", "(", "[", "bin", "(", "int", "(", "x", ")", ")", "[", "2", ":", "]", ".", "rjust", "(", "8", ",", "'0'", ")", "for", "x", "in", "ipaddr", ".", "split", "(", "'.'", ...
Accepts an IPv4 dotted quad and returns a string representing its binary counterpart
[ "Accepts", "an", "IPv4", "dotted", "quad", "and", "returns", "a", "string", "representing", "its", "binary", "counterpart" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1094-L1099
33,591
saltstack/salt
salt/utils/network.py
_get_iface_info
def _get_iface_info(iface): ''' If `iface` is available, return interface info and no error, otherwise return no info and log and return an error ''' iface_info = interfaces() if iface in iface_info.keys(): return iface_info, False else: error_msg = ('Interface "{0}" not in ...
python
def _get_iface_info(iface): ''' If `iface` is available, return interface info and no error, otherwise return no info and log and return an error ''' iface_info = interfaces() if iface in iface_info.keys(): return iface_info, False else: error_msg = ('Interface "{0}" not in ...
[ "def", "_get_iface_info", "(", "iface", ")", ":", "iface_info", "=", "interfaces", "(", ")", "if", "iface", "in", "iface_info", ".", "keys", "(", ")", ":", "return", "iface_info", ",", "False", "else", ":", "error_msg", "=", "(", "'Interface \"{0}\" not in a...
If `iface` is available, return interface info and no error, otherwise return no info and log and return an error
[ "If", "iface", "is", "available", "return", "interface", "info", "and", "no", "error", "otherwise", "return", "no", "info", "and", "log", "and", "return", "an", "error" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1102-L1115
33,592
saltstack/salt
salt/utils/network.py
interface
def interface(iface): ''' Return the details of `iface` or an error if it does not exist ''' iface_info, error = _get_iface_info(iface) if error is False: return iface_info.get(iface, {}).get('inet', '') else: return error
python
def interface(iface): ''' Return the details of `iface` or an error if it does not exist ''' iface_info, error = _get_iface_info(iface) if error is False: return iface_info.get(iface, {}).get('inet', '') else: return error
[ "def", "interface", "(", "iface", ")", ":", "iface_info", ",", "error", "=", "_get_iface_info", "(", "iface", ")", "if", "error", "is", "False", ":", "return", "iface_info", ".", "get", "(", "iface", ",", "{", "}", ")", ".", "get", "(", "'inet'", ","...
Return the details of `iface` or an error if it does not exist
[ "Return", "the", "details", "of", "iface", "or", "an", "error", "if", "it", "does", "not", "exist" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1159-L1168
33,593
saltstack/salt
salt/utils/network.py
interface_ip
def interface_ip(iface): ''' Return `iface` IPv4 addr or an error if `iface` does not exist ''' iface_info, error = _get_iface_info(iface) if error is False: inet = iface_info.get(iface, {}).get('inet', None) return inet[0].get('address', '') if inet else '' else: return...
python
def interface_ip(iface): ''' Return `iface` IPv4 addr or an error if `iface` does not exist ''' iface_info, error = _get_iface_info(iface) if error is False: inet = iface_info.get(iface, {}).get('inet', None) return inet[0].get('address', '') if inet else '' else: return...
[ "def", "interface_ip", "(", "iface", ")", ":", "iface_info", ",", "error", "=", "_get_iface_info", "(", "iface", ")", "if", "error", "is", "False", ":", "inet", "=", "iface_info", ".", "get", "(", "iface", ",", "{", "}", ")", ".", "get", "(", "'inet'...
Return `iface` IPv4 addr or an error if `iface` does not exist
[ "Return", "iface", "IPv4", "addr", "or", "an", "error", "if", "iface", "does", "not", "exist" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1171-L1181
33,594
saltstack/salt
salt/utils/network.py
_subnets
def _subnets(proto='inet', interfaces_=None): ''' Returns a list of subnets to which the host belongs ''' if interfaces_ is None: ifaces = interfaces() elif isinstance(interfaces_, list): ifaces = {} for key, value in six.iteritems(interfaces()): if key in interfa...
python
def _subnets(proto='inet', interfaces_=None): ''' Returns a list of subnets to which the host belongs ''' if interfaces_ is None: ifaces = interfaces() elif isinstance(interfaces_, list): ifaces = {} for key, value in six.iteritems(interfaces()): if key in interfa...
[ "def", "_subnets", "(", "proto", "=", "'inet'", ",", "interfaces_", "=", "None", ")", ":", "if", "interfaces_", "is", "None", ":", "ifaces", "=", "interfaces", "(", ")", "elif", "isinstance", "(", "interfaces_", ",", "list", ")", ":", "ifaces", "=", "{...
Returns a list of subnets to which the host belongs
[ "Returns", "a", "list", "of", "subnets", "to", "which", "the", "host", "belongs" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1184-L1221
33,595
saltstack/salt
salt/utils/network.py
_ip_addrs
def _ip_addrs(interface=None, include_loopback=False, interface_data=None, proto='inet'): ''' Return the full list of IP adresses matching the criteria proto = inet|inet6 ''' ret = set() ifaces = interface_data \ if isinstance(interface_data, dict) \ else interfaces() if in...
python
def _ip_addrs(interface=None, include_loopback=False, interface_data=None, proto='inet'): ''' Return the full list of IP adresses matching the criteria proto = inet|inet6 ''' ret = set() ifaces = interface_data \ if isinstance(interface_data, dict) \ else interfaces() if in...
[ "def", "_ip_addrs", "(", "interface", "=", "None", ",", "include_loopback", "=", "False", ",", "interface_data", "=", "None", ",", "proto", "=", "'inet'", ")", ":", "ret", "=", "set", "(", ")", "ifaces", "=", "interface_data", "if", "isinstance", "(", "i...
Return the full list of IP adresses matching the criteria proto = inet|inet6
[ "Return", "the", "full", "list", "of", "IP", "adresses", "matching", "the", "criteria" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1257-L1283
33,596
saltstack/salt
salt/utils/network.py
mac2eui64
def mac2eui64(mac, prefix=None): ''' Convert a MAC address to a EUI64 identifier or, with prefix provided, a full IPv6 address ''' # http://tools.ietf.org/html/rfc4291#section-2.5.1 eui64 = re.sub(r'[.:-]', '', mac).lower() eui64 = eui64[0:6] + 'fffe' + eui64[6:] eui64 = hex(int(eui64[0:...
python
def mac2eui64(mac, prefix=None): ''' Convert a MAC address to a EUI64 identifier or, with prefix provided, a full IPv6 address ''' # http://tools.ietf.org/html/rfc4291#section-2.5.1 eui64 = re.sub(r'[.:-]', '', mac).lower() eui64 = eui64[0:6] + 'fffe' + eui64[6:] eui64 = hex(int(eui64[0:...
[ "def", "mac2eui64", "(", "mac", ",", "prefix", "=", "None", ")", ":", "# http://tools.ietf.org/html/rfc4291#section-2.5.1", "eui64", "=", "re", ".", "sub", "(", "r'[.:-]'", ",", "''", ",", "mac", ")", ".", "lower", "(", ")", "eui64", "=", "eui64", "[", "...
Convert a MAC address to a EUI64 identifier or, with prefix provided, a full IPv6 address
[ "Convert", "a", "MAC", "address", "to", "a", "EUI64", "identifier", "or", "with", "prefix", "provided", "a", "full", "IPv6", "address" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1343-L1361
33,597
saltstack/salt
salt/utils/network.py
active_tcp
def active_tcp(): ''' Return a dict describing all active tcp connections as quickly as possible ''' ret = {} for statf in ['/proc/net/tcp', '/proc/net/tcp6']: if os.path.isfile(statf): with salt.utils.files.fopen(statf, 'rb') as fp_: for line in fp_: ...
python
def active_tcp(): ''' Return a dict describing all active tcp connections as quickly as possible ''' ret = {} for statf in ['/proc/net/tcp', '/proc/net/tcp6']: if os.path.isfile(statf): with salt.utils.files.fopen(statf, 'rb') as fp_: for line in fp_: ...
[ "def", "active_tcp", "(", ")", ":", "ret", "=", "{", "}", "for", "statf", "in", "[", "'/proc/net/tcp'", ",", "'/proc/net/tcp6'", "]", ":", "if", "os", ".", "path", ".", "isfile", "(", "statf", ")", ":", "with", "salt", ".", "utils", ".", "files", "...
Return a dict describing all active tcp connections as quickly as possible
[ "Return", "a", "dict", "describing", "all", "active", "tcp", "connections", "as", "quickly", "as", "possible" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1364-L1381
33,598
saltstack/salt
salt/utils/network.py
_remotes_on
def _remotes_on(port, which_end): ''' Return a set of ip addrs active tcp connections ''' port = int(port) ret = _netlink_tool_remote_on(port, which_end) if ret is not None: return ret ret = set() proc_available = False for statf in ['/proc/net/tcp', '/proc/net/tcp6']: ...
python
def _remotes_on(port, which_end): ''' Return a set of ip addrs active tcp connections ''' port = int(port) ret = _netlink_tool_remote_on(port, which_end) if ret is not None: return ret ret = set() proc_available = False for statf in ['/proc/net/tcp', '/proc/net/tcp6']: ...
[ "def", "_remotes_on", "(", "port", ",", "which_end", ")", ":", "port", "=", "int", "(", "port", ")", "ret", "=", "_netlink_tool_remote_on", "(", "port", ",", "which_end", ")", "if", "ret", "is", "not", "None", ":", "return", "ret", "ret", "=", "set", ...
Return a set of ip addrs active tcp connections
[ "Return", "a", "set", "of", "ip", "addrs", "active", "tcp", "connections" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1400-L1441
33,599
saltstack/salt
salt/utils/network.py
_netlink_tool_remote_on
def _netlink_tool_remote_on(port, which_end): ''' Returns set of ipv4 host addresses of remote established connections on local or remote tcp port. Parses output of shell 'ss' to get connections [root@salt-master ~]# ss -ant State Recv-Q Send-Q Local Address:Port ...
python
def _netlink_tool_remote_on(port, which_end): ''' Returns set of ipv4 host addresses of remote established connections on local or remote tcp port. Parses output of shell 'ss' to get connections [root@salt-master ~]# ss -ant State Recv-Q Send-Q Local Address:Port ...
[ "def", "_netlink_tool_remote_on", "(", "port", ",", "which_end", ")", ":", "remotes", "=", "set", "(", ")", "valid", "=", "False", "try", ":", "data", "=", "subprocess", ".", "check_output", "(", "[", "'ss'", ",", "'-ant'", "]", ")", "# pylint: disable=min...
Returns set of ipv4 host addresses of remote established connections on local or remote tcp port. Parses output of shell 'ss' to get connections [root@salt-master ~]# ss -ant State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 511 ...
[ "Returns", "set", "of", "ipv4", "host", "addresses", "of", "remote", "established", "connections", "on", "local", "or", "remote", "tcp", "port", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1462-L1504