partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | _set_tcp_keepalive | Ensure that TCP keepalives are set for the socket. | salt/transport/tcp.py | 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):
'''
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'):
... | [
"Ensure",
"that",
"TCP",
"keepalives",
"are",
"set",
"for",
"the",
"socket",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L83-L135 | [
"def",
"_set_tcp_keepalive",
"(",
"sock",
",",
"opts",
")",
":",
"if",
"hasattr",
"(",
"socket",
",",
"'SO_KEEPALIVE'",
")",
":",
"if",
"opts",
".",
"get",
"(",
"'tcp_keepalive'",
",",
"False",
")",
":",
"sock",
".",
"setsockopt",
"(",
"socket",
".",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AsyncTCPReqChannel._crypted_transfer | 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 | salt/transport/tcp.py | 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):
'''
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... | [
"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",... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L361-L391 | [
"def",
"_crypted_transfer",
"(",
"self",
",",
"load",
",",
"tries",
"=",
"3",
",",
"timeout",
"=",
"60",
")",
":",
"@",
"tornado",
".",
"gen",
".",
"coroutine",
"def",
"_do_transfer",
"(",
")",
":",
"data",
"=",
"yield",
"self",
".",
"message_client",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AsyncTCPPubChannel.send_id | 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. | salt/transport/tcp.py | 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):
'''
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['... | [
"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... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L451-L482 | [
"def",
"send_id",
"(",
"self",
",",
"tok",
",",
"force_auth",
")",
":",
"load",
"=",
"{",
"'id'",
":",
"self",
".",
"opts",
"[",
"'id'",
"]",
",",
"'tok'",
":",
"tok",
"}",
"@",
"tornado",
".",
"gen",
".",
"coroutine",
"def",
"_do_transfer",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AsyncTCPPubChannel.on_recv | Register an on_recv callback | salt/transport/tcp.py | 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):
'''
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... | [
"Register",
"an",
"on_recv",
"callback"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L579-L596 | [
"def",
"on_recv",
"(",
"self",
",",
"callback",
")",
":",
"if",
"callback",
"is",
"None",
":",
"return",
"self",
".",
"message_client",
".",
"on_recv",
"(",
"callback",
")",
"@",
"tornado",
".",
"gen",
".",
"coroutine",
"def",
"wrap_callback",
"(",
"body... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | TCPReqServerChannel.pre_fork | Pre-fork we need to create the zmq router device | salt/transport/tcp.py | def pre_fork(self, process_manager):
'''
Pre-fork we need to create the zmq router device
'''
salt.transport.mixins.auth.AESReqServerMixin.pre_fork(self, process_manager)
if USE_LOAD_BALANCER:
self.socket_queue = multiprocessing.Queue()
process_manager.add... | def pre_fork(self, process_manager):
'''
Pre-fork we need to create the zmq router device
'''
salt.transport.mixins.auth.AESReqServerMixin.pre_fork(self, process_manager)
if USE_LOAD_BALANCER:
self.socket_queue = multiprocessing.Queue()
process_manager.add... | [
"Pre",
"-",
"fork",
"we",
"need",
"to",
"create",
"the",
"zmq",
"router",
"device"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L633-L648 | [
"def",
"pre_fork",
"(",
"self",
",",
"process_manager",
")",
":",
"salt",
".",
"transport",
".",
"mixins",
".",
"auth",
".",
"AESReqServerMixin",
".",
"pre_fork",
"(",
"self",
",",
"process_manager",
")",
"if",
"USE_LOAD_BALANCER",
":",
"self",
".",
"socket_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | TCPReqServerChannel.post_fork | After forking we need to create all of the local sockets to listen to the
router
payload_handler: function to call with your payloads | salt/transport/tcp.py | def post_fork(self, payload_handler, io_loop):
'''
After forking we need to create all of the local sockets to listen to the
router
payload_handler: function to call with your payloads
'''
self.payload_handler = payload_handler
self.io_loop = io_loop
self... | def post_fork(self, payload_handler, io_loop):
'''
After forking we need to create all of the local sockets to listen to the
router
payload_handler: function to call with your payloads
'''
self.payload_handler = payload_handler
self.io_loop = io_loop
self... | [
"After",
"forking",
"we",
"need",
"to",
"create",
"all",
"of",
"the",
"local",
"sockets",
"to",
"listen",
"to",
"the",
"router"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L650-L676 | [
"def",
"post_fork",
"(",
"self",
",",
"payload_handler",
",",
"io_loop",
")",
":",
"self",
".",
"payload_handler",
"=",
"payload_handler",
"self",
".",
"io_loop",
"=",
"io_loop",
"self",
".",
"serial",
"=",
"salt",
".",
"payload",
".",
"Serial",
"(",
"self... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | TCPReqServerChannel.handle_message | Handle incoming messages from underylying tcp streams | salt/transport/tcp.py | def handle_message(self, stream, header, payload):
'''
Handle incoming messages from underylying tcp streams
'''
try:
try:
payload = self._decode_payload(payload)
except Exception:
stream.write(salt.transport.frame.frame_msg('bad lo... | def handle_message(self, stream, header, payload):
'''
Handle incoming messages from underylying tcp streams
'''
try:
try:
payload = self._decode_payload(payload)
except Exception:
stream.write(salt.transport.frame.frame_msg('bad lo... | [
"Handle",
"incoming",
"messages",
"from",
"underylying",
"tcp",
"streams"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L679-L750 | [
"def",
"handle_message",
"(",
"self",
",",
"stream",
",",
"header",
",",
"payload",
")",
":",
"try",
":",
"try",
":",
"payload",
"=",
"self",
".",
"_decode_payload",
"(",
"payload",
")",
"except",
"Exception",
":",
"stream",
".",
"write",
"(",
"salt",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltMessageServer.handle_stream | Handle incoming streams and add messages to the incoming queue | salt/transport/tcp.py | 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):
'''
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:
... | [
"Handle",
"incoming",
"streams",
"and",
"add",
"messages",
"to",
"the",
"incoming",
"queue"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L766-L791 | [
"def",
"handle_stream",
"(",
"self",
",",
"stream",
",",
"address",
")",
":",
"log",
".",
"trace",
"(",
"'Req client %s connected'",
",",
"address",
")",
"self",
".",
"clients",
".",
"append",
"(",
"(",
"stream",
",",
"address",
")",
")",
"unpacker",
"="... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltMessageServer.shutdown | Shutdown the whole server | salt/transport/tcp.py | def shutdown(self):
'''
Shutdown the whole server
'''
for item in self.clients:
client, address = item
client.close()
self.clients.remove(item) | def shutdown(self):
'''
Shutdown the whole server
'''
for item in self.clients:
client, address = item
client.close()
self.clients.remove(item) | [
"Shutdown",
"the",
"whole",
"server"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L793-L800 | [
"def",
"shutdown",
"(",
"self",
")",
":",
"for",
"item",
"in",
"self",
".",
"clients",
":",
"client",
",",
"address",
"=",
"item",
"client",
".",
"close",
"(",
")",
"self",
".",
"clients",
".",
"remove",
"(",
"item",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | TCPClientKeepAlive._create_stream | Override _create_stream() in TCPClient.
Tornado 4.5 added the kwargs 'source_ip' and 'source_port'.
Due to this, use **kwargs to swallow these and any future
kwargs to maintain compatibility. | salt/transport/tcp.py | def _create_stream(self, max_buffer_size, af, addr, **kwargs): # pylint: disable=unused-argument
'''
Override _create_stream() in TCPClient.
Tornado 4.5 added the kwargs 'source_ip' and 'source_port'.
Due to this, use **kwargs to swallow these and any future
kwargs to maintain ... | def _create_stream(self, max_buffer_size, af, addr, **kwargs): # pylint: disable=unused-argument
'''
Override _create_stream() in TCPClient.
Tornado 4.5 added the kwargs 'source_ip' and 'source_port'.
Due to this, use **kwargs to swallow these and any future
kwargs to maintain ... | [
"Override",
"_create_stream",
"()",
"in",
"TCPClient",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L849-L866 | [
"def",
"_create_stream",
"(",
"self",
",",
"max_buffer_size",
",",
"af",
",",
"addr",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"# Always connect in plaintext; we'll convert to ssl if necessary",
"# after one connection has completed.",
"sock",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltMessageClient._connect | Try to connect for the rest of time! | salt/transport/tcp.py | 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):
'''
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):
... | [
"Try",
"to",
"connect",
"for",
"the",
"rest",
"of",
"time!"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L1007-L1033 | [
"def",
"_connect",
"(",
"self",
")",
":",
"while",
"True",
":",
"if",
"self",
".",
"_closing",
":",
"break",
"try",
":",
"kwargs",
"=",
"{",
"}",
"if",
"self",
".",
"source_ip",
"or",
"self",
".",
"source_port",
":",
"if",
"tornado",
".",
"version_in... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltMessageClient.on_recv | Register a callback for received messages (that we didn't initiate) | salt/transport/tcp.py | def on_recv(self, callback):
'''
Register a callback for received messages (that we didn't initiate)
'''
if callback is None:
self._on_recv = callback
else:
def wrap_recv(header, body):
callback(body)
self._on_recv = wrap_recv | def on_recv(self, callback):
'''
Register a callback for received messages (that we didn't initiate)
'''
if callback is None:
self._on_recv = callback
else:
def wrap_recv(header, body):
callback(body)
self._on_recv = wrap_recv | [
"Register",
"a",
"callback",
"for",
"received",
"messages",
"(",
"that",
"we",
"didn",
"t",
"initiate",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L1142-L1151 | [
"def",
"on_recv",
"(",
"self",
",",
"callback",
")",
":",
"if",
"callback",
"is",
"None",
":",
"self",
".",
"_on_recv",
"=",
"callback",
"else",
":",
"def",
"wrap_recv",
"(",
"header",
",",
"body",
")",
":",
"callback",
"(",
"body",
")",
"self",
".",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltMessageClient.send | Send given message, and return a future | salt/transport/tcp.py | 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):
'''
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... | [
"Send",
"given",
"message",
"and",
"return",
"a",
"future"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L1167-L1194 | [
"def",
"send",
"(",
"self",
",",
"msg",
",",
"timeout",
"=",
"None",
",",
"callback",
"=",
"None",
",",
"raw",
"=",
"False",
")",
":",
"message_id",
"=",
"self",
".",
"_message_id",
"(",
")",
"header",
"=",
"{",
"'mid'",
":",
"message_id",
"}",
"fu... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | TCPPubServerChannel._publish_daemon | Bind to the interface specified in the configuration file | salt/transport/tcp.py | def _publish_daemon(self, **kwargs):
'''
Bind to the interface specified in the configuration file
'''
salt.utils.process.appendproctitle(self.__class__.__name__)
log_queue = kwargs.get('log_queue')
if log_queue is not None:
salt.log.setup.set_multiprocessing... | def _publish_daemon(self, **kwargs):
'''
Bind to the interface specified in the configuration file
'''
salt.utils.process.appendproctitle(self.__class__.__name__)
log_queue = kwargs.get('log_queue')
if log_queue is not None:
salt.log.setup.set_multiprocessing... | [
"Bind",
"to",
"the",
"interface",
"specified",
"in",
"the",
"configuration",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L1418-L1469 | [
"def",
"_publish_daemon",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"salt",
".",
"utils",
".",
"process",
".",
"appendproctitle",
"(",
"self",
".",
"__class__",
".",
"__name__",
")",
"log_queue",
"=",
"kwargs",
".",
"get",
"(",
"'log_queue'",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | TCPPubServerChannel.pre_fork | 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 | salt/transport/tcp.py | 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):
'''
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... | [
"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... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L1471-L1477 | [
"def",
"pre_fork",
"(",
"self",
",",
"process_manager",
",",
"kwargs",
"=",
"None",
")",
":",
"process_manager",
".",
"add_process",
"(",
"self",
".",
"_publish_daemon",
",",
"kwargs",
"=",
"kwargs",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | TCPPubServerChannel.publish | Publish "load" to minions | salt/transport/tcp.py | 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):
'''
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']:
... | [
"Publish",
"load",
"to",
"minions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L1479-L1520 | [
"def",
"publish",
"(",
"self",
",",
"load",
")",
":",
"payload",
"=",
"{",
"'enc'",
":",
"'aes'",
"}",
"crypticle",
"=",
"salt",
".",
"crypt",
".",
"Crypticle",
"(",
"self",
".",
"opts",
",",
"salt",
".",
"master",
".",
"SMaster",
".",
"secrets",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | find_file | Find the first file to match the path and ref, read the file out of git
and send the path to the newly cached file | salt/fileserver/gitfs.py | def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613
'''
Find the first file to match the path and ref, read the file out of git
and send the path to the newly cached file
'''
return _gitfs().find_file(path, tgt_env=tgt_env, **kwargs) | def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613
'''
Find the first file to match the path and ref, read the file out of git
and send the path to the newly cached file
'''
return _gitfs().find_file(path, tgt_env=tgt_env, **kwargs) | [
"Find",
"the",
"first",
"file",
"to",
"match",
"the",
"path",
"and",
"ref",
"read",
"the",
"file",
"out",
"of",
"git",
"and",
"send",
"the",
"path",
"to",
"the",
"newly",
"cached",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/gitfs.py#L150-L155 | [
"def",
"find_file",
"(",
"path",
",",
"tgt_env",
"=",
"'base'",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=W0613",
"return",
"_gitfs",
"(",
")",
".",
"find_file",
"(",
"path",
",",
"tgt_env",
"=",
"tgt_env",
",",
"*",
"*",
"kwargs",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _error_msg_iface | Build an appropriate error message from a given option and
a list of expected values. | salt/modules/debian_ip.py | def _error_msg_iface(iface, option, expected):
'''
Build an appropriate error message from a given option and
a list of expected values.
'''
msg = 'Invalid option -- Interface: {0}, Option: {1}, Expected: [{2}]'
return msg.format(iface, option, '|'.join(str(e) for e in expected)) | def _error_msg_iface(iface, option, expected):
'''
Build an appropriate error message from a given option and
a list of expected values.
'''
msg = 'Invalid option -- Interface: {0}, Option: {1}, Expected: [{2}]'
return msg.format(iface, option, '|'.join(str(e) for e in expected)) | [
"Build",
"an",
"appropriate",
"error",
"message",
"from",
"a",
"given",
"option",
"and",
"a",
"list",
"of",
"expected",
"values",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L155-L161 | [
"def",
"_error_msg_iface",
"(",
"iface",
",",
"option",
",",
"expected",
")",
":",
"msg",
"=",
"'Invalid option -- Interface: {0}, Option: {1}, Expected: [{2}]'",
"return",
"msg",
".",
"format",
"(",
"iface",
",",
"option",
",",
"'|'",
".",
"join",
"(",
"str",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _error_msg_routes | Build an appropriate error message from a given option and
a list of expected values. | salt/modules/debian_ip.py | def _error_msg_routes(iface, option, expected):
'''
Build an appropriate error message from a given option and
a list of expected values.
'''
msg = 'Invalid option -- Route interface: {0}, Option: {1}, Expected: [{2}]'
return msg.format(iface, option, expected) | def _error_msg_routes(iface, option, expected):
'''
Build an appropriate error message from a given option and
a list of expected values.
'''
msg = 'Invalid option -- Route interface: {0}, Option: {1}, Expected: [{2}]'
return msg.format(iface, option, expected) | [
"Build",
"an",
"appropriate",
"error",
"message",
"from",
"a",
"given",
"option",
"and",
"a",
"list",
"of",
"expected",
"values",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L164-L170 | [
"def",
"_error_msg_routes",
"(",
"iface",
",",
"option",
",",
"expected",
")",
":",
"msg",
"=",
"'Invalid option -- Route interface: {0}, Option: {1}, Expected: [{2}]'",
"return",
"msg",
".",
"format",
"(",
"iface",
",",
"option",
",",
"expected",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _error_msg_network | Build an appropriate error message from a given option and
a list of expected values. | salt/modules/debian_ip.py | def _error_msg_network(option, expected):
'''
Build an appropriate error message from a given option and
a list of expected values.
'''
msg = 'Invalid network setting -- Setting: {0}, Expected: [{1}]'
return msg.format(option, '|'.join(str(e) for e in expected)) | def _error_msg_network(option, expected):
'''
Build an appropriate error message from a given option and
a list of expected values.
'''
msg = 'Invalid network setting -- Setting: {0}, Expected: [{1}]'
return msg.format(option, '|'.join(str(e) for e in expected)) | [
"Build",
"an",
"appropriate",
"error",
"message",
"from",
"a",
"given",
"option",
"and",
"a",
"list",
"of",
"expected",
"values",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L180-L186 | [
"def",
"_error_msg_network",
"(",
"option",
",",
"expected",
")",
":",
"msg",
"=",
"'Invalid network setting -- Setting: {0}, Expected: [{1}]'",
"return",
"msg",
".",
"format",
"(",
"option",
",",
"'|'",
".",
"join",
"(",
"str",
"(",
"e",
")",
"for",
"e",
"in"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _raise_error_iface | Log and raise an error with a logical formatted message. | salt/modules/debian_ip.py | def _raise_error_iface(iface, option, expected):
'''
Log and raise an error with a logical formatted message.
'''
msg = _error_msg_iface(iface, option, expected)
log.error(msg)
raise AttributeError(msg) | def _raise_error_iface(iface, option, expected):
'''
Log and raise an error with a logical formatted message.
'''
msg = _error_msg_iface(iface, option, expected)
log.error(msg)
raise AttributeError(msg) | [
"Log",
"and",
"raise",
"an",
"error",
"with",
"a",
"logical",
"formatted",
"message",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L193-L199 | [
"def",
"_raise_error_iface",
"(",
"iface",
",",
"option",
",",
"expected",
")",
":",
"msg",
"=",
"_error_msg_iface",
"(",
"iface",
",",
"option",
",",
"expected",
")",
"log",
".",
"error",
"(",
"msg",
")",
"raise",
"AttributeError",
"(",
"msg",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _raise_error_network | Log and raise an error with a logical formatted message. | salt/modules/debian_ip.py | def _raise_error_network(option, expected):
'''
Log and raise an error with a logical formatted message.
'''
msg = _error_msg_network(option, expected)
log.error(msg)
raise AttributeError(msg) | def _raise_error_network(option, expected):
'''
Log and raise an error with a logical formatted message.
'''
msg = _error_msg_network(option, expected)
log.error(msg)
raise AttributeError(msg) | [
"Log",
"and",
"raise",
"an",
"error",
"with",
"a",
"logical",
"formatted",
"message",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L202-L208 | [
"def",
"_raise_error_network",
"(",
"option",
",",
"expected",
")",
":",
"msg",
"=",
"_error_msg_network",
"(",
"option",
",",
"expected",
")",
"log",
".",
"error",
"(",
"msg",
")",
"raise",
"AttributeError",
"(",
"msg",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _raise_error_routes | Log and raise an error with a logical formatted message. | salt/modules/debian_ip.py | def _raise_error_routes(iface, option, expected):
'''
Log and raise an error with a logical formatted message.
'''
msg = _error_msg_routes(iface, option, expected)
log.error(msg)
raise AttributeError(msg) | def _raise_error_routes(iface, option, expected):
'''
Log and raise an error with a logical formatted message.
'''
msg = _error_msg_routes(iface, option, expected)
log.error(msg)
raise AttributeError(msg) | [
"Log",
"and",
"raise",
"an",
"error",
"with",
"a",
"logical",
"formatted",
"message",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L211-L217 | [
"def",
"_raise_error_routes",
"(",
"iface",
",",
"option",
",",
"expected",
")",
":",
"msg",
"=",
"_error_msg_routes",
"(",
"iface",
",",
"option",
",",
"expected",
")",
"log",
".",
"error",
"(",
"msg",
")",
"raise",
"AttributeError",
"(",
"msg",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _read_file | Reads and returns the contents of a text file | salt/modules/debian_ip.py | def _read_file(path):
'''
Reads and returns the contents of a text file
'''
try:
with salt.utils.files.flopen(path, 'rb') as contents:
return [salt.utils.stringutils.to_str(line) for line in contents.readlines()]
except (OSError, IOError):
return '' | def _read_file(path):
'''
Reads and returns the contents of a text file
'''
try:
with salt.utils.files.flopen(path, 'rb') as contents:
return [salt.utils.stringutils.to_str(line) for line in contents.readlines()]
except (OSError, IOError):
return '' | [
"Reads",
"and",
"returns",
"the",
"contents",
"of",
"a",
"text",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L220-L228 | [
"def",
"_read_file",
"(",
"path",
")",
":",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"flopen",
"(",
"path",
",",
"'rb'",
")",
"as",
"contents",
":",
"return",
"[",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_str",
"(",
"l... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_current_network_settings | Parse /etc/default/networking and return current configuration | salt/modules/debian_ip.py | def _parse_current_network_settings():
'''
Parse /etc/default/networking and return current configuration
'''
opts = salt.utils.odict.OrderedDict()
opts['networking'] = ''
if os.path.isfile(_DEB_NETWORKING_FILE):
with salt.utils.files.fopen(_DEB_NETWORKING_FILE) as contents:
... | def _parse_current_network_settings():
'''
Parse /etc/default/networking and return current configuration
'''
opts = salt.utils.odict.OrderedDict()
opts['networking'] = ''
if os.path.isfile(_DEB_NETWORKING_FILE):
with salt.utils.files.fopen(_DEB_NETWORKING_FILE) as contents:
... | [
"Parse",
"/",
"etc",
"/",
"default",
"/",
"networking",
"and",
"return",
"current",
"configuration"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L263-L286 | [
"def",
"_parse_current_network_settings",
"(",
")",
":",
"opts",
"=",
"salt",
".",
"utils",
".",
"odict",
".",
"OrderedDict",
"(",
")",
"opts",
"[",
"'networking'",
"]",
"=",
"''",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"_DEB_NETWORKING_FILE",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __int | validate an integer | salt/modules/debian_ip.py | 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):
'''validate an integer'''
valid, _value = False, value
try:
_value = int(value)
valid = True
except ValueError:
pass
return (valid, _value, 'integer') | [
"validate",
"an",
"integer"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L315-L323 | [
"def",
"__int",
"(",
"value",
")",
":",
"valid",
",",
"_value",
"=",
"False",
",",
"value",
"try",
":",
"_value",
"=",
"int",
"(",
"value",
")",
"valid",
"=",
"True",
"except",
"ValueError",
":",
"pass",
"return",
"(",
"valid",
",",
"_value",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __float | validate a float | salt/modules/debian_ip.py | 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):
'''validate a float'''
valid, _value = False, value
try:
_value = float(value)
valid = True
except ValueError:
pass
return (valid, _value, 'float') | [
"validate",
"a",
"float"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L326-L334 | [
"def",
"__float",
"(",
"value",
")",
":",
"valid",
",",
"_value",
"=",
"False",
",",
"value",
"try",
":",
"_value",
"=",
"float",
"(",
"value",
")",
"valid",
"=",
"True",
"except",
"ValueError",
":",
"pass",
"return",
"(",
"valid",
",",
"_value",
","... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __ipv4_netmask | validate an IPv4 dotted quad or integer CIDR netmask | salt/modules/debian_ip.py | 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):
'''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) | [
"validate",
"an",
"IPv4",
"dotted",
"quad",
"or",
"integer",
"CIDR",
"netmask"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L337-L343 | [
"def",
"__ipv4_netmask",
"(",
"value",
")",
":",
"valid",
",",
"errmsg",
"=",
"False",
",",
"'dotted quad or integer CIDR (0->32)'",
"valid",
",",
"value",
",",
"_",
"=",
"__int",
"(",
"value",
")",
"if",
"not",
"(",
"valid",
"and",
"0",
"<=",
"value",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __ipv6_netmask | validate an IPv6 integer netmask | salt/modules/debian_ip.py | 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):
'''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) | [
"validate",
"an",
"IPv6",
"integer",
"netmask"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L346-L351 | [
"def",
"__ipv6_netmask",
"(",
"value",
")",
":",
"valid",
",",
"errmsg",
"=",
"False",
",",
"'IPv6 netmask (0->128)'",
"valid",
",",
"value",
",",
"_",
"=",
"__int",
"(",
"value",
")",
"valid",
"=",
"(",
"valid",
"and",
"0",
"<=",
"value",
"<=",
"128",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __within2 | validate that a value is in ``within`` and optionally a ``dtype`` | salt/modules/debian_ip.py | 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):
'''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
... | [
"validate",
"that",
"a",
"value",
"is",
"in",
"within",
"and",
"optionally",
"a",
"dtype"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L354-L373 | [
"def",
"__within2",
"(",
"value",
",",
"within",
"=",
"None",
",",
"errmsg",
"=",
"None",
",",
"dtype",
"=",
"None",
")",
":",
"valid",
",",
"_value",
"=",
"False",
",",
"value",
"if",
"dtype",
":",
"try",
":",
"_value",
"=",
"dtype",
"(",
"value",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __space_delimited_list | validate that a value contains one or more space-delimited values | salt/modules/debian_ip.py | def __space_delimited_list(value):
'''validate that a value contains one or more space-delimited values'''
if isinstance(value, six.string_types):
value = value.strip().split()
if hasattr(value, '__iter__') and value != []:
return (True, value, 'space-delimited string')
else:
re... | def __space_delimited_list(value):
'''validate that a value contains one or more space-delimited values'''
if isinstance(value, six.string_types):
value = value.strip().split()
if hasattr(value, '__iter__') and value != []:
return (True, value, 'space-delimited string')
else:
re... | [
"validate",
"that",
"a",
"value",
"contains",
"one",
"or",
"more",
"space",
"-",
"delimited",
"values"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L381-L389 | [
"def",
"__space_delimited_list",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"six",
".",
"string_types",
")",
":",
"value",
"=",
"value",
".",
"strip",
"(",
")",
".",
"split",
"(",
")",
"if",
"hasattr",
"(",
"value",
",",
"'__iter__'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _validate_interface_option | lookup the validation function for a [addrfam][attr] and
return the results
:param attr: attribute name
:param value: raw setting value
:param addrfam: address family (inet, inet6, | salt/modules/debian_ip.py | def _validate_interface_option(attr, value, addrfam='inet'):
'''lookup the validation function for a [addrfam][attr] and
return the results
:param attr: attribute name
:param value: raw setting value
:param addrfam: address family (inet, inet6,
'''
valid, _value, errmsg = False, value, 'Unk... | def _validate_interface_option(attr, value, addrfam='inet'):
'''lookup the validation function for a [addrfam][attr] and
return the results
:param attr: attribute name
:param value: raw setting value
:param addrfam: address family (inet, inet6,
'''
valid, _value, errmsg = False, value, 'Unk... | [
"lookup",
"the",
"validation",
"function",
"for",
"a",
"[",
"addrfam",
"]",
"[",
"attr",
"]",
"and",
"return",
"the",
"results"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L523-L538 | [
"def",
"_validate_interface_option",
"(",
"attr",
",",
"value",
",",
"addrfam",
"=",
"'inet'",
")",
":",
"valid",
",",
"_value",
",",
"errmsg",
"=",
"False",
",",
"value",
",",
"'Unknown validator'",
"attrmaps",
"=",
"ATTRMAPS",
".",
"get",
"(",
"addrfam",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_interfaces | Parse /etc/network/interfaces and return current configured interfaces | salt/modules/debian_ip.py | def _parse_interfaces(interface_files=None):
'''
Parse /etc/network/interfaces and return current configured interfaces
'''
if interface_files is None:
interface_files = []
# Add this later.
if os.path.exists(_DEB_NETWORK_DIR):
interface_files += ['{0}/{1}'.format(_DE... | def _parse_interfaces(interface_files=None):
'''
Parse /etc/network/interfaces and return current configured interfaces
'''
if interface_files is None:
interface_files = []
# Add this later.
if os.path.exists(_DEB_NETWORK_DIR):
interface_files += ['{0}/{1}'.format(_DE... | [
"Parse",
"/",
"etc",
"/",
"network",
"/",
"interfaces",
"and",
"return",
"current",
"configured",
"interfaces"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L548-L692 | [
"def",
"_parse_interfaces",
"(",
"interface_files",
"=",
"None",
")",
":",
"if",
"interface_files",
"is",
"None",
":",
"interface_files",
"=",
"[",
"]",
"# Add this later.",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"_DEB_NETWORK_DIR",
")",
":",
"interface_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_ethtool_opts | 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. | salt/modules/debian_ip.py | 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):
'''
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... | [
"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",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L695-L736 | [
"def",
"_parse_ethtool_opts",
"(",
"opts",
",",
"iface",
")",
":",
"config",
"=",
"{",
"}",
"if",
"'autoneg'",
"in",
"opts",
":",
"if",
"opts",
"[",
"'autoneg'",
"]",
"in",
"_CONFIG_TRUE",
":",
"config",
".",
"update",
"(",
"{",
"'autoneg'",
":",
"'on'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_ethtool_pppoe_opts | 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. | salt/modules/debian_ip.py | 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):
'''
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... | [
"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... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L739-L765 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_settings_bond | 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. | salt/modules/debian_ip.py | 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):
'''
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... | [
"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",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L768-L835 | [
"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)",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_settings_bond_2 | 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. | salt/modules/debian_ip.py | 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):
'''
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... | [
"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",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L918-L962 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_bridge_opts | 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. | salt/modules/debian_ip.py | 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):
'''
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... | [
"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",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1130-L1198 | [
"def",
"_parse_bridge_opts",
"(",
"opts",
",",
"iface",
")",
":",
"config",
"=",
"{",
"}",
"if",
"'ports'",
"in",
"opts",
":",
"if",
"isinstance",
"(",
"opts",
"[",
"'ports'",
"]",
",",
"list",
")",
":",
"opts",
"[",
"'ports'",
"]",
"=",
"' '",
"."... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_settings_eth | Filters given options and outputs valid settings for a
network interface. | salt/modules/debian_ip.py | def _parse_settings_eth(opts, iface_type, enabled, iface):
'''
Filters given options and outputs valid settings for a
network interface.
'''
adapters = salt.utils.odict.OrderedDict()
adapters[iface] = salt.utils.odict.OrderedDict()
adapters[iface]['type'] = iface_type
adapters[iface]['... | def _parse_settings_eth(opts, iface_type, enabled, iface):
'''
Filters given options and outputs valid settings for a
network interface.
'''
adapters = salt.utils.odict.OrderedDict()
adapters[iface] = salt.utils.odict.OrderedDict()
adapters[iface]['type'] = iface_type
adapters[iface]['... | [
"Filters",
"given",
"options",
"and",
"outputs",
"valid",
"settings",
"for",
"a",
"network",
"interface",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1201-L1312 | [
"def",
"_parse_settings_eth",
"(",
"opts",
",",
"iface_type",
",",
"enabled",
",",
"iface",
")",
":",
"adapters",
"=",
"salt",
".",
"utils",
".",
"odict",
".",
"OrderedDict",
"(",
")",
"adapters",
"[",
"iface",
"]",
"=",
"salt",
".",
"utils",
".",
"odi... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_settings_source | Filters given options and outputs valid settings for a
network interface. | salt/modules/debian_ip.py | def _parse_settings_source(opts, iface_type, enabled, iface):
'''
Filters given options and outputs valid settings for a
network interface.
'''
adapters = salt.utils.odict.OrderedDict()
adapters[iface] = salt.utils.odict.OrderedDict()
adapters[iface]['type'] = iface_type
adapters[iface... | def _parse_settings_source(opts, iface_type, enabled, iface):
'''
Filters given options and outputs valid settings for a
network interface.
'''
adapters = salt.utils.odict.OrderedDict()
adapters[iface] = salt.utils.odict.OrderedDict()
adapters[iface]['type'] = iface_type
adapters[iface... | [
"Filters",
"given",
"options",
"and",
"outputs",
"valid",
"settings",
"for",
"a",
"network",
"interface",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1315-L1329 | [
"def",
"_parse_settings_source",
"(",
"opts",
",",
"iface_type",
",",
"enabled",
",",
"iface",
")",
":",
"adapters",
"=",
"salt",
".",
"utils",
".",
"odict",
".",
"OrderedDict",
"(",
")",
"adapters",
"[",
"iface",
"]",
"=",
"salt",
".",
"utils",
".",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_network_settings | Filters given options and outputs valid settings for
the global network settings file. | salt/modules/debian_ip.py | def _parse_network_settings(opts, current):
'''
Filters given options and outputs valid settings for
the global network settings file.
'''
# Normalize keys
opts = dict((k.lower(), v) for (k, v) in six.iteritems(opts))
current = dict((k.lower(), v) for (k, v) in six.iteritems(current))
re... | def _parse_network_settings(opts, current):
'''
Filters given options and outputs valid settings for
the global network settings file.
'''
# Normalize keys
opts = dict((k.lower(), v) for (k, v) in six.iteritems(opts))
current = dict((k.lower(), v) for (k, v) in six.iteritems(current))
re... | [
"Filters",
"given",
"options",
"and",
"outputs",
"valid",
"settings",
"for",
"the",
"global",
"network",
"settings",
"file",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1332-L1375 | [
"def",
"_parse_network_settings",
"(",
"opts",
",",
"current",
")",
":",
"# Normalize keys",
"opts",
"=",
"dict",
"(",
"(",
"k",
".",
"lower",
"(",
")",
",",
"v",
")",
"for",
"(",
"k",
",",
"v",
")",
"in",
"six",
".",
"iteritems",
"(",
"opts",
")",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_routes | Filters given options and outputs valid settings for
the route settings file. | salt/modules/debian_ip.py | 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):
'''
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 ... | [
"Filters",
"given",
"options",
"and",
"outputs",
"valid",
"settings",
"for",
"the",
"route",
"settings",
"file",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1378-L1392 | [
"def",
"_parse_routes",
"(",
"iface",
",",
"opts",
")",
":",
"# Normalize keys",
"opts",
"=",
"dict",
"(",
"(",
"k",
".",
"lower",
"(",
")",
",",
"v",
")",
"for",
"(",
"k",
",",
"v",
")",
"in",
"six",
".",
"iteritems",
"(",
"opts",
")",
")",
"r... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _write_file | Writes a file to disk | salt/modules/debian_ip.py | def _write_file(iface, data, folder, pattern):
'''
Writes a file to disk
'''
filename = os.path.join(folder, pattern.format(iface))
if not os.path.exists(folder):
msg = '{0} cannot be written. {1} does not exist'
msg = msg.format(filename, folder)
log.error(msg)
raise... | def _write_file(iface, data, folder, pattern):
'''
Writes a file to disk
'''
filename = os.path.join(folder, pattern.format(iface))
if not os.path.exists(folder):
msg = '{0} cannot be written. {1} does not exist'
msg = msg.format(filename, folder)
log.error(msg)
raise... | [
"Writes",
"a",
"file",
"to",
"disk"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1395-L1407 | [
"def",
"_write_file",
"(",
"iface",
",",
"data",
",",
"folder",
",",
"pattern",
")",
":",
"filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"folder",
",",
"pattern",
".",
"format",
"(",
"iface",
")",
")",
"if",
"not",
"os",
".",
"path",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _write_file_network | Writes a file to disk
If file does not exist, only create if create
argument is True | salt/modules/debian_ip.py | 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):
'''
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... | [
"Writes",
"a",
"file",
"to",
"disk",
"If",
"file",
"does",
"not",
"exist",
"only",
"create",
"if",
"create",
"argument",
"is",
"True"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1437-L1450 | [
"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 ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _read_temp | Return what would be written to disk | salt/modules/debian_ip.py | 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):
'''
Return what would be written to disk
'''
tout = StringIO()
tout.write(data)
tout.seek(0)
output = tout.readlines()
tout.close()
return output | [
"Return",
"what",
"would",
"be",
"written",
"to",
"disk"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1453-L1463 | [
"def",
"_read_temp",
"(",
"data",
")",
":",
"tout",
"=",
"StringIO",
"(",
")",
"tout",
".",
"write",
"(",
"data",
")",
"tout",
".",
"seek",
"(",
"0",
")",
"output",
"=",
"tout",
".",
"readlines",
"(",
")",
"tout",
".",
"close",
"(",
")",
"return"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _read_temp_ifaces | Return what would be written to disk for interfaces | salt/modules/debian_ip.py | 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):
'''
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... | [
"Return",
"what",
"would",
"be",
"written",
"to",
"disk",
"for",
"interfaces"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1466-L1478 | [
"def",
"_read_temp_ifaces",
"(",
"iface",
",",
"data",
")",
":",
"try",
":",
"template",
"=",
"JINJA",
".",
"get_template",
"(",
"'debian_eth.jinja'",
")",
"except",
"jinja2",
".",
"exceptions",
".",
"TemplateNotFound",
":",
"log",
".",
"error",
"(",
"'Could... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _write_file_ifaces | Writes a file to disk | salt/modules/debian_ip.py | def _write_file_ifaces(iface, data, **settings):
'''
Writes a file to disk
'''
try:
eth_template = JINJA.get_template('debian_eth.jinja')
source_template = JINJA.get_template('debian_source.jinja')
except jinja2.exceptions.TemplateNotFound:
log.error('Could not load template ... | def _write_file_ifaces(iface, data, **settings):
'''
Writes a file to disk
'''
try:
eth_template = JINJA.get_template('debian_eth.jinja')
source_template = JINJA.get_template('debian_source.jinja')
except jinja2.exceptions.TemplateNotFound:
log.error('Could not load template ... | [
"Writes",
"a",
"file",
"to",
"disk"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1481-L1532 | [
"def",
"_write_file_ifaces",
"(",
"iface",
",",
"data",
",",
"*",
"*",
"settings",
")",
":",
"try",
":",
"eth_template",
"=",
"JINJA",
".",
"get_template",
"(",
"'debian_eth.jinja'",
")",
"source_template",
"=",
"JINJA",
".",
"get_template",
"(",
"'debian_sour... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _write_file_ppp_ifaces | Writes a file to disk | salt/modules/debian_ip.py | def _write_file_ppp_ifaces(iface, data):
'''
Writes a file to disk
'''
try:
template = JINJA.get_template('debian_ppp_eth.jinja')
except jinja2.exceptions.TemplateNotFound:
log.error('Could not load template debian_ppp_eth.jinja')
return ''
adapters = _parse_interfaces()... | def _write_file_ppp_ifaces(iface, data):
'''
Writes a file to disk
'''
try:
template = JINJA.get_template('debian_ppp_eth.jinja')
except jinja2.exceptions.TemplateNotFound:
log.error('Could not load template debian_ppp_eth.jinja')
return ''
adapters = _parse_interfaces()... | [
"Writes",
"a",
"file",
"to",
"disk"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1535-L1562 | [
"def",
"_write_file_ppp_ifaces",
"(",
"iface",
",",
"data",
")",
":",
"try",
":",
"template",
"=",
"JINJA",
".",
"get_template",
"(",
"'debian_ppp_eth.jinja'",
")",
"except",
"jinja2",
".",
"exceptions",
".",
"TemplateNotFound",
":",
"log",
".",
"error",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | build_bond | Create a bond script in /etc/modprobe.d with the passed settings
and load the bonding kernel module.
CLI Example:
.. code-block:: bash
salt '*' ip.build_bond bond0 mode=balance-alb | salt/modules/debian_ip.py | def build_bond(iface, **settings):
'''
Create a bond script in /etc/modprobe.d with the passed settings
and load the bonding kernel module.
CLI Example:
.. code-block:: bash
salt '*' ip.build_bond bond0 mode=balance-alb
'''
deb_major = __grains__['osrelease'][:1]
opts = _pars... | def build_bond(iface, **settings):
'''
Create a bond script in /etc/modprobe.d with the passed settings
and load the bonding kernel module.
CLI Example:
.. code-block:: bash
salt '*' ip.build_bond bond0 mode=balance-alb
'''
deb_major = __grains__['osrelease'][:1]
opts = _pars... | [
"Create",
"a",
"bond",
"script",
"in",
"/",
"etc",
"/",
"modprobe",
".",
"d",
"with",
"the",
"passed",
"settings",
"and",
"load",
"the",
"bonding",
"kernel",
"module",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1565-L1604 | [
"def",
"build_bond",
"(",
"iface",
",",
"*",
"*",
"settings",
")",
":",
"deb_major",
"=",
"__grains__",
"[",
"'osrelease'",
"]",
"[",
":",
"1",
"]",
"opts",
"=",
"_parse_settings_bond",
"(",
"settings",
",",
"iface",
")",
"try",
":",
"template",
"=",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | build_interface | Build an interface script for a network interface.
CLI Example:
.. code-block:: bash
salt '*' ip.build_interface eth0 eth <settings> | salt/modules/debian_ip.py | def build_interface(iface, iface_type, enabled, **settings):
'''
Build an interface script for a network interface.
CLI Example:
.. code-block:: bash
salt '*' ip.build_interface eth0 eth <settings>
'''
iface_type = iface_type.lower()
if iface_type not in _IFACE_TYPES:
_r... | def build_interface(iface, iface_type, enabled, **settings):
'''
Build an interface script for a network interface.
CLI Example:
.. code-block:: bash
salt '*' ip.build_interface eth0 eth <settings>
'''
iface_type = iface_type.lower()
if iface_type not in _IFACE_TYPES:
_r... | [
"Build",
"an",
"interface",
"script",
"for",
"a",
"network",
"interface",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1607-L1670 | [
"def",
"build_interface",
"(",
"iface",
",",
"iface_type",
",",
"enabled",
",",
"*",
"*",
"settings",
")",
":",
"iface_type",
"=",
"iface_type",
".",
"lower",
"(",
")",
"if",
"iface_type",
"not",
"in",
"_IFACE_TYPES",
":",
"_raise_error_iface",
"(",
"iface",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | build_routes | Add route scripts for a network interface using up commands.
CLI Example:
.. code-block:: bash
salt '*' ip.build_routes eth0 <settings> | salt/modules/debian_ip.py | 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):
'''
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')... | [
"Add",
"route",
"scripts",
"for",
"a",
"network",
"interface",
"using",
"up",
"commands",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1673-L1714 | [
"def",
"build_routes",
"(",
"iface",
",",
"*",
"*",
"settings",
")",
":",
"opts",
"=",
"_parse_routes",
"(",
"iface",
",",
"settings",
")",
"try",
":",
"template",
"=",
"JINJA",
".",
"get_template",
"(",
"'route_eth.jinja'",
")",
"except",
"jinja2",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_bond | Return the content of a bond script
CLI Example:
.. code-block:: bash
salt '*' ip.get_bond bond0 | salt/modules/debian_ip.py | def get_bond(iface):
'''
Return the content of a bond script
CLI Example:
.. code-block:: bash
salt '*' ip.get_bond bond0
'''
path = os.path.join(_DEB_NETWORK_CONF_FILES, '{0}.conf'.format(iface))
return _read_file(path) | def get_bond(iface):
'''
Return the content of a bond script
CLI Example:
.. code-block:: bash
salt '*' ip.get_bond bond0
'''
path = os.path.join(_DEB_NETWORK_CONF_FILES, '{0}.conf'.format(iface))
return _read_file(path) | [
"Return",
"the",
"content",
"of",
"a",
"bond",
"script"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1734-L1745 | [
"def",
"get_bond",
"(",
"iface",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"_DEB_NETWORK_CONF_FILES",
",",
"'{0}.conf'",
".",
"format",
"(",
"iface",
")",
")",
"return",
"_read_file",
"(",
"path",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_interface | Return the contents of an interface script
CLI Example:
.. code-block:: bash
salt '*' ip.get_interface eth0 | salt/modules/debian_ip.py | def get_interface(iface):
'''
Return the contents of an interface script
CLI Example:
.. code-block:: bash
salt '*' ip.get_interface eth0
'''
adapters = _parse_interfaces()
if iface in adapters:
try:
if iface == 'source':
template = JINJA.get_t... | def get_interface(iface):
'''
Return the contents of an interface script
CLI Example:
.. code-block:: bash
salt '*' ip.get_interface eth0
'''
adapters = _parse_interfaces()
if iface in adapters:
try:
if iface == 'source':
template = JINJA.get_t... | [
"Return",
"the",
"contents",
"of",
"an",
"interface",
"script"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1748-L1775 | [
"def",
"get_interface",
"(",
"iface",
")",
":",
"adapters",
"=",
"_parse_interfaces",
"(",
")",
"if",
"iface",
"in",
"adapters",
":",
"try",
":",
"if",
"iface",
"==",
"'source'",
":",
"template",
"=",
"JINJA",
".",
"get_template",
"(",
"'debian_source.jinja'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_network_settings | Return the contents of the global network script.
CLI Example:
.. code-block:: bash
salt '*' ip.get_network_settings | salt/modules/debian_ip.py | def get_network_settings():
'''
Return the contents of the global network script.
CLI Example:
.. code-block:: bash
salt '*' ip.get_network_settings
'''
skip_etc_default_networking = (
__grains__['osfullname'] == 'Ubuntu' and
int(__grains__['osrelease'].split('.')[0]) ... | def get_network_settings():
'''
Return the contents of the global network script.
CLI Example:
.. code-block:: bash
salt '*' ip.get_network_settings
'''
skip_etc_default_networking = (
__grains__['osfullname'] == 'Ubuntu' and
int(__grains__['osrelease'].split('.')[0]) ... | [
"Return",
"the",
"contents",
"of",
"the",
"global",
"network",
"script",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1795-L1837 | [
"def",
"get_network_settings",
"(",
")",
":",
"skip_etc_default_networking",
"=",
"(",
"__grains__",
"[",
"'osfullname'",
"]",
"==",
"'Ubuntu'",
"and",
"int",
"(",
"__grains__",
"[",
"'osrelease'",
"]",
".",
"split",
"(",
"'.'",
")",
"[",
"0",
"]",
")",
">... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_routes | Return the routes for the interface
CLI Example:
.. code-block:: bash
salt '*' ip.get_routes eth0 | salt/modules/debian_ip.py | 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):
'''
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... | [
"Return",
"the",
"routes",
"for",
"the",
"interface"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1840-L1857 | [
"def",
"get_routes",
"(",
"iface",
")",
":",
"filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"_DEB_NETWORK_UP_DIR",
",",
"'route-{0}'",
".",
"format",
"(",
"iface",
")",
")",
"results",
"=",
"_read_file",
"(",
"filename",
")",
"filename",
"=",
"os"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | apply_network_settings | Apply global network configuration.
CLI Example:
.. code-block:: bash
salt '*' ip.apply_network_settings | salt/modules/debian_ip.py | def apply_network_settings(**settings):
'''
Apply global network configuration.
CLI Example:
.. code-block:: bash
salt '*' ip.apply_network_settings
'''
if 'require_reboot' not in settings:
settings['require_reboot'] = False
if 'apply_hostname' not in settings:
se... | def apply_network_settings(**settings):
'''
Apply global network configuration.
CLI Example:
.. code-block:: bash
salt '*' ip.apply_network_settings
'''
if 'require_reboot' not in settings:
settings['require_reboot'] = False
if 'apply_hostname' not in settings:
se... | [
"Apply",
"global",
"network",
"configuration",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1860-L1899 | [
"def",
"apply_network_settings",
"(",
"*",
"*",
"settings",
")",
":",
"if",
"'require_reboot'",
"not",
"in",
"settings",
":",
"settings",
"[",
"'require_reboot'",
"]",
"=",
"False",
"if",
"'apply_hostname'",
"not",
"in",
"settings",
":",
"settings",
"[",
"'app... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | build_network_settings | Build the global network script.
CLI Example:
.. code-block:: bash
salt '*' ip.build_network_settings <settings> | salt/modules/debian_ip.py | def build_network_settings(**settings):
'''
Build the global network script.
CLI Example:
.. code-block:: bash
salt '*' ip.build_network_settings <settings>
'''
changes = []
# Read current configuration and store default values
current_network_settings = _parse_current_networ... | def build_network_settings(**settings):
'''
Build the global network script.
CLI Example:
.. code-block:: bash
salt '*' ip.build_network_settings <settings>
'''
changes = []
# Read current configuration and store default values
current_network_settings = _parse_current_networ... | [
"Build",
"the",
"global",
"network",
"script",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1902-L2024 | [
"def",
"build_network_settings",
"(",
"*",
"*",
"settings",
")",
":",
"changes",
"=",
"[",
"]",
"# Read current configuration and store default values",
"current_network_settings",
"=",
"_parse_current_network_settings",
"(",
")",
"# Build settings",
"opts",
"=",
"_parse_ne... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | setval | 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... | salt/modules/environ.py | 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):
'''
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... | [
"Set",
"a",
"single",
"salt",
"process",
"environment",
"variable",
".",
"Returns",
"True",
"on",
"success",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/environ.py#L27-L105 | [
"def",
"setval",
"(",
"key",
",",
"val",
",",
"false_unsets",
"=",
"False",
",",
"permanent",
"=",
"False",
")",
":",
"is_windows",
"=",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
"if",
"is_windows",
":",
"permanent_hive",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | setenv | 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... | salt/modules/environ.py | 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):
'''
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... | [
"Set",
"multiple",
"salt",
"process",
"environment",
"variables",
"from",
"a",
"dict",
".",
"Returns",
"a",
"dict",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/environ.py#L108-L186 | [
"def",
"setenv",
"(",
"environ",
",",
"false_unsets",
"=",
"False",
",",
"clear_all",
"=",
"False",
",",
"update_minion",
"=",
"False",
",",
"permanent",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"not",
"isinstance",
"(",
"environ",
",",
"dic... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get | 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.... | salt/modules/environ.py | 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=''):
'''
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... | [
"Get",
"a",
"single",
"salt",
"process",
"environment",
"variable",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/environ.py#L189-L211 | [
"def",
"get",
"(",
"key",
",",
"default",
"=",
"''",
")",
":",
"if",
"not",
"isinstance",
"(",
"key",
",",
"six",
".",
"string_types",
")",
":",
"log",
".",
"debug",
"(",
"'%s: \\'key\\' argument is not a string type: \\'%s\\''",
",",
"__name__",
",",
"key",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | has_value | 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... | salt/modules/environ.py | 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):
'''
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... | [
"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",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/environ.py#L214-L245 | [
"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__",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | item | 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... | salt/modules/environ.py | 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=''):
'''
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.
... | [
"Get",
"one",
"or",
"more",
"salt",
"process",
"environment",
"variables",
".",
"Returns",
"a",
"dict",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/environ.py#L248-L281 | [
"def",
"item",
"(",
"keys",
",",
"default",
"=",
"''",
")",
":",
"ret",
"=",
"{",
"}",
"key_list",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"keys",
",",
"six",
".",
"string_types",
")",
":",
"key_list",
".",
"append",
"(",
"keys",
")",
"elif",
"is... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _extract_key_val | Extract key and value from key=val string.
Example:
>>> _extract_key_val('foo=bar')
('foo', 'bar') | salt/pillar/svn_pillar.py | 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='='):
'''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 | [
"Extract",
"key",
"and",
"value",
"from",
"key",
"=",
"val",
"string",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/svn_pillar.py#L148-L158 | [
"def",
"_extract_key_val",
"(",
"kv",
",",
"delimiter",
"=",
"'='",
")",
":",
"pieces",
"=",
"kv",
".",
"split",
"(",
"delimiter",
")",
"key",
"=",
"pieces",
"[",
"0",
"]",
"val",
"=",
"delimiter",
".",
"join",
"(",
"pieces",
"[",
"1",
":",
"]",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ext_pillar | Execute a command and read the output as YAML | salt/pillar/svn_pillar.py | def ext_pillar(minion_id,
pillar, # pylint: disable=W0613
repo_string):
'''
Execute a command and read the output as YAML
'''
# split the branch, repo name and optional extra (key=val) parameters.
options = repo_string.strip().split()
branch = options[0]
repo_l... | def ext_pillar(minion_id,
pillar, # pylint: disable=W0613
repo_string):
'''
Execute a command and read the output as YAML
'''
# split the branch, repo name and optional extra (key=val) parameters.
options = repo_string.strip().split()
branch = options[0]
repo_l... | [
"Execute",
"a",
"command",
"and",
"read",
"the",
"output",
"as",
"YAML"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/svn_pillar.py#L161-L201 | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"pillar",
",",
"# pylint: disable=W0613",
"repo_string",
")",
":",
"# split the branch, repo name and optional extra (key=val) parameters.",
"options",
"=",
"repo_string",
".",
"strip",
"(",
")",
".",
"split",
"(",
")",
"branc... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SvnPillar.pillar_dir | Returns the directory of the pillars (repo cache + branch + root) | salt/pillar/svn_pillar.py | def pillar_dir(self):
'''
Returns the directory of the pillars (repo cache + branch + root)
'''
repo_dir = self.repo_dir
root = self.root
branch = self.branch
if branch == 'trunk' or branch == 'base':
working_dir = os.path.join(repo_dir, 'trunk', root)... | def pillar_dir(self):
'''
Returns the directory of the pillars (repo cache + branch + root)
'''
repo_dir = self.repo_dir
root = self.root
branch = self.branch
if branch == 'trunk' or branch == 'base':
working_dir = os.path.join(repo_dir, 'trunk', root)... | [
"Returns",
"the",
"directory",
"of",
"the",
"pillars",
"(",
"repo",
"cache",
"+",
"branch",
"+",
"root",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/svn_pillar.py#L125-L145 | [
"def",
"pillar_dir",
"(",
"self",
")",
":",
"repo_dir",
"=",
"self",
".",
"repo_dir",
"root",
"=",
"self",
".",
"root",
"branch",
"=",
"self",
".",
"branch",
"if",
"branch",
"==",
"'trunk'",
"or",
"branch",
"==",
"'base'",
":",
"working_dir",
"=",
"os"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ext_pillar | Accept the key for the VM on the hyper, if authorized. | salt/pillar/virtkey.py | 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):
'''
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 {} | [
"Accept",
"the",
"key",
"for",
"the",
"VM",
"on",
"the",
"hyper",
"if",
"authorized",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/virtkey.py#L21-L28 | [
"def",
"ext_pillar",
"(",
"hyper_id",
",",
"pillar",
",",
"name",
",",
"key",
")",
":",
"vk",
"=",
"salt",
".",
"utils",
".",
"virt",
".",
"VirtKey",
"(",
"hyper_id",
",",
"name",
",",
"__opts__",
")",
"ok",
"=",
"vk",
".",
"accept",
"(",
"key",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | pv_present | 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. | salt/states/lvm.py | 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):
'''
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': {},
... | [
"Set",
"a",
"Physical",
"Device",
"to",
"be",
"used",
"as",
"an",
"LVM",
"Physical",
"Volume"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/lvm.py#L43-L74 | [
"def",
"pv_present",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
",",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
"}",
"if",
"__salt__",
"[",
"'lvm.pvdisplay'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | pv_absent | Ensure that a Physical Device is not being used by lvm
name
The device name to initialize. | salt/states/lvm.py | 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):
'''
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... | [
"Ensure",
"that",
"a",
"Physical",
"Device",
"is",
"not",
"being",
"used",
"by",
"lvm"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/lvm.py#L77-L104 | [
"def",
"pv_absent",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
",",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
"}",
"if",
"not",
"__salt__",
"[",
"'lvm.pvdisplay'",
"]",
"(",
"name",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | vg_present | 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. | salt/states/lvm.py | 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):
'''
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>... | [
"Create",
"an",
"LVM",
"Volume",
"Group"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/lvm.py#L107-L173 | [
"def",
"vg_present",
"(",
"name",
",",
"devices",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
",",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
"}",
"if",
"isin... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | lv_present | 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 ... | salt/states/lvm.py | 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=False,
**kwargs):
'''
Create a new Logical Volume
n... | [
"Create",
"a",
"new",
"Logical",
"Volume"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/lvm.py#L206-L295 | [
"def",
"lv_present",
"(",
"name",
",",
"vgname",
"=",
"None",
",",
"size",
"=",
"None",
",",
"extents",
"=",
"None",
",",
"snapshot",
"=",
"None",
",",
"pv",
"=",
"''",
",",
"thinvolume",
"=",
"False",
",",
"thinpool",
"=",
"False",
",",
"force",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | lv_absent | 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 | salt/states/lvm.py | 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):
'''
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': '',
... | [
"Remove",
"a",
"given",
"existing",
"Logical",
"Volume",
"from",
"a",
"named",
"existing",
"volume",
"group"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/lvm.py#L298-L329 | [
"def",
"lv_absent",
"(",
"name",
",",
"vgname",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
",",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
"}",
"lvpath",
"=",
"'/dev/{0}/{1}'",
".",
"f... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_conn | Return a client object for accessing consul | salt/sdb/consul.py | def get_conn(profile):
'''
Return a client object for accessing consul
'''
params = {}
for key in ('host', 'port', 'token', 'scheme', 'consistency', 'dc', 'verify'):
if key in profile:
params[key] = profile[key]
if HAS_CONSUL:
return consul.Consul(**params)
else:... | def get_conn(profile):
'''
Return a client object for accessing consul
'''
params = {}
for key in ('host', 'port', 'token', 'scheme', 'consistency', 'dc', 'verify'):
if key in profile:
params[key] = profile[key]
if HAS_CONSUL:
return consul.Consul(**params)
else:... | [
"Return",
"a",
"client",
"object",
"for",
"accessing",
"consul"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/consul.py#L66-L81 | [
"def",
"get_conn",
"(",
"profile",
")",
":",
"params",
"=",
"{",
"}",
"for",
"key",
"in",
"(",
"'host'",
",",
"'port'",
",",
"'token'",
",",
"'scheme'",
",",
"'consistency'",
",",
"'dc'",
",",
"'verify'",
")",
":",
"if",
"key",
"in",
"profile",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _delivery_report | Called once for each message produced to indicate delivery result.
Triggered by poll() or flush(). | salt/returners/kafka_return.py | def _delivery_report(err, msg):
''' Called once for each message produced to indicate delivery result.
Triggered by poll() or flush(). '''
if err is not None:
log.error('Message delivery failed: %s', err)
else:
log.debug('Message delivered to %s [%s]', msg.topic(), msg.partition()) | def _delivery_report(err, msg):
''' Called once for each message produced to indicate delivery result.
Triggered by poll() or flush(). '''
if err is not None:
log.error('Message delivery failed: %s', err)
else:
log.debug('Message delivered to %s [%s]', msg.topic(), msg.partition()) | [
"Called",
"once",
"for",
"each",
"message",
"produced",
"to",
"indicate",
"delivery",
"result",
".",
"Triggered",
"by",
"poll",
"()",
"or",
"flush",
"()",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/kafka_return.py#L61-L67 | [
"def",
"_delivery_report",
"(",
"err",
",",
"msg",
")",
":",
"if",
"err",
"is",
"not",
"None",
":",
"log",
".",
"error",
"(",
"'Message delivery failed: %s'",
",",
"err",
")",
"else",
":",
"log",
".",
"debug",
"(",
"'Message delivered to %s [%s]'",
",",
"m... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | returner | Return information to a Kafka server | salt/returners/kafka_return.py | 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):
'''
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... | [
"Return",
"information",
"to",
"a",
"Kafka",
"server"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/kafka_return.py#L70-L84 | [
"def",
"returner",
"(",
"ret",
")",
":",
"if",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'returner.kafka.topic'",
")",
":",
"topic",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'returner.kafka.topic'",
")",
"conn",
"=",
"_get_conn",
"(",
")",
"p... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | installed | 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... | salt/states/composer.py | 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,
optimize=None,
no_dev=None,
quiet=False,
... | [
"Verify",
"that",
"the",
"correct",
"versions",
"of",
"composer",
"dependencies",
"are",
"present",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/composer.py#L53-L182 | [
"def",
"installed",
"(",
"name",
",",
"composer",
"=",
"None",
",",
"php",
"=",
"None",
",",
"user",
"=",
"None",
",",
"prefer_source",
"=",
"None",
",",
"prefer_dist",
"=",
"None",
",",
"no_scripts",
"=",
"None",
",",
"no_plugins",
"=",
"None",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update | 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... | salt/states/composer.py | 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,
optimize=None,
no_dev=None,
quiet=False,
composer_home='/root',
... | [
"Composer",
"update",
"the",
"directory",
"to",
"ensure",
"we",
"have",
"the",
"latest",
"versions",
"of",
"all",
"project",
"dependencies",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/composer.py#L185-L301 | [
"def",
"update",
"(",
"name",
",",
"composer",
"=",
"None",
",",
"php",
"=",
"None",
",",
"user",
"=",
"None",
",",
"prefer_source",
"=",
"None",
",",
"prefer_dist",
"=",
"None",
",",
"no_scripts",
"=",
"None",
",",
"no_plugins",
"=",
"None",
",",
"o... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | exists | Check to see if a cache cluster exists.
CLI example::
salt myminion boto_elasticache.exists myelasticache | salt/modules/boto_elasticache.py | def exists(name, region=None, key=None, keyid=None, profile=None):
'''
Check to see if a cache cluster exists.
CLI example::
salt myminion boto_elasticache.exists myelasticache
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
try:
conn.describe_cache_... | def exists(name, region=None, key=None, keyid=None, profile=None):
'''
Check to see if a cache cluster exists.
CLI example::
salt myminion boto_elasticache.exists myelasticache
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
try:
conn.describe_cache_... | [
"Check",
"to",
"see",
"if",
"a",
"cache",
"cluster",
"exists",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L87-L102 | [
"def",
"exists",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
",",
"keyid",
"="... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | group_exists | Check to see if a replication group exists.
CLI example::
salt myminion boto_elasticache.group_exists myelasticache | salt/modules/boto_elasticache.py | def group_exists(name, region=None, key=None, keyid=None, profile=None):
'''
Check to see if a replication group exists.
CLI example::
salt myminion boto_elasticache.group_exists myelasticache
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
try:
conn... | def group_exists(name, region=None, key=None, keyid=None, profile=None):
'''
Check to see if a replication group exists.
CLI example::
salt myminion boto_elasticache.group_exists myelasticache
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
try:
conn... | [
"Check",
"to",
"see",
"if",
"a",
"replication",
"group",
"exists",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L105-L120 | [
"def",
"group_exists",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
",",
"keyid",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_replication_group | Create replication group.
CLI example::
salt myminion boto_elasticache.create_replication_group myelasticache myprimarycluster description | salt/modules/boto_elasticache.py | 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... | [
"Create",
"replication",
"group",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L123-L154 | [
"def",
"create_replication_group",
"(",
"name",
",",
"primary_cluster_id",
",",
"replication_group_description",
",",
"wait",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | describe_replication_group | Get replication group information.
CLI example::
salt myminion boto_elasticache.describe_replication_group mygroup | salt/modules/boto_elasticache.py | 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):
'''
Get replication group information.
CLI example::
salt myminion boto_elasticache.describe_replication_group mygroup
'''
conn = _get_conn(region=region, k... | [
"Get",
"replication",
"group",
"information",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L181-L241 | [
"def",
"describe_replication_group",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"parameter",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"regio... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_config | Get the configuration for a cache cluster.
CLI example::
salt myminion boto_elasticache.get_config myelasticache | salt/modules/boto_elasticache.py | 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):
'''
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... | [
"Get",
"the",
"configuration",
"for",
"a",
"cache",
"cluster",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L244-L307 | [
"def",
"get_config",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
",",
"keyid",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_node_host | Get hostname from cache node
CLI example::
salt myminion boto_elasticache.get_node_host myelasticache | salt/modules/boto_elasticache.py | 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):
'''
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... | [
"Get",
"hostname",
"from",
"cache",
"node"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L310-L333 | [
"def",
"get_node_host",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
",",
"keyid"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_group_host | Get hostname from replication cache group
CLI example::
salt myminion boto_elasticache.get_group_host myelasticachegroup | salt/modules/boto_elasticache.py | 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):
'''
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... | [
"Get",
"hostname",
"from",
"replication",
"cache",
"group"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L336-L359 | [
"def",
"get_group_host",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
",",
"keyid... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_all_cache_subnet_groups | Return a list of all cache subnet groups with details
CLI example::
salt myminion boto_elasticache.get_all_subnet_groups region=us-east-1 | salt/modules/boto_elasticache.py | 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):
'''
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... | [
"Return",
"a",
"list",
"of",
"all",
"cache",
"subnet",
"groups",
"with",
"details"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L362-L387 | [
"def",
"get_all_cache_subnet_groups",
"(",
"name",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_cache_subnet_groups | Return a list of all cache subnet group names
CLI example::
salt myminion boto_elasticache.list_subnet_groups region=us-east-1 | salt/modules/boto_elasticache.py | def list_cache_subnet_groups(name=None, region=None, key=None,
keyid=None, profile=None):
'''
Return a list of all cache subnet group names
CLI example::
salt myminion boto_elasticache.list_subnet_groups region=us-east-1
'''
return [g['CacheSubnetGroupName'] fo... | def list_cache_subnet_groups(name=None, region=None, key=None,
keyid=None, profile=None):
'''
Return a list of all cache subnet group names
CLI example::
salt myminion boto_elasticache.list_subnet_groups region=us-east-1
'''
return [g['CacheSubnetGroupName'] fo... | [
"Return",
"a",
"list",
"of",
"all",
"cache",
"subnet",
"group",
"names"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L390-L400 | [
"def",
"list_cache_subnet_groups",
"(",
"name",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"return",
"[",
"g",
"[",
"'CacheSubnetGroupName'",
"]",
"for",
"g",
"in"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | subnet_group_exists | Check to see if an ElastiCache subnet group exists.
CLI example::
salt myminion boto_elasticache.subnet_group_exists my-param-group \
region=us-east-1 | salt/modules/boto_elasticache.py | def subnet_group_exists(name, tags=None, region=None, key=None, keyid=None, profile=None):
'''
Check to see if an ElastiCache subnet group exists.
CLI example::
salt myminion boto_elasticache.subnet_group_exists my-param-group \
region=us-east-1
'''
conn = _get_conn(region=... | def subnet_group_exists(name, tags=None, region=None, key=None, keyid=None, profile=None):
'''
Check to see if an ElastiCache subnet group exists.
CLI example::
salt myminion boto_elasticache.subnet_group_exists my-param-group \
region=us-east-1
'''
conn = _get_conn(region=... | [
"Check",
"to",
"see",
"if",
"an",
"ElastiCache",
"subnet",
"group",
"exists",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L403-L424 | [
"def",
"subnet_group_exists",
"(",
"name",
",",
"tags",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_subnet_group | Create an ElastiCache subnet group
CLI example to create an ElastiCache subnet group::
salt myminion boto_elasticache.create_subnet_group my-subnet-group \
"group description" subnet_ids='[subnet-12345678, subnet-87654321]' \
region=us-east-1 | salt/modules/boto_elasticache.py | def create_subnet_group(name, description, subnet_ids=None, subnet_names=None, tags=None,
region=None, key=None, keyid=None, profile=None):
'''
Create an ElastiCache subnet group
CLI example to create an ElastiCache subnet group::
salt myminion boto_elasticache.create_subne... | def create_subnet_group(name, description, subnet_ids=None, subnet_names=None, tags=None,
region=None, key=None, keyid=None, profile=None):
'''
Create an ElastiCache subnet group
CLI example to create an ElastiCache subnet group::
salt myminion boto_elasticache.create_subne... | [
"Create",
"an",
"ElastiCache",
"subnet",
"group"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L427-L468 | [
"def",
"create_subnet_group",
"(",
"name",
",",
"description",
",",
"subnet_ids",
"=",
"None",
",",
"subnet_names",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_cache_subnet_group | Get information about a cache subnet group.
CLI example::
salt myminion boto_elasticache.get_cache_subnet_group mycache_subnet_group | salt/modules/boto_elasticache.py | 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):
'''
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... | [
"Get",
"information",
"about",
"a",
"cache",
"subnet",
"group",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L471-L513 | [
"def",
"get_cache_subnet_group",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_subnet_group | Delete an ElastiCache subnet group.
CLI example::
salt myminion boto_elasticache.delete_subnet_group my-subnet-group \
region=us-east-1 | salt/modules/boto_elasticache.py | 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):
'''
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... | [
"Delete",
"an",
"ElastiCache",
"subnet",
"group",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L516-L537 | [
"def",
"delete_subnet_group",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
",",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create | Create a cache cluster.
CLI example::
salt myminion boto_elasticache.create myelasticache 1 redis cache.t1.micro
cache_security_group_names='["myelasticachesg"]' | salt/modules/boto_elasticache.py | def create(name, num_cache_nodes=None, engine=None, cache_node_type=None,
replication_group_id=None, engine_version=None,
cache_parameter_group_name=None, cache_subnet_group_name=None,
cache_security_group_names=None, security_group_ids=None,
snapshot_arns=None, preferred_ava... | def create(name, num_cache_nodes=None, engine=None, cache_node_type=None,
replication_group_id=None, engine_version=None,
cache_parameter_group_name=None, cache_subnet_group_name=None,
cache_security_group_names=None, security_group_ids=None,
snapshot_arns=None, preferred_ava... | [
"Create",
"a",
"cache",
"cluster",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L540-L581 | [
"def",
"create",
"(",
"name",
",",
"num_cache_nodes",
"=",
"None",
",",
"engine",
"=",
"None",
",",
"cache_node_type",
"=",
"None",
",",
"replication_group_id",
"=",
"None",
",",
"engine_version",
"=",
"None",
",",
"cache_parameter_group_name",
"=",
"None",
",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete | Delete a cache cluster.
CLI example::
salt myminion boto_elasticache.delete myelasticache | salt/modules/boto_elasticache.py | 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):
'''
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... | [
"Delete",
"a",
"cache",
"cluster",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L584-L612 | [
"def",
"delete",
"(",
"name",
",",
"wait",
"=",
"False",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_cache_security_group | Create a cache security group.
CLI example::
salt myminion boto_elasticache.create_cache_security_group myelasticachesg 'My Cache Security Group' | salt/modules/boto_elasticache.py | def create_cache_security_group(name, description, region=None, key=None,
keyid=None, profile=None):
'''
Create a cache security group.
CLI example::
salt myminion boto_elasticache.create_cache_security_group myelasticachesg 'My Cache Security Group'
'''
con... | def create_cache_security_group(name, description, region=None, key=None,
keyid=None, profile=None):
'''
Create a cache security group.
CLI example::
salt myminion boto_elasticache.create_cache_security_group myelasticachesg 'My Cache Security Group'
'''
con... | [
"Create",
"a",
"cache",
"security",
"group",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L615-L633 | [
"def",
"create_cache_security_group",
"(",
"name",
",",
"description",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_cache_security_group | Delete a cache security group.
CLI example::
salt myminion boto_elasticache.delete_cache_security_group myelasticachesg 'My Cache Security Group' | salt/modules/boto_elasticache.py | def delete_cache_security_group(name, region=None, key=None, keyid=None,
profile=None):
'''
Delete a cache security group.
CLI example::
salt myminion boto_elasticache.delete_cache_security_group myelasticachesg 'My Cache Security Group'
'''
conn = _get_conn... | def delete_cache_security_group(name, region=None, key=None, keyid=None,
profile=None):
'''
Delete a cache security group.
CLI example::
salt myminion boto_elasticache.delete_cache_security_group myelasticachesg 'My Cache Security Group'
'''
conn = _get_conn... | [
"Delete",
"a",
"cache",
"security",
"group",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L636-L654 | [
"def",
"delete_cache_security_group",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | authorize_cache_security_group_ingress | Authorize network ingress from an ec2 security group to a cache security
group.
CLI example::
salt myminion boto_elasticache.authorize_cache_security_group_ingress myelasticachesg myec2sg 879879 | salt/modules/boto_elasticache.py | def authorize_cache_security_group_ingress(name, ec2_security_group_name,
ec2_security_group_owner_id,
region=None, key=None, keyid=None,
profile=None):
'''
Authorize network ingress ... | def authorize_cache_security_group_ingress(name, ec2_security_group_name,
ec2_security_group_owner_id,
region=None, key=None, keyid=None,
profile=None):
'''
Authorize network ingress ... | [
"Authorize",
"network",
"ingress",
"from",
"an",
"ec2",
"security",
"group",
"to",
"a",
"cache",
"security",
"group",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticache.py#L657-L689 | [
"def",
"authorize_cache_security_group_ingress",
"(",
"name",
",",
"ec2_security_group_name",
",",
"ec2_security_group_owner_id",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | try_printout | Safely get the string to print out, try the configured outputter, then
fall back to nested and then to raw | salt/output/__init__.py | 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):
'''
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... | [
"Safely",
"get",
"the",
"string",
"to",
"print",
"out",
"try",
"the",
"configured",
"outputter",
"then",
"fall",
"back",
"to",
"nested",
"and",
"then",
"to",
"raw"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/__init__.py#L37-L56 | [
"def",
"try_printout",
"(",
"data",
",",
"out",
",",
"opts",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"printout",
"=",
"get_printout",
"(",
"out",
",",
"opts",
")",
"(",
"data",
",",
"*",
"*",
"kwargs",
")",
"if",
"printout",
"is",
"not",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_progress | Get the progress bar from the given outputter | salt/output/__init__.py | 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):
'''
Get the progress bar from the given outputter
'''
return salt.loader.raw_mod(opts,
out,
'rawmodule',
mod='output')['{0}.progress_iter'.format(out)](progress) | [
"Get",
"the",
"progress",
"bar",
"from",
"the",
"given",
"outputter"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/__init__.py#L59-L66 | [
"def",
"get_progress",
"(",
"opts",
",",
"out",
",",
"progress",
")",
":",
"return",
"salt",
".",
"loader",
".",
"raw_mod",
"(",
"opts",
",",
"out",
",",
"'rawmodule'",
",",
"mod",
"=",
"'output'",
")",
"[",
"'{0}.progress_iter'",
".",
"format",
"(",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update_progress | Update the progress iterator for the given outputter | salt/output/__init__.py | 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):
'''
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... | [
"Update",
"the",
"progress",
"iterator",
"for",
"the",
"given",
"outputter"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/__init__.py#L69-L79 | [
"def",
"update_progress",
"(",
"opts",
",",
"progress",
",",
"progress_iter",
",",
"out",
")",
":",
"# Look up the outputter",
"try",
":",
"progress_outputter",
"=",
"salt",
".",
"loader",
".",
"outputters",
"(",
"opts",
")",
"[",
"out",
"]",
"except",
"KeyE... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | display_output | Print the passed data using the desired output | salt/output/__init__.py | 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):
'''
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:
... | [
"Print",
"the",
"passed",
"data",
"using",
"the",
"desired",
"output"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/__init__.py#L90-L132 | [
"def",
"display_output",
"(",
"data",
",",
"out",
"=",
"None",
",",
"opts",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"opts",
"is",
"None",
":",
"opts",
"=",
"{",
"}",
"display_data",
"=",
"try_printout",
"(",
"data",
",",
"out",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_printout | Return a printer function | salt/output/__init__.py | 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):
'''
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.
... | [
"Return",
"a",
"printer",
"function"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/__init__.py#L135-L198 | [
"def",
"get_printout",
"(",
"out",
",",
"opts",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"opts",
"is",
"None",
":",
"opts",
"=",
"{",
"}",
"if",
"'output'",
"in",
"opts",
"and",
"opts",
"[",
"'output'",
"]",
"!=",
"'highstate'",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | out_format | Return the formatted outputter string for the passed data | salt/output/__init__.py | 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 the formatted outputter string for the passed data
'''
return try_printout(data, out, opts, **kwargs) | [
"Return",
"the",
"formatted",
"outputter",
"string",
"for",
"the",
"passed",
"data"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/__init__.py#L201-L205 | [
"def",
"out_format",
"(",
"data",
",",
"out",
",",
"opts",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"try_printout",
"(",
"data",
",",
"out",
",",
"opts",
",",
"*",
"*",
"kwargs",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.