id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
33,700
saltstack/salt
salt/modules/lxc.py
exists
def exists(name, path=None): ''' Returns whether the named container exists. path path to the container parent directory (default: /var/lib/lxc) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.exists name ''' _exists = name in ls_(path...
python
def exists(name, path=None): ''' Returns whether the named container exists. path path to the container parent directory (default: /var/lib/lxc) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.exists name ''' _exists = name in ls_(path...
[ "def", "exists", "(", "name", ",", "path", "=", "None", ")", ":", "_exists", "=", "name", "in", "ls_", "(", "path", "=", "path", ")", "# container may be just created but we did cached earlier the", "# lxc-ls results", "if", "not", "_exists", ":", "_exists", "="...
Returns whether the named container exists. path path to the container parent directory (default: /var/lib/lxc) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.exists name
[ "Returns", "whether", "the", "named", "container", "exists", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2607-L2629
33,701
saltstack/salt
salt/modules/lxc.py
state
def state(name, path=None): ''' Returns the state of a container. path path to the container parent directory (default: /var/lib/lxc) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.state name ''' # Don't use _ensure_exists() here, it wi...
python
def state(name, path=None): ''' Returns the state of a container. path path to the container parent directory (default: /var/lib/lxc) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.state name ''' # Don't use _ensure_exists() here, it wi...
[ "def", "state", "(", "name", ",", "path", "=", "None", ")", ":", "# Don't use _ensure_exists() here, it will mess with _change_state()", "cachekey", "=", "'lxc.state.{0}{1}'", ".", "format", "(", "name", ",", "path", ")", "try", ":", "return", "__context__", "[", ...
Returns the state of a container. path path to the container parent directory (default: /var/lib/lxc) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.state name
[ "Returns", "the", "state", "of", "a", "container", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2632-L2674
33,702
saltstack/salt
salt/modules/lxc.py
get_parameter
def get_parameter(name, parameter, path=None): ''' Returns the value of a cgroup parameter for a container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.get_par...
python
def get_parameter(name, parameter, path=None): ''' Returns the value of a cgroup parameter for a container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.get_par...
[ "def", "get_parameter", "(", "name", ",", "parameter", ",", "path", "=", "None", ")", ":", "_ensure_exists", "(", "name", ",", "path", "=", "path", ")", "cmd", "=", "'lxc-cgroup'", "if", "path", ":", "cmd", "+=", "' -P {0}'", ".", "format", "(", "pipes...
Returns the value of a cgroup parameter for a container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.get_parameter container_name memory.limit_in_bytes
[ "Returns", "the", "value", "of", "a", "cgroup", "parameter", "for", "a", "container" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2677-L2703
33,703
saltstack/salt
salt/modules/lxc.py
set_parameter
def set_parameter(name, parameter, value, path=None): ''' Set the value of a cgroup parameter for a container. path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.set...
python
def set_parameter(name, parameter, value, path=None): ''' Set the value of a cgroup parameter for a container. path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.set...
[ "def", "set_parameter", "(", "name", ",", "parameter", ",", "value", ",", "path", "=", "None", ")", ":", "if", "not", "exists", "(", "name", ",", "path", "=", "path", ")", ":", "return", "None", "cmd", "=", "'lxc-cgroup'", "if", "path", ":", "cmd", ...
Set the value of a cgroup parameter for a container. path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.set_parameter name parameter value
[ "Set", "the", "value", "of", "a", "cgroup", "parameter", "for", "a", "container", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2706-L2733
33,704
saltstack/salt
salt/modules/lxc.py
systemd_running_state
def systemd_running_state(name, path=None): ''' Get the operational state of a systemd based container path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion lxc.systemd_...
python
def systemd_running_state(name, path=None): ''' Get the operational state of a systemd based container path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion lxc.systemd_...
[ "def", "systemd_running_state", "(", "name", ",", "path", "=", "None", ")", ":", "try", ":", "ret", "=", "run_all", "(", "name", ",", "'systemctl is-system-running'", ",", "path", "=", "path", ",", "ignore_retcode", "=", "True", ")", "[", "'stdout'", "]", ...
Get the operational state of a systemd based container path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion lxc.systemd_running_state ubuntu
[ "Get", "the", "operational", "state", "of", "a", "systemd", "based", "container" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L3227-L3251
33,705
saltstack/salt
salt/modules/lxc.py
wait_started
def wait_started(name, path=None, timeout=300): ''' Check that the system has fully inited This is actually very important for systemD based containers see https://github.com/saltstack/salt/issues/23847 path path to the container parent default: /var/lib/lxc (system default) ...
python
def wait_started(name, path=None, timeout=300): ''' Check that the system has fully inited This is actually very important for systemD based containers see https://github.com/saltstack/salt/issues/23847 path path to the container parent default: /var/lib/lxc (system default) ...
[ "def", "wait_started", "(", "name", ",", "path", "=", "None", ",", "timeout", "=", "300", ")", ":", "if", "not", "exists", "(", "name", ",", "path", "=", "path", ")", ":", "raise", "CommandExecutionError", "(", "'Container {0} does does exists'", ".", "for...
Check that the system has fully inited This is actually very important for systemD based containers see https://github.com/saltstack/salt/issues/23847 path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 CLI Example: .. cod...
[ "Check", "that", "the", "system", "has", "fully", "inited" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L3311-L3359
33,706
saltstack/salt
salt/modules/lxc.py
attachable
def attachable(name, path=None): ''' Return True if the named container can be attached to via the lxc-attach command path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt 'm...
python
def attachable(name, path=None): ''' Return True if the named container can be attached to via the lxc-attach command path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt 'm...
[ "def", "attachable", "(", "name", ",", "path", "=", "None", ")", ":", "cachekey", "=", "'lxc.attachable{0}{1}'", ".", "format", "(", "name", ",", "path", ")", "try", ":", "return", "__context__", "[", "cachekey", "]", "except", "KeyError", ":", "_ensure_ex...
Return True if the named container can be attached to via the lxc-attach command path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt 'minion' lxc.attachable ubuntu
[ "Return", "True", "if", "the", "named", "container", "can", "be", "attached", "to", "via", "the", "lxc", "-", "attach", "command" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L3586-L3620
33,707
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
33,708
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
33,709
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
33,710
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
33,711
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
33,712
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
33,713
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
33,714
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
33,715
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
33,716
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
33,717
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
33,718
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
33,719
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
33,720
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
33,721
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
33,722
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
33,723
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
33,724
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
33,725
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
33,726
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
33,727
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
33,728
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
33,729
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
33,730
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
33,731
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
33,732
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
33,733
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
33,734
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
33,735
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
33,736
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
33,737
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
33,738
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
33,739
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
33,740
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
33,741
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
33,742
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
33,743
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
33,744
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
33,745
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
33,746
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
33,747
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
33,748
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
33,749
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
33,750
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
33,751
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
33,752
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
33,753
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
33,754
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
33,755
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
33,756
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
33,757
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
33,758
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
33,759
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
33,760
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
33,761
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
33,762
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
33,763
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
33,764
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
33,765
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
33,766
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
33,767
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
33,768
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
33,769
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
33,770
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
33,771
saltstack/salt
salt/modules/quota.py
_parse_quota
def _parse_quota(mount, opts): ''' Parse the output from repquota. Requires that -u -g are passed in ''' cmd = 'repquota -vp {0} {1}'.format(opts, mount) out = __salt__['cmd.run'](cmd, python_shell=False).splitlines() mode = 'header' if '-u' in opts: quotatype = 'Users' elif '-g...
python
def _parse_quota(mount, opts): ''' Parse the output from repquota. Requires that -u -g are passed in ''' cmd = 'repquota -vp {0} {1}'.format(opts, mount) out = __salt__['cmd.run'](cmd, python_shell=False).splitlines() mode = 'header' if '-u' in opts: quotatype = 'Users' elif '-g...
[ "def", "_parse_quota", "(", "mount", ",", "opts", ")", ":", "cmd", "=", "'repquota -vp {0} {1}'", ".", "format", "(", "opts", ",", "mount", ")", "out", "=", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ",", "python_shell", "=", "False", ")", ".", "sp...
Parse the output from repquota. Requires that -u -g are passed in
[ "Parse", "the", "output", "from", "repquota", ".", "Requires", "that", "-", "u", "-", "g", "are", "passed", "in" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/quota.py#L54-L94
33,772
saltstack/salt
salt/modules/quota.py
set_
def set_(device, **kwargs): ''' Calls out to setquota, for a specific user or group CLI Example: .. code-block:: bash salt '*' quota.set /media/data user=larry block-soft-limit=1048576 salt '*' quota.set /media/data group=painters file-hard-limit=1000 ''' empty = {'block-soft-...
python
def set_(device, **kwargs): ''' Calls out to setquota, for a specific user or group CLI Example: .. code-block:: bash salt '*' quota.set /media/data user=larry block-soft-limit=1048576 salt '*' quota.set /media/data group=painters file-hard-limit=1000 ''' empty = {'block-soft-...
[ "def", "set_", "(", "device", ",", "*", "*", "kwargs", ")", ":", "empty", "=", "{", "'block-soft-limit'", ":", "0", ",", "'block-hard-limit'", ":", "0", ",", "'file-soft-limit'", ":", "0", ",", "'file-hard-limit'", ":", "0", "}", "current", "=", "None", ...
Calls out to setquota, for a specific user or group CLI Example: .. code-block:: bash salt '*' quota.set /media/data user=larry block-soft-limit=1048576 salt '*' quota.set /media/data group=painters file-hard-limit=1000
[ "Calls", "out", "to", "setquota", "for", "a", "specific", "user", "or", "group" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/quota.py#L97-L155
33,773
saltstack/salt
salt/modules/quota.py
stats
def stats(): ''' Runs the quotastats command, and returns the parsed output CLI Example: .. code-block:: bash salt '*' quota.stats ''' ret = {} out = __salt__['cmd.run']('quotastats').splitlines() for line in out: if not line: continue comps = line....
python
def stats(): ''' Runs the quotastats command, and returns the parsed output CLI Example: .. code-block:: bash salt '*' quota.stats ''' ret = {} out = __salt__['cmd.run']('quotastats').splitlines() for line in out: if not line: continue comps = line....
[ "def", "stats", "(", ")", ":", "ret", "=", "{", "}", "out", "=", "__salt__", "[", "'cmd.run'", "]", "(", "'quotastats'", ")", ".", "splitlines", "(", ")", "for", "line", "in", "out", ":", "if", "not", "line", ":", "continue", "comps", "=", "line", ...
Runs the quotastats command, and returns the parsed output CLI Example: .. code-block:: bash salt '*' quota.stats
[ "Runs", "the", "quotastats", "command", "and", "returns", "the", "parsed", "output" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/quota.py#L172-L190
33,774
saltstack/salt
salt/modules/quota.py
on
def on(device): ''' Turns on the quota system CLI Example: .. code-block:: bash salt '*' quota.on ''' cmd = 'quotaon {0}'.format(device) __salt__['cmd.run'](cmd, python_shell=False) return True
python
def on(device): ''' Turns on the quota system CLI Example: .. code-block:: bash salt '*' quota.on ''' cmd = 'quotaon {0}'.format(device) __salt__['cmd.run'](cmd, python_shell=False) return True
[ "def", "on", "(", "device", ")", ":", "cmd", "=", "'quotaon {0}'", ".", "format", "(", "device", ")", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ",", "python_shell", "=", "False", ")", "return", "True" ]
Turns on the quota system CLI Example: .. code-block:: bash salt '*' quota.on
[ "Turns", "on", "the", "quota", "system" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/quota.py#L193-L205
33,775
saltstack/salt
salt/modules/quota.py
off
def off(device): ''' Turns off the quota system CLI Example: .. code-block:: bash salt '*' quota.off ''' cmd = 'quotaoff {0}'.format(device) __salt__['cmd.run'](cmd, python_shell=False) return True
python
def off(device): ''' Turns off the quota system CLI Example: .. code-block:: bash salt '*' quota.off ''' cmd = 'quotaoff {0}'.format(device) __salt__['cmd.run'](cmd, python_shell=False) return True
[ "def", "off", "(", "device", ")", ":", "cmd", "=", "'quotaoff {0}'", ".", "format", "(", "device", ")", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ",", "python_shell", "=", "False", ")", "return", "True" ]
Turns off the quota system CLI Example: .. code-block:: bash salt '*' quota.off
[ "Turns", "off", "the", "quota", "system" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/quota.py#L208-L220
33,776
saltstack/salt
salt/modules/quota.py
get_mode
def get_mode(device): ''' Report whether the quota system for this device is on or off CLI Example: .. code-block:: bash salt '*' quota.get_mode ''' ret = {} cmd = 'quotaon -p {0}'.format(device) out = __salt__['cmd.run'](cmd, python_shell=False) for line in out.splitlines...
python
def get_mode(device): ''' Report whether the quota system for this device is on or off CLI Example: .. code-block:: bash salt '*' quota.get_mode ''' ret = {} cmd = 'quotaon -p {0}'.format(device) out = __salt__['cmd.run'](cmd, python_shell=False) for line in out.splitlines...
[ "def", "get_mode", "(", "device", ")", ":", "ret", "=", "{", "}", "cmd", "=", "'quotaon -p {0}'", ".", "format", "(", "device", ")", "out", "=", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ",", "python_shell", "=", "False", ")", "for", "line", "in...
Report whether the quota system for this device is on or off CLI Example: .. code-block:: bash salt '*' quota.get_mode
[ "Report", "whether", "the", "quota", "system", "for", "this", "device", "is", "on", "or", "off" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/quota.py#L223-L251
33,777
saltstack/salt
salt/modules/rsync.py
_check
def _check(delete, force, update, passwordfile, exclude, excludefrom, dryrun, rsh): ''' Generate rsync options ''' options = ['-avz'] if delete: options.append('--delete') if force: options.append('--force') if update: options.append('--update') if rsh: o...
python
def _check(delete, force, update, passwordfile, exclude, excludefrom, dryrun, rsh): ''' Generate rsync options ''' options = ['-avz'] if delete: options.append('--delete') if force: options.append('--force') if update: options.append('--update') if rsh: o...
[ "def", "_check", "(", "delete", ",", "force", ",", "update", ",", "passwordfile", ",", "exclude", ",", "excludefrom", ",", "dryrun", ",", "rsh", ")", ":", "options", "=", "[", "'-avz'", "]", "if", "delete", ":", "options", ".", "append", "(", "'--delet...
Generate rsync options
[ "Generate", "rsync", "options" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rsync.py#L38-L66
33,778
saltstack/salt
salt/states/keystone_role.py
present
def present(name, auth=None, **kwargs): ''' Ensure an role exists name Name of the role description An arbitrary description of the role ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} kwargs = __utils__['args.clean_k...
python
def present(name, auth=None, **kwargs): ''' Ensure an role exists name Name of the role description An arbitrary description of the role ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} kwargs = __utils__['args.clean_k...
[ "def", "present", "(", "name", ",", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "kwargs", "=", ...
Ensure an role exists name Name of the role description An arbitrary description of the role
[ "Ensure", "an", "role", "exists" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keystone_role.py#L40-L75
33,779
saltstack/salt
salt/states/keystone_role.py
absent
def absent(name, auth=None, **kwargs): ''' Ensure role does not exist name Name of the role ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} __salt__['keystoneng.setup_clouds'](auth) kwargs['name'] = name role = __salt__['...
python
def absent(name, auth=None, **kwargs): ''' Ensure role does not exist name Name of the role ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} __salt__['keystoneng.setup_clouds'](auth) kwargs['name'] = name role = __salt__['...
[ "def", "absent", "(", "name", ",", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "__salt__", "[", ...
Ensure role does not exist name Name of the role
[ "Ensure", "role", "does", "not", "exist" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keystone_role.py#L78-L106
33,780
saltstack/salt
salt/modules/mac_assistive.py
install
def install(app_id, enable=True): ''' Install a bundle ID or command as being allowed to use assistive access. app_id The bundle ID or command to install for assistive access. enabled Sets enabled or disabled status. Default is ``True``. CLI Example: .. code-block:: bash ...
python
def install(app_id, enable=True): ''' Install a bundle ID or command as being allowed to use assistive access. app_id The bundle ID or command to install for assistive access. enabled Sets enabled or disabled status. Default is ``True``. CLI Example: .. code-block:: bash ...
[ "def", "install", "(", "app_id", ",", "enable", "=", "True", ")", ":", "ge_el_capitan", "=", "True", "if", "_LooseVersion", "(", "__grains__", "[", "'osrelease'", "]", ")", ">=", "salt", ".", "utils", ".", "stringutils", ".", "to_str", "(", "'10.11'", ")...
Install a bundle ID or command as being allowed to use assistive access. app_id The bundle ID or command to install for assistive access. enabled Sets enabled or disabled status. Default is ``True``. CLI Example: .. code-block:: bash salt '*' assistive.install /usr/bin/o...
[ "Install", "a", "bundle", "ID", "or", "command", "as", "being", "allowed", "to", "use", "assistive", "access", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_assistive.py#L39-L78
33,781
saltstack/salt
salt/modules/mac_assistive.py
enable
def enable(app_id, enabled=True): ''' Enable or disable an existing assistive access application. app_id The bundle ID or command to set assistive access status. enabled Sets enabled or disabled status. Default is ``True``. CLI Example: .. code-block:: bash salt '*' ...
python
def enable(app_id, enabled=True): ''' Enable or disable an existing assistive access application. app_id The bundle ID or command to set assistive access status. enabled Sets enabled or disabled status. Default is ``True``. CLI Example: .. code-block:: bash salt '*' ...
[ "def", "enable", "(", "app_id", ",", "enabled", "=", "True", ")", ":", "enable_str", "=", "'1'", "if", "enabled", "else", "'0'", "for", "a", "in", "_get_assistive_access", "(", ")", ":", "if", "app_id", "==", "a", "[", "0", "]", ":", "cmd", "=", "'...
Enable or disable an existing assistive access application. app_id The bundle ID or command to set assistive access status. enabled Sets enabled or disabled status. Default is ``True``. CLI Example: .. code-block:: bash salt '*' assistive.enable /usr/bin/osascript sa...
[ "Enable", "or", "disable", "an", "existing", "assistive", "access", "application", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_assistive.py#L103-L143
33,782
saltstack/salt
salt/modules/mac_assistive.py
remove
def remove(app_id): ''' Remove a bundle ID or command as being allowed to use assistive access. app_id The bundle ID or command to remove from assistive access list. CLI Example: .. code-block:: bash salt '*' assistive.remove /usr/bin/osascript salt '*' assistive.remove c...
python
def remove(app_id): ''' Remove a bundle ID or command as being allowed to use assistive access. app_id The bundle ID or command to remove from assistive access list. CLI Example: .. code-block:: bash salt '*' assistive.remove /usr/bin/osascript salt '*' assistive.remove c...
[ "def", "remove", "(", "app_id", ")", ":", "cmd", "=", "'sqlite3 \"/Library/Application Support/com.apple.TCC/TCC.db\" '", "'\"DELETE from access where client=\\'{0}\\'\"'", ".", "format", "(", "app_id", ")", "call", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ...
Remove a bundle ID or command as being allowed to use assistive access. app_id The bundle ID or command to remove from assistive access list. CLI Example: .. code-block:: bash salt '*' assistive.remove /usr/bin/osascript salt '*' assistive.remove com.smileonmymac.textexpander
[ "Remove", "a", "bundle", "ID", "or", "command", "as", "being", "allowed", "to", "use", "assistive", "access", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_assistive.py#L168-L199
33,783
saltstack/salt
salt/modules/mac_assistive.py
_get_assistive_access
def _get_assistive_access(): ''' Get a list of all of the assistive access applications installed, returns as a ternary showing whether each app is enabled or not. ''' cmd = 'sqlite3 "/Library/Application Support/com.apple.TCC/TCC.db" "SELECT * FROM access"' call = __salt__['cmd.run_all']( ...
python
def _get_assistive_access(): ''' Get a list of all of the assistive access applications installed, returns as a ternary showing whether each app is enabled or not. ''' cmd = 'sqlite3 "/Library/Application Support/com.apple.TCC/TCC.db" "SELECT * FROM access"' call = __salt__['cmd.run_all']( ...
[ "def", "_get_assistive_access", "(", ")", ":", "cmd", "=", "'sqlite3 \"/Library/Application Support/com.apple.TCC/TCC.db\" \"SELECT * FROM access\"'", "call", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ",", "output_loglevel", "=", "'debug'", ",", "python_shell"...
Get a list of all of the assistive access applications installed, returns as a ternary showing whether each app is enabled or not.
[ "Get", "a", "list", "of", "all", "of", "the", "assistive", "access", "applications", "installed", "returns", "as", "a", "ternary", "showing", "whether", "each", "app", "is", "enabled", "or", "not", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_assistive.py#L210-L232
33,784
saltstack/salt
salt/serializers/yaml.py
deserialize
def deserialize(stream_or_string, **options): ''' Deserialize any string of stream like object into a Python data structure. :param stream_or_string: stream or string to deserialize. :param options: options given to lower yaml module. ''' options.setdefault('Loader', Loader) try: r...
python
def deserialize(stream_or_string, **options): ''' Deserialize any string of stream like object into a Python data structure. :param stream_or_string: stream or string to deserialize. :param options: options given to lower yaml module. ''' options.setdefault('Loader', Loader) try: r...
[ "def", "deserialize", "(", "stream_or_string", ",", "*", "*", "options", ")", ":", "options", ".", "setdefault", "(", "'Loader'", ",", "Loader", ")", "try", ":", "return", "yaml", ".", "load", "(", "stream_or_string", ",", "*", "*", "options", ")", "exce...
Deserialize any string of stream like object into a Python data structure. :param stream_or_string: stream or string to deserialize. :param options: options given to lower yaml module.
[ "Deserialize", "any", "string", "of", "stream", "like", "object", "into", "a", "Python", "data", "structure", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/serializers/yaml.py#L41-L64
33,785
saltstack/salt
salt/serializers/yaml.py
serialize
def serialize(obj, **options): ''' Serialize Python data to YAML. :param obj: the data structure to serialize :param options: options given to lower yaml module. ''' options.setdefault('Dumper', Dumper) try: response = yaml.dump(obj, **options) if response.endswith('\n...\n...
python
def serialize(obj, **options): ''' Serialize Python data to YAML. :param obj: the data structure to serialize :param options: options given to lower yaml module. ''' options.setdefault('Dumper', Dumper) try: response = yaml.dump(obj, **options) if response.endswith('\n...\n...
[ "def", "serialize", "(", "obj", ",", "*", "*", "options", ")", ":", "options", ".", "setdefault", "(", "'Dumper'", ",", "Dumper", ")", "try", ":", "response", "=", "yaml", ".", "dump", "(", "obj", ",", "*", "*", "options", ")", "if", "response", "....
Serialize Python data to YAML. :param obj: the data structure to serialize :param options: options given to lower yaml module.
[ "Serialize", "Python", "data", "to", "YAML", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/serializers/yaml.py#L67-L85
33,786
saltstack/salt
salt/modules/win_certutil.py
get_cert_serial
def get_cert_serial(cert_file): ''' Get the serial number of a certificate file cert_file The certificate file to find the serial for CLI Example: .. code-block:: bash salt '*' certutil.get_cert_serial <certificate name> ''' cmd = "certutil.exe -silent -verify {0}".format...
python
def get_cert_serial(cert_file): ''' Get the serial number of a certificate file cert_file The certificate file to find the serial for CLI Example: .. code-block:: bash salt '*' certutil.get_cert_serial <certificate name> ''' cmd = "certutil.exe -silent -verify {0}".format...
[ "def", "get_cert_serial", "(", "cert_file", ")", ":", "cmd", "=", "\"certutil.exe -silent -verify {0}\"", ".", "format", "(", "cert_file", ")", "out", "=", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ")", "# match serial number by paragraph to work with multiple lang...
Get the serial number of a certificate file cert_file The certificate file to find the serial for CLI Example: .. code-block:: bash salt '*' certutil.get_cert_serial <certificate name>
[ "Get", "the", "serial", "number", "of", "a", "certificate", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_certutil.py#L32-L52
33,787
saltstack/salt
salt/modules/win_certutil.py
get_stored_cert_serials
def get_stored_cert_serials(store): ''' Get all of the certificate serials in the specified store store The store to get all the certificate serials from CLI Example: .. code-block:: bash salt '*' certutil.get_stored_cert_serials <store> ''' cmd = "certutil.exe -store {0}...
python
def get_stored_cert_serials(store): ''' Get all of the certificate serials in the specified store store The store to get all the certificate serials from CLI Example: .. code-block:: bash salt '*' certutil.get_stored_cert_serials <store> ''' cmd = "certutil.exe -store {0}...
[ "def", "get_stored_cert_serials", "(", "store", ")", ":", "cmd", "=", "\"certutil.exe -store {0}\"", ".", "format", "(", "store", ")", "out", "=", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ")", "# match serial numbers by header position to work with multiple langua...
Get all of the certificate serials in the specified store store The store to get all the certificate serials from CLI Example: .. code-block:: bash salt '*' certutil.get_stored_cert_serials <store>
[ "Get", "all", "of", "the", "certificate", "serials", "in", "the", "specified", "store" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_certutil.py#L55-L72
33,788
saltstack/salt
salt/modules/win_certutil.py
add_store
def add_store(source, store, saltenv='base'): ''' Add the given cert into the given Certificate Store source The source certificate file this can be in the form salt://path/to/file store The certificate store to add the certificate to saltenv The salt environment t...
python
def add_store(source, store, saltenv='base'): ''' Add the given cert into the given Certificate Store source The source certificate file this can be in the form salt://path/to/file store The certificate store to add the certificate to saltenv The salt environment t...
[ "def", "add_store", "(", "source", ",", "store", ",", "saltenv", "=", "'base'", ")", ":", "cert_file", "=", "__salt__", "[", "'cp.cache_file'", "]", "(", "source", ",", "saltenv", ")", "cmd", "=", "\"certutil.exe -addstore {0} {1}\"", ".", "format", "(", "st...
Add the given cert into the given Certificate Store source The source certificate file this can be in the form salt://path/to/file store The certificate store to add the certificate to saltenv The salt environment to use this is ignored if the path is local CL...
[ "Add", "the", "given", "cert", "into", "the", "given", "Certificate", "Store" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_certutil.py#L75-L98
33,789
saltstack/salt
salt/modules/win_certutil.py
del_store
def del_store(source, store, saltenv='base'): ''' Delete the given cert into the given Certificate Store source The source certificate file this can be in the form salt://path/to/file store The certificate store to delete the certificate from saltenv The salt envir...
python
def del_store(source, store, saltenv='base'): ''' Delete the given cert into the given Certificate Store source The source certificate file this can be in the form salt://path/to/file store The certificate store to delete the certificate from saltenv The salt envir...
[ "def", "del_store", "(", "source", ",", "store", ",", "saltenv", "=", "'base'", ")", ":", "cert_file", "=", "__salt__", "[", "'cp.cache_file'", "]", "(", "source", ",", "saltenv", ")", "serial", "=", "get_cert_serial", "(", "cert_file", ")", "cmd", "=", ...
Delete the given cert into the given Certificate Store source The source certificate file this can be in the form salt://path/to/file store The certificate store to delete the certificate from saltenv The salt environment to use this is ignored if the path is local...
[ "Delete", "the", "given", "cert", "into", "the", "given", "Certificate", "Store" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_certutil.py#L101-L125
33,790
saltstack/salt
salt/states/ddns.py
present
def present(name, zone, ttl, data, rdtype='A', **kwargs): ''' Ensures that the named DNS record is present with the given ttl. name The host portion of the DNS record, e.g., 'webserver'. Name and zone are concatenated when the entry is created unless name includes a trailing dot, so...
python
def present(name, zone, ttl, data, rdtype='A', **kwargs): ''' Ensures that the named DNS record is present with the given ttl. name The host portion of the DNS record, e.g., 'webserver'. Name and zone are concatenated when the entry is created unless name includes a trailing dot, so...
[ "def", "present", "(", "name", ",", "zone", ",", "ttl", ",", "data", ",", "rdtype", "=", "'A'", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "False", ",", "'co...
Ensures that the named DNS record is present with the given ttl. name The host portion of the DNS record, e.g., 'webserver'. Name and zone are concatenated when the entry is created unless name includes a trailing dot, so make sure that information is not duplicated in these two arg...
[ "Ensures", "that", "the", "named", "DNS", "record", "is", "present", "with", "the", "given", "ttl", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ddns.py#L35-L91
33,791
saltstack/salt
salt/states/ddns.py
absent
def absent(name, zone, data=None, rdtype=None, **kwargs): ''' Ensures that the named DNS record is absent. name The host portion of the DNS record, e.g., 'webserver'. Name and zone are concatenated when the entry is created unless name includes a trailing dot, so make sure that info...
python
def absent(name, zone, data=None, rdtype=None, **kwargs): ''' Ensures that the named DNS record is absent. name The host portion of the DNS record, e.g., 'webserver'. Name and zone are concatenated when the entry is created unless name includes a trailing dot, so make sure that info...
[ "def", "absent", "(", "name", ",", "zone", ",", "data", "=", "None", ",", "rdtype", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "False", ",", "'c...
Ensures that the named DNS record is absent. name The host portion of the DNS record, e.g., 'webserver'. Name and zone are concatenated when the entry is created unless name includes a trailing dot, so make sure that information is not duplicated in these two arguments. zone ...
[ "Ensures", "that", "the", "named", "DNS", "record", "is", "absent", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ddns.py#L94-L145
33,792
saltstack/salt
salt/renderers/json.py
render
def render(json_data, saltenv='base', sls='', **kws): ''' Accepts JSON as a string or as a file object and runs it through the JSON parser. :rtype: A Python data structure ''' if not isinstance(json_data, six.string_types): json_data = json_data.read() if json_data.startswith('#!')...
python
def render(json_data, saltenv='base', sls='', **kws): ''' Accepts JSON as a string or as a file object and runs it through the JSON parser. :rtype: A Python data structure ''' if not isinstance(json_data, six.string_types): json_data = json_data.read() if json_data.startswith('#!')...
[ "def", "render", "(", "json_data", ",", "saltenv", "=", "'base'", ",", "sls", "=", "''", ",", "*", "*", "kws", ")", ":", "if", "not", "isinstance", "(", "json_data", ",", "six", ".", "string_types", ")", ":", "json_data", "=", "json_data", ".", "read...
Accepts JSON as a string or as a file object and runs it through the JSON parser. :rtype: A Python data structure
[ "Accepts", "JSON", "as", "a", "string", "or", "as", "a", "file", "object", "and", "runs", "it", "through", "the", "JSON", "parser", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/json.py#L16-L30
33,793
saltstack/salt
salt/modules/at.py
_atq
def _atq(**kwargs): ''' Return match jobs list ''' jobs = [] runas = kwargs.get('runas', None) tag = kwargs.get('tag', None) hour = kwargs.get('hour', None) minute = kwargs.get('minute', None) day = kwargs.get('day', None) month = kwargs.get('month', None) year = kwargs.get...
python
def _atq(**kwargs): ''' Return match jobs list ''' jobs = [] runas = kwargs.get('runas', None) tag = kwargs.get('tag', None) hour = kwargs.get('hour', None) minute = kwargs.get('minute', None) day = kwargs.get('day', None) month = kwargs.get('month', None) year = kwargs.get...
[ "def", "_atq", "(", "*", "*", "kwargs", ")", ":", "jobs", "=", "[", "]", "runas", "=", "kwargs", ".", "get", "(", "'runas'", ",", "None", ")", "tag", "=", "kwargs", ".", "get", "(", "'tag'", ",", "None", ")", "hour", "=", "kwargs", ".", "get", ...
Return match jobs list
[ "Return", "match", "jobs", "list" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/at.py#L290-L368
33,794
saltstack/salt
salt/cli/support/__init__.py
get_profiles
def get_profiles(config): ''' Get available profiles. :return: ''' profiles = [] for profile_name in os.listdir(os.path.join(os.path.dirname(__file__), 'profiles')): if profile_name.endswith('.yml'): profiles.append(profile_name.split('.')[0]) return sorted(profiles)
python
def get_profiles(config): ''' Get available profiles. :return: ''' profiles = [] for profile_name in os.listdir(os.path.join(os.path.dirname(__file__), 'profiles')): if profile_name.endswith('.yml'): profiles.append(profile_name.split('.')[0]) return sorted(profiles)
[ "def", "get_profiles", "(", "config", ")", ":", "profiles", "=", "[", "]", "for", "profile_name", "in", "os", ".", "listdir", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "'profiles'", ")", ...
Get available profiles. :return:
[ "Get", "available", "profiles", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/__init__.py#L55-L66
33,795
saltstack/salt
salt/utils/user.py
get_user
def get_user(): ''' Get the current user ''' if HAS_PWD: ret = pwd.getpwuid(os.geteuid()).pw_name elif HAS_WIN_FUNCTIONS and salt.utils.win_functions.HAS_WIN32: ret = salt.utils.win_functions.get_current_user() else: raise CommandExecutionError( 'Required exte...
python
def get_user(): ''' Get the current user ''' if HAS_PWD: ret = pwd.getpwuid(os.geteuid()).pw_name elif HAS_WIN_FUNCTIONS and salt.utils.win_functions.HAS_WIN32: ret = salt.utils.win_functions.get_current_user() else: raise CommandExecutionError( 'Required exte...
[ "def", "get_user", "(", ")", ":", "if", "HAS_PWD", ":", "ret", "=", "pwd", ".", "getpwuid", "(", "os", ".", "geteuid", "(", ")", ")", ".", "pw_name", "elif", "HAS_WIN_FUNCTIONS", "and", "salt", ".", "utils", ".", "win_functions", ".", "HAS_WIN32", ":",...
Get the current user
[ "Get", "the", "current", "user" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/user.py#L54-L65
33,796
saltstack/salt
salt/utils/user.py
get_uid
def get_uid(user=None): ''' Get the uid for a given user name. If no user given, the current euid will be returned. If the user does not exist, None will be returned. On systems which do not support pwd or os.geteuid, None will be returned. ''' if not HAS_PWD: return None elif user i...
python
def get_uid(user=None): ''' Get the uid for a given user name. If no user given, the current euid will be returned. If the user does not exist, None will be returned. On systems which do not support pwd or os.geteuid, None will be returned. ''' if not HAS_PWD: return None elif user i...
[ "def", "get_uid", "(", "user", "=", "None", ")", ":", "if", "not", "HAS_PWD", ":", "return", "None", "elif", "user", "is", "None", ":", "try", ":", "return", "os", ".", "geteuid", "(", ")", "except", "AttributeError", ":", "return", "None", "else", "...
Get the uid for a given user name. If no user given, the current euid will be returned. If the user does not exist, None will be returned. On systems which do not support pwd or os.geteuid, None will be returned.
[ "Get", "the", "uid", "for", "a", "given", "user", "name", ".", "If", "no", "user", "given", "the", "current", "euid", "will", "be", "returned", ".", "If", "the", "user", "does", "not", "exist", "None", "will", "be", "returned", ".", "On", "systems", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/user.py#L69-L86
33,797
saltstack/salt
salt/utils/user.py
_win_user_token_is_admin
def _win_user_token_is_admin(user_token): ''' Using the win32 api, determine if the user with token 'user_token' has administrator rights. See MSDN entry here: http://msdn.microsoft.com/en-us/library/aa376389(VS.85).aspx ''' class SID_IDENTIFIER_AUTHORITY(ctypes.Structure): _fie...
python
def _win_user_token_is_admin(user_token): ''' Using the win32 api, determine if the user with token 'user_token' has administrator rights. See MSDN entry here: http://msdn.microsoft.com/en-us/library/aa376389(VS.85).aspx ''' class SID_IDENTIFIER_AUTHORITY(ctypes.Structure): _fie...
[ "def", "_win_user_token_is_admin", "(", "user_token", ")", ":", "class", "SID_IDENTIFIER_AUTHORITY", "(", "ctypes", ".", "Structure", ")", ":", "_fields_", "=", "[", "(", "\"byte0\"", ",", "ctypes", ".", "c_byte", ")", ",", "(", "\"byte1\"", ",", "ctypes", "...
Using the win32 api, determine if the user with token 'user_token' has administrator rights. See MSDN entry here: http://msdn.microsoft.com/en-us/library/aa376389(VS.85).aspx
[ "Using", "the", "win32", "api", "determine", "if", "the", "user", "with", "token", "user_token", "has", "administrator", "rights", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/user.py#L89-L131
33,798
saltstack/salt
salt/utils/user.py
get_specific_user
def get_specific_user(): ''' Get a user name for publishing. If you find the user is "root" attempt to be more specific ''' user = get_user() if salt.utils.platform.is_windows(): if _win_current_user_is_admin(): return 'sudo_{0}'.format(user) else: env_vars = ('SU...
python
def get_specific_user(): ''' Get a user name for publishing. If you find the user is "root" attempt to be more specific ''' user = get_user() if salt.utils.platform.is_windows(): if _win_current_user_is_admin(): return 'sudo_{0}'.format(user) else: env_vars = ('SU...
[ "def", "get_specific_user", "(", ")", ":", "user", "=", "get_user", "(", ")", "if", "salt", ".", "utils", ".", "platform", ".", "is_windows", "(", ")", ":", "if", "_win_current_user_is_admin", "(", ")", ":", "return", "'sudo_{0}'", ".", "format", "(", "u...
Get a user name for publishing. If you find the user is "root" attempt to be more specific
[ "Get", "a", "user", "name", "for", "publishing", ".", "If", "you", "find", "the", "user", "is", "root", "attempt", "to", "be", "more", "specific" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/user.py#L142-L157
33,799
saltstack/salt
salt/utils/user.py
get_default_group
def get_default_group(user): ''' Returns the specified user's default group. If the user doesn't exist, a KeyError will be raised. ''' return grp.getgrgid(pwd.getpwnam(user).pw_gid).gr_name \ if HAS_GRP and HAS_PWD \ else None
python
def get_default_group(user): ''' Returns the specified user's default group. If the user doesn't exist, a KeyError will be raised. ''' return grp.getgrgid(pwd.getpwnam(user).pw_gid).gr_name \ if HAS_GRP and HAS_PWD \ else None
[ "def", "get_default_group", "(", "user", ")", ":", "return", "grp", ".", "getgrgid", "(", "pwd", ".", "getpwnam", "(", "user", ")", ".", "pw_gid", ")", ".", "gr_name", "if", "HAS_GRP", "and", "HAS_PWD", "else", "None" ]
Returns the specified user's default group. If the user doesn't exist, a KeyError will be raised.
[ "Returns", "the", "specified", "user", "s", "default", "group", ".", "If", "the", "user", "doesn", "t", "exist", "a", "KeyError", "will", "be", "raised", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/user.py#L260-L267