id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
32,700 | saltstack/salt | salt/modules/file.py | open_files | def open_files(by_pid=False):
'''
Return a list of all physical open files on the system.
CLI Examples:
.. code-block:: bash
salt '*' file.open_files
salt '*' file.open_files by_pid=True
'''
# First we collect valid PIDs
pids = {}
procfs = os.listdir('/proc/')
for ... | python | def open_files(by_pid=False):
'''
Return a list of all physical open files on the system.
CLI Examples:
.. code-block:: bash
salt '*' file.open_files
salt '*' file.open_files by_pid=True
'''
# First we collect valid PIDs
pids = {}
procfs = os.listdir('/proc/')
for ... | [
"def",
"open_files",
"(",
"by_pid",
"=",
"False",
")",
":",
"# First we collect valid PIDs",
"pids",
"=",
"{",
"}",
"procfs",
"=",
"os",
".",
"listdir",
"(",
"'/proc/'",
")",
"for",
"pfile",
"in",
"procfs",
":",
"try",
":",
"pids",
"[",
"int",
"(",
"pf... | Return a list of all physical open files on the system.
CLI Examples:
.. code-block:: bash
salt '*' file.open_files
salt '*' file.open_files by_pid=True | [
"Return",
"a",
"list",
"of",
"all",
"physical",
"open",
"files",
"on",
"the",
"system",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L6580-L6657 |
32,701 | saltstack/salt | salt/modules/file.py | move | def move(src, dst):
'''
Move a file or directory
CLI Example:
.. code-block:: bash
salt '*' file.move /path/to/src /path/to/dst
'''
src = os.path.expanduser(src)
dst = os.path.expanduser(dst)
if not os.path.isabs(src):
raise SaltInvocationError('Source path must be ab... | python | def move(src, dst):
'''
Move a file or directory
CLI Example:
.. code-block:: bash
salt '*' file.move /path/to/src /path/to/dst
'''
src = os.path.expanduser(src)
dst = os.path.expanduser(dst)
if not os.path.isabs(src):
raise SaltInvocationError('Source path must be ab... | [
"def",
"move",
"(",
"src",
",",
"dst",
")",
":",
"src",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"src",
")",
"dst",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"dst",
")",
"if",
"not",
"os",
".",
"path",
".",
"isabs",
"(",
"src",
"... | Move a file or directory
CLI Example:
.. code-block:: bash
salt '*' file.move /path/to/src /path/to/dst | [
"Move",
"a",
"file",
"or",
"directory"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L6773-L6804 |
32,702 | saltstack/salt | salt/modules/file.py | diskusage | def diskusage(path):
'''
Recursively calculate disk usage of path and return it
in bytes
CLI Example:
.. code-block:: bash
salt '*' file.diskusage /path/to/check
'''
total_size = 0
seen = set()
if os.path.isfile(path):
stat_structure = os.stat(path)
ret = ... | python | def diskusage(path):
'''
Recursively calculate disk usage of path and return it
in bytes
CLI Example:
.. code-block:: bash
salt '*' file.diskusage /path/to/check
'''
total_size = 0
seen = set()
if os.path.isfile(path):
stat_structure = os.stat(path)
ret = ... | [
"def",
"diskusage",
"(",
"path",
")",
":",
"total_size",
"=",
"0",
"seen",
"=",
"set",
"(",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
")",
":",
"stat_structure",
"=",
"os",
".",
"stat",
"(",
"path",
")",
"ret",
"=",
"stat_structure"... | Recursively calculate disk usage of path and return it
in bytes
CLI Example:
.. code-block:: bash
salt '*' file.diskusage /path/to/check | [
"Recursively",
"calculate",
"disk",
"usage",
"of",
"path",
"and",
"return",
"it",
"in",
"bytes"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L6807-L6843 |
32,703 | saltstack/salt | salt/sdb/sqlite3.py | get | def get(key, profile=None):
'''
Get a value from sqlite3
'''
if not profile:
return None
_, cur, table = _connect(profile)
q = profile.get('get_query', ('SELECT value FROM {0} WHERE '
'key=:key'.format(table)))
res = cur.execute(q, {'key': key})
... | python | def get(key, profile=None):
'''
Get a value from sqlite3
'''
if not profile:
return None
_, cur, table = _connect(profile)
q = profile.get('get_query', ('SELECT value FROM {0} WHERE '
'key=:key'.format(table)))
res = cur.execute(q, {'key': key})
... | [
"def",
"get",
"(",
"key",
",",
"profile",
"=",
"None",
")",
":",
"if",
"not",
"profile",
":",
"return",
"None",
"_",
",",
"cur",
",",
"table",
"=",
"_connect",
"(",
"profile",
")",
"q",
"=",
"profile",
".",
"get",
"(",
"'get_query'",
",",
"(",
"'... | Get a value from sqlite3 | [
"Get",
"a",
"value",
"from",
"sqlite3"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/sqlite3.py#L137-L150 |
32,704 | saltstack/salt | salt/modules/napalm_route.py | show | def show(destination, protocol=None, **kwargs): # pylint: disable=unused-argument
'''
Displays all details for a certain route learned via a specific protocol.
If the protocol is not specified, will return all possible routes.
.. note::
This function return the routes from the RIB.
I... | python | def show(destination, protocol=None, **kwargs): # pylint: disable=unused-argument
'''
Displays all details for a certain route learned via a specific protocol.
If the protocol is not specified, will return all possible routes.
.. note::
This function return the routes from the RIB.
I... | [
"def",
"show",
"(",
"destination",
",",
"protocol",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"return",
"salt",
".",
"utils",
".",
"napalm",
".",
"call",
"(",
"napalm_device",
",",
"# pylint: disable=undefined-variable",
... | Displays all details for a certain route learned via a specific protocol.
If the protocol is not specified, will return all possible routes.
.. note::
This function return the routes from the RIB.
In case the destination prefix is too short,
there may be too many routes matched.
... | [
"Displays",
"all",
"details",
"for",
"a",
"certain",
"route",
"learned",
"via",
"a",
"specific",
"protocol",
".",
"If",
"the",
"protocol",
"is",
"not",
"specified",
"will",
"return",
"all",
"possible",
"routes",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_route.py#L59-L158 |
32,705 | saltstack/salt | salt/states/docker_network.py | absent | def absent(name):
'''
Ensure that a network is absent.
name
Name of the network
Usage Example:
.. code-block:: yaml
network_foo:
docker_network.absent
'''
ret = {'name': name,
'changes': {},
'result': False,
'comment': ''}
t... | python | def absent(name):
'''
Ensure that a network is absent.
name
Name of the network
Usage Example:
.. code-block:: yaml
network_foo:
docker_network.absent
'''
ret = {'name': name,
'changes': {},
'result': False,
'comment': ''}
t... | [
"def",
"absent",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"try",
":",
"network",
"=",
"__salt__",
"[",
"'docker.inspect_network'",
... | Ensure that a network is absent.
name
Name of the network
Usage Example:
.. code-block:: yaml
network_foo:
docker_network.absent | [
"Ensure",
"that",
"a",
"network",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/docker_network.py#L893-L933 |
32,706 | saltstack/salt | salt/states/docker_network.py | _remove_network | def _remove_network(network):
'''
Remove network, including all connected containers
'''
ret = {'name': network['Name'],
'changes': {},
'result': False,
'comment': ''}
errors = []
for cid in network['Containers']:
try:
cinfo = __salt__['docke... | python | def _remove_network(network):
'''
Remove network, including all connected containers
'''
ret = {'name': network['Name'],
'changes': {},
'result': False,
'comment': ''}
errors = []
for cid in network['Containers']:
try:
cinfo = __salt__['docke... | [
"def",
"_remove_network",
"(",
"network",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"network",
"[",
"'Name'",
"]",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"errors",
"=",
"[",
"]",
"for",
"ci... | Remove network, including all connected containers | [
"Remove",
"network",
"including",
"all",
"connected",
"containers"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/docker_network.py#L936-L978 |
32,707 | saltstack/salt | salt/transport/mixins/auth.py | AESReqServerMixin._encrypt_private | def _encrypt_private(self, ret, dictkey, target):
'''
The server equivalent of ReqChannel.crypted_transfer_decode_dictentry
'''
# encrypt with a specific AES key
pubfn = os.path.join(self.opts['pki_dir'],
'minions',
target... | python | def _encrypt_private(self, ret, dictkey, target):
'''
The server equivalent of ReqChannel.crypted_transfer_decode_dictentry
'''
# encrypt with a specific AES key
pubfn = os.path.join(self.opts['pki_dir'],
'minions',
target... | [
"def",
"_encrypt_private",
"(",
"self",
",",
"ret",
",",
"dictkey",
",",
"target",
")",
":",
"# encrypt with a specific AES key",
"pubfn",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"opts",
"[",
"'pki_dir'",
"]",
",",
"'minions'",
",",
"target"... | The server equivalent of ReqChannel.crypted_transfer_decode_dictentry | [
"The",
"server",
"equivalent",
"of",
"ReqChannel",
".",
"crypted_transfer_decode_dictentry"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/mixins/auth.py#L110-L141 |
32,708 | saltstack/salt | salt/transport/mixins/auth.py | AESReqServerMixin._update_aes | def _update_aes(self):
'''
Check to see if a fresh AES key is available and update the components
of the worker
'''
if salt.master.SMaster.secrets['aes']['secret'].value != self.crypticle.key_string:
self.crypticle = salt.crypt.Crypticle(self.opts, salt.master.SMaster... | python | def _update_aes(self):
'''
Check to see if a fresh AES key is available and update the components
of the worker
'''
if salt.master.SMaster.secrets['aes']['secret'].value != self.crypticle.key_string:
self.crypticle = salt.crypt.Crypticle(self.opts, salt.master.SMaster... | [
"def",
"_update_aes",
"(",
"self",
")",
":",
"if",
"salt",
".",
"master",
".",
"SMaster",
".",
"secrets",
"[",
"'aes'",
"]",
"[",
"'secret'",
"]",
".",
"value",
"!=",
"self",
".",
"crypticle",
".",
"key_string",
":",
"self",
".",
"crypticle",
"=",
"s... | Check to see if a fresh AES key is available and update the components
of the worker | [
"Check",
"to",
"see",
"if",
"a",
"fresh",
"AES",
"key",
"is",
"available",
"and",
"update",
"the",
"components",
"of",
"the",
"worker"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/mixins/auth.py#L143-L151 |
32,709 | saltstack/salt | salt/utils/decorators/path.py | which | def which(exe):
'''
Decorator wrapper for salt.utils.path.which
'''
def wrapper(function):
def wrapped(*args, **kwargs):
if salt.utils.path.which(exe) is None:
raise CommandNotFoundError(
'The \'{0}\' binary was not found in $PATH.'.format(exe)
... | python | def which(exe):
'''
Decorator wrapper for salt.utils.path.which
'''
def wrapper(function):
def wrapped(*args, **kwargs):
if salt.utils.path.which(exe) is None:
raise CommandNotFoundError(
'The \'{0}\' binary was not found in $PATH.'.format(exe)
... | [
"def",
"which",
"(",
"exe",
")",
":",
"def",
"wrapper",
"(",
"function",
")",
":",
"def",
"wrapped",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"exe",
")",
"is",
"None",
":",... | Decorator wrapper for salt.utils.path.which | [
"Decorator",
"wrapper",
"for",
"salt",
".",
"utils",
".",
"path",
".",
"which"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/path.py#L13-L25 |
32,710 | saltstack/salt | salt/utils/decorators/path.py | which_bin | def which_bin(exes):
'''
Decorator wrapper for salt.utils.path.which_bin
'''
def wrapper(function):
def wrapped(*args, **kwargs):
if salt.utils.path.which_bin(exes) is None:
raise CommandNotFoundError(
'None of provided binaries({0}) was not found ... | python | def which_bin(exes):
'''
Decorator wrapper for salt.utils.path.which_bin
'''
def wrapper(function):
def wrapped(*args, **kwargs):
if salt.utils.path.which_bin(exes) is None:
raise CommandNotFoundError(
'None of provided binaries({0}) was not found ... | [
"def",
"which_bin",
"(",
"exes",
")",
":",
"def",
"wrapper",
"(",
"function",
")",
":",
"def",
"wrapped",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"salt",
".",
"utils",
".",
"path",
".",
"which_bin",
"(",
"exes",
")",
"is",
"Non... | Decorator wrapper for salt.utils.path.which_bin | [
"Decorator",
"wrapper",
"for",
"salt",
".",
"utils",
".",
"path",
".",
"which_bin"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/path.py#L28-L43 |
32,711 | saltstack/salt | salt/runners/doc.py | runner | def runner():
'''
Return all inline documentation for runner modules
CLI Example:
.. code-block:: bash
salt-run doc.runner
'''
client = salt.runner.RunnerClient(__opts__)
ret = client.get_docs()
return ret | python | def runner():
'''
Return all inline documentation for runner modules
CLI Example:
.. code-block:: bash
salt-run doc.runner
'''
client = salt.runner.RunnerClient(__opts__)
ret = client.get_docs()
return ret | [
"def",
"runner",
"(",
")",
":",
"client",
"=",
"salt",
".",
"runner",
".",
"RunnerClient",
"(",
"__opts__",
")",
"ret",
"=",
"client",
".",
"get_docs",
"(",
")",
"return",
"ret"
] | Return all inline documentation for runner modules
CLI Example:
.. code-block:: bash
salt-run doc.runner | [
"Return",
"all",
"inline",
"documentation",
"for",
"runner",
"modules"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/doc.py#L27-L39 |
32,712 | saltstack/salt | salt/runners/doc.py | wheel | def wheel():
'''
Return all inline documentation for wheel modules
CLI Example:
.. code-block:: bash
salt-run doc.wheel
'''
client = salt.wheel.Wheel(__opts__)
ret = client.get_docs()
return ret | python | def wheel():
'''
Return all inline documentation for wheel modules
CLI Example:
.. code-block:: bash
salt-run doc.wheel
'''
client = salt.wheel.Wheel(__opts__)
ret = client.get_docs()
return ret | [
"def",
"wheel",
"(",
")",
":",
"client",
"=",
"salt",
".",
"wheel",
".",
"Wheel",
"(",
"__opts__",
")",
"ret",
"=",
"client",
".",
"get_docs",
"(",
")",
"return",
"ret"
] | Return all inline documentation for wheel modules
CLI Example:
.. code-block:: bash
salt-run doc.wheel | [
"Return",
"all",
"inline",
"documentation",
"for",
"wheel",
"modules"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/doc.py#L42-L54 |
32,713 | saltstack/salt | salt/runners/doc.py | execution | def execution():
'''
Collect all the sys.doc output from each minion and return the aggregate
CLI Example:
.. code-block:: bash
salt-run doc.execution
'''
client = salt.client.get_local_client(__opts__['conf_file'])
docs = {}
try:
for ret in client.cmd_iter('*', 'sys.... | python | def execution():
'''
Collect all the sys.doc output from each minion and return the aggregate
CLI Example:
.. code-block:: bash
salt-run doc.execution
'''
client = salt.client.get_local_client(__opts__['conf_file'])
docs = {}
try:
for ret in client.cmd_iter('*', 'sys.... | [
"def",
"execution",
"(",
")",
":",
"client",
"=",
"salt",
".",
"client",
".",
"get_local_client",
"(",
"__opts__",
"[",
"'conf_file'",
"]",
")",
"docs",
"=",
"{",
"}",
"try",
":",
"for",
"ret",
"in",
"client",
".",
"cmd_iter",
"(",
"'*'",
",",
"'sys.... | Collect all the sys.doc output from each minion and return the aggregate
CLI Example:
.. code-block:: bash
salt-run doc.execution | [
"Collect",
"all",
"the",
"sys",
".",
"doc",
"output",
"from",
"each",
"minion",
"and",
"return",
"the",
"aggregate"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/doc.py#L57-L81 |
32,714 | saltstack/salt | salt/modules/temp.py | file | def file(suffix='', prefix='tmp', parent=None):
'''
Create a temporary file
CLI Example:
.. code-block:: bash
salt '*' temp.file
salt '*' temp.file prefix='mytemp-' parent='/var/run/'
'''
fh_, tmp_ = tempfile.mkstemp(suffix, prefix, parent)
os.close(fh_)
return tmp_ | python | def file(suffix='', prefix='tmp', parent=None):
'''
Create a temporary file
CLI Example:
.. code-block:: bash
salt '*' temp.file
salt '*' temp.file prefix='mytemp-' parent='/var/run/'
'''
fh_, tmp_ = tempfile.mkstemp(suffix, prefix, parent)
os.close(fh_)
return tmp_ | [
"def",
"file",
"(",
"suffix",
"=",
"''",
",",
"prefix",
"=",
"'tmp'",
",",
"parent",
"=",
"None",
")",
":",
"fh_",
",",
"tmp_",
"=",
"tempfile",
".",
"mkstemp",
"(",
"suffix",
",",
"prefix",
",",
"parent",
")",
"os",
".",
"close",
"(",
"fh_",
")"... | Create a temporary file
CLI Example:
.. code-block:: bash
salt '*' temp.file
salt '*' temp.file prefix='mytemp-' parent='/var/run/' | [
"Create",
"a",
"temporary",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/temp.py#L33-L46 |
32,715 | saltstack/salt | salt/runner.py | RunnerClient.cmd_async | def cmd_async(self, low):
'''
Execute a runner function asynchronously; eauth is respected
This function requires that :conf_master:`external_auth` is configured
and the user is authorized to execute runner functions: (``@runner``).
.. code-block:: python
runner.ea... | python | def cmd_async(self, low):
'''
Execute a runner function asynchronously; eauth is respected
This function requires that :conf_master:`external_auth` is configured
and the user is authorized to execute runner functions: (``@runner``).
.. code-block:: python
runner.ea... | [
"def",
"cmd_async",
"(",
"self",
",",
"low",
")",
":",
"reformatted_low",
"=",
"self",
".",
"_reformat_low",
"(",
"low",
")",
"return",
"mixins",
".",
"AsyncClientMixin",
".",
"cmd_async",
"(",
"self",
",",
"reformatted_low",
")"
] | Execute a runner function asynchronously; eauth is respected
This function requires that :conf_master:`external_auth` is configured
and the user is authorized to execute runner functions: (``@runner``).
.. code-block:: python
runner.eauth_async({
'fun': 'jobs.list_... | [
"Execute",
"a",
"runner",
"function",
"asynchronously",
";",
"eauth",
"is",
"respected"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runner.py#L109-L127 |
32,716 | saltstack/salt | salt/runner.py | Runner.print_docs | def print_docs(self):
'''
Print out the documentation!
'''
arg = self.opts.get('fun', None)
docs = super(Runner, self).get_docs(arg)
for fun in sorted(docs):
display_output('{0}:'.format(fun), 'text', self.opts)
print(docs[fun]) | python | def print_docs(self):
'''
Print out the documentation!
'''
arg = self.opts.get('fun', None)
docs = super(Runner, self).get_docs(arg)
for fun in sorted(docs):
display_output('{0}:'.format(fun), 'text', self.opts)
print(docs[fun]) | [
"def",
"print_docs",
"(",
"self",
")",
":",
"arg",
"=",
"self",
".",
"opts",
".",
"get",
"(",
"'fun'",
",",
"None",
")",
"docs",
"=",
"super",
"(",
"Runner",
",",
"self",
")",
".",
"get_docs",
"(",
"arg",
")",
"for",
"fun",
"in",
"sorted",
"(",
... | Print out the documentation! | [
"Print",
"out",
"the",
"documentation!"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runner.py#L169-L177 |
32,717 | saltstack/salt | salt/runner.py | Runner.run | def run(self):
'''
Execute the runner sequence
'''
# Print documentation only
if self.opts.get('doc', False):
self.print_docs()
else:
return self._run_runner() | python | def run(self):
'''
Execute the runner sequence
'''
# Print documentation only
if self.opts.get('doc', False):
self.print_docs()
else:
return self._run_runner() | [
"def",
"run",
"(",
"self",
")",
":",
"# Print documentation only",
"if",
"self",
".",
"opts",
".",
"get",
"(",
"'doc'",
",",
"False",
")",
":",
"self",
".",
"print_docs",
"(",
")",
"else",
":",
"return",
"self",
".",
"_run_runner",
"(",
")"
] | Execute the runner sequence | [
"Execute",
"the",
"runner",
"sequence"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runner.py#L180-L188 |
32,718 | saltstack/salt | salt/thorium/status.py | reg | def reg(name):
'''
Activate this register to turn on a minion status tracking register, this
register keeps the current status beacon data and the time that each beacon
was last checked in.
'''
ret = {'name': name,
'changes': {},
'comment': '',
'result': True}
... | python | def reg(name):
'''
Activate this register to turn on a minion status tracking register, this
register keeps the current status beacon data and the time that each beacon
was last checked in.
'''
ret = {'name': name,
'changes': {},
'comment': '',
'result': True}
... | [
"def",
"reg",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
",",
"'result'",
":",
"True",
"}",
"now",
"=",
"time",
".",
"time",
"(",
")",
"if",
"'status'",
"not",
"i... | Activate this register to turn on a minion status tracking register, this
register keeps the current status beacon data and the time that each beacon
was last checked in. | [
"Activate",
"this",
"register",
"to",
"turn",
"on",
"a",
"minion",
"status",
"tracking",
"register",
"this",
"register",
"keeps",
"the",
"current",
"status",
"beacon",
"data",
"and",
"the",
"time",
"that",
"each",
"beacon",
"was",
"last",
"checked",
"in",
".... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/thorium/status.py#L14-L38 |
32,719 | saltstack/salt | salt/modules/boto_datapipeline.py | create_pipeline | def create_pipeline(name, unique_id, description='', region=None, key=None, keyid=None,
profile=None):
'''
Create a new, empty pipeline. This function is idempotent.
CLI example:
.. code-block:: bash
salt myminion boto_datapipeline.create_pipeline my_name my_unique_id
... | python | def create_pipeline(name, unique_id, description='', region=None, key=None, keyid=None,
profile=None):
'''
Create a new, empty pipeline. This function is idempotent.
CLI example:
.. code-block:: bash
salt myminion boto_datapipeline.create_pipeline my_name my_unique_id
... | [
"def",
"create_pipeline",
"(",
"name",
",",
"unique_id",
",",
"description",
"=",
"''",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"client",
"=",
"_get_client",
"(",
"region",
... | Create a new, empty pipeline. This function is idempotent.
CLI example:
.. code-block:: bash
salt myminion boto_datapipeline.create_pipeline my_name my_unique_id | [
"Create",
"a",
"new",
"empty",
"pipeline",
".",
"This",
"function",
"is",
"idempotent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_datapipeline.py#L57-L79 |
32,720 | saltstack/salt | salt/modules/boto_datapipeline.py | delete_pipeline | def delete_pipeline(pipeline_id, region=None, key=None, keyid=None, profile=None):
'''
Delete a pipeline, its pipeline definition, and its run history. This function is idempotent.
CLI example:
.. code-block:: bash
salt myminion boto_datapipeline.delete_pipeline my_pipeline_id
'''
cli... | python | def delete_pipeline(pipeline_id, region=None, key=None, keyid=None, profile=None):
'''
Delete a pipeline, its pipeline definition, and its run history. This function is idempotent.
CLI example:
.. code-block:: bash
salt myminion boto_datapipeline.delete_pipeline my_pipeline_id
'''
cli... | [
"def",
"delete_pipeline",
"(",
"pipeline_id",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"client",
"=",
"_get_client",
"(",
"region",
",",
"key",
",",
"keyid",
",",
"profile",
... | Delete a pipeline, its pipeline definition, and its run history. This function is idempotent.
CLI example:
.. code-block:: bash
salt myminion boto_datapipeline.delete_pipeline my_pipeline_id | [
"Delete",
"a",
"pipeline",
"its",
"pipeline",
"definition",
"and",
"its",
"run",
"history",
".",
"This",
"function",
"is",
"idempotent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_datapipeline.py#L82-L99 |
32,721 | saltstack/salt | salt/modules/boto_datapipeline.py | describe_pipelines | def describe_pipelines(pipeline_ids, region=None, key=None, keyid=None, profile=None):
'''
Retrieve metadata about one or more pipelines.
CLI example:
.. code-block:: bash
salt myminion boto_datapipeline.describe_pipelines ['my_pipeline_id']
'''
client = _get_client(region, key, keyid... | python | def describe_pipelines(pipeline_ids, region=None, key=None, keyid=None, profile=None):
'''
Retrieve metadata about one or more pipelines.
CLI example:
.. code-block:: bash
salt myminion boto_datapipeline.describe_pipelines ['my_pipeline_id']
'''
client = _get_client(region, key, keyid... | [
"def",
"describe_pipelines",
"(",
"pipeline_ids",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"client",
"=",
"_get_client",
"(",
"region",
",",
"key",
",",
"keyid",
",",
"profil... | Retrieve metadata about one or more pipelines.
CLI example:
.. code-block:: bash
salt myminion boto_datapipeline.describe_pipelines ['my_pipeline_id'] | [
"Retrieve",
"metadata",
"about",
"one",
"or",
"more",
"pipelines",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_datapipeline.py#L102-L118 |
32,722 | saltstack/salt | salt/modules/boto_datapipeline.py | list_pipelines | def list_pipelines(region=None, key=None, keyid=None, profile=None):
'''
Get a list of pipeline ids and names for all pipelines.
CLI Example:
.. code-block:: bash
salt myminion boto_datapipeline.list_pipelines profile=myprofile
'''
client = _get_client(region, key, keyid, profile)
... | python | def list_pipelines(region=None, key=None, keyid=None, profile=None):
'''
Get a list of pipeline ids and names for all pipelines.
CLI Example:
.. code-block:: bash
salt myminion boto_datapipeline.list_pipelines profile=myprofile
'''
client = _get_client(region, key, keyid, profile)
... | [
"def",
"list_pipelines",
"(",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"client",
"=",
"_get_client",
"(",
"region",
",",
"key",
",",
"keyid",
",",
"profile",
")",
"r",
"=",
"{... | Get a list of pipeline ids and names for all pipelines.
CLI Example:
.. code-block:: bash
salt myminion boto_datapipeline.list_pipelines profile=myprofile | [
"Get",
"a",
"list",
"of",
"pipeline",
"ids",
"and",
"names",
"for",
"all",
"pipelines",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_datapipeline.py#L144-L164 |
32,723 | saltstack/salt | salt/modules/boto_datapipeline.py | pipeline_id_from_name | def pipeline_id_from_name(name, region=None, key=None, keyid=None, profile=None):
'''
Get the pipeline id, if it exists, for the given name.
CLI example:
.. code-block:: bash
salt myminion boto_datapipeline.pipeline_id_from_name my_pipeline_name
'''
r = {}
result_pipelines = list_... | python | def pipeline_id_from_name(name, region=None, key=None, keyid=None, profile=None):
'''
Get the pipeline id, if it exists, for the given name.
CLI example:
.. code-block:: bash
salt myminion boto_datapipeline.pipeline_id_from_name my_pipeline_name
'''
r = {}
result_pipelines = list_... | [
"def",
"pipeline_id_from_name",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"r",
"=",
"{",
"}",
"result_pipelines",
"=",
"list_pipelines",
"(",
")",
"if",
"'error'"... | Get the pipeline id, if it exists, for the given name.
CLI example:
.. code-block:: bash
salt myminion boto_datapipeline.pipeline_id_from_name my_pipeline_name | [
"Get",
"the",
"pipeline",
"id",
"if",
"it",
"exists",
"for",
"the",
"given",
"name",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_datapipeline.py#L167-L187 |
32,724 | saltstack/salt | salt/modules/boto_datapipeline.py | put_pipeline_definition | def put_pipeline_definition(pipeline_id, pipeline_objects, parameter_objects=None,
parameter_values=None, region=None, key=None, keyid=None, profile=None):
'''
Add tasks, schedules, and preconditions to the specified pipeline. This function is
idempotent and will replace an exist... | python | def put_pipeline_definition(pipeline_id, pipeline_objects, parameter_objects=None,
parameter_values=None, region=None, key=None, keyid=None, profile=None):
'''
Add tasks, schedules, and preconditions to the specified pipeline. This function is
idempotent and will replace an exist... | [
"def",
"put_pipeline_definition",
"(",
"pipeline_id",
",",
"pipeline_objects",
",",
"parameter_objects",
"=",
"None",
",",
"parameter_values",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"... | Add tasks, schedules, and preconditions to the specified pipeline. This function is
idempotent and will replace an existing definition.
CLI example:
.. code-block:: bash
salt myminion boto_datapipeline.put_pipeline_definition my_pipeline_id my_pipeline_objects | [
"Add",
"tasks",
"schedules",
"and",
"preconditions",
"to",
"the",
"specified",
"pipeline",
".",
"This",
"function",
"is",
"idempotent",
"and",
"will",
"replace",
"an",
"existing",
"definition",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_datapipeline.py#L190-L219 |
32,725 | saltstack/salt | salt/modules/boto_datapipeline.py | _get_client | def _get_client(region, key, keyid, profile):
'''
Get a boto connection to Data Pipeline.
'''
session = _get_session(region, key, keyid, profile)
if not session:
log.error("Failed to get datapipeline client.")
return None
return session.client('datapipeline') | python | def _get_client(region, key, keyid, profile):
'''
Get a boto connection to Data Pipeline.
'''
session = _get_session(region, key, keyid, profile)
if not session:
log.error("Failed to get datapipeline client.")
return None
return session.client('datapipeline') | [
"def",
"_get_client",
"(",
"region",
",",
"key",
",",
"keyid",
",",
"profile",
")",
":",
"session",
"=",
"_get_session",
"(",
"region",
",",
"key",
",",
"keyid",
",",
"profile",
")",
"if",
"not",
"session",
":",
"log",
".",
"error",
"(",
"\"Failed to g... | Get a boto connection to Data Pipeline. | [
"Get",
"a",
"boto",
"connection",
"to",
"Data",
"Pipeline",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_datapipeline.py#L222-L231 |
32,726 | saltstack/salt | salt/modules/boto_datapipeline.py | _get_session | def _get_session(region, key, keyid, profile):
'''
Get a boto3 session
'''
if profile:
if isinstance(profile, six.string_types):
_profile = __salt__['config.option'](profile)
elif isinstance(profile, dict):
_profile = profile
key = _profile.get('key', None... | python | def _get_session(region, key, keyid, profile):
'''
Get a boto3 session
'''
if profile:
if isinstance(profile, six.string_types):
_profile = __salt__['config.option'](profile)
elif isinstance(profile, dict):
_profile = profile
key = _profile.get('key', None... | [
"def",
"_get_session",
"(",
"region",
",",
"key",
",",
"keyid",
",",
"profile",
")",
":",
"if",
"profile",
":",
"if",
"isinstance",
"(",
"profile",
",",
"six",
".",
"string_types",
")",
":",
"_profile",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
... | Get a boto3 session | [
"Get",
"a",
"boto3",
"session"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_datapipeline.py#L234-L257 |
32,727 | saltstack/salt | salt/modules/qemu_img.py | make_image | def make_image(location, size, fmt):
'''
Create a blank virtual machine image file of the specified size in
megabytes. The image can be created in any format supported by qemu
CLI Example:
.. code-block:: bash
salt '*' qemu_img.make_image /tmp/image.qcow 2048 qcow2
salt '*' qemu_i... | python | def make_image(location, size, fmt):
'''
Create a blank virtual machine image file of the specified size in
megabytes. The image can be created in any format supported by qemu
CLI Example:
.. code-block:: bash
salt '*' qemu_img.make_image /tmp/image.qcow 2048 qcow2
salt '*' qemu_i... | [
"def",
"make_image",
"(",
"location",
",",
"size",
",",
"fmt",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isabs",
"(",
"location",
")",
":",
"return",
"''",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"os",
".",
"path",
".",
"dirname"... | Create a blank virtual machine image file of the specified size in
megabytes. The image can be created in any format supported by qemu
CLI Example:
.. code-block:: bash
salt '*' qemu_img.make_image /tmp/image.qcow 2048 qcow2
salt '*' qemu_img.make_image /tmp/image.raw 10240 raw | [
"Create",
"a",
"blank",
"virtual",
"machine",
"image",
"file",
"of",
"the",
"specified",
"size",
"in",
"megabytes",
".",
"The",
"image",
"can",
"be",
"created",
"in",
"any",
"format",
"supported",
"by",
"qemu"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/qemu_img.py#L28-L51 |
32,728 | saltstack/salt | salt/modules/qemu_img.py | convert | def convert(orig, dest, fmt):
'''
Convert an existing disk image to another format using qemu-img
CLI Example:
.. code-block:: bash
salt '*' qemu_img.convert /path/to/original.img /path/to/new.img qcow2
'''
cmd = ('qemu-img', 'convert', '-O', fmt, orig, dest)
ret = __salt__['cmd.r... | python | def convert(orig, dest, fmt):
'''
Convert an existing disk image to another format using qemu-img
CLI Example:
.. code-block:: bash
salt '*' qemu_img.convert /path/to/original.img /path/to/new.img qcow2
'''
cmd = ('qemu-img', 'convert', '-O', fmt, orig, dest)
ret = __salt__['cmd.r... | [
"def",
"convert",
"(",
"orig",
",",
"dest",
",",
"fmt",
")",
":",
"cmd",
"=",
"(",
"'qemu-img'",
",",
"'convert'",
",",
"'-O'",
",",
"fmt",
",",
"orig",
",",
"dest",
")",
"ret",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"python_s... | Convert an existing disk image to another format using qemu-img
CLI Example:
.. code-block:: bash
salt '*' qemu_img.convert /path/to/original.img /path/to/new.img qcow2 | [
"Convert",
"an",
"existing",
"disk",
"image",
"to",
"another",
"format",
"using",
"qemu",
"-",
"img"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/qemu_img.py#L54-L69 |
32,729 | saltstack/salt | salt/modules/win_network.py | ping | def ping(host, timeout=False, return_boolean=False):
'''
Performs a ping to a host
CLI Example:
.. code-block:: bash
salt '*' network.ping archlinux.org
.. versionadded:: 2016.11.0
Return a True or False instead of ping output.
.. code-block:: bash
salt '*' network.pin... | python | def ping(host, timeout=False, return_boolean=False):
'''
Performs a ping to a host
CLI Example:
.. code-block:: bash
salt '*' network.ping archlinux.org
.. versionadded:: 2016.11.0
Return a True or False instead of ping output.
.. code-block:: bash
salt '*' network.pin... | [
"def",
"ping",
"(",
"host",
",",
"timeout",
"=",
"False",
",",
"return_boolean",
"=",
"False",
")",
":",
"if",
"timeout",
":",
"# Windows ping differs by having timeout be for individual echo requests.'",
"# Divide timeout by tries to mimic BSD behaviour.",
"timeout",
"=",
... | Performs a ping to a host
CLI Example:
.. code-block:: bash
salt '*' network.ping archlinux.org
.. versionadded:: 2016.11.0
Return a True or False instead of ping output.
.. code-block:: bash
salt '*' network.ping archlinux.org return_boolean=True
Set the time to wait for... | [
"Performs",
"a",
"ping",
"to",
"a",
"host"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_network.py#L69-L107 |
32,730 | saltstack/salt | salt/modules/win_network.py | nslookup | def nslookup(host):
'''
Query DNS for information about a domain or ip address
CLI Example:
.. code-block:: bash
salt '*' network.nslookup archlinux.org
'''
ret = []
addresses = []
cmd = ['nslookup', salt.utils.network.sanitize_host(host)]
lines = __salt__['cmd.run'](cmd, ... | python | def nslookup(host):
'''
Query DNS for information about a domain or ip address
CLI Example:
.. code-block:: bash
salt '*' network.nslookup archlinux.org
'''
ret = []
addresses = []
cmd = ['nslookup', salt.utils.network.sanitize_host(host)]
lines = __salt__['cmd.run'](cmd, ... | [
"def",
"nslookup",
"(",
"host",
")",
":",
"ret",
"=",
"[",
"]",
"addresses",
"=",
"[",
"]",
"cmd",
"=",
"[",
"'nslookup'",
",",
"salt",
".",
"utils",
".",
"network",
".",
"sanitize_host",
"(",
"host",
")",
"]",
"lines",
"=",
"__salt__",
"[",
"'cmd.... | Query DNS for information about a domain or ip address
CLI Example:
.. code-block:: bash
salt '*' network.nslookup archlinux.org | [
"Query",
"DNS",
"for",
"information",
"about",
"a",
"domain",
"or",
"ip",
"address"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_network.py#L196-L226 |
32,731 | saltstack/salt | salt/modules/win_network.py | interfaces_names | def interfaces_names():
'''
Return a list of all the interfaces names
CLI Example:
.. code-block:: bash
salt '*' network.interfaces_names
'''
ret = []
with salt.utils.winapi.Com():
c = wmi.WMI()
for iface in c.Win32_NetworkAdapter(NetEnabled=True):
ret... | python | def interfaces_names():
'''
Return a list of all the interfaces names
CLI Example:
.. code-block:: bash
salt '*' network.interfaces_names
'''
ret = []
with salt.utils.winapi.Com():
c = wmi.WMI()
for iface in c.Win32_NetworkAdapter(NetEnabled=True):
ret... | [
"def",
"interfaces_names",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"with",
"salt",
".",
"utils",
".",
"winapi",
".",
"Com",
"(",
")",
":",
"c",
"=",
"wmi",
".",
"WMI",
"(",
")",
"for",
"iface",
"in",
"c",
".",
"Win32_NetworkAdapter",
"(",
"NetEnabled"... | Return a list of all the interfaces names
CLI Example:
.. code-block:: bash
salt '*' network.interfaces_names | [
"Return",
"a",
"list",
"of",
"all",
"the",
"interfaces",
"names"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_network.py#L274-L290 |
32,732 | saltstack/salt | salt/modules/win_network.py | ip_addrs | def ip_addrs(interface=None, include_loopback=False, cidr=None, type=None):
'''
Returns a list of IPv4 addresses assigned to the host.
interface
Only IP addresses from that interface will be returned.
include_loopback : False
Include loopback 127.0.0.1 IPv4 address.
cidr
D... | python | def ip_addrs(interface=None, include_loopback=False, cidr=None, type=None):
'''
Returns a list of IPv4 addresses assigned to the host.
interface
Only IP addresses from that interface will be returned.
include_loopback : False
Include loopback 127.0.0.1 IPv4 address.
cidr
D... | [
"def",
"ip_addrs",
"(",
"interface",
"=",
"None",
",",
"include_loopback",
"=",
"False",
",",
"cidr",
"=",
"None",
",",
"type",
"=",
"None",
")",
":",
"addrs",
"=",
"salt",
".",
"utils",
".",
"network",
".",
"ip_addrs",
"(",
"interface",
"=",
"interfac... | Returns a list of IPv4 addresses assigned to the host.
interface
Only IP addresses from that interface will be returned.
include_loopback : False
Include loopback 127.0.0.1 IPv4 address.
cidr
Describes subnet using CIDR notation and only IPv4 addresses that belong
to this ... | [
"Returns",
"a",
"list",
"of",
"IPv4",
"addresses",
"assigned",
"to",
"the",
"host",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_network.py#L349-L389 |
32,733 | saltstack/salt | salt/modules/win_network.py | ip_addrs6 | def ip_addrs6(interface=None, include_loopback=False, cidr=None):
'''
Returns a list of IPv6 addresses assigned to the host.
interface
Only IP addresses from that interface will be returned.
include_loopback : False
Include loopback ::1 IPv6 address.
cidr
Describes subnet ... | python | def ip_addrs6(interface=None, include_loopback=False, cidr=None):
'''
Returns a list of IPv6 addresses assigned to the host.
interface
Only IP addresses from that interface will be returned.
include_loopback : False
Include loopback ::1 IPv6 address.
cidr
Describes subnet ... | [
"def",
"ip_addrs6",
"(",
"interface",
"=",
"None",
",",
"include_loopback",
"=",
"False",
",",
"cidr",
"=",
"None",
")",
":",
"addrs",
"=",
"salt",
".",
"utils",
".",
"network",
".",
"ip_addrs6",
"(",
"interface",
"=",
"interface",
",",
"include_loopback",... | Returns a list of IPv6 addresses assigned to the host.
interface
Only IP addresses from that interface will be returned.
include_loopback : False
Include loopback ::1 IPv6 address.
cidr
Describes subnet using CIDR notation and only IPv6 addresses that belong
to this subnet... | [
"Returns",
"a",
"list",
"of",
"IPv6",
"addresses",
"assigned",
"to",
"the",
"host",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_network.py#L395-L423 |
32,734 | saltstack/salt | salt/modules/win_network.py | connect | def connect(host, port=None, **kwargs):
'''
Test connectivity to a host using a particular
port from the minion.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' network.connect archlinux.org 80
salt '*' network.connect archlinux.org 80 timeout=3
... | python | def connect(host, port=None, **kwargs):
'''
Test connectivity to a host using a particular
port from the minion.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' network.connect archlinux.org 80
salt '*' network.connect archlinux.org 80 timeout=3
... | [
"def",
"connect",
"(",
"host",
",",
"port",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"if",
"not",
"host",
":",
"ret",
"[",
"'result'",
"]",
"=",
"False",
"ret",
... | Test connectivity to a host using a particular
port from the minion.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' network.connect archlinux.org 80
salt '*' network.connect archlinux.org 80 timeout=3
salt '*' network.connect archlinux.org 80 timeout=... | [
"Test",
"connectivity",
"to",
"a",
"host",
"using",
"a",
"particular",
"port",
"from",
"the",
"minion",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_network.py#L429-L518 |
32,735 | saltstack/salt | salt/returners/pushover_returner.py | returner | def returner(ret):
'''
Send an PushOver message with the data
'''
_options = _get_options(ret)
user = _options.get('user')
device = _options.get('device')
token = _options.get('token')
title = _options.get('title')
priority = _options.get('priority')
expire = _options.get('expi... | python | def returner(ret):
'''
Send an PushOver message with the data
'''
_options = _get_options(ret)
user = _options.get('user')
device = _options.get('device')
token = _options.get('token')
title = _options.get('title')
priority = _options.get('priority')
expire = _options.get('expi... | [
"def",
"returner",
"(",
"ret",
")",
":",
"_options",
"=",
"_get_options",
"(",
"ret",
")",
"user",
"=",
"_options",
".",
"get",
"(",
"'user'",
")",
"device",
"=",
"_options",
".",
"get",
"(",
"'device'",
")",
"token",
"=",
"_options",
".",
"get",
"("... | Send an PushOver message with the data | [
"Send",
"an",
"PushOver",
"message",
"with",
"the",
"data"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pushover_returner.py#L201-L251 |
32,736 | saltstack/salt | salt/loader.py | _format_entrypoint_target | def _format_entrypoint_target(ep):
'''
Makes a string describing the target of an EntryPoint object.
Base strongly on EntryPoint.__str__().
'''
s = ep.module_name
if ep.attrs:
s += ':' + '.'.join(ep.attrs)
return s | python | def _format_entrypoint_target(ep):
'''
Makes a string describing the target of an EntryPoint object.
Base strongly on EntryPoint.__str__().
'''
s = ep.module_name
if ep.attrs:
s += ':' + '.'.join(ep.attrs)
return s | [
"def",
"_format_entrypoint_target",
"(",
"ep",
")",
":",
"s",
"=",
"ep",
".",
"module_name",
"if",
"ep",
".",
"attrs",
":",
"s",
"+=",
"':'",
"+",
"'.'",
".",
"join",
"(",
"ep",
".",
"attrs",
")",
"return",
"s"
] | Makes a string describing the target of an EntryPoint object.
Base strongly on EntryPoint.__str__(). | [
"Makes",
"a",
"string",
"describing",
"the",
"target",
"of",
"an",
"EntryPoint",
"object",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L147-L156 |
32,737 | saltstack/salt | salt/loader.py | minion_mods | def minion_mods(
opts,
context=None,
utils=None,
whitelist=None,
initial_load=False,
loaded_base_name=None,
notify=False,
static_modules=None,
proxy=None):
'''
Load execution modules
Returns a dictionary of execution modules appropriat... | python | def minion_mods(
opts,
context=None,
utils=None,
whitelist=None,
initial_load=False,
loaded_base_name=None,
notify=False,
static_modules=None,
proxy=None):
'''
Load execution modules
Returns a dictionary of execution modules appropriat... | [
"def",
"minion_mods",
"(",
"opts",
",",
"context",
"=",
"None",
",",
"utils",
"=",
"None",
",",
"whitelist",
"=",
"None",
",",
"initial_load",
"=",
"False",
",",
"loaded_base_name",
"=",
"None",
",",
"notify",
"=",
"False",
",",
"static_modules",
"=",
"N... | Load execution modules
Returns a dictionary of execution modules appropriate for the current
system by evaluating the __virtual__() function in each module.
:param dict opts: The Salt options dictionary
:param dict context: A Salt context that should be made present inside
... | [
"Load",
"execution",
"modules"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L205-L287 |
32,738 | saltstack/salt | salt/loader.py | engines | def engines(opts, functions, runners, utils, proxy=None):
'''
Return the master services plugins
'''
pack = {'__salt__': functions,
'__runners__': runners,
'__proxy__': proxy,
'__utils__': utils}
return LazyLoader(
_module_dirs(opts, 'engines'),
op... | python | def engines(opts, functions, runners, utils, proxy=None):
'''
Return the master services plugins
'''
pack = {'__salt__': functions,
'__runners__': runners,
'__proxy__': proxy,
'__utils__': utils}
return LazyLoader(
_module_dirs(opts, 'engines'),
op... | [
"def",
"engines",
"(",
"opts",
",",
"functions",
",",
"runners",
",",
"utils",
",",
"proxy",
"=",
"None",
")",
":",
"pack",
"=",
"{",
"'__salt__'",
":",
"functions",
",",
"'__runners__'",
":",
"runners",
",",
"'__proxy__'",
":",
"proxy",
",",
"'__utils__... | Return the master services plugins | [
"Return",
"the",
"master",
"services",
"plugins"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L341-L354 |
32,739 | saltstack/salt | salt/loader.py | proxy | def proxy(opts, functions=None, returners=None, whitelist=None, utils=None):
'''
Returns the proxy module for this salt-proxy-minion
'''
ret = LazyLoader(
_module_dirs(opts, 'proxy'),
opts,
tag='proxy',
pack={'__salt__': functions, '__ret__': returners, '__utils__': utils... | python | def proxy(opts, functions=None, returners=None, whitelist=None, utils=None):
'''
Returns the proxy module for this salt-proxy-minion
'''
ret = LazyLoader(
_module_dirs(opts, 'proxy'),
opts,
tag='proxy',
pack={'__salt__': functions, '__ret__': returners, '__utils__': utils... | [
"def",
"proxy",
"(",
"opts",
",",
"functions",
"=",
"None",
",",
"returners",
"=",
"None",
",",
"whitelist",
"=",
"None",
",",
"utils",
"=",
"None",
")",
":",
"ret",
"=",
"LazyLoader",
"(",
"_module_dirs",
"(",
"opts",
",",
"'proxy'",
")",
",",
"opts... | Returns the proxy module for this salt-proxy-minion | [
"Returns",
"the",
"proxy",
"module",
"for",
"this",
"salt",
"-",
"proxy",
"-",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L357-L370 |
32,740 | saltstack/salt | salt/loader.py | utils | def utils(opts, whitelist=None, context=None, proxy=proxy):
'''
Returns the utility modules
'''
return LazyLoader(
_module_dirs(opts, 'utils', ext_type_dirs='utils_dirs'),
opts,
tag='utils',
whitelist=whitelist,
pack={'__context__': context, '__proxy__': proxy or ... | python | def utils(opts, whitelist=None, context=None, proxy=proxy):
'''
Returns the utility modules
'''
return LazyLoader(
_module_dirs(opts, 'utils', ext_type_dirs='utils_dirs'),
opts,
tag='utils',
whitelist=whitelist,
pack={'__context__': context, '__proxy__': proxy or ... | [
"def",
"utils",
"(",
"opts",
",",
"whitelist",
"=",
"None",
",",
"context",
"=",
"None",
",",
"proxy",
"=",
"proxy",
")",
":",
"return",
"LazyLoader",
"(",
"_module_dirs",
"(",
"opts",
",",
"'utils'",
",",
"ext_type_dirs",
"=",
"'utils_dirs'",
")",
",",
... | Returns the utility modules | [
"Returns",
"the",
"utility",
"modules"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L386-L396 |
32,741 | saltstack/salt | salt/loader.py | pillars | def pillars(opts, functions, context=None):
'''
Returns the pillars modules
'''
ret = LazyLoader(_module_dirs(opts, 'pillar'),
opts,
tag='pillar',
pack={'__salt__': functions,
'__context__': context,
... | python | def pillars(opts, functions, context=None):
'''
Returns the pillars modules
'''
ret = LazyLoader(_module_dirs(opts, 'pillar'),
opts,
tag='pillar',
pack={'__salt__': functions,
'__context__': context,
... | [
"def",
"pillars",
"(",
"opts",
",",
"functions",
",",
"context",
"=",
"None",
")",
":",
"ret",
"=",
"LazyLoader",
"(",
"_module_dirs",
"(",
"opts",
",",
"'pillar'",
")",
",",
"opts",
",",
"tag",
"=",
"'pillar'",
",",
"pack",
"=",
"{",
"'__salt__'",
"... | Returns the pillars modules | [
"Returns",
"the",
"pillars",
"modules"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L399-L410 |
32,742 | saltstack/salt | salt/loader.py | tops | def tops(opts):
'''
Returns the tops modules
'''
if 'master_tops' not in opts:
return {}
whitelist = list(opts['master_tops'].keys())
ret = LazyLoader(
_module_dirs(opts, 'tops', 'top'),
opts,
tag='top',
whitelist=whitelist,
)
return FilterDictWrap... | python | def tops(opts):
'''
Returns the tops modules
'''
if 'master_tops' not in opts:
return {}
whitelist = list(opts['master_tops'].keys())
ret = LazyLoader(
_module_dirs(opts, 'tops', 'top'),
opts,
tag='top',
whitelist=whitelist,
)
return FilterDictWrap... | [
"def",
"tops",
"(",
"opts",
")",
":",
"if",
"'master_tops'",
"not",
"in",
"opts",
":",
"return",
"{",
"}",
"whitelist",
"=",
"list",
"(",
"opts",
"[",
"'master_tops'",
"]",
".",
"keys",
"(",
")",
")",
"ret",
"=",
"LazyLoader",
"(",
"_module_dirs",
"(... | Returns the tops modules | [
"Returns",
"the",
"tops",
"modules"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L413-L426 |
32,743 | saltstack/salt | salt/loader.py | wheels | def wheels(opts, whitelist=None, context=None):
'''
Returns the wheels modules
'''
if context is None:
context = {}
return LazyLoader(
_module_dirs(opts, 'wheel'),
opts,
tag='wheel',
whitelist=whitelist,
pack={'__context__': context},
) | python | def wheels(opts, whitelist=None, context=None):
'''
Returns the wheels modules
'''
if context is None:
context = {}
return LazyLoader(
_module_dirs(opts, 'wheel'),
opts,
tag='wheel',
whitelist=whitelist,
pack={'__context__': context},
) | [
"def",
"wheels",
"(",
"opts",
",",
"whitelist",
"=",
"None",
",",
"context",
"=",
"None",
")",
":",
"if",
"context",
"is",
"None",
":",
"context",
"=",
"{",
"}",
"return",
"LazyLoader",
"(",
"_module_dirs",
"(",
"opts",
",",
"'wheel'",
")",
",",
"opt... | Returns the wheels modules | [
"Returns",
"the",
"wheels",
"modules"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L429-L441 |
32,744 | saltstack/salt | salt/loader.py | outputters | def outputters(opts):
'''
Returns the outputters modules
:param dict opts: The Salt options dictionary
:returns: LazyLoader instance, with only outputters present in the keyspace
'''
ret = LazyLoader(
_module_dirs(opts, 'output', ext_type_dirs='outputter_dirs'),
opts,
ta... | python | def outputters(opts):
'''
Returns the outputters modules
:param dict opts: The Salt options dictionary
:returns: LazyLoader instance, with only outputters present in the keyspace
'''
ret = LazyLoader(
_module_dirs(opts, 'output', ext_type_dirs='outputter_dirs'),
opts,
ta... | [
"def",
"outputters",
"(",
"opts",
")",
":",
"ret",
"=",
"LazyLoader",
"(",
"_module_dirs",
"(",
"opts",
",",
"'output'",
",",
"ext_type_dirs",
"=",
"'outputter_dirs'",
")",
",",
"opts",
",",
"tag",
"=",
"'output'",
",",
")",
"wrapped_ret",
"=",
"FilterDict... | Returns the outputters modules
:param dict opts: The Salt options dictionary
:returns: LazyLoader instance, with only outputters present in the keyspace | [
"Returns",
"the",
"outputters",
"modules"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L444-L459 |
32,745 | saltstack/salt | salt/loader.py | auth | def auth(opts, whitelist=None):
'''
Returns the auth modules
:param dict opts: The Salt options dictionary
:returns: LazyLoader
'''
return LazyLoader(
_module_dirs(opts, 'auth'),
opts,
tag='auth',
whitelist=whitelist,
pack={'__salt__': minion_mods(opts)},... | python | def auth(opts, whitelist=None):
'''
Returns the auth modules
:param dict opts: The Salt options dictionary
:returns: LazyLoader
'''
return LazyLoader(
_module_dirs(opts, 'auth'),
opts,
tag='auth',
whitelist=whitelist,
pack={'__salt__': minion_mods(opts)},... | [
"def",
"auth",
"(",
"opts",
",",
"whitelist",
"=",
"None",
")",
":",
"return",
"LazyLoader",
"(",
"_module_dirs",
"(",
"opts",
",",
"'auth'",
")",
",",
"opts",
",",
"tag",
"=",
"'auth'",
",",
"whitelist",
"=",
"whitelist",
",",
"pack",
"=",
"{",
"'__... | Returns the auth modules
:param dict opts: The Salt options dictionary
:returns: LazyLoader | [
"Returns",
"the",
"auth",
"modules"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L488-L501 |
32,746 | saltstack/salt | salt/loader.py | fileserver | def fileserver(opts, backends):
'''
Returns the file server modules
'''
return LazyLoader(_module_dirs(opts, 'fileserver'),
opts,
tag='fileserver',
whitelist=backends,
pack={'__utils__': utils(opts)}) | python | def fileserver(opts, backends):
'''
Returns the file server modules
'''
return LazyLoader(_module_dirs(opts, 'fileserver'),
opts,
tag='fileserver',
whitelist=backends,
pack={'__utils__': utils(opts)}) | [
"def",
"fileserver",
"(",
"opts",
",",
"backends",
")",
":",
"return",
"LazyLoader",
"(",
"_module_dirs",
"(",
"opts",
",",
"'fileserver'",
")",
",",
"opts",
",",
"tag",
"=",
"'fileserver'",
",",
"whitelist",
"=",
"backends",
",",
"pack",
"=",
"{",
"'__u... | Returns the file server modules | [
"Returns",
"the",
"file",
"server",
"modules"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L504-L512 |
32,747 | saltstack/salt | salt/loader.py | roster | def roster(opts, runner=None, utils=None, whitelist=None):
'''
Returns the roster modules
'''
return LazyLoader(
_module_dirs(opts, 'roster'),
opts,
tag='roster',
whitelist=whitelist,
pack={
'__runner__': runner,
'__utils__': utils,
... | python | def roster(opts, runner=None, utils=None, whitelist=None):
'''
Returns the roster modules
'''
return LazyLoader(
_module_dirs(opts, 'roster'),
opts,
tag='roster',
whitelist=whitelist,
pack={
'__runner__': runner,
'__utils__': utils,
... | [
"def",
"roster",
"(",
"opts",
",",
"runner",
"=",
"None",
",",
"utils",
"=",
"None",
",",
"whitelist",
"=",
"None",
")",
":",
"return",
"LazyLoader",
"(",
"_module_dirs",
"(",
"opts",
",",
"'roster'",
")",
",",
"opts",
",",
"tag",
"=",
"'roster'",
",... | Returns the roster modules | [
"Returns",
"the",
"roster",
"modules"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L515-L528 |
32,748 | saltstack/salt | salt/loader.py | thorium | def thorium(opts, functions, runners):
'''
Load the thorium runtime modules
'''
pack = {'__salt__': functions, '__runner__': runners, '__context__': {}}
ret = LazyLoader(_module_dirs(opts, 'thorium'),
opts,
tag='thorium',
pack=pack)
ret.pack['__thorium__'] = r... | python | def thorium(opts, functions, runners):
'''
Load the thorium runtime modules
'''
pack = {'__salt__': functions, '__runner__': runners, '__context__': {}}
ret = LazyLoader(_module_dirs(opts, 'thorium'),
opts,
tag='thorium',
pack=pack)
ret.pack['__thorium__'] = r... | [
"def",
"thorium",
"(",
"opts",
",",
"functions",
",",
"runners",
")",
":",
"pack",
"=",
"{",
"'__salt__'",
":",
"functions",
",",
"'__runner__'",
":",
"runners",
",",
"'__context__'",
":",
"{",
"}",
"}",
"ret",
"=",
"LazyLoader",
"(",
"_module_dirs",
"("... | Load the thorium runtime modules | [
"Load",
"the",
"thorium",
"runtime",
"modules"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L531-L541 |
32,749 | saltstack/salt | salt/loader.py | states | def states(opts, functions, utils, serializers, whitelist=None, proxy=None, context=None):
'''
Returns the state modules
:param dict opts: The Salt options dictionary
:param dict functions: A dictionary of minion modules, with module names as
keys and funcs as values.
.... | python | def states(opts, functions, utils, serializers, whitelist=None, proxy=None, context=None):
'''
Returns the state modules
:param dict opts: The Salt options dictionary
:param dict functions: A dictionary of minion modules, with module names as
keys and funcs as values.
.... | [
"def",
"states",
"(",
"opts",
",",
"functions",
",",
"utils",
",",
"serializers",
",",
"whitelist",
"=",
"None",
",",
"proxy",
"=",
"None",
",",
"context",
"=",
"None",
")",
":",
"if",
"context",
"is",
"None",
":",
"context",
"=",
"{",
"}",
"ret",
... | Returns the state modules
:param dict opts: The Salt options dictionary
:param dict functions: A dictionary of minion modules, with module names as
keys and funcs as values.
.. code-block:: python
import salt.config
import salt.loader
__opts__ = salt.c... | [
"Returns",
"the",
"state",
"modules"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L544-L574 |
32,750 | saltstack/salt | salt/loader.py | beacons | def beacons(opts, functions, context=None, proxy=None):
'''
Load the beacon modules
:param dict opts: The Salt options dictionary
:param dict functions: A dictionary of minion modules, with module names as
keys and funcs as values.
'''
return LazyLoader(
_mod... | python | def beacons(opts, functions, context=None, proxy=None):
'''
Load the beacon modules
:param dict opts: The Salt options dictionary
:param dict functions: A dictionary of minion modules, with module names as
keys and funcs as values.
'''
return LazyLoader(
_mod... | [
"def",
"beacons",
"(",
"opts",
",",
"functions",
",",
"context",
"=",
"None",
",",
"proxy",
"=",
"None",
")",
":",
"return",
"LazyLoader",
"(",
"_module_dirs",
"(",
"opts",
",",
"'beacons'",
")",
",",
"opts",
",",
"tag",
"=",
"'beacons'",
",",
"pack",
... | Load the beacon modules
:param dict opts: The Salt options dictionary
:param dict functions: A dictionary of minion modules, with module names as
keys and funcs as values. | [
"Load",
"the",
"beacon",
"modules"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L577-L591 |
32,751 | saltstack/salt | salt/loader.py | render | def render(opts, functions, states=None, proxy=None, context=None):
'''
Returns the render modules
'''
if context is None:
context = {}
pack = {'__salt__': functions,
'__grains__': opts.get('grains', {}),
'__context__': context}
if states:
pack['__states... | python | def render(opts, functions, states=None, proxy=None, context=None):
'''
Returns the render modules
'''
if context is None:
context = {}
pack = {'__salt__': functions,
'__grains__': opts.get('grains', {}),
'__context__': context}
if states:
pack['__states... | [
"def",
"render",
"(",
"opts",
",",
"functions",
",",
"states",
"=",
"None",
",",
"proxy",
"=",
"None",
",",
"context",
"=",
"None",
")",
":",
"if",
"context",
"is",
"None",
":",
"context",
"=",
"{",
"}",
"pack",
"=",
"{",
"'__salt__'",
":",
"functi... | Returns the render modules | [
"Returns",
"the",
"render",
"modules"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L634-L666 |
32,752 | saltstack/salt | salt/loader.py | grain_funcs | def grain_funcs(opts, proxy=None):
'''
Returns the grain functions
.. code-block:: python
import salt.config
import salt.loader
__opts__ = salt.config.minion_config('/etc/salt/minion')
grainfuncs = salt.loader.grain_funcs(__opts__)
'''
ret = LazyLoader(
... | python | def grain_funcs(opts, proxy=None):
'''
Returns the grain functions
.. code-block:: python
import salt.config
import salt.loader
__opts__ = salt.config.minion_config('/etc/salt/minion')
grainfuncs = salt.loader.grain_funcs(__opts__)
'''
ret = LazyLoader(
... | [
"def",
"grain_funcs",
"(",
"opts",
",",
"proxy",
"=",
"None",
")",
":",
"ret",
"=",
"LazyLoader",
"(",
"_module_dirs",
"(",
"opts",
",",
"'grains'",
",",
"'grain'",
",",
"ext_type_dirs",
"=",
"'grains_dirs'",
",",
")",
",",
"opts",
",",
"tag",
"=",
"'g... | Returns the grain functions
.. code-block:: python
import salt.config
import salt.loader
__opts__ = salt.config.minion_config('/etc/salt/minion')
grainfuncs = salt.loader.grain_funcs(__opts__) | [
"Returns",
"the",
"grain",
"functions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L669-L692 |
32,753 | saltstack/salt | salt/loader.py | _load_cached_grains | def _load_cached_grains(opts, cfn):
'''
Returns the grains cached in cfn, or None if the cache is too old or is
corrupted.
'''
if not os.path.isfile(cfn):
log.debug('Grains cache file does not exist.')
return None
grains_cache_age = int(time.time() - os.path.getmtime(cfn))
i... | python | def _load_cached_grains(opts, cfn):
'''
Returns the grains cached in cfn, or None if the cache is too old or is
corrupted.
'''
if not os.path.isfile(cfn):
log.debug('Grains cache file does not exist.')
return None
grains_cache_age = int(time.time() - os.path.getmtime(cfn))
i... | [
"def",
"_load_cached_grains",
"(",
"opts",
",",
"cfn",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"cfn",
")",
":",
"log",
".",
"debug",
"(",
"'Grains cache file does not exist.'",
")",
"return",
"None",
"grains_cache_age",
"=",
"int",
"(... | Returns the grains cached in cfn, or None if the cache is too old or is
corrupted. | [
"Returns",
"the",
"grains",
"cached",
"in",
"cfn",
"or",
"None",
"if",
"the",
"cache",
"is",
"too",
"old",
"or",
"is",
"corrupted",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L695-L729 |
32,754 | saltstack/salt | salt/loader.py | sdb | def sdb(opts, functions=None, whitelist=None, utils=None):
'''
Make a very small database call
'''
if utils is None:
utils = {}
return LazyLoader(
_module_dirs(opts, 'sdb'),
opts,
tag='sdb',
pack={
'__sdb__': functions,
'__opts__': opt... | python | def sdb(opts, functions=None, whitelist=None, utils=None):
'''
Make a very small database call
'''
if utils is None:
utils = {}
return LazyLoader(
_module_dirs(opts, 'sdb'),
opts,
tag='sdb',
pack={
'__sdb__': functions,
'__opts__': opt... | [
"def",
"sdb",
"(",
"opts",
",",
"functions",
"=",
"None",
",",
"whitelist",
"=",
"None",
",",
"utils",
"=",
"None",
")",
":",
"if",
"utils",
"is",
"None",
":",
"utils",
"=",
"{",
"}",
"return",
"LazyLoader",
"(",
"_module_dirs",
"(",
"opts",
",",
"... | Make a very small database call | [
"Make",
"a",
"very",
"small",
"database",
"call"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L960-L978 |
32,755 | saltstack/salt | salt/loader.py | pkgdb | def pkgdb(opts):
'''
Return modules for SPM's package database
.. versionadded:: 2015.8.0
'''
return LazyLoader(
_module_dirs(
opts,
'pkgdb',
base_path=os.path.join(SALT_BASE_PATH, 'spm')
),
opts,
tag='pkgdb'
) | python | def pkgdb(opts):
'''
Return modules for SPM's package database
.. versionadded:: 2015.8.0
'''
return LazyLoader(
_module_dirs(
opts,
'pkgdb',
base_path=os.path.join(SALT_BASE_PATH, 'spm')
),
opts,
tag='pkgdb'
) | [
"def",
"pkgdb",
"(",
"opts",
")",
":",
"return",
"LazyLoader",
"(",
"_module_dirs",
"(",
"opts",
",",
"'pkgdb'",
",",
"base_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"SALT_BASE_PATH",
",",
"'spm'",
")",
")",
",",
"opts",
",",
"tag",
"=",
"'pkg... | Return modules for SPM's package database
.. versionadded:: 2015.8.0 | [
"Return",
"modules",
"for",
"SPM",
"s",
"package",
"database"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L981-L995 |
32,756 | saltstack/salt | salt/loader.py | clouds | def clouds(opts):
'''
Return the cloud functions
'''
# Let's bring __active_provider_name__, defaulting to None, to all cloud
# drivers. This will get temporarily updated/overridden with a context
# manager when needed.
functions = LazyLoader(
_module_dirs(opts,
... | python | def clouds(opts):
'''
Return the cloud functions
'''
# Let's bring __active_provider_name__, defaulting to None, to all cloud
# drivers. This will get temporarily updated/overridden with a context
# manager when needed.
functions = LazyLoader(
_module_dirs(opts,
... | [
"def",
"clouds",
"(",
"opts",
")",
":",
"# Let's bring __active_provider_name__, defaulting to None, to all cloud",
"# drivers. This will get temporarily updated/overridden with a context",
"# manager when needed.",
"functions",
"=",
"LazyLoader",
"(",
"_module_dirs",
"(",
"opts",
",... | Return the cloud functions | [
"Return",
"the",
"cloud",
"functions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L1015-L1039 |
32,757 | saltstack/salt | salt/loader.py | executors | def executors(opts, functions=None, context=None, proxy=None):
'''
Returns the executor modules
'''
executors = LazyLoader(
_module_dirs(opts, 'executors', 'executor'),
opts,
tag='executor',
pack={'__salt__': functions, '__context__': context or {}, '__proxy__': proxy or ... | python | def executors(opts, functions=None, context=None, proxy=None):
'''
Returns the executor modules
'''
executors = LazyLoader(
_module_dirs(opts, 'executors', 'executor'),
opts,
tag='executor',
pack={'__salt__': functions, '__context__': context or {}, '__proxy__': proxy or ... | [
"def",
"executors",
"(",
"opts",
",",
"functions",
"=",
"None",
",",
"context",
"=",
"None",
",",
"proxy",
"=",
"None",
")",
":",
"executors",
"=",
"LazyLoader",
"(",
"_module_dirs",
"(",
"opts",
",",
"'executors'",
",",
"'executor'",
")",
",",
"opts",
... | Returns the executor modules | [
"Returns",
"the",
"executor",
"modules"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L1053-L1064 |
32,758 | saltstack/salt | salt/loader.py | global_injector_decorator | def global_injector_decorator(inject_globals):
'''
Decorator used by the LazyLoader to inject globals into a function at
execute time.
globals
Dictionary with global variables to inject
'''
def inner_decorator(f):
@functools.wraps(f)
def wrapper(*args, **kwargs):
... | python | def global_injector_decorator(inject_globals):
'''
Decorator used by the LazyLoader to inject globals into a function at
execute time.
globals
Dictionary with global variables to inject
'''
def inner_decorator(f):
@functools.wraps(f)
def wrapper(*args, **kwargs):
... | [
"def",
"global_injector_decorator",
"(",
"inject_globals",
")",
":",
"def",
"inner_decorator",
"(",
"f",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"f",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"salt",
"."... | Decorator used by the LazyLoader to inject globals into a function at
execute time.
globals
Dictionary with global variables to inject | [
"Decorator",
"used",
"by",
"the",
"LazyLoader",
"to",
"inject",
"globals",
"into",
"a",
"function",
"at",
"execute",
"time",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L2044-L2058 |
32,759 | saltstack/salt | salt/loader.py | LazyLoader.missing_fun_string | def missing_fun_string(self, function_name):
'''
Return the error string for a missing function.
This can range from "not available' to "__virtual__" returned False
'''
mod_name = function_name.split('.')[0]
if mod_name in self.loaded_modules:
return '\'{0}\'... | python | def missing_fun_string(self, function_name):
'''
Return the error string for a missing function.
This can range from "not available' to "__virtual__" returned False
'''
mod_name = function_name.split('.')[0]
if mod_name in self.loaded_modules:
return '\'{0}\'... | [
"def",
"missing_fun_string",
"(",
"self",
",",
"function_name",
")",
":",
"mod_name",
"=",
"function_name",
".",
"split",
"(",
"'.'",
")",
"[",
"0",
"]",
"if",
"mod_name",
"in",
"self",
".",
"loaded_modules",
":",
"return",
"'\\'{0}\\' is not available.'",
"."... | Return the error string for a missing function.
This can range from "not available' to "__virtual__" returned False | [
"Return",
"the",
"error",
"string",
"for",
"a",
"missing",
"function",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L1348-L1366 |
32,760 | saltstack/salt | salt/loader.py | LazyLoader.__prep_mod_opts | def __prep_mod_opts(self, opts):
'''
Strip out of the opts any logger instance
'''
if '__grains__' not in self.pack:
grains = opts.get('grains', {})
if isinstance(grains, ThreadLocalProxy):
grains = ThreadLocalProxy.unproxy(grains)
se... | python | def __prep_mod_opts(self, opts):
'''
Strip out of the opts any logger instance
'''
if '__grains__' not in self.pack:
grains = opts.get('grains', {})
if isinstance(grains, ThreadLocalProxy):
grains = ThreadLocalProxy.unproxy(grains)
se... | [
"def",
"__prep_mod_opts",
"(",
"self",
",",
"opts",
")",
":",
"if",
"'__grains__'",
"not",
"in",
"self",
".",
"pack",
":",
"grains",
"=",
"opts",
".",
"get",
"(",
"'grains'",
",",
"{",
"}",
")",
"if",
"isinstance",
"(",
"grains",
",",
"ThreadLocalProxy... | Strip out of the opts any logger instance | [
"Strip",
"out",
"of",
"the",
"opts",
"any",
"logger",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L1537-L1564 |
32,761 | saltstack/salt | salt/loader.py | LazyLoader._iter_files | def _iter_files(self, mod_name):
'''
Iterate over all file_mapping files in order of closeness to mod_name
'''
# do we have an exact match?
if mod_name in self.file_mapping:
yield mod_name
# do we have a partial match?
for k in self.file_mapping:
... | python | def _iter_files(self, mod_name):
'''
Iterate over all file_mapping files in order of closeness to mod_name
'''
# do we have an exact match?
if mod_name in self.file_mapping:
yield mod_name
# do we have a partial match?
for k in self.file_mapping:
... | [
"def",
"_iter_files",
"(",
"self",
",",
"mod_name",
")",
":",
"# do we have an exact match?",
"if",
"mod_name",
"in",
"self",
".",
"file_mapping",
":",
"yield",
"mod_name",
"# do we have a partial match?",
"for",
"k",
"in",
"self",
".",
"file_mapping",
":",
"if",
... | Iterate over all file_mapping files in order of closeness to mod_name | [
"Iterate",
"over",
"all",
"file_mapping",
"files",
"in",
"order",
"of",
"closeness",
"to",
"mod_name"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L1566-L1582 |
32,762 | saltstack/salt | salt/loader.py | LazyLoader._load | def _load(self, key):
'''
Load a single item if you have it
'''
# if the key doesn't have a '.' then it isn't valid for this mod dict
if not isinstance(key, six.string_types):
raise KeyError('The key must be a string.')
if '.' not in key:
raise Key... | python | def _load(self, key):
'''
Load a single item if you have it
'''
# if the key doesn't have a '.' then it isn't valid for this mod dict
if not isinstance(key, six.string_types):
raise KeyError('The key must be a string.')
if '.' not in key:
raise Key... | [
"def",
"_load",
"(",
"self",
",",
"key",
")",
":",
"# if the key doesn't have a '.' then it isn't valid for this mod dict",
"if",
"not",
"isinstance",
"(",
"key",
",",
"six",
".",
"string_types",
")",
":",
"raise",
"KeyError",
"(",
"'The key must be a string.'",
")",
... | Load a single item if you have it | [
"Load",
"a",
"single",
"item",
"if",
"you",
"have",
"it"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L1851-L1902 |
32,763 | saltstack/salt | salt/loader.py | LazyLoader._load_all | def _load_all(self):
'''
Load all of them
'''
with self._lock:
for name in self.file_mapping:
if name in self.loaded_files or name in self.missing_modules:
continue
self._load_module(name)
self.loaded = True | python | def _load_all(self):
'''
Load all of them
'''
with self._lock:
for name in self.file_mapping:
if name in self.loaded_files or name in self.missing_modules:
continue
self._load_module(name)
self.loaded = True | [
"def",
"_load_all",
"(",
"self",
")",
":",
"with",
"self",
".",
"_lock",
":",
"for",
"name",
"in",
"self",
".",
"file_mapping",
":",
"if",
"name",
"in",
"self",
".",
"loaded_files",
"or",
"name",
"in",
"self",
".",
"missing_modules",
":",
"continue",
"... | Load all of them | [
"Load",
"all",
"of",
"them"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L1904-L1914 |
32,764 | saltstack/salt | salt/loader.py | LazyLoader._process_virtual | def _process_virtual(self, mod, module_name, virtual_func='__virtual__'):
'''
Given a loaded module and its default name determine its virtual name
This function returns a tuple. The first value will be either True or
False and will indicate if the module should be loaded or not (i.e. i... | python | def _process_virtual(self, mod, module_name, virtual_func='__virtual__'):
'''
Given a loaded module and its default name determine its virtual name
This function returns a tuple. The first value will be either True or
False and will indicate if the module should be loaded or not (i.e. i... | [
"def",
"_process_virtual",
"(",
"self",
",",
"mod",
",",
"module_name",
",",
"virtual_func",
"=",
"'__virtual__'",
")",
":",
"# The __virtual__ function will return either a True or False value.",
"# If it returns a True value it can also set a module level attribute",
"# named __vir... | Given a loaded module and its default name determine its virtual name
This function returns a tuple. The first value will be either True or
False and will indicate if the module should be loaded or not (i.e. if
it threw and exception while processing its __virtual__ function). The
secon... | [
"Given",
"a",
"loaded",
"module",
"and",
"its",
"default",
"name",
"determine",
"its",
"virtual",
"name"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L1930-L2041 |
32,765 | saltstack/salt | salt/modules/smbios.py | get | def get(string, clean=True):
'''
Get an individual DMI string from SMBIOS info
string
The string to fetch. DMIdecode supports:
- ``bios-vendor``
- ``bios-version``
- ``bios-release-date``
- ``system-manufacturer``
- ``system-product-name``
... | python | def get(string, clean=True):
'''
Get an individual DMI string from SMBIOS info
string
The string to fetch. DMIdecode supports:
- ``bios-vendor``
- ``bios-version``
- ``bios-release-date``
- ``system-manufacturer``
- ``system-product-name``
... | [
"def",
"get",
"(",
"string",
",",
"clean",
"=",
"True",
")",
":",
"val",
"=",
"_dmidecoder",
"(",
"'-s {0}'",
".",
"format",
"(",
"string",
")",
")",
".",
"strip",
"(",
")",
"# Cleanup possible comments in strings.",
"val",
"=",
"'\\n'",
".",
"join",
"("... | Get an individual DMI string from SMBIOS info
string
The string to fetch. DMIdecode supports:
- ``bios-vendor``
- ``bios-version``
- ``bios-release-date``
- ``system-manufacturer``
- ``system-product-name``
- ``system-version``
- ``syste... | [
"Get",
"an",
"individual",
"DMI",
"string",
"from",
"SMBIOS",
"info"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smbios.py#L41-L89 |
32,766 | saltstack/salt | salt/modules/smbios.py | records | def records(rec_type=None, fields=None, clean=True):
'''
Return DMI records from SMBIOS
type
Return only records of type(s)
The SMBIOS specification defines the following DMI types:
==== ======================================
Type Information
==== ===============... | python | def records(rec_type=None, fields=None, clean=True):
'''
Return DMI records from SMBIOS
type
Return only records of type(s)
The SMBIOS specification defines the following DMI types:
==== ======================================
Type Information
==== ===============... | [
"def",
"records",
"(",
"rec_type",
"=",
"None",
",",
"fields",
"=",
"None",
",",
"clean",
"=",
"True",
")",
":",
"if",
"rec_type",
"is",
"None",
":",
"smbios",
"=",
"_dmi_parse",
"(",
"_dmidecoder",
"(",
")",
",",
"clean",
",",
"fields",
")",
"else",... | Return DMI records from SMBIOS
type
Return only records of type(s)
The SMBIOS specification defines the following DMI types:
==== ======================================
Type Information
==== ======================================
0 BIOS
1 System
... | [
"Return",
"DMI",
"records",
"from",
"SMBIOS"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smbios.py#L92-L167 |
32,767 | saltstack/salt | salt/modules/smbios.py | _dmi_parse | def _dmi_parse(data, clean=True, fields=None):
'''
Structurize DMI records into a nice list
Optionally trash bogus entries and filter output
'''
dmi = []
# Detect & split Handle records
dmi_split = re.compile('(handle [0-9]x[0-9a-f]+[^\n]+)\n', re.MULTILINE+re.IGNORECASE)
dmi_raw = iter... | python | def _dmi_parse(data, clean=True, fields=None):
'''
Structurize DMI records into a nice list
Optionally trash bogus entries and filter output
'''
dmi = []
# Detect & split Handle records
dmi_split = re.compile('(handle [0-9]x[0-9a-f]+[^\n]+)\n', re.MULTILINE+re.IGNORECASE)
dmi_raw = iter... | [
"def",
"_dmi_parse",
"(",
"data",
",",
"clean",
"=",
"True",
",",
"fields",
"=",
"None",
")",
":",
"dmi",
"=",
"[",
"]",
"# Detect & split Handle records",
"dmi_split",
"=",
"re",
".",
"compile",
"(",
"'(handle [0-9]x[0-9a-f]+[^\\n]+)\\n'",
",",
"re",
".",
"... | Structurize DMI records into a nice list
Optionally trash bogus entries and filter output | [
"Structurize",
"DMI",
"records",
"into",
"a",
"nice",
"list",
"Optionally",
"trash",
"bogus",
"entries",
"and",
"filter",
"output"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smbios.py#L170-L207 |
32,768 | saltstack/salt | salt/modules/smbios.py | _dmi_data | def _dmi_data(dmi_raw, clean, fields):
'''
Parse the raw DMIdecode output of a single handle
into a nice dict
'''
dmi_data = {}
key = None
key_data = [None, []]
for line in dmi_raw:
if re.match(r'\t[^\s]+', line):
# Finish previous key
if key is not None:... | python | def _dmi_data(dmi_raw, clean, fields):
'''
Parse the raw DMIdecode output of a single handle
into a nice dict
'''
dmi_data = {}
key = None
key_data = [None, []]
for line in dmi_raw:
if re.match(r'\t[^\s]+', line):
# Finish previous key
if key is not None:... | [
"def",
"_dmi_data",
"(",
"dmi_raw",
",",
"clean",
",",
"fields",
")",
":",
"dmi_data",
"=",
"{",
"}",
"key",
"=",
"None",
"key_data",
"=",
"[",
"None",
",",
"[",
"]",
"]",
"for",
"line",
"in",
"dmi_raw",
":",
"if",
"re",
".",
"match",
"(",
"r'\\t... | Parse the raw DMIdecode output of a single handle
into a nice dict | [
"Parse",
"the",
"raw",
"DMIdecode",
"output",
"of",
"a",
"single",
"handle",
"into",
"a",
"nice",
"dict"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smbios.py#L210-L259 |
32,769 | saltstack/salt | salt/modules/smbios.py | _dmi_cast | def _dmi_cast(key, val, clean=True):
'''
Simple caster thingy for trying to fish out at least ints & lists from strings
'''
if clean and not _dmi_isclean(key, val):
return
elif not re.match(r'serial|part|asset|product', key, flags=re.IGNORECASE):
if ',' in val:
val = [el.... | python | def _dmi_cast(key, val, clean=True):
'''
Simple caster thingy for trying to fish out at least ints & lists from strings
'''
if clean and not _dmi_isclean(key, val):
return
elif not re.match(r'serial|part|asset|product', key, flags=re.IGNORECASE):
if ',' in val:
val = [el.... | [
"def",
"_dmi_cast",
"(",
"key",
",",
"val",
",",
"clean",
"=",
"True",
")",
":",
"if",
"clean",
"and",
"not",
"_dmi_isclean",
"(",
"key",
",",
"val",
")",
":",
"return",
"elif",
"not",
"re",
".",
"match",
"(",
"r'serial|part|asset|product'",
",",
"key"... | Simple caster thingy for trying to fish out at least ints & lists from strings | [
"Simple",
"caster",
"thingy",
"for",
"trying",
"to",
"fish",
"out",
"at",
"least",
"ints",
"&",
"lists",
"from",
"strings"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smbios.py#L262-L277 |
32,770 | saltstack/salt | salt/utils/yamlloader.py | SaltYamlSafeLoader.construct_mapping | def construct_mapping(self, node, deep=False):
'''
Build the mapping for YAML
'''
if not isinstance(node, MappingNode):
raise ConstructorError(
None,
None,
'expected a mapping node, but found {0}'.format(node.id),
... | python | def construct_mapping(self, node, deep=False):
'''
Build the mapping for YAML
'''
if not isinstance(node, MappingNode):
raise ConstructorError(
None,
None,
'expected a mapping node, but found {0}'.format(node.id),
... | [
"def",
"construct_mapping",
"(",
"self",
",",
"node",
",",
"deep",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"node",
",",
"MappingNode",
")",
":",
"raise",
"ConstructorError",
"(",
"None",
",",
"None",
",",
"'expected a mapping node, but found {0... | Build the mapping for YAML | [
"Build",
"the",
"mapping",
"for",
"YAML"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/yamlloader.py#L72-L105 |
32,771 | saltstack/salt | salt/ext/ipaddress.py | _BaseV4._is_valid_netmask | def _is_valid_netmask(self, netmask):
"""Verify that the netmask is valid.
Args:
netmask: A string, either a prefix or dotted decimal
netmask.
Returns:
A boolean, True if the prefix represents a valid IPv4
netmask.
"""
mask = n... | python | def _is_valid_netmask(self, netmask):
"""Verify that the netmask is valid.
Args:
netmask: A string, either a prefix or dotted decimal
netmask.
Returns:
A boolean, True if the prefix represents a valid IPv4
netmask.
"""
mask = n... | [
"def",
"_is_valid_netmask",
"(",
"self",
",",
"netmask",
")",
":",
"mask",
"=",
"netmask",
".",
"split",
"(",
"'.'",
")",
"if",
"len",
"(",
"mask",
")",
"==",
"4",
":",
"try",
":",
"for",
"x",
"in",
"mask",
":",
"if",
"int",
"(",
"x",
")",
"not... | Verify that the netmask is valid.
Args:
netmask: A string, either a prefix or dotted decimal
netmask.
Returns:
A boolean, True if the prefix represents a valid IPv4
netmask. | [
"Verify",
"that",
"the",
"netmask",
"is",
"valid",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/ext/ipaddress.py#L1249-L1278 |
32,772 | saltstack/salt | salt/ext/ipaddress.py | IPv6Network.hosts | def hosts(self):
"""Generate Iterator over usable hosts in a network.
This is like __iter__ except it doesn't return the
Subnet-Router anycast address.
"""
network = int(self.network_address)
broadcast = int(self.broadcast_address)
for x in long_range(1, bro... | python | def hosts(self):
"""Generate Iterator over usable hosts in a network.
This is like __iter__ except it doesn't return the
Subnet-Router anycast address.
"""
network = int(self.network_address)
broadcast = int(self.broadcast_address)
for x in long_range(1, bro... | [
"def",
"hosts",
"(",
"self",
")",
":",
"network",
"=",
"int",
"(",
"self",
".",
"network_address",
")",
"broadcast",
"=",
"int",
"(",
"self",
".",
"broadcast_address",
")",
"for",
"x",
"in",
"long_range",
"(",
"1",
",",
"broadcast",
"-",
"network",
"+"... | Generate Iterator over usable hosts in a network.
This is like __iter__ except it doesn't return the
Subnet-Router anycast address. | [
"Generate",
"Iterator",
"over",
"usable",
"hosts",
"in",
"a",
"network",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/ext/ipaddress.py#L2250-L2260 |
32,773 | saltstack/salt | salt/beacons/network_info.py | _to_list | def _to_list(obj):
'''
Convert snetinfo object to list
'''
ret = {}
for attr in __attrs:
if hasattr(obj, attr):
ret[attr] = getattr(obj, attr)
return ret | python | def _to_list(obj):
'''
Convert snetinfo object to list
'''
ret = {}
for attr in __attrs:
if hasattr(obj, attr):
ret[attr] = getattr(obj, attr)
return ret | [
"def",
"_to_list",
"(",
"obj",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"attr",
"in",
"__attrs",
":",
"if",
"hasattr",
"(",
"obj",
",",
"attr",
")",
":",
"ret",
"[",
"attr",
"]",
"=",
"getattr",
"(",
"obj",
",",
"attr",
")",
"return",
"ret"
] | Convert snetinfo object to list | [
"Convert",
"snetinfo",
"object",
"to",
"list"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/network_info.py#L33-L42 |
32,774 | saltstack/salt | salt/beacons/network_info.py | beacon | def beacon(config):
'''
Emit the network statistics of this host.
Specify thresholds for each network stat
and only emit a beacon if any of them are
exceeded.
Emit beacon when any values are equal to
configured values.
.. code-block:: yaml
beacons:
network_info:
... | python | def beacon(config):
'''
Emit the network statistics of this host.
Specify thresholds for each network stat
and only emit a beacon if any of them are
exceeded.
Emit beacon when any values are equal to
configured values.
.. code-block:: yaml
beacons:
network_info:
... | [
"def",
"beacon",
"(",
"config",
")",
":",
"ret",
"=",
"[",
"]",
"_config",
"=",
"{",
"}",
"list",
"(",
"map",
"(",
"_config",
".",
"update",
",",
"config",
")",
")",
"log",
".",
"debug",
"(",
"'psutil.net_io_counters %s'",
",",
"psutil",
".",
"net_io... | Emit the network statistics of this host.
Specify thresholds for each network stat
and only emit a beacon if any of them are
exceeded.
Emit beacon when any values are equal to
configured values.
.. code-block:: yaml
beacons:
network_info:
- interfaces:
... | [
"Emit",
"the",
"network",
"statistics",
"of",
"this",
"host",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/network_info.py#L81-L166 |
32,775 | saltstack/salt | salt/modules/apcups.py | status | def status():
'''
Return apcaccess output
CLI Example:
.. code-block:: bash
salt '*' apcups.status
'''
ret = {}
apcaccess = _check_apcaccess()
res = __salt__['cmd.run_all'](apcaccess)
retcode = res['retcode']
if retcode != 0:
ret['Error'] = 'Something with wron... | python | def status():
'''
Return apcaccess output
CLI Example:
.. code-block:: bash
salt '*' apcups.status
'''
ret = {}
apcaccess = _check_apcaccess()
res = __salt__['cmd.run_all'](apcaccess)
retcode = res['retcode']
if retcode != 0:
ret['Error'] = 'Something with wron... | [
"def",
"status",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"apcaccess",
"=",
"_check_apcaccess",
"(",
")",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"apcaccess",
")",
"retcode",
"=",
"res",
"[",
"'retcode'",
"]",
"if",
"retcode",
"!=",
"0",
... | Return apcaccess output
CLI Example:
.. code-block:: bash
salt '*' apcups.status | [
"Return",
"apcaccess",
"output"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/apcups.py#L42-L64 |
32,776 | saltstack/salt | salt/modules/apcups.py | status_charge | def status_charge():
'''
Return battery charge
CLI Example:
.. code-block:: bash
salt '*' apcups.status_charge
'''
data = status()
if 'BCHARGE' in data:
charge = data['BCHARGE'].split()
if charge[1].lower() == 'percent':
return float(charge[0])
ret... | python | def status_charge():
'''
Return battery charge
CLI Example:
.. code-block:: bash
salt '*' apcups.status_charge
'''
data = status()
if 'BCHARGE' in data:
charge = data['BCHARGE'].split()
if charge[1].lower() == 'percent':
return float(charge[0])
ret... | [
"def",
"status_charge",
"(",
")",
":",
"data",
"=",
"status",
"(",
")",
"if",
"'BCHARGE'",
"in",
"data",
":",
"charge",
"=",
"data",
"[",
"'BCHARGE'",
"]",
".",
"split",
"(",
")",
"if",
"charge",
"[",
"1",
"]",
".",
"lower",
"(",
")",
"==",
"'per... | Return battery charge
CLI Example:
.. code-block:: bash
salt '*' apcups.status_charge | [
"Return",
"battery",
"charge"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/apcups.py#L86-L102 |
32,777 | saltstack/salt | salt/states/esxi.py | coredump_configured | def coredump_configured(name, enabled, dump_ip, host_vnic='vmk0', dump_port=6500):
'''
Ensures a host's core dump configuration.
name
Name of the state.
enabled
Sets whether or not ESXi core dump collection should be enabled.
This is a boolean value set to ``True`` or ``False``... | python | def coredump_configured(name, enabled, dump_ip, host_vnic='vmk0', dump_port=6500):
'''
Ensures a host's core dump configuration.
name
Name of the state.
enabled
Sets whether or not ESXi core dump collection should be enabled.
This is a boolean value set to ``True`` or ``False``... | [
"def",
"coredump_configured",
"(",
"name",
",",
"enabled",
",",
"dump_ip",
",",
"host_vnic",
"=",
"'vmk0'",
",",
"dump_port",
"=",
"6500",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"False",
",",
"'changes'",
":",
"{",
"}",... | Ensures a host's core dump configuration.
name
Name of the state.
enabled
Sets whether or not ESXi core dump collection should be enabled.
This is a boolean value set to ``True`` or ``False`` to enable
or disable core dumps.
Note that ESXi requires that the core dump m... | [
"Ensures",
"a",
"host",
"s",
"core",
"dump",
"configuration",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/esxi.py#L139-L274 |
32,778 | saltstack/salt | salt/states/esxi.py | vmotion_configured | def vmotion_configured(name, enabled, device='vmk0'):
'''
Configures a host's VMotion properties such as enabling VMotion and setting
the device VirtualNic that VMotion will use.
name
Name of the state.
enabled
Ensures whether or not VMotion should be enabled on a host as a boolean... | python | def vmotion_configured(name, enabled, device='vmk0'):
'''
Configures a host's VMotion properties such as enabling VMotion and setting
the device VirtualNic that VMotion will use.
name
Name of the state.
enabled
Ensures whether or not VMotion should be enabled on a host as a boolean... | [
"def",
"vmotion_configured",
"(",
"name",
",",
"enabled",
",",
"device",
"=",
"'vmk0'",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"False",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
"}",
"esxi_cmd",
"=... | Configures a host's VMotion properties such as enabling VMotion and setting
the device VirtualNic that VMotion will use.
name
Name of the state.
enabled
Ensures whether or not VMotion should be enabled on a host as a boolean
value where ``True`` indicates that VMotion should be ena... | [
"Configures",
"a",
"host",
"s",
"VMotion",
"properties",
"such",
"as",
"enabling",
"VMotion",
"and",
"setting",
"the",
"device",
"VirtualNic",
"that",
"VMotion",
"will",
"use",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/esxi.py#L500-L569 |
32,779 | saltstack/salt | salt/states/esxi.py | vsan_configured | def vsan_configured(name, enabled, add_disks_to_vsan=False):
'''
Configures a host's VSAN properties such as enabling or disabling VSAN, or
adding VSAN-eligible disks to the VSAN system for the host.
name
Name of the state.
enabled
Ensures whether or not VSAN should be enabled on a... | python | def vsan_configured(name, enabled, add_disks_to_vsan=False):
'''
Configures a host's VSAN properties such as enabling or disabling VSAN, or
adding VSAN-eligible disks to the VSAN system for the host.
name
Name of the state.
enabled
Ensures whether or not VSAN should be enabled on a... | [
"def",
"vsan_configured",
"(",
"name",
",",
"enabled",
",",
"add_disks_to_vsan",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"False",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
"}",
"esxi_cmd... | Configures a host's VSAN properties such as enabling or disabling VSAN, or
adding VSAN-eligible disks to the VSAN system for the host.
name
Name of the state.
enabled
Ensures whether or not VSAN should be enabled on a host as a boolean
value where ``True`` indicates that VSAN shoul... | [
"Configures",
"a",
"host",
"s",
"VSAN",
"properties",
"such",
"as",
"enabling",
"or",
"disabling",
"VSAN",
"or",
"adding",
"VSAN",
"-",
"eligible",
"disks",
"to",
"the",
"VSAN",
"system",
"for",
"the",
"host",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/esxi.py#L572-L666 |
32,780 | saltstack/salt | salt/states/cimc.py | hostname | def hostname(name, hostname=None):
'''
Ensures that the hostname is set to the specified value.
.. versionadded:: 2019.2.0
name: The name of the module function to execute.
hostname(str): The hostname of the server.
SLS Example:
.. code-block:: yaml
set_name:
cimc.hos... | python | def hostname(name, hostname=None):
'''
Ensures that the hostname is set to the specified value.
.. versionadded:: 2019.2.0
name: The name of the module function to execute.
hostname(str): The hostname of the server.
SLS Example:
.. code-block:: yaml
set_name:
cimc.hos... | [
"def",
"hostname",
"(",
"name",
",",
"hostname",
"=",
"None",
")",
":",
"ret",
"=",
"_default_ret",
"(",
"name",
")",
"current_name",
"=",
"__salt__",
"[",
"'cimc.get_hostname'",
"]",
"(",
")",
"req_change",
"=",
"False",
"try",
":",
"if",
"current_name",
... | Ensures that the hostname is set to the specified value.
.. versionadded:: 2019.2.0
name: The name of the module function to execute.
hostname(str): The hostname of the server.
SLS Example:
.. code-block:: yaml
set_name:
cimc.hostname:
- hostname: foobar | [
"Ensures",
"that",
"the",
"hostname",
"is",
"set",
"to",
"the",
"specified",
"value",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cimc.py#L46-L100 |
32,781 | saltstack/salt | salt/states/cimc.py | ntp | def ntp(name, servers):
'''
Ensures that the NTP servers are configured. Servers are provided as an individual string or list format. Only four
NTP servers will be reviewed. Any entries past four will be ignored.
name: The name of the module function to execute.
servers(str, list): The IP address ... | python | def ntp(name, servers):
'''
Ensures that the NTP servers are configured. Servers are provided as an individual string or list format. Only four
NTP servers will be reviewed. Any entries past four will be ignored.
name: The name of the module function to execute.
servers(str, list): The IP address ... | [
"def",
"ntp",
"(",
"name",
",",
"servers",
")",
":",
"ret",
"=",
"_default_ret",
"(",
"name",
")",
"ntp_servers",
"=",
"[",
"''",
",",
"''",
",",
"''",
",",
"''",
"]",
"# Parse our server arguments",
"if",
"isinstance",
"(",
"servers",
",",
"list",
")"... | Ensures that the NTP servers are configured. Servers are provided as an individual string or list format. Only four
NTP servers will be reviewed. Any entries past four will be ignored.
name: The name of the module function to execute.
servers(str, list): The IP address or FQDN of the NTP servers.
SLS... | [
"Ensures",
"that",
"the",
"NTP",
"servers",
"are",
"configured",
".",
"Servers",
"are",
"provided",
"as",
"an",
"individual",
"string",
"or",
"list",
"format",
".",
"Only",
"four",
"NTP",
"servers",
"will",
"be",
"reviewed",
".",
"Any",
"entries",
"past",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cimc.py#L168-L247 |
32,782 | saltstack/salt | salt/states/cimc.py | power_configuration | def power_configuration(name, policy=None, delayType=None, delayValue=None):
'''
Ensures that the power configuration is configured on the system. This is
only available on some C-Series servers.
.. versionadded:: 2019.2.0
name: The name of the module function to execute.
policy(str): The act... | python | def power_configuration(name, policy=None, delayType=None, delayValue=None):
'''
Ensures that the power configuration is configured on the system. This is
only available on some C-Series servers.
.. versionadded:: 2019.2.0
name: The name of the module function to execute.
policy(str): The act... | [
"def",
"power_configuration",
"(",
"name",
",",
"policy",
"=",
"None",
",",
"delayType",
"=",
"None",
",",
"delayValue",
"=",
"None",
")",
":",
"ret",
"=",
"_default_ret",
"(",
"name",
")",
"power_conf",
"=",
"__salt__",
"[",
"'cimc.get_power_configuration'",
... | Ensures that the power configuration is configured on the system. This is
only available on some C-Series servers.
.. versionadded:: 2019.2.0
name: The name of the module function to execute.
policy(str): The action to be taken when chassis power is restored after
an unexpected power loss. This c... | [
"Ensures",
"that",
"the",
"power",
"configuration",
"is",
"configured",
"on",
"the",
"system",
".",
"This",
"is",
"only",
"available",
"on",
"some",
"C",
"-",
"Series",
"servers",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cimc.py#L250-L348 |
32,783 | saltstack/salt | salt/states/cimc.py | syslog | def syslog(name, primary=None, secondary=None):
'''
Ensures that the syslog servers are set to the specified values. A value of None will be ignored.
name: The name of the module function to execute.
primary(str): The IP address or FQDN of the primary syslog server.
secondary(str): The IP address... | python | def syslog(name, primary=None, secondary=None):
'''
Ensures that the syslog servers are set to the specified values. A value of None will be ignored.
name: The name of the module function to execute.
primary(str): The IP address or FQDN of the primary syslog server.
secondary(str): The IP address... | [
"def",
"syslog",
"(",
"name",
",",
"primary",
"=",
"None",
",",
"secondary",
"=",
"None",
")",
":",
"ret",
"=",
"_default_ret",
"(",
"name",
")",
"conf",
"=",
"__salt__",
"[",
"'cimc.get_syslog'",
"]",
"(",
")",
"req_change",
"=",
"False",
"if",
"prima... | Ensures that the syslog servers are set to the specified values. A value of None will be ignored.
name: The name of the module function to execute.
primary(str): The IP address or FQDN of the primary syslog server.
secondary(str): The IP address or FQDN of the secondary syslog server.
SLS Example:
... | [
"Ensures",
"that",
"the",
"syslog",
"servers",
"are",
"set",
"to",
"the",
"specified",
"values",
".",
"A",
"value",
"of",
"None",
"will",
"be",
"ignored",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cimc.py#L351-L434 |
32,784 | saltstack/salt | salt/states/cimc.py | user | def user(name, id='', user='', priv='', password='', status='active'):
'''
Ensures that a user is configured on the device. Due to being unable to
verify the user password. This is a forced operation.
.. versionadded:: 2019.2.0
name: The name of the module function to execute.
id(int): The us... | python | def user(name, id='', user='', priv='', password='', status='active'):
'''
Ensures that a user is configured on the device. Due to being unable to
verify the user password. This is a forced operation.
.. versionadded:: 2019.2.0
name: The name of the module function to execute.
id(int): The us... | [
"def",
"user",
"(",
"name",
",",
"id",
"=",
"''",
",",
"user",
"=",
"''",
",",
"priv",
"=",
"''",
",",
"password",
"=",
"''",
",",
"status",
"=",
"'active'",
")",
":",
"ret",
"=",
"_default_ret",
"(",
"name",
")",
"user_conf",
"=",
"__salt__",
"[... | Ensures that a user is configured on the device. Due to being unable to
verify the user password. This is a forced operation.
.. versionadded:: 2019.2.0
name: The name of the module function to execute.
id(int): The user ID slot on the device.
user(str): The username of the user.
priv(str):... | [
"Ensures",
"that",
"a",
"user",
"is",
"configured",
"on",
"the",
"device",
".",
"Due",
"to",
"being",
"unable",
"to",
"verify",
"the",
"user",
"password",
".",
"This",
"is",
"a",
"forced",
"operation",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cimc.py#L437-L503 |
32,785 | saltstack/salt | salt/cli/key.py | SaltKey.run | def run(self):
'''
Execute salt-key
'''
import salt.key
self.parse_args()
self.setup_logfile_logger()
verify_log(self.config)
key = salt.key.KeyCLI(self.config)
if check_user(self.config['user']):
key.run() | python | def run(self):
'''
Execute salt-key
'''
import salt.key
self.parse_args()
self.setup_logfile_logger()
verify_log(self.config)
key = salt.key.KeyCLI(self.config)
if check_user(self.config['user']):
key.run() | [
"def",
"run",
"(",
"self",
")",
":",
"import",
"salt",
".",
"key",
"self",
".",
"parse_args",
"(",
")",
"self",
".",
"setup_logfile_logger",
"(",
")",
"verify_log",
"(",
"self",
".",
"config",
")",
"key",
"=",
"salt",
".",
"key",
".",
"KeyCLI",
"(",
... | Execute salt-key | [
"Execute",
"salt",
"-",
"key"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/key.py#L14-L26 |
32,786 | saltstack/salt | salt/sdb/tism.py | get | def get(key, service=None, profile=None): # pylint: disable=W0613
'''
Get a decrypted secret from the tISMd API
'''
if not profile.get('url') or not profile.get('token'):
raise SaltConfigurationError("url and/or token missing from the tism sdb profile")
request = {"token": profile['token'... | python | def get(key, service=None, profile=None): # pylint: disable=W0613
'''
Get a decrypted secret from the tISMd API
'''
if not profile.get('url') or not profile.get('token'):
raise SaltConfigurationError("url and/or token missing from the tism sdb profile")
request = {"token": profile['token'... | [
"def",
"get",
"(",
"key",
",",
"service",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"# pylint: disable=W0613",
"if",
"not",
"profile",
".",
"get",
"(",
"'url'",
")",
"or",
"not",
"profile",
".",
"get",
"(",
"'token'",
")",
":",
"raise",
"Sa... | Get a decrypted secret from the tISMd API | [
"Get",
"a",
"decrypted",
"secret",
"from",
"the",
"tISMd",
"API"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/tism.py#L53-L78 |
32,787 | saltstack/salt | salt/pillar/postgres.py | ext_pillar | def ext_pillar(minion_id,
pillar,
*args,
**kwargs):
'''
Execute queries against POSTGRES, merge and return as a dict
'''
return POSTGRESExtPillar().fetch(minion_id, pillar, *args, **kwargs) | python | def ext_pillar(minion_id,
pillar,
*args,
**kwargs):
'''
Execute queries against POSTGRES, merge and return as a dict
'''
return POSTGRESExtPillar().fetch(minion_id, pillar, *args, **kwargs) | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"pillar",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"POSTGRESExtPillar",
"(",
")",
".",
"fetch",
"(",
"minion_id",
",",
"pillar",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Execute queries against POSTGRES, merge and return as a dict | [
"Execute",
"queries",
"against",
"POSTGRES",
"merge",
"and",
"return",
"as",
"a",
"dict"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/postgres.py#L112-L119 |
32,788 | saltstack/salt | salt/pillar/postgres.py | POSTGRESExtPillar._get_cursor | def _get_cursor(self):
'''
Yield a POSTGRES cursor
'''
_options = self._get_options()
conn = psycopg2.connect(host=_options['host'],
user=_options['user'],
password=_options['pass'],
d... | python | def _get_cursor(self):
'''
Yield a POSTGRES cursor
'''
_options = self._get_options()
conn = psycopg2.connect(host=_options['host'],
user=_options['user'],
password=_options['pass'],
d... | [
"def",
"_get_cursor",
"(",
"self",
")",
":",
"_options",
"=",
"self",
".",
"_get_options",
"(",
")",
"conn",
"=",
"psycopg2",
".",
"connect",
"(",
"host",
"=",
"_options",
"[",
"'host'",
"]",
",",
"user",
"=",
"_options",
"[",
"'user'",
"]",
",",
"pa... | Yield a POSTGRES cursor | [
"Yield",
"a",
"POSTGRES",
"cursor"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/postgres.py#L85-L102 |
32,789 | saltstack/salt | salt/modules/ps.py | _get_proc_cmdline | def _get_proc_cmdline(proc):
'''
Returns the cmdline of a Process instance.
It's backward compatible with < 2.0 versions of psutil.
'''
try:
return salt.utils.data.decode(proc.cmdline() if PSUTIL2 else proc.cmdline)
except (psutil.NoSuchProcess, psutil.AccessDenied):
return [] | python | def _get_proc_cmdline(proc):
'''
Returns the cmdline of a Process instance.
It's backward compatible with < 2.0 versions of psutil.
'''
try:
return salt.utils.data.decode(proc.cmdline() if PSUTIL2 else proc.cmdline)
except (psutil.NoSuchProcess, psutil.AccessDenied):
return [] | [
"def",
"_get_proc_cmdline",
"(",
"proc",
")",
":",
"try",
":",
"return",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"proc",
".",
"cmdline",
"(",
")",
"if",
"PSUTIL2",
"else",
"proc",
".",
"cmdline",
")",
"except",
"(",
"psutil",
".",
"NoS... | Returns the cmdline of a Process instance.
It's backward compatible with < 2.0 versions of psutil. | [
"Returns",
"the",
"cmdline",
"of",
"a",
"Process",
"instance",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L50-L59 |
32,790 | saltstack/salt | salt/modules/ps.py | _get_proc_create_time | def _get_proc_create_time(proc):
'''
Returns the create_time of a Process instance.
It's backward compatible with < 2.0 versions of psutil.
'''
try:
return salt.utils.data.decode(proc.create_time() if PSUTIL2 else proc.create_time)
except (psutil.NoSuchProcess, psutil.AccessDenied):
... | python | def _get_proc_create_time(proc):
'''
Returns the create_time of a Process instance.
It's backward compatible with < 2.0 versions of psutil.
'''
try:
return salt.utils.data.decode(proc.create_time() if PSUTIL2 else proc.create_time)
except (psutil.NoSuchProcess, psutil.AccessDenied):
... | [
"def",
"_get_proc_create_time",
"(",
"proc",
")",
":",
"try",
":",
"return",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"proc",
".",
"create_time",
"(",
")",
"if",
"PSUTIL2",
"else",
"proc",
".",
"create_time",
")",
"except",
"(",
"psutil",
... | Returns the create_time of a Process instance.
It's backward compatible with < 2.0 versions of psutil. | [
"Returns",
"the",
"create_time",
"of",
"a",
"Process",
"instance",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L62-L71 |
32,791 | saltstack/salt | salt/modules/ps.py | _get_proc_name | def _get_proc_name(proc):
'''
Returns the name of a Process instance.
It's backward compatible with < 2.0 versions of psutil.
'''
try:
return salt.utils.data.decode(proc.name() if PSUTIL2 else proc.name)
except (psutil.NoSuchProcess, psutil.AccessDenied):
return [] | python | def _get_proc_name(proc):
'''
Returns the name of a Process instance.
It's backward compatible with < 2.0 versions of psutil.
'''
try:
return salt.utils.data.decode(proc.name() if PSUTIL2 else proc.name)
except (psutil.NoSuchProcess, psutil.AccessDenied):
return [] | [
"def",
"_get_proc_name",
"(",
"proc",
")",
":",
"try",
":",
"return",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"proc",
".",
"name",
"(",
")",
"if",
"PSUTIL2",
"else",
"proc",
".",
"name",
")",
"except",
"(",
"psutil",
".",
"NoSuchProces... | Returns the name of a Process instance.
It's backward compatible with < 2.0 versions of psutil. | [
"Returns",
"the",
"name",
"of",
"a",
"Process",
"instance",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L74-L83 |
32,792 | saltstack/salt | salt/modules/ps.py | _get_proc_status | def _get_proc_status(proc):
'''
Returns the status of a Process instance.
It's backward compatible with < 2.0 versions of psutil.
'''
try:
return salt.utils.data.decode(proc.status() if PSUTIL2 else proc.status)
except (psutil.NoSuchProcess, psutil.AccessDenied):
return None | python | def _get_proc_status(proc):
'''
Returns the status of a Process instance.
It's backward compatible with < 2.0 versions of psutil.
'''
try:
return salt.utils.data.decode(proc.status() if PSUTIL2 else proc.status)
except (psutil.NoSuchProcess, psutil.AccessDenied):
return None | [
"def",
"_get_proc_status",
"(",
"proc",
")",
":",
"try",
":",
"return",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"proc",
".",
"status",
"(",
")",
"if",
"PSUTIL2",
"else",
"proc",
".",
"status",
")",
"except",
"(",
"psutil",
".",
"NoSuch... | Returns the status of a Process instance.
It's backward compatible with < 2.0 versions of psutil. | [
"Returns",
"the",
"status",
"of",
"a",
"Process",
"instance",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L86-L95 |
32,793 | saltstack/salt | salt/modules/ps.py | _get_proc_username | def _get_proc_username(proc):
'''
Returns the username of a Process instance.
It's backward compatible with < 2.0 versions of psutil.
'''
try:
return salt.utils.data.decode(proc.username() if PSUTIL2 else proc.username)
except (psutil.NoSuchProcess, psutil.AccessDenied, KeyError):
... | python | def _get_proc_username(proc):
'''
Returns the username of a Process instance.
It's backward compatible with < 2.0 versions of psutil.
'''
try:
return salt.utils.data.decode(proc.username() if PSUTIL2 else proc.username)
except (psutil.NoSuchProcess, psutil.AccessDenied, KeyError):
... | [
"def",
"_get_proc_username",
"(",
"proc",
")",
":",
"try",
":",
"return",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"proc",
".",
"username",
"(",
")",
"if",
"PSUTIL2",
"else",
"proc",
".",
"username",
")",
"except",
"(",
"psutil",
".",
"... | Returns the username of a Process instance.
It's backward compatible with < 2.0 versions of psutil. | [
"Returns",
"the",
"username",
"of",
"a",
"Process",
"instance",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L98-L107 |
32,794 | saltstack/salt | salt/modules/ps.py | top | def top(num_processes=5, interval=3):
'''
Return a list of top CPU consuming processes during the interval.
num_processes = return the top N CPU consuming processes
interval = the number of seconds to sample CPU usage over
CLI Examples:
.. code-block:: bash
salt '*' ps.top
sa... | python | def top(num_processes=5, interval=3):
'''
Return a list of top CPU consuming processes during the interval.
num_processes = return the top N CPU consuming processes
interval = the number of seconds to sample CPU usage over
CLI Examples:
.. code-block:: bash
salt '*' ps.top
sa... | [
"def",
"top",
"(",
"num_processes",
"=",
"5",
",",
"interval",
"=",
"3",
")",
":",
"result",
"=",
"[",
"]",
"start_usage",
"=",
"{",
"}",
"for",
"pid",
"in",
"psutil",
".",
"pids",
"(",
")",
":",
"try",
":",
"process",
"=",
"psutil",
".",
"Proces... | Return a list of top CPU consuming processes during the interval.
num_processes = return the top N CPU consuming processes
interval = the number of seconds to sample CPU usage over
CLI Examples:
.. code-block:: bash
salt '*' ps.top
salt '*' ps.top 5 10 | [
"Return",
"a",
"list",
"of",
"top",
"CPU",
"consuming",
"processes",
"during",
"the",
"interval",
".",
"num_processes",
"=",
"return",
"the",
"top",
"N",
"CPU",
"consuming",
"processes",
"interval",
"=",
"the",
"number",
"of",
"seconds",
"to",
"sample",
"CPU... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L119-L178 |
32,795 | saltstack/salt | salt/modules/ps.py | kill_pid | def kill_pid(pid, signal=15):
'''
Kill a process by PID.
.. code-block:: bash
salt 'minion' ps.kill_pid pid [signal=signal_number]
pid
PID of process to kill.
signal
Signal to send to the process. See manpage entry for kill
for possible values. Default: 15 (SIGTER... | python | def kill_pid(pid, signal=15):
'''
Kill a process by PID.
.. code-block:: bash
salt 'minion' ps.kill_pid pid [signal=signal_number]
pid
PID of process to kill.
signal
Signal to send to the process. See manpage entry for kill
for possible values. Default: 15 (SIGTER... | [
"def",
"kill_pid",
"(",
"pid",
",",
"signal",
"=",
"15",
")",
":",
"try",
":",
"psutil",
".",
"Process",
"(",
"pid",
")",
".",
"send_signal",
"(",
"signal",
")",
"return",
"True",
"except",
"psutil",
".",
"NoSuchProcess",
":",
"return",
"False"
] | Kill a process by PID.
.. code-block:: bash
salt 'minion' ps.kill_pid pid [signal=signal_number]
pid
PID of process to kill.
signal
Signal to send to the process. See manpage entry for kill
for possible values. Default: 15 (SIGTERM).
**Example:**
Send SIGKILL to... | [
"Kill",
"a",
"process",
"by",
"PID",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L220-L247 |
32,796 | saltstack/salt | salt/modules/ps.py | pkill | def pkill(pattern, user=None, signal=15, full=False):
'''
Kill processes matching a pattern.
.. code-block:: bash
salt '*' ps.pkill pattern [user=username] [signal=signal_number] \\
[full=(true|false)]
pattern
Pattern to search for in the process list.
user
... | python | def pkill(pattern, user=None, signal=15, full=False):
'''
Kill processes matching a pattern.
.. code-block:: bash
salt '*' ps.pkill pattern [user=username] [signal=signal_number] \\
[full=(true|false)]
pattern
Pattern to search for in the process list.
user
... | [
"def",
"pkill",
"(",
"pattern",
",",
"user",
"=",
"None",
",",
"signal",
"=",
"15",
",",
"full",
"=",
"False",
")",
":",
"killed",
"=",
"[",
"]",
"for",
"proc",
"in",
"psutil",
".",
"process_iter",
"(",
")",
":",
"name_match",
"=",
"pattern",
"in",... | Kill processes matching a pattern.
.. code-block:: bash
salt '*' ps.pkill pattern [user=username] [signal=signal_number] \\
[full=(true|false)]
pattern
Pattern to search for in the process list.
user
Limit matches to the given username. Default: All users.
si... | [
"Kill",
"processes",
"matching",
"a",
"pattern",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L250-L302 |
32,797 | saltstack/salt | salt/modules/ps.py | pgrep | def pgrep(pattern, user=None, full=False, pattern_is_regex=False):
'''
Return the pids for processes matching a pattern.
If full is true, the full command line is searched for a match,
otherwise only the name of the command is searched.
.. code-block:: bash
salt '*' ps.pgrep pattern [user... | python | def pgrep(pattern, user=None, full=False, pattern_is_regex=False):
'''
Return the pids for processes matching a pattern.
If full is true, the full command line is searched for a match,
otherwise only the name of the command is searched.
.. code-block:: bash
salt '*' ps.pgrep pattern [user... | [
"def",
"pgrep",
"(",
"pattern",
",",
"user",
"=",
"None",
",",
"full",
"=",
"False",
",",
"pattern_is_regex",
"=",
"False",
")",
":",
"procs",
"=",
"[",
"]",
"if",
"pattern_is_regex",
":",
"pattern",
"=",
"re",
".",
"compile",
"(",
"str",
"(",
"patte... | Return the pids for processes matching a pattern.
If full is true, the full command line is searched for a match,
otherwise only the name of the command is searched.
.. code-block:: bash
salt '*' ps.pgrep pattern [user=username] [full=(true|false)]
pattern
Pattern to search for in th... | [
"Return",
"the",
"pids",
"for",
"processes",
"matching",
"a",
"pattern",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L305-L368 |
32,798 | saltstack/salt | salt/modules/ps.py | cpu_percent | def cpu_percent(interval=0.1, per_cpu=False):
'''
Return the percent of time the CPU is busy.
interval
the number of seconds to sample CPU usage over
per_cpu
if True return an array of CPU percent busy for each CPU, otherwise
aggregate all percents into one number
CLI Examp... | python | def cpu_percent(interval=0.1, per_cpu=False):
'''
Return the percent of time the CPU is busy.
interval
the number of seconds to sample CPU usage over
per_cpu
if True return an array of CPU percent busy for each CPU, otherwise
aggregate all percents into one number
CLI Examp... | [
"def",
"cpu_percent",
"(",
"interval",
"=",
"0.1",
",",
"per_cpu",
"=",
"False",
")",
":",
"if",
"per_cpu",
":",
"result",
"=",
"list",
"(",
"psutil",
".",
"cpu_percent",
"(",
"interval",
",",
"True",
")",
")",
"else",
":",
"result",
"=",
"psutil",
"... | Return the percent of time the CPU is busy.
interval
the number of seconds to sample CPU usage over
per_cpu
if True return an array of CPU percent busy for each CPU, otherwise
aggregate all percents into one number
CLI Example:
.. code-block:: bash
salt '*' ps.cpu_per... | [
"Return",
"the",
"percent",
"of",
"time",
"the",
"CPU",
"is",
"busy",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L371-L391 |
32,799 | saltstack/salt | salt/modules/ps.py | disk_partitions | def disk_partitions(all=False):
'''
Return a list of disk partitions and their device, mount point, and
filesystem type.
all
if set to False, only return local, physical partitions (hard disk,
USB, CD/DVD partitions). If True, return all filesystems.
CLI Example:
.. code-bloc... | python | def disk_partitions(all=False):
'''
Return a list of disk partitions and their device, mount point, and
filesystem type.
all
if set to False, only return local, physical partitions (hard disk,
USB, CD/DVD partitions). If True, return all filesystems.
CLI Example:
.. code-bloc... | [
"def",
"disk_partitions",
"(",
"all",
"=",
"False",
")",
":",
"result",
"=",
"[",
"dict",
"(",
"partition",
".",
"_asdict",
"(",
")",
")",
"for",
"partition",
"in",
"psutil",
".",
"disk_partitions",
"(",
"all",
")",
"]",
"return",
"result"
] | Return a list of disk partitions and their device, mount point, and
filesystem type.
all
if set to False, only return local, physical partitions (hard disk,
USB, CD/DVD partitions). If True, return all filesystems.
CLI Example:
.. code-block:: bash
salt '*' ps.disk_partition... | [
"Return",
"a",
"list",
"of",
"disk",
"partitions",
"and",
"their",
"device",
"mount",
"point",
"and",
"filesystem",
"type",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L460-L477 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.