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 | Master._pre_flight | Run pre flight checks. If anything in this method fails then the master
should not start up. | salt/master.py | def _pre_flight(self):
'''
Run pre flight checks. If anything in this method fails then the master
should not start up.
'''
errors = []
critical_errors = []
try:
os.chdir('/')
except OSError as err:
errors.append(
'... | def _pre_flight(self):
'''
Run pre flight checks. If anything in this method fails then the master
should not start up.
'''
errors = []
critical_errors = []
try:
os.chdir('/')
except OSError as err:
errors.append(
'... | [
"Run",
"pre",
"flight",
"checks",
".",
"If",
"anything",
"in",
"this",
"method",
"fails",
"then",
"the",
"master",
"should",
"not",
"start",
"up",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L563-L644 | [
"def",
"_pre_flight",
"(",
"self",
")",
":",
"errors",
"=",
"[",
"]",
"critical_errors",
"=",
"[",
"]",
"try",
":",
"os",
".",
"chdir",
"(",
"'/'",
")",
"except",
"OSError",
"as",
"err",
":",
"errors",
".",
"append",
"(",
"'Cannot change to root director... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Master.start | Turn on the master server components | salt/master.py | def start(self):
'''
Turn on the master server components
'''
self._pre_flight()
log.info('salt-master is starting as user \'%s\'', salt.utils.user.get_user())
enable_sigusr1_handler()
enable_sigusr2_handler()
self.__set_max_open_files()
# Reset... | def start(self):
'''
Turn on the master server components
'''
self._pre_flight()
log.info('salt-master is starting as user \'%s\'', salt.utils.user.get_user())
enable_sigusr1_handler()
enable_sigusr2_handler()
self.__set_max_open_files()
# Reset... | [
"Turn",
"on",
"the",
"master",
"server",
"components"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L646-L774 | [
"def",
"start",
"(",
"self",
")",
":",
"self",
".",
"_pre_flight",
"(",
")",
"log",
".",
"info",
"(",
"'salt-master is starting as user \\'%s\\''",
",",
"salt",
".",
"utils",
".",
"user",
".",
"get_user",
"(",
")",
")",
"enable_sigusr1_handler",
"(",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Halite.run | Fire up halite! | salt/master.py | def run(self):
'''
Fire up halite!
'''
salt.utils.process.appendproctitle(self.__class__.__name__)
halite.start(self.hopts) | def run(self):
'''
Fire up halite!
'''
salt.utils.process.appendproctitle(self.__class__.__name__)
halite.start(self.hopts) | [
"Fire",
"up",
"halite!"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L817-L822 | [
"def",
"run",
"(",
"self",
")",
":",
"salt",
".",
"utils",
".",
"process",
".",
"appendproctitle",
"(",
"self",
".",
"__class__",
".",
"__name__",
")",
"halite",
".",
"start",
"(",
"self",
".",
"hopts",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ReqServer.__bind | Binds the reply server | salt/master.py | def __bind(self):
'''
Binds the reply server
'''
if self.log_queue is not None:
salt.log.setup.set_multiprocessing_logging_queue(self.log_queue)
if self.log_queue_level is not None:
salt.log.setup.set_multiprocessing_logging_level(self.log_queue_level)
... | def __bind(self):
'''
Binds the reply server
'''
if self.log_queue is not None:
salt.log.setup.set_multiprocessing_logging_queue(self.log_queue)
if self.log_queue_level is not None:
salt.log.setup.set_multiprocessing_logging_level(self.log_queue_level)
... | [
"Binds",
"the",
"reply",
"server"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L876-L937 | [
"def",
"__bind",
"(",
"self",
")",
":",
"if",
"self",
".",
"log_queue",
"is",
"not",
"None",
":",
"salt",
".",
"log",
".",
"setup",
".",
"set_multiprocessing_logging_queue",
"(",
"self",
".",
"log_queue",
")",
"if",
"self",
".",
"log_queue_level",
"is",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | MWorker.__bind | Bind to the local port | salt/master.py | def __bind(self):
'''
Bind to the local port
'''
# using ZMQIOLoop since we *might* need zmq in there
install_zmq()
self.io_loop = ZMQDefaultLoop()
self.io_loop.make_current()
for req_channel in self.req_channels:
req_channel.post_fork(self._ha... | def __bind(self):
'''
Bind to the local port
'''
# using ZMQIOLoop since we *might* need zmq in there
install_zmq()
self.io_loop = ZMQDefaultLoop()
self.io_loop.make_current()
for req_channel in self.req_channels:
req_channel.post_fork(self._ha... | [
"Bind",
"to",
"the",
"local",
"port"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1024-L1038 | [
"def",
"__bind",
"(",
"self",
")",
":",
"# using ZMQIOLoop since we *might* need zmq in there",
"install_zmq",
"(",
")",
"self",
".",
"io_loop",
"=",
"ZMQDefaultLoop",
"(",
")",
"self",
".",
"io_loop",
".",
"make_current",
"(",
")",
"for",
"req_channel",
"in",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | MWorker._handle_payload | The _handle_payload method is the key method used to figure out what
needs to be done with communication to the server
Example cleartext payload generated for 'salt myminion test.ping':
{'enc': 'clear',
'load': {'arg': [],
'cmd': 'publish',
'fun': '... | salt/master.py | def _handle_payload(self, payload):
'''
The _handle_payload method is the key method used to figure out what
needs to be done with communication to the server
Example cleartext payload generated for 'salt myminion test.ping':
{'enc': 'clear',
'load': {'arg': [],
... | def _handle_payload(self, payload):
'''
The _handle_payload method is the key method used to figure out what
needs to be done with communication to the server
Example cleartext payload generated for 'salt myminion test.ping':
{'enc': 'clear',
'load': {'arg': [],
... | [
"The",
"_handle_payload",
"method",
"is",
"the",
"key",
"method",
"used",
"to",
"figure",
"out",
"what",
"needs",
"to",
"be",
"done",
"with",
"communication",
"to",
"the",
"server"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1041-L1066 | [
"def",
"_handle_payload",
"(",
"self",
",",
"payload",
")",
":",
"key",
"=",
"payload",
"[",
"'enc'",
"]",
"load",
"=",
"payload",
"[",
"'load'",
"]",
"ret",
"=",
"{",
"'aes'",
":",
"self",
".",
"_handle_aes",
",",
"'clear'",
":",
"self",
".",
"_hand... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | MWorker._post_stats | Fire events with stat info if it's time | salt/master.py | def _post_stats(self, stats):
'''
Fire events with stat info if it's time
'''
end_time = time.time()
if end_time - self.stat_clock > self.opts['master_stats_event_iter']:
# Fire the event with the stats and wipe the tracker
self.aes_funcs.event.fire_event(... | def _post_stats(self, stats):
'''
Fire events with stat info if it's time
'''
end_time = time.time()
if end_time - self.stat_clock > self.opts['master_stats_event_iter']:
# Fire the event with the stats and wipe the tracker
self.aes_funcs.event.fire_event(... | [
"Fire",
"events",
"with",
"stat",
"info",
"if",
"it",
"s",
"time"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1068-L1077 | [
"def",
"_post_stats",
"(",
"self",
",",
"stats",
")",
":",
"end_time",
"=",
"time",
".",
"time",
"(",
")",
"if",
"end_time",
"-",
"self",
".",
"stat_clock",
">",
"self",
".",
"opts",
"[",
"'master_stats_event_iter'",
"]",
":",
"# Fire the event with the stat... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | MWorker._handle_clear | Process a cleartext command
:param dict load: Cleartext payload
:return: The result of passing the load to a function in ClearFuncs corresponding to
the command specified in the load's 'cmd' key. | salt/master.py | def _handle_clear(self, load):
'''
Process a cleartext command
:param dict load: Cleartext payload
:return: The result of passing the load to a function in ClearFuncs corresponding to
the command specified in the load's 'cmd' key.
'''
log.trace('Clear pa... | def _handle_clear(self, load):
'''
Process a cleartext command
:param dict load: Cleartext payload
:return: The result of passing the load to a function in ClearFuncs corresponding to
the command specified in the load's 'cmd' key.
'''
log.trace('Clear pa... | [
"Process",
"a",
"cleartext",
"command"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1079-L1097 | [
"def",
"_handle_clear",
"(",
"self",
",",
"load",
")",
":",
"log",
".",
"trace",
"(",
"'Clear payload received with command %s'",
",",
"load",
"[",
"'cmd'",
"]",
")",
"cmd",
"=",
"load",
"[",
"'cmd'",
"]",
"if",
"cmd",
".",
"startswith",
"(",
"'__'",
")"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | MWorker._handle_aes | Process a command sent via an AES key
:param str load: Encrypted payload
:return: The result of passing the load to a function in AESFuncs corresponding to
the command specified in the load's 'cmd' key. | salt/master.py | def _handle_aes(self, data):
'''
Process a command sent via an AES key
:param str load: Encrypted payload
:return: The result of passing the load to a function in AESFuncs corresponding to
the command specified in the load's 'cmd' key.
'''
if 'cmd' not i... | def _handle_aes(self, data):
'''
Process a command sent via an AES key
:param str load: Encrypted payload
:return: The result of passing the load to a function in AESFuncs corresponding to
the command specified in the load's 'cmd' key.
'''
if 'cmd' not i... | [
"Process",
"a",
"command",
"sent",
"via",
"an",
"AES",
"key"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1099-L1128 | [
"def",
"_handle_aes",
"(",
"self",
",",
"data",
")",
":",
"if",
"'cmd'",
"not",
"in",
"data",
":",
"log",
".",
"error",
"(",
"'Received malformed command %s'",
",",
"data",
")",
"return",
"{",
"}",
"cmd",
"=",
"data",
"[",
"'cmd'",
"]",
"log",
".",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | MWorker.run | Start a Master Worker | salt/master.py | def run(self):
'''
Start a Master Worker
'''
salt.utils.process.appendproctitle(self.name)
self.clear_funcs = ClearFuncs(
self.opts,
self.key,
)
self.aes_funcs = AESFuncs(self.opts)
salt.utils.crypt.reinit_crypto()
self.__b... | def run(self):
'''
Start a Master Worker
'''
salt.utils.process.appendproctitle(self.name)
self.clear_funcs = ClearFuncs(
self.opts,
self.key,
)
self.aes_funcs = AESFuncs(self.opts)
salt.utils.crypt.reinit_crypto()
self.__b... | [
"Start",
"a",
"Master",
"Worker"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1130-L1141 | [
"def",
"run",
"(",
"self",
")",
":",
"salt",
".",
"utils",
".",
"process",
".",
"appendproctitle",
"(",
"self",
".",
"name",
")",
"self",
".",
"clear_funcs",
"=",
"ClearFuncs",
"(",
"self",
".",
"opts",
",",
"self",
".",
"key",
",",
")",
"self",
".... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AESFuncs.__setup_fileserver | Set the local file objects from the file server interface | salt/master.py | def __setup_fileserver(self):
'''
Set the local file objects from the file server interface
'''
# Avoid circular import
import salt.fileserver
self.fs_ = salt.fileserver.Fileserver(self.opts)
self._serve_file = self.fs_.serve_file
self._file_find = self.fs... | def __setup_fileserver(self):
'''
Set the local file objects from the file server interface
'''
# Avoid circular import
import salt.fileserver
self.fs_ = salt.fileserver.Fileserver(self.opts)
self._serve_file = self.fs_.serve_file
self._file_find = self.fs... | [
"Set",
"the",
"local",
"file",
"objects",
"from",
"the",
"file",
"server",
"interface"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1176-L1191 | [
"def",
"__setup_fileserver",
"(",
"self",
")",
":",
"# Avoid circular import",
"import",
"salt",
".",
"fileserver",
"self",
".",
"fs_",
"=",
"salt",
".",
"fileserver",
".",
"Fileserver",
"(",
"self",
".",
"opts",
")",
"self",
".",
"_serve_file",
"=",
"self",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AESFuncs.__verify_minion | Take a minion id and a string signed with the minion private key
The string needs to verify as 'salt' with the minion public key
:param str id_: A minion ID
:param str token: A string signed with the minion private key
:rtype: bool
:return: Boolean indicating whether or not the... | salt/master.py | def __verify_minion(self, id_, token):
'''
Take a minion id and a string signed with the minion private key
The string needs to verify as 'salt' with the minion public key
:param str id_: A minion ID
:param str token: A string signed with the minion private key
:rtype: ... | def __verify_minion(self, id_, token):
'''
Take a minion id and a string signed with the minion private key
The string needs to verify as 'salt' with the minion public key
:param str id_: A minion ID
:param str token: A string signed with the minion private key
:rtype: ... | [
"Take",
"a",
"minion",
"id",
"and",
"a",
"string",
"signed",
"with",
"the",
"minion",
"private",
"key",
"The",
"string",
"needs",
"to",
"verify",
"as",
"salt",
"with",
"the",
"minion",
"public",
"key"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1193-L1229 | [
"def",
"__verify_minion",
"(",
"self",
",",
"id_",
",",
"token",
")",
":",
"if",
"not",
"salt",
".",
"utils",
".",
"verify",
".",
"valid_id",
"(",
"self",
".",
"opts",
",",
"id_",
")",
":",
"return",
"False",
"pub_path",
"=",
"os",
".",
"path",
"."... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AESFuncs.__verify_minion_publish | Verify that the passed information authorized a minion to execute
:param dict clear_load: A publication load from a minion
:rtype: bool
:return: A boolean indicating if the minion is allowed to publish the command in the load | salt/master.py | def __verify_minion_publish(self, clear_load):
'''
Verify that the passed information authorized a minion to execute
:param dict clear_load: A publication load from a minion
:rtype: bool
:return: A boolean indicating if the minion is allowed to publish the command in the load
... | def __verify_minion_publish(self, clear_load):
'''
Verify that the passed information authorized a minion to execute
:param dict clear_load: A publication load from a minion
:rtype: bool
:return: A boolean indicating if the minion is allowed to publish the command in the load
... | [
"Verify",
"that",
"the",
"passed",
"information",
"authorized",
"a",
"minion",
"to",
"execute"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1244-L1294 | [
"def",
"__verify_minion_publish",
"(",
"self",
",",
"clear_load",
")",
":",
"# Verify that the load is valid",
"if",
"'peer'",
"not",
"in",
"self",
".",
"opts",
":",
"return",
"False",
"if",
"not",
"isinstance",
"(",
"self",
".",
"opts",
"[",
"'peer'",
"]",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AESFuncs.__verify_load | A utility function to perform common verification steps.
:param dict load: A payload received from a minion
:param list verify_keys: A list of strings that should be present in a
given load
:rtype: bool
:rtype: dict
:return: The original load (except for the token) if t... | salt/master.py | def __verify_load(self, load, verify_keys):
'''
A utility function to perform common verification steps.
:param dict load: A payload received from a minion
:param list verify_keys: A list of strings that should be present in a
given load
:rtype: bool
:rtype: dic... | def __verify_load(self, load, verify_keys):
'''
A utility function to perform common verification steps.
:param dict load: A payload received from a minion
:param list verify_keys: A list of strings that should be present in a
given load
:rtype: bool
:rtype: dic... | [
"A",
"utility",
"function",
"to",
"perform",
"common",
"verification",
"steps",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1296-L1326 | [
"def",
"__verify_load",
"(",
"self",
",",
"load",
",",
"verify_keys",
")",
":",
"if",
"any",
"(",
"key",
"not",
"in",
"load",
"for",
"key",
"in",
"verify_keys",
")",
":",
"return",
"False",
"if",
"'tok'",
"not",
"in",
"load",
":",
"log",
".",
"error"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AESFuncs._master_tops | Return the results from an external node classifier if one is
specified
:param dict load: A payload received from a minion
:return: The results from an external node classifier | salt/master.py | def _master_tops(self, load):
'''
Return the results from an external node classifier if one is
specified
:param dict load: A payload received from a minion
:return: The results from an external node classifier
'''
load = self.__verify_load(load, ('id', 'tok'))
... | def _master_tops(self, load):
'''
Return the results from an external node classifier if one is
specified
:param dict load: A payload received from a minion
:return: The results from an external node classifier
'''
load = self.__verify_load(load, ('id', 'tok'))
... | [
"Return",
"the",
"results",
"from",
"an",
"external",
"node",
"classifier",
"if",
"one",
"is",
"specified"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1328-L1339 | [
"def",
"_master_tops",
"(",
"self",
",",
"load",
")",
":",
"load",
"=",
"self",
".",
"__verify_load",
"(",
"load",
",",
"(",
"'id'",
",",
"'tok'",
")",
")",
"if",
"load",
"is",
"False",
":",
"return",
"{",
"}",
"return",
"self",
".",
"masterapi",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AESFuncs._mine_get | Gathers the data from the specified minions' mine
:param dict load: A payload received from a minion
:rtype: dict
:return: Mine data from the specified minions | salt/master.py | def _mine_get(self, load):
'''
Gathers the data from the specified minions' mine
:param dict load: A payload received from a minion
:rtype: dict
:return: Mine data from the specified minions
'''
load = self.__verify_load(load, ('id', 'tgt', 'fun', 'tok'))
... | def _mine_get(self, load):
'''
Gathers the data from the specified minions' mine
:param dict load: A payload received from a minion
:rtype: dict
:return: Mine data from the specified minions
'''
load = self.__verify_load(load, ('id', 'tgt', 'fun', 'tok'))
... | [
"Gathers",
"the",
"data",
"from",
"the",
"specified",
"minions",
"mine"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1379-L1392 | [
"def",
"_mine_get",
"(",
"self",
",",
"load",
")",
":",
"load",
"=",
"self",
".",
"__verify_load",
"(",
"load",
",",
"(",
"'id'",
",",
"'tgt'",
",",
"'fun'",
",",
"'tok'",
")",
")",
"if",
"load",
"is",
"False",
":",
"return",
"{",
"}",
"else",
":... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AESFuncs._mine | Store the mine data
:param dict load: A payload received from a minion
:rtype: bool
:return: True if the data has been stored in the mine | salt/master.py | def _mine(self, load):
'''
Store the mine data
:param dict load: A payload received from a minion
:rtype: bool
:return: True if the data has been stored in the mine
'''
load = self.__verify_load(load, ('id', 'data', 'tok'))
if load is False:
... | def _mine(self, load):
'''
Store the mine data
:param dict load: A payload received from a minion
:rtype: bool
:return: True if the data has been stored in the mine
'''
load = self.__verify_load(load, ('id', 'data', 'tok'))
if load is False:
... | [
"Store",
"the",
"mine",
"data"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1394-L1406 | [
"def",
"_mine",
"(",
"self",
",",
"load",
")",
":",
"load",
"=",
"self",
".",
"__verify_load",
"(",
"load",
",",
"(",
"'id'",
",",
"'data'",
",",
"'tok'",
")",
")",
"if",
"load",
"is",
"False",
":",
"return",
"{",
"}",
"return",
"self",
".",
"mas... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AESFuncs._mine_delete | Allow the minion to delete a specific function from its own mine
:param dict load: A payload received from a minion
:rtype: bool
:return: Boolean indicating whether or not the given function was deleted from the mine | salt/master.py | def _mine_delete(self, load):
'''
Allow the minion to delete a specific function from its own mine
:param dict load: A payload received from a minion
:rtype: bool
:return: Boolean indicating whether or not the given function was deleted from the mine
'''
load = ... | def _mine_delete(self, load):
'''
Allow the minion to delete a specific function from its own mine
:param dict load: A payload received from a minion
:rtype: bool
:return: Boolean indicating whether or not the given function was deleted from the mine
'''
load = ... | [
"Allow",
"the",
"minion",
"to",
"delete",
"a",
"specific",
"function",
"from",
"its",
"own",
"mine"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1408-L1421 | [
"def",
"_mine_delete",
"(",
"self",
",",
"load",
")",
":",
"load",
"=",
"self",
".",
"__verify_load",
"(",
"load",
",",
"(",
"'id'",
",",
"'fun'",
",",
"'tok'",
")",
")",
"if",
"load",
"is",
"False",
":",
"return",
"{",
"}",
"else",
":",
"return",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AESFuncs._mine_flush | Allow the minion to delete all of its own mine contents
:param dict load: A payload received from a minion | salt/master.py | def _mine_flush(self, load):
'''
Allow the minion to delete all of its own mine contents
:param dict load: A payload received from a minion
'''
load = self.__verify_load(load, ('id', 'tok'))
if load is False:
return {}
else:
return self.ma... | def _mine_flush(self, load):
'''
Allow the minion to delete all of its own mine contents
:param dict load: A payload received from a minion
'''
load = self.__verify_load(load, ('id', 'tok'))
if load is False:
return {}
else:
return self.ma... | [
"Allow",
"the",
"minion",
"to",
"delete",
"all",
"of",
"its",
"own",
"mine",
"contents"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1423-L1433 | [
"def",
"_mine_flush",
"(",
"self",
",",
"load",
")",
":",
"load",
"=",
"self",
".",
"__verify_load",
"(",
"load",
",",
"(",
"'id'",
",",
"'tok'",
")",
")",
"if",
"load",
"is",
"False",
":",
"return",
"{",
"}",
"else",
":",
"return",
"self",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AESFuncs._file_recv | Allows minions to send files to the master, files are sent to the
master file cache | salt/master.py | def _file_recv(self, load):
'''
Allows minions to send files to the master, files are sent to the
master file cache
'''
if any(key not in load for key in ('id', 'path', 'loc')):
return False
if not isinstance(load['path'], list):
return False
... | def _file_recv(self, load):
'''
Allows minions to send files to the master, files are sent to the
master file cache
'''
if any(key not in load for key in ('id', 'path', 'loc')):
return False
if not isinstance(load['path'], list):
return False
... | [
"Allows",
"minions",
"to",
"send",
"files",
"to",
"the",
"master",
"files",
"are",
"sent",
"to",
"the",
"master",
"file",
"cache"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1435-L1514 | [
"def",
"_file_recv",
"(",
"self",
",",
"load",
")",
":",
"if",
"any",
"(",
"key",
"not",
"in",
"load",
"for",
"key",
"in",
"(",
"'id'",
",",
"'path'",
",",
"'loc'",
")",
")",
":",
"return",
"False",
"if",
"not",
"isinstance",
"(",
"load",
"[",
"'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AESFuncs._pillar | Return the pillar data for the minion
:param dict load: Minion payload
:rtype: dict
:return: The pillar data for the minion | salt/master.py | def _pillar(self, load):
'''
Return the pillar data for the minion
:param dict load: Minion payload
:rtype: dict
:return: The pillar data for the minion
'''
if any(key not in load for key in ('id', 'grains')):
return False
if not salt.utils.v... | def _pillar(self, load):
'''
Return the pillar data for the minion
:param dict load: Minion payload
:rtype: dict
:return: The pillar data for the minion
'''
if any(key not in load for key in ('id', 'grains')):
return False
if not salt.utils.v... | [
"Return",
"the",
"pillar",
"data",
"for",
"the",
"minion"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1516-L1549 | [
"def",
"_pillar",
"(",
"self",
",",
"load",
")",
":",
"if",
"any",
"(",
"key",
"not",
"in",
"load",
"for",
"key",
"in",
"(",
"'id'",
",",
"'grains'",
")",
")",
":",
"return",
"False",
"if",
"not",
"salt",
".",
"utils",
".",
"verify",
".",
"valid_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AESFuncs._minion_event | Receive an event from the minion and fire it on the master event
interface
:param dict load: The minion payload | salt/master.py | def _minion_event(self, load):
'''
Receive an event from the minion and fire it on the master event
interface
:param dict load: The minion payload
'''
load = self.__verify_load(load, ('id', 'tok'))
if load is False:
return {}
# Route to master... | def _minion_event(self, load):
'''
Receive an event from the minion and fire it on the master event
interface
:param dict load: The minion payload
'''
load = self.__verify_load(load, ('id', 'tok'))
if load is False:
return {}
# Route to master... | [
"Receive",
"an",
"event",
"from",
"the",
"minion",
"and",
"fire",
"it",
"on",
"the",
"master",
"event",
"interface"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1551-L1564 | [
"def",
"_minion_event",
"(",
"self",
",",
"load",
")",
":",
"load",
"=",
"self",
".",
"__verify_load",
"(",
"load",
",",
"(",
"'id'",
",",
"'tok'",
")",
")",
"if",
"load",
"is",
"False",
":",
"return",
"{",
"}",
"# Route to master event bus",
"self",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AESFuncs._handle_minion_event | Act on specific events from minions | salt/master.py | def _handle_minion_event(self, load):
'''
Act on specific events from minions
'''
id_ = load['id']
if load.get('tag', '') == '_salt_error':
log.error(
'Received minion error from [%s]: %s',
id_, load['data']['message']
)
... | def _handle_minion_event(self, load):
'''
Act on specific events from minions
'''
id_ = load['id']
if load.get('tag', '') == '_salt_error':
log.error(
'Received minion error from [%s]: %s',
id_, load['data']['message']
)
... | [
"Act",
"on",
"specific",
"events",
"from",
"minions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1566-L1595 | [
"def",
"_handle_minion_event",
"(",
"self",
",",
"load",
")",
":",
"id_",
"=",
"load",
"[",
"'id'",
"]",
"if",
"load",
".",
"get",
"(",
"'tag'",
",",
"''",
")",
"==",
"'_salt_error'",
":",
"log",
".",
"error",
"(",
"'Received minion error from [%s]: %s'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AESFuncs._return | Handle the return data sent from the minions.
Takes the return, verifies it and fires it on the master event bus.
Typically, this event is consumed by the Salt CLI waiting on the other
end of the event bus but could be heard by any listener on the bus.
:param dict load: The minion payl... | salt/master.py | def _return(self, load):
'''
Handle the return data sent from the minions.
Takes the return, verifies it and fires it on the master event bus.
Typically, this event is consumed by the Salt CLI waiting on the other
end of the event bus but could be heard by any listener on the bu... | def _return(self, load):
'''
Handle the return data sent from the minions.
Takes the return, verifies it and fires it on the master event bus.
Typically, this event is consumed by the Salt CLI waiting on the other
end of the event bus but could be heard by any listener on the bu... | [
"Handle",
"the",
"return",
"data",
"sent",
"from",
"the",
"minions",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1597-L1636 | [
"def",
"_return",
"(",
"self",
",",
"load",
")",
":",
"if",
"self",
".",
"opts",
"[",
"'require_minion_sign_messages'",
"]",
"and",
"'sig'",
"not",
"in",
"load",
":",
"log",
".",
"critical",
"(",
"'_return: Master is requiring minions to sign their '",
"'messages,... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AESFuncs._syndic_return | Receive a syndic minion return and format it to look like returns from
individual minions.
:param dict load: The minion payload | salt/master.py | def _syndic_return(self, load):
'''
Receive a syndic minion return and format it to look like returns from
individual minions.
:param dict load: The minion payload
'''
loads = load.get('load')
if not isinstance(loads, list):
loads = [load] # support ... | def _syndic_return(self, load):
'''
Receive a syndic minion return and format it to look like returns from
individual minions.
:param dict load: The minion payload
'''
loads = load.get('load')
if not isinstance(loads, list):
loads = [load] # support ... | [
"Receive",
"a",
"syndic",
"minion",
"return",
"and",
"format",
"it",
"to",
"look",
"like",
"returns",
"from",
"individual",
"minions",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1638-L1681 | [
"def",
"_syndic_return",
"(",
"self",
",",
"load",
")",
":",
"loads",
"=",
"load",
".",
"get",
"(",
"'load'",
")",
"if",
"not",
"isinstance",
"(",
"loads",
",",
"list",
")",
":",
"loads",
"=",
"[",
"load",
"]",
"# support old syndics not aggregating return... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AESFuncs.minion_runner | Execute a runner from a minion, return the runner's function data
:param dict clear_load: The minion payload
:rtype: dict
:return: The runner function data | salt/master.py | def minion_runner(self, clear_load):
'''
Execute a runner from a minion, return the runner's function data
:param dict clear_load: The minion payload
:rtype: dict
:return: The runner function data
'''
load = self.__verify_load(clear_load, ('fun', 'arg', 'id', 't... | def minion_runner(self, clear_load):
'''
Execute a runner from a minion, return the runner's function data
:param dict clear_load: The minion payload
:rtype: dict
:return: The runner function data
'''
load = self.__verify_load(clear_load, ('fun', 'arg', 'id', 't... | [
"Execute",
"a",
"runner",
"from",
"a",
"minion",
"return",
"the",
"runner",
"s",
"function",
"data"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1683-L1696 | [
"def",
"minion_runner",
"(",
"self",
",",
"clear_load",
")",
":",
"load",
"=",
"self",
".",
"__verify_load",
"(",
"clear_load",
",",
"(",
"'fun'",
",",
"'arg'",
",",
"'id'",
",",
"'tok'",
")",
")",
"if",
"load",
"is",
"False",
":",
"return",
"{",
"}"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AESFuncs.pub_ret | Request the return data from a specific jid, only allowed
if the requesting minion also initialted the execution.
:param dict load: The minion payload
:rtype: dict
:return: Return data corresponding to a given JID | salt/master.py | def pub_ret(self, load):
'''
Request the return data from a specific jid, only allowed
if the requesting minion also initialted the execution.
:param dict load: The minion payload
:rtype: dict
:return: Return data corresponding to a given JID
'''
load = ... | def pub_ret(self, load):
'''
Request the return data from a specific jid, only allowed
if the requesting minion also initialted the execution.
:param dict load: The minion payload
:rtype: dict
:return: Return data corresponding to a given JID
'''
load = ... | [
"Request",
"the",
"return",
"data",
"from",
"a",
"specific",
"jid",
"only",
"allowed",
"if",
"the",
"requesting",
"minion",
"also",
"initialted",
"the",
"execution",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1698-L1722 | [
"def",
"pub_ret",
"(",
"self",
",",
"load",
")",
":",
"load",
"=",
"self",
".",
"__verify_load",
"(",
"load",
",",
"(",
"'jid'",
",",
"'id'",
",",
"'tok'",
")",
")",
"if",
"load",
"is",
"False",
":",
"return",
"{",
"}",
"# Check that this minion can ac... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AESFuncs.minion_pub | Publish a command initiated from a minion, this method executes minion
restrictions so that the minion publication will only work if it is
enabled in the config.
The configuration on the master allows minions to be matched to
salt functions, so the minions can only publish allowed salt ... | salt/master.py | def minion_pub(self, clear_load):
'''
Publish a command initiated from a minion, this method executes minion
restrictions so that the minion publication will only work if it is
enabled in the config.
The configuration on the master allows minions to be matched to
salt fu... | def minion_pub(self, clear_load):
'''
Publish a command initiated from a minion, this method executes minion
restrictions so that the minion publication will only work if it is
enabled in the config.
The configuration on the master allows minions to be matched to
salt fu... | [
"Publish",
"a",
"command",
"initiated",
"from",
"a",
"minion",
"this",
"method",
"executes",
"minion",
"restrictions",
"so",
"that",
"the",
"minion",
"publication",
"will",
"only",
"work",
"if",
"it",
"is",
"enabled",
"in",
"the",
"config",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1724-L1757 | [
"def",
"minion_pub",
"(",
"self",
",",
"clear_load",
")",
":",
"if",
"not",
"self",
".",
"__verify_minion_publish",
"(",
"clear_load",
")",
":",
"return",
"{",
"}",
"else",
":",
"return",
"self",
".",
"masterapi",
".",
"minion_pub",
"(",
"clear_load",
")"
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AESFuncs.minion_publish | Publish a command initiated from a minion, this method executes minion
restrictions so that the minion publication will only work if it is
enabled in the config.
The configuration on the master allows minions to be matched to
salt functions, so the minions can only publish allowed salt ... | salt/master.py | def minion_publish(self, clear_load):
'''
Publish a command initiated from a minion, this method executes minion
restrictions so that the minion publication will only work if it is
enabled in the config.
The configuration on the master allows minions to be matched to
sal... | def minion_publish(self, clear_load):
'''
Publish a command initiated from a minion, this method executes minion
restrictions so that the minion publication will only work if it is
enabled in the config.
The configuration on the master allows minions to be matched to
sal... | [
"Publish",
"a",
"command",
"initiated",
"from",
"a",
"minion",
"this",
"method",
"executes",
"minion",
"restrictions",
"so",
"that",
"the",
"minion",
"publication",
"will",
"only",
"work",
"if",
"it",
"is",
"enabled",
"in",
"the",
"config",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1759-L1792 | [
"def",
"minion_publish",
"(",
"self",
",",
"clear_load",
")",
":",
"if",
"not",
"self",
".",
"__verify_minion_publish",
"(",
"clear_load",
")",
":",
"return",
"{",
"}",
"else",
":",
"return",
"self",
".",
"masterapi",
".",
"minion_publish",
"(",
"clear_load"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AESFuncs.revoke_auth | Allow a minion to request revocation of its own key
:param dict load: The minion payload
:rtype: dict
:return: If the load is invalid, it may be returned. No key operation is performed.
:rtype: bool
:return: True if key was revoked, False if not | salt/master.py | def revoke_auth(self, load):
'''
Allow a minion to request revocation of its own key
:param dict load: The minion payload
:rtype: dict
:return: If the load is invalid, it may be returned. No key operation is performed.
:rtype: bool
:return: True if key was revo... | def revoke_auth(self, load):
'''
Allow a minion to request revocation of its own key
:param dict load: The minion payload
:rtype: dict
:return: If the load is invalid, it may be returned. No key operation is performed.
:rtype: bool
:return: True if key was revo... | [
"Allow",
"a",
"minion",
"to",
"request",
"revocation",
"of",
"its",
"own",
"key"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1794-L1818 | [
"def",
"revoke_auth",
"(",
"self",
",",
"load",
")",
":",
"load",
"=",
"self",
".",
"__verify_load",
"(",
"load",
",",
"(",
"'id'",
",",
"'tok'",
")",
")",
"if",
"not",
"self",
".",
"opts",
".",
"get",
"(",
"'allow_minion_key_revoke'",
",",
"False",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AESFuncs.run_func | Wrapper for running functions executed with AES encryption
:param function func: The function to run
:return: The result of the master function that was called | salt/master.py | def run_func(self, func, load):
'''
Wrapper for running functions executed with AES encryption
:param function func: The function to run
:return: The result of the master function that was called
'''
# Don't honor private functions
if func.startswith('__'):
... | def run_func(self, func, load):
'''
Wrapper for running functions executed with AES encryption
:param function func: The function to run
:return: The result of the master function that was called
'''
# Don't honor private functions
if func.startswith('__'):
... | [
"Wrapper",
"for",
"running",
"functions",
"executed",
"with",
"AES",
"encryption"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1820-L1859 | [
"def",
"run_func",
"(",
"self",
",",
"func",
",",
"load",
")",
":",
"# Don't honor private functions",
"if",
"func",
".",
"startswith",
"(",
"'__'",
")",
":",
"# TODO: return some error? Seems odd to return {}",
"return",
"{",
"}",
",",
"{",
"'fun'",
":",
"'send... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ClearFuncs.runner | Send a master control function back to the runner system | salt/master.py | def runner(self, clear_load):
'''
Send a master control function back to the runner system
'''
# All runner ops pass through eauth
auth_type, err_name, key, sensitive_load_keys = self._prep_auth_info(clear_load)
# Authenticate
auth_check = self.loadauth.check_aut... | def runner(self, clear_load):
'''
Send a master control function back to the runner system
'''
# All runner ops pass through eauth
auth_type, err_name, key, sensitive_load_keys = self._prep_auth_info(clear_load)
# Authenticate
auth_check = self.loadauth.check_aut... | [
"Send",
"a",
"master",
"control",
"function",
"back",
"to",
"the",
"runner",
"system"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1894-L1947 | [
"def",
"runner",
"(",
"self",
",",
"clear_load",
")",
":",
"# All runner ops pass through eauth",
"auth_type",
",",
"err_name",
",",
"key",
",",
"sensitive_load_keys",
"=",
"self",
".",
"_prep_auth_info",
"(",
"clear_load",
")",
"# Authenticate",
"auth_check",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ClearFuncs.wheel | Send a master control function back to the wheel system | salt/master.py | def wheel(self, clear_load):
'''
Send a master control function back to the wheel system
'''
# All wheel ops pass through eauth
auth_type, err_name, key, sensitive_load_keys = self._prep_auth_info(clear_load)
# Authenticate
auth_check = self.loadauth.check_authen... | def wheel(self, clear_load):
'''
Send a master control function back to the wheel system
'''
# All wheel ops pass through eauth
auth_type, err_name, key, sensitive_load_keys = self._prep_auth_info(clear_load)
# Authenticate
auth_check = self.loadauth.check_authen... | [
"Send",
"a",
"master",
"control",
"function",
"back",
"to",
"the",
"wheel",
"system"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1949-L2018 | [
"def",
"wheel",
"(",
"self",
",",
"clear_load",
")",
":",
"# All wheel ops pass through eauth",
"auth_type",
",",
"err_name",
",",
"key",
",",
"sensitive_load_keys",
"=",
"self",
".",
"_prep_auth_info",
"(",
"clear_load",
")",
"# Authenticate",
"auth_check",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ClearFuncs.mk_token | Create and return an authentication token, the clear load needs to
contain the eauth key and the needed authentication creds. | salt/master.py | def mk_token(self, clear_load):
'''
Create and return an authentication token, the clear load needs to
contain the eauth key and the needed authentication creds.
'''
token = self.loadauth.mk_token(clear_load)
if not token:
log.warning('Authentication failure o... | def mk_token(self, clear_load):
'''
Create and return an authentication token, the clear load needs to
contain the eauth key and the needed authentication creds.
'''
token = self.loadauth.mk_token(clear_load)
if not token:
log.warning('Authentication failure o... | [
"Create",
"and",
"return",
"an",
"authentication",
"token",
"the",
"clear",
"load",
"needs",
"to",
"contain",
"the",
"eauth",
"key",
"and",
"the",
"needed",
"authentication",
"creds",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L2020-L2029 | [
"def",
"mk_token",
"(",
"self",
",",
"clear_load",
")",
":",
"token",
"=",
"self",
".",
"loadauth",
".",
"mk_token",
"(",
"clear_load",
")",
"if",
"not",
"token",
":",
"log",
".",
"warning",
"(",
"'Authentication failure of type \"eauth\" occurred.'",
")",
"re... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ClearFuncs.publish | This method sends out publications to the minions, it can only be used
by the LocalClient. | salt/master.py | def publish(self, clear_load):
'''
This method sends out publications to the minions, it can only be used
by the LocalClient.
'''
extra = clear_load.get('kwargs', {})
publisher_acl = salt.acl.PublisherACL(self.opts['publisher_acl_blacklist'])
if publisher_acl.us... | def publish(self, clear_load):
'''
This method sends out publications to the minions, it can only be used
by the LocalClient.
'''
extra = clear_load.get('kwargs', {})
publisher_acl = salt.acl.PublisherACL(self.opts['publisher_acl_blacklist'])
if publisher_acl.us... | [
"This",
"method",
"sends",
"out",
"publications",
"to",
"the",
"minions",
"it",
"can",
"only",
"be",
"used",
"by",
"the",
"LocalClient",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L2063-L2174 | [
"def",
"publish",
"(",
"self",
",",
"clear_load",
")",
":",
"extra",
"=",
"clear_load",
".",
"get",
"(",
"'kwargs'",
",",
"{",
"}",
")",
"publisher_acl",
"=",
"salt",
".",
"acl",
".",
"PublisherACL",
"(",
"self",
".",
"opts",
"[",
"'publisher_acl_blackli... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ClearFuncs._prep_jid | Return a jid for this publication | salt/master.py | def _prep_jid(self, clear_load, extra):
'''
Return a jid for this publication
'''
# the jid in clear_load can be None, '', or something else. this is an
# attempt to clean up the value before passing to plugins
passed_jid = clear_load['jid'] if clear_load.get('jid') else ... | def _prep_jid(self, clear_load, extra):
'''
Return a jid for this publication
'''
# the jid in clear_load can be None, '', or something else. this is an
# attempt to clean up the value before passing to plugins
passed_jid = clear_load['jid'] if clear_load.get('jid') else ... | [
"Return",
"a",
"jid",
"for",
"this",
"publication"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L2194-L2217 | [
"def",
"_prep_jid",
"(",
"self",
",",
"clear_load",
",",
"extra",
")",
":",
"# the jid in clear_load can be None, '', or something else. this is an",
"# attempt to clean up the value before passing to plugins",
"passed_jid",
"=",
"clear_load",
"[",
"'jid'",
"]",
"if",
"clear_lo... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ClearFuncs._send_pub | Take a load and send it across the network to connected minions | salt/master.py | def _send_pub(self, load):
'''
Take a load and send it across the network to connected minions
'''
for transport, opts in iter_transport_opts(self.opts):
chan = salt.transport.server.PubServerChannel.factory(opts)
chan.publish(load) | def _send_pub(self, load):
'''
Take a load and send it across the network to connected minions
'''
for transport, opts in iter_transport_opts(self.opts):
chan = salt.transport.server.PubServerChannel.factory(opts)
chan.publish(load) | [
"Take",
"a",
"load",
"and",
"send",
"it",
"across",
"the",
"network",
"to",
"connected",
"minions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L2219-L2225 | [
"def",
"_send_pub",
"(",
"self",
",",
"load",
")",
":",
"for",
"transport",
",",
"opts",
"in",
"iter_transport_opts",
"(",
"self",
".",
"opts",
")",
":",
"chan",
"=",
"salt",
".",
"transport",
".",
"server",
".",
"PubServerChannel",
".",
"factory",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ClearFuncs._send_ssh_pub | Take a load and send it across the network to ssh minions | salt/master.py | def _send_ssh_pub(self, load, ssh_minions=False):
'''
Take a load and send it across the network to ssh minions
'''
if self.opts['enable_ssh_minions'] is True and ssh_minions is True:
log.debug('Send payload to ssh minions')
threading.Thread(target=self.ssh_client... | def _send_ssh_pub(self, load, ssh_minions=False):
'''
Take a load and send it across the network to ssh minions
'''
if self.opts['enable_ssh_minions'] is True and ssh_minions is True:
log.debug('Send payload to ssh minions')
threading.Thread(target=self.ssh_client... | [
"Take",
"a",
"load",
"and",
"send",
"it",
"across",
"the",
"network",
"to",
"ssh",
"minions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L2233-L2239 | [
"def",
"_send_ssh_pub",
"(",
"self",
",",
"load",
",",
"ssh_minions",
"=",
"False",
")",
":",
"if",
"self",
".",
"opts",
"[",
"'enable_ssh_minions'",
"]",
"is",
"True",
"and",
"ssh_minions",
"is",
"True",
":",
"log",
".",
"debug",
"(",
"'Send payload to ss... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ClearFuncs._prep_pub | Take a given load and perform the necessary steps
to prepare a publication.
TODO: This is really only bound by temporal cohesion
and thus should be refactored even further. | salt/master.py | def _prep_pub(self, minions, jid, clear_load, extra, missing):
'''
Take a given load and perform the necessary steps
to prepare a publication.
TODO: This is really only bound by temporal cohesion
and thus should be refactored even further.
'''
clear_load['jid'] =... | def _prep_pub(self, minions, jid, clear_load, extra, missing):
'''
Take a given load and perform the necessary steps
to prepare a publication.
TODO: This is really only bound by temporal cohesion
and thus should be refactored even further.
'''
clear_load['jid'] =... | [
"Take",
"a",
"given",
"load",
"and",
"perform",
"the",
"necessary",
"steps",
"to",
"prepare",
"a",
"publication",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L2241-L2378 | [
"def",
"_prep_pub",
"(",
"self",
",",
"minions",
",",
"jid",
",",
"clear_load",
",",
"extra",
",",
"missing",
")",
":",
"clear_load",
"[",
"'jid'",
"]",
"=",
"jid",
"delimiter",
"=",
"clear_load",
".",
"get",
"(",
"'kwargs'",
",",
"{",
"}",
")",
".",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | row_absent | Makes sure the specified row is absent in db. If multiple rows
match where_sql, then the state will fail.
name
Only used as the unique ID
db
The database file name
table
The table name to check
where_sql
The sql to select the row to check
where_args
... | salt/states/sqlite3.py | def row_absent(name, db, table, where_sql, where_args=None):
'''
Makes sure the specified row is absent in db. If multiple rows
match where_sql, then the state will fail.
name
Only used as the unique ID
db
The database file name
table
The table name to check
wher... | def row_absent(name, db, table, where_sql, where_args=None):
'''
Makes sure the specified row is absent in db. If multiple rows
match where_sql, then the state will fail.
name
Only used as the unique ID
db
The database file name
table
The table name to check
wher... | [
"Makes",
"sure",
"the",
"specified",
"row",
"is",
"absent",
"in",
"db",
".",
"If",
"multiple",
"rows",
"match",
"where_sql",
"then",
"the",
"state",
"will",
"fail",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/sqlite3.py#L117-L191 | [
"def",
"row_absent",
"(",
"name",
",",
"db",
",",
"table",
",",
"where_sql",
",",
"where_args",
"=",
"None",
")",
":",
"changes",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | row_present | Checks to make sure the given row exists. If row exists and update is True
then row will be updated with data. Otherwise it will leave existing
row unmodified and check it against data. If the existing data
doesn't match data_check the state will fail. If the row doesn't
exist then it will insert data ... | salt/states/sqlite3.py | def row_present(name,
db,
table,
data,
where_sql,
where_args=None,
update=False):
'''
Checks to make sure the given row exists. If row exists and update is True
then row will be updated with data. Otherwise it wi... | def row_present(name,
db,
table,
data,
where_sql,
where_args=None,
update=False):
'''
Checks to make sure the given row exists. If row exists and update is True
then row will be updated with data. Otherwise it wi... | [
"Checks",
"to",
"make",
"sure",
"the",
"given",
"row",
"exists",
".",
"If",
"row",
"exists",
"and",
"update",
"is",
"True",
"then",
"row",
"will",
"be",
"updated",
"with",
"data",
".",
"Otherwise",
"it",
"will",
"leave",
"existing",
"row",
"unmodified",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/sqlite3.py#L194-L331 | [
"def",
"row_present",
"(",
"name",
",",
"db",
",",
"table",
",",
"data",
",",
"where_sql",
",",
"where_args",
"=",
"None",
",",
"update",
"=",
"False",
")",
":",
"changes",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'re... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | table_absent | Make sure the specified table does not exist
name
The name of the table
db
The name of the database file | salt/states/sqlite3.py | def table_absent(name, db):
'''
Make sure the specified table does not exist
name
The name of the table
db
The name of the database file
'''
changes = {'name': name,
'changes': {},
'result': None,
'comment': ''}
conn = None
t... | def table_absent(name, db):
'''
Make sure the specified table does not exist
name
The name of the table
db
The name of the database file
'''
changes = {'name': name,
'changes': {},
'result': None,
'comment': ''}
conn = None
t... | [
"Make",
"sure",
"the",
"specified",
"table",
"does",
"not",
"exist"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/sqlite3.py#L334-L380 | [
"def",
"table_absent",
"(",
"name",
",",
"db",
")",
":",
"changes",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"conn",
"=",
"None",
"try",
":",
"conn",
"=",
"s... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | table_present | Make sure the specified table exists with the specified schema
name
The name of the table
db
The name of the database file
schema
The dictionary containing the schema information
force
If the name of the table exists and force is set to False,
the state will f... | salt/states/sqlite3.py | def table_present(name, db, schema, force=False):
'''
Make sure the specified table exists with the specified schema
name
The name of the table
db
The name of the database file
schema
The dictionary containing the schema information
force
If the name of the ta... | def table_present(name, db, schema, force=False):
'''
Make sure the specified table exists with the specified schema
name
The name of the table
db
The name of the database file
schema
The dictionary containing the schema information
force
If the name of the ta... | [
"Make",
"sure",
"the",
"specified",
"table",
"exists",
"with",
"the",
"specified",
"schema"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/sqlite3.py#L383-L471 | [
"def",
"table_present",
"(",
"name",
",",
"db",
",",
"schema",
",",
"force",
"=",
"False",
")",
":",
"changes",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"conn"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | match | Matches based on range cluster | salt/matchers/range_match.py | def match(tgt, opts=None):
'''
Matches based on range cluster
'''
if not opts:
opts = __opts__
if HAS_RANGE:
range_ = seco.range.Range(opts['range_server'])
try:
return opts['grains']['fqdn'] in range_.expand(tgt)
except seco.range.RangeException as exc:
... | def match(tgt, opts=None):
'''
Matches based on range cluster
'''
if not opts:
opts = __opts__
if HAS_RANGE:
range_ = seco.range.Range(opts['range_server'])
try:
return opts['grains']['fqdn'] in range_.expand(tgt)
except seco.range.RangeException as exc:
... | [
"Matches",
"based",
"on",
"range",
"cluster"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/matchers/range_match.py#L19-L32 | [
"def",
"match",
"(",
"tgt",
",",
"opts",
"=",
"None",
")",
":",
"if",
"not",
"opts",
":",
"opts",
"=",
"__opts__",
"if",
"HAS_RANGE",
":",
"range_",
"=",
"seco",
".",
"range",
".",
"Range",
"(",
"opts",
"[",
"'range_server'",
"]",
")",
"try",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | returner | Return data to a Cassandra ColumnFamily | salt/returners/cassandra_return.py | def returner(ret):
'''
Return data to a Cassandra ColumnFamily
'''
consistency_level = getattr(pycassa.ConsistencyLevel,
__opts__['cassandra.consistency_level'])
pool = pycassa.ConnectionPool(__opts__['cassandra.keyspace'],
__opts__... | def returner(ret):
'''
Return data to a Cassandra ColumnFamily
'''
consistency_level = getattr(pycassa.ConsistencyLevel,
__opts__['cassandra.consistency_level'])
pool = pycassa.ConnectionPool(__opts__['cassandra.keyspace'],
__opts__... | [
"Return",
"data",
"to",
"a",
"Cassandra",
"ColumnFamily"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/cassandra_return.py#L54-L76 | [
"def",
"returner",
"(",
"ret",
")",
":",
"consistency_level",
"=",
"getattr",
"(",
"pycassa",
".",
"ConsistencyLevel",
",",
"__opts__",
"[",
"'cassandra.consistency_level'",
"]",
")",
"pool",
"=",
"pycassa",
".",
"ConnectionPool",
"(",
"__opts__",
"[",
"'cassand... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | prep_bootstrap | Update and get the random script to a random place
CLI Example:
.. code-block:: bash
salt '*' seed.prep_bootstrap /tmp | salt/modules/seed.py | def prep_bootstrap(mpt):
'''
Update and get the random script to a random place
CLI Example:
.. code-block:: bash
salt '*' seed.prep_bootstrap /tmp
'''
# Verify that the boostrap script is downloaded
bs_ = __salt__['config.gather_bootstrap_script']()
fpd_ = os.path.join(mpt, ... | def prep_bootstrap(mpt):
'''
Update and get the random script to a random place
CLI Example:
.. code-block:: bash
salt '*' seed.prep_bootstrap /tmp
'''
# Verify that the boostrap script is downloaded
bs_ = __salt__['config.gather_bootstrap_script']()
fpd_ = os.path.join(mpt, ... | [
"Update",
"and",
"get",
"the",
"random",
"script",
"to",
"a",
"random",
"place"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/seed.py#L39-L61 | [
"def",
"prep_bootstrap",
"(",
"mpt",
")",
":",
"# Verify that the boostrap script is downloaded",
"bs_",
"=",
"__salt__",
"[",
"'config.gather_bootstrap_script'",
"]",
"(",
")",
"fpd_",
"=",
"os",
".",
"path",
".",
"join",
"(",
"mpt",
",",
"'tmp'",
",",
"\"{0}\"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | apply_ | Seed a location (disk image, directory, or block device) with the
minion config, approve the minion's key, and/or install salt-minion.
CLI Example:
.. code-block:: bash
salt 'minion' seed.apply path id [config=config_data] \\
[gen_key=(true|false)] [approve_key=(true|false)] \\
... | salt/modules/seed.py | def apply_(path, id_=None, config=None, approve_key=True, install=True,
prep_install=False, pub_key=None, priv_key=None, mount_point=None):
'''
Seed a location (disk image, directory, or block device) with the
minion config, approve the minion's key, and/or install salt-minion.
CLI Example:
... | def apply_(path, id_=None, config=None, approve_key=True, install=True,
prep_install=False, pub_key=None, priv_key=None, mount_point=None):
'''
Seed a location (disk image, directory, or block device) with the
minion config, approve the minion's key, and/or install salt-minion.
CLI Example:
... | [
"Seed",
"a",
"location",
"(",
"disk",
"image",
"directory",
"or",
"block",
"device",
")",
"with",
"the",
"minion",
"config",
"approve",
"the",
"minion",
"s",
"key",
"and",
"/",
"or",
"install",
"salt",
"-",
"minion",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/seed.py#L94-L187 | [
"def",
"apply_",
"(",
"path",
",",
"id_",
"=",
"None",
",",
"config",
"=",
"None",
",",
"approve_key",
"=",
"True",
",",
"install",
"=",
"True",
",",
"prep_install",
"=",
"False",
",",
"pub_key",
"=",
"None",
",",
"priv_key",
"=",
"None",
",",
"mount... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | mkconfig | Generate keys and config and put them in a tmp directory.
pub_key
absolute path or file content of an optional preseeded salt key
priv_key
absolute path or file content of an optional preseeded salt key
CLI Example:
.. code-block:: bash
salt 'minion' seed.mkconfig [config=co... | salt/modules/seed.py | def mkconfig(config=None,
tmp=None,
id_=None,
approve_key=True,
pub_key=None,
priv_key=None):
'''
Generate keys and config and put them in a tmp directory.
pub_key
absolute path or file content of an optional preseeded salt key
p... | def mkconfig(config=None,
tmp=None,
id_=None,
approve_key=True,
pub_key=None,
priv_key=None):
'''
Generate keys and config and put them in a tmp directory.
pub_key
absolute path or file content of an optional preseeded salt key
p... | [
"Generate",
"keys",
"and",
"config",
"and",
"put",
"them",
"in",
"a",
"tmp",
"directory",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/seed.py#L190-L246 | [
"def",
"mkconfig",
"(",
"config",
"=",
"None",
",",
"tmp",
"=",
"None",
",",
"id_",
"=",
"None",
",",
"approve_key",
"=",
"True",
",",
"pub_key",
"=",
"None",
",",
"priv_key",
"=",
"None",
")",
":",
"if",
"tmp",
"is",
"None",
":",
"tmp",
"=",
"te... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _install | Determine whether salt-minion is installed and, if not,
install it.
Return True if install is successful or already installed. | salt/modules/seed.py | def _install(mpt):
'''
Determine whether salt-minion is installed and, if not,
install it.
Return True if install is successful or already installed.
'''
_check_resolv(mpt)
boot_, tmppath = (prep_bootstrap(mpt)
or salt.syspaths.BOOTSTRAP)
# Exec the chroot command
cmd = ... | def _install(mpt):
'''
Determine whether salt-minion is installed and, if not,
install it.
Return True if install is successful or already installed.
'''
_check_resolv(mpt)
boot_, tmppath = (prep_bootstrap(mpt)
or salt.syspaths.BOOTSTRAP)
# Exec the chroot command
cmd = ... | [
"Determine",
"whether",
"salt",
"-",
"minion",
"is",
"installed",
"and",
"if",
"not",
"install",
"it",
".",
"Return",
"True",
"if",
"install",
"is",
"successful",
"or",
"already",
"installed",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/seed.py#L249-L261 | [
"def",
"_install",
"(",
"mpt",
")",
":",
"_check_resolv",
"(",
"mpt",
")",
"boot_",
",",
"tmppath",
"=",
"(",
"prep_bootstrap",
"(",
"mpt",
")",
"or",
"salt",
".",
"syspaths",
".",
"BOOTSTRAP",
")",
"# Exec the chroot command",
"cmd",
"=",
"'if type salt-min... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _check_resolv | Check that the resolv.conf is present and populated | salt/modules/seed.py | def _check_resolv(mpt):
'''
Check that the resolv.conf is present and populated
'''
resolv = os.path.join(mpt, 'etc/resolv.conf')
replace = False
if os.path.islink(resolv):
resolv = os.path.realpath(resolv)
if not os.path.isdir(os.path.dirname(resolv)):
os.makedirs(os... | def _check_resolv(mpt):
'''
Check that the resolv.conf is present and populated
'''
resolv = os.path.join(mpt, 'etc/resolv.conf')
replace = False
if os.path.islink(resolv):
resolv = os.path.realpath(resolv)
if not os.path.isdir(os.path.dirname(resolv)):
os.makedirs(os... | [
"Check",
"that",
"the",
"resolv",
".",
"conf",
"is",
"present",
"and",
"populated"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/seed.py#L264-L284 | [
"def",
"_check_resolv",
"(",
"mpt",
")",
":",
"resolv",
"=",
"os",
".",
"path",
".",
"join",
"(",
"mpt",
",",
"'etc/resolv.conf'",
")",
"replace",
"=",
"False",
"if",
"os",
".",
"path",
".",
"islink",
"(",
"resolv",
")",
":",
"resolv",
"=",
"os",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _netsh_file | helper function to get the results of ``netsh -f content.txt``
Running ``netsh`` will drop you into a ``netsh`` prompt where you can issue
``netsh`` commands. You can put a series of commands in an external file and
run them as if from a ``netsh`` prompt using the ``-f`` switch. That's what
this functi... | salt/utils/win_lgpo_netsh.py | def _netsh_file(content):
'''
helper function to get the results of ``netsh -f content.txt``
Running ``netsh`` will drop you into a ``netsh`` prompt where you can issue
``netsh`` commands. You can put a series of commands in an external file and
run them as if from a ``netsh`` prompt using the ``-f... | def _netsh_file(content):
'''
helper function to get the results of ``netsh -f content.txt``
Running ``netsh`` will drop you into a ``netsh`` prompt where you can issue
``netsh`` commands. You can put a series of commands in an external file and
run them as if from a ``netsh`` prompt using the ``-f... | [
"helper",
"function",
"to",
"get",
"the",
"results",
"of",
"netsh",
"-",
"f",
"content",
".",
"txt"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_lgpo_netsh.py#L99-L126 | [
"def",
"_netsh_file",
"(",
"content",
")",
":",
"with",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"mode",
"=",
"'w'",
",",
"prefix",
"=",
"'salt-'",
",",
"suffix",
"=",
"'.netsh'",
",",
"delete",
"=",
"False",
")",
"as",
"fp",
":",
"fp",
".",
"write"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_settings | Get the firewall property from the specified profile in the specified store
as returned by ``netsh advfirewall``.
Args:
profile (str):
The firewall profile to query. Valid options are:
- domain
- public
- private
section (str):
The ... | salt/utils/win_lgpo_netsh.py | def get_settings(profile, section, store='local'):
'''
Get the firewall property from the specified profile in the specified store
as returned by ``netsh advfirewall``.
Args:
profile (str):
The firewall profile to query. Valid options are:
- domain
- public... | def get_settings(profile, section, store='local'):
'''
Get the firewall property from the specified profile in the specified store
as returned by ``netsh advfirewall``.
Args:
profile (str):
The firewall profile to query. Valid options are:
- domain
- public... | [
"Get",
"the",
"firewall",
"property",
"from",
"the",
"specified",
"profile",
"in",
"the",
"specified",
"store",
"as",
"returned",
"by",
"netsh",
"advfirewall",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_lgpo_netsh.py#L148-L224 | [
"def",
"get_settings",
"(",
"profile",
",",
"section",
",",
"store",
"=",
"'local'",
")",
":",
"# validate input",
"if",
"profile",
".",
"lower",
"(",
")",
"not",
"in",
"(",
"'domain'",
",",
"'public'",
",",
"'private'",
")",
":",
"raise",
"ValueError",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_all_settings | Gets all the properties for the specified profile in the specified store
Args:
profile (str):
The firewall profile to query. Valid options are:
- domain
- public
- private
store (str):
The store to use. This is either the local firewall... | salt/utils/win_lgpo_netsh.py | def get_all_settings(profile, store='local'):
'''
Gets all the properties for the specified profile in the specified store
Args:
profile (str):
The firewall profile to query. Valid options are:
- domain
- public
- private
store (str):
... | def get_all_settings(profile, store='local'):
'''
Gets all the properties for the specified profile in the specified store
Args:
profile (str):
The firewall profile to query. Valid options are:
- domain
- public
- private
store (str):
... | [
"Gets",
"all",
"the",
"properties",
"for",
"the",
"specified",
"profile",
"in",
"the",
"specified",
"store"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_lgpo_netsh.py#L227-L257 | [
"def",
"get_all_settings",
"(",
"profile",
",",
"store",
"=",
"'local'",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"ret",
".",
"update",
"(",
"get_settings",
"(",
"profile",
"=",
"profile",
",",
"section",
"=",
"'state'",
",",
"store",
"=",
"store",
")",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_all_profiles | Gets all properties for all profiles in the specified store
Args:
store (str):
The store to use. This is either the local firewall policy or the
policy defined by local group policy. Valid options are:
- lgpo
- local
Default is ``local``
R... | salt/utils/win_lgpo_netsh.py | def get_all_profiles(store='local'):
'''
Gets all properties for all profiles in the specified store
Args:
store (str):
The store to use. This is either the local firewall policy or the
policy defined by local group policy. Valid options are:
- lgpo
... | def get_all_profiles(store='local'):
'''
Gets all properties for all profiles in the specified store
Args:
store (str):
The store to use. This is either the local firewall policy or the
policy defined by local group policy. Valid options are:
- lgpo
... | [
"Gets",
"all",
"properties",
"for",
"all",
"profiles",
"in",
"the",
"specified",
"store"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_lgpo_netsh.py#L260-L282 | [
"def",
"get_all_profiles",
"(",
"store",
"=",
"'local'",
")",
":",
"return",
"{",
"'Domain Profile'",
":",
"get_all_settings",
"(",
"profile",
"=",
"'domain'",
",",
"store",
"=",
"store",
")",
",",
"'Private Profile'",
":",
"get_all_settings",
"(",
"profile",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_firewall_settings | Set the firewall inbound/outbound settings for the specified profile and
store
Args:
profile (str):
The firewall profile to configure. Valid options are:
- domain
- public
- private
inbound (str):
The inbound setting. If ``None`` is... | salt/utils/win_lgpo_netsh.py | def set_firewall_settings(profile,
inbound=None,
outbound=None,
store='local'):
'''
Set the firewall inbound/outbound settings for the specified profile and
store
Args:
profile (str):
The firewall profile... | def set_firewall_settings(profile,
inbound=None,
outbound=None,
store='local'):
'''
Set the firewall inbound/outbound settings for the specified profile and
store
Args:
profile (str):
The firewall profile... | [
"Set",
"the",
"firewall",
"inbound",
"/",
"outbound",
"settings",
"for",
"the",
"specified",
"profile",
"and",
"store"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_lgpo_netsh.py#L285-L374 | [
"def",
"set_firewall_settings",
"(",
"profile",
",",
"inbound",
"=",
"None",
",",
"outbound",
"=",
"None",
",",
"store",
"=",
"'local'",
")",
":",
"# Input validation",
"if",
"profile",
".",
"lower",
"(",
")",
"not",
"in",
"(",
"'domain'",
",",
"'public'",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_logging_settings | Configure logging settings for the Windows firewall.
Args:
profile (str):
The firewall profile to configure. Valid options are:
- domain
- public
- private
setting (str):
The logging setting to configure. Valid options are:
... | salt/utils/win_lgpo_netsh.py | def set_logging_settings(profile, setting, value, store='local'):
'''
Configure logging settings for the Windows firewall.
Args:
profile (str):
The firewall profile to configure. Valid options are:
- domain
- public
- private
setting (str):... | def set_logging_settings(profile, setting, value, store='local'):
'''
Configure logging settings for the Windows firewall.
Args:
profile (str):
The firewall profile to configure. Valid options are:
- domain
- public
- private
setting (str):... | [
"Configure",
"logging",
"settings",
"for",
"the",
"Windows",
"firewall",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_lgpo_netsh.py#L377-L470 | [
"def",
"set_logging_settings",
"(",
"profile",
",",
"setting",
",",
"value",
",",
"store",
"=",
"'local'",
")",
":",
"# Input validation",
"if",
"profile",
".",
"lower",
"(",
")",
"not",
"in",
"(",
"'domain'",
",",
"'public'",
",",
"'private'",
")",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_settings | Configure firewall settings.
Args:
profile (str):
The firewall profile to configure. Valid options are:
- domain
- public
- private
setting (str):
The firewall setting to configure. Valid options are:
- localfirewallrules
... | salt/utils/win_lgpo_netsh.py | def set_settings(profile, setting, value, store='local'):
'''
Configure firewall settings.
Args:
profile (str):
The firewall profile to configure. Valid options are:
- domain
- public
- private
setting (str):
The firewall settin... | def set_settings(profile, setting, value, store='local'):
'''
Configure firewall settings.
Args:
profile (str):
The firewall profile to configure. Valid options are:
- domain
- public
- private
setting (str):
The firewall settin... | [
"Configure",
"firewall",
"settings",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_lgpo_netsh.py#L473-L538 | [
"def",
"set_settings",
"(",
"profile",
",",
"setting",
",",
"value",
",",
"store",
"=",
"'local'",
")",
":",
"# Input validation",
"if",
"profile",
".",
"lower",
"(",
")",
"not",
"in",
"(",
"'domain'",
",",
"'public'",
",",
"'private'",
")",
":",
"raise"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_state | Configure the firewall state.
Args:
profile (str):
The firewall profile to configure. Valid options are:
- domain
- public
- private
state (str):
The firewall state. Valid options are:
- on
- off
- n... | salt/utils/win_lgpo_netsh.py | def set_state(profile, state, store='local'):
'''
Configure the firewall state.
Args:
profile (str):
The firewall profile to configure. Valid options are:
- domain
- public
- private
state (str):
The firewall state. Valid option... | def set_state(profile, state, store='local'):
'''
Configure the firewall state.
Args:
profile (str):
The firewall profile to configure. Valid options are:
- domain
- public
- private
state (str):
The firewall state. Valid option... | [
"Configure",
"the",
"firewall",
"state",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_lgpo_netsh.py#L541-L591 | [
"def",
"set_state",
"(",
"profile",
",",
"state",
",",
"store",
"=",
"'local'",
")",
":",
"# Input validation",
"if",
"profile",
".",
"lower",
"(",
")",
"not",
"in",
"(",
"'domain'",
",",
"'public'",
",",
"'private'",
")",
":",
"raise",
"ValueError",
"("... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __parse_aliases | Parse the aliases file, and return a list of line components:
[
(alias1, target1, comment1),
(alias2, target2, comment2),
] | salt/modules/aliases.py | def __parse_aliases():
'''
Parse the aliases file, and return a list of line components:
[
(alias1, target1, comment1),
(alias2, target2, comment2),
]
'''
afn = __get_aliases_filename()
ret = []
if not os.path.isfile(afn):
return ret
with salt.utils.files.fopen(a... | def __parse_aliases():
'''
Parse the aliases file, and return a list of line components:
[
(alias1, target1, comment1),
(alias2, target2, comment2),
]
'''
afn = __get_aliases_filename()
ret = []
if not os.path.isfile(afn):
return ret
with salt.utils.files.fopen(a... | [
"Parse",
"the",
"aliases",
"file",
"and",
"return",
"a",
"list",
"of",
"line",
"components",
":"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aliases.py#L40-L61 | [
"def",
"__parse_aliases",
"(",
")",
":",
"afn",
"=",
"__get_aliases_filename",
"(",
")",
"ret",
"=",
"[",
"]",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"afn",
")",
":",
"return",
"ret",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"f... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __write_aliases_file | Write a new copy of the aliases file. Lines is a list of lines
as returned by __parse_aliases. | salt/modules/aliases.py | def __write_aliases_file(lines):
'''
Write a new copy of the aliases file. Lines is a list of lines
as returned by __parse_aliases.
'''
afn = __get_aliases_filename()
adir = os.path.dirname(afn)
out = tempfile.NamedTemporaryFile(dir=adir, delete=False)
if not __opts__.get('integration... | def __write_aliases_file(lines):
'''
Write a new copy of the aliases file. Lines is a list of lines
as returned by __parse_aliases.
'''
afn = __get_aliases_filename()
adir = os.path.dirname(afn)
out = tempfile.NamedTemporaryFile(dir=adir, delete=False)
if not __opts__.get('integration... | [
"Write",
"a",
"new",
"copy",
"of",
"the",
"aliases",
"file",
".",
"Lines",
"is",
"a",
"list",
"of",
"lines",
"as",
"returned",
"by",
"__parse_aliases",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aliases.py#L64-L106 | [
"def",
"__write_aliases_file",
"(",
"lines",
")",
":",
"afn",
"=",
"__get_aliases_filename",
"(",
")",
"adir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"afn",
")",
"out",
"=",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"dir",
"=",
"adir",
",",
"dele... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_aliases | Return the aliases found in the aliases file in this format::
{'alias': 'target'}
CLI Example:
.. code-block:: bash
salt '*' aliases.list_aliases | salt/modules/aliases.py | def list_aliases():
'''
Return the aliases found in the aliases file in this format::
{'alias': 'target'}
CLI Example:
.. code-block:: bash
salt '*' aliases.list_aliases
'''
ret = dict((alias, target) for alias, target, comment in __parse_aliases() if alias)
return ret | def list_aliases():
'''
Return the aliases found in the aliases file in this format::
{'alias': 'target'}
CLI Example:
.. code-block:: bash
salt '*' aliases.list_aliases
'''
ret = dict((alias, target) for alias, target, comment in __parse_aliases() if alias)
return ret | [
"Return",
"the",
"aliases",
"found",
"in",
"the",
"aliases",
"file",
"in",
"this",
"format",
"::"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aliases.py#L109-L122 | [
"def",
"list_aliases",
"(",
")",
":",
"ret",
"=",
"dict",
"(",
"(",
"alias",
",",
"target",
")",
"for",
"alias",
",",
"target",
",",
"comment",
"in",
"__parse_aliases",
"(",
")",
"if",
"alias",
")",
"return",
"ret"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | has_target | Return true if the alias/target is set
CLI Example:
.. code-block:: bash
salt '*' aliases.has_target alias target | salt/modules/aliases.py | def has_target(alias, target):
'''
Return true if the alias/target is set
CLI Example:
.. code-block:: bash
salt '*' aliases.has_target alias target
'''
if target == '':
raise SaltInvocationError('target can not be an empty string')
aliases = list_aliases()
if alias no... | def has_target(alias, target):
'''
Return true if the alias/target is set
CLI Example:
.. code-block:: bash
salt '*' aliases.has_target alias target
'''
if target == '':
raise SaltInvocationError('target can not be an empty string')
aliases = list_aliases()
if alias no... | [
"Return",
"true",
"if",
"the",
"alias",
"/",
"target",
"is",
"set"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aliases.py#L141-L158 | [
"def",
"has_target",
"(",
"alias",
",",
"target",
")",
":",
"if",
"target",
"==",
"''",
":",
"raise",
"SaltInvocationError",
"(",
"'target can not be an empty string'",
")",
"aliases",
"=",
"list_aliases",
"(",
")",
"if",
"alias",
"not",
"in",
"aliases",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_target | Set the entry in the aliases file for the given alias, this will overwrite
any previous entry for the given alias or create a new one if it does not
exist.
CLI Example:
.. code-block:: bash
salt '*' aliases.set_target alias target | salt/modules/aliases.py | def set_target(alias, target):
'''
Set the entry in the aliases file for the given alias, this will overwrite
any previous entry for the given alias or create a new one if it does not
exist.
CLI Example:
.. code-block:: bash
salt '*' aliases.set_target alias target
'''
if ali... | def set_target(alias, target):
'''
Set the entry in the aliases file for the given alias, this will overwrite
any previous entry for the given alias or create a new one if it does not
exist.
CLI Example:
.. code-block:: bash
salt '*' aliases.set_target alias target
'''
if ali... | [
"Set",
"the",
"entry",
"in",
"the",
"aliases",
"file",
"for",
"the",
"given",
"alias",
"this",
"will",
"overwrite",
"any",
"previous",
"entry",
"for",
"the",
"given",
"alias",
"or",
"create",
"a",
"new",
"one",
"if",
"it",
"does",
"not",
"exist",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aliases.py#L161-L197 | [
"def",
"set_target",
"(",
"alias",
",",
"target",
")",
":",
"if",
"alias",
"==",
"''",
":",
"raise",
"SaltInvocationError",
"(",
"'alias can not be an empty string'",
")",
"if",
"target",
"==",
"''",
":",
"raise",
"SaltInvocationError",
"(",
"'target can not be an... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | rm_alias | Remove an entry from the aliases file
CLI Example:
.. code-block:: bash
salt '*' aliases.rm_alias alias | salt/modules/aliases.py | def rm_alias(alias):
'''
Remove an entry from the aliases file
CLI Example:
.. code-block:: bash
salt '*' aliases.rm_alias alias
'''
if not get_target(alias):
return True
lines = __parse_aliases()
out = []
for (line_alias, line_target, line_comment) in lines:
... | def rm_alias(alias):
'''
Remove an entry from the aliases file
CLI Example:
.. code-block:: bash
salt '*' aliases.rm_alias alias
'''
if not get_target(alias):
return True
lines = __parse_aliases()
out = []
for (line_alias, line_target, line_comment) in lines:
... | [
"Remove",
"an",
"entry",
"from",
"the",
"aliases",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aliases.py#L200-L220 | [
"def",
"rm_alias",
"(",
"alias",
")",
":",
"if",
"not",
"get_target",
"(",
"alias",
")",
":",
"return",
"True",
"lines",
"=",
"__parse_aliases",
"(",
")",
"out",
"=",
"[",
"]",
"for",
"(",
"line_alias",
",",
"line_target",
",",
"line_comment",
")",
"in... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ThorState.gather_cache | Gather the specified data from the minion data cache | salt/thorium/__init__.py | def gather_cache(self):
'''
Gather the specified data from the minion data cache
'''
cache = {'grains': {}, 'pillar': {}}
if self.grains or self.pillar:
if self.opts.get('minion_data_cache'):
minions = self.cache.list('minions')
if not ... | def gather_cache(self):
'''
Gather the specified data from the minion data cache
'''
cache = {'grains': {}, 'pillar': {}}
if self.grains or self.pillar:
if self.opts.get('minion_data_cache'):
minions = self.cache.list('minions')
if not ... | [
"Gather",
"the",
"specified",
"data",
"from",
"the",
"minion",
"data",
"cache"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/thorium/__init__.py#L70-L102 | [
"def",
"gather_cache",
"(",
"self",
")",
":",
"cache",
"=",
"{",
"'grains'",
":",
"{",
"}",
",",
"'pillar'",
":",
"{",
"}",
"}",
"if",
"self",
".",
"grains",
"or",
"self",
".",
"pillar",
":",
"if",
"self",
".",
"opts",
".",
"get",
"(",
"'minion_d... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ThorState.start_runtime | Start the system! | salt/thorium/__init__.py | def start_runtime(self):
'''
Start the system!
'''
while True:
try:
self.call_runtime()
except Exception:
log.error('Exception in Thorium: ', exc_info=True)
time.sleep(self.opts['thorium_interval']) | def start_runtime(self):
'''
Start the system!
'''
while True:
try:
self.call_runtime()
except Exception:
log.error('Exception in Thorium: ', exc_info=True)
time.sleep(self.opts['thorium_interval']) | [
"Start",
"the",
"system!"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/thorium/__init__.py#L104-L113 | [
"def",
"start_runtime",
"(",
"self",
")",
":",
"while",
"True",
":",
"try",
":",
"self",
".",
"call_runtime",
"(",
")",
"except",
"Exception",
":",
"log",
".",
"error",
"(",
"'Exception in Thorium: '",
",",
"exc_info",
"=",
"True",
")",
"time",
".",
"sle... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ThorState.get_chunks | Compile the top file and return the lowstate for the thorium runtime
to iterate over | salt/thorium/__init__.py | def get_chunks(self, exclude=None, whitelist=None):
'''
Compile the top file and return the lowstate for the thorium runtime
to iterate over
'''
ret = {}
err = []
try:
top = self.get_top()
except SaltRenderError as err:
return ret
... | def get_chunks(self, exclude=None, whitelist=None):
'''
Compile the top file and return the lowstate for the thorium runtime
to iterate over
'''
ret = {}
err = []
try:
top = self.get_top()
except SaltRenderError as err:
return ret
... | [
"Compile",
"the",
"top",
"file",
"and",
"return",
"the",
"lowstate",
"for",
"the",
"thorium",
"runtime",
"to",
"iterate",
"over"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/thorium/__init__.py#L115-L150 | [
"def",
"get_chunks",
"(",
"self",
",",
"exclude",
"=",
"None",
",",
"whitelist",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"err",
"=",
"[",
"]",
"try",
":",
"top",
"=",
"self",
".",
"get_top",
"(",
")",
"except",
"SaltRenderError",
"as",
"err",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ThorState.get_events | iterate over the available events and return a list of events | salt/thorium/__init__.py | def get_events(self):
'''
iterate over the available events and return a list of events
'''
ret = []
while True:
event = self.event.get_event(wait=1, full=True)
if event is None:
return ret
ret.append(event) | def get_events(self):
'''
iterate over the available events and return a list of events
'''
ret = []
while True:
event = self.event.get_event(wait=1, full=True)
if event is None:
return ret
ret.append(event) | [
"iterate",
"over",
"the",
"available",
"events",
"and",
"return",
"a",
"list",
"of",
"events"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/thorium/__init__.py#L152-L161 | [
"def",
"get_events",
"(",
"self",
")",
":",
"ret",
"=",
"[",
"]",
"while",
"True",
":",
"event",
"=",
"self",
".",
"event",
".",
"get_event",
"(",
"wait",
"=",
"1",
",",
"full",
"=",
"True",
")",
"if",
"event",
"is",
"None",
":",
"return",
"ret",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ThorState.call_runtime | Execute the runtime | salt/thorium/__init__.py | def call_runtime(self):
'''
Execute the runtime
'''
cache = self.gather_cache()
chunks = self.get_chunks()
interval = self.opts['thorium_interval']
recompile = self.opts.get('thorium_recompile', 300)
r_start = time.time()
while True:
ev... | def call_runtime(self):
'''
Execute the runtime
'''
cache = self.gather_cache()
chunks = self.get_chunks()
interval = self.opts['thorium_interval']
recompile = self.opts.get('thorium_recompile', 300)
r_start = time.time()
while True:
ev... | [
"Execute",
"the",
"runtime"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/thorium/__init__.py#L163-L190 | [
"def",
"call_runtime",
"(",
"self",
")",
":",
"cache",
"=",
"self",
".",
"gather_cache",
"(",
")",
"chunks",
"=",
"self",
".",
"get_chunks",
"(",
")",
"interval",
"=",
"self",
".",
"opts",
"[",
"'thorium_interval'",
"]",
"recompile",
"=",
"self",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _validate | Decorator for common function argument validation | salt/modules/container_resource.py | def _validate(wrapped):
'''
Decorator for common function argument validation
'''
@functools.wraps(wrapped)
def wrapper(*args, **kwargs):
container_type = kwargs.get('container_type')
exec_driver = kwargs.get('exec_driver')
valid_driver = {
'docker': ('lxc-attach'... | def _validate(wrapped):
'''
Decorator for common function argument validation
'''
@functools.wraps(wrapped)
def wrapper(*args, **kwargs):
container_type = kwargs.get('container_type')
exec_driver = kwargs.get('exec_driver')
valid_driver = {
'docker': ('lxc-attach'... | [
"Decorator",
"for",
"common",
"function",
"argument",
"validation"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/container_resource.py#L35-L64 | [
"def",
"_validate",
"(",
"wrapped",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"wrapped",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"container_type",
"=",
"kwargs",
".",
"get",
"(",
"'container_type'",
")",
"exec_d... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | cache_file | Wrapper for cp.cache_file which raises an error if the file was unable to
be cached.
CLI Example:
.. code-block:: bash
salt myminion container_resource.cache_file salt://foo/bar/baz.txt | salt/modules/container_resource.py | def cache_file(source):
'''
Wrapper for cp.cache_file which raises an error if the file was unable to
be cached.
CLI Example:
.. code-block:: bash
salt myminion container_resource.cache_file salt://foo/bar/baz.txt
'''
try:
# Don't just use cp.cache_file for this. Docker ha... | def cache_file(source):
'''
Wrapper for cp.cache_file which raises an error if the file was unable to
be cached.
CLI Example:
.. code-block:: bash
salt myminion container_resource.cache_file salt://foo/bar/baz.txt
'''
try:
# Don't just use cp.cache_file for this. Docker ha... | [
"Wrapper",
"for",
"cp",
".",
"cache_file",
"which",
"raises",
"an",
"error",
"if",
"the",
"file",
"was",
"unable",
"to",
"be",
"cached",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/container_resource.py#L91-L114 | [
"def",
"cache_file",
"(",
"source",
")",
":",
"try",
":",
"# Don't just use cp.cache_file for this. Docker has its own code to",
"# pull down images from the web.",
"if",
"source",
".",
"startswith",
"(",
"'salt://'",
")",
":",
"cached_source",
"=",
"__salt__",
"[",
"'cp.... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | run | Common logic for running shell commands in containers
path
path to the container parent (for LXC only)
default: /var/lib/lxc (system default)
CLI Example:
.. code-block:: bash
salt myminion container_resource.run mycontainer 'ps aux' container_type=docker exec_driver=nsenter outp... | salt/modules/container_resource.py | def run(name,
cmd,
container_type=None,
exec_driver=None,
output=None,
no_start=False,
stdin=None,
python_shell=True,
output_loglevel='debug',
ignore_retcode=False,
path=None,
use_vt=False,
keep_env=None):
'''
Common... | def run(name,
cmd,
container_type=None,
exec_driver=None,
output=None,
no_start=False,
stdin=None,
python_shell=True,
output_loglevel='debug',
ignore_retcode=False,
path=None,
use_vt=False,
keep_env=None):
'''
Common... | [
"Common",
"logic",
"for",
"running",
"shell",
"commands",
"in",
"containers"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/container_resource.py#L118-L266 | [
"def",
"run",
"(",
"name",
",",
"cmd",
",",
"container_type",
"=",
"None",
",",
"exec_driver",
"=",
"None",
",",
"output",
"=",
"None",
",",
"no_start",
"=",
"False",
",",
"stdin",
"=",
"None",
",",
"python_shell",
"=",
"True",
",",
"output_loglevel",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | copy_to | Common logic for copying files to containers
path
path to the container parent (for LXC only)
default: /var/lib/lxc (system default)
CLI Example:
.. code-block:: bash
salt myminion container_resource.copy_to mycontainer /local/file/path /container/file/path container_type=docker ... | salt/modules/container_resource.py | def copy_to(name,
source,
dest,
container_type=None,
path=None,
exec_driver=None,
overwrite=False,
makedirs=False):
'''
Common logic for copying files to containers
path
path to the container parent (for LXC only)
... | def copy_to(name,
source,
dest,
container_type=None,
path=None,
exec_driver=None,
overwrite=False,
makedirs=False):
'''
Common logic for copying files to containers
path
path to the container parent (for LXC only)
... | [
"Common",
"logic",
"for",
"copying",
"files",
"to",
"containers"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/container_resource.py#L270-L404 | [
"def",
"copy_to",
"(",
"name",
",",
"source",
",",
"dest",
",",
"container_type",
"=",
"None",
",",
"path",
"=",
"None",
",",
"exec_driver",
"=",
"None",
",",
"overwrite",
"=",
"False",
",",
"makedirs",
"=",
"False",
")",
":",
"# Get the appropriate functi... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | execute | Directly calls the given function with arguments | salt/executors/docker.py | def execute(opts, data, func, args, kwargs):
'''
Directly calls the given function with arguments
'''
if data['fun'] == 'saltutil.find_job':
return __executors__['direct_call.execute'](opts, data, func, args, kwargs)
if data['fun'] in DOCKER_MOD_MAP:
return __executors__['direct_call... | def execute(opts, data, func, args, kwargs):
'''
Directly calls the given function with arguments
'''
if data['fun'] == 'saltutil.find_job':
return __executors__['direct_call.execute'](opts, data, func, args, kwargs)
if data['fun'] in DOCKER_MOD_MAP:
return __executors__['direct_call... | [
"Directly",
"calls",
"the",
"given",
"function",
"with",
"arguments"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/executors/docker.py#L28-L36 | [
"def",
"execute",
"(",
"opts",
",",
"data",
",",
"func",
",",
"args",
",",
"kwargs",
")",
":",
"if",
"data",
"[",
"'fun'",
"]",
"==",
"'saltutil.find_job'",
":",
"return",
"__executors__",
"[",
"'direct_call.execute'",
"]",
"(",
"opts",
",",
"data",
",",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltCMD.run | Execute the salt command line | salt/cli/salt.py | def run(self):
'''
Execute the salt command line
'''
import salt.client
self.parse_args()
if self.config['log_level'] not in ('quiet', ):
# Setup file logging!
self.setup_logfile_logger()
verify_log(self.config)
try:
... | def run(self):
'''
Execute the salt command line
'''
import salt.client
self.parse_args()
if self.config['log_level'] not in ('quiet', ):
# Setup file logging!
self.setup_logfile_logger()
verify_log(self.config)
try:
... | [
"Execute",
"the",
"salt",
"command",
"line"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/salt.py#L36-L224 | [
"def",
"run",
"(",
"self",
")",
":",
"import",
"salt",
".",
"client",
"self",
".",
"parse_args",
"(",
")",
"if",
"self",
".",
"config",
"[",
"'log_level'",
"]",
"not",
"in",
"(",
"'quiet'",
",",
")",
":",
"# Setup file logging!",
"self",
".",
"setup_lo... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltCMD._print_returns_summary | Display returns summary | salt/cli/salt.py | def _print_returns_summary(self, ret):
'''
Display returns summary
'''
return_counter = 0
not_return_counter = 0
not_return_minions = []
not_response_minions = []
not_connected_minions = []
failed_minions = []
for each_minion in ret:
... | def _print_returns_summary(self, ret):
'''
Display returns summary
'''
return_counter = 0
not_return_counter = 0
not_return_minions = []
not_response_minions = []
not_connected_minions = []
failed_minions = []
for each_minion in ret:
... | [
"Display",
"returns",
"summary"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/salt.py#L301-L344 | [
"def",
"_print_returns_summary",
"(",
"self",
",",
"ret",
")",
":",
"return_counter",
"=",
"0",
"not_return_counter",
"=",
"0",
"not_return_minions",
"=",
"[",
"]",
"not_response_minions",
"=",
"[",
"]",
"not_connected_minions",
"=",
"[",
"]",
"failed_minions",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltCMD._progress_ret | Print progress events | salt/cli/salt.py | def _progress_ret(self, progress, out):
'''
Print progress events
'''
import salt.output
# Get the progress bar
if not hasattr(self, 'progress_bar'):
try:
self.progress_bar = salt.output.get_progress(self.config, out, progress)
exce... | def _progress_ret(self, progress, out):
'''
Print progress events
'''
import salt.output
# Get the progress bar
if not hasattr(self, 'progress_bar'):
try:
self.progress_bar = salt.output.get_progress(self.config, out, progress)
exce... | [
"Print",
"progress",
"events"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/salt.py#L350-L362 | [
"def",
"_progress_ret",
"(",
"self",
",",
"progress",
",",
"out",
")",
":",
"import",
"salt",
".",
"output",
"# Get the progress bar",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'progress_bar'",
")",
":",
"try",
":",
"self",
".",
"progress_bar",
"=",
"salt... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltCMD._output_ret | Print the output from a single return to the terminal | salt/cli/salt.py | def _output_ret(self, ret, out, retcode=0):
'''
Print the output from a single return to the terminal
'''
import salt.output
# Handle special case commands
if self.config['fun'] == 'sys.doc' and not isinstance(ret, Exception):
self._print_docs(ret)
els... | def _output_ret(self, ret, out, retcode=0):
'''
Print the output from a single return to the terminal
'''
import salt.output
# Handle special case commands
if self.config['fun'] == 'sys.doc' and not isinstance(ret, Exception):
self._print_docs(ret)
els... | [
"Print",
"the",
"output",
"from",
"a",
"single",
"return",
"to",
"the",
"terminal"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/salt.py#L364-L380 | [
"def",
"_output_ret",
"(",
"self",
",",
"ret",
",",
"out",
",",
"retcode",
"=",
"0",
")",
":",
"import",
"salt",
".",
"output",
"# Handle special case commands",
"if",
"self",
".",
"config",
"[",
"'fun'",
"]",
"==",
"'sys.doc'",
"and",
"not",
"isinstance",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltCMD._format_ret | Take the full return data and format it to simple output | salt/cli/salt.py | def _format_ret(self, full_ret):
'''
Take the full return data and format it to simple output
'''
ret = {}
out = ''
retcode = 0
for key, data in six.iteritems(full_ret):
ret[key] = data['ret']
if 'out' in data:
out = data['o... | def _format_ret(self, full_ret):
'''
Take the full return data and format it to simple output
'''
ret = {}
out = ''
retcode = 0
for key, data in six.iteritems(full_ret):
ret[key] = data['ret']
if 'out' in data:
out = data['o... | [
"Take",
"the",
"full",
"return",
"data",
"and",
"format",
"it",
"to",
"simple",
"output"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/salt.py#L382-L396 | [
"def",
"_format_ret",
"(",
"self",
",",
"full_ret",
")",
":",
"ret",
"=",
"{",
"}",
"out",
"=",
"''",
"retcode",
"=",
"0",
"for",
"key",
",",
"data",
"in",
"six",
".",
"iteritems",
"(",
"full_ret",
")",
":",
"ret",
"[",
"key",
"]",
"=",
"data",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltCMD._get_retcode | Determine a retcode for a given return | salt/cli/salt.py | def _get_retcode(self, ret):
'''
Determine a retcode for a given return
'''
retcode = 0
# if there is a dict with retcode, use that
if isinstance(ret, dict) and ret.get('retcode', 0) != 0:
if isinstance(ret.get('retcode', 0), dict):
return max(... | def _get_retcode(self, ret):
'''
Determine a retcode for a given return
'''
retcode = 0
# if there is a dict with retcode, use that
if isinstance(ret, dict) and ret.get('retcode', 0) != 0:
if isinstance(ret.get('retcode', 0), dict):
return max(... | [
"Determine",
"a",
"retcode",
"for",
"a",
"given",
"return"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/salt.py#L398-L411 | [
"def",
"_get_retcode",
"(",
"self",
",",
"ret",
")",
":",
"retcode",
"=",
"0",
"# if there is a dict with retcode, use that",
"if",
"isinstance",
"(",
"ret",
",",
"dict",
")",
"and",
"ret",
".",
"get",
"(",
"'retcode'",
",",
"0",
")",
"!=",
"0",
":",
"if... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltCMD._print_docs | Print out the docstrings for all of the functions on the minions | salt/cli/salt.py | def _print_docs(self, ret):
'''
Print out the docstrings for all of the functions on the minions
'''
import salt.output
docs = {}
if not ret:
self.exit(2, 'No minions found to gather docs from\n')
if isinstance(ret, six.string_types):
self.... | def _print_docs(self, ret):
'''
Print out the docstrings for all of the functions on the minions
'''
import salt.output
docs = {}
if not ret:
self.exit(2, 'No minions found to gather docs from\n')
if isinstance(ret, six.string_types):
self.... | [
"Print",
"out",
"the",
"docstrings",
"for",
"all",
"of",
"the",
"functions",
"on",
"the",
"minions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/salt.py#L418-L443 | [
"def",
"_print_docs",
"(",
"self",
",",
"ret",
")",
":",
"import",
"salt",
".",
"output",
"docs",
"=",
"{",
"}",
"if",
"not",
"ret",
":",
"self",
".",
"exit",
"(",
"2",
",",
"'No minions found to gather docs from\\n'",
")",
"if",
"isinstance",
"(",
"ret"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | yaml_dquote | Make text into a double-quoted YAML string with correct escaping
for special characters. Includes the opening and closing double
quote characters. | salt/utils/yamlencoding.py | def yaml_dquote(text):
'''
Make text into a double-quoted YAML string with correct escaping
for special characters. Includes the opening and closing double
quote characters.
'''
with io.StringIO() as ostream:
yemitter = yaml.emitter.Emitter(ostream, width=six.MAXSIZE)
yemitter.w... | def yaml_dquote(text):
'''
Make text into a double-quoted YAML string with correct escaping
for special characters. Includes the opening and closing double
quote characters.
'''
with io.StringIO() as ostream:
yemitter = yaml.emitter.Emitter(ostream, width=six.MAXSIZE)
yemitter.w... | [
"Make",
"text",
"into",
"a",
"double",
"-",
"quoted",
"YAML",
"string",
"with",
"correct",
"escaping",
"for",
"special",
"characters",
".",
"Includes",
"the",
"opening",
"and",
"closing",
"double",
"quote",
"characters",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/yamlencoding.py#L19-L28 | [
"def",
"yaml_dquote",
"(",
"text",
")",
":",
"with",
"io",
".",
"StringIO",
"(",
")",
"as",
"ostream",
":",
"yemitter",
"=",
"yaml",
".",
"emitter",
".",
"Emitter",
"(",
"ostream",
",",
"width",
"=",
"six",
".",
"MAXSIZE",
")",
"yemitter",
".",
"writ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | yaml_squote | Make text into a single-quoted YAML string with correct escaping
for special characters. Includes the opening and closing single
quote characters. | salt/utils/yamlencoding.py | def yaml_squote(text):
'''
Make text into a single-quoted YAML string with correct escaping
for special characters. Includes the opening and closing single
quote characters.
'''
with io.StringIO() as ostream:
yemitter = yaml.emitter.Emitter(ostream, width=six.MAXSIZE)
yemitter.w... | def yaml_squote(text):
'''
Make text into a single-quoted YAML string with correct escaping
for special characters. Includes the opening and closing single
quote characters.
'''
with io.StringIO() as ostream:
yemitter = yaml.emitter.Emitter(ostream, width=six.MAXSIZE)
yemitter.w... | [
"Make",
"text",
"into",
"a",
"single",
"-",
"quoted",
"YAML",
"string",
"with",
"correct",
"escaping",
"for",
"special",
"characters",
".",
"Includes",
"the",
"opening",
"and",
"closing",
"single",
"quote",
"characters",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/yamlencoding.py#L32-L41 | [
"def",
"yaml_squote",
"(",
"text",
")",
":",
"with",
"io",
".",
"StringIO",
"(",
")",
"as",
"ostream",
":",
"yemitter",
"=",
"yaml",
".",
"emitter",
".",
"Emitter",
"(",
"ostream",
",",
"width",
"=",
"six",
".",
"MAXSIZE",
")",
"yemitter",
".",
"writ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | yaml_encode | A simple YAML encode that can take a single-element datatype and return
a string representation. | salt/utils/yamlencoding.py | def yaml_encode(data):
'''
A simple YAML encode that can take a single-element datatype and return
a string representation.
'''
yrepr = yaml.representer.SafeRepresenter()
ynode = yrepr.represent_data(data)
if not isinstance(ynode, yaml.ScalarNode):
raise TypeError(
"yaml_... | def yaml_encode(data):
'''
A simple YAML encode that can take a single-element datatype and return
a string representation.
'''
yrepr = yaml.representer.SafeRepresenter()
ynode = yrepr.represent_data(data)
if not isinstance(ynode, yaml.ScalarNode):
raise TypeError(
"yaml_... | [
"A",
"simple",
"YAML",
"encode",
"that",
"can",
"take",
"a",
"single",
"-",
"element",
"datatype",
"and",
"return",
"a",
"string",
"representation",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/yamlencoding.py#L45-L64 | [
"def",
"yaml_encode",
"(",
"data",
")",
":",
"yrepr",
"=",
"yaml",
".",
"representer",
".",
"SafeRepresenter",
"(",
")",
"ynode",
"=",
"yrepr",
".",
"represent_data",
"(",
"data",
")",
"if",
"not",
"isinstance",
"(",
"ynode",
",",
"yaml",
".",
"ScalarNod... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _decrypt_object | Recursively try to decrypt any object. If the object is a six.string_types
(string or unicode), and it contains a valid NACLENC pretext, decrypt it,
otherwise keep going until a string is found. | salt/renderers/nacl.py | def _decrypt_object(obj, **kwargs):
'''
Recursively try to decrypt any object. If the object is a six.string_types
(string or unicode), and it contains a valid NACLENC pretext, decrypt it,
otherwise keep going until a string is found.
'''
if salt.utils.stringio.is_readable(obj):
return _... | def _decrypt_object(obj, **kwargs):
'''
Recursively try to decrypt any object. If the object is a six.string_types
(string or unicode), and it contains a valid NACLENC pretext, decrypt it,
otherwise keep going until a string is found.
'''
if salt.utils.stringio.is_readable(obj):
return _... | [
"Recursively",
"try",
"to",
"decrypt",
"any",
"object",
".",
"If",
"the",
"object",
"is",
"a",
"six",
".",
"string_types",
"(",
"string",
"or",
"unicode",
")",
"and",
"it",
"contains",
"a",
"valid",
"NACLENC",
"pretext",
"decrypt",
"it",
"otherwise",
"keep... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/nacl.py#L71-L93 | [
"def",
"_decrypt_object",
"(",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"salt",
".",
"utils",
".",
"stringio",
".",
"is_readable",
"(",
"obj",
")",
":",
"return",
"_decrypt_object",
"(",
"obj",
".",
"getvalue",
"(",
")",
",",
"*",
"*",
"kwargs... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ext_pillar | Execute queries against MySQL, merge and return as a dict | salt/pillar/mysql.py | def ext_pillar(minion_id,
pillar,
*args,
**kwargs):
'''
Execute queries against MySQL, merge and return as a dict
'''
return MySQLExtPillar().fetch(minion_id, pillar, *args, **kwargs) | def ext_pillar(minion_id,
pillar,
*args,
**kwargs):
'''
Execute queries against MySQL, merge and return as a dict
'''
return MySQLExtPillar().fetch(minion_id, pillar, *args, **kwargs) | [
"Execute",
"queries",
"against",
"MySQL",
"merge",
"and",
"return",
"as",
"a",
"dict"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/mysql.py#L140-L147 | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"pillar",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"MySQLExtPillar",
"(",
")",
".",
"fetch",
"(",
"minion_id",
",",
"pillar",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | MySQLExtPillar._get_options | Returns options used for the MySQL connection. | salt/pillar/mysql.py | def _get_options(self):
'''
Returns options used for the MySQL connection.
'''
defaults = {'host': 'localhost',
'user': 'salt',
'pass': 'salt',
'db': 'salt',
'port': 3306,
'ssl': {}}
... | def _get_options(self):
'''
Returns options used for the MySQL connection.
'''
defaults = {'host': 'localhost',
'user': 'salt',
'pass': 'salt',
'db': 'salt',
'port': 3306,
'ssl': {}}
... | [
"Returns",
"options",
"used",
"for",
"the",
"MySQL",
"connection",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/mysql.py#L93-L111 | [
"def",
"_get_options",
"(",
"self",
")",
":",
"defaults",
"=",
"{",
"'host'",
":",
"'localhost'",
",",
"'user'",
":",
"'salt'",
",",
"'pass'",
":",
"'salt'",
",",
"'db'",
":",
"'salt'",
",",
"'port'",
":",
"3306",
",",
"'ssl'",
":",
"{",
"}",
"}",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | MySQLExtPillar._get_cursor | Yield a MySQL cursor | salt/pillar/mysql.py | def _get_cursor(self):
'''
Yield a MySQL cursor
'''
_options = self._get_options()
conn = MySQLdb.connect(host=_options['host'],
user=_options['user'],
passwd=_options['pass'],
db=_option... | def _get_cursor(self):
'''
Yield a MySQL cursor
'''
_options = self._get_options()
conn = MySQLdb.connect(host=_options['host'],
user=_options['user'],
passwd=_options['pass'],
db=_option... | [
"Yield",
"a",
"MySQL",
"cursor"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/mysql.py#L114-L130 | [
"def",
"_get_cursor",
"(",
"self",
")",
":",
"_options",
"=",
"self",
".",
"_get_options",
"(",
")",
"conn",
"=",
"MySQLdb",
".",
"connect",
"(",
"host",
"=",
"_options",
"[",
"'host'",
"]",
",",
"user",
"=",
"_options",
"[",
"'user'",
"]",
",",
"pas... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | MySQLExtPillar.extract_queries | This function normalizes the config block into a set of queries we
can use. The return is a list of consistently laid out dicts. | salt/pillar/mysql.py | def extract_queries(self, args, kwargs):
'''
This function normalizes the config block into a set of queries we
can use. The return is a list of consistently laid out dicts.
'''
return super(MySQLExtPillar, self).extract_queries(args, kwargs) | def extract_queries(self, args, kwargs):
'''
This function normalizes the config block into a set of queries we
can use. The return is a list of consistently laid out dicts.
'''
return super(MySQLExtPillar, self).extract_queries(args, kwargs) | [
"This",
"function",
"normalizes",
"the",
"config",
"block",
"into",
"a",
"set",
"of",
"queries",
"we",
"can",
"use",
".",
"The",
"return",
"is",
"a",
"list",
"of",
"consistently",
"laid",
"out",
"dicts",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/mysql.py#L132-L137 | [
"def",
"extract_queries",
"(",
"self",
",",
"args",
",",
"kwargs",
")",
":",
"return",
"super",
"(",
"MySQLExtPillar",
",",
"self",
")",
".",
"extract_queries",
"(",
"args",
",",
"kwargs",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | merge | Retrieves an option based on key, merging all matches.
Same as ``option()`` except that it merges all matches, rather than taking
the first match.
CLI Example:
.. code-block:: bash
salt '*' config.merge schedule | salt/client/ssh/wrapper/config.py | def merge(value,
default='',
omit_opts=False,
omit_master=False,
omit_pillar=False):
'''
Retrieves an option based on key, merging all matches.
Same as ``option()`` except that it merges all matches, rather than taking
the first match.
CLI Example:
.. c... | def merge(value,
default='',
omit_opts=False,
omit_master=False,
omit_pillar=False):
'''
Retrieves an option based on key, merging all matches.
Same as ``option()`` except that it merges all matches, rather than taking
the first match.
CLI Example:
.. c... | [
"Retrieves",
"an",
"option",
"based",
"on",
"key",
"merging",
"all",
"matches",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/config.py#L134-L185 | [
"def",
"merge",
"(",
"value",
",",
"default",
"=",
"''",
",",
"omit_opts",
"=",
"False",
",",
"omit_master",
"=",
"False",
",",
"omit_pillar",
"=",
"False",
")",
":",
"ret",
"=",
"None",
"if",
"not",
"omit_opts",
":",
"if",
"value",
"in",
"__opts__",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get | .. versionadded: 0.14.0
Attempt to retrieve the named value from opts, pillar, grains of the master
config, if the named value is not available return the passed default.
The default return is an empty string.
The value can also represent a value in a nested dict using a ":" delimiter
for the dict... | salt/client/ssh/wrapper/config.py | def get(key, default=''):
'''
.. versionadded: 0.14.0
Attempt to retrieve the named value from opts, pillar, grains of the master
config, if the named value is not available return the passed default.
The default return is an empty string.
The value can also represent a value in a nested dict ... | def get(key, default=''):
'''
.. versionadded: 0.14.0
Attempt to retrieve the named value from opts, pillar, grains of the master
config, if the named value is not available return the passed default.
The default return is an empty string.
The value can also represent a value in a nested dict ... | [
"..",
"versionadded",
":",
"0",
".",
"14",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/config.py#L188-L231 | [
"def",
"get",
"(",
"key",
",",
"default",
"=",
"''",
")",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"data",
".",
"traverse_dict_and_list",
"(",
"__opts__",
",",
"key",
",",
"'_|-'",
")",
"if",
"ret",
"!=",
"'_|-'",
":",
"return",
"ret",
"ret",
"=... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | present | Creates Zabbix Action object or if differs update it according defined parameters
:param name: Zabbix Action name
:param params: Definition of the Zabbix Action
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optio... | salt/states/zabbix_action.py | def present(name, params, **kwargs):
'''
Creates Zabbix Action object or if differs update it according defined parameters
:param name: Zabbix Action name
:param params: Definition of the Zabbix Action
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's ... | def present(name, params, **kwargs):
'''
Creates Zabbix Action object or if differs update it according defined parameters
:param name: Zabbix Action name
:param params: Definition of the Zabbix Action
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's ... | [
"Creates",
"Zabbix",
"Action",
"object",
"or",
"if",
"differs",
"update",
"it",
"according",
"defined",
"parameters"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_action.py#L35-L151 | [
"def",
"present",
"(",
"name",
",",
"params",
",",
"*",
"*",
"kwargs",
")",
":",
"zabbix_id_mapper",
"=",
"__salt__",
"[",
"'zabbix.get_zabbix_id_mapper'",
"]",
"(",
")",
"dry_run",
"=",
"__opts__",
"[",
"'test'",
"]",
"ret",
"=",
"{",
"'name'",
":",
"na... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | available | Return True if the named service is available.
CLI Example:
.. code-block:: bash
salt '*' service.available sshd | salt/modules/openbsdrcctl_service.py | def available(name):
'''
Return True if the named service is available.
CLI Example:
.. code-block:: bash
salt '*' service.available sshd
'''
cmd = '{0} get {1}'.format(_cmd(), name)
if __salt__['cmd.retcode'](cmd) == 2:
return False
return True | def available(name):
'''
Return True if the named service is available.
CLI Example:
.. code-block:: bash
salt '*' service.available sshd
'''
cmd = '{0} get {1}'.format(_cmd(), name)
if __salt__['cmd.retcode'](cmd) == 2:
return False
return True | [
"Return",
"True",
"if",
"the",
"named",
"service",
"is",
"available",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdrcctl_service.py#L54-L67 | [
"def",
"available",
"(",
"name",
")",
":",
"cmd",
"=",
"'{0} get {1}'",
".",
"format",
"(",
"_cmd",
"(",
")",
",",
"name",
")",
"if",
"__salt__",
"[",
"'cmd.retcode'",
"]",
"(",
"cmd",
")",
"==",
"2",
":",
"return",
"False",
"return",
"True"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_all | Return all installed services.
CLI Example:
.. code-block:: bash
salt '*' service.get_all | salt/modules/openbsdrcctl_service.py | def get_all():
'''
Return all installed services.
CLI Example:
.. code-block:: bash
salt '*' service.get_all
'''
ret = []
service = _cmd()
for svc in __salt__['cmd.run']('{0} ls all'.format(service)).splitlines():
ret.append(svc)
return sorted(ret) | def get_all():
'''
Return all installed services.
CLI Example:
.. code-block:: bash
salt '*' service.get_all
'''
ret = []
service = _cmd()
for svc in __salt__['cmd.run']('{0} ls all'.format(service)).splitlines():
ret.append(svc)
return sorted(ret) | [
"Return",
"all",
"installed",
"services",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdrcctl_service.py#L84-L98 | [
"def",
"get_all",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"service",
"=",
"_cmd",
"(",
")",
"for",
"svc",
"in",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'{0} ls all'",
".",
"format",
"(",
"service",
")",
")",
".",
"splitlines",
"(",
")",
":",
"ret",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | status | Return the status for a service, returns a bool whether the service is
running.
CLI Example:
.. code-block:: bash
salt '*' service.status <service name> | salt/modules/openbsdrcctl_service.py | def status(name, sig=None):
'''
Return the status for a service, returns a bool whether the service is
running.
CLI Example:
.. code-block:: bash
salt '*' service.status <service name>
'''
if sig:
return bool(__salt__['status.pid'](sig))
cmd = '{0} check {1}'.format(_... | def status(name, sig=None):
'''
Return the status for a service, returns a bool whether the service is
running.
CLI Example:
.. code-block:: bash
salt '*' service.status <service name>
'''
if sig:
return bool(__salt__['status.pid'](sig))
cmd = '{0} check {1}'.format(_... | [
"Return",
"the",
"status",
"for",
"a",
"service",
"returns",
"a",
"bool",
"whether",
"the",
"service",
"is",
"running",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdrcctl_service.py#L191-L206 | [
"def",
"status",
"(",
"name",
",",
"sig",
"=",
"None",
")",
":",
"if",
"sig",
":",
"return",
"bool",
"(",
"__salt__",
"[",
"'status.pid'",
"]",
"(",
"sig",
")",
")",
"cmd",
"=",
"'{0} check {1}'",
".",
"format",
"(",
"_cmd",
"(",
")",
",",
"name",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | enable | Enable the named service to start at boot.
flags : None
Set optional flags to run the service with.
service.flags can be used to change the default flags.
CLI Example:
.. code-block:: bash
salt '*' service.enable <service name>
salt '*' service.enable <service name> flags=<f... | salt/modules/openbsdrcctl_service.py | def enable(name, **kwargs):
'''
Enable the named service to start at boot.
flags : None
Set optional flags to run the service with.
service.flags can be used to change the default flags.
CLI Example:
.. code-block:: bash
salt '*' service.enable <service name>
salt '*... | def enable(name, **kwargs):
'''
Enable the named service to start at boot.
flags : None
Set optional flags to run the service with.
service.flags can be used to change the default flags.
CLI Example:
.. code-block:: bash
salt '*' service.enable <service name>
salt '*... | [
"Enable",
"the",
"named",
"service",
"to",
"start",
"at",
"boot",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdrcctl_service.py#L209-L235 | [
"def",
"enable",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"stat_cmd",
"=",
"'{0} set {1} status on'",
".",
"format",
"(",
"_cmd",
"(",
")",
",",
"name",
")",
"stat_retcode",
"=",
"__salt__",
"[",
"'cmd.retcode'",
"]",
"(",
"stat_cmd",
")",
"flag_r... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | enabled | Return True if the named service is enabled at boot and the provided
flags match the configured ones (if any). Return False otherwise.
name
Service name
CLI Example:
.. code-block:: bash
salt '*' service.enabled <service name>
salt '*' service.enabled <service name> flags=<fl... | salt/modules/openbsdrcctl_service.py | def enabled(name, **kwargs):
'''
Return True if the named service is enabled at boot and the provided
flags match the configured ones (if any). Return False otherwise.
name
Service name
CLI Example:
.. code-block:: bash
salt '*' service.enabled <service name>
salt '*'... | def enabled(name, **kwargs):
'''
Return True if the named service is enabled at boot and the provided
flags match the configured ones (if any). Return False otherwise.
name
Service name
CLI Example:
.. code-block:: bash
salt '*' service.enabled <service name>
salt '*'... | [
"Return",
"True",
"if",
"the",
"named",
"service",
"is",
"enabled",
"at",
"boot",
"and",
"the",
"provided",
"flags",
"match",
"the",
"configured",
"ones",
"(",
"if",
"any",
")",
".",
"Return",
"False",
"otherwise",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdrcctl_service.py#L266-L294 | [
"def",
"enabled",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"cmd",
"=",
"'{0} get {1} status'",
".",
"format",
"(",
"_cmd",
"(",
")",
",",
"name",
")",
"if",
"not",
"__salt__",
"[",
"'cmd.retcode'",
"]",
"(",
"cmd",
")",
":",
"# also consider a s... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _expand_users | Creates a longer list of accepted users on the device. | salt/states/netusers.py | def _expand_users(device_users, common_users):
'''Creates a longer list of accepted users on the device.'''
expected_users = deepcopy(common_users)
expected_users.update(device_users)
return expected_users | def _expand_users(device_users, common_users):
'''Creates a longer list of accepted users on the device.'''
expected_users = deepcopy(common_users)
expected_users.update(device_users)
return expected_users | [
"Creates",
"a",
"longer",
"list",
"of",
"accepted",
"users",
"on",
"the",
"device",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netusers.py#L75-L82 | [
"def",
"_expand_users",
"(",
"device_users",
",",
"common_users",
")",
":",
"expected_users",
"=",
"deepcopy",
"(",
"common_users",
")",
"expected_users",
".",
"update",
"(",
"device_users",
")",
"return",
"expected_users"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _check_users | Checks if the input dictionary of users is valid. | salt/states/netusers.py | def _check_users(users):
'''Checks if the input dictionary of users is valid.'''
messg = ''
valid = True
for user, user_details in six.iteritems(users):
if not user_details:
valid = False
messg += 'Please provide details for username {user}.\n'.format(user=user)
... | def _check_users(users):
'''Checks if the input dictionary of users is valid.'''
messg = ''
valid = True
for user, user_details in six.iteritems(users):
if not user_details:
valid = False
messg += 'Please provide details for username {user}.\n'.format(user=user)
... | [
"Checks",
"if",
"the",
"input",
"dictionary",
"of",
"users",
"is",
"valid",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netusers.py#L85-L101 | [
"def",
"_check_users",
"(",
"users",
")",
":",
"messg",
"=",
"''",
"valid",
"=",
"True",
"for",
"user",
",",
"user_details",
"in",
"six",
".",
"iteritems",
"(",
"users",
")",
":",
"if",
"not",
"user_details",
":",
"valid",
"=",
"False",
"messg",
"+=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _compute_diff | Computes the differences between the actual config and the expected config | salt/states/netusers.py | def _compute_diff(configured, expected):
'''Computes the differences between the actual config and the expected config'''
diff = {
'add': {},
'update': {},
'remove': {}
}
configured_users = set(configured.keys())
expected_users = set(expected.keys())
add_usernames = e... | def _compute_diff(configured, expected):
'''Computes the differences between the actual config and the expected config'''
diff = {
'add': {},
'update': {},
'remove': {}
}
configured_users = set(configured.keys())
expected_users = set(expected.keys())
add_usernames = e... | [
"Computes",
"the",
"differences",
"between",
"the",
"actual",
"config",
"and",
"the",
"expected",
"config"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netusers.py#L104-L141 | [
"def",
"_compute_diff",
"(",
"configured",
",",
"expected",
")",
":",
"diff",
"=",
"{",
"'add'",
":",
"{",
"}",
",",
"'update'",
":",
"{",
"}",
",",
"'remove'",
":",
"{",
"}",
"}",
"configured_users",
"=",
"set",
"(",
"configured",
".",
"keys",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.