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
35,300
saltstack/salt
salt/modules/ssh.py
_get_config_file
def _get_config_file(user, config): ''' Get absolute path to a user's ssh_config. ''' uinfo = __salt__['user.info'](user) if not uinfo: raise CommandExecutionError('User \'{0}\' does not exist'.format(user)) home = uinfo['home'] config = _expand_authorized_keys_path(config, user, hom...
python
def _get_config_file(user, config): ''' Get absolute path to a user's ssh_config. ''' uinfo = __salt__['user.info'](user) if not uinfo: raise CommandExecutionError('User \'{0}\' does not exist'.format(user)) home = uinfo['home'] config = _expand_authorized_keys_path(config, user, hom...
[ "def", "_get_config_file", "(", "user", ",", "config", ")", ":", "uinfo", "=", "__salt__", "[", "'user.info'", "]", "(", "user", ")", "if", "not", "uinfo", ":", "raise", "CommandExecutionError", "(", "'User \\'{0}\\' does not exist'", ".", "format", "(", "user...
Get absolute path to a user's ssh_config.
[ "Get", "absolute", "path", "to", "a", "user", "s", "ssh_config", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L123-L134
35,301
saltstack/salt
salt/modules/ssh.py
_replace_auth_key
def _replace_auth_key( user, key, enc='ssh-rsa', comment='', options=None, config='.ssh/authorized_keys'): ''' Replace an existing key ''' auth_line = _format_auth_line(key, enc, comment, options or []) lines = [] full = _get_config_file(user, co...
python
def _replace_auth_key( user, key, enc='ssh-rsa', comment='', options=None, config='.ssh/authorized_keys'): ''' Replace an existing key ''' auth_line = _format_auth_line(key, enc, comment, options or []) lines = [] full = _get_config_file(user, co...
[ "def", "_replace_auth_key", "(", "user", ",", "key", ",", "enc", "=", "'ssh-rsa'", ",", "comment", "=", "''", ",", "options", "=", "None", ",", "config", "=", "'.ssh/authorized_keys'", ")", ":", "auth_line", "=", "_format_auth_line", "(", "key", ",", "enc"...
Replace an existing key
[ "Replace", "an", "existing", "key" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L137-L181
35,302
saltstack/salt
salt/modules/ssh.py
_validate_keys
def _validate_keys(key_file, fingerprint_hash_type): ''' Return a dict containing validated keys in the passed file ''' ret = {} linere = re.compile(r'^(.*?)\s?((?:ssh\-|ecds)[\w-]+\s.+)$') try: with salt.utils.files.fopen(key_file, 'r') as _fh: for line in _fh: ...
python
def _validate_keys(key_file, fingerprint_hash_type): ''' Return a dict containing validated keys in the passed file ''' ret = {} linere = re.compile(r'^(.*?)\s?((?:ssh\-|ecds)[\w-]+\s.+)$') try: with salt.utils.files.fopen(key_file, 'r') as _fh: for line in _fh: ...
[ "def", "_validate_keys", "(", "key_file", ",", "fingerprint_hash_type", ")", ":", "ret", "=", "{", "}", "linere", "=", "re", ".", "compile", "(", "r'^(.*?)\\s?((?:ssh\\-|ecds)[\\w-]+\\s.+)$'", ")", "try", ":", "with", "salt", ".", "utils", ".", "files", ".", ...
Return a dict containing validated keys in the passed file
[ "Return", "a", "dict", "containing", "validated", "keys", "in", "the", "passed", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L184-L239
35,303
saltstack/salt
salt/modules/ssh.py
_fingerprint
def _fingerprint(public_key, fingerprint_hash_type): ''' Return a public key fingerprint based on its base64-encoded representation The fingerprint string is formatted according to RFC 4716 (ch.4), that is, in the form "xx:xx:...:xx" If the key is invalid (incorrect base64 string), return None ...
python
def _fingerprint(public_key, fingerprint_hash_type): ''' Return a public key fingerprint based on its base64-encoded representation The fingerprint string is formatted according to RFC 4716 (ch.4), that is, in the form "xx:xx:...:xx" If the key is invalid (incorrect base64 string), return None ...
[ "def", "_fingerprint", "(", "public_key", ",", "fingerprint_hash_type", ")", ":", "if", "fingerprint_hash_type", ":", "hash_type", "=", "fingerprint_hash_type", ".", "lower", "(", ")", "else", ":", "hash_type", "=", "'sha256'", "try", ":", "hash_func", "=", "get...
Return a public key fingerprint based on its base64-encoded representation The fingerprint string is formatted according to RFC 4716 (ch.4), that is, in the form "xx:xx:...:xx" If the key is invalid (incorrect base64 string), return None public_key The public key to return the fingerprint for...
[ "Return", "a", "public", "key", "fingerprint", "based", "on", "its", "base64", "-", "encoded", "representation" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L242-L287
35,304
saltstack/salt
salt/modules/ssh.py
host_keys
def host_keys(keydir=None, private=True, certs=True): ''' Return the minion's host keys CLI Example: .. code-block:: bash salt '*' ssh.host_keys salt '*' ssh.host_keys keydir=/etc/ssh salt '*' ssh.host_keys keydir=/etc/ssh private=False salt '*' ssh.host_keys keydir=/e...
python
def host_keys(keydir=None, private=True, certs=True): ''' Return the minion's host keys CLI Example: .. code-block:: bash salt '*' ssh.host_keys salt '*' ssh.host_keys keydir=/etc/ssh salt '*' ssh.host_keys keydir=/etc/ssh private=False salt '*' ssh.host_keys keydir=/e...
[ "def", "host_keys", "(", "keydir", "=", "None", ",", "private", "=", "True", ",", "certs", "=", "True", ")", ":", "# TODO: support parsing sshd_config for the key directory", "if", "not", "keydir", ":", "if", "__grains__", "[", "'kernel'", "]", "==", "'Linux'", ...
Return the minion's host keys CLI Example: .. code-block:: bash salt '*' ssh.host_keys salt '*' ssh.host_keys keydir=/etc/ssh salt '*' ssh.host_keys keydir=/etc/ssh private=False salt '*' ssh.host_keys keydir=/etc/ssh certs=False
[ "Return", "the", "minion", "s", "host", "keys" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L314-L370
35,305
saltstack/salt
salt/modules/ssh.py
auth_keys
def auth_keys(user=None, config='.ssh/authorized_keys', fingerprint_hash_type=None): ''' Return the authorized keys for users CLI Example: .. code-block:: bash salt '*' ssh.auth_keys salt '*' ssh.auth_keys root salt '*' ssh.auth_keys user=root ...
python
def auth_keys(user=None, config='.ssh/authorized_keys', fingerprint_hash_type=None): ''' Return the authorized keys for users CLI Example: .. code-block:: bash salt '*' ssh.auth_keys salt '*' ssh.auth_keys root salt '*' ssh.auth_keys user=root ...
[ "def", "auth_keys", "(", "user", "=", "None", ",", "config", "=", "'.ssh/authorized_keys'", ",", "fingerprint_hash_type", "=", "None", ")", ":", "if", "not", "user", ":", "user", "=", "__salt__", "[", "'user.list_users'", "]", "(", ")", "old_output_when_one_us...
Return the authorized keys for users CLI Example: .. code-block:: bash salt '*' ssh.auth_keys salt '*' ssh.auth_keys root salt '*' ssh.auth_keys user=root salt '*' ssh.auth_keys user="[user1, user2]"
[ "Return", "the", "authorized", "keys", "for", "users" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L373-L413
35,306
saltstack/salt
salt/modules/ssh.py
check_key_file
def check_key_file(user, source, config='.ssh/authorized_keys', saltenv='base', fingerprint_hash_type=None): ''' Check a keyfile from a source destination against the local keys and return the keys to change CLI Example: ....
python
def check_key_file(user, source, config='.ssh/authorized_keys', saltenv='base', fingerprint_hash_type=None): ''' Check a keyfile from a source destination against the local keys and return the keys to change CLI Example: ....
[ "def", "check_key_file", "(", "user", ",", "source", ",", "config", "=", "'.ssh/authorized_keys'", ",", "saltenv", "=", "'base'", ",", "fingerprint_hash_type", "=", "None", ")", ":", "keyfile", "=", "__salt__", "[", "'cp.cache_file'", "]", "(", "source", ",", ...
Check a keyfile from a source destination against the local keys and return the keys to change CLI Example: .. code-block:: bash salt '*' ssh.check_key_file root salt://ssh/keyfile
[ "Check", "a", "keyfile", "from", "a", "source", "destination", "against", "the", "local", "keys", "and", "return", "the", "keys", "to", "change" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L416-L452
35,307
saltstack/salt
salt/modules/ssh.py
check_key
def check_key(user, key, enc, comment, options, config='.ssh/authorized_keys', cache_keys=None, fingerprint_hash_type=None): ''' Check to see if a key needs updating, returns "update", "add" or "exists" CLI Ex...
python
def check_key(user, key, enc, comment, options, config='.ssh/authorized_keys', cache_keys=None, fingerprint_hash_type=None): ''' Check to see if a key needs updating, returns "update", "add" or "exists" CLI Ex...
[ "def", "check_key", "(", "user", ",", "key", ",", "enc", ",", "comment", ",", "options", ",", "config", "=", "'.ssh/authorized_keys'", ",", "cache_keys", "=", "None", ",", "fingerprint_hash_type", "=", "None", ")", ":", "if", "cache_keys", "is", "None", ":...
Check to see if a key needs updating, returns "update", "add" or "exists" CLI Example: .. code-block:: bash salt '*' ssh.check_key <user> <key> <enc> <comment> <options>
[ "Check", "to", "see", "if", "a", "key", "needs", "updating", "returns", "update", "add", "or", "exists" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L455-L502
35,308
saltstack/salt
salt/modules/ssh.py
rm_auth_key_from_file
def rm_auth_key_from_file(user, source, config='.ssh/authorized_keys', saltenv='base', fingerprint_hash_type=None): ''' Remove an authorized key from the specified user's authorized key file, using a file...
python
def rm_auth_key_from_file(user, source, config='.ssh/authorized_keys', saltenv='base', fingerprint_hash_type=None): ''' Remove an authorized key from the specified user's authorized key file, using a file...
[ "def", "rm_auth_key_from_file", "(", "user", ",", "source", ",", "config", "=", "'.ssh/authorized_keys'", ",", "saltenv", "=", "'base'", ",", "fingerprint_hash_type", "=", "None", ")", ":", "lfile", "=", "__salt__", "[", "'cp.cache_file'", "]", "(", "source", ...
Remove an authorized key from the specified user's authorized key file, using a file as source CLI Example: .. code-block:: bash salt '*' ssh.rm_auth_key_from_file <user> salt://ssh_keys/<user>.id_rsa.pub
[ "Remove", "an", "authorized", "key", "from", "the", "specified", "user", "s", "authorized", "key", "file", "using", "a", "file", "as", "source" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L505-L554
35,309
saltstack/salt
salt/modules/ssh.py
rm_auth_key
def rm_auth_key(user, key, config='.ssh/authorized_keys', fingerprint_hash_type=None): ''' Remove an authorized key from the specified user's authorized key file CLI Example: .. code-block:: bash salt '*' ssh.rm_auth_key <user> <key> ''' ...
python
def rm_auth_key(user, key, config='.ssh/authorized_keys', fingerprint_hash_type=None): ''' Remove an authorized key from the specified user's authorized key file CLI Example: .. code-block:: bash salt '*' ssh.rm_auth_key <user> <key> ''' ...
[ "def", "rm_auth_key", "(", "user", ",", "key", ",", "config", "=", "'.ssh/authorized_keys'", ",", "fingerprint_hash_type", "=", "None", ")", ":", "current", "=", "auth_keys", "(", "user", ",", "config", "=", "config", ",", "fingerprint_hash_type", "=", "finger...
Remove an authorized key from the specified user's authorized key file CLI Example: .. code-block:: bash salt '*' ssh.rm_auth_key <user> <key>
[ "Remove", "an", "authorized", "key", "from", "the", "specified", "user", "s", "authorized", "key", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L557-L631
35,310
saltstack/salt
salt/modules/ssh.py
set_auth_key_from_file
def set_auth_key_from_file(user, source, config='.ssh/authorized_keys', saltenv='base', fingerprint_hash_type=None): ''' Add a key to the authorized_keys file, using a file as the source. CLI Example...
python
def set_auth_key_from_file(user, source, config='.ssh/authorized_keys', saltenv='base', fingerprint_hash_type=None): ''' Add a key to the authorized_keys file, using a file as the source. CLI Example...
[ "def", "set_auth_key_from_file", "(", "user", ",", "source", ",", "config", "=", "'.ssh/authorized_keys'", ",", "saltenv", "=", "'base'", ",", "fingerprint_hash_type", "=", "None", ")", ":", "# TODO: add support for pulling keys from other file sources as well", "lfile", ...
Add a key to the authorized_keys file, using a file as the source. CLI Example: .. code-block:: bash salt '*' ssh.set_auth_key_from_file <user> salt://ssh_keys/<user>.id_rsa.pub
[ "Add", "a", "key", "to", "the", "authorized_keys", "file", "using", "a", "file", "as", "the", "source", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L634-L689
35,311
saltstack/salt
salt/modules/ssh.py
_get_matched_host_line_numbers
def _get_matched_host_line_numbers(lines, enc): ''' Helper function which parses ssh-keygen -F function output and yield line number of known_hosts entries with encryption key type matching enc, one by one. ''' enc = enc if enc else "rsa" for i, line in enumerate(lines): if i % 2 == ...
python
def _get_matched_host_line_numbers(lines, enc): ''' Helper function which parses ssh-keygen -F function output and yield line number of known_hosts entries with encryption key type matching enc, one by one. ''' enc = enc if enc else "rsa" for i, line in enumerate(lines): if i % 2 == ...
[ "def", "_get_matched_host_line_numbers", "(", "lines", ",", "enc", ")", ":", "enc", "=", "enc", "if", "enc", "else", "\"rsa\"", "for", "i", ",", "line", "in", "enumerate", "(", "lines", ")", ":", "if", "i", "%", "2", "==", "0", ":", "line_no", "=", ...
Helper function which parses ssh-keygen -F function output and yield line number of known_hosts entries with encryption key type matching enc, one by one.
[ "Helper", "function", "which", "parses", "ssh", "-", "keygen", "-", "F", "function", "output", "and", "yield", "line", "number", "of", "known_hosts", "entries", "with", "encryption", "key", "type", "matching", "enc", "one", "by", "one", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L799-L812
35,312
saltstack/salt
salt/modules/ssh.py
_parse_openssh_output
def _parse_openssh_output(lines, fingerprint_hash_type=None): ''' Helper function which parses ssh-keygen -F and ssh-keyscan function output and yield dict with keys information, one by one. ''' for line in lines: # We don't need any whitespace-only containing lines or arbitrary doubled newl...
python
def _parse_openssh_output(lines, fingerprint_hash_type=None): ''' Helper function which parses ssh-keygen -F and ssh-keyscan function output and yield dict with keys information, one by one. ''' for line in lines: # We don't need any whitespace-only containing lines or arbitrary doubled newl...
[ "def", "_parse_openssh_output", "(", "lines", ",", "fingerprint_hash_type", "=", "None", ")", ":", "for", "line", "in", "lines", ":", "# We don't need any whitespace-only containing lines or arbitrary doubled newlines", "line", "=", "line", ".", "strip", "(", ")", "if",...
Helper function which parses ssh-keygen -F and ssh-keyscan function output and yield dict with keys information, one by one.
[ "Helper", "function", "which", "parses", "ssh", "-", "keygen", "-", "F", "and", "ssh", "-", "keyscan", "function", "output", "and", "yield", "dict", "with", "keys", "information", "one", "by", "one", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L815-L838
35,313
saltstack/salt
salt/modules/ssh.py
rm_known_host
def rm_known_host(user=None, hostname=None, config=None, port=None): ''' Remove all keys belonging to hostname from a known_hosts file. CLI Example: .. code-block:: bash salt '*' ssh.rm_known_host <user> <hostname> ''' if not hostname: return {'status': 'error', ...
python
def rm_known_host(user=None, hostname=None, config=None, port=None): ''' Remove all keys belonging to hostname from a known_hosts file. CLI Example: .. code-block:: bash salt '*' ssh.rm_known_host <user> <hostname> ''' if not hostname: return {'status': 'error', ...
[ "def", "rm_known_host", "(", "user", "=", "None", ",", "hostname", "=", "None", ",", "config", "=", "None", ",", "port", "=", "None", ")", ":", "if", "not", "hostname", ":", "return", "{", "'status'", ":", "'error'", ",", "'error'", ":", "'hostname arg...
Remove all keys belonging to hostname from a known_hosts file. CLI Example: .. code-block:: bash salt '*' ssh.rm_known_host <user> <hostname>
[ "Remove", "all", "keys", "belonging", "to", "hostname", "from", "a", "known_hosts", "file", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L1013-L1044
35,314
saltstack/salt
salt/utils/boto3mod.py
_option
def _option(value): ''' Look up the value for an option. ''' if value in __opts__: return __opts__[value] master_opts = __pillar__.get('master', {}) if value in master_opts: return master_opts[value] if value in __pillar__: return __pillar__[value]
python
def _option(value): ''' Look up the value for an option. ''' if value in __opts__: return __opts__[value] master_opts = __pillar__.get('master', {}) if value in master_opts: return master_opts[value] if value in __pillar__: return __pillar__[value]
[ "def", "_option", "(", "value", ")", ":", "if", "value", "in", "__opts__", ":", "return", "__opts__", "[", "value", "]", "master_opts", "=", "__pillar__", ".", "get", "(", "'master'", ",", "{", "}", ")", "if", "value", "in", "master_opts", ":", "return...
Look up the value for an option.
[ "Look", "up", "the", "value", "for", "an", "option", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/boto3mod.py#L83-L93
35,315
saltstack/salt
salt/utils/boto3mod.py
paged_call
def paged_call(function, *args, **kwargs): """Retrieve full set of values from a boto3 API call that may truncate its results, yielding each page as it is obtained. """ marker_flag = kwargs.pop('marker_flag', 'NextMarker') marker_arg = kwargs.pop('marker_arg', 'Marker') while True: ret =...
python
def paged_call(function, *args, **kwargs): """Retrieve full set of values from a boto3 API call that may truncate its results, yielding each page as it is obtained. """ marker_flag = kwargs.pop('marker_flag', 'NextMarker') marker_arg = kwargs.pop('marker_arg', 'Marker') while True: ret =...
[ "def", "paged_call", "(", "function", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "marker_flag", "=", "kwargs", ".", "pop", "(", "'marker_flag'", ",", "'NextMarker'", ")", "marker_arg", "=", "kwargs", ".", "pop", "(", "'marker_arg'", ",", "'Mark...
Retrieve full set of values from a boto3 API call that may truncate its results, yielding each page as it is obtained.
[ "Retrieve", "full", "set", "of", "values", "from", "a", "boto3", "API", "call", "that", "may", "truncate", "its", "results", "yielding", "each", "page", "as", "it", "is", "obtained", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/boto3mod.py#L304-L316
35,316
saltstack/salt
salt/modules/win_path.py
_normalize_dir
def _normalize_dir(string_): ''' Normalize the directory to make comparison possible ''' return os.path.normpath(salt.utils.stringutils.to_unicode(string_))
python
def _normalize_dir(string_): ''' Normalize the directory to make comparison possible ''' return os.path.normpath(salt.utils.stringutils.to_unicode(string_))
[ "def", "_normalize_dir", "(", "string_", ")", ":", "return", "os", ".", "path", ".", "normpath", "(", "salt", ".", "utils", ".", "stringutils", ".", "to_unicode", "(", "string_", ")", ")" ]
Normalize the directory to make comparison possible
[ "Normalize", "the", "directory", "to", "make", "comparison", "possible" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_path.py#L48-L52
35,317
saltstack/salt
salt/modules/win_path.py
get_path
def get_path(): ''' Returns a list of items in the SYSTEM path CLI Example: .. code-block:: bash salt '*' win_path.get_path ''' ret = salt.utils.stringutils.to_unicode( __utils__['reg.read_value']( 'HKEY_LOCAL_MACHINE', 'SYSTEM\\CurrentControlSet\\Contr...
python
def get_path(): ''' Returns a list of items in the SYSTEM path CLI Example: .. code-block:: bash salt '*' win_path.get_path ''' ret = salt.utils.stringutils.to_unicode( __utils__['reg.read_value']( 'HKEY_LOCAL_MACHINE', 'SYSTEM\\CurrentControlSet\\Contr...
[ "def", "get_path", "(", ")", ":", "ret", "=", "salt", ".", "utils", ".", "stringutils", ".", "to_unicode", "(", "__utils__", "[", "'reg.read_value'", "]", "(", "'HKEY_LOCAL_MACHINE'", ",", "'SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment'", ","...
Returns a list of items in the SYSTEM path CLI Example: .. code-block:: bash salt '*' win_path.get_path
[ "Returns", "a", "list", "of", "items", "in", "the", "SYSTEM", "path" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_path.py#L76-L94
35,318
saltstack/salt
salt/modules/win_path.py
exists
def exists(path): ''' Check if the directory is configured in the SYSTEM path Case-insensitive and ignores trailing backslash Returns: boolean True if path exists, False if not CLI Example: .. code-block:: bash salt '*' win_path.exists 'c:\\python27' salt '*' win_path...
python
def exists(path): ''' Check if the directory is configured in the SYSTEM path Case-insensitive and ignores trailing backslash Returns: boolean True if path exists, False if not CLI Example: .. code-block:: bash salt '*' win_path.exists 'c:\\python27' salt '*' win_path...
[ "def", "exists", "(", "path", ")", ":", "path", "=", "_normalize_dir", "(", "path", ")", "sysPath", "=", "get_path", "(", ")", "return", "path", ".", "lower", "(", ")", "in", "(", "x", ".", "lower", "(", ")", "for", "x", "in", "sysPath", ")" ]
Check if the directory is configured in the SYSTEM path Case-insensitive and ignores trailing backslash Returns: boolean True if path exists, False if not CLI Example: .. code-block:: bash salt '*' win_path.exists 'c:\\python27' salt '*' win_path.exists 'c:\\python27\\' ...
[ "Check", "if", "the", "directory", "is", "configured", "in", "the", "SYSTEM", "path", "Case", "-", "insensitive", "and", "ignores", "trailing", "backslash" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_path.py#L97-L116
35,319
saltstack/salt
salt/modules/win_path.py
add
def add(path, index=None, **kwargs): ''' Add the directory to the SYSTEM path in the index location. Returns ``True`` if successful, otherwise ``False``. path Directory to add to path index Optionally specify an index at which to insert the directory rehash : True If t...
python
def add(path, index=None, **kwargs): ''' Add the directory to the SYSTEM path in the index location. Returns ``True`` if successful, otherwise ``False``. path Directory to add to path index Optionally specify an index at which to insert the directory rehash : True If t...
[ "def", "add", "(", "path", ",", "index", "=", "None", ",", "*", "*", "kwargs", ")", ":", "kwargs", "=", "salt", ".", "utils", ".", "args", ".", "clean_kwargs", "(", "*", "*", "kwargs", ")", "rehash_", "=", "kwargs", ".", "pop", "(", "'rehash'", "...
Add the directory to the SYSTEM path in the index location. Returns ``True`` if successful, otherwise ``False``. path Directory to add to path index Optionally specify an index at which to insert the directory rehash : True If the registry was updated, and this value is set to...
[ "Add", "the", "directory", "to", "the", "SYSTEM", "path", "in", "the", "index", "location", ".", "Returns", "True", "if", "successful", "otherwise", "False", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_path.py#L123-L285
35,320
saltstack/salt
salt/modules/win_path.py
remove
def remove(path, **kwargs): r''' Remove the directory from the SYSTEM path Returns: boolean True if successful, False if unsuccessful rehash : True If the registry was updated, and this value is set to ``True``, sends a WM_SETTINGCHANGE broadcast to refresh the environment vari...
python
def remove(path, **kwargs): r''' Remove the directory from the SYSTEM path Returns: boolean True if successful, False if unsuccessful rehash : True If the registry was updated, and this value is set to ``True``, sends a WM_SETTINGCHANGE broadcast to refresh the environment vari...
[ "def", "remove", "(", "path", ",", "*", "*", "kwargs", ")", ":", "kwargs", "=", "salt", ".", "utils", ".", "args", ".", "clean_kwargs", "(", "*", "*", "kwargs", ")", "rehash_", "=", "kwargs", ".", "pop", "(", "'rehash'", ",", "True", ")", "if", "...
r''' Remove the directory from the SYSTEM path Returns: boolean True if successful, False if unsuccessful rehash : True If the registry was updated, and this value is set to ``True``, sends a WM_SETTINGCHANGE broadcast to refresh the environment variables. Set this to ``Fal...
[ "r", "Remove", "the", "directory", "from", "the", "SYSTEM", "path" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_path.py#L288-L361
35,321
saltstack/salt
salt/output/table_out.py
output
def output(ret, **kwargs): ''' Display the output as table. Args: * nested_indent: integer, specify the left alignment. * has_header: boolean specifying if header should be displayed. Default: True. * row_delimiter: character to separate rows. Default: ``_``. * delim: chara...
python
def output(ret, **kwargs): ''' Display the output as table. Args: * nested_indent: integer, specify the left alignment. * has_header: boolean specifying if header should be displayed. Default: True. * row_delimiter: character to separate rows. Default: ``_``. * delim: chara...
[ "def", "output", "(", "ret", ",", "*", "*", "kwargs", ")", ":", "# to facilitate re-use", "if", "'opts'", "in", "kwargs", ":", "global", "__opts__", "# pylint: disable=W0601", "__opts__", "=", "kwargs", ".", "pop", "(", "'opts'", ")", "# Prefer kwargs before opt...
Display the output as table. Args: * nested_indent: integer, specify the left alignment. * has_header: boolean specifying if header should be displayed. Default: True. * row_delimiter: character to separate rows. Default: ``_``. * delim: character to separate columns. Default: ``" ...
[ "Display", "the", "output", "as", "table", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/table_out.py#L309-L370
35,322
saltstack/salt
salt/output/table_out.py
TableDisplay.ustring
def ustring(self, indent, color, msg, prefix='', suffix='', endc=None): '''Build the unicode string to be displayed.''' if endc is None: endc = self.ENDC # pylint: disable=no-member inde...
python
def ustring(self, indent, color, msg, prefix='', suffix='', endc=None): '''Build the unicode string to be displayed.''' if endc is None: endc = self.ENDC # pylint: disable=no-member inde...
[ "def", "ustring", "(", "self", ",", "indent", ",", "color", ",", "msg", ",", "prefix", "=", "''", ",", "suffix", "=", "''", ",", "endc", "=", "None", ")", ":", "if", "endc", "is", "None", ":", "endc", "=", "self", ".", "ENDC", "# pylint: disable=no...
Build the unicode string to be displayed.
[ "Build", "the", "unicode", "string", "to", "be", "displayed", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/table_out.py#L102-L119
35,323
saltstack/salt
salt/output/table_out.py
TableDisplay.wrap_onspace
def wrap_onspace(self, text): ''' When the text inside the column is longer then the width, will split by space and continue on the next line.''' def _truncate(line, word): return '{line}{part}{word}'.format( line=line, part=' \n'[(le...
python
def wrap_onspace(self, text): ''' When the text inside the column is longer then the width, will split by space and continue on the next line.''' def _truncate(line, word): return '{line}{part}{word}'.format( line=line, part=' \n'[(le...
[ "def", "wrap_onspace", "(", "self", ",", "text", ")", ":", "def", "_truncate", "(", "line", ",", "word", ")", ":", "return", "'{line}{part}{word}'", ".", "format", "(", "line", "=", "line", ",", "part", "=", "' \\n'", "[", "(", "len", "(", "line", "[...
When the text inside the column is longer then the width, will split by space and continue on the next line.
[ "When", "the", "text", "inside", "the", "column", "is", "longer", "then", "the", "width", "will", "split", "by", "space", "and", "continue", "on", "the", "next", "line", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/table_out.py#L121-L133
35,324
saltstack/salt
salt/output/table_out.py
TableDisplay.prepare_rows
def prepare_rows(self, rows, indent, has_header): '''Prepare rows content to be displayed.''' out = [] def row_wrapper(row): new_rows = [ self.wrapfunc(item).split('\n') for item in row ...
python
def prepare_rows(self, rows, indent, has_header): '''Prepare rows content to be displayed.''' out = [] def row_wrapper(row): new_rows = [ self.wrapfunc(item).split('\n') for item in row ...
[ "def", "prepare_rows", "(", "self", ",", "rows", ",", "indent", ",", "has_header", ")", ":", "out", "=", "[", "]", "def", "row_wrapper", "(", "row", ")", ":", "new_rows", "=", "[", "self", ".", "wrapfunc", "(", "item", ")", ".", "split", "(", "'\\n...
Prepare rows content to be displayed.
[ "Prepare", "rows", "content", "to", "be", "displayed", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/table_out.py#L135-L204
35,325
saltstack/salt
salt/output/table_out.py
TableDisplay.display_rows
def display_rows(self, rows, labels, indent): '''Prepares row content and displays.''' out = [] if not rows: return out first_row_type = type(rows[0]) # all rows must have the same datatype con...
python
def display_rows(self, rows, labels, indent): '''Prepares row content and displays.''' out = [] if not rows: return out first_row_type = type(rows[0]) # all rows must have the same datatype con...
[ "def", "display_rows", "(", "self", ",", "rows", ",", "labels", ",", "indent", ")", ":", "out", "=", "[", "]", "if", "not", "rows", ":", "return", "out", "first_row_type", "=", "type", "(", "rows", "[", "0", "]", ")", "# all rows must have the same datat...
Prepares row content and displays.
[ "Prepares", "row", "content", "and", "displays", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/table_out.py#L206-L250
35,326
saltstack/salt
salt/states/zfs.py
filesystem_absent
def filesystem_absent(name, force=False, recursive=False): ''' ensure filesystem is absent on the system name : string name of filesystem force : boolean try harder to destroy the dataset (zfs destroy -f) recursive : boolean also destroy all the child datasets (zfs destroy -...
python
def filesystem_absent(name, force=False, recursive=False): ''' ensure filesystem is absent on the system name : string name of filesystem force : boolean try harder to destroy the dataset (zfs destroy -f) recursive : boolean also destroy all the child datasets (zfs destroy -...
[ "def", "filesystem_absent", "(", "name", ",", "force", "=", "False", ",", "recursive", "=", "False", ")", ":", "if", "not", "__utils__", "[", "'zfs.is_dataset'", "]", "(", "name", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":",...
ensure filesystem is absent on the system name : string name of filesystem force : boolean try harder to destroy the dataset (zfs destroy -f) recursive : boolean also destroy all the child datasets (zfs destroy -r) .. warning:: If a volume with ``name`` exists, this st...
[ "ensure", "filesystem", "is", "absent", "on", "the", "system" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zfs.py#L138-L162
35,327
saltstack/salt
salt/states/zfs.py
snapshot_absent
def snapshot_absent(name, force=False, recursive=False, recursive_all=False): ''' ensure snapshot is absent on the system name : string name of snapshot force : boolean try harder to destroy the dataset (zfs destroy -f) recursive : boolean also destroy all the child datasets...
python
def snapshot_absent(name, force=False, recursive=False, recursive_all=False): ''' ensure snapshot is absent on the system name : string name of snapshot force : boolean try harder to destroy the dataset (zfs destroy -f) recursive : boolean also destroy all the child datasets...
[ "def", "snapshot_absent", "(", "name", ",", "force", "=", "False", ",", "recursive", "=", "False", ",", "recursive_all", "=", "False", ")", ":", "if", "not", "__utils__", "[", "'zfs.is_snapshot'", "]", "(", "name", ")", ":", "ret", "=", "{", "'name'", ...
ensure snapshot is absent on the system name : string name of snapshot force : boolean try harder to destroy the dataset (zfs destroy -f) recursive : boolean also destroy all the child datasets (zfs destroy -r) recursive_all : boolean recursively destroy all dependents, ...
[ "ensure", "snapshot", "is", "absent", "on", "the", "system" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zfs.py#L192-L214
35,328
saltstack/salt
salt/states/zfs.py
hold_absent
def hold_absent(name, snapshot, recursive=False): ''' ensure hold is absent on the system name : string name of hold snapshot : string name of snapshot recursive : boolean recursively releases a hold with the given tag on the snapshots of all descendent file systems. ''...
python
def hold_absent(name, snapshot, recursive=False): ''' ensure hold is absent on the system name : string name of hold snapshot : string name of snapshot recursive : boolean recursively releases a hold with the given tag on the snapshots of all descendent file systems. ''...
[ "def", "hold_absent", "(", "name", ",", "snapshot", ",", "recursive", "=", "False", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "## log configuration...
ensure hold is absent on the system name : string name of hold snapshot : string name of snapshot recursive : boolean recursively releases a hold with the given tag on the snapshots of all descendent file systems.
[ "ensure", "hold", "is", "absent", "on", "the", "system" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zfs.py#L239-L306
35,329
saltstack/salt
salt/states/zfs.py
filesystem_present
def filesystem_present(name, create_parent=False, properties=None, cloned_from=None): ''' ensure filesystem exists and has properties set name : string name of filesystem create_parent : boolean creates all the non-existing parent datasets. any property specified on the command ...
python
def filesystem_present(name, create_parent=False, properties=None, cloned_from=None): ''' ensure filesystem exists and has properties set name : string name of filesystem create_parent : boolean creates all the non-existing parent datasets. any property specified on the command ...
[ "def", "filesystem_present", "(", "name", ",", "create_parent", "=", "False", ",", "properties", "=", "None", ",", "cloned_from", "=", "None", ")", ":", "return", "_dataset_present", "(", "'filesystem'", ",", "name", ",", "create_parent", "=", "create_parent", ...
ensure filesystem exists and has properties set name : string name of filesystem create_parent : boolean creates all the non-existing parent datasets. any property specified on the command line using the -o option is ignored. cloned_from : string name of snapshot to clone ...
[ "ensure", "filesystem", "exists", "and", "has", "properties", "set" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zfs.py#L560-L589
35,330
saltstack/salt
salt/states/zfs.py
volume_present
def volume_present(name, volume_size, sparse=False, create_parent=False, properties=None, cloned_from=None): ''' ensure volume exists and has properties set name : string name of volume volume_size : string size of volume sparse : boolean create sparse volume create_pare...
python
def volume_present(name, volume_size, sparse=False, create_parent=False, properties=None, cloned_from=None): ''' ensure volume exists and has properties set name : string name of volume volume_size : string size of volume sparse : boolean create sparse volume create_pare...
[ "def", "volume_present", "(", "name", ",", "volume_size", ",", "sparse", "=", "False", ",", "create_parent", "=", "False", ",", "properties", "=", "None", ",", "cloned_from", "=", "None", ")", ":", "return", "_dataset_present", "(", "'volume'", ",", "name", ...
ensure volume exists and has properties set name : string name of volume volume_size : string size of volume sparse : boolean create sparse volume create_parent : boolean creates all the non-existing parent datasets. any property specified on the command line usi...
[ "ensure", "volume", "exists", "and", "has", "properties", "set" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zfs.py#L592-L633
35,331
saltstack/salt
salt/states/zfs.py
bookmark_present
def bookmark_present(name, snapshot): ''' ensure bookmark exists name : string name of bookmark snapshot : string name of snapshot ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} ## log configuration log.debug('zf...
python
def bookmark_present(name, snapshot): ''' ensure bookmark exists name : string name of bookmark snapshot : string name of snapshot ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} ## log configuration log.debug('zf...
[ "def", "bookmark_present", "(", "name", ",", "snapshot", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "## log configuration", "log", ".", "debug", "("...
ensure bookmark exists name : string name of bookmark snapshot : string name of snapshot
[ "ensure", "bookmark", "exists" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zfs.py#L636-L693
35,332
saltstack/salt
salt/states/zfs.py
snapshot_present
def snapshot_present(name, recursive=False, properties=None): ''' ensure snapshot exists and has properties set name : string name of snapshot recursive : boolean recursively create snapshots of all descendent datasets properties : dict additional zfs properties (-o) .....
python
def snapshot_present(name, recursive=False, properties=None): ''' ensure snapshot exists and has properties set name : string name of snapshot recursive : boolean recursively create snapshots of all descendent datasets properties : dict additional zfs properties (-o) .....
[ "def", "snapshot_present", "(", "name", ",", "recursive", "=", "False", ",", "properties", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}",...
ensure snapshot exists and has properties set name : string name of snapshot recursive : boolean recursively create snapshots of all descendent datasets properties : dict additional zfs properties (-o) .. note: Properties are only set at creation time
[ "ensure", "snapshot", "exists", "and", "has", "properties", "set" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zfs.py#L696-L754
35,333
saltstack/salt
salt/states/zfs.py
promoted
def promoted(name): ''' ensure a dataset is not a clone name : string name of fileset or volume .. warning:: only one dataset can be the origin, if you promote a clone the original will now point to the promoted dataset ''' ret = {'name': name, 'changes': {...
python
def promoted(name): ''' ensure a dataset is not a clone name : string name of fileset or volume .. warning:: only one dataset can be the origin, if you promote a clone the original will now point to the promoted dataset ''' ret = {'name': name, 'changes': {...
[ "def", "promoted", "(", "name", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "## check we if we have a valid dataset name", "if", "not", "__utils__", "[",...
ensure a dataset is not a clone name : string name of fileset or volume .. warning:: only one dataset can be the origin, if you promote a clone the original will now point to the promoted dataset
[ "ensure", "a", "dataset", "is", "not", "a", "clone" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zfs.py#L757-L807
35,334
saltstack/salt
salt/states/zfs.py
_schedule_snapshot_retrieve
def _schedule_snapshot_retrieve(dataset, prefix, snapshots): ''' Update snapshots dict with current snapshots dataset: string name of filesystem or volume prefix : string prefix for the snapshots e.g. 'test' will result in snapshots being named 'test-yyyymmdd_hhmm' snapshots...
python
def _schedule_snapshot_retrieve(dataset, prefix, snapshots): ''' Update snapshots dict with current snapshots dataset: string name of filesystem or volume prefix : string prefix for the snapshots e.g. 'test' will result in snapshots being named 'test-yyyymmdd_hhmm' snapshots...
[ "def", "_schedule_snapshot_retrieve", "(", "dataset", ",", "prefix", ",", "snapshots", ")", ":", "## NOTE: retrieve all snapshots for the dataset", "for", "snap", "in", "sorted", "(", "__salt__", "[", "'zfs.list'", "]", "(", "dataset", ",", "*", "*", "{", "'recurs...
Update snapshots dict with current snapshots dataset: string name of filesystem or volume prefix : string prefix for the snapshots e.g. 'test' will result in snapshots being named 'test-yyyymmdd_hhmm' snapshots : OrderedDict preseeded OrderedDict with configuration
[ "Update", "snapshots", "dict", "with", "current", "snapshots" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zfs.py#L810-L847
35,335
saltstack/salt
salt/states/zfs.py
_schedule_snapshot_prepare
def _schedule_snapshot_prepare(dataset, prefix, snapshots): ''' Update snapshots dict with info for a new snapshot dataset: string name of filesystem or volume prefix : string prefix for the snapshots e.g. 'test' will result in snapshots being named 'test-yyyymmdd_hhmm' snap...
python
def _schedule_snapshot_prepare(dataset, prefix, snapshots): ''' Update snapshots dict with info for a new snapshot dataset: string name of filesystem or volume prefix : string prefix for the snapshots e.g. 'test' will result in snapshots being named 'test-yyyymmdd_hhmm' snap...
[ "def", "_schedule_snapshot_prepare", "(", "dataset", ",", "prefix", ",", "snapshots", ")", ":", "## NOTE: generate new snapshot name", "snapshot_create_name", "=", "'{dataset}@{prefix}-{timestamp}'", ".", "format", "(", "dataset", "=", "dataset", ",", "prefix", "=", "pr...
Update snapshots dict with info for a new snapshot dataset: string name of filesystem or volume prefix : string prefix for the snapshots e.g. 'test' will result in snapshots being named 'test-yyyymmdd_hhmm' snapshots : OrderedDict preseeded OrderedDict with configuration
[ "Update", "snapshots", "dict", "with", "info", "for", "a", "new", "snapshot" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zfs.py#L850-L906
35,336
saltstack/salt
salt/modules/win_dacl.py
_getUserSid
def _getUserSid(user): ''' return a state error dictionary, with 'sid' as a field if it could be returned if user is None, sid will also be None ''' ret = {} sid_pattern = r'^S-1(-\d+){1,}$' if user and re.match(sid_pattern, user, re.I): try: sid = win32security.GetBina...
python
def _getUserSid(user): ''' return a state error dictionary, with 'sid' as a field if it could be returned if user is None, sid will also be None ''' ret = {} sid_pattern = r'^S-1(-\d+){1,}$' if user and re.match(sid_pattern, user, re.I): try: sid = win32security.GetBina...
[ "def", "_getUserSid", "(", "user", ")", ":", "ret", "=", "{", "}", "sid_pattern", "=", "r'^S-1(-\\d+){1,}$'", "if", "user", "and", "re", ".", "match", "(", "sid_pattern", ",", "user", ",", "re", ".", "I", ")", ":", "try", ":", "sid", "=", "win32secur...
return a state error dictionary, with 'sid' as a field if it could be returned if user is None, sid will also be None
[ "return", "a", "state", "error", "dictionary", "with", "sid", "as", "a", "field", "if", "it", "could", "be", "returned", "if", "user", "is", "None", "sid", "will", "also", "be", "None" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dacl.py#L304-L338
35,337
saltstack/salt
salt/modules/win_dacl.py
_get_dacl
def _get_dacl(path, objectType): ''' Gets the DACL of a path ''' try: dacl = win32security.GetNamedSecurityInfo( path, objectType, win32security.DACL_SECURITY_INFORMATION ).GetSecurityDescriptorDacl() except Exception: dacl = None return dacl
python
def _get_dacl(path, objectType): ''' Gets the DACL of a path ''' try: dacl = win32security.GetNamedSecurityInfo( path, objectType, win32security.DACL_SECURITY_INFORMATION ).GetSecurityDescriptorDacl() except Exception: dacl = None return dacl
[ "def", "_get_dacl", "(", "path", ",", "objectType", ")", ":", "try", ":", "dacl", "=", "win32security", ".", "GetNamedSecurityInfo", "(", "path", ",", "objectType", ",", "win32security", ".", "DACL_SECURITY_INFORMATION", ")", ".", "GetSecurityDescriptorDacl", "(",...
Gets the DACL of a path
[ "Gets", "the", "DACL", "of", "a", "path" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dacl.py#L350-L360
35,338
saltstack/salt
salt/modules/win_dacl.py
get
def get(path, objectType, user=None): ''' Get the ACL of an object. Will filter by user if one is provided. Args: path: The path to the object objectType: The type of object (FILE, DIRECTORY, REGISTRY) user: A user name to filter by Returns (dict): A dictionary containing the A...
python
def get(path, objectType, user=None): ''' Get the ACL of an object. Will filter by user if one is provided. Args: path: The path to the object objectType: The type of object (FILE, DIRECTORY, REGISTRY) user: A user name to filter by Returns (dict): A dictionary containing the A...
[ "def", "get", "(", "path", ",", "objectType", ",", "user", "=", "None", ")", ":", "ret", "=", "{", "'Path'", ":", "path", ",", "'ACLs'", ":", "[", "]", "}", "sidRet", "=", "_getUserSid", "(", "user", ")", "if", "path", "and", "objectType", ":", "...
Get the ACL of an object. Will filter by user if one is provided. Args: path: The path to the object objectType: The type of object (FILE, DIRECTORY, REGISTRY) user: A user name to filter by Returns (dict): A dictionary containing the ACL CLI Example: .. code-block:: bash ...
[ "Get", "the", "ACL", "of", "an", "object", ".", "Will", "filter", "by", "user", "if", "one", "is", "provided", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dacl.py#L363-L395
35,339
saltstack/salt
salt/modules/win_dacl.py
add_ace
def add_ace(path, objectType, user, permission, acetype, propagation): r''' add an ace to an object path: path to the object (i.e. c:\\temp\\file, HKEY_LOCAL_MACHINE\\SOFTWARE\\KEY, etc) user: user to add permission: permissions for the user acetype: either allow/deny for each user/permissio...
python
def add_ace(path, objectType, user, permission, acetype, propagation): r''' add an ace to an object path: path to the object (i.e. c:\\temp\\file, HKEY_LOCAL_MACHINE\\SOFTWARE\\KEY, etc) user: user to add permission: permissions for the user acetype: either allow/deny for each user/permissio...
[ "def", "add_ace", "(", "path", ",", "objectType", ",", "user", ",", "permission", ",", "acetype", ",", "propagation", ")", ":", "ret", "=", "{", "'result'", ":", "None", ",", "'changes'", ":", "{", "}", ",", "'comment'", ":", "''", "}", "if", "(", ...
r''' add an ace to an object path: path to the object (i.e. c:\\temp\\file, HKEY_LOCAL_MACHINE\\SOFTWARE\\KEY, etc) user: user to add permission: permissions for the user acetype: either allow/deny for each user/permission (ALLOW, DENY) propagation: how the ACE applies to children for Regist...
[ "r", "add", "an", "ace", "to", "an", "object" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dacl.py#L398-L467
35,340
saltstack/salt
salt/modules/win_dacl.py
rm_ace
def rm_ace(path, objectType, user, permission=None, acetype=None, propagation=None): r''' remove an ace to an object path: path to the object (i.e. c:\\temp\\file, HKEY_LOCAL_MACHINE\\SOFTWARE\\KEY, etc) user: user to remove permission: permissions for the user acetypes: either allow/deny fo...
python
def rm_ace(path, objectType, user, permission=None, acetype=None, propagation=None): r''' remove an ace to an object path: path to the object (i.e. c:\\temp\\file, HKEY_LOCAL_MACHINE\\SOFTWARE\\KEY, etc) user: user to remove permission: permissions for the user acetypes: either allow/deny fo...
[ "def", "rm_ace", "(", "path", ",", "objectType", ",", "user", ",", "permission", "=", "None", ",", "acetype", "=", "None", ",", "propagation", "=", "None", ")", ":", "ret", "=", "{", "'result'", ":", "None", ",", "'changes'", ":", "{", "}", ",", "'...
r''' remove an ace to an object path: path to the object (i.e. c:\\temp\\file, HKEY_LOCAL_MACHINE\\SOFTWARE\\KEY, etc) user: user to remove permission: permissions for the user acetypes: either allow/deny for each user/permission (ALLOW, DENY) propagation: how the ACE applies to children for...
[ "r", "remove", "an", "ace", "to", "an", "object" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dacl.py#L470-L540
35,341
saltstack/salt
salt/modules/win_dacl.py
_ace_to_text
def _ace_to_text(ace, objectType): ''' helper function to convert an ace to a textual representation ''' dc = daclConstants() objectType = dc.getObjectTypeBit(objectType) try: userSid = win32security.LookupAccountSid('', ace[2]) if userSid[1]: userSid = '{1}\\{0}'.for...
python
def _ace_to_text(ace, objectType): ''' helper function to convert an ace to a textual representation ''' dc = daclConstants() objectType = dc.getObjectTypeBit(objectType) try: userSid = win32security.LookupAccountSid('', ace[2]) if userSid[1]: userSid = '{1}\\{0}'.for...
[ "def", "_ace_to_text", "(", "ace", ",", "objectType", ")", ":", "dc", "=", "daclConstants", "(", ")", "objectType", "=", "dc", ".", "getObjectTypeBit", "(", "objectType", ")", "try", ":", "userSid", "=", "win32security", ".", "LookupAccountSid", "(", "''", ...
helper function to convert an ace to a textual representation
[ "helper", "function", "to", "convert", "an", "ace", "to", "a", "textual", "representation" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dacl.py#L543-L578
35,342
saltstack/salt
salt/modules/win_dacl.py
disable_inheritance
def disable_inheritance(path, objectType, copy=True): ''' Disable inheritance on an object Args: path: The path to the object objectType: The type of object (FILE, DIRECTORY, REGISTRY) copy: True will copy the Inherited ACEs to the DACL before disabling inheritance Returns (dic...
python
def disable_inheritance(path, objectType, copy=True): ''' Disable inheritance on an object Args: path: The path to the object objectType: The type of object (FILE, DIRECTORY, REGISTRY) copy: True will copy the Inherited ACEs to the DACL before disabling inheritance Returns (dic...
[ "def", "disable_inheritance", "(", "path", ",", "objectType", ",", "copy", "=", "True", ")", ":", "dc", "=", "daclConstants", "(", ")", "objectType", "=", "dc", ".", "getObjectTypeBit", "(", "objectType", ")", "path", "=", "dc", ".", "processPath", "(", ...
Disable inheritance on an object Args: path: The path to the object objectType: The type of object (FILE, DIRECTORY, REGISTRY) copy: True will copy the Inherited ACEs to the DACL before disabling inheritance Returns (dict): A dictionary containing the results CLI Example: .. ...
[ "Disable", "inheritance", "on", "an", "object" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dacl.py#L677-L698
35,343
saltstack/salt
salt/modules/win_dacl.py
check_inheritance
def check_inheritance(path, objectType, user=None): ''' Check a specified path to verify if inheritance is enabled Args: path: path of the registry key or file system object to check objectType: The type of object (FILE, DIRECTORY, REGISTRY) user: if provided, will consider only the...
python
def check_inheritance(path, objectType, user=None): ''' Check a specified path to verify if inheritance is enabled Args: path: path of the registry key or file system object to check objectType: The type of object (FILE, DIRECTORY, REGISTRY) user: if provided, will consider only the...
[ "def", "check_inheritance", "(", "path", ",", "objectType", ",", "user", "=", "None", ")", ":", "ret", "=", "{", "'result'", ":", "False", ",", "'Inheritance'", ":", "False", ",", "'comment'", ":", "''", "}", "sidRet", "=", "_getUserSid", "(", "user", ...
Check a specified path to verify if inheritance is enabled Args: path: path of the registry key or file system object to check objectType: The type of object (FILE, DIRECTORY, REGISTRY) user: if provided, will consider only the ACEs for that user Returns (bool): 'Inheritance' of True/F...
[ "Check", "a", "specified", "path", "to", "verify", "if", "inheritance", "is", "enabled" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dacl.py#L701-L745
35,344
saltstack/salt
salt/modules/win_dacl.py
daclConstants.getObjectTypeBit
def getObjectTypeBit(self, t): ''' returns the bit value of the string object type ''' if isinstance(t, string_types): t = t.upper() try: return self.objectType[t] except KeyError: raise CommandExecutionError(( ...
python
def getObjectTypeBit(self, t): ''' returns the bit value of the string object type ''' if isinstance(t, string_types): t = t.upper() try: return self.objectType[t] except KeyError: raise CommandExecutionError(( ...
[ "def", "getObjectTypeBit", "(", "self", ",", "t", ")", ":", "if", "isinstance", "(", "t", ",", "string_types", ")", ":", "t", "=", "t", ".", "upper", "(", ")", "try", ":", "return", "self", ".", "objectType", "[", "t", "]", "except", "KeyError", ":...
returns the bit value of the string object type
[ "returns", "the", "bit", "value", "of", "the", "string", "object", "type" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dacl.py#L193-L206
35,345
saltstack/salt
salt/modules/win_dacl.py
daclConstants.getSecurityHkey
def getSecurityHkey(self, s): ''' returns the necessary string value for an HKEY for the win32security module ''' try: return self.hkeys_security[s] except KeyError: raise CommandExecutionError(( 'No HKEY named "{0}". It should be one of t...
python
def getSecurityHkey(self, s): ''' returns the necessary string value for an HKEY for the win32security module ''' try: return self.hkeys_security[s] except KeyError: raise CommandExecutionError(( 'No HKEY named "{0}". It should be one of t...
[ "def", "getSecurityHkey", "(", "self", ",", "s", ")", ":", "try", ":", "return", "self", ".", "hkeys_security", "[", "s", "]", "except", "KeyError", ":", "raise", "CommandExecutionError", "(", "(", "'No HKEY named \"{0}\". It should be one of the following: {1}'", ...
returns the necessary string value for an HKEY for the win32security module
[ "returns", "the", "necessary", "string", "value", "for", "an", "HKEY", "for", "the", "win32security", "module" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dacl.py#L208-L217
35,346
saltstack/salt
salt/modules/win_dacl.py
daclConstants.getPermissionBit
def getPermissionBit(self, t, m): ''' returns a permission bit of the string permission value for the specified object type ''' try: if isinstance(m, string_types): return self.rights[t][m]['BITS'] else: return m except KeyE...
python
def getPermissionBit(self, t, m): ''' returns a permission bit of the string permission value for the specified object type ''' try: if isinstance(m, string_types): return self.rights[t][m]['BITS'] else: return m except KeyE...
[ "def", "getPermissionBit", "(", "self", ",", "t", ",", "m", ")", ":", "try", ":", "if", "isinstance", "(", "m", ",", "string_types", ")", ":", "return", "self", ".", "rights", "[", "t", "]", "[", "m", "]", "[", "'BITS'", "]", "else", ":", "return...
returns a permission bit of the string permission value for the specified object type
[ "returns", "a", "permission", "bit", "of", "the", "string", "permission", "value", "for", "the", "specified", "object", "type" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dacl.py#L219-L231
35,347
saltstack/salt
salt/modules/win_dacl.py
daclConstants.getAceTypeBit
def getAceTypeBit(self, t): ''' returns the acetype bit of a text value ''' try: return self.validAceTypes[t]['BITS'] except KeyError: raise CommandExecutionError(( 'No ACE type "{0}". It should be one of the following: {1}' ...
python
def getAceTypeBit(self, t): ''' returns the acetype bit of a text value ''' try: return self.validAceTypes[t]['BITS'] except KeyError: raise CommandExecutionError(( 'No ACE type "{0}". It should be one of the following: {1}' ...
[ "def", "getAceTypeBit", "(", "self", ",", "t", ")", ":", "try", ":", "return", "self", ".", "validAceTypes", "[", "t", "]", "[", "'BITS'", "]", "except", "KeyError", ":", "raise", "CommandExecutionError", "(", "(", "'No ACE type \"{0}\". It should be one of the...
returns the acetype bit of a text value
[ "returns", "the", "acetype", "bit", "of", "a", "text", "value" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dacl.py#L244-L253
35,348
saltstack/salt
salt/modules/win_dacl.py
daclConstants.getAceTypeText
def getAceTypeText(self, t): ''' returns the textual representation of a acetype bit ''' try: return self.validAceTypes[t]['TEXT'] except KeyError: raise CommandExecutionError(( 'No ACE type "{0}". It should be one of the following: {1}' ...
python
def getAceTypeText(self, t): ''' returns the textual representation of a acetype bit ''' try: return self.validAceTypes[t]['TEXT'] except KeyError: raise CommandExecutionError(( 'No ACE type "{0}". It should be one of the following: {1}' ...
[ "def", "getAceTypeText", "(", "self", ",", "t", ")", ":", "try", ":", "return", "self", ".", "validAceTypes", "[", "t", "]", "[", "'TEXT'", "]", "except", "KeyError", ":", "raise", "CommandExecutionError", "(", "(", "'No ACE type \"{0}\". It should be one of th...
returns the textual representation of a acetype bit
[ "returns", "the", "textual", "representation", "of", "a", "acetype", "bit" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dacl.py#L255-L264
35,349
saltstack/salt
salt/modules/win_dacl.py
daclConstants.getPropagationBit
def getPropagationBit(self, t, p): ''' returns the propagation bit of a text value ''' try: return self.validPropagations[t][p]['BITS'] except KeyError: raise CommandExecutionError(( 'No propagation type of "{0}". It should be one of the f...
python
def getPropagationBit(self, t, p): ''' returns the propagation bit of a text value ''' try: return self.validPropagations[t][p]['BITS'] except KeyError: raise CommandExecutionError(( 'No propagation type of "{0}". It should be one of the f...
[ "def", "getPropagationBit", "(", "self", ",", "t", ",", "p", ")", ":", "try", ":", "return", "self", ".", "validPropagations", "[", "t", "]", "[", "p", "]", "[", "'BITS'", "]", "except", "KeyError", ":", "raise", "CommandExecutionError", "(", "(", "'No...
returns the propagation bit of a text value
[ "returns", "the", "propagation", "bit", "of", "a", "text", "value" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dacl.py#L266-L275
35,350
saltstack/salt
salt/states/neutron_subnet.py
present
def present(name, auth=None, **kwargs): ''' Ensure a subnet exists and is up-to-date name Name of the subnet network_name_or_id The unique name or ID of the attached network. If a non-unique name is supplied, an exception is raised. allocation_pools A list of dicti...
python
def present(name, auth=None, **kwargs): ''' Ensure a subnet exists and is up-to-date name Name of the subnet network_name_or_id The unique name or ID of the attached network. If a non-unique name is supplied, an exception is raised. allocation_pools A list of dicti...
[ "def", "present", "(", "name", ",", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "kwargs", "=", ...
Ensure a subnet exists and is up-to-date name Name of the subnet network_name_or_id The unique name or ID of the attached network. If a non-unique name is supplied, an exception is raised. allocation_pools A list of dictionaries of the start and end addresses for t...
[ "Ensure", "a", "subnet", "exists", "and", "is", "up", "-", "to", "-", "date" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/neutron_subnet.py#L62-L139
35,351
saltstack/salt
salt/states/neutron_subnet.py
absent
def absent(name, auth=None): ''' Ensure a subnet does not exists name Name of the subnet ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} __salt__['neutronng.setup_clouds'](auth) subnet = __salt__['neutronng.subnet_get'](name...
python
def absent(name, auth=None): ''' Ensure a subnet does not exists name Name of the subnet ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} __salt__['neutronng.setup_clouds'](auth) subnet = __salt__['neutronng.subnet_get'](name...
[ "def", "absent", "(", "name", ",", "auth", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "__salt__", "[", "'neutronng.setup_clouds'", "]...
Ensure a subnet does not exists name Name of the subnet
[ "Ensure", "a", "subnet", "does", "not", "exists" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/neutron_subnet.py#L142-L170
35,352
saltstack/salt
salt/runners/virt.py
_determine_host
def _determine_host(data, omit=''): ''' Determine what the most resource free host is based on the given data ''' # This is just checking for the host with the most free ram, this needs # to be much more complicated. host = '' bestmem = 0 for hv_, comps in six.iteritems(data): if...
python
def _determine_host(data, omit=''): ''' Determine what the most resource free host is based on the given data ''' # This is just checking for the host with the most free ram, this needs # to be much more complicated. host = '' bestmem = 0 for hv_, comps in six.iteritems(data): if...
[ "def", "_determine_host", "(", "data", ",", "omit", "=", "''", ")", ":", "# This is just checking for the host with the most free ram, this needs", "# to be much more complicated.", "host", "=", "''", "bestmem", "=", "0", "for", "hv_", ",", "comps", "in", "six", ".", ...
Determine what the most resource free host is based on the given data
[ "Determine", "what", "the", "most", "resource", "free", "host", "is", "based", "on", "the", "given", "data" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/virt.py#L25-L41
35,353
saltstack/salt
salt/runners/virt.py
_find_vm
def _find_vm(name, data, quiet=False): ''' Scan the query data for the named VM ''' for hv_ in data: # Check if data is a dict, and not '"virt.full_info" is not available.' if not isinstance(data[hv_], dict): continue if name in data[hv_].get('vm_info', {}): ...
python
def _find_vm(name, data, quiet=False): ''' Scan the query data for the named VM ''' for hv_ in data: # Check if data is a dict, and not '"virt.full_info" is not available.' if not isinstance(data[hv_], dict): continue if name in data[hv_].get('vm_info', {}): ...
[ "def", "_find_vm", "(", "name", ",", "data", ",", "quiet", "=", "False", ")", ":", "for", "hv_", "in", "data", ":", "# Check if data is a dict, and not '\"virt.full_info\" is not available.'", "if", "not", "isinstance", "(", "data", "[", "hv_", "]", ",", "dict",...
Scan the query data for the named VM
[ "Scan", "the", "query", "data", "for", "the", "named", "VM" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/virt.py#L44-L57
35,354
saltstack/salt
salt/runners/virt.py
query
def query(host=None, quiet=False): ''' Query the virtual machines. When called without options all hosts are detected and a full query is returned. A single host can be passed in to specify an individual host to query. ''' if quiet: log.warning("'quiet' is deprecated. Please migrate to -...
python
def query(host=None, quiet=False): ''' Query the virtual machines. When called without options all hosts are detected and a full query is returned. A single host can be passed in to specify an individual host to query. ''' if quiet: log.warning("'quiet' is deprecated. Please migrate to -...
[ "def", "query", "(", "host", "=", "None", ",", "quiet", "=", "False", ")", ":", "if", "quiet", ":", "log", ".", "warning", "(", "\"'quiet' is deprecated. Please migrate to --quiet\"", ")", "ret", "=", "{", "}", "client", "=", "salt", ".", "client", ".", ...
Query the virtual machines. When called without options all hosts are detected and a full query is returned. A single host can be passed in to specify an individual host to query.
[ "Query", "the", "virtual", "machines", ".", "When", "called", "without", "options", "all", "hosts", "are", "detected", "and", "a", "full", "query", "is", "returned", ".", "A", "single", "host", "can", "be", "passed", "in", "to", "specify", "an", "individua...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/virt.py#L60-L94
35,355
saltstack/salt
salt/runners/virt.py
list
def list(host=None, quiet=False, hyper=None): # pylint: disable=redefined-builtin ''' List the virtual machines on each host, this is a simplified query, showing only the virtual machine names belonging to each host. A single host can be passed in to specify an individual host to list. ''' ...
python
def list(host=None, quiet=False, hyper=None): # pylint: disable=redefined-builtin ''' List the virtual machines on each host, this is a simplified query, showing only the virtual machine names belonging to each host. A single host can be passed in to specify an individual host to list. ''' ...
[ "def", "list", "(", "host", "=", "None", ",", "quiet", "=", "False", ",", "hyper", "=", "None", ")", ":", "# pylint: disable=redefined-builtin", "if", "quiet", ":", "log", ".", "warning", "(", "\"'quiet' is deprecated. Please migrate to --quiet\"", ")", "ret", "...
List the virtual machines on each host, this is a simplified query, showing only the virtual machine names belonging to each host. A single host can be passed in to specify an individual host to list.
[ "List", "the", "virtual", "machines", "on", "each", "host", "this", "is", "a", "simplified", "query", "showing", "only", "the", "virtual", "machine", "names", "belonging", "to", "each", "host", ".", "A", "single", "host", "can", "be", "passed", "in", "to",...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/virt.py#L97-L136
35,356
saltstack/salt
salt/runners/virt.py
host_info
def host_info(host=None): ''' Return information about the host connected to this master ''' data = query(host, quiet=True) for id_ in data: if 'vm_info' in data[id_]: data[id_].pop('vm_info') __jid_event__.fire_event({'data': data, 'outputter': 'nested'}, 'progress') ret...
python
def host_info(host=None): ''' Return information about the host connected to this master ''' data = query(host, quiet=True) for id_ in data: if 'vm_info' in data[id_]: data[id_].pop('vm_info') __jid_event__.fire_event({'data': data, 'outputter': 'nested'}, 'progress') ret...
[ "def", "host_info", "(", "host", "=", "None", ")", ":", "data", "=", "query", "(", "host", ",", "quiet", "=", "True", ")", "for", "id_", "in", "data", ":", "if", "'vm_info'", "in", "data", "[", "id_", "]", ":", "data", "[", "id_", "]", ".", "po...
Return information about the host connected to this master
[ "Return", "information", "about", "the", "host", "connected", "to", "this", "master" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/virt.py#L150-L159
35,357
saltstack/salt
salt/runners/virt.py
init
def init( name, cpu, mem, image, hypervisor='kvm', host=None, seed=True, nic='default', install=True, start=True, disk='default', saltenv='base', enable_vnc=False, seed_cmd='seed.apply', enable_qcow=F...
python
def init( name, cpu, mem, image, hypervisor='kvm', host=None, seed=True, nic='default', install=True, start=True, disk='default', saltenv='base', enable_vnc=False, seed_cmd='seed.apply', enable_qcow=F...
[ "def", "init", "(", "name", ",", "cpu", ",", "mem", ",", "image", ",", "hypervisor", "=", "'kvm'", ",", "host", "=", "None", ",", "seed", "=", "True", ",", "nic", "=", "'default'", ",", "install", "=", "True", ",", "start", "=", "True", ",", "dis...
This routine is used to create a new virtual machine. This routines takes a number of options to determine what the newly created virtual machine will look like. name The mandatory name of the new virtual machine. The name option is also the minion id, all minions must have an id. cpu ...
[ "This", "routine", "is", "used", "to", "create", "a", "new", "virtual", "machine", ".", "This", "routines", "takes", "a", "number", "of", "options", "to", "determine", "what", "the", "newly", "created", "virtual", "machine", "will", "look", "like", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/virt.py#L162-L317
35,358
saltstack/salt
salt/runners/virt.py
vm_info
def vm_info(name, quiet=False): ''' Return the information on the named VM ''' data = query(quiet=True) return _find_vm(name, data, quiet)
python
def vm_info(name, quiet=False): ''' Return the information on the named VM ''' data = query(quiet=True) return _find_vm(name, data, quiet)
[ "def", "vm_info", "(", "name", ",", "quiet", "=", "False", ")", ":", "data", "=", "query", "(", "quiet", "=", "True", ")", "return", "_find_vm", "(", "name", ",", "data", ",", "quiet", ")" ]
Return the information on the named VM
[ "Return", "the", "information", "on", "the", "named", "VM" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/virt.py#L320-L325
35,359
saltstack/salt
salt/runners/virt.py
reset
def reset(name): ''' Force power down and restart an existing VM ''' ret = {} client = salt.client.get_local_client(__opts__['conf_file']) data = vm_info(name, quiet=True) if not data: __jid_event__.fire_event({'message': 'Failed to find VM {0} to reset'.format(name)}, 'progress') ...
python
def reset(name): ''' Force power down and restart an existing VM ''' ret = {} client = salt.client.get_local_client(__opts__['conf_file']) data = vm_info(name, quiet=True) if not data: __jid_event__.fire_event({'message': 'Failed to find VM {0} to reset'.format(name)}, 'progress') ...
[ "def", "reset", "(", "name", ")", ":", "ret", "=", "{", "}", "client", "=", "salt", ".", "client", ".", "get_local_client", "(", "__opts__", "[", "'conf_file'", "]", ")", "data", "=", "vm_info", "(", "name", ",", "quiet", "=", "True", ")", "if", "n...
Force power down and restart an existing VM
[ "Force", "power", "down", "and", "restart", "an", "existing", "VM" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/virt.py#L328-L350
35,360
saltstack/salt
salt/runners/virt.py
purge
def purge(name, delete_key=True): ''' Destroy the named VM ''' ret = {} client = salt.client.get_local_client(__opts__['conf_file']) data = vm_info(name, quiet=True) if not data: __jid_event__.fire_event({'error': 'Failed to find VM {0} to purge'.format(name)}, 'progress') re...
python
def purge(name, delete_key=True): ''' Destroy the named VM ''' ret = {} client = salt.client.get_local_client(__opts__['conf_file']) data = vm_info(name, quiet=True) if not data: __jid_event__.fire_event({'error': 'Failed to find VM {0} to purge'.format(name)}, 'progress') re...
[ "def", "purge", "(", "name", ",", "delete_key", "=", "True", ")", ":", "ret", "=", "{", "}", "client", "=", "salt", ".", "client", ".", "get_local_client", "(", "__opts__", "[", "'conf_file'", "]", ")", "data", "=", "vm_info", "(", "name", ",", "quie...
Destroy the named VM
[ "Destroy", "the", "named", "VM" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/virt.py#L409-L437
35,361
saltstack/salt
salt/runners/virt.py
migrate
def migrate(name, target=''): ''' Migrate a VM from one host to another. This routine will just start the migration and display information on how to look up the progress. ''' client = salt.client.get_local_client(__opts__['conf_file']) data = query(quiet=True) origin_data = _find_vm(name, d...
python
def migrate(name, target=''): ''' Migrate a VM from one host to another. This routine will just start the migration and display information on how to look up the progress. ''' client = salt.client.get_local_client(__opts__['conf_file']) data = query(quiet=True) origin_data = _find_vm(name, d...
[ "def", "migrate", "(", "name", ",", "target", "=", "''", ")", ":", "client", "=", "salt", ".", "client", ".", "get_local_client", "(", "__opts__", "[", "'conf_file'", "]", ")", "data", "=", "query", "(", "quiet", "=", "True", ")", "origin_data", "=", ...
Migrate a VM from one host to another. This routine will just start the migration and display information on how to look up the progress.
[ "Migrate", "a", "VM", "from", "one", "host", "to", "another", ".", "This", "routine", "will", "just", "start", "the", "migration", "and", "display", "information", "on", "how", "to", "look", "up", "the", "progress", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/virt.py#L497-L531
35,362
saltstack/salt
salt/modules/mac_keychain.py
install
def install(cert, password, keychain="/Library/Keychains/System.keychain", allow_any=False, keychain_password=None): ''' Install a certificate cert The certificate to install password The password for the certificate being installed forma...
python
def install(cert, password, keychain="/Library/Keychains/System.keychain", allow_any=False, keychain_password=None): ''' Install a certificate cert The certificate to install password The password for the certificate being installed forma...
[ "def", "install", "(", "cert", ",", "password", ",", "keychain", "=", "\"/Library/Keychains/System.keychain\"", ",", "allow_any", "=", "False", ",", "keychain_password", "=", "None", ")", ":", "if", "keychain_password", "is", "not", "None", ":", "unlock_keychain",...
Install a certificate cert The certificate to install password The password for the certificate being installed formatted in the way described for openssl command in the PASS PHRASE ARGUMENTS section. Note: The password given here will show up as plaintext in the job returned ...
[ "Install", "a", "certificate" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_keychain.py#L44-L88
35,363
saltstack/salt
salt/modules/mac_keychain.py
uninstall
def uninstall(cert_name, keychain="/Library/Keychains/System.keychain", keychain_password=None): ''' Uninstall a certificate from a keychain cert_name The name of the certificate to remove keychain The keychain to install the certificate to, this defaults to...
python
def uninstall(cert_name, keychain="/Library/Keychains/System.keychain", keychain_password=None): ''' Uninstall a certificate from a keychain cert_name The name of the certificate to remove keychain The keychain to install the certificate to, this defaults to...
[ "def", "uninstall", "(", "cert_name", ",", "keychain", "=", "\"/Library/Keychains/System.keychain\"", ",", "keychain_password", "=", "None", ")", ":", "if", "keychain_password", "is", "not", "None", ":", "unlock_keychain", "(", "keychain", ",", "keychain_password", ...
Uninstall a certificate from a keychain cert_name The name of the certificate to remove keychain The keychain to install the certificate to, this defaults to /Library/Keychains/System.keychain keychain_password If your keychain is likely to be locked pass the password and ...
[ "Uninstall", "a", "certificate", "from", "a", "keychain" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_keychain.py#L91-L121
35,364
saltstack/salt
salt/modules/mac_keychain.py
list_certs
def list_certs(keychain="/Library/Keychains/System.keychain"): ''' List all of the installed certificates keychain The keychain to install the certificate to, this defaults to /Library/Keychains/System.keychain CLI Example: .. code-block:: bash salt '*' keychain.list_cert...
python
def list_certs(keychain="/Library/Keychains/System.keychain"): ''' List all of the installed certificates keychain The keychain to install the certificate to, this defaults to /Library/Keychains/System.keychain CLI Example: .. code-block:: bash salt '*' keychain.list_cert...
[ "def", "list_certs", "(", "keychain", "=", "\"/Library/Keychains/System.keychain\"", ")", ":", "cmd", "=", "'security find-certificate -a {0} | grep -o \"alis\".*\\\\\" | '", "'grep -o \\'\\\\\"[-A-Za-z0-9.:() ]*\\\\\"\\''", ".", "format", "(", "_quote", "(", "keychain", ")", "...
List all of the installed certificates keychain The keychain to install the certificate to, this defaults to /Library/Keychains/System.keychain CLI Example: .. code-block:: bash salt '*' keychain.list_certs
[ "List", "all", "of", "the", "installed", "certificates" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_keychain.py#L124-L141
35,365
saltstack/salt
salt/modules/mac_keychain.py
get_friendly_name
def get_friendly_name(cert, password): ''' Get the friendly name of the given certificate cert The certificate to install password The password for the certificate being installed formatted in the way described for openssl command in the PASS PHRASE ARGUMENTS section N...
python
def get_friendly_name(cert, password): ''' Get the friendly name of the given certificate cert The certificate to install password The password for the certificate being installed formatted in the way described for openssl command in the PASS PHRASE ARGUMENTS section N...
[ "def", "get_friendly_name", "(", "cert", ",", "password", ")", ":", "cmd", "=", "'openssl pkcs12 -in {0} -passin pass:{1} -info -nodes -nokeys 2> /dev/null | '", "'grep friendlyName:'", ".", "format", "(", "_quote", "(", "cert", ")", ",", "_quote", "(", "password", ")",...
Get the friendly name of the given certificate cert The certificate to install password The password for the certificate being installed formatted in the way described for openssl command in the PASS PHRASE ARGUMENTS section Note: The password given here will show up as plaint...
[ "Get", "the", "friendly", "name", "of", "the", "given", "certificate" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_keychain.py#L144-L167
35,366
saltstack/salt
salt/modules/mac_keychain.py
get_default_keychain
def get_default_keychain(user=None, domain="user"): ''' Get the default keychain user The user to check the default keychain of domain The domain to use valid values are user|system|common|dynamic, the default is user CLI Example: .. code-block:: bash salt '*' keycha...
python
def get_default_keychain(user=None, domain="user"): ''' Get the default keychain user The user to check the default keychain of domain The domain to use valid values are user|system|common|dynamic, the default is user CLI Example: .. code-block:: bash salt '*' keycha...
[ "def", "get_default_keychain", "(", "user", "=", "None", ",", "domain", "=", "\"user\"", ")", ":", "cmd", "=", "\"security default-keychain -d {0}\"", ".", "format", "(", "domain", ")", "return", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ",", "runas", "...
Get the default keychain user The user to check the default keychain of domain The domain to use valid values are user|system|common|dynamic, the default is user CLI Example: .. code-block:: bash salt '*' keychain.get_default_keychain
[ "Get", "the", "default", "keychain" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_keychain.py#L170-L187
35,367
saltstack/salt
salt/modules/mac_keychain.py
set_default_keychain
def set_default_keychain(keychain, domain="user", user=None): ''' Set the default keychain keychain The location of the keychain to set as default domain The domain to use valid values are user|system|common|dynamic, the default is user user The user to set the default key...
python
def set_default_keychain(keychain, domain="user", user=None): ''' Set the default keychain keychain The location of the keychain to set as default domain The domain to use valid values are user|system|common|dynamic, the default is user user The user to set the default key...
[ "def", "set_default_keychain", "(", "keychain", ",", "domain", "=", "\"user\"", ",", "user", "=", "None", ")", ":", "cmd", "=", "\"security default-keychain -d {0} -s {1}\"", ".", "format", "(", "domain", ",", "keychain", ")", "return", "__salt__", "[", "'cmd.ru...
Set the default keychain keychain The location of the keychain to set as default domain The domain to use valid values are user|system|common|dynamic, the default is user user The user to set the default keychain as CLI Example: .. code-block:: bash salt '*' key...
[ "Set", "the", "default", "keychain" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_keychain.py#L190-L210
35,368
saltstack/salt
salt/modules/mac_keychain.py
get_hash
def get_hash(name, password=None): ''' Returns the hash of a certificate in the keychain. name The name of the certificate (which you can get from keychain.get_friendly_name) or the location of a p12 file. password The password that is used in the certificate. Only required if ...
python
def get_hash(name, password=None): ''' Returns the hash of a certificate in the keychain. name The name of the certificate (which you can get from keychain.get_friendly_name) or the location of a p12 file. password The password that is used in the certificate. Only required if ...
[ "def", "get_hash", "(", "name", ",", "password", "=", "None", ")", ":", "if", "'.p12'", "in", "name", "[", "-", "4", ":", "]", ":", "cmd", "=", "'openssl pkcs12 -in {0} -passin pass:{1} -passout pass:{1}'", ".", "format", "(", "name", ",", "password", ")", ...
Returns the hash of a certificate in the keychain. name The name of the certificate (which you can get from keychain.get_friendly_name) or the location of a p12 file. password The password that is used in the certificate. Only required if your passing a p12 file. Note: This wil...
[ "Returns", "the", "hash", "of", "a", "certificate", "in", "the", "keychain", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_keychain.py#L236-L265
35,369
saltstack/salt
salt/states/aws_sqs.py
absent
def absent( name, region, user=None, opts=False): ''' Remove the named SQS queue if it exists. name Name of the SQS queue. region Region to remove the queue from user Name of the user performing the SQS operations opts Include a...
python
def absent( name, region, user=None, opts=False): ''' Remove the named SQS queue if it exists. name Name of the SQS queue. region Region to remove the queue from user Name of the user performing the SQS operations opts Include a...
[ "def", "absent", "(", "name", ",", "region", ",", "user", "=", "None", ",", "opts", "=", "False", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", "}", ...
Remove the named SQS queue if it exists. name Name of the SQS queue. region Region to remove the queue from user Name of the user performing the SQS operations opts Include additional arguments and options to the aws command line
[ "Remove", "the", "named", "SQS", "queue", "if", "it", "exists", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/aws_sqs.py#L73-L112
35,370
saltstack/salt
salt/modules/mac_portspkg.py
remove
def remove(name=None, pkgs=None, **kwargs): ''' Removes packages with ``port uninstall``. name The name of the package to be deleted. Multiple Package Options: pkgs A list of packages to delete. Must be passed as a python list. The ``name`` parameter will be ignored if th...
python
def remove(name=None, pkgs=None, **kwargs): ''' Removes packages with ``port uninstall``. name The name of the package to be deleted. Multiple Package Options: pkgs A list of packages to delete. Must be passed as a python list. The ``name`` parameter will be ignored if th...
[ "def", "remove", "(", "name", "=", "None", ",", "pkgs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "pkg_params", "=", "__salt__", "[", "'pkg_resource.parse_targets'", "]", "(", "name", ",", "pkgs", ",", "*", "*", "kwargs", ")", "[", "0", "]", ...
Removes packages with ``port uninstall``. name The name of the package to be deleted. Multiple Package Options: pkgs A list of packages to delete. Must be passed as a python list. The ``name`` parameter will be ignored if this option is passed. .. versionadded:: 0.16.0 ...
[ "Removes", "packages", "with", "port", "uninstall", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_portspkg.py#L187-L240
35,371
saltstack/salt
salt/modules/mac_portspkg.py
refresh_db
def refresh_db(**kwargs): ''' Update ports with ``port selfupdate`` CLI Example: .. code-block:: bash salt mac pkg.refresh_db ''' # Remove rtag file to keep multiple refreshes from happening in pkg states salt.utils.pkg.clear_rtag(__opts__) cmd = ['port', 'selfupdate'] ret...
python
def refresh_db(**kwargs): ''' Update ports with ``port selfupdate`` CLI Example: .. code-block:: bash salt mac pkg.refresh_db ''' # Remove rtag file to keep multiple refreshes from happening in pkg states salt.utils.pkg.clear_rtag(__opts__) cmd = ['port', 'selfupdate'] ret...
[ "def", "refresh_db", "(", "*", "*", "kwargs", ")", ":", "# Remove rtag file to keep multiple refreshes from happening in pkg states", "salt", ".", "utils", ".", "pkg", ".", "clear_rtag", "(", "__opts__", ")", "cmd", "=", "[", "'port'", ",", "'selfupdate'", "]", "r...
Update ports with ``port selfupdate`` CLI Example: .. code-block:: bash salt mac pkg.refresh_db
[ "Update", "ports", "with", "port", "selfupdate" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_portspkg.py#L392-L405
35,372
saltstack/salt
salt/modules/sdb.py
get_or_set_hash
def get_or_set_hash(uri, length=8, chars='abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'): ''' Perform a one-time generation of a hash and write it to sdb. If that value has already been set return the value instead. This is useful for generating passwords or keys that are specific...
python
def get_or_set_hash(uri, length=8, chars='abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'): ''' Perform a one-time generation of a hash and write it to sdb. If that value has already been set return the value instead. This is useful for generating passwords or keys that are specific...
[ "def", "get_or_set_hash", "(", "uri", ",", "length", "=", "8", ",", "chars", "=", "'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'", ")", ":", "return", "salt", ".", "utils", ".", "sdb", ".", "sdb_get_or_set_hash", "(", "uri", ",", "__opts__", ",", "length"...
Perform a one-time generation of a hash and write it to sdb. If that value has already been set return the value instead. This is useful for generating passwords or keys that are specific to multiple minions that need to be stored somewhere centrally. State Example: .. code-block:: yaml ...
[ "Perform", "a", "one", "-", "time", "generation", "of", "a", "hash", "and", "write", "it", "to", "sdb", ".", "If", "that", "value", "has", "already", "been", "set", "return", "the", "value", "instead", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sdb.py#L61-L94
35,373
saltstack/salt
salt/modules/csf.py
__csf_cmd
def __csf_cmd(cmd): ''' Execute csf command ''' csf_cmd = '{0} {1}'.format(salt.utils.path.which('csf'), cmd) out = __salt__['cmd.run_all'](csf_cmd) if out['retcode'] != 0: if not out['stderr']: ret = out['stdout'] else: ret = out['stderr'] raise ...
python
def __csf_cmd(cmd): ''' Execute csf command ''' csf_cmd = '{0} {1}'.format(salt.utils.path.which('csf'), cmd) out = __salt__['cmd.run_all'](csf_cmd) if out['retcode'] != 0: if not out['stderr']: ret = out['stdout'] else: ret = out['stderr'] raise ...
[ "def", "__csf_cmd", "(", "cmd", ")", ":", "csf_cmd", "=", "'{0} {1}'", ".", "format", "(", "salt", ".", "utils", ".", "path", ".", "which", "(", "'csf'", ")", ",", "cmd", ")", "out", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "csf_cmd", ")", ...
Execute csf command
[ "Execute", "csf", "command" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/csf.py#L76-L93
35,374
saltstack/salt
salt/modules/csf.py
_access_rule
def _access_rule(method, ip=None, port=None, proto='tcp', direction='in', port_origin='d', ip_origin='d', comment=''): ''' Handles the cmd execution for allow and deny commands. ''' if _status...
python
def _access_rule(method, ip=None, port=None, proto='tcp', direction='in', port_origin='d', ip_origin='d', comment=''): ''' Handles the cmd execution for allow and deny commands. ''' if _status...
[ "def", "_access_rule", "(", "method", ",", "ip", "=", "None", ",", "port", "=", "None", ",", "proto", "=", "'tcp'", ",", "direction", "=", "'in'", ",", "port_origin", "=", "'d'", ",", "ip_origin", "=", "'d'", ",", "comment", "=", "''", ")", ":", "i...
Handles the cmd execution for allow and deny commands.
[ "Handles", "the", "cmd", "execution", "for", "allow", "and", "deny", "commands", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/csf.py#L132-L159
35,375
saltstack/salt
salt/modules/csf.py
_csf_to_list
def _csf_to_list(option): ''' Extract comma-separated values from a csf.conf option and return a list. ''' result = [] line = get_option(option) if line: csv = line.split('=')[1].replace(' ', '').replace('"', '') result = csv.split(',') return result
python
def _csf_to_list(option): ''' Extract comma-separated values from a csf.conf option and return a list. ''' result = [] line = get_option(option) if line: csv = line.split('=')[1].replace(' ', '').replace('"', '') result = csv.split(',') return result
[ "def", "_csf_to_list", "(", "option", ")", ":", "result", "=", "[", "]", "line", "=", "get_option", "(", "option", ")", "if", "line", ":", "csv", "=", "line", ".", "split", "(", "'='", ")", "[", "1", "]", ".", "replace", "(", "' '", ",", "''", ...
Extract comma-separated values from a csf.conf option and return a list.
[ "Extract", "comma", "-", "separated", "values", "from", "a", "csf", ".", "conf", "option", "and", "return", "a", "list", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/csf.py#L204-L214
35,376
saltstack/salt
salt/modules/csf.py
_tmp_access_rule
def _tmp_access_rule(method, ip=None, ttl=None, port=None, direction='in', port_origin='d', ip_origin='d', comment=''): ''' Handles the cmd execution for tempdeny and tempa...
python
def _tmp_access_rule(method, ip=None, ttl=None, port=None, direction='in', port_origin='d', ip_origin='d', comment=''): ''' Handles the cmd execution for tempdeny and tempa...
[ "def", "_tmp_access_rule", "(", "method", ",", "ip", "=", "None", ",", "ttl", "=", "None", ",", "port", "=", "None", ",", "direction", "=", "'in'", ",", "port_origin", "=", "'d'", ",", "ip_origin", "=", "'d'", ",", "comment", "=", "''", ")", ":", "...
Handles the cmd execution for tempdeny and tempallow commands.
[ "Handles", "the", "cmd", "execution", "for", "tempdeny", "and", "tempallow", "commands", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/csf.py#L308-L325
35,377
saltstack/salt
salt/modules/csf.py
allow_port
def allow_port(port, proto='tcp', direction='both'): ''' Like allow_ports, but it will append to the existing entry instead of replacing it. Takes a single port instead of a list of ports. CLI Example: .. code-block:: bash salt '*' csf.allow_port 22 proto='tcp' direction='in' ''' ...
python
def allow_port(port, proto='tcp', direction='both'): ''' Like allow_ports, but it will append to the existing entry instead of replacing it. Takes a single port instead of a list of ports. CLI Example: .. code-block:: bash salt '*' csf.allow_port 22 proto='tcp' direction='in' ''' ...
[ "def", "allow_port", "(", "port", ",", "proto", "=", "'tcp'", ",", "direction", "=", "'both'", ")", ":", "ports", "=", "get_ports", "(", "proto", "=", "proto", ",", "direction", "=", "direction", ")", "direction", "=", "direction", ".", "upper", "(", "...
Like allow_ports, but it will append to the existing entry instead of replacing it. Takes a single port instead of a list of ports. CLI Example: .. code-block:: bash salt '*' csf.allow_port 22 proto='tcp' direction='in'
[ "Like", "allow_ports", "but", "it", "will", "append", "to", "the", "existing", "entry", "instead", "of", "replacing", "it", ".", "Takes", "a", "single", "port", "instead", "of", "a", "list", "of", "ports", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/csf.py#L611-L633
35,378
saltstack/salt
salt/client/ssh/wrapper/state.py
_ssh_state
def _ssh_state(chunks, st_kwargs, kwargs, test=False): ''' Function to run a state with the given chunk via salt-ssh ''' file_refs = salt.client.ssh.state.lowstate_file_refs( chunks, _merge_extra_filerefs( kwargs.get('extra_filerefs', ''), ...
python
def _ssh_state(chunks, st_kwargs, kwargs, test=False): ''' Function to run a state with the given chunk via salt-ssh ''' file_refs = salt.client.ssh.state.lowstate_file_refs( chunks, _merge_extra_filerefs( kwargs.get('extra_filerefs', ''), ...
[ "def", "_ssh_state", "(", "chunks", ",", "st_kwargs", ",", "kwargs", ",", "test", "=", "False", ")", ":", "file_refs", "=", "salt", ".", "client", ".", "ssh", ".", "state", ".", "lowstate_file_refs", "(", "chunks", ",", "_merge_extra_filerefs", "(", "kwarg...
Function to run a state with the given chunk via salt-ssh
[ "Function", "to", "run", "a", "state", "with", "the", "given", "chunk", "via", "salt", "-", "ssh" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/state.py#L39-L89
35,379
saltstack/salt
salt/client/ssh/wrapper/state.py
_wait
def _wait(jid): ''' Wait for all previously started state jobs to finish running ''' if jid is None: jid = salt.utils.jid.gen_jid(__opts__) states = _prior_running_states(jid) while states: time.sleep(1) states = _prior_running_states(jid)
python
def _wait(jid): ''' Wait for all previously started state jobs to finish running ''' if jid is None: jid = salt.utils.jid.gen_jid(__opts__) states = _prior_running_states(jid) while states: time.sleep(1) states = _prior_running_states(jid)
[ "def", "_wait", "(", "jid", ")", ":", "if", "jid", "is", "None", ":", "jid", "=", "salt", ".", "utils", ".", "jid", ".", "gen_jid", "(", "__opts__", ")", "states", "=", "_prior_running_states", "(", "jid", ")", "while", "states", ":", "time", ".", ...
Wait for all previously started state jobs to finish running
[ "Wait", "for", "all", "previously", "started", "state", "jobs", "to", "finish", "running" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/state.py#L121-L130
35,380
saltstack/salt
salt/client/ssh/wrapper/state.py
_merge_extra_filerefs
def _merge_extra_filerefs(*args): ''' Takes a list of filerefs and returns a merged list ''' ret = [] for arg in args: if isinstance(arg, six.string_types): if arg: ret.extend(arg.split(',')) elif isinstance(arg, list): if arg: ...
python
def _merge_extra_filerefs(*args): ''' Takes a list of filerefs and returns a merged list ''' ret = [] for arg in args: if isinstance(arg, six.string_types): if arg: ret.extend(arg.split(',')) elif isinstance(arg, list): if arg: ...
[ "def", "_merge_extra_filerefs", "(", "*", "args", ")", ":", "ret", "=", "[", "]", "for", "arg", "in", "args", ":", "if", "isinstance", "(", "arg", ",", "six", ".", "string_types", ")", ":", "if", "arg", ":", "ret", ".", "extend", "(", "arg", ".", ...
Takes a list of filerefs and returns a merged list
[ "Takes", "a", "list", "of", "filerefs", "and", "returns", "a", "merged", "list" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/state.py#L133-L145
35,381
saltstack/salt
salt/client/ssh/wrapper/state.py
_cleanup_slsmod_high_data
def _cleanup_slsmod_high_data(high_data): ''' Set "slsmod" keys to None to make high_data JSON serializable ''' for i in six.itervalues(high_data): if 'stateconf' in i: stateconf_data = i['stateconf'][1] if 'slsmod' in stateconf_data: stateconf_data['s...
python
def _cleanup_slsmod_high_data(high_data): ''' Set "slsmod" keys to None to make high_data JSON serializable ''' for i in six.itervalues(high_data): if 'stateconf' in i: stateconf_data = i['stateconf'][1] if 'slsmod' in stateconf_data: stateconf_data['s...
[ "def", "_cleanup_slsmod_high_data", "(", "high_data", ")", ":", "for", "i", "in", "six", ".", "itervalues", "(", "high_data", ")", ":", "if", "'stateconf'", "in", "i", ":", "stateconf_data", "=", "i", "[", "'stateconf'", "]", "[", "1", "]", "if", "'slsmo...
Set "slsmod" keys to None to make high_data JSON serializable
[ "Set", "slsmod", "keys", "to", "None", "to", "make", "high_data", "JSON", "serializable" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/state.py#L158-L167
35,382
saltstack/salt
salt/client/ssh/wrapper/state.py
_parse_mods
def _parse_mods(mods): ''' Parse modules. ''' if isinstance(mods, six.string_types): mods = [item.strip() for item in mods.split(',') if item.strip()] return mods
python
def _parse_mods(mods): ''' Parse modules. ''' if isinstance(mods, six.string_types): mods = [item.strip() for item in mods.split(',') if item.strip()] return mods
[ "def", "_parse_mods", "(", "mods", ")", ":", "if", "isinstance", "(", "mods", ",", "six", ".", "string_types", ")", ":", "mods", "=", "[", "item", ".", "strip", "(", ")", "for", "item", "in", "mods", ".", "split", "(", "','", ")", "if", "item", "...
Parse modules.
[ "Parse", "modules", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/state.py#L170-L177
35,383
saltstack/salt
salt/client/ssh/wrapper/state.py
sls
def sls(mods, saltenv='base', test=None, exclude=None, **kwargs): ''' Create the seed file for a state.sls run ''' st_kwargs = __salt__.kwargs __opts__['grains'] = __grains__ __pillar__.update(kwargs.get('pillar', {})) opts = salt.utils.state.get_sls_opts(__opts__, **kwargs) st_ = salt.c...
python
def sls(mods, saltenv='base', test=None, exclude=None, **kwargs): ''' Create the seed file for a state.sls run ''' st_kwargs = __salt__.kwargs __opts__['grains'] = __grains__ __pillar__.update(kwargs.get('pillar', {})) opts = salt.utils.state.get_sls_opts(__opts__, **kwargs) st_ = salt.c...
[ "def", "sls", "(", "mods", ",", "saltenv", "=", "'base'", ",", "test", "=", "None", ",", "exclude", "=", "None", ",", "*", "*", "kwargs", ")", ":", "st_kwargs", "=", "__salt__", ".", "kwargs", "__opts__", "[", "'grains'", "]", "=", "__grains__", "__p...
Create the seed file for a state.sls run
[ "Create", "the", "seed", "file", "for", "a", "state", ".", "sls", "run" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/state.py#L180-L267
35,384
saltstack/salt
salt/client/ssh/wrapper/state.py
running
def running(concurrent=False): ''' Return a list of strings that contain state return data if a state function is already running. This function is used to prevent multiple state calls from being run at the same time. CLI Example: .. code-block:: bash salt '*' state.running ''' ...
python
def running(concurrent=False): ''' Return a list of strings that contain state return data if a state function is already running. This function is used to prevent multiple state calls from being run at the same time. CLI Example: .. code-block:: bash salt '*' state.running ''' ...
[ "def", "running", "(", "concurrent", "=", "False", ")", ":", "ret", "=", "[", "]", "if", "concurrent", ":", "return", "ret", "active", "=", "__salt__", "[", "'saltutil.is_running'", "]", "(", "'state.*'", ")", "for", "data", "in", "active", ":", "err", ...
Return a list of strings that contain state return data if a state function is already running. This function is used to prevent multiple state calls from being run at the same time. CLI Example: .. code-block:: bash salt '*' state.running
[ "Return", "a", "list", "of", "strings", "that", "contain", "state", "return", "data", "if", "a", "state", "function", "is", "already", "running", ".", "This", "function", "is", "used", "to", "prevent", "multiple", "state", "calls", "from", "being", "run", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/state.py#L270-L297
35,385
saltstack/salt
salt/client/ssh/wrapper/state.py
_prior_running_states
def _prior_running_states(jid): ''' Return a list of dicts of prior calls to state functions. This function is used to queue state calls so only one is run at a time. ''' ret = [] active = __salt__['saltutil.is_running']('state.*') for data in active: try: data_jid = in...
python
def _prior_running_states(jid): ''' Return a list of dicts of prior calls to state functions. This function is used to queue state calls so only one is run at a time. ''' ret = [] active = __salt__['saltutil.is_running']('state.*') for data in active: try: data_jid = in...
[ "def", "_prior_running_states", "(", "jid", ")", ":", "ret", "=", "[", "]", "active", "=", "__salt__", "[", "'saltutil.is_running'", "]", "(", "'state.*'", ")", "for", "data", "in", "active", ":", "try", ":", "data_jid", "=", "int", "(", "data", "[", "...
Return a list of dicts of prior calls to state functions. This function is used to queue state calls so only one is run at a time.
[ "Return", "a", "list", "of", "dicts", "of", "prior", "calls", "to", "state", "functions", ".", "This", "function", "is", "used", "to", "queue", "state", "calls", "so", "only", "one", "is", "run", "at", "a", "time", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/state.py#L300-L315
35,386
saltstack/salt
salt/client/ssh/wrapper/state.py
low
def low(data, **kwargs): ''' Execute a single low data call This function is mostly intended for testing the state system CLI Example: .. code-block:: bash salt '*' state.low '{"state": "pkg", "fun": "installed", "name": "vi"}' ''' st_kwargs = __salt__.kwargs __opts__['grains'...
python
def low(data, **kwargs): ''' Execute a single low data call This function is mostly intended for testing the state system CLI Example: .. code-block:: bash salt '*' state.low '{"state": "pkg", "fun": "installed", "name": "vi"}' ''' st_kwargs = __salt__.kwargs __opts__['grains'...
[ "def", "low", "(", "data", ",", "*", "*", "kwargs", ")", ":", "st_kwargs", "=", "__salt__", ".", "kwargs", "__opts__", "[", "'grains'", "]", "=", "__grains__", "chunks", "=", "[", "data", "]", "st_", "=", "salt", ".", "client", ".", "ssh", ".", "st...
Execute a single low data call This function is mostly intended for testing the state system CLI Example: .. code-block:: bash salt '*' state.low '{"state": "pkg", "fun": "installed", "name": "vi"}'
[ "Execute", "a", "single", "low", "data", "call", "This", "function", "is", "mostly", "intended", "for", "testing", "the", "state", "system" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/state.py#L338-L410
35,387
saltstack/salt
salt/client/ssh/wrapper/state.py
show_sls
def show_sls(mods, saltenv='base', test=None, **kwargs): ''' Display the state data from a specific sls or list of sls files on the master CLI Example: .. code-block:: bash salt '*' state.show_sls core,edit.vim dev ''' __pillar__.update(kwargs.get('pillar', {})) __opts__['grai...
python
def show_sls(mods, saltenv='base', test=None, **kwargs): ''' Display the state data from a specific sls or list of sls files on the master CLI Example: .. code-block:: bash salt '*' state.show_sls core,edit.vim dev ''' __pillar__.update(kwargs.get('pillar', {})) __opts__['grai...
[ "def", "show_sls", "(", "mods", ",", "saltenv", "=", "'base'", ",", "test", "=", "None", ",", "*", "*", "kwargs", ")", ":", "__pillar__", ".", "update", "(", "kwargs", ".", "get", "(", "'pillar'", ",", "{", "}", ")", ")", "__opts__", "[", "'grains'...
Display the state data from a specific sls or list of sls files on the master CLI Example: .. code-block:: bash salt '*' state.show_sls core,edit.vim dev
[ "Display", "the", "state", "data", "from", "a", "specific", "sls", "or", "list", "of", "sls", "files", "on", "the", "master" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/state.py#L967-L1005
35,388
saltstack/salt
salt/modules/datadog_api.py
_initialize_connection
def _initialize_connection(api_key, app_key): ''' Initialize Datadog connection ''' if api_key is None: raise SaltInvocationError('api_key must be specified') if app_key is None: raise SaltInvocationError('app_key must be specified') options = { 'api_key': api_key, ...
python
def _initialize_connection(api_key, app_key): ''' Initialize Datadog connection ''' if api_key is None: raise SaltInvocationError('api_key must be specified') if app_key is None: raise SaltInvocationError('app_key must be specified') options = { 'api_key': api_key, ...
[ "def", "_initialize_connection", "(", "api_key", ",", "app_key", ")", ":", "if", "api_key", "is", "None", ":", "raise", "SaltInvocationError", "(", "'api_key must be specified'", ")", "if", "app_key", "is", "None", ":", "raise", "SaltInvocationError", "(", "'app_k...
Initialize Datadog connection
[ "Initialize", "Datadog", "connection" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/datadog_api.py#L41-L53
35,389
saltstack/salt
salt/modules/datadog_api.py
schedule_downtime
def schedule_downtime(scope, api_key=None, app_key=None, monitor_id=None, start=None, end=None, message=None, recurrence=None, timezone=None, ...
python
def schedule_downtime(scope, api_key=None, app_key=None, monitor_id=None, start=None, end=None, message=None, recurrence=None, timezone=None, ...
[ "def", "schedule_downtime", "(", "scope", ",", "api_key", "=", "None", ",", "app_key", "=", "None", ",", "monitor_id", "=", "None", ",", "start", "=", "None", ",", "end", "=", "None", ",", "message", "=", "None", ",", "recurrence", "=", "None", ",", ...
Schedule downtime for a scope of monitors. CLI Example: .. code-block:: bash salt-call datadog.schedule_downtime 'host:app2' \\ stop=$(date --date='30 minutes' +%s) \\ app_key='0123456789' \\ ...
[ "Schedule", "downtime", "for", "a", "scope", "of", "monitors", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/datadog_api.py#L56-L120
35,390
saltstack/salt
salt/modules/datadog_api.py
cancel_downtime
def cancel_downtime(api_key=None, app_key=None, scope=None, id=None): ''' Cancel a downtime by id or by scope. CLI Example: .. code-block:: bash salt-call datadog.cancel_downtime scope='host:app01' \\ ...
python
def cancel_downtime(api_key=None, app_key=None, scope=None, id=None): ''' Cancel a downtime by id or by scope. CLI Example: .. code-block:: bash salt-call datadog.cancel_downtime scope='host:app01' \\ ...
[ "def", "cancel_downtime", "(", "api_key", "=", "None", ",", "app_key", "=", "None", ",", "scope", "=", "None", ",", "id", "=", "None", ")", ":", "if", "api_key", "is", "None", ":", "raise", "SaltInvocationError", "(", "'api_key must be specified'", ")", "i...
Cancel a downtime by id or by scope. CLI Example: .. code-block:: bash salt-call datadog.cancel_downtime scope='host:app01' \\ api_key='0123456789' \\ app_key='9876543210'` Arguments - Either scope or id is requi...
[ "Cancel", "a", "downtime", "by", "id", "or", "by", "scope", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/datadog_api.py#L123-L180
35,391
saltstack/salt
salt/modules/datadog_api.py
post_event
def post_event(api_key=None, app_key=None, title=None, text=None, date_happened=None, priority=None, host=None, tags=None, alert_type=None, aggregation_key=None, source_t...
python
def post_event(api_key=None, app_key=None, title=None, text=None, date_happened=None, priority=None, host=None, tags=None, alert_type=None, aggregation_key=None, source_t...
[ "def", "post_event", "(", "api_key", "=", "None", ",", "app_key", "=", "None", ",", "title", "=", "None", ",", "text", "=", "None", ",", "date_happened", "=", "None", ",", "priority", "=", "None", ",", "host", "=", "None", ",", "tags", "=", "None", ...
Post an event to the Datadog stream. CLI Example .. code-block:: bash salt-call datadog.post_event api_key='0123456789' \\ app_key='9876543210' \\ title='Salt Highstate' \\ text="Salt highst...
[ "Post", "an", "event", "to", "the", "Datadog", "stream", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/datadog_api.py#L183-L264
35,392
saltstack/salt
salt/modules/xbpspkg.py
_get_version
def _get_version(): ''' Get the xbps version ''' version_string = __salt__['cmd.run']( [_check_xbps(), '--version'], output_loglevel='trace') if version_string is None: # Dunno why it would, but... return False VERSION_MATCH = re.compile(r'(?:XBPS:[\s]+)([\d.]+)(...
python
def _get_version(): ''' Get the xbps version ''' version_string = __salt__['cmd.run']( [_check_xbps(), '--version'], output_loglevel='trace') if version_string is None: # Dunno why it would, but... return False VERSION_MATCH = re.compile(r'(?:XBPS:[\s]+)([\d.]+)(...
[ "def", "_get_version", "(", ")", ":", "version_string", "=", "__salt__", "[", "'cmd.run'", "]", "(", "[", "_check_xbps", "(", ")", ",", "'--version'", "]", ",", "output_loglevel", "=", "'trace'", ")", "if", "version_string", "is", "None", ":", "# Dunno why i...
Get the xbps version
[ "Get", "the", "xbps", "version" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xbpspkg.py#L51-L67
35,393
saltstack/salt
salt/modules/xbpspkg.py
refresh_db
def refresh_db(**kwargs): ''' Update list of available packages from installed repos CLI Example: .. code-block:: bash salt '*' pkg.refresh_db ''' # Remove rtag file to keep multiple refreshes from happening in pkg states salt.utils.pkg.clear_rtag(__opts__) cmd = 'xbps-install...
python
def refresh_db(**kwargs): ''' Update list of available packages from installed repos CLI Example: .. code-block:: bash salt '*' pkg.refresh_db ''' # Remove rtag file to keep multiple refreshes from happening in pkg states salt.utils.pkg.clear_rtag(__opts__) cmd = 'xbps-install...
[ "def", "refresh_db", "(", "*", "*", "kwargs", ")", ":", "# Remove rtag file to keep multiple refreshes from happening in pkg states", "salt", ".", "utils", ".", "pkg", ".", "clear_rtag", "(", "__opts__", ")", "cmd", "=", "'xbps-install -Sy'", "call", "=", "__salt__", ...
Update list of available packages from installed repos CLI Example: .. code-block:: bash salt '*' pkg.refresh_db
[ "Update", "list", "of", "available", "packages", "from", "installed", "repos" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xbpspkg.py#L263-L284
35,394
saltstack/salt
salt/modules/xbpspkg.py
list_repos
def list_repos(**kwargs): ''' List all repos known by XBPS CLI Example: .. code-block:: bash salt '*' pkg.list_repos ''' repos = {} out = __salt__['cmd.run']('xbps-query -L', output_loglevel='trace') for line in out.splitlines(): repo = {} if not line: ...
python
def list_repos(**kwargs): ''' List all repos known by XBPS CLI Example: .. code-block:: bash salt '*' pkg.list_repos ''' repos = {} out = __salt__['cmd.run']('xbps-query -L', output_loglevel='trace') for line in out.splitlines(): repo = {} if not line: ...
[ "def", "list_repos", "(", "*", "*", "kwargs", ")", ":", "repos", "=", "{", "}", "out", "=", "__salt__", "[", "'cmd.run'", "]", "(", "'xbps-query -L'", ",", "output_loglevel", "=", "'trace'", ")", "for", "line", "in", "out", ".", "splitlines", "(", ")",...
List all repos known by XBPS CLI Example: .. code-block:: bash salt '*' pkg.list_repos
[ "List", "all", "repos", "known", "by", "XBPS" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xbpspkg.py#L487-L514
35,395
saltstack/salt
salt/modules/xbpspkg.py
_locate_repo_files
def _locate_repo_files(repo, rewrite=False): ''' Find what file a repo is called in. Helper function for add_repo() and del_repo() repo url of the repo to locate (persistent). rewrite Whether to remove matching repository settings during this process. Returns a list of absolu...
python
def _locate_repo_files(repo, rewrite=False): ''' Find what file a repo is called in. Helper function for add_repo() and del_repo() repo url of the repo to locate (persistent). rewrite Whether to remove matching repository settings during this process. Returns a list of absolu...
[ "def", "_locate_repo_files", "(", "repo", ",", "rewrite", "=", "False", ")", ":", "ret_val", "=", "[", "]", "files", "=", "[", "]", "conf_dirs", "=", "[", "'/etc/xbps.d/'", ",", "'/usr/share/xbps.d/'", "]", "name_glob", "=", "'*.conf'", "# Matches a line where...
Find what file a repo is called in. Helper function for add_repo() and del_repo() repo url of the repo to locate (persistent). rewrite Whether to remove matching repository settings during this process. Returns a list of absolute paths.
[ "Find", "what", "file", "a", "repo", "is", "called", "in", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xbpspkg.py#L533-L575
35,396
saltstack/salt
salt/modules/xbpspkg.py
add_repo
def add_repo(repo, conffile='/usr/share/xbps.d/15-saltstack.conf'): ''' Add an XBPS repository to the system. repo url of repo to add (persistent). conffile path to xbps conf file to add this repo default: /usr/share/xbps.d/15-saltstack.conf CLI Examples: .. code-bloc...
python
def add_repo(repo, conffile='/usr/share/xbps.d/15-saltstack.conf'): ''' Add an XBPS repository to the system. repo url of repo to add (persistent). conffile path to xbps conf file to add this repo default: /usr/share/xbps.d/15-saltstack.conf CLI Examples: .. code-bloc...
[ "def", "add_repo", "(", "repo", ",", "conffile", "=", "'/usr/share/xbps.d/15-saltstack.conf'", ")", ":", "if", "not", "_locate_repo_files", "(", "repo", ")", ":", "try", ":", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "conffile", ",", "...
Add an XBPS repository to the system. repo url of repo to add (persistent). conffile path to xbps conf file to add this repo default: /usr/share/xbps.d/15-saltstack.conf CLI Examples: .. code-block:: bash salt '*' pkg.add_repo <repo url> [conffile=/path/to/xbps/repo....
[ "Add", "an", "XBPS", "repository", "to", "the", "system", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xbpspkg.py#L578-L607
35,397
saltstack/salt
salt/modules/xbpspkg.py
del_repo
def del_repo(repo, **kwargs): ''' Remove an XBPS repository from the system. repo url of repo to remove (persistent). CLI Examples: .. code-block:: bash salt '*' pkg.del_repo <repo url> ''' try: _locate_repo_files(repo, rewrite=True) except IOError: r...
python
def del_repo(repo, **kwargs): ''' Remove an XBPS repository from the system. repo url of repo to remove (persistent). CLI Examples: .. code-block:: bash salt '*' pkg.del_repo <repo url> ''' try: _locate_repo_files(repo, rewrite=True) except IOError: r...
[ "def", "del_repo", "(", "repo", ",", "*", "*", "kwargs", ")", ":", "try", ":", "_locate_repo_files", "(", "repo", ",", "rewrite", "=", "True", ")", "except", "IOError", ":", "return", "False", "else", ":", "return", "True" ]
Remove an XBPS repository from the system. repo url of repo to remove (persistent). CLI Examples: .. code-block:: bash salt '*' pkg.del_repo <repo url>
[ "Remove", "an", "XBPS", "repository", "from", "the", "system", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xbpspkg.py#L610-L629
35,398
saltstack/salt
salt/states/apache_conf.py
enabled
def enabled(name): ''' Ensure an Apache conf is enabled. name Name of the Apache conf ''' ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} is_enabled = __salt__['apache.check_conf_enabled'](name) if not is_enabled: if __opts__['test']: msg = 'A...
python
def enabled(name): ''' Ensure an Apache conf is enabled. name Name of the Apache conf ''' ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} is_enabled = __salt__['apache.check_conf_enabled'](name) if not is_enabled: if __opts__['test']: msg = 'A...
[ "def", "enabled", "(", "name", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", "}", "is_enabled", "=", "__salt__", "[", "'apache.check_conf_enabled'", "]", "(...
Ensure an Apache conf is enabled. name Name of the Apache conf
[ "Ensure", "an", "Apache", "conf", "is", "enabled", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/apache_conf.py#L33-L64
35,399
saltstack/salt
salt/modules/napalm_ntp.py
peers
def peers(**kwargs): # pylint: disable=unused-argument ''' Returns a list the NTP peers configured on the network device. :return: configured NTP peers as list. CLI Example: .. code-block:: bash salt '*' ntp.peers Example output: .. code-block:: python [ ...
python
def peers(**kwargs): # pylint: disable=unused-argument ''' Returns a list the NTP peers configured on the network device. :return: configured NTP peers as list. CLI Example: .. code-block:: bash salt '*' ntp.peers Example output: .. code-block:: python [ ...
[ "def", "peers", "(", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "ntp_peers", "=", "salt", ".", "utils", ".", "napalm", ".", "call", "(", "napalm_device", ",", "# pylint: disable=undefined-variable", "'get_ntp_peers'", ",", "*", "*", "{", ...
Returns a list the NTP peers configured on the network device. :return: configured NTP peers as list. CLI Example: .. code-block:: bash salt '*' ntp.peers Example output: .. code-block:: python [ '192.168.0.1', '172.17.17.1', '172.17.17.2', ...
[ "Returns", "a", "list", "the", "NTP", "peers", "configured", "on", "the", "network", "device", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_ntp.py#L63-L103