repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/lxc.py | _run | def _run(name,
cmd,
output=None,
no_start=False,
preserve_state=True,
stdin=None,
python_shell=True,
output_loglevel='debug',
use_vt=False,
path=None,
ignore_retcode=False,
chroot_fallback=None,
keep_env='http_pr... | python | def _run(name,
cmd,
output=None,
no_start=False,
preserve_state=True,
stdin=None,
python_shell=True,
output_loglevel='debug',
use_vt=False,
path=None,
ignore_retcode=False,
chroot_fallback=None,
keep_env='http_pr... | [
"def",
"_run",
"(",
"name",
",",
"cmd",
",",
"output",
"=",
"None",
",",
"no_start",
"=",
"False",
",",
"preserve_state",
"=",
"True",
",",
"stdin",
"=",
"None",
",",
"python_shell",
"=",
"True",
",",
"output_loglevel",
"=",
"'debug'",
",",
"use_vt",
"... | Common logic for lxc.run functions
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0 | [
"Common",
"logic",
"for",
"lxc",
".",
"run",
"functions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L3623-L3691 | train |
saltstack/salt | salt/modules/lxc.py | run | def run(name,
cmd,
no_start=False,
preserve_state=True,
stdin=None,
python_shell=True,
output_loglevel='debug',
use_vt=False,
path=None,
ignore_retcode=False,
chroot_fallback=False,
keep_env='http_proxy,https_proxy,no_proxy'):
'... | python | def run(name,
cmd,
no_start=False,
preserve_state=True,
stdin=None,
python_shell=True,
output_loglevel='debug',
use_vt=False,
path=None,
ignore_retcode=False,
chroot_fallback=False,
keep_env='http_proxy,https_proxy,no_proxy'):
'... | [
"def",
"run",
"(",
"name",
",",
"cmd",
",",
"no_start",
"=",
"False",
",",
"preserve_state",
"=",
"True",
",",
"stdin",
"=",
"None",
",",
"python_shell",
"=",
"True",
",",
"output_loglevel",
"=",
"'debug'",
",",
"use_vt",
"=",
"False",
",",
"path",
"="... | .. versionadded:: 2015.8.0
Run :mod:`cmd.run <salt.modules.cmdmod.run>` within a container
.. warning::
Many shell builtins do not work, failing with stderr similar to the
following:
.. code-block:: bash
lxc_container: No such file or directory - failed to exec 'command'... | [
"..",
"versionadded",
"::",
"2015",
".",
"8",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L3694-L3780 | train |
saltstack/salt | salt/modules/lxc.py | _get_md5 | def _get_md5(name, path):
'''
Get the MD5 checksum of a file from a container
'''
output = run_stdout(name, 'md5sum "{0}"'.format(path),
chroot_fallback=True,
ignore_retcode=True)
try:
return output.split()[0]
except IndexError:
# D... | python | def _get_md5(name, path):
'''
Get the MD5 checksum of a file from a container
'''
output = run_stdout(name, 'md5sum "{0}"'.format(path),
chroot_fallback=True,
ignore_retcode=True)
try:
return output.split()[0]
except IndexError:
# D... | [
"def",
"_get_md5",
"(",
"name",
",",
"path",
")",
":",
"output",
"=",
"run_stdout",
"(",
"name",
",",
"'md5sum \"{0}\"'",
".",
"format",
"(",
"path",
")",
",",
"chroot_fallback",
"=",
"True",
",",
"ignore_retcode",
"=",
"True",
")",
"try",
":",
"return",... | Get the MD5 checksum of a file from a container | [
"Get",
"the",
"MD5",
"checksum",
"of",
"a",
"file",
"from",
"a",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L4141-L4152 | train |
saltstack/salt | salt/modules/lxc.py | copy_to | def copy_to(name, source, dest, overwrite=False, makedirs=False, path=None):
'''
.. versionchanged:: 2015.8.0
Function renamed from ``lxc.cp`` to ``lxc.copy_to`` for consistency
with other container types. ``lxc.cp`` will continue to work, however.
For versions 2015.2.x and earlier, use ... | python | def copy_to(name, source, dest, overwrite=False, makedirs=False, path=None):
'''
.. versionchanged:: 2015.8.0
Function renamed from ``lxc.cp`` to ``lxc.copy_to`` for consistency
with other container types. ``lxc.cp`` will continue to work, however.
For versions 2015.2.x and earlier, use ... | [
"def",
"copy_to",
"(",
"name",
",",
"source",
",",
"dest",
",",
"overwrite",
"=",
"False",
",",
"makedirs",
"=",
"False",
",",
"path",
"=",
"None",
")",
":",
"_ensure_running",
"(",
"name",
",",
"no_start",
"=",
"True",
",",
"path",
"=",
"path",
")",... | .. versionchanged:: 2015.8.0
Function renamed from ``lxc.cp`` to ``lxc.copy_to`` for consistency
with other container types. ``lxc.cp`` will continue to work, however.
For versions 2015.2.x and earlier, use ``lxc.cp``.
Copy a file or directory from the host into a container
name
... | [
"..",
"versionchanged",
"::",
"2015",
".",
"8",
".",
"0",
"Function",
"renamed",
"from",
"lxc",
".",
"cp",
"to",
"lxc",
".",
"copy_to",
"for",
"consistency",
"with",
"other",
"container",
"types",
".",
"lxc",
".",
"cp",
"will",
"continue",
"to",
"work",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L4155-L4212 | train |
saltstack/salt | salt/modules/lxc.py | read_conf | def read_conf(conf_file, out_format='simple'):
'''
Read in an LXC configuration file. By default returns a simple, unsorted
dict, but can also return a more detailed structure including blank lines
and comments.
out_format:
set to 'simple' if you need the old and unsupported behavior.
... | python | def read_conf(conf_file, out_format='simple'):
'''
Read in an LXC configuration file. By default returns a simple, unsorted
dict, but can also return a more detailed structure including blank lines
and comments.
out_format:
set to 'simple' if you need the old and unsupported behavior.
... | [
"def",
"read_conf",
"(",
"conf_file",
",",
"out_format",
"=",
"'simple'",
")",
":",
"ret_commented",
"=",
"[",
"]",
"ret_simple",
"=",
"{",
"}",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"conf_file",
",",
"'r'",
")",
"as",
"fp_",
... | Read in an LXC configuration file. By default returns a simple, unsorted
dict, but can also return a more detailed structure including blank lines
and comments.
out_format:
set to 'simple' if you need the old and unsupported behavior.
This won't support the multiple lxc values (eg: multiple... | [
"Read",
"in",
"an",
"LXC",
"configuration",
"file",
".",
"By",
"default",
"returns",
"a",
"simple",
"unsorted",
"dict",
"but",
"can",
"also",
"return",
"a",
"more",
"detailed",
"structure",
"including",
"blank",
"lines",
"and",
"comments",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L4218-L4259 | train |
saltstack/salt | salt/modules/lxc.py | write_conf | def write_conf(conf_file, conf):
'''
Write out an LXC configuration file
This is normally only used internally. The format of the data structure
must match that which is returned from ``lxc.read_conf()``, with
``out_format`` set to ``commented``.
An example might look like:
.. code-block:... | python | def write_conf(conf_file, conf):
'''
Write out an LXC configuration file
This is normally only used internally. The format of the data structure
must match that which is returned from ``lxc.read_conf()``, with
``out_format`` set to ``commented``.
An example might look like:
.. code-block:... | [
"def",
"write_conf",
"(",
"conf_file",
",",
"conf",
")",
":",
"if",
"not",
"isinstance",
"(",
"conf",
",",
"list",
")",
":",
"raise",
"SaltInvocationError",
"(",
"'Configuration must be passed as a list'",
")",
"# construct the content prior to write to the file",
"# to... | Write out an LXC configuration file
This is normally only used internally. The format of the data structure
must match that which is returned from ``lxc.read_conf()``, with
``out_format`` set to ``commented``.
An example might look like:
.. code-block:: python
[
{'lxc.utsname... | [
"Write",
"out",
"an",
"LXC",
"configuration",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L4262-L4323 | train |
saltstack/salt | salt/modules/lxc.py | edit_conf | def edit_conf(conf_file,
out_format='simple',
read_only=False,
lxc_config=None,
**kwargs):
'''
Edit an LXC configuration file. If a setting is already present inside the
file, its value will be replaced. If it does not exist, it will be appended
to... | python | def edit_conf(conf_file,
out_format='simple',
read_only=False,
lxc_config=None,
**kwargs):
'''
Edit an LXC configuration file. If a setting is already present inside the
file, its value will be replaced. If it does not exist, it will be appended
to... | [
"def",
"edit_conf",
"(",
"conf_file",
",",
"out_format",
"=",
"'simple'",
",",
"read_only",
"=",
"False",
",",
"lxc_config",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"[",
"]",
"try",
":",
"conf",
"=",
"read_conf",
"(",
"conf_file",
... | Edit an LXC configuration file. If a setting is already present inside the
file, its value will be replaced. If it does not exist, it will be appended
to the end of the file. Comments and blank lines will be kept in-tact if
they already exist in the file.
out_format:
Set to simple if you need b... | [
"Edit",
"an",
"LXC",
"configuration",
"file",
".",
"If",
"a",
"setting",
"is",
"already",
"present",
"inside",
"the",
"file",
"its",
"value",
"will",
"be",
"replaced",
".",
"If",
"it",
"does",
"not",
"exist",
"it",
"will",
"be",
"appended",
"to",
"the",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L4326-L4436 | train |
saltstack/salt | salt/modules/lxc.py | reboot | def reboot(name, path=None):
'''
Reboot a container.
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
CLI Examples:
.. code-block:: bash
salt 'minion' lxc.reboot myvm
'''
ret = {'result': True,
... | python | def reboot(name, path=None):
'''
Reboot a container.
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
CLI Examples:
.. code-block:: bash
salt 'minion' lxc.reboot myvm
'''
ret = {'result': True,
... | [
"def",
"reboot",
"(",
"name",
",",
"path",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'result'",
":",
"True",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"'{0} rebooted'",
".",
"format",
"(",
"name",
")",
"}",
"does_exist",
"=",
"exists",
... | Reboot a container.
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
CLI Examples:
.. code-block:: bash
salt 'minion' lxc.reboot myvm | [
"Reboot",
"a",
"container",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L4439-L4476 | train |
saltstack/salt | salt/modules/lxc.py | reconfigure | def reconfigure(name,
cpu=None,
cpuset=None,
cpushare=None,
memory=None,
profile=None,
network_profile=None,
nic_opts=None,
bridge=None,
gateway=None,
autostart... | python | def reconfigure(name,
cpu=None,
cpuset=None,
cpushare=None,
memory=None,
profile=None,
network_profile=None,
nic_opts=None,
bridge=None,
gateway=None,
autostart... | [
"def",
"reconfigure",
"(",
"name",
",",
"cpu",
"=",
"None",
",",
"cpuset",
"=",
"None",
",",
"cpushare",
"=",
"None",
",",
"memory",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"network_profile",
"=",
"None",
",",
"nic_opts",
"=",
"None",
",",
"br... | Reconfigure a container.
This only applies to a few property
name
Name of the container.
utsname
utsname of the container.
.. versionadded:: 2016.3.0
rootfs
rootfs of the container.
.. versionadded:: 2016.3.0
cpu
Select a random number of cpu cor... | [
"Reconfigure",
"a",
"container",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L4479-L4608 | train |
saltstack/salt | salt/modules/lxc.py | apply_network_profile | def apply_network_profile(name, network_profile, nic_opts=None, path=None):
'''
.. versionadded:: 2015.5.0
Apply a network profile to a container
network_profile
profile name or default values (dict)
nic_opts
values to override in defaults (dict)
indexed by nic card names
... | python | def apply_network_profile(name, network_profile, nic_opts=None, path=None):
'''
.. versionadded:: 2015.5.0
Apply a network profile to a container
network_profile
profile name or default values (dict)
nic_opts
values to override in defaults (dict)
indexed by nic card names
... | [
"def",
"apply_network_profile",
"(",
"name",
",",
"network_profile",
",",
"nic_opts",
"=",
"None",
",",
"path",
"=",
"None",
")",
":",
"cpath",
"=",
"get_root_path",
"(",
"path",
")",
"cfgpath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"cpath",
",",
"... | .. versionadded:: 2015.5.0
Apply a network profile to a container
network_profile
profile name or default values (dict)
nic_opts
values to override in defaults (dict)
indexed by nic card names
path
path to the container parent
.. versionadded:: 2015.8.0
... | [
"..",
"versionadded",
"::",
"2015",
".",
"5",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L4611-L4678 | train |
saltstack/salt | salt/modules/lxc.py | get_pid | def get_pid(name, path=None):
'''
Returns a container pid.
Throw an exception if the container isn't running.
CLI Example:
.. code-block:: bash
salt '*' lxc.get_pid name
'''
if name not in list_(limit='running', path=path):
raise CommandExecutionError('Container {0} is not... | python | def get_pid(name, path=None):
'''
Returns a container pid.
Throw an exception if the container isn't running.
CLI Example:
.. code-block:: bash
salt '*' lxc.get_pid name
'''
if name not in list_(limit='running', path=path):
raise CommandExecutionError('Container {0} is not... | [
"def",
"get_pid",
"(",
"name",
",",
"path",
"=",
"None",
")",
":",
"if",
"name",
"not",
"in",
"list_",
"(",
"limit",
"=",
"'running'",
",",
"path",
"=",
"path",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'Container {0} is not running, can\\'t determine ... | Returns a container pid.
Throw an exception if the container isn't running.
CLI Example:
.. code-block:: bash
salt '*' lxc.get_pid name | [
"Returns",
"a",
"container",
"pid",
".",
"Throw",
"an",
"exception",
"if",
"the",
"container",
"isn",
"t",
"running",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L4681-L4696 | train |
saltstack/salt | salt/modules/lxc.py | add_veth | def add_veth(name, interface_name, bridge=None, path=None):
'''
Add a veth to a container.
Note : this function doesn't update the container config, just add the interface at runtime
name
Name of the container
interface_name
Name of the interface in the container
bridge
... | python | def add_veth(name, interface_name, bridge=None, path=None):
'''
Add a veth to a container.
Note : this function doesn't update the container config, just add the interface at runtime
name
Name of the container
interface_name
Name of the interface in the container
bridge
... | [
"def",
"add_veth",
"(",
"name",
",",
"interface_name",
",",
"bridge",
"=",
"None",
",",
"path",
"=",
"None",
")",
":",
"# Get container init PID",
"pid",
"=",
"get_pid",
"(",
"name",
",",
"path",
"=",
"path",
")",
"# Generate a ramdom string for veth and ensure ... | Add a veth to a container.
Note : this function doesn't update the container config, just add the interface at runtime
name
Name of the container
interface_name
Name of the interface in the container
bridge
Name of the bridge to attach the interface to (facultative)
CLI E... | [
"Add",
"a",
"veth",
"to",
"a",
"container",
".",
"Note",
":",
"this",
"function",
"doesn",
"t",
"update",
"the",
"container",
"config",
"just",
"add",
"the",
"interface",
"at",
"runtime"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L4699-L4778 | train |
saltstack/salt | salt/modules/lxc.py | _LXCConfig._filter_data | def _filter_data(self, pattern):
'''
Removes parameters which match the pattern from the config data
'''
removed = []
filtered = []
for param in self.data:
if not param[0].startswith(pattern):
filtered.append(param)
else:
... | python | def _filter_data(self, pattern):
'''
Removes parameters which match the pattern from the config data
'''
removed = []
filtered = []
for param in self.data:
if not param[0].startswith(pattern):
filtered.append(param)
else:
... | [
"def",
"_filter_data",
"(",
"self",
",",
"pattern",
")",
":",
"removed",
"=",
"[",
"]",
"filtered",
"=",
"[",
"]",
"for",
"param",
"in",
"self",
".",
"data",
":",
"if",
"not",
"param",
"[",
"0",
"]",
".",
"startswith",
"(",
"pattern",
")",
":",
"... | Removes parameters which match the pattern from the config data | [
"Removes",
"parameters",
"which",
"match",
"the",
"pattern",
"from",
"the",
"config",
"data"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L1055-L1067 | train |
saltstack/salt | salt/engines/script.py | _get_serializer | def _get_serializer(output):
'''
Helper to return known serializer based on
pass output argument
'''
serializers = salt.loader.serializers(__opts__)
try:
return getattr(serializers, output)
except AttributeError:
raise CommandExecutionError(
"Unknown serializer '{... | python | def _get_serializer(output):
'''
Helper to return known serializer based on
pass output argument
'''
serializers = salt.loader.serializers(__opts__)
try:
return getattr(serializers, output)
except AttributeError:
raise CommandExecutionError(
"Unknown serializer '{... | [
"def",
"_get_serializer",
"(",
"output",
")",
":",
"serializers",
"=",
"salt",
".",
"loader",
".",
"serializers",
"(",
"__opts__",
")",
"try",
":",
"return",
"getattr",
"(",
"serializers",
",",
"output",
")",
"except",
"AttributeError",
":",
"raise",
"Comman... | Helper to return known serializer based on
pass output argument | [
"Helper",
"to",
"return",
"known",
"serializer",
"based",
"on",
"pass",
"output",
"argument"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/script.py#L51-L62 | train |
saltstack/salt | salt/engines/script.py | start | def start(cmd, output='json', interval=1):
'''
Parse stdout of a command and generate an event
The script engine will scrap stdout of the
given script and generate an event based on the
presence of the 'tag' key and it's value.
If there is a data obj available, that will also
be fired alon... | python | def start(cmd, output='json', interval=1):
'''
Parse stdout of a command and generate an event
The script engine will scrap stdout of the
given script and generate an event based on the
presence of the 'tag' key and it's value.
If there is a data obj available, that will also
be fired alon... | [
"def",
"start",
"(",
"cmd",
",",
"output",
"=",
"'json'",
",",
"interval",
"=",
"1",
")",
":",
"try",
":",
"cmd",
"=",
"shlex",
".",
"split",
"(",
"cmd",
")",
"except",
"AttributeError",
":",
"cmd",
"=",
"shlex",
".",
"split",
"(",
"six",
".",
"t... | Parse stdout of a command and generate an event
The script engine will scrap stdout of the
given script and generate an event based on the
presence of the 'tag' key and it's value.
If there is a data obj available, that will also
be fired along with the tag.
Example:
Given the follow... | [
"Parse",
"stdout",
"of",
"a",
"command",
"and",
"generate",
"an",
"event"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/script.py#L65-L141 | train |
saltstack/salt | salt/modules/bluez_bluetooth.py | version | def version():
'''
Return Bluez version from bluetoothd -v
CLI Example:
.. code-block:: bash
salt '*' bluetoothd.version
'''
cmd = 'bluetoothctl -v'
out = __salt__['cmd.run'](cmd).splitlines()
bluez_version = out[0]
pybluez_version = '<= 0.18 (Unknown, but installed)'
... | python | def version():
'''
Return Bluez version from bluetoothd -v
CLI Example:
.. code-block:: bash
salt '*' bluetoothd.version
'''
cmd = 'bluetoothctl -v'
out = __salt__['cmd.run'](cmd).splitlines()
bluez_version = out[0]
pybluez_version = '<= 0.18 (Unknown, but installed)'
... | [
"def",
"version",
"(",
")",
":",
"cmd",
"=",
"'bluetoothctl -v'",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
")",
".",
"splitlines",
"(",
")",
"bluez_version",
"=",
"out",
"[",
"0",
"]",
"pybluez_version",
"=",
"'<= 0.18 (Unknown, but install... | Return Bluez version from bluetoothd -v
CLI Example:
.. code-block:: bash
salt '*' bluetoothd.version | [
"Return",
"Bluez",
"version",
"from",
"bluetoothd",
"-",
"v"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluez_bluetooth.py#L48-L66 | train |
saltstack/salt | salt/modules/bluez_bluetooth.py | address_ | def address_():
'''
Get the many addresses of the Bluetooth adapter
CLI Example:
.. code-block:: bash
salt '*' bluetooth.address
'''
ret = {}
cmd = 'hciconfig'
out = __salt__['cmd.run'](cmd).splitlines()
dev = ''
for line in out:
if line.startswith('hci'):
... | python | def address_():
'''
Get the many addresses of the Bluetooth adapter
CLI Example:
.. code-block:: bash
salt '*' bluetooth.address
'''
ret = {}
cmd = 'hciconfig'
out = __salt__['cmd.run'](cmd).splitlines()
dev = ''
for line in out:
if line.startswith('hci'):
... | [
"def",
"address_",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"'hciconfig'",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
")",
".",
"splitlines",
"(",
")",
"dev",
"=",
"''",
"for",
"line",
"in",
"out",
":",
"if",
"line",
".",
... | Get the many addresses of the Bluetooth adapter
CLI Example:
.. code-block:: bash
salt '*' bluetooth.address | [
"Get",
"the",
"many",
"addresses",
"of",
"the",
"Bluetooth",
"adapter"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluez_bluetooth.py#L69-L98 | train |
saltstack/salt | salt/modules/bluez_bluetooth.py | power | def power(dev, mode):
'''
Power a bluetooth device on or off
CLI Examples:
.. code-block:: bash
salt '*' bluetooth.power hci0 on
salt '*' bluetooth.power hci0 off
'''
if dev not in address_():
raise CommandExecutionError('Invalid dev passed to bluetooth.power')
if... | python | def power(dev, mode):
'''
Power a bluetooth device on or off
CLI Examples:
.. code-block:: bash
salt '*' bluetooth.power hci0 on
salt '*' bluetooth.power hci0 off
'''
if dev not in address_():
raise CommandExecutionError('Invalid dev passed to bluetooth.power')
if... | [
"def",
"power",
"(",
"dev",
",",
"mode",
")",
":",
"if",
"dev",
"not",
"in",
"address_",
"(",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid dev passed to bluetooth.power'",
")",
"if",
"mode",
"==",
"'on'",
"or",
"mode",
"is",
"True",
":",
"sta... | Power a bluetooth device on or off
CLI Examples:
.. code-block:: bash
salt '*' bluetooth.power hci0 on
salt '*' bluetooth.power hci0 off | [
"Power",
"a",
"bluetooth",
"device",
"on",
"or",
"off"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluez_bluetooth.py#L101-L126 | train |
saltstack/salt | salt/modules/bluez_bluetooth.py | discoverable | def discoverable(dev):
'''
Enable this bluetooth device to be discoverable.
CLI Example:
.. code-block:: bash
salt '*' bluetooth.discoverable hci0
'''
if dev not in address_():
raise CommandExecutionError(
'Invalid dev passed to bluetooth.discoverable'
)
... | python | def discoverable(dev):
'''
Enable this bluetooth device to be discoverable.
CLI Example:
.. code-block:: bash
salt '*' bluetooth.discoverable hci0
'''
if dev not in address_():
raise CommandExecutionError(
'Invalid dev passed to bluetooth.discoverable'
)
... | [
"def",
"discoverable",
"(",
"dev",
")",
":",
"if",
"dev",
"not",
"in",
"address_",
"(",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid dev passed to bluetooth.discoverable'",
")",
"cmd",
"=",
"'hciconfig {0} iscan'",
".",
"format",
"(",
"dev",
")",
"... | Enable this bluetooth device to be discoverable.
CLI Example:
.. code-block:: bash
salt '*' bluetooth.discoverable hci0 | [
"Enable",
"this",
"bluetooth",
"device",
"to",
"be",
"discoverable",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluez_bluetooth.py#L129-L150 | train |
saltstack/salt | salt/modules/bluez_bluetooth.py | scan | def scan():
'''
Scan for bluetooth devices in the area
CLI Example:
.. code-block:: bash
salt '*' bluetooth.scan
'''
ret = []
devices = bluetooth.discover_devices(lookup_names=True)
for device in devices:
ret.append({device[0]: device[1]})
return ret | python | def scan():
'''
Scan for bluetooth devices in the area
CLI Example:
.. code-block:: bash
salt '*' bluetooth.scan
'''
ret = []
devices = bluetooth.discover_devices(lookup_names=True)
for device in devices:
ret.append({device[0]: device[1]})
return ret | [
"def",
"scan",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"devices",
"=",
"bluetooth",
".",
"discover_devices",
"(",
"lookup_names",
"=",
"True",
")",
"for",
"device",
"in",
"devices",
":",
"ret",
".",
"append",
"(",
"{",
"device",
"[",
"0",
"]",
":",
"d... | Scan for bluetooth devices in the area
CLI Example:
.. code-block:: bash
salt '*' bluetooth.scan | [
"Scan",
"for",
"bluetooth",
"devices",
"in",
"the",
"area"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluez_bluetooth.py#L175-L189 | train |
saltstack/salt | salt/modules/bluez_bluetooth.py | block | def block(bdaddr):
'''
Block a specific bluetooth device by BD Address
CLI Example:
.. code-block:: bash
salt '*' bluetooth.block DE:AD:BE:EF:CA:FE
'''
if not salt.utils.validate.net.mac(bdaddr):
raise CommandExecutionError(
'Invalid BD address passed to bluetooth.... | python | def block(bdaddr):
'''
Block a specific bluetooth device by BD Address
CLI Example:
.. code-block:: bash
salt '*' bluetooth.block DE:AD:BE:EF:CA:FE
'''
if not salt.utils.validate.net.mac(bdaddr):
raise CommandExecutionError(
'Invalid BD address passed to bluetooth.... | [
"def",
"block",
"(",
"bdaddr",
")",
":",
"if",
"not",
"salt",
".",
"utils",
".",
"validate",
".",
"net",
".",
"mac",
"(",
"bdaddr",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid BD address passed to bluetooth.block'",
")",
"cmd",
"=",
"'hciconfig ... | Block a specific bluetooth device by BD Address
CLI Example:
.. code-block:: bash
salt '*' bluetooth.block DE:AD:BE:EF:CA:FE | [
"Block",
"a",
"specific",
"bluetooth",
"device",
"by",
"BD",
"Address"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluez_bluetooth.py#L192-L208 | train |
saltstack/salt | salt/modules/bluez_bluetooth.py | pair | def pair(address, key):
'''
Pair the bluetooth adapter with a device
CLI Example:
.. code-block:: bash
salt '*' bluetooth.pair DE:AD:BE:EF:CA:FE 1234
Where DE:AD:BE:EF:CA:FE is the address of the device to pair with, and 1234
is the passphrase.
TODO: This function is currently b... | python | def pair(address, key):
'''
Pair the bluetooth adapter with a device
CLI Example:
.. code-block:: bash
salt '*' bluetooth.pair DE:AD:BE:EF:CA:FE 1234
Where DE:AD:BE:EF:CA:FE is the address of the device to pair with, and 1234
is the passphrase.
TODO: This function is currently b... | [
"def",
"pair",
"(",
"address",
",",
"key",
")",
":",
"if",
"not",
"salt",
".",
"utils",
".",
"validate",
".",
"net",
".",
"mac",
"(",
"address",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid BD address passed to bluetooth.pair'",
")",
"try",
":"... | Pair the bluetooth adapter with a device
CLI Example:
.. code-block:: bash
salt '*' bluetooth.pair DE:AD:BE:EF:CA:FE 1234
Where DE:AD:BE:EF:CA:FE is the address of the device to pair with, and 1234
is the passphrase.
TODO: This function is currently broken, as the bluez-simple-agent pro... | [
"Pair",
"the",
"bluetooth",
"adapter",
"with",
"a",
"device"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluez_bluetooth.py#L230-L263 | train |
saltstack/salt | salt/modules/bluez_bluetooth.py | unpair | def unpair(address):
'''
Unpair the bluetooth adapter from a device
CLI Example:
.. code-block:: bash
salt '*' bluetooth.unpair DE:AD:BE:EF:CA:FE
Where DE:AD:BE:EF:CA:FE is the address of the device to unpair.
TODO: This function is currently broken, as the bluez-simple-agent progra... | python | def unpair(address):
'''
Unpair the bluetooth adapter from a device
CLI Example:
.. code-block:: bash
salt '*' bluetooth.unpair DE:AD:BE:EF:CA:FE
Where DE:AD:BE:EF:CA:FE is the address of the device to unpair.
TODO: This function is currently broken, as the bluez-simple-agent progra... | [
"def",
"unpair",
"(",
"address",
")",
":",
"if",
"not",
"salt",
".",
"utils",
".",
"validate",
".",
"net",
".",
"mac",
"(",
"address",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid BD address passed to bluetooth.unpair'",
")",
"cmd",
"=",
"'bluez-... | Unpair the bluetooth adapter from a device
CLI Example:
.. code-block:: bash
salt '*' bluetooth.unpair DE:AD:BE:EF:CA:FE
Where DE:AD:BE:EF:CA:FE is the address of the device to unpair.
TODO: This function is currently broken, as the bluez-simple-agent program
no longer ships with BlueZ ... | [
"Unpair",
"the",
"bluetooth",
"adapter",
"from",
"a",
"device"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluez_bluetooth.py#L266-L288 | train |
saltstack/salt | salt/modules/msteams.py | post_card | def post_card(message,
hook_url=None,
title=None,
theme_color=None):
'''
Send a message to an MS Teams channel.
:param message: The message to send to the MS Teams channel.
:param hook_url: The Teams webhook URL, if not specified in the configuration.
... | python | def post_card(message,
hook_url=None,
title=None,
theme_color=None):
'''
Send a message to an MS Teams channel.
:param message: The message to send to the MS Teams channel.
:param hook_url: The Teams webhook URL, if not specified in the configuration.
... | [
"def",
"post_card",
"(",
"message",
",",
"hook_url",
"=",
"None",
",",
"title",
"=",
"None",
",",
"theme_color",
"=",
"None",
")",
":",
"if",
"not",
"hook_url",
":",
"hook_url",
"=",
"_get_hook_url",
"(",
")",
"if",
"not",
"message",
":",
"log",
".",
... | Send a message to an MS Teams channel.
:param message: The message to send to the MS Teams channel.
:param hook_url: The Teams webhook URL, if not specified in the configuration.
:param title: Optional title for the posted card
:param theme_color: Optional hex color highlight for the poste... | [
"Send",
"a",
"message",
"to",
"an",
"MS",
"Teams",
"channel",
".",
":",
"param",
"message",
":",
"The",
"message",
"to",
"send",
"to",
"the",
"MS",
"Teams",
"channel",
".",
":",
"param",
"hook_url",
":",
"The",
"Teams",
"webhook",
"URL",
"if",
"not",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/msteams.py#L54-L96 | train |
saltstack/salt | salt/beacons/ps.py | beacon | def beacon(config):
'''
Scan for processes and fire events
Example Config
.. code-block:: yaml
beacons:
ps:
- processes:
salt-master: running
mysql: stopped
The config above sets up beacons to check that
processes are running or s... | python | def beacon(config):
'''
Scan for processes and fire events
Example Config
.. code-block:: yaml
beacons:
ps:
- processes:
salt-master: running
mysql: stopped
The config above sets up beacons to check that
processes are running or s... | [
"def",
"beacon",
"(",
"config",
")",
":",
"ret",
"=",
"[",
"]",
"procs",
"=",
"[",
"]",
"for",
"proc",
"in",
"psutil",
".",
"process_iter",
"(",
")",
":",
"_name",
"=",
"proc",
".",
"name",
"(",
")",
"if",
"_name",
"not",
"in",
"procs",
":",
"p... | Scan for processes and fire events
Example Config
.. code-block:: yaml
beacons:
ps:
- processes:
salt-master: running
mysql: stopped
The config above sets up beacons to check that
processes are running or stopped. | [
"Scan",
"for",
"processes",
"and",
"fire",
"events"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/ps.py#L53-L94 | train |
saltstack/salt | salt/cloud/clouds/vagrant.py | list_nodes_full | def list_nodes_full(call=None):
'''
List the nodes, ask all 'vagrant' minions, return dict of grains (enhanced).
CLI Example:
.. code-block:: bash
salt-call -F
'''
ret = _list_nodes(call)
for key, grains in ret.items(): # clean up some hyperverbose grains -- everything is too mu... | python | def list_nodes_full(call=None):
'''
List the nodes, ask all 'vagrant' minions, return dict of grains (enhanced).
CLI Example:
.. code-block:: bash
salt-call -F
'''
ret = _list_nodes(call)
for key, grains in ret.items(): # clean up some hyperverbose grains -- everything is too mu... | [
"def",
"list_nodes_full",
"(",
"call",
"=",
"None",
")",
":",
"ret",
"=",
"_list_nodes",
"(",
"call",
")",
"for",
"key",
",",
"grains",
"in",
"ret",
".",
"items",
"(",
")",
":",
"# clean up some hyperverbose grains -- everything is too much",
"try",
":",
"del"... | List the nodes, ask all 'vagrant' minions, return dict of grains (enhanced).
CLI Example:
.. code-block:: bash
salt-call -F | [
"List",
"the",
"nodes",
"ask",
"all",
"vagrant",
"minions",
"return",
"dict",
"of",
"grains",
"(",
"enhanced",
")",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vagrant.py#L125-L148 | train |
saltstack/salt | salt/cloud/clouds/vagrant.py | _list_nodes | def _list_nodes(call=None):
'''
List the nodes, ask all 'vagrant' minions, return dict of grains.
'''
local = salt.client.LocalClient()
ret = local.cmd('salt-cloud:driver:vagrant', 'grains.items', '', tgt_type='grain')
return ret | python | def _list_nodes(call=None):
'''
List the nodes, ask all 'vagrant' minions, return dict of grains.
'''
local = salt.client.LocalClient()
ret = local.cmd('salt-cloud:driver:vagrant', 'grains.items', '', tgt_type='grain')
return ret | [
"def",
"_list_nodes",
"(",
"call",
"=",
"None",
")",
":",
"local",
"=",
"salt",
".",
"client",
".",
"LocalClient",
"(",
")",
"ret",
"=",
"local",
".",
"cmd",
"(",
"'salt-cloud:driver:vagrant'",
",",
"'grains.items'",
",",
"''",
",",
"tgt_type",
"=",
"'gr... | List the nodes, ask all 'vagrant' minions, return dict of grains. | [
"List",
"the",
"nodes",
"ask",
"all",
"vagrant",
"minions",
"return",
"dict",
"of",
"grains",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vagrant.py#L151-L157 | train |
saltstack/salt | salt/cloud/clouds/vagrant.py | create | def create(vm_):
'''
Provision a single machine
CLI Example:
.. code-block:: bash
salt-cloud -p my_profile new_node_1
'''
name = vm_['name']
machine = config.get_cloud_config_value(
'machine', vm_, __opts__, default='')
vm_['machine'] = machine
host = config.get_c... | python | def create(vm_):
'''
Provision a single machine
CLI Example:
.. code-block:: bash
salt-cloud -p my_profile new_node_1
'''
name = vm_['name']
machine = config.get_cloud_config_value(
'machine', vm_, __opts__, default='')
vm_['machine'] = machine
host = config.get_c... | [
"def",
"create",
"(",
"vm_",
")",
":",
"name",
"=",
"vm_",
"[",
"'name'",
"]",
"machine",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'machine'",
",",
"vm_",
",",
"__opts__",
",",
"default",
"=",
"''",
")",
"vm_",
"[",
"'machine'",
"]",
"=",
... | Provision a single machine
CLI Example:
.. code-block:: bash
salt-cloud -p my_profile new_node_1 | [
"Provision",
"a",
"single",
"machine"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vagrant.py#L186-L248 | train |
saltstack/salt | salt/cloud/clouds/vagrant.py | destroy | def destroy(name, call=None):
'''
Destroy a node.
CLI Example:
.. code-block:: bash
salt-cloud --destroy mymachine
'''
if call == 'function':
raise SaltCloudSystemExit(
'The destroy action must be called with -d, --destroy, '
'-a, or --action.'
... | python | def destroy(name, call=None):
'''
Destroy a node.
CLI Example:
.. code-block:: bash
salt-cloud --destroy mymachine
'''
if call == 'function':
raise SaltCloudSystemExit(
'The destroy action must be called with -d, --destroy, '
'-a, or --action.'
... | [
"def",
"destroy",
"(",
"name",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The destroy action must be called with -d, --destroy, '",
"'-a, or --action.'",
")",
"opts",
"=",
"__opts__",
"__utils__",
... | Destroy a node.
CLI Example:
.. code-block:: bash
salt-cloud --destroy mymachine | [
"Destroy",
"a",
"node",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vagrant.py#L264-L316 | train |
saltstack/salt | salt/cloud/clouds/vagrant.py | reboot | def reboot(name, call=None):
'''
Reboot a vagrant minion.
name
The name of the VM to reboot.
CLI Example:
.. code-block:: bash
salt-cloud -a reboot vm_name
'''
if call != 'action':
raise SaltCloudException(
'The reboot action must be called with -a or ... | python | def reboot(name, call=None):
'''
Reboot a vagrant minion.
name
The name of the VM to reboot.
CLI Example:
.. code-block:: bash
salt-cloud -a reboot vm_name
'''
if call != 'action':
raise SaltCloudException(
'The reboot action must be called with -a or ... | [
"def",
"reboot",
"(",
"name",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"!=",
"'action'",
":",
"raise",
"SaltCloudException",
"(",
"'The reboot action must be called with -a or --action.'",
")",
"my_info",
"=",
"_get_my_info",
"(",
"name",
")",
"profile_na... | Reboot a vagrant minion.
name
The name of the VM to reboot.
CLI Example:
.. code-block:: bash
salt-cloud -a reboot vm_name | [
"Reboot",
"a",
"vagrant",
"minion",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vagrant.py#L320-L342 | train |
saltstack/salt | salt/utils/pkg/__init__.py | clear_rtag | def clear_rtag(opts):
'''
Remove the rtag file
'''
try:
os.remove(rtag(opts))
except OSError as exc:
if exc.errno != errno.ENOENT:
# Using __str__() here to get the fully-formatted error message
# (error number, error message, path)
log.warning('En... | python | def clear_rtag(opts):
'''
Remove the rtag file
'''
try:
os.remove(rtag(opts))
except OSError as exc:
if exc.errno != errno.ENOENT:
# Using __str__() here to get the fully-formatted error message
# (error number, error message, path)
log.warning('En... | [
"def",
"clear_rtag",
"(",
"opts",
")",
":",
"try",
":",
"os",
".",
"remove",
"(",
"rtag",
"(",
"opts",
")",
")",
"except",
"OSError",
"as",
"exc",
":",
"if",
"exc",
".",
"errno",
"!=",
"errno",
".",
"ENOENT",
":",
"# Using __str__() here to get the fully... | Remove the rtag file | [
"Remove",
"the",
"rtag",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/__init__.py#L28-L38 | train |
saltstack/salt | salt/utils/pkg/__init__.py | write_rtag | def write_rtag(opts):
'''
Write the rtag file
'''
rtag_file = rtag(opts)
if not os.path.exists(rtag_file):
try:
with salt.utils.files.fopen(rtag_file, 'w+'):
pass
except OSError as exc:
log.warning('Encountered error writing rtag: %s', exc.__st... | python | def write_rtag(opts):
'''
Write the rtag file
'''
rtag_file = rtag(opts)
if not os.path.exists(rtag_file):
try:
with salt.utils.files.fopen(rtag_file, 'w+'):
pass
except OSError as exc:
log.warning('Encountered error writing rtag: %s', exc.__st... | [
"def",
"write_rtag",
"(",
"opts",
")",
":",
"rtag_file",
"=",
"rtag",
"(",
"opts",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"rtag_file",
")",
":",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"rtag_file... | Write the rtag file | [
"Write",
"the",
"rtag",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/__init__.py#L41-L51 | train |
saltstack/salt | salt/utils/pkg/__init__.py | check_refresh | def check_refresh(opts, refresh=None):
'''
Check whether or not a refresh is necessary
Returns:
- True if refresh evaluates as True
- False if refresh is False
- A boolean if refresh is not False and the rtag file exists
'''
return bool(
salt.utils.data.is_true(refresh) or
... | python | def check_refresh(opts, refresh=None):
'''
Check whether or not a refresh is necessary
Returns:
- True if refresh evaluates as True
- False if refresh is False
- A boolean if refresh is not False and the rtag file exists
'''
return bool(
salt.utils.data.is_true(refresh) or
... | [
"def",
"check_refresh",
"(",
"opts",
",",
"refresh",
"=",
"None",
")",
":",
"return",
"bool",
"(",
"salt",
".",
"utils",
".",
"data",
".",
"is_true",
"(",
"refresh",
")",
"or",
"(",
"os",
".",
"path",
".",
"isfile",
"(",
"rtag",
"(",
"opts",
")",
... | Check whether or not a refresh is necessary
Returns:
- True if refresh evaluates as True
- False if refresh is False
- A boolean if refresh is not False and the rtag file exists | [
"Check",
"whether",
"or",
"not",
"a",
"refresh",
"is",
"necessary"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/__init__.py#L54-L67 | train |
saltstack/salt | salt/utils/pkg/__init__.py | match_version | def match_version(desired, available, cmp_func=None, ignore_epoch=False):
'''
Returns the first version of the list of available versions which matches
the desired version comparison expression, or None if no match is found.
'''
oper, version = split_comparison(desired)
if not oper:
oper... | python | def match_version(desired, available, cmp_func=None, ignore_epoch=False):
'''
Returns the first version of the list of available versions which matches
the desired version comparison expression, or None if no match is found.
'''
oper, version = split_comparison(desired)
if not oper:
oper... | [
"def",
"match_version",
"(",
"desired",
",",
"available",
",",
"cmp_func",
"=",
"None",
",",
"ignore_epoch",
"=",
"False",
")",
":",
"oper",
",",
"version",
"=",
"split_comparison",
"(",
"desired",
")",
"if",
"not",
"oper",
":",
"oper",
"=",
"'=='",
"for... | Returns the first version of the list of available versions which matches
the desired version comparison expression, or None if no match is found. | [
"Returns",
"the",
"first",
"version",
"of",
"the",
"list",
"of",
"available",
"versions",
"which",
"matches",
"the",
"desired",
"version",
"comparison",
"expression",
"or",
"None",
"if",
"no",
"match",
"is",
"found",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/__init__.py#L80-L95 | train |
saltstack/salt | salt/modules/swift.py | _auth | def _auth(profile=None):
'''
Set up openstack credentials
'''
if profile:
credentials = __salt__['config.option'](profile)
user = credentials['keystone.user']
password = credentials.get('keystone.password', None)
tenant = credentials['keystone.tenant']
auth_url = ... | python | def _auth(profile=None):
'''
Set up openstack credentials
'''
if profile:
credentials = __salt__['config.option'](profile)
user = credentials['keystone.user']
password = credentials.get('keystone.password', None)
tenant = credentials['keystone.tenant']
auth_url = ... | [
"def",
"_auth",
"(",
"profile",
"=",
"None",
")",
":",
"if",
"profile",
":",
"credentials",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"profile",
")",
"user",
"=",
"credentials",
"[",
"'keystone.user'",
"]",
"password",
"=",
"credentials",
".",
"ge... | Set up openstack credentials | [
"Set",
"up",
"openstack",
"credentials"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swift.py#L71-L104 | train |
saltstack/salt | salt/modules/swift.py | delete | def delete(cont, path=None, profile=None):
'''
Delete a container, or delete an object from a container.
CLI Example to delete a container::
salt myminion swift.delete mycontainer
CLI Example to delete an object from a container::
salt myminion swift.delete mycontainer remoteobject
... | python | def delete(cont, path=None, profile=None):
'''
Delete a container, or delete an object from a container.
CLI Example to delete a container::
salt myminion swift.delete mycontainer
CLI Example to delete an object from a container::
salt myminion swift.delete mycontainer remoteobject
... | [
"def",
"delete",
"(",
"cont",
",",
"path",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"swift_conn",
"=",
"_auth",
"(",
"profile",
")",
"if",
"path",
"is",
"None",
":",
"return",
"swift_conn",
".",
"delete_container",
"(",
"cont",
")",
"else",
... | Delete a container, or delete an object from a container.
CLI Example to delete a container::
salt myminion swift.delete mycontainer
CLI Example to delete an object from a container::
salt myminion swift.delete mycontainer remoteobject | [
"Delete",
"a",
"container",
"or",
"delete",
"an",
"object",
"from",
"a",
"container",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swift.py#L107-L124 | train |
saltstack/salt | salt/modules/swift.py | get | def get(cont=None, path=None, local_file=None, return_bin=False, profile=None):
'''
List the contents of a container, or return an object from a container. Set
return_bin to True in order to retrieve an object wholesale. Otherwise,
Salt will attempt to parse an XML response.
CLI Example to list con... | python | def get(cont=None, path=None, local_file=None, return_bin=False, profile=None):
'''
List the contents of a container, or return an object from a container. Set
return_bin to True in order to retrieve an object wholesale. Otherwise,
Salt will attempt to parse an XML response.
CLI Example to list con... | [
"def",
"get",
"(",
"cont",
"=",
"None",
",",
"path",
"=",
"None",
",",
"local_file",
"=",
"None",
",",
"return_bin",
"=",
"False",
",",
"profile",
"=",
"None",
")",
":",
"swift_conn",
"=",
"_auth",
"(",
"profile",
")",
"if",
"cont",
"is",
"None",
"... | List the contents of a container, or return an object from a container. Set
return_bin to True in order to retrieve an object wholesale. Otherwise,
Salt will attempt to parse an XML response.
CLI Example to list containers:
.. code-block:: bash
salt myminion swift.get
CLI Example to list... | [
"List",
"the",
"contents",
"of",
"a",
"container",
"or",
"return",
"an",
"object",
"from",
"a",
"container",
".",
"Set",
"return_bin",
"to",
"True",
"in",
"order",
"to",
"retrieve",
"an",
"object",
"wholesale",
".",
"Otherwise",
"Salt",
"will",
"attempt",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swift.py#L127-L172 | train |
saltstack/salt | salt/modules/swift.py | put | def put(cont, path=None, local_file=None, profile=None):
'''
Create a new container, or upload an object to a container.
CLI Example to create a container:
.. code-block:: bash
salt myminion swift.put mycontainer
CLI Example to upload an object to a container:
.. code-block:: bash
... | python | def put(cont, path=None, local_file=None, profile=None):
'''
Create a new container, or upload an object to a container.
CLI Example to create a container:
.. code-block:: bash
salt myminion swift.put mycontainer
CLI Example to upload an object to a container:
.. code-block:: bash
... | [
"def",
"put",
"(",
"cont",
",",
"path",
"=",
"None",
",",
"local_file",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"swift_conn",
"=",
"_auth",
"(",
"profile",
")",
"if",
"path",
"is",
"None",
":",
"return",
"swift_conn",
".",
"put_container",
... | Create a new container, or upload an object to a container.
CLI Example to create a container:
.. code-block:: bash
salt myminion swift.put mycontainer
CLI Example to upload an object to a container:
.. code-block:: bash
salt myminion swift.put mycontainer remotepath local_file=/pa... | [
"Create",
"a",
"new",
"container",
"or",
"upload",
"an",
"object",
"to",
"a",
"container",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swift.py#L179-L202 | train |
saltstack/salt | salt/modules/mac_shadow.py | _get_account_policy | def _get_account_policy(name):
'''
Get the entire accountPolicy and return it as a dictionary. For use by this
module only
:param str name: The user name
:return: a dictionary containing all values for the accountPolicy
:rtype: dict
:raises: CommandExecutionError on user not found or any ... | python | def _get_account_policy(name):
'''
Get the entire accountPolicy and return it as a dictionary. For use by this
module only
:param str name: The user name
:return: a dictionary containing all values for the accountPolicy
:rtype: dict
:raises: CommandExecutionError on user not found or any ... | [
"def",
"_get_account_policy",
"(",
"name",
")",
":",
"cmd",
"=",
"'pwpolicy -u {0} -getpolicy'",
".",
"format",
"(",
"name",
")",
"try",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_result",
"(",
"cmd",
")",
"except",
"Comman... | Get the entire accountPolicy and return it as a dictionary. For use by this
module only
:param str name: The user name
:return: a dictionary containing all values for the accountPolicy
:rtype: dict
:raises: CommandExecutionError on user not found or any other unknown error | [
"Get",
"the",
"entire",
"accountPolicy",
"and",
"return",
"it",
"as",
"a",
"dictionary",
".",
"For",
"use",
"by",
"this",
"module",
"only"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_shadow.py#L45-L75 | train |
saltstack/salt | salt/modules/mac_shadow.py | _set_account_policy | def _set_account_policy(name, policy):
'''
Set a value in the user accountPolicy. For use by this module only
:param str name: The user name
:param str policy: The policy to apply
:return: True if success, otherwise False
:rtype: bool
:raises: CommandExecutionError on user not found or an... | python | def _set_account_policy(name, policy):
'''
Set a value in the user accountPolicy. For use by this module only
:param str name: The user name
:param str policy: The policy to apply
:return: True if success, otherwise False
:rtype: bool
:raises: CommandExecutionError on user not found or an... | [
"def",
"_set_account_policy",
"(",
"name",
",",
"policy",
")",
":",
"cmd",
"=",
"'pwpolicy -u {0} -setpolicy \"{1}\"'",
".",
"format",
"(",
"name",
",",
"policy",
")",
"try",
":",
"return",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_success",
... | Set a value in the user accountPolicy. For use by this module only
:param str name: The user name
:param str policy: The policy to apply
:return: True if success, otherwise False
:rtype: bool
:raises: CommandExecutionError on user not found or any other unknown error | [
"Set",
"a",
"value",
"in",
"the",
"user",
"accountPolicy",
".",
"For",
"use",
"by",
"this",
"module",
"only"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_shadow.py#L78-L97 | train |
saltstack/salt | salt/modules/mac_shadow.py | _get_account_policy_data_value | def _get_account_policy_data_value(name, key):
'''
Return the value for a key in the accountPolicy section of the user's plist
file. For use by this module only
:param str name: The username
:param str key: The accountPolicy key
:return: The value contained within the key
:rtype: str
... | python | def _get_account_policy_data_value(name, key):
'''
Return the value for a key in the accountPolicy section of the user's plist
file. For use by this module only
:param str name: The username
:param str key: The accountPolicy key
:return: The value contained within the key
:rtype: str
... | [
"def",
"_get_account_policy_data_value",
"(",
"name",
",",
"key",
")",
":",
"cmd",
"=",
"'dscl . -readpl /Users/{0} accountPolicyData {1}'",
".",
"format",
"(",
"name",
",",
"key",
")",
"try",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"exec... | Return the value for a key in the accountPolicy section of the user's plist
file. For use by this module only
:param str name: The username
:param str key: The accountPolicy key
:return: The value contained within the key
:rtype: str
:raises: CommandExecutionError on user not found or any oth... | [
"Return",
"the",
"value",
"for",
"a",
"key",
"in",
"the",
"accountPolicy",
"section",
"of",
"the",
"user",
"s",
"plist",
"file",
".",
"For",
"use",
"by",
"this",
"module",
"only"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_shadow.py#L100-L121 | train |
saltstack/salt | salt/modules/mac_shadow.py | _convert_to_datetime | def _convert_to_datetime(unix_timestamp):
'''
Converts a unix timestamp to a human readable date/time
:param float unix_timestamp: A unix timestamp
:return: A date/time in the format YYYY-mm-dd HH:MM:SS
:rtype: str
'''
try:
unix_timestamp = float(unix_timestamp)
return date... | python | def _convert_to_datetime(unix_timestamp):
'''
Converts a unix timestamp to a human readable date/time
:param float unix_timestamp: A unix timestamp
:return: A date/time in the format YYYY-mm-dd HH:MM:SS
:rtype: str
'''
try:
unix_timestamp = float(unix_timestamp)
return date... | [
"def",
"_convert_to_datetime",
"(",
"unix_timestamp",
")",
":",
"try",
":",
"unix_timestamp",
"=",
"float",
"(",
"unix_timestamp",
")",
"return",
"datetime",
".",
"fromtimestamp",
"(",
"unix_timestamp",
")",
".",
"strftime",
"(",
"'%Y-%m-%d %H:%M:%S'",
")",
"excep... | Converts a unix timestamp to a human readable date/time
:param float unix_timestamp: A unix timestamp
:return: A date/time in the format YYYY-mm-dd HH:MM:SS
:rtype: str | [
"Converts",
"a",
"unix",
"timestamp",
"to",
"a",
"human",
"readable",
"date",
"/",
"time"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_shadow.py#L124-L137 | train |
saltstack/salt | salt/modules/mac_shadow.py | info | def info(name):
'''
Return information for the specified user
:param str name: The username
:return: A dictionary containing the user's shadow information
:rtype: dict
CLI Example:
.. code-block:: bash
salt '*' shadow.info admin
'''
try:
data = pwd.getpwnam(name)... | python | def info(name):
'''
Return information for the specified user
:param str name: The username
:return: A dictionary containing the user's shadow information
:rtype: dict
CLI Example:
.. code-block:: bash
salt '*' shadow.info admin
'''
try:
data = pwd.getpwnam(name)... | [
"def",
"info",
"(",
"name",
")",
":",
"try",
":",
"data",
"=",
"pwd",
".",
"getpwnam",
"(",
"name",
")",
"return",
"{",
"'name'",
":",
"data",
".",
"pw_name",
",",
"'passwd'",
":",
"data",
".",
"pw_passwd",
",",
"'account_created'",
":",
"get_account_c... | Return information for the specified user
:param str name: The username
:return: A dictionary containing the user's shadow information
:rtype: dict
CLI Example:
.. code-block:: bash
salt '*' shadow.info admin | [
"Return",
"information",
"for",
"the",
"specified",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_shadow.py#L140-L183 | train |
saltstack/salt | salt/modules/mac_shadow.py | get_account_created | def get_account_created(name):
'''
Get the date/time the account was created
:param str name: The username of the account
:return: The date/time the account was created (yyyy-mm-dd hh:mm:ss)
:rtype: str
:raises: CommandExecutionError on user not found or any other unknown error
CLI Examp... | python | def get_account_created(name):
'''
Get the date/time the account was created
:param str name: The username of the account
:return: The date/time the account was created (yyyy-mm-dd hh:mm:ss)
:rtype: str
:raises: CommandExecutionError on user not found or any other unknown error
CLI Examp... | [
"def",
"get_account_created",
"(",
"name",
")",
":",
"ret",
"=",
"_get_account_policy_data_value",
"(",
"name",
",",
"'creationTime'",
")",
"unix_timestamp",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"parse_return",
"(",
"ret",
")",
"date_text",
"=",
"... | Get the date/time the account was created
:param str name: The username of the account
:return: The date/time the account was created (yyyy-mm-dd hh:mm:ss)
:rtype: str
:raises: CommandExecutionError on user not found or any other unknown error
CLI Example:
.. code-block:: bash
salt... | [
"Get",
"the",
"date",
"/",
"time",
"the",
"account",
"was",
"created"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_shadow.py#L186-L209 | train |
saltstack/salt | salt/modules/mac_shadow.py | get_login_failed_count | def get_login_failed_count(name):
'''
Get the the number of failed login attempts
:param str name: The username of the account
:return: The number of failed login attempts
:rtype: int
:raises: CommandExecutionError on user not found or any other unknown error
CLI Example:
.. code-bl... | python | def get_login_failed_count(name):
'''
Get the the number of failed login attempts
:param str name: The username of the account
:return: The number of failed login attempts
:rtype: int
:raises: CommandExecutionError on user not found or any other unknown error
CLI Example:
.. code-bl... | [
"def",
"get_login_failed_count",
"(",
"name",
")",
":",
"ret",
"=",
"_get_account_policy_data_value",
"(",
"name",
",",
"'failedLoginCount'",
")",
"return",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"parse_return",
"(",
"ret",
")"
] | Get the the number of failed login attempts
:param str name: The username of the account
:return: The number of failed login attempts
:rtype: int
:raises: CommandExecutionError on user not found or any other unknown error
CLI Example:
.. code-block:: bash
salt '*' shadow.get_login_... | [
"Get",
"the",
"the",
"number",
"of",
"failed",
"login",
"attempts"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_shadow.py#L238-L257 | train |
saltstack/salt | salt/modules/mac_shadow.py | set_maxdays | def set_maxdays(name, days):
'''
Set the maximum age of the password in days
:param str name: The username of the account
:param int days: The maximum age of the account in days
:return: True if successful, False if not
:rtype: bool
:raises: CommandExecutionError on user not found or any... | python | def set_maxdays(name, days):
'''
Set the maximum age of the password in days
:param str name: The username of the account
:param int days: The maximum age of the account in days
:return: True if successful, False if not
:rtype: bool
:raises: CommandExecutionError on user not found or any... | [
"def",
"set_maxdays",
"(",
"name",
",",
"days",
")",
":",
"minutes",
"=",
"days",
"*",
"24",
"*",
"60",
"_set_account_policy",
"(",
"name",
",",
"'maxMinutesUntilChangePassword={0}'",
".",
"format",
"(",
"minutes",
")",
")",
"return",
"get_maxdays",
"(",
"na... | Set the maximum age of the password in days
:param str name: The username of the account
:param int days: The maximum age of the account in days
:return: True if successful, False if not
:rtype: bool
:raises: CommandExecutionError on user not found or any other unknown error
CLI Example:
... | [
"Set",
"the",
"maximum",
"age",
"of",
"the",
"password",
"in",
"days"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_shadow.py#L287-L311 | train |
saltstack/salt | salt/modules/mac_shadow.py | get_maxdays | def get_maxdays(name):
'''
Get the maximum age of the password
:param str name: The username of the account
:return: The maximum age of the password in days
:rtype: int
:raises: CommandExecutionError on user not found or any other unknown error
CLI Example:
.. code-block:: bash
... | python | def get_maxdays(name):
'''
Get the maximum age of the password
:param str name: The username of the account
:return: The maximum age of the password in days
:rtype: int
:raises: CommandExecutionError on user not found or any other unknown error
CLI Example:
.. code-block:: bash
... | [
"def",
"get_maxdays",
"(",
"name",
")",
":",
"policies",
"=",
"_get_account_policy",
"(",
"name",
")",
"if",
"'maxMinutesUntilChangePassword'",
"in",
"policies",
":",
"max_minutes",
"=",
"policies",
"[",
"'maxMinutesUntilChangePassword'",
"]",
"return",
"int",
"(",
... | Get the maximum age of the password
:param str name: The username of the account
:return: The maximum age of the password in days
:rtype: int
:raises: CommandExecutionError on user not found or any other unknown error
CLI Example:
.. code-block:: bash
salt '*' shadow.get_maxdays ad... | [
"Get",
"the",
"maximum",
"age",
"of",
"the",
"password"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_shadow.py#L314-L337 | train |
saltstack/salt | salt/modules/mac_shadow.py | set_change | def set_change(name, date):
'''
Sets the date on which the password expires. The user will be required to
change their password. Format is mm/dd/yyyy
:param str name: The name of the user account
:param date date: The date the password will expire. Must be in mm/dd/yyyy
format.
:retur... | python | def set_change(name, date):
'''
Sets the date on which the password expires. The user will be required to
change their password. Format is mm/dd/yyyy
:param str name: The name of the user account
:param date date: The date the password will expire. Must be in mm/dd/yyyy
format.
:retur... | [
"def",
"set_change",
"(",
"name",
",",
"date",
")",
":",
"_set_account_policy",
"(",
"name",
",",
"'usingExpirationDate=1 expirationDateGMT={0}'",
".",
"format",
"(",
"date",
")",
")",
"return",
"get_change",
"(",
"name",
")",
"==",
"date"
] | Sets the date on which the password expires. The user will be required to
change their password. Format is mm/dd/yyyy
:param str name: The name of the user account
:param date date: The date the password will expire. Must be in mm/dd/yyyy
format.
:return: True if successful, otherwise False
... | [
"Sets",
"the",
"date",
"on",
"which",
"the",
"password",
"expires",
".",
"The",
"user",
"will",
"be",
"required",
"to",
"change",
"their",
"password",
".",
"Format",
"is",
"mm",
"/",
"dd",
"/",
"yyyy"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_shadow.py#L402-L426 | train |
saltstack/salt | salt/modules/mac_shadow.py | set_expire | def set_expire(name, date):
'''
Sets the date on which the account expires. The user will not be able to
login after this date. Date format is mm/dd/yyyy
:param str name: The name of the user account
:param datetime date: The date the account will expire. Format must be
mm/dd/yyyy.
:r... | python | def set_expire(name, date):
'''
Sets the date on which the account expires. The user will not be able to
login after this date. Date format is mm/dd/yyyy
:param str name: The name of the user account
:param datetime date: The date the account will expire. Format must be
mm/dd/yyyy.
:r... | [
"def",
"set_expire",
"(",
"name",
",",
"date",
")",
":",
"_set_account_policy",
"(",
"name",
",",
"'usingHardExpirationDate=1 hardExpireDateGMT={0}'",
".",
"format",
"(",
"date",
")",
")",
"return",
"get_expire",
"(",
"name",
")",
"==",
"date"
] | Sets the date on which the account expires. The user will not be able to
login after this date. Date format is mm/dd/yyyy
:param str name: The name of the user account
:param datetime date: The date the account will expire. Format must be
mm/dd/yyyy.
:return: True if successful, False if not
... | [
"Sets",
"the",
"date",
"on",
"which",
"the",
"account",
"expires",
".",
"The",
"user",
"will",
"not",
"be",
"able",
"to",
"login",
"after",
"this",
"date",
".",
"Date",
"format",
"is",
"mm",
"/",
"dd",
"/",
"yyyy"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_shadow.py#L454-L478 | train |
saltstack/salt | salt/modules/mac_shadow.py | del_password | def del_password(name):
'''
Deletes the account password
:param str name: The user name of the account
:return: True if successful, otherwise False
:rtype: bool
:raises: CommandExecutionError on user not found or any other unknown error
CLI Example:
.. code-block:: bash
sal... | python | def del_password(name):
'''
Deletes the account password
:param str name: The user name of the account
:return: True if successful, otherwise False
:rtype: bool
:raises: CommandExecutionError on user not found or any other unknown error
CLI Example:
.. code-block:: bash
sal... | [
"def",
"del_password",
"(",
"name",
")",
":",
"# This removes the password",
"cmd",
"=",
"\"dscl . -passwd /Users/{0} ''\"",
".",
"format",
"(",
"name",
")",
"try",
":",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_success",
"(",
"cmd",
")",
"exc... | Deletes the account password
:param str name: The user name of the account
:return: True if successful, otherwise False
:rtype: bool
:raises: CommandExecutionError on user not found or any other unknown error
CLI Example:
.. code-block:: bash
salt '*' shadow.del_password username | [
"Deletes",
"the",
"account",
"password"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_shadow.py#L506-L536 | train |
saltstack/salt | salt/modules/mac_shadow.py | set_password | def set_password(name, password):
'''
Set the password for a named user (insecure, the password will be in the
process list while the command is running)
:param str name: The name of the local user, which is assumed to be in the
local directory service
:param str password: The plaintext pa... | python | def set_password(name, password):
'''
Set the password for a named user (insecure, the password will be in the
process list while the command is running)
:param str name: The name of the local user, which is assumed to be in the
local directory service
:param str password: The plaintext pa... | [
"def",
"set_password",
"(",
"name",
",",
"password",
")",
":",
"cmd",
"=",
"\"dscl . -passwd /Users/{0} '{1}'\"",
".",
"format",
"(",
"name",
",",
"password",
")",
"try",
":",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_success",
"(",
"cmd",
... | Set the password for a named user (insecure, the password will be in the
process list while the command is running)
:param str name: The name of the local user, which is assumed to be in the
local directory service
:param str password: The plaintext password to set
:return: True if successful... | [
"Set",
"the",
"password",
"for",
"a",
"named",
"user",
"(",
"insecure",
"the",
"password",
"will",
"be",
"in",
"the",
"process",
"list",
"while",
"the",
"command",
"is",
"running",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_shadow.py#L539-L568 | train |
saltstack/salt | salt/states/rabbitmq_policy.py | present | def present(name,
pattern,
definition,
priority=0,
vhost='/',
runas=None,
apply_to=None):
'''
Ensure the RabbitMQ policy exists.
Reference: http://www.rabbitmq.com/ha.html
name
Policy name
pattern
A regex of qu... | python | def present(name,
pattern,
definition,
priority=0,
vhost='/',
runas=None,
apply_to=None):
'''
Ensure the RabbitMQ policy exists.
Reference: http://www.rabbitmq.com/ha.html
name
Policy name
pattern
A regex of qu... | [
"def",
"present",
"(",
"name",
",",
"pattern",
",",
"definition",
",",
"priority",
"=",
"0",
",",
"vhost",
"=",
"'/'",
",",
"runas",
"=",
"None",
",",
"apply_to",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
... | Ensure the RabbitMQ policy exists.
Reference: http://www.rabbitmq.com/ha.html
name
Policy name
pattern
A regex of queues to apply the policy to
definition
A json dict describing the policy
priority
Priority (defaults to 0)
vhost
Virtual host to apply to ... | [
"Ensure",
"the",
"RabbitMQ",
"policy",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/rabbitmq_policy.py#L37-L124 | train |
saltstack/salt | salt/states/rabbitmq_policy.py | absent | def absent(name,
vhost='/',
runas=None):
'''
Ensure the named policy is absent
Reference: http://www.rabbitmq.com/ha.html
name
The name of the policy to remove
runas
Name of the user to run the command as
'''
ret = {'name': name, 'result': True, 'comme... | python | def absent(name,
vhost='/',
runas=None):
'''
Ensure the named policy is absent
Reference: http://www.rabbitmq.com/ha.html
name
The name of the policy to remove
runas
Name of the user to run the command as
'''
ret = {'name': name, 'result': True, 'comme... | [
"def",
"absent",
"(",
"name",
",",
"vhost",
"=",
"'/'",
",",
"runas",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"policy_exists",
... | Ensure the named policy is absent
Reference: http://www.rabbitmq.com/ha.html
name
The name of the policy to remove
runas
Name of the user to run the command as | [
"Ensure",
"the",
"named",
"policy",
"is",
"absent"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/rabbitmq_policy.py#L127-L165 | train |
saltstack/salt | salt/cloud/clouds/openstack.py | get_configured_provider | def get_configured_provider():
'''
Return the first configured instance.
'''
return config.is_provider_configured(
__opts__, __active_provider_name__ or __virtualname__,
('auth', 'region_name'), log_message=False,
) or config.is_provider_configured(
__opts__, __active_provide... | python | def get_configured_provider():
'''
Return the first configured instance.
'''
return config.is_provider_configured(
__opts__, __active_provider_name__ or __virtualname__,
('auth', 'region_name'), log_message=False,
) or config.is_provider_configured(
__opts__, __active_provide... | [
"def",
"get_configured_provider",
"(",
")",
":",
"return",
"config",
".",
"is_provider_configured",
"(",
"__opts__",
",",
"__active_provider_name__",
"or",
"__virtualname__",
",",
"(",
"'auth'",
",",
"'region_name'",
")",
",",
"log_message",
"=",
"False",
",",
")"... | Return the first configured instance. | [
"Return",
"the",
"first",
"configured",
"instance",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/openstack.py#L259-L269 | train |
saltstack/salt | salt/cloud/clouds/openstack.py | preferred_ip | def preferred_ip(vm_, ips):
'''
Return the preferred Internet protocol. Either 'ipv4' (default) or 'ipv6'.
'''
proto = config.get_cloud_config_value(
'protocol', vm_, __opts__, default='ipv4', search_global=False
)
family = socket.AF_INET
if proto == 'ipv6':
family = socket.... | python | def preferred_ip(vm_, ips):
'''
Return the preferred Internet protocol. Either 'ipv4' (default) or 'ipv6'.
'''
proto = config.get_cloud_config_value(
'protocol', vm_, __opts__, default='ipv4', search_global=False
)
family = socket.AF_INET
if proto == 'ipv6':
family = socket.... | [
"def",
"preferred_ip",
"(",
"vm_",
",",
"ips",
")",
":",
"proto",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'protocol'",
",",
"vm_",
",",
"__opts__",
",",
"default",
"=",
"'ipv4'",
",",
"search_global",
"=",
"False",
")",
"family",
"=",
"socket",... | Return the preferred Internet protocol. Either 'ipv4' (default) or 'ipv6'. | [
"Return",
"the",
"preferred",
"Internet",
"protocol",
".",
"Either",
"ipv4",
"(",
"default",
")",
"or",
"ipv6",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/openstack.py#L286-L303 | train |
saltstack/salt | salt/cloud/clouds/openstack.py | get_conn | def get_conn():
'''
Return a conn object for the passed VM data
'''
if __active_provider_name__ in __context__:
return __context__[__active_provider_name__]
vm_ = get_configured_provider()
profile = vm_.pop('profile', None)
if profile is not None:
vm_ = __utils__['dictupdate.... | python | def get_conn():
'''
Return a conn object for the passed VM data
'''
if __active_provider_name__ in __context__:
return __context__[__active_provider_name__]
vm_ = get_configured_provider()
profile = vm_.pop('profile', None)
if profile is not None:
vm_ = __utils__['dictupdate.... | [
"def",
"get_conn",
"(",
")",
":",
"if",
"__active_provider_name__",
"in",
"__context__",
":",
"return",
"__context__",
"[",
"__active_provider_name__",
"]",
"vm_",
"=",
"get_configured_provider",
"(",
")",
"profile",
"=",
"vm_",
".",
"pop",
"(",
"'profile'",
","... | Return a conn object for the passed VM data | [
"Return",
"a",
"conn",
"object",
"for",
"the",
"passed",
"VM",
"data"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/openstack.py#L314-L327 | train |
saltstack/salt | salt/cloud/clouds/openstack.py | list_nodes | def list_nodes(conn=None, call=None):
'''
Return a list of VMs
CLI Example
.. code-block:: bash
salt-cloud -f list_nodes myopenstack
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
r... | python | def list_nodes(conn=None, call=None):
'''
Return a list of VMs
CLI Example
.. code-block:: bash
salt-cloud -f list_nodes myopenstack
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
r... | [
"def",
"list_nodes",
"(",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_nodes function must be called with -f or --function.'",
")",
"ret",
"=",
"{",
"}",
"for",
"nod... | Return a list of VMs
CLI Example
.. code-block:: bash
salt-cloud -f list_nodes myopenstack | [
"Return",
"a",
"list",
"of",
"VMs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/openstack.py#L330-L350 | train |
saltstack/salt | salt/cloud/clouds/openstack.py | list_nodes_min | def list_nodes_min(conn=None, call=None):
'''
Return a list of VMs with minimal information
CLI Example
.. code-block:: bash
salt-cloud -f list_nodes_min myopenstack
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_min function must be called wi... | python | def list_nodes_min(conn=None, call=None):
'''
Return a list of VMs with minimal information
CLI Example
.. code-block:: bash
salt-cloud -f list_nodes_min myopenstack
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_min function must be called wi... | [
"def",
"list_nodes_min",
"(",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_nodes_min function must be called with -f or --function.'",
")",
"if",
"conn",
"is",
"None",
... | Return a list of VMs with minimal information
CLI Example
.. code-block:: bash
salt-cloud -f list_nodes_min myopenstack | [
"Return",
"a",
"list",
"of",
"VMs",
"with",
"minimal",
"information"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/openstack.py#L353-L373 | train |
saltstack/salt | salt/cloud/clouds/openstack.py | list_nodes_full | def list_nodes_full(conn=None, call=None):
'''
Return a list of VMs with all the information about them
CLI Example
.. code-block:: bash
salt-cloud -f list_nodes_full myopenstack
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_full function mus... | python | def list_nodes_full(conn=None, call=None):
'''
Return a list of VMs with all the information about them
CLI Example
.. code-block:: bash
salt-cloud -f list_nodes_full myopenstack
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_full function mus... | [
"def",
"list_nodes_full",
"(",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_nodes_full function must be called with -f or --function.'",
")",
"if",
"conn",
"is",
"None",... | Return a list of VMs with all the information about them
CLI Example
.. code-block:: bash
salt-cloud -f list_nodes_full myopenstack | [
"Return",
"a",
"list",
"of",
"VMs",
"with",
"all",
"the",
"information",
"about",
"them"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/openstack.py#L389-L418 | train |
saltstack/salt | salt/cloud/clouds/openstack.py | list_nodes_select | def list_nodes_select(conn=None, call=None):
'''
Return a list of VMs with the fields from `query.selection`
CLI Example
.. code-block:: bash
salt-cloud -f list_nodes_full myopenstack
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_select funct... | python | def list_nodes_select(conn=None, call=None):
'''
Return a list of VMs with the fields from `query.selection`
CLI Example
.. code-block:: bash
salt-cloud -f list_nodes_full myopenstack
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_select funct... | [
"def",
"list_nodes_select",
"(",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_nodes_select function must be called with -f or --function.'",
")",
"return",
"__utils__",
"[... | Return a list of VMs with the fields from `query.selection`
CLI Example
.. code-block:: bash
salt-cloud -f list_nodes_full myopenstack | [
"Return",
"a",
"list",
"of",
"VMs",
"with",
"the",
"fields",
"from",
"query",
".",
"selection"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/openstack.py#L421-L438 | train |
saltstack/salt | salt/cloud/clouds/openstack.py | show_instance | def show_instance(name, conn=None, call=None):
'''
Get VM on this OpenStack account
name
name of the instance
CLI Example
.. code-block:: bash
salt-cloud -a show_instance myserver
'''
if call != 'action':
raise SaltCloudSystemExit(
'The show_instance... | python | def show_instance(name, conn=None, call=None):
'''
Get VM on this OpenStack account
name
name of the instance
CLI Example
.. code-block:: bash
salt-cloud -a show_instance myserver
'''
if call != 'action':
raise SaltCloudSystemExit(
'The show_instance... | [
"def",
"show_instance",
"(",
"name",
",",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"!=",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The show_instance action must be called with -a or --action.'",
")",
"if",
"conn",
"is",
... | Get VM on this OpenStack account
name
name of the instance
CLI Example
.. code-block:: bash
salt-cloud -a show_instance myserver | [
"Get",
"VM",
"on",
"this",
"OpenStack",
"account"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/openstack.py#L441-L477 | train |
saltstack/salt | salt/cloud/clouds/openstack.py | avail_images | def avail_images(conn=None, call=None):
'''
List available images for OpenStack
CLI Example
.. code-block:: bash
salt-cloud -f avail_images myopenstack
salt-cloud --list-images myopenstack
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_imag... | python | def avail_images(conn=None, call=None):
'''
List available images for OpenStack
CLI Example
.. code-block:: bash
salt-cloud -f avail_images myopenstack
salt-cloud --list-images myopenstack
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_imag... | [
"def",
"avail_images",
"(",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_images function must be called with '",
"'-f or --function, or with the --list-images option'",
")",
... | List available images for OpenStack
CLI Example
.. code-block:: bash
salt-cloud -f avail_images myopenstack
salt-cloud --list-images myopenstack | [
"List",
"available",
"images",
"for",
"OpenStack"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/openstack.py#L480-L499 | train |
saltstack/salt | salt/cloud/clouds/openstack.py | avail_sizes | def avail_sizes(conn=None, call=None):
'''
List available sizes for OpenStack
CLI Example
.. code-block:: bash
salt-cloud -f avail_sizes myopenstack
salt-cloud --list-sizes myopenstack
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_sizes fu... | python | def avail_sizes(conn=None, call=None):
'''
List available sizes for OpenStack
CLI Example
.. code-block:: bash
salt-cloud -f avail_sizes myopenstack
salt-cloud --list-sizes myopenstack
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_sizes fu... | [
"def",
"avail_sizes",
"(",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_sizes function must be called with '",
"'-f or --function, or with the --list-sizes option'",
")",
"... | List available sizes for OpenStack
CLI Example
.. code-block:: bash
salt-cloud -f avail_sizes myopenstack
salt-cloud --list-sizes myopenstack | [
"List",
"available",
"sizes",
"for",
"OpenStack"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/openstack.py#L502-L521 | train |
saltstack/salt | salt/cloud/clouds/openstack.py | list_networks | def list_networks(conn=None, call=None):
'''
List networks for OpenStack
CLI Example
.. code-block:: bash
salt-cloud -f list_networks myopenstack
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_networks function must be called with '
'-f ... | python | def list_networks(conn=None, call=None):
'''
List networks for OpenStack
CLI Example
.. code-block:: bash
salt-cloud -f list_networks myopenstack
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_networks function must be called with '
'-f ... | [
"def",
"list_networks",
"(",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_networks function must be called with '",
"'-f or --function'",
")",
"if",
"conn",
"is",
"Non... | List networks for OpenStack
CLI Example
.. code-block:: bash
salt-cloud -f list_networks myopenstack | [
"List",
"networks",
"for",
"OpenStack"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/openstack.py#L524-L542 | train |
saltstack/salt | salt/cloud/clouds/openstack.py | list_subnets | def list_subnets(conn=None, call=None, kwargs=None):
'''
List subnets in a virtual network
network
network to list subnets of
.. code-block:: bash
salt-cloud -f list_subnets myopenstack network=salt-net
'''
if call == 'action':
raise SaltCloudSystemExit(
'... | python | def list_subnets(conn=None, call=None, kwargs=None):
'''
List subnets in a virtual network
network
network to list subnets of
.. code-block:: bash
salt-cloud -f list_subnets myopenstack network=salt-net
'''
if call == 'action':
raise SaltCloudSystemExit(
'... | [
"def",
"list_subnets",
"(",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_subnets function must be called with '",
"'-f or --function.'",
")... | List subnets in a virtual network
network
network to list subnets of
.. code-block:: bash
salt-cloud -f list_subnets myopenstack network=salt-net | [
"List",
"subnets",
"in",
"a",
"virtual",
"network"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/openstack.py#L545-L568 | train |
saltstack/salt | salt/cloud/clouds/openstack.py | _clean_create_kwargs | def _clean_create_kwargs(**kwargs):
'''
Sanatize kwargs to be sent to create_server
'''
VALID_OPTS = {
'name': six.string_types,
'image': six.string_types,
'flavor': six.string_types,
'auto_ip': bool,
'ips': list,
'ip_pool': six.string_types,
'root... | python | def _clean_create_kwargs(**kwargs):
'''
Sanatize kwargs to be sent to create_server
'''
VALID_OPTS = {
'name': six.string_types,
'image': six.string_types,
'flavor': six.string_types,
'auto_ip': bool,
'ips': list,
'ip_pool': six.string_types,
'root... | [
"def",
"_clean_create_kwargs",
"(",
"*",
"*",
"kwargs",
")",
":",
"VALID_OPTS",
"=",
"{",
"'name'",
":",
"six",
".",
"string_types",
",",
"'image'",
":",
"six",
".",
"string_types",
",",
"'flavor'",
":",
"six",
".",
"string_types",
",",
"'auto_ip'",
":",
... | Sanatize kwargs to be sent to create_server | [
"Sanatize",
"kwargs",
"to",
"be",
"sent",
"to",
"create_server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/openstack.py#L571-L616 | train |
saltstack/salt | salt/cloud/clouds/openstack.py | request_instance | def request_instance(vm_, conn=None, call=None):
'''
Request an instance to be built
'''
if call == 'function':
# Technically this function may be called other ways too, but it
# definitely cannot be called with --function.
raise SaltCloudSystemExit(
'The request_inst... | python | def request_instance(vm_, conn=None, call=None):
'''
Request an instance to be built
'''
if call == 'function':
# Technically this function may be called other ways too, but it
# definitely cannot be called with --function.
raise SaltCloudSystemExit(
'The request_inst... | [
"def",
"request_instance",
"(",
"vm_",
",",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'function'",
":",
"# Technically this function may be called other ways too, but it",
"# definitely cannot be called with --function.",
"raise",
"Salt... | Request an instance to be built | [
"Request",
"an",
"instance",
"to",
"be",
"built"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/openstack.py#L619-L658 | train |
saltstack/salt | salt/cloud/clouds/openstack.py | create | def create(vm_):
'''
Create a single VM from a data dict
'''
deploy = config.get_cloud_config_value('deploy', vm_, __opts__)
key_filename = config.get_cloud_config_value(
'ssh_key_file', vm_, __opts__, search_global=False, default=None
)
if key_filename is not None and not os.path.is... | python | def create(vm_):
'''
Create a single VM from a data dict
'''
deploy = config.get_cloud_config_value('deploy', vm_, __opts__)
key_filename = config.get_cloud_config_value(
'ssh_key_file', vm_, __opts__, search_global=False, default=None
)
if key_filename is not None and not os.path.is... | [
"def",
"create",
"(",
"vm_",
")",
":",
"deploy",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'deploy'",
",",
"vm_",
",",
"__opts__",
")",
"key_filename",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'ssh_key_file'",
",",
"vm_",
",",
"__opts__",
... | Create a single VM from a data dict | [
"Create",
"a",
"single",
"VM",
"from",
"a",
"data",
"dict"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/openstack.py#L661-L770 | train |
saltstack/salt | salt/cloud/clouds/openstack.py | destroy | def destroy(name, conn=None, call=None):
'''
Delete a single VM
'''
if call == 'function':
raise SaltCloudSystemExit(
'The destroy action must be called with -d, --destroy, '
'-a or --action.'
)
__utils__['cloud.fire_event'](
'event',
'destroy... | python | def destroy(name, conn=None, call=None):
'''
Delete a single VM
'''
if call == 'function':
raise SaltCloudSystemExit(
'The destroy action must be called with -d, --destroy, '
'-a or --action.'
)
__utils__['cloud.fire_event'](
'event',
'destroy... | [
"def",
"destroy",
"(",
"name",
",",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The destroy action must be called with -d, --destroy, '",
"'-a or --action.'",
")",
"__utils__"... | Delete a single VM | [
"Delete",
"a",
"single",
"VM"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/openstack.py#L773-L816 | train |
saltstack/salt | salt/cloud/clouds/openstack.py | call | def call(conn=None, call=None, kwargs=None):
'''
Call function from shade.
func
function to call from shade.openstackcloud library
CLI Example
.. code-block:: bash
salt-cloud -f call myopenstack func=list_images
t sujksalt-cloud -f call myopenstack func=create_network na... | python | def call(conn=None, call=None, kwargs=None):
'''
Call function from shade.
func
function to call from shade.openstackcloud library
CLI Example
.. code-block:: bash
salt-cloud -f call myopenstack func=list_images
t sujksalt-cloud -f call myopenstack func=create_network na... | [
"def",
"call",
"(",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The call function must be called with '",
"'-f or --function.'",
")",
"if",
"'f... | Call function from shade.
func
function to call from shade.openstackcloud library
CLI Example
.. code-block:: bash
salt-cloud -f call myopenstack func=list_images
t sujksalt-cloud -f call myopenstack func=create_network name=mysubnet | [
"Call",
"function",
"from",
"shade",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/openstack.py#L819-L858 | train |
saltstack/salt | salt/modules/slsutil.py | merge | def merge(obj_a, obj_b, strategy='smart', renderer='yaml', merge_lists=False):
'''
Merge a data structure into another by choosing a merge strategy
Strategies:
* aggregate
* list
* overwrite
* recurse
* smart
CLI Example:
.. code-block:: shell
salt '*' slsutil.merge ... | python | def merge(obj_a, obj_b, strategy='smart', renderer='yaml', merge_lists=False):
'''
Merge a data structure into another by choosing a merge strategy
Strategies:
* aggregate
* list
* overwrite
* recurse
* smart
CLI Example:
.. code-block:: shell
salt '*' slsutil.merge ... | [
"def",
"merge",
"(",
"obj_a",
",",
"obj_b",
",",
"strategy",
"=",
"'smart'",
",",
"renderer",
"=",
"'yaml'",
",",
"merge_lists",
"=",
"False",
")",
":",
"return",
"salt",
".",
"utils",
".",
"dictupdate",
".",
"merge",
"(",
"obj_a",
",",
"obj_b",
",",
... | Merge a data structure into another by choosing a merge strategy
Strategies:
* aggregate
* list
* overwrite
* recurse
* smart
CLI Example:
.. code-block:: shell
salt '*' slsutil.merge '{foo: Foo}' '{bar: Bar}' | [
"Merge",
"a",
"data",
"structure",
"into",
"another",
"by",
"choosing",
"a",
"merge",
"strategy"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/slsutil.py#L37-L56 | train |
saltstack/salt | salt/modules/slsutil.py | merge_all | def merge_all(lst, strategy='smart', renderer='yaml', merge_lists=False):
'''
.. versionadded:: 2019.2.0
Merge a list of objects into each other in order
:type lst: Iterable
:param lst: List of objects to be merged.
:type strategy: String
:param strategy: Merge strategy. See utils.dictupd... | python | def merge_all(lst, strategy='smart', renderer='yaml', merge_lists=False):
'''
.. versionadded:: 2019.2.0
Merge a list of objects into each other in order
:type lst: Iterable
:param lst: List of objects to be merged.
:type strategy: String
:param strategy: Merge strategy. See utils.dictupd... | [
"def",
"merge_all",
"(",
"lst",
",",
"strategy",
"=",
"'smart'",
",",
"renderer",
"=",
"'yaml'",
",",
"merge_lists",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"obj",
"in",
"lst",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"dictupdate",
... | .. versionadded:: 2019.2.0
Merge a list of objects into each other in order
:type lst: Iterable
:param lst: List of objects to be merged.
:type strategy: String
:param strategy: Merge strategy. See utils.dictupdate.
:type renderer: String
:param renderer:
Renderer type. Used to d... | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/slsutil.py#L59-L92 | train |
saltstack/salt | salt/modules/slsutil.py | renderer | def renderer(path=None, string=None, default_renderer='jinja|yaml', **kwargs):
'''
Parse a string or file through Salt's renderer system
.. versionchanged:: 2018.3.0
Add support for Salt fileserver URIs.
This is an open-ended function and can be used for a variety of tasks. It
makes use of ... | python | def renderer(path=None, string=None, default_renderer='jinja|yaml', **kwargs):
'''
Parse a string or file through Salt's renderer system
.. versionchanged:: 2018.3.0
Add support for Salt fileserver URIs.
This is an open-ended function and can be used for a variety of tasks. It
makes use of ... | [
"def",
"renderer",
"(",
"path",
"=",
"None",
",",
"string",
"=",
"None",
",",
"default_renderer",
"=",
"'jinja|yaml'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"path",
"and",
"not",
"string",
":",
"raise",
"salt",
".",
"exceptions",
".",
"SaltIn... | Parse a string or file through Salt's renderer system
.. versionchanged:: 2018.3.0
Add support for Salt fileserver URIs.
This is an open-ended function and can be used for a variety of tasks. It
makes use of Salt's "renderer pipes" system to run a string or file through
a pipe of any of the loa... | [
"Parse",
"a",
"string",
"or",
"file",
"through",
"Salt",
"s",
"renderer",
"system"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/slsutil.py#L95-L186 | train |
saltstack/salt | salt/modules/slsutil.py | serialize | def serialize(serializer, obj, **mod_kwargs):
'''
Serialize a Python object using a :py:mod:`serializer module
<salt.serializers>`
CLI Example:
.. code-block:: bash
salt '*' --no-parse=obj slsutil.serialize 'json' obj="{'foo': 'Foo!'}
Jinja Example:
.. code-block:: jinja
... | python | def serialize(serializer, obj, **mod_kwargs):
'''
Serialize a Python object using a :py:mod:`serializer module
<salt.serializers>`
CLI Example:
.. code-block:: bash
salt '*' --no-parse=obj slsutil.serialize 'json' obj="{'foo': 'Foo!'}
Jinja Example:
.. code-block:: jinja
... | [
"def",
"serialize",
"(",
"serializer",
",",
"obj",
",",
"*",
"*",
"mod_kwargs",
")",
":",
"kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"mod_kwargs",
")",
"return",
"_get_serialize_fn",
"(",
"serializer",
",",
"'se... | Serialize a Python object using a :py:mod:`serializer module
<salt.serializers>`
CLI Example:
.. code-block:: bash
salt '*' --no-parse=obj slsutil.serialize 'json' obj="{'foo': 'Foo!'}
Jinja Example:
.. code-block:: jinja
{% set json_string = salt.slsutil.serialize('json',
... | [
"Serialize",
"a",
"Python",
"object",
"using",
"a",
":",
"py",
":",
"mod",
":",
"serializer",
"module",
"<salt",
".",
"serializers",
">"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/slsutil.py#L206-L225 | train |
saltstack/salt | salt/modules/slsutil.py | deserialize | def deserialize(serializer, stream_or_string, **mod_kwargs):
'''
Deserialize a Python object using a :py:mod:`serializer module
<salt.serializers>`
CLI Example:
.. code-block:: bash
salt '*' slsutil.deserialize 'json' '{"foo": "Foo!"}'
salt '*' --no-parse=stream_or_string slsutil.... | python | def deserialize(serializer, stream_or_string, **mod_kwargs):
'''
Deserialize a Python object using a :py:mod:`serializer module
<salt.serializers>`
CLI Example:
.. code-block:: bash
salt '*' slsutil.deserialize 'json' '{"foo": "Foo!"}'
salt '*' --no-parse=stream_or_string slsutil.... | [
"def",
"deserialize",
"(",
"serializer",
",",
"stream_or_string",
",",
"*",
"*",
"mod_kwargs",
")",
":",
"kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"mod_kwargs",
")",
"return",
"_get_serialize_fn",
"(",
"serializer"... | Deserialize a Python object using a :py:mod:`serializer module
<salt.serializers>`
CLI Example:
.. code-block:: bash
salt '*' slsutil.deserialize 'json' '{"foo": "Foo!"}'
salt '*' --no-parse=stream_or_string slsutil.deserialize 'json' \\
stream_or_string='{"foo": "Foo!"}'
... | [
"Deserialize",
"a",
"Python",
"object",
"using",
"a",
":",
"py",
":",
"mod",
":",
"serializer",
"module",
"<salt",
".",
"serializers",
">"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/slsutil.py#L228-L250 | train |
saltstack/salt | salt/modules/slsutil.py | banner | def banner(width=72, commentchar='#', borderchar='#', blockstart=None, blockend=None,
title=None, text=None, newline=False):
'''
Create a standardized comment block to include in a templated file.
A common technique in configuration management is to include a comment
block in managed files, ... | python | def banner(width=72, commentchar='#', borderchar='#', blockstart=None, blockend=None,
title=None, text=None, newline=False):
'''
Create a standardized comment block to include in a templated file.
A common technique in configuration management is to include a comment
block in managed files, ... | [
"def",
"banner",
"(",
"width",
"=",
"72",
",",
"commentchar",
"=",
"'#'",
",",
"borderchar",
"=",
"'#'",
",",
"blockstart",
"=",
"None",
",",
"blockend",
"=",
"None",
",",
"title",
"=",
"None",
",",
"text",
"=",
"None",
",",
"newline",
"=",
"False",
... | Create a standardized comment block to include in a templated file.
A common technique in configuration management is to include a comment
block in managed files, warning users not to modify the file. This
function simplifies and standardizes those comment blocks.
:param width: The width, in character... | [
"Create",
"a",
"standardized",
"comment",
"block",
"to",
"include",
"in",
"a",
"templated",
"file",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/slsutil.py#L253-L339 | train |
saltstack/salt | salt/utils/msazure.py | get_storage_conn | def get_storage_conn(storage_account=None, storage_key=None, opts=None):
'''
.. versionadded:: 2015.8.0
Return a storage_conn object for the storage account
'''
if opts is None:
opts = {}
if not storage_account:
storage_account = opts.get('storage_account', None)
if not sto... | python | def get_storage_conn(storage_account=None, storage_key=None, opts=None):
'''
.. versionadded:: 2015.8.0
Return a storage_conn object for the storage account
'''
if opts is None:
opts = {}
if not storage_account:
storage_account = opts.get('storage_account', None)
if not sto... | [
"def",
"get_storage_conn",
"(",
"storage_account",
"=",
"None",
",",
"storage_key",
"=",
"None",
",",
"opts",
"=",
"None",
")",
":",
"if",
"opts",
"is",
"None",
":",
"opts",
"=",
"{",
"}",
"if",
"not",
"storage_account",
":",
"storage_account",
"=",
"opt... | .. versionadded:: 2015.8.0
Return a storage_conn object for the storage account | [
"..",
"versionadded",
"::",
"2015",
".",
"8",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/msazure.py#L26-L40 | train |
saltstack/salt | salt/utils/msazure.py | list_blobs | def list_blobs(storage_conn=None, **kwargs):
'''
.. versionadded:: 2015.8.0
List blobs associated with the container
'''
if not storage_conn:
storage_conn = get_storage_conn(opts=kwargs)
if 'container' not in kwargs:
raise SaltSystemExit(
code=42,
msg='A... | python | def list_blobs(storage_conn=None, **kwargs):
'''
.. versionadded:: 2015.8.0
List blobs associated with the container
'''
if not storage_conn:
storage_conn = get_storage_conn(opts=kwargs)
if 'container' not in kwargs:
raise SaltSystemExit(
code=42,
msg='A... | [
"def",
"list_blobs",
"(",
"storage_conn",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"storage_conn",
":",
"storage_conn",
"=",
"get_storage_conn",
"(",
"opts",
"=",
"kwargs",
")",
"if",
"'container'",
"not",
"in",
"kwargs",
":",
"raise",
... | .. versionadded:: 2015.8.0
List blobs associated with the container | [
"..",
"versionadded",
"::",
"2015",
".",
"8",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/msazure.py#L43-L70 | train |
saltstack/salt | salt/utils/msazure.py | put_blob | def put_blob(storage_conn=None, **kwargs):
'''
.. versionadded:: 2015.8.0
Upload a blob
'''
if not storage_conn:
storage_conn = get_storage_conn(opts=kwargs)
if 'container' not in kwargs:
raise SaltSystemExit(code=42, msg='The blob container name must be specified as "container... | python | def put_blob(storage_conn=None, **kwargs):
'''
.. versionadded:: 2015.8.0
Upload a blob
'''
if not storage_conn:
storage_conn = get_storage_conn(opts=kwargs)
if 'container' not in kwargs:
raise SaltSystemExit(code=42, msg='The blob container name must be specified as "container... | [
"def",
"put_blob",
"(",
"storage_conn",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"storage_conn",
":",
"storage_conn",
"=",
"get_storage_conn",
"(",
"opts",
"=",
"kwargs",
")",
"if",
"'container'",
"not",
"in",
"kwargs",
":",
"raise",
... | .. versionadded:: 2015.8.0
Upload a blob | [
"..",
"versionadded",
"::",
"2015",
".",
"8",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/msazure.py#L73-L120 | train |
saltstack/salt | salt/utils/msazure.py | get_blob | def get_blob(storage_conn=None, **kwargs):
'''
.. versionadded:: 2015.8.0
Download a blob
'''
if not storage_conn:
storage_conn = get_storage_conn(opts=kwargs)
if 'container' not in kwargs:
raise SaltSystemExit(code=42, msg='The blob container name must be specified as "contain... | python | def get_blob(storage_conn=None, **kwargs):
'''
.. versionadded:: 2015.8.0
Download a blob
'''
if not storage_conn:
storage_conn = get_storage_conn(opts=kwargs)
if 'container' not in kwargs:
raise SaltSystemExit(code=42, msg='The blob container name must be specified as "contain... | [
"def",
"get_blob",
"(",
"storage_conn",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"storage_conn",
":",
"storage_conn",
"=",
"get_storage_conn",
"(",
"opts",
"=",
"kwargs",
")",
"if",
"'container'",
"not",
"in",
"kwargs",
":",
"raise",
... | .. versionadded:: 2015.8.0
Download a blob | [
"..",
"versionadded",
"::",
"2015",
".",
"8",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/msazure.py#L123-L167 | train |
saltstack/salt | salt/utils/msazure.py | object_to_dict | def object_to_dict(obj):
'''
.. versionadded:: 2015.8.0
Convert an object to a dictionary
'''
if isinstance(obj, list) or isinstance(obj, tuple):
ret = []
for item in obj:
ret.append(object_to_dict(item))
elif hasattr(obj, '__dict__'):
ret = {}
for it... | python | def object_to_dict(obj):
'''
.. versionadded:: 2015.8.0
Convert an object to a dictionary
'''
if isinstance(obj, list) or isinstance(obj, tuple):
ret = []
for item in obj:
ret.append(object_to_dict(item))
elif hasattr(obj, '__dict__'):
ret = {}
for it... | [
"def",
"object_to_dict",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"list",
")",
"or",
"isinstance",
"(",
"obj",
",",
"tuple",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"item",
"in",
"obj",
":",
"ret",
".",
"append",
"(",
"object_to_di... | .. versionadded:: 2015.8.0
Convert an object to a dictionary | [
"..",
"versionadded",
"::",
"2015",
".",
"8",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/msazure.py#L170-L188 | train |
saltstack/salt | salt/cloud/cli.py | SaltCloud.run | def run(self):
'''
Execute the salt-cloud command line
'''
# Parse shell arguments
self.parse_args()
salt_master_user = self.config.get('user')
if salt_master_user is None:
salt_master_user = salt.utils.user.get_user()
if not check_user(salt_... | python | def run(self):
'''
Execute the salt-cloud command line
'''
# Parse shell arguments
self.parse_args()
salt_master_user = self.config.get('user')
if salt_master_user is None:
salt_master_user = salt.utils.user.get_user()
if not check_user(salt_... | [
"def",
"run",
"(",
"self",
")",
":",
"# Parse shell arguments",
"self",
".",
"parse_args",
"(",
")",
"salt_master_user",
"=",
"self",
".",
"config",
".",
"get",
"(",
"'user'",
")",
"if",
"salt_master_user",
"is",
"None",
":",
"salt_master_user",
"=",
"salt",... | Execute the salt-cloud command line | [
"Execute",
"the",
"salt",
"-",
"cloud",
"command",
"line"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/cli.py#L41-L397 | train |
saltstack/salt | salt/states/webutil.py | user_exists | def user_exists(name, password=None, htpasswd_file=None, options='',
force=False, runas=None, update=False):
'''
Make sure the user is inside the specified htpasswd file
name
User name
password
User password
htpasswd_file
Path to the htpasswd file
opti... | python | def user_exists(name, password=None, htpasswd_file=None, options='',
force=False, runas=None, update=False):
'''
Make sure the user is inside the specified htpasswd file
name
User name
password
User password
htpasswd_file
Path to the htpasswd file
opti... | [
"def",
"user_exists",
"(",
"name",
",",
"password",
"=",
"None",
",",
"htpasswd_file",
"=",
"None",
",",
"options",
"=",
"''",
",",
"force",
"=",
"False",
",",
"runas",
"=",
"None",
",",
"update",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'name'",
... | Make sure the user is inside the specified htpasswd file
name
User name
password
User password
htpasswd_file
Path to the htpasswd file
options
See :mod:`salt.modules.htpasswd.useradd`
force
Touch the file even if user already created
runas
Th... | [
"Make",
"sure",
"the",
"user",
"is",
"inside",
"the",
"specified",
"htpasswd",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/webutil.py#L36-L104 | train |
saltstack/salt | salt/states/webutil.py | user_absent | def user_absent(name, htpasswd_file=None, runas=None):
'''
Make sure the user is not in the specified htpasswd file
name
User name
htpasswd_file
Path to the htpasswd file
runas
The system user to run htpasswd command with
'''
ret = {'name': name,
'chang... | python | def user_absent(name, htpasswd_file=None, runas=None):
'''
Make sure the user is not in the specified htpasswd file
name
User name
htpasswd_file
Path to the htpasswd file
runas
The system user to run htpasswd command with
'''
ret = {'name': name,
'chang... | [
"def",
"user_absent",
"(",
"name",
",",
"htpasswd_file",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
",",
"'result'",
":",
"None",
"}",
"exi... | Make sure the user is not in the specified htpasswd file
name
User name
htpasswd_file
Path to the htpasswd file
runas
The system user to run htpasswd command with | [
"Make",
"sure",
"the",
"user",
"is",
"not",
"in",
"the",
"specified",
"htpasswd",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/webutil.py#L107-L150 | train |
saltstack/salt | salt/modules/celery.py | run_task | def run_task(task_name, args=None, kwargs=None, broker=None, backend=None, wait_for_result=False, timeout=None,
propagate=True, interval=0.5, no_ack=True, raise_timeout=True, config=None):
'''
Execute celery tasks. For celery specific parameters see celery documentation.
CLI Example:
.. ... | python | def run_task(task_name, args=None, kwargs=None, broker=None, backend=None, wait_for_result=False, timeout=None,
propagate=True, interval=0.5, no_ack=True, raise_timeout=True, config=None):
'''
Execute celery tasks. For celery specific parameters see celery documentation.
CLI Example:
.. ... | [
"def",
"run_task",
"(",
"task_name",
",",
"args",
"=",
"None",
",",
"kwargs",
"=",
"None",
",",
"broker",
"=",
"None",
",",
"backend",
"=",
"None",
",",
"wait_for_result",
"=",
"False",
",",
"timeout",
"=",
"None",
",",
"propagate",
"=",
"True",
",",
... | Execute celery tasks. For celery specific parameters see celery documentation.
CLI Example:
.. code-block:: bash
salt '*' celery.run_task tasks.sleep args=[4] broker=redis://localhost \\
backend=redis://localhost wait_for_result=true
task_name
The task name, e.g. tasks.sleep
... | [
"Execute",
"celery",
"tasks",
".",
"For",
"celery",
"specific",
"parameters",
"see",
"celery",
"documentation",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/celery.py#L40-L110 | train |
saltstack/salt | salt/client/api.py | APIClient.run | def run(self, cmd):
'''
Execute the salt command given by cmd dict.
cmd is a dictionary of the following form:
{
'mode': 'modestring',
'fun' : 'modulefunctionstring',
'kwarg': functionkeywordargdictionary,
'tgt' : 'targetpatternstring',
... | python | def run(self, cmd):
'''
Execute the salt command given by cmd dict.
cmd is a dictionary of the following form:
{
'mode': 'modestring',
'fun' : 'modulefunctionstring',
'kwarg': functionkeywordargdictionary,
'tgt' : 'targetpatternstring',
... | [
"def",
"run",
"(",
"self",
",",
"cmd",
")",
":",
"cmd",
"=",
"dict",
"(",
"cmd",
")",
"# make copy",
"client",
"=",
"'minion'",
"# default to local minion client",
"mode",
"=",
"cmd",
".",
"get",
"(",
"'mode'",
",",
"'async'",
")",
"# check for wheel or runn... | Execute the salt command given by cmd dict.
cmd is a dictionary of the following form:
{
'mode': 'modestring',
'fun' : 'modulefunctionstring',
'kwarg': functionkeywordargdictionary,
'tgt' : 'targetpatternstring',
'tgt_type' : 'targetpatternty... | [
"Execute",
"the",
"salt",
"command",
"given",
"by",
"cmd",
"dict",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/api.py#L70-L137 | train |
saltstack/salt | salt/client/api.py | APIClient.signature | def signature(self, cmd):
'''
Convenience function that returns dict of function signature(s) specified by cmd.
cmd is dict of the form:
{
'module' : 'modulestring',
'tgt' : 'targetpatternstring',
'tgt_type' : 'targetpatterntype',
'token':... | python | def signature(self, cmd):
'''
Convenience function that returns dict of function signature(s) specified by cmd.
cmd is dict of the form:
{
'module' : 'modulestring',
'tgt' : 'targetpatternstring',
'tgt_type' : 'targetpatterntype',
'token':... | [
"def",
"signature",
"(",
"self",
",",
"cmd",
")",
":",
"cmd",
"[",
"'client'",
"]",
"=",
"'minion'",
"if",
"len",
"(",
"cmd",
"[",
"'module'",
"]",
".",
"split",
"(",
"'.'",
")",
")",
">",
"2",
"and",
"cmd",
"[",
"'module'",
"]",
".",
"split",
... | Convenience function that returns dict of function signature(s) specified by cmd.
cmd is dict of the form:
{
'module' : 'modulestring',
'tgt' : 'targetpatternstring',
'tgt_type' : 'targetpatterntype',
'token': 'salttokenstring',
'username': 'u... | [
"Convenience",
"function",
"that",
"returns",
"dict",
"of",
"function",
"signature",
"(",
"s",
")",
"specified",
"by",
"cmd",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/api.py#L177-L211 | train |
saltstack/salt | salt/client/api.py | APIClient._signature | def _signature(self, cmd):
'''
Expects everything that signature does and also a client type string.
client can either be master or minion.
'''
result = {}
client = cmd.get('client', 'minion')
if client == 'minion':
cmd['fun'] = 'sys.argspec'
... | python | def _signature(self, cmd):
'''
Expects everything that signature does and also a client type string.
client can either be master or minion.
'''
result = {}
client = cmd.get('client', 'minion')
if client == 'minion':
cmd['fun'] = 'sys.argspec'
... | [
"def",
"_signature",
"(",
"self",
",",
"cmd",
")",
":",
"result",
"=",
"{",
"}",
"client",
"=",
"cmd",
".",
"get",
"(",
"'client'",
",",
"'minion'",
")",
"if",
"client",
"==",
"'minion'",
":",
"cmd",
"[",
"'fun'",
"]",
"=",
"'sys.argspec'",
"cmd",
... | Expects everything that signature does and also a client type string.
client can either be master or minion. | [
"Expects",
"everything",
"that",
"signature",
"does",
"and",
"also",
"a",
"client",
"type",
"string",
".",
"client",
"can",
"either",
"be",
"master",
"or",
"minion",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/api.py#L213-L234 | train |
saltstack/salt | salt/client/api.py | APIClient.create_token | def create_token(self, creds):
'''
Create token with creds.
Token authorizes salt access if successful authentication
with the credentials in creds.
creds format is as follows:
{
'username': 'namestring',
'password': 'passwordstring',
... | python | def create_token(self, creds):
'''
Create token with creds.
Token authorizes salt access if successful authentication
with the credentials in creds.
creds format is as follows:
{
'username': 'namestring',
'password': 'passwordstring',
... | [
"def",
"create_token",
"(",
"self",
",",
"creds",
")",
":",
"try",
":",
"tokenage",
"=",
"self",
".",
"resolver",
".",
"mk_token",
"(",
"creds",
")",
"except",
"Exception",
"as",
"ex",
":",
"raise",
"EauthAuthenticationError",
"(",
"\"Authentication failed wit... | Create token with creds.
Token authorizes salt access if successful authentication
with the credentials in creds.
creds format is as follows:
{
'username': 'namestring',
'password': 'passwordstring',
'eauth': 'eauthtypestring',
}
exam... | [
"Create",
"token",
"with",
"creds",
".",
"Token",
"authorizes",
"salt",
"access",
"if",
"successful",
"authentication",
"with",
"the",
"credentials",
"in",
"creds",
".",
"creds",
"format",
"is",
"as",
"follows",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/api.py#L236-L293 | train |
saltstack/salt | salt/client/api.py | APIClient.verify_token | def verify_token(self, token):
'''
If token is valid Then returns user name associated with token
Else False.
'''
try:
result = self.resolver.get_token(token)
except Exception as ex:
raise EauthAuthenticationError(
"Token validation... | python | def verify_token(self, token):
'''
If token is valid Then returns user name associated with token
Else False.
'''
try:
result = self.resolver.get_token(token)
except Exception as ex:
raise EauthAuthenticationError(
"Token validation... | [
"def",
"verify_token",
"(",
"self",
",",
"token",
")",
":",
"try",
":",
"result",
"=",
"self",
".",
"resolver",
".",
"get_token",
"(",
"token",
")",
"except",
"Exception",
"as",
"ex",
":",
"raise",
"EauthAuthenticationError",
"(",
"\"Token validation failed wi... | If token is valid Then returns user name associated with token
Else False. | [
"If",
"token",
"is",
"valid",
"Then",
"returns",
"user",
"name",
"associated",
"with",
"token",
"Else",
"False",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/api.py#L295-L306 | train |
saltstack/salt | salt/client/api.py | APIClient.get_event | def get_event(self, wait=0.25, tag='', full=False):
'''
Get a single salt event.
If no events are available, then block for up to ``wait`` seconds.
Return the event if it matches the tag (or ``tag`` is empty)
Otherwise return None
If wait is 0 then block forever or until... | python | def get_event(self, wait=0.25, tag='', full=False):
'''
Get a single salt event.
If no events are available, then block for up to ``wait`` seconds.
Return the event if it matches the tag (or ``tag`` is empty)
Otherwise return None
If wait is 0 then block forever or until... | [
"def",
"get_event",
"(",
"self",
",",
"wait",
"=",
"0.25",
",",
"tag",
"=",
"''",
",",
"full",
"=",
"False",
")",
":",
"return",
"self",
".",
"event",
".",
"get_event",
"(",
"wait",
"=",
"wait",
",",
"tag",
"=",
"tag",
",",
"full",
"=",
"full",
... | Get a single salt event.
If no events are available, then block for up to ``wait`` seconds.
Return the event if it matches the tag (or ``tag`` is empty)
Otherwise return None
If wait is 0 then block forever or until next event becomes available. | [
"Get",
"a",
"single",
"salt",
"event",
".",
"If",
"no",
"events",
"are",
"available",
"then",
"block",
"for",
"up",
"to",
"wait",
"seconds",
".",
"Return",
"the",
"event",
"if",
"it",
"matches",
"the",
"tag",
"(",
"or",
"tag",
"is",
"empty",
")",
"Ot... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/api.py#L308-L317 | train |
saltstack/salt | salt/client/api.py | APIClient.fire_event | def fire_event(self, data, tag):
'''
fires event with data and tag
This only works if api is running with same user permissions as master
Need to convert this to a master call with appropriate authentication
'''
return self.event.fire_event(data, salt.utils.event.tagify(... | python | def fire_event(self, data, tag):
'''
fires event with data and tag
This only works if api is running with same user permissions as master
Need to convert this to a master call with appropriate authentication
'''
return self.event.fire_event(data, salt.utils.event.tagify(... | [
"def",
"fire_event",
"(",
"self",
",",
"data",
",",
"tag",
")",
":",
"return",
"self",
".",
"event",
".",
"fire_event",
"(",
"data",
",",
"salt",
".",
"utils",
".",
"event",
".",
"tagify",
"(",
"tag",
",",
"'wui'",
")",
")"
] | fires event with data and tag
This only works if api is running with same user permissions as master
Need to convert this to a master call with appropriate authentication | [
"fires",
"event",
"with",
"data",
"and",
"tag",
"This",
"only",
"works",
"if",
"api",
"is",
"running",
"with",
"same",
"user",
"permissions",
"as",
"master",
"Need",
"to",
"convert",
"this",
"to",
"a",
"master",
"call",
"with",
"appropriate",
"authentication... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/api.py#L319-L326 | train |
saltstack/salt | salt/modules/win_timezone.py | get_zone | def get_zone():
'''
Get current timezone (i.e. America/Denver)
Returns:
str: Timezone in unix format
Raises:
CommandExecutionError: If timezone could not be gathered
CLI Example:
.. code-block:: bash
salt '*' timezone.get_zone
'''
cmd = ['tzutil', '/g']
r... | python | def get_zone():
'''
Get current timezone (i.e. America/Denver)
Returns:
str: Timezone in unix format
Raises:
CommandExecutionError: If timezone could not be gathered
CLI Example:
.. code-block:: bash
salt '*' timezone.get_zone
'''
cmd = ['tzutil', '/g']
r... | [
"def",
"get_zone",
"(",
")",
":",
"cmd",
"=",
"[",
"'tzutil'",
",",
"'/g'",
"]",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"python_shell",
"=",
"False",
")",
"if",
"res",
"[",
"'retcode'",
"]",
"or",
"not",
"res",
"[",
"'s... | Get current timezone (i.e. America/Denver)
Returns:
str: Timezone in unix format
Raises:
CommandExecutionError: If timezone could not be gathered
CLI Example:
.. code-block:: bash
salt '*' timezone.get_zone | [
"Get",
"current",
"timezone",
"(",
"i",
".",
"e",
".",
"America",
"/",
"Denver",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_timezone.py#L201-L223 | train |
saltstack/salt | salt/modules/win_timezone.py | get_offset | def get_offset():
'''
Get current numeric timezone offset from UTC (i.e. -0700)
Returns:
str: Offset from UTC
CLI Example:
.. code-block:: bash
salt '*' timezone.get_offset
'''
# http://craigglennie.com/programming/python/2013/07/21/working-with-timezones-using-Python-and... | python | def get_offset():
'''
Get current numeric timezone offset from UTC (i.e. -0700)
Returns:
str: Offset from UTC
CLI Example:
.. code-block:: bash
salt '*' timezone.get_offset
'''
# http://craigglennie.com/programming/python/2013/07/21/working-with-timezones-using-Python-and... | [
"def",
"get_offset",
"(",
")",
":",
"# http://craigglennie.com/programming/python/2013/07/21/working-with-timezones-using-Python-and-pytz-localize-vs-normalize/",
"tz_object",
"=",
"pytz",
".",
"timezone",
"(",
"get_zone",
"(",
")",
")",
"utc_time",
"=",
"pytz",
".",
"utc",
... | Get current numeric timezone offset from UTC (i.e. -0700)
Returns:
str: Offset from UTC
CLI Example:
.. code-block:: bash
salt '*' timezone.get_offset | [
"Get",
"current",
"numeric",
"timezone",
"offset",
"from",
"UTC",
"(",
"i",
".",
"e",
".",
"-",
"0700",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_timezone.py#L226-L244 | train |
saltstack/salt | salt/modules/win_timezone.py | get_zonecode | def get_zonecode():
'''
Get current timezone (i.e. PST, MDT, etc)
Returns:
str: An abbreviated timezone code
CLI Example:
.. code-block:: bash
salt '*' timezone.get_zonecode
'''
tz_object = pytz.timezone(get_zone())
loc_time = tz_object.localize(datetime.utcnow())
... | python | def get_zonecode():
'''
Get current timezone (i.e. PST, MDT, etc)
Returns:
str: An abbreviated timezone code
CLI Example:
.. code-block:: bash
salt '*' timezone.get_zonecode
'''
tz_object = pytz.timezone(get_zone())
loc_time = tz_object.localize(datetime.utcnow())
... | [
"def",
"get_zonecode",
"(",
")",
":",
"tz_object",
"=",
"pytz",
".",
"timezone",
"(",
"get_zone",
"(",
")",
")",
"loc_time",
"=",
"tz_object",
".",
"localize",
"(",
"datetime",
".",
"utcnow",
"(",
")",
")",
"return",
"loc_time",
".",
"tzname",
"(",
")"... | Get current timezone (i.e. PST, MDT, etc)
Returns:
str: An abbreviated timezone code
CLI Example:
.. code-block:: bash
salt '*' timezone.get_zonecode | [
"Get",
"current",
"timezone",
"(",
"i",
".",
"e",
".",
"PST",
"MDT",
"etc",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_timezone.py#L247-L262 | train |
saltstack/salt | salt/modules/win_timezone.py | set_zone | def set_zone(timezone):
'''
Sets the timezone using the tzutil.
Args:
timezone (str): A valid timezone
Returns:
bool: ``True`` if successful, otherwise ``False``
Raises:
CommandExecutionError: If invalid timezone is passed
CLI Example:
.. code-block:: bash
... | python | def set_zone(timezone):
'''
Sets the timezone using the tzutil.
Args:
timezone (str): A valid timezone
Returns:
bool: ``True`` if successful, otherwise ``False``
Raises:
CommandExecutionError: If invalid timezone is passed
CLI Example:
.. code-block:: bash
... | [
"def",
"set_zone",
"(",
"timezone",
")",
":",
"# if it's one of the key's just use it",
"if",
"timezone",
".",
"lower",
"(",
")",
"in",
"mapper",
".",
"win_to_unix",
":",
"win_zone",
"=",
"timezone",
"elif",
"timezone",
".",
"lower",
"(",
")",
"in",
"mapper",
... | Sets the timezone using the tzutil.
Args:
timezone (str): A valid timezone
Returns:
bool: ``True`` if successful, otherwise ``False``
Raises:
CommandExecutionError: If invalid timezone is passed
CLI Example:
.. code-block:: bash
salt '*' timezone.set_zone 'Ameri... | [
"Sets",
"the",
"timezone",
"using",
"the",
"tzutil",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_timezone.py#L265-L303 | train |
saltstack/salt | salt/modules/win_timezone.py | zone_compare | def zone_compare(timezone):
'''
Compares the given timezone with the machine timezone. Mostly useful for
running state checks.
Args:
timezone (str):
The timezone to compare. This can be in Windows or Unix format. Can
be any of the values returned by the ``timezone.list``... | python | def zone_compare(timezone):
'''
Compares the given timezone with the machine timezone. Mostly useful for
running state checks.
Args:
timezone (str):
The timezone to compare. This can be in Windows or Unix format. Can
be any of the values returned by the ``timezone.list``... | [
"def",
"zone_compare",
"(",
"timezone",
")",
":",
"# if it's one of the key's just use it",
"if",
"timezone",
".",
"lower",
"(",
")",
"in",
"mapper",
".",
"win_to_unix",
":",
"check_zone",
"=",
"timezone",
"elif",
"timezone",
".",
"lower",
"(",
")",
"in",
"map... | Compares the given timezone with the machine timezone. Mostly useful for
running state checks.
Args:
timezone (str):
The timezone to compare. This can be in Windows or Unix format. Can
be any of the values returned by the ``timezone.list`` function
Returns:
bool: ``... | [
"Compares",
"the",
"given",
"timezone",
"with",
"the",
"machine",
"timezone",
".",
"Mostly",
"useful",
"for",
"running",
"state",
"checks",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_timezone.py#L306-L338 | train |
saltstack/salt | salt/states/win_license.py | activate | def activate(name):
'''
Install and activate the given product key
name
The 5x5 product key given to you by Microsoft
'''
ret = {'name': name,
'result': True,
'comment': '',
'changes': {}}
product_key = name
license_info = __salt__['license.info']... | python | def activate(name):
'''
Install and activate the given product key
name
The 5x5 product key given to you by Microsoft
'''
ret = {'name': name,
'result': True,
'comment': '',
'changes': {}}
product_key = name
license_info = __salt__['license.info']... | [
"def",
"activate",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"product_key",
"=",
"name",
"license_info",
"=",
"__salt__",
"[",
"'lic... | Install and activate the given product key
name
The 5x5 product key given to you by Microsoft | [
"Install",
"and",
"activate",
"the",
"given",
"product",
"key"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_license.py#L33-L71 | train |
saltstack/salt | salt/states/quota.py | mode | def mode(name, mode, quotatype):
'''
Set the quota for the system
name
The filesystem to set the quota mode on
mode
Whether the quota system is on or off
quotatype
Must be ``user`` or ``group``
'''
ret = {'name': name,
'changes': {},
'result':... | python | def mode(name, mode, quotatype):
'''
Set the quota for the system
name
The filesystem to set the quota mode on
mode
Whether the quota system is on or off
quotatype
Must be ``user`` or ``group``
'''
ret = {'name': name,
'changes': {},
'result':... | [
"def",
"mode",
"(",
"name",
",",
"mode",
",",
"quotatype",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"fun",
"=",
"'off'",
"if",
"mode",
"is",... | Set the quota for the system
name
The filesystem to set the quota mode on
mode
Whether the quota system is on or off
quotatype
Must be ``user`` or ``group`` | [
"Set",
"the",
"quota",
"for",
"the",
"system"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/quota.py#L26-L62 | train |
saltstack/salt | salt/modules/quota.py | report | def report(mount):
'''
Report on quotas for a specific volume
CLI Example:
.. code-block:: bash
salt '*' quota.report /media/data
'''
ret = {mount: {}}
ret[mount]['User Quotas'] = _parse_quota(mount, '-u')
ret[mount]['Group Quotas'] = _parse_quota(mount, '-g')
return ret | python | def report(mount):
'''
Report on quotas for a specific volume
CLI Example:
.. code-block:: bash
salt '*' quota.report /media/data
'''
ret = {mount: {}}
ret[mount]['User Quotas'] = _parse_quota(mount, '-u')
ret[mount]['Group Quotas'] = _parse_quota(mount, '-g')
return ret | [
"def",
"report",
"(",
"mount",
")",
":",
"ret",
"=",
"{",
"mount",
":",
"{",
"}",
"}",
"ret",
"[",
"mount",
"]",
"[",
"'User Quotas'",
"]",
"=",
"_parse_quota",
"(",
"mount",
",",
"'-u'",
")",
"ret",
"[",
"mount",
"]",
"[",
"'Group Quotas'",
"]",
... | Report on quotas for a specific volume
CLI Example:
.. code-block:: bash
salt '*' quota.report /media/data | [
"Report",
"on",
"quotas",
"for",
"a",
"specific",
"volume"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/quota.py#L38-L51 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.