repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
saltstack/salt
salt/cache/localfs.py
updated
def updated(bank, key, cachedir): ''' Return the epoch of the mtime for this cache file ''' key_file = os.path.join(cachedir, os.path.normpath(bank), '{0}.p'.format(key)) if not os.path.isfile(key_file): log.warning('Cache file "%s" does not exist', key_file) return None try: ...
python
def updated(bank, key, cachedir): ''' Return the epoch of the mtime for this cache file ''' key_file = os.path.join(cachedir, os.path.normpath(bank), '{0}.p'.format(key)) if not os.path.isfile(key_file): log.warning('Cache file "%s" does not exist', key_file) return None try: ...
[ "def", "updated", "(", "bank", ",", "key", ",", "cachedir", ")", ":", "key_file", "=", "os", ".", "path", ".", "join", "(", "cachedir", ",", "os", ".", "path", ".", "normpath", "(", "bank", ")", ",", "'{0}.p'", ".", "format", "(", "key", ")", ")"...
Return the epoch of the mtime for this cache file
[ "Return", "the", "epoch", "of", "the", "mtime", "for", "this", "cache", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/localfs.py#L103-L118
train
saltstack/salt
salt/cache/localfs.py
flush
def flush(bank, key=None, cachedir=None): ''' Remove the key from the cache bank with all the key content. ''' if cachedir is None: cachedir = __cachedir() try: if key is None: target = os.path.join(cachedir, os.path.normpath(bank)) if not os.path.isdir(targe...
python
def flush(bank, key=None, cachedir=None): ''' Remove the key from the cache bank with all the key content. ''' if cachedir is None: cachedir = __cachedir() try: if key is None: target = os.path.join(cachedir, os.path.normpath(bank)) if not os.path.isdir(targe...
[ "def", "flush", "(", "bank", ",", "key", "=", "None", ",", "cachedir", "=", "None", ")", ":", "if", "cachedir", "is", "None", ":", "cachedir", "=", "__cachedir", "(", ")", "try", ":", "if", "key", "is", "None", ":", "target", "=", "os", ".", "pat...
Remove the key from the cache bank with all the key content.
[ "Remove", "the", "key", "from", "the", "cache", "bank", "with", "all", "the", "key", "content", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/localfs.py#L121-L145
train
saltstack/salt
salt/cache/localfs.py
list_
def list_(bank, cachedir): ''' Return an iterable object containing all entries stored in the specified bank. ''' base = os.path.join(cachedir, os.path.normpath(bank)) if not os.path.isdir(base): return [] try: items = os.listdir(base) except OSError as exc: raise Sal...
python
def list_(bank, cachedir): ''' Return an iterable object containing all entries stored in the specified bank. ''' base = os.path.join(cachedir, os.path.normpath(bank)) if not os.path.isdir(base): return [] try: items = os.listdir(base) except OSError as exc: raise Sal...
[ "def", "list_", "(", "bank", ",", "cachedir", ")", ":", "base", "=", "os", ".", "path", ".", "join", "(", "cachedir", ",", "os", ".", "path", ".", "normpath", "(", "bank", ")", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "base", ")"...
Return an iterable object containing all entries stored in the specified bank.
[ "Return", "an", "iterable", "object", "containing", "all", "entries", "stored", "in", "the", "specified", "bank", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/localfs.py#L148-L169
train
saltstack/salt
salt/cache/localfs.py
contains
def contains(bank, key, cachedir): ''' Checks if the specified bank contains the specified key. ''' if key is None: base = os.path.join(cachedir, os.path.normpath(bank)) return os.path.isdir(base) else: keyfile = os.path.join(cachedir, os.path.normpath(bank), '{0}.p'.format(k...
python
def contains(bank, key, cachedir): ''' Checks if the specified bank contains the specified key. ''' if key is None: base = os.path.join(cachedir, os.path.normpath(bank)) return os.path.isdir(base) else: keyfile = os.path.join(cachedir, os.path.normpath(bank), '{0}.p'.format(k...
[ "def", "contains", "(", "bank", ",", "key", ",", "cachedir", ")", ":", "if", "key", "is", "None", ":", "base", "=", "os", ".", "path", ".", "join", "(", "cachedir", ",", "os", ".", "path", ".", "normpath", "(", "bank", ")", ")", "return", "os", ...
Checks if the specified bank contains the specified key.
[ "Checks", "if", "the", "specified", "bank", "contains", "the", "specified", "key", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/localfs.py#L172-L181
train
saltstack/salt
salt/utils/win_reg.py
key_exists
def key_exists(hive, key, use_32bit_registry=False): ''' Check that the key is found in the registry. This refers to keys and not value/data pairs. To check value/data pairs, use ``value_exists`` Args: hive (str): The hive to connect to key (str): The key to check use_32bit_r...
python
def key_exists(hive, key, use_32bit_registry=False): ''' Check that the key is found in the registry. This refers to keys and not value/data pairs. To check value/data pairs, use ``value_exists`` Args: hive (str): The hive to connect to key (str): The key to check use_32bit_r...
[ "def", "key_exists", "(", "hive", ",", "key", ",", "use_32bit_registry", "=", "False", ")", ":", "local_hive", "=", "_to_unicode", "(", "hive", ")", "local_key", "=", "_to_unicode", "(", "key", ")", "registry", "=", "Registry", "(", ")", "try", ":", "hke...
Check that the key is found in the registry. This refers to keys and not value/data pairs. To check value/data pairs, use ``value_exists`` Args: hive (str): The hive to connect to key (str): The key to check use_32bit_registry (bool): Look in the 32bit portion of the registry Re...
[ "Check", "that", "the", "key", "is", "found", "in", "the", "registry", ".", "This", "refers", "to", "keys", "and", "not", "value", "/", "data", "pairs", ".", "To", "check", "value", "/", "data", "pairs", "use", "value_exists" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_reg.py#L162-L205
train
saltstack/salt
salt/utils/win_reg.py
value_exists
def value_exists(hive, key, vname, use_32bit_registry=False): ''' Check that the value/data pair is found in the registry. .. version-added:: 2018.3.4 Args: hive (str): The hive to connect to key (str): The key to check in vname (str): The name of the value/data pair you're ...
python
def value_exists(hive, key, vname, use_32bit_registry=False): ''' Check that the value/data pair is found in the registry. .. version-added:: 2018.3.4 Args: hive (str): The hive to connect to key (str): The key to check in vname (str): The name of the value/data pair you're ...
[ "def", "value_exists", "(", "hive", ",", "key", ",", "vname", ",", "use_32bit_registry", "=", "False", ")", ":", "local_hive", "=", "_to_unicode", "(", "hive", ")", "local_key", "=", "_to_unicode", "(", "key", ")", "local_vname", "=", "_to_unicode", "(", "...
Check that the value/data pair is found in the registry. .. version-added:: 2018.3.4 Args: hive (str): The hive to connect to key (str): The key to check in vname (str): The name of the value/data pair you're checking use_32bit_registry (bool): Look in the 32bit portion of ...
[ "Check", "that", "the", "value", "/", "data", "pair", "is", "found", "in", "the", "registry", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_reg.py#L208-L266
train
saltstack/salt
salt/utils/win_reg.py
broadcast_change
def broadcast_change(): ''' Refresh the windows environment. .. note:: This will only effect new processes and windows. Services will not see the change until the system restarts. Returns: bool: True if successful, otherwise False Usage: .. code-block:: python ...
python
def broadcast_change(): ''' Refresh the windows environment. .. note:: This will only effect new processes and windows. Services will not see the change until the system restarts. Returns: bool: True if successful, otherwise False Usage: .. code-block:: python ...
[ "def", "broadcast_change", "(", ")", ":", "# https://msdn.microsoft.com/en-us/library/windows/desktop/ms644952(v=vs.85).aspx", "_", ",", "res", "=", "win32gui", ".", "SendMessageTimeout", "(", "win32con", ".", "HWND_BROADCAST", ",", "win32con", ".", "WM_SETTINGCHANGE", ",",...
Refresh the windows environment. .. note:: This will only effect new processes and windows. Services will not see the change until the system restarts. Returns: bool: True if successful, otherwise False Usage: .. code-block:: python import salt.utils.win_reg ...
[ "Refresh", "the", "windows", "environment", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_reg.py#L269-L291
train
saltstack/salt
salt/utils/win_reg.py
list_keys
def list_keys(hive, key=None, use_32bit_registry=False): ''' Enumerates the subkeys in a registry key or hive. Args: hive (str): The name of the hive. Can be one of the following: - HKEY_LOCAL_MACHINE or HKLM - HKEY_CURRENT_USER or HKCU -...
python
def list_keys(hive, key=None, use_32bit_registry=False): ''' Enumerates the subkeys in a registry key or hive. Args: hive (str): The name of the hive. Can be one of the following: - HKEY_LOCAL_MACHINE or HKLM - HKEY_CURRENT_USER or HKCU -...
[ "def", "list_keys", "(", "hive", ",", "key", "=", "None", ",", "use_32bit_registry", "=", "False", ")", ":", "local_hive", "=", "_to_unicode", "(", "hive", ")", "local_key", "=", "_to_unicode", "(", "key", ")", "registry", "=", "Registry", "(", ")", "try...
Enumerates the subkeys in a registry key or hive. Args: hive (str): The name of the hive. Can be one of the following: - HKEY_LOCAL_MACHINE or HKLM - HKEY_CURRENT_USER or HKCU - HKEY_USERS or HKU - HKEY_CLASSES_ROOT or HKCR ...
[ "Enumerates", "the", "subkeys", "in", "a", "registry", "key", "or", "hive", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_reg.py#L294-L357
train
saltstack/salt
salt/utils/win_reg.py
list_values
def list_values(hive, key=None, use_32bit_registry=False, include_default=True): ''' Enumerates the values in a registry key or hive. Args: hive (str): The name of the hive. Can be one of the following: - HKEY_LOCAL_MACHINE or HKLM - HKEY_CURRENT_USER o...
python
def list_values(hive, key=None, use_32bit_registry=False, include_default=True): ''' Enumerates the values in a registry key or hive. Args: hive (str): The name of the hive. Can be one of the following: - HKEY_LOCAL_MACHINE or HKLM - HKEY_CURRENT_USER o...
[ "def", "list_values", "(", "hive", ",", "key", "=", "None", ",", "use_32bit_registry", "=", "False", ",", "include_default", "=", "True", ")", ":", "local_hive", "=", "_to_unicode", "(", "hive", ")", "local_key", "=", "_to_unicode", "(", "key", ")", "regis...
Enumerates the values in a registry key or hive. Args: hive (str): The name of the hive. Can be one of the following: - HKEY_LOCAL_MACHINE or HKLM - HKEY_CURRENT_USER or HKCU - HKEY_USER or HKU - HKEY_CLASSES_ROOT or HKCR ...
[ "Enumerates", "the", "values", "in", "a", "registry", "key", "or", "hive", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_reg.py#L360-L438
train
saltstack/salt
salt/utils/win_reg.py
read_value
def read_value(hive, key, vname=None, use_32bit_registry=False): r''' Reads a registry value entry or the default value for a key. To read the default value, don't pass ``vname`` Args: hive (str): The name of the hive. Can be one of the following: - HKEY_LOCAL_MACHINE or HKLM ...
python
def read_value(hive, key, vname=None, use_32bit_registry=False): r''' Reads a registry value entry or the default value for a key. To read the default value, don't pass ``vname`` Args: hive (str): The name of the hive. Can be one of the following: - HKEY_LOCAL_MACHINE or HKLM ...
[ "def", "read_value", "(", "hive", ",", "key", ",", "vname", "=", "None", ",", "use_32bit_registry", "=", "False", ")", ":", "# If no name is passed, the default value of the key will be returned", "# The value name is Default", "# Setup the return array", "local_hive", "=", ...
r''' Reads a registry value entry or the default value for a key. To read the default value, don't pass ``vname`` Args: hive (str): The name of the hive. Can be one of the following: - HKEY_LOCAL_MACHINE or HKLM - HKEY_CURRENT_USER or HKCU - HKEY_USER or HKU ...
[ "r", "Reads", "a", "registry", "value", "entry", "or", "the", "default", "value", "for", "a", "key", ".", "To", "read", "the", "default", "value", "don", "t", "pass", "vname" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_reg.py#L441-L555
train
saltstack/salt
salt/utils/win_reg.py
set_value
def set_value(hive, key, vname=None, vdata=None, vtype='REG_SZ', use_32bit_registry=False, volatile=False): ''' Sets a value in the registry. If ``vname`` is passed, it will be the value for that value name, otherwise it wil...
python
def set_value(hive, key, vname=None, vdata=None, vtype='REG_SZ', use_32bit_registry=False, volatile=False): ''' Sets a value in the registry. If ``vname`` is passed, it will be the value for that value name, otherwise it wil...
[ "def", "set_value", "(", "hive", ",", "key", ",", "vname", "=", "None", ",", "vdata", "=", "None", ",", "vtype", "=", "'REG_SZ'", ",", "use_32bit_registry", "=", "False", ",", "volatile", "=", "False", ")", ":", "local_hive", "=", "_to_unicode", "(", "...
Sets a value in the registry. If ``vname`` is passed, it will be the value for that value name, otherwise it will be the default value for the specified key Args: hive (str): The name of the hive. Can be one of the following - HKEY_LOCAL_MACHINE or HKLM ...
[ "Sets", "a", "value", "in", "the", "registry", ".", "If", "vname", "is", "passed", "it", "will", "be", "the", "value", "for", "that", "value", "name", "otherwise", "it", "will", "be", "the", "default", "value", "for", "the", "specified", "key" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_reg.py#L558-L719
train
saltstack/salt
salt/utils/win_reg.py
cast_vdata
def cast_vdata(vdata=None, vtype='REG_SZ'): ''' Cast the ``vdata` value to the appropriate data type for the registry type specified in ``vtype`` Args: vdata (str, int, list, bytes): The data to cast vtype (str): The type of data to be written to the registry. Must be one ...
python
def cast_vdata(vdata=None, vtype='REG_SZ'): ''' Cast the ``vdata` value to the appropriate data type for the registry type specified in ``vtype`` Args: vdata (str, int, list, bytes): The data to cast vtype (str): The type of data to be written to the registry. Must be one ...
[ "def", "cast_vdata", "(", "vdata", "=", "None", ",", "vtype", "=", "'REG_SZ'", ")", ":", "# Check data type and cast to expected type", "# int will automatically become long on 64bit numbers", "# https://www.python.org/dev/peps/pep-0237/", "registry", "=", "Registry", "(", ")",...
Cast the ``vdata` value to the appropriate data type for the registry type specified in ``vtype`` Args: vdata (str, int, list, bytes): The data to cast vtype (str): The type of data to be written to the registry. Must be one of the following: - REG_BIN...
[ "Cast", "the", "vdata", "value", "to", "the", "appropriate", "data", "type", "for", "the", "registry", "type", "specified", "in", "vtype" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_reg.py#L722-L777
train
saltstack/salt
salt/utils/win_reg.py
delete_key_recursive
def delete_key_recursive(hive, key, use_32bit_registry=False): ''' .. versionadded:: 2015.5.4 Delete a registry key to include all subkeys and value/data pairs. Args: hive (str): The name of the hive. Can be one of the following - HKEY_LOCAL_MACHINE or HKLM ...
python
def delete_key_recursive(hive, key, use_32bit_registry=False): ''' .. versionadded:: 2015.5.4 Delete a registry key to include all subkeys and value/data pairs. Args: hive (str): The name of the hive. Can be one of the following - HKEY_LOCAL_MACHINE or HKLM ...
[ "def", "delete_key_recursive", "(", "hive", ",", "key", ",", "use_32bit_registry", "=", "False", ")", ":", "local_hive", "=", "_to_unicode", "(", "hive", ")", "local_key", "=", "_to_unicode", "(", "key", ")", "# Instantiate the registry object", "registry", "=", ...
.. versionadded:: 2015.5.4 Delete a registry key to include all subkeys and value/data pairs. Args: hive (str): The name of the hive. Can be one of the following - HKEY_LOCAL_MACHINE or HKLM - HKEY_CURRENT_USER or HKCU - HKEY_USER or HKU ...
[ "..", "versionadded", "::", "2015", ".", "5", ".", "4" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_reg.py#L780-L887
train
saltstack/salt
salt/utils/win_reg.py
delete_value
def delete_value(hive, key, vname=None, use_32bit_registry=False): ''' Delete a registry value entry or the default value for a key. Args: hive (str): The name of the hive. Can be one of the following - HKEY_LOCAL_MACHINE or HKLM - HKEY_CURRENT_USER or ...
python
def delete_value(hive, key, vname=None, use_32bit_registry=False): ''' Delete a registry value entry or the default value for a key. Args: hive (str): The name of the hive. Can be one of the following - HKEY_LOCAL_MACHINE or HKLM - HKEY_CURRENT_USER or ...
[ "def", "delete_value", "(", "hive", ",", "key", ",", "vname", "=", "None", ",", "use_32bit_registry", "=", "False", ")", ":", "local_hive", "=", "_to_unicode", "(", "hive", ")", "local_key", "=", "_to_unicode", "(", "key", ")", "local_vname", "=", "_to_uni...
Delete a registry value entry or the default value for a key. Args: hive (str): The name of the hive. Can be one of the following - HKEY_LOCAL_MACHINE or HKLM - HKEY_CURRENT_USER or HKCU - HKEY_USER or HKU - HKEY_CLASSES_ROOT or ...
[ "Delete", "a", "registry", "value", "entry", "or", "the", "default", "value", "for", "a", "key", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_reg.py#L890-L955
train
saltstack/salt
salt/modules/at_solaris.py
atq
def atq(tag=None): ''' List all queued and running jobs or only those with an optional 'tag'. CLI Example: .. code-block:: bash salt '*' at.atq salt '*' at.atq [tag] salt '*' at.atq [job number] ''' jobs = [] res = __salt__['cmd.run_all']('atq') if res['r...
python
def atq(tag=None): ''' List all queued and running jobs or only those with an optional 'tag'. CLI Example: .. code-block:: bash salt '*' at.atq salt '*' at.atq [tag] salt '*' at.atq [job number] ''' jobs = [] res = __salt__['cmd.run_all']('atq') if res['r...
[ "def", "atq", "(", "tag", "=", "None", ")", ":", "jobs", "=", "[", "]", "res", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "'atq'", ")", "if", "res", "[", "'retcode'", "]", ">", "0", ":", "return", "{", "'error'", ":", "res", "[", "'stderr'"...
List all queued and running jobs or only those with an optional 'tag'. CLI Example: .. code-block:: bash salt '*' at.atq salt '*' at.atq [tag] salt '*' at.atq [job number]
[ "List", "all", "queued", "and", "running", "jobs", "or", "only", "those", "with", "an", "optional", "tag", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/at_solaris.py#L50-L121
train
saltstack/salt
salt/modules/at_solaris.py
atrm
def atrm(*args): ''' Remove jobs from the queue. CLI Example: .. code-block:: bash salt '*' at.atrm <jobid> <jobid> .. <jobid> salt '*' at.atrm all salt '*' at.atrm all [tag] ''' if not args: return {'jobs': {'removed': [], 'tag': None}} if args[0] == 'al...
python
def atrm(*args): ''' Remove jobs from the queue. CLI Example: .. code-block:: bash salt '*' at.atrm <jobid> <jobid> .. <jobid> salt '*' at.atrm all salt '*' at.atrm all [tag] ''' if not args: return {'jobs': {'removed': [], 'tag': None}} if args[0] == 'al...
[ "def", "atrm", "(", "*", "args", ")", ":", "if", "not", "args", ":", "return", "{", "'jobs'", ":", "{", "'removed'", ":", "[", "]", ",", "'tag'", ":", "None", "}", "}", "if", "args", "[", "0", "]", "==", "'all'", ":", "if", "len", "(", "args"...
Remove jobs from the queue. CLI Example: .. code-block:: bash salt '*' at.atrm <jobid> <jobid> .. <jobid> salt '*' at.atrm all salt '*' at.atrm all [tag]
[ "Remove", "jobs", "from", "the", "queue", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/at_solaris.py#L124-L167
train
saltstack/salt
salt/modules/at_solaris.py
at
def at(*args, **kwargs): # pylint: disable=C0103 ''' Add a job to the queue. The 'timespec' follows the format documented in the at(1) manpage. CLI Example: .. code-block:: bash salt '*' at.at <timespec> <cmd> [tag=<tag>] [runas=<user>] salt '*' at.at 12:05am '/sbin/reboot' ...
python
def at(*args, **kwargs): # pylint: disable=C0103 ''' Add a job to the queue. The 'timespec' follows the format documented in the at(1) manpage. CLI Example: .. code-block:: bash salt '*' at.at <timespec> <cmd> [tag=<tag>] [runas=<user>] salt '*' at.at 12:05am '/sbin/reboot' ...
[ "def", "at", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=C0103", "# check args", "if", "len", "(", "args", ")", "<", "2", ":", "return", "{", "'jobs'", ":", "[", "]", "}", "# build job", "if", "'tag'", "in", "kwargs", ":",...
Add a job to the queue. The 'timespec' follows the format documented in the at(1) manpage. CLI Example: .. code-block:: bash salt '*' at.at <timespec> <cmd> [tag=<tag>] [runas=<user>] salt '*' at.at 12:05am '/sbin/reboot' tag=reboot salt '*' at.at '3:05am +3 days' 'bin/myscri...
[ "Add", "a", "job", "to", "the", "queue", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/at_solaris.py#L170-L211
train
saltstack/salt
salt/modules/at_solaris.py
atc
def atc(jobid): ''' Print the at(1) script that will run for the passed job id. This is mostly for debugging so the output will just be text. CLI Example: .. code-block:: bash salt '*' at.atc <jobid> ''' atjob_file = '/var/spool/cron/atjobs/{job}'.format( job=jobid ...
python
def atc(jobid): ''' Print the at(1) script that will run for the passed job id. This is mostly for debugging so the output will just be text. CLI Example: .. code-block:: bash salt '*' at.atc <jobid> ''' atjob_file = '/var/spool/cron/atjobs/{job}'.format( job=jobid ...
[ "def", "atc", "(", "jobid", ")", ":", "atjob_file", "=", "'/var/spool/cron/atjobs/{job}'", ".", "format", "(", "job", "=", "jobid", ")", "if", "__salt__", "[", "'file.file_exists'", "]", "(", "atjob_file", ")", ":", "with", "salt", ".", "utils", ".", "file...
Print the at(1) script that will run for the passed job id. This is mostly for debugging so the output will just be text. CLI Example: .. code-block:: bash salt '*' at.atc <jobid>
[ "Print", "the", "at", "(", "1", ")", "script", "that", "will", "run", "for", "the", "passed", "job", "id", ".", "This", "is", "mostly", "for", "debugging", "so", "the", "output", "will", "just", "be", "text", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/at_solaris.py#L214-L235
train
saltstack/salt
salt/modules/ssh.py
_refine_enc
def _refine_enc(enc): ''' Return the properly formatted ssh value for the authorized encryption key type. ecdsa defaults to 256 bits, must give full ecdsa enc schema string if using higher enc. If the type is not found, raise CommandExecutionError. ''' rsa = ['r', 'rsa', 'ssh-rsa'] dss = ['...
python
def _refine_enc(enc): ''' Return the properly formatted ssh value for the authorized encryption key type. ecdsa defaults to 256 bits, must give full ecdsa enc schema string if using higher enc. If the type is not found, raise CommandExecutionError. ''' rsa = ['r', 'rsa', 'ssh-rsa'] dss = ['...
[ "def", "_refine_enc", "(", "enc", ")", ":", "rsa", "=", "[", "'r'", ",", "'rsa'", ",", "'ssh-rsa'", "]", "dss", "=", "[", "'d'", ",", "'dsa'", ",", "'dss'", ",", "'ssh-dss'", "]", "ecdsa", "=", "[", "'e'", ",", "'ecdsa'", ",", "'ecdsa-sha2-nistp521'"...
Return the properly formatted ssh value for the authorized encryption key type. ecdsa defaults to 256 bits, must give full ecdsa enc schema string if using higher enc. If the type is not found, raise CommandExecutionError.
[ "Return", "the", "properly", "formatted", "ssh", "value", "for", "the", "authorized", "encryption", "key", "type", ".", "ecdsa", "defaults", "to", "256", "bits", "must", "give", "full", "ecdsa", "enc", "schema", "string", "if", "using", "higher", "enc", ".",...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L52-L80
train
saltstack/salt
salt/modules/ssh.py
_format_auth_line
def _format_auth_line(key, enc, comment, options): ''' Properly format user input. ''' line = '' if options: line += '{0} '.format(','.join(options)) line += '{0} {1} {2}\n'.format(enc, key, comment) return line
python
def _format_auth_line(key, enc, comment, options): ''' Properly format user input. ''' line = '' if options: line += '{0} '.format(','.join(options)) line += '{0} {1} {2}\n'.format(enc, key, comment) return line
[ "def", "_format_auth_line", "(", "key", ",", "enc", ",", "comment", ",", "options", ")", ":", "line", "=", "''", "if", "options", ":", "line", "+=", "'{0} '", ".", "format", "(", "','", ".", "join", "(", "options", ")", ")", "line", "+=", "'{0} {1} {...
Properly format user input.
[ "Properly", "format", "user", "input", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L83-L91
train
saltstack/salt
salt/modules/ssh.py
_expand_authorized_keys_path
def _expand_authorized_keys_path(path, user, home): ''' Expand the AuthorizedKeysFile expression. Defined in man sshd_config(5) ''' converted_path = '' had_escape = False for char in path: if had_escape: had_escape = False if char == '%': converted...
python
def _expand_authorized_keys_path(path, user, home): ''' Expand the AuthorizedKeysFile expression. Defined in man sshd_config(5) ''' converted_path = '' had_escape = False for char in path: if had_escape: had_escape = False if char == '%': converted...
[ "def", "_expand_authorized_keys_path", "(", "path", ",", "user", ",", "home", ")", ":", "converted_path", "=", "''", "had_escape", "=", "False", "for", "char", "in", "path", ":", "if", "had_escape", ":", "had_escape", "=", "False", "if", "char", "==", "'%'...
Expand the AuthorizedKeysFile expression. Defined in man sshd_config(5)
[ "Expand", "the", "AuthorizedKeysFile", "expression", ".", "Defined", "in", "man", "sshd_config", "(", "5", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L94-L120
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
saltstack/salt
salt/modules/ssh.py
set_auth_key
def set_auth_key( user, key, enc='ssh-rsa', comment='', options=None, config='.ssh/authorized_keys', cache_keys=None, fingerprint_hash_type=None): ''' Add a key to the authorized_keys file. The "key" parameter must only be the string of text th...
python
def set_auth_key( user, key, enc='ssh-rsa', comment='', options=None, config='.ssh/authorized_keys', cache_keys=None, fingerprint_hash_type=None): ''' Add a key to the authorized_keys file. The "key" parameter must only be the string of text th...
[ "def", "set_auth_key", "(", "user", ",", "key", ",", "enc", "=", "'ssh-rsa'", ",", "comment", "=", "''", ",", "options", "=", "None", ",", "config", "=", "'.ssh/authorized_keys'", ",", "cache_keys", "=", "None", ",", "fingerprint_hash_type", "=", "None", "...
Add a key to the authorized_keys file. The "key" parameter must only be the string of text that is the encoded key. If the key begins with "ssh-rsa" or ends with user@host, remove those from the key before passing it to this function. CLI Example: .. code-block:: bash salt '*' ssh.set_aut...
[ "Add", "a", "key", "to", "the", "authorized_keys", "file", ".", "The", "key", "parameter", "must", "only", "be", "the", "string", "of", "text", "that", "is", "the", "encoded", "key", ".", "If", "the", "key", "begins", "with", "ssh", "-", "rsa", "or", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L692-L796
train
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
train
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
train
saltstack/salt
salt/modules/ssh.py
get_known_host_entries
def get_known_host_entries(user, hostname, config=None, port=None, fingerprint_hash_type=None): ''' .. versionadded:: 2018.3.0 Return information about known host entries from the configfile, if any....
python
def get_known_host_entries(user, hostname, config=None, port=None, fingerprint_hash_type=None): ''' .. versionadded:: 2018.3.0 Return information about known host entries from the configfile, if any....
[ "def", "get_known_host_entries", "(", "user", ",", "hostname", ",", "config", "=", "None", ",", "port", "=", "None", ",", "fingerprint_hash_type", "=", "None", ")", ":", "full", "=", "_get_known_hosts_file", "(", "config", "=", "config", ",", "user", "=", ...
.. versionadded:: 2018.3.0 Return information about known host entries from the configfile, if any. If there are no entries for a matching hostname, return None. CLI Example: .. code-block:: bash salt '*' ssh.get_known_host_entries <user> <hostname>
[ "..", "versionadded", "::", "2018", ".", "3", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L842-L873
train
saltstack/salt
salt/modules/ssh.py
recv_known_host_entries
def recv_known_host_entries(hostname, enc=None, port=None, hash_known_hosts=True, timeout=5, fingerprint_hash_type=None): ''' .. versionadded:: 2018.3.0 Retrieve infor...
python
def recv_known_host_entries(hostname, enc=None, port=None, hash_known_hosts=True, timeout=5, fingerprint_hash_type=None): ''' .. versionadded:: 2018.3.0 Retrieve infor...
[ "def", "recv_known_host_entries", "(", "hostname", ",", "enc", "=", "None", ",", "port", "=", "None", ",", "hash_known_hosts", "=", "True", ",", "timeout", "=", "5", ",", "fingerprint_hash_type", "=", "None", ")", ":", "# The following list of OSes have an old ver...
.. versionadded:: 2018.3.0 Retrieve information about host public keys from remote server hostname The name of the remote host (e.g. "github.com") enc Defines what type of key is being used, can be ed25519, ecdsa ssh-rsa or ssh-dss port Optional parameter, denoting th...
[ "..", "versionadded", "::", "2018", ".", "3", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L877-L963
train
saltstack/salt
salt/modules/ssh.py
check_known_host
def check_known_host(user=None, hostname=None, key=None, fingerprint=None, config=None, port=None, fingerprint_hash_type=None): ''' Check the record in known_hosts file, either by its value or by fingerprint (it's enough to set up either key or fingerprint, you don't need to set up ...
python
def check_known_host(user=None, hostname=None, key=None, fingerprint=None, config=None, port=None, fingerprint_hash_type=None): ''' Check the record in known_hosts file, either by its value or by fingerprint (it's enough to set up either key or fingerprint, you don't need to set up ...
[ "def", "check_known_host", "(", "user", "=", "None", ",", "hostname", "=", "None", ",", "key", "=", "None", ",", "fingerprint", "=", "None", ",", "config", "=", "None", ",", "port", "=", "None", ",", "fingerprint_hash_type", "=", "None", ")", ":", "if"...
Check the record in known_hosts file, either by its value or by fingerprint (it's enough to set up either key or fingerprint, you don't need to set up both). If provided key or fingerprint doesn't match with stored value, return "update", if no value is found for a given host, return "add", otherwise ...
[ "Check", "the", "record", "in", "known_hosts", "file", "either", "by", "its", "value", "or", "by", "fingerprint", "(", "it", "s", "enough", "to", "set", "up", "either", "key", "or", "fingerprint", "you", "don", "t", "need", "to", "set", "up", "both", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L966-L1010
train
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
train
saltstack/salt
salt/modules/ssh.py
set_known_host
def set_known_host(user=None, hostname=None, fingerprint=None, key=None, port=None, enc=None, config=None, hash_known_hosts=True, timeout=5, fingerpr...
python
def set_known_host(user=None, hostname=None, fingerprint=None, key=None, port=None, enc=None, config=None, hash_known_hosts=True, timeout=5, fingerpr...
[ "def", "set_known_host", "(", "user", "=", "None", ",", "hostname", "=", "None", ",", "fingerprint", "=", "None", ",", "key", "=", "None", ",", "port", "=", "None", ",", "enc", "=", "None", ",", "config", "=", "None", ",", "hash_known_hosts", "=", "T...
Download SSH public key from remote host "hostname", optionally validate its fingerprint against "fingerprint" variable and save the record in the known_hosts file. If such a record does already exists in there, do nothing. user The user who owns the ssh authorized keys file to modify hos...
[ "Download", "SSH", "public", "key", "from", "remote", "host", "hostname", "optionally", "validate", "its", "fingerprint", "against", "fingerprint", "variable", "and", "save", "the", "record", "in", "the", "known_hosts", "file", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L1047-L1260
train
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
train
saltstack/salt
salt/utils/boto3mod.py
get_connection
def get_connection(service, module=None, region=None, key=None, keyid=None, profile=None): ''' Return a boto connection for the service. .. code-block:: python conn = __utils__['boto.get_connection']('ec2', profile='custom_profile') ''' module = module or service c...
python
def get_connection(service, module=None, region=None, key=None, keyid=None, profile=None): ''' Return a boto connection for the service. .. code-block:: python conn = __utils__['boto.get_connection']('ec2', profile='custom_profile') ''' module = module or service c...
[ "def", "get_connection", "(", "service", ",", "module", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "module", "=", "module", "or", "service", "cxkey", ",", "regio...
Return a boto connection for the service. .. code-block:: python conn = __utils__['boto.get_connection']('ec2', profile='custom_profile')
[ "Return", "a", "boto", "connection", "for", "the", "service", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/boto3mod.py#L181-L216
train
saltstack/salt
salt/utils/boto3mod.py
get_region
def get_region(service, region, profile): """ Retrieve the region for a particular AWS service based on configured region and/or profile. """ _, region, _, _ = _get_profile(service, region, None, None, profile) return region
python
def get_region(service, region, profile): """ Retrieve the region for a particular AWS service based on configured region and/or profile. """ _, region, _, _ = _get_profile(service, region, None, None, profile) return region
[ "def", "get_region", "(", "service", ",", "region", ",", "profile", ")", ":", "_", ",", "region", ",", "_", ",", "_", "=", "_get_profile", "(", "service", ",", "region", ",", "None", ",", "None", ",", "profile", ")", "return", "region" ]
Retrieve the region for a particular AWS service based on configured region and/or profile.
[ "Retrieve", "the", "region", "for", "a", "particular", "AWS", "service", "based", "on", "configured", "region", "and", "/", "or", "profile", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/boto3mod.py#L231-L237
train
saltstack/salt
salt/utils/boto3mod.py
assign_funcs
def assign_funcs(modname, service, module=None, get_conn_funcname='_get_conn', cache_id_funcname='_cache_id', exactly_one_funcname='_exactly_one'): ''' Assign _get_conn and _cache_id functions to the named module. .. code-block:: python _utils__['boto.assign_partial...
python
def assign_funcs(modname, service, module=None, get_conn_funcname='_get_conn', cache_id_funcname='_cache_id', exactly_one_funcname='_exactly_one'): ''' Assign _get_conn and _cache_id functions to the named module. .. code-block:: python _utils__['boto.assign_partial...
[ "def", "assign_funcs", "(", "modname", ",", "service", ",", "module", "=", "None", ",", "get_conn_funcname", "=", "'_get_conn'", ",", "cache_id_funcname", "=", "'_cache_id'", ",", "exactly_one_funcname", "=", "'_exactly_one'", ")", ":", "mod", "=", "sys", ".", ...
Assign _get_conn and _cache_id functions to the named module. .. code-block:: python _utils__['boto.assign_partials'](__name__, 'ec2')
[ "Assign", "_get_conn", "and", "_cache_id", "functions", "to", "the", "named", "module", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/boto3mod.py#L284-L301
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
saltstack/salt
salt/output/table_out.py
TableDisplay.display
def display(self, ret, indent, out, rows_key=None, labels_key=None): '''Display table(s).''' rows = [] labels = None if isinstance(ret, dict): if not rows_key or (rows_key and rows_key in list(...
python
def display(self, ret, indent, out, rows_key=None, labels_key=None): '''Display table(s).''' rows = [] labels = None if isinstance(ret, dict): if not rows_key or (rows_key and rows_key in list(...
[ "def", "display", "(", "self", ",", "ret", ",", "indent", ",", "out", ",", "rows_key", "=", "None", ",", "labels_key", "=", "None", ")", ":", "rows", "=", "[", "]", "labels", "=", "None", "if", "isinstance", "(", "ret", ",", "dict", ")", ":", "if...
Display table(s).
[ "Display", "table", "(", "s", ")", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/table_out.py#L252-L306
train
saltstack/salt
salt/states/zfs.py
_absent
def _absent(name, dataset_type, force=False, recursive=False, recursive_all=False): ''' internal shared function for *_absent name : string name of dataset dataset_type : string [filesystem, volume, snapshot, or bookmark] type of dataset to remove force : boolean try harder ...
python
def _absent(name, dataset_type, force=False, recursive=False, recursive_all=False): ''' internal shared function for *_absent name : string name of dataset dataset_type : string [filesystem, volume, snapshot, or bookmark] type of dataset to remove force : boolean try harder ...
[ "def", "_absent", "(", "name", ",", "dataset_type", ",", "force", "=", "False", ",", "recursive", "=", "False", ",", "recursive_all", "=", "False", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":...
internal shared function for *_absent name : string name of dataset dataset_type : string [filesystem, volume, snapshot, or bookmark] type of dataset to remove force : boolean try harder to destroy the dataset recursive : boolean also destroy all the child datasets r...
[ "internal", "shared", "function", "for", "*", "_absent" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zfs.py#L77-L135
train
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
train
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
train
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
train
saltstack/salt
salt/states/zfs.py
_dataset_present
def _dataset_present(dataset_type, name, volume_size=None, sparse=False, create_parent=False, properties=None, cloned_from=None): ''' internal handler for filesystem_present/volume_present dataset_type : string volume or filesystem name : string name of volume volume_size : string ...
python
def _dataset_present(dataset_type, name, volume_size=None, sparse=False, create_parent=False, properties=None, cloned_from=None): ''' internal handler for filesystem_present/volume_present dataset_type : string volume or filesystem name : string name of volume volume_size : string ...
[ "def", "_dataset_present", "(", "dataset_type", ",", "name", ",", "volume_size", "=", "None", ",", "sparse", "=", "False", ",", "create_parent", "=", "False", ",", "properties", "=", "None", ",", "cloned_from", "=", "None", ")", ":", "ret", "=", "{", "'n...
internal handler for filesystem_present/volume_present dataset_type : string volume or filesystem name : string name of volume volume_size : string size of volume sparse : boolean create sparse volume create_parent : boolean creates all the non-existing paren...
[ "internal", "handler", "for", "filesystem_present", "/", "volume_present" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zfs.py#L382-L557
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
saltstack/salt
salt/states/zfs.py
scheduled_snapshot
def scheduled_snapshot(name, prefix, recursive=True, schedule=None): ''' maintain a set of snapshots based on a schedule name : string name of filesystem or volume prefix : string prefix for the snapshots e.g. 'test' will result in snapshots being named 'test-yyyymmdd_hhmm' ...
python
def scheduled_snapshot(name, prefix, recursive=True, schedule=None): ''' maintain a set of snapshots based on a schedule name : string name of filesystem or volume prefix : string prefix for the snapshots e.g. 'test' will result in snapshots being named 'test-yyyymmdd_hhmm' ...
[ "def", "scheduled_snapshot", "(", "name", ",", "prefix", ",", "recursive", "=", "True", ",", "schedule", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", "...
maintain a set of snapshots based on a schedule name : string name of filesystem or volume prefix : string prefix for the snapshots e.g. 'test' will result in snapshots being named 'test-yyyymmdd_hhmm' recursive : boolean create snapshots for all children also schedule :...
[ "maintain", "a", "set", "of", "snapshots", "based", "on", "a", "schedule" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zfs.py#L909-L1085
train
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
train
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
train
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
train
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
train
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
train
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
train
saltstack/salt
salt/modules/win_dacl.py
_set_dacl_inheritance
def _set_dacl_inheritance(path, objectType, inheritance=True, copy=True, clear=False): ''' helper function to set the inheritance Args: path (str): The path to the object objectType (str): The type of object inheritance (bool): True enables inheritance, False disables cop...
python
def _set_dacl_inheritance(path, objectType, inheritance=True, copy=True, clear=False): ''' helper function to set the inheritance Args: path (str): The path to the object objectType (str): The type of object inheritance (bool): True enables inheritance, False disables cop...
[ "def", "_set_dacl_inheritance", "(", "path", ",", "objectType", ",", "inheritance", "=", "True", ",", "copy", "=", "True", ",", "clear", "=", "False", ")", ":", "ret", "=", "{", "'result'", ":", "False", ",", "'comment'", ":", "''", ",", "'changes'", "...
helper function to set the inheritance Args: path (str): The path to the object objectType (str): The type of object inheritance (bool): True enables inheritance, False disables copy (bool): Copy inherited ACEs to the DACL before disabling inheritance clear (bool...
[ "helper", "function", "to", "set", "the", "inheritance", "Args", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dacl.py#L581-L650
train
saltstack/salt
salt/modules/win_dacl.py
enable_inheritance
def enable_inheritance(path, objectType, clear=False): ''' enable/disable inheritance on an object Args: path: The path to the object objectType: The type of object (FILE, DIRECTORY, REGISTRY) clear: True will remove non-Inherited ACEs from the ACL Returns (dict): A dictionary ...
python
def enable_inheritance(path, objectType, clear=False): ''' enable/disable inheritance on an object Args: path: The path to the object objectType: The type of object (FILE, DIRECTORY, REGISTRY) clear: True will remove non-Inherited ACEs from the ACL Returns (dict): A dictionary ...
[ "def", "enable_inheritance", "(", "path", ",", "objectType", ",", "clear", "=", "False", ")", ":", "dc", "=", "daclConstants", "(", ")", "objectType", "=", "dc", ".", "getObjectTypeBit", "(", "objectType", ")", "path", "=", "dc", ".", "processPath", "(", ...
enable/disable inheritance on an object Args: path: The path to the object objectType: The type of object (FILE, DIRECTORY, REGISTRY) clear: True will remove non-Inherited ACEs from the ACL Returns (dict): A dictionary containing the results CLI Example: .. code-block:: bash ...
[ "enable", "/", "disable", "inheritance", "on", "an", "object" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dacl.py#L653-L674
train
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
train
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
train
saltstack/salt
salt/modules/win_dacl.py
check_ace
def check_ace(path, objectType, user, permission=None, acetype=None, propagation=None, exactPermissionMatch=False): ''' Checks a path to verify the ACE (access control entry) specified exists Args: path: path to the file/reg key objectType: The type of object (FILE, DIRECTORY, REGISTRY) ...
python
def check_ace(path, objectType, user, permission=None, acetype=None, propagation=None, exactPermissionMatch=False): ''' Checks a path to verify the ACE (access control entry) specified exists Args: path: path to the file/reg key objectType: The type of object (FILE, DIRECTORY, REGISTRY) ...
[ "def", "check_ace", "(", "path", ",", "objectType", ",", "user", ",", "permission", "=", "None", ",", "acetype", "=", "None", ",", "propagation", "=", "None", ",", "exactPermissionMatch", "=", "False", ")", ":", "ret", "=", "{", "'result'", ":", "False",...
Checks a path to verify the ACE (access control entry) specified exists Args: path: path to the file/reg key objectType: The type of object (FILE, DIRECTORY, REGISTRY) user: user that the ACL is for permission: permission to test for (READ, FULLCONTROL, etc) acetype: the...
[ "Checks", "a", "path", "to", "verify", "the", "ACE", "(", "access", "control", "entry", ")", "specified", "exists" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dacl.py#L748-L810
train
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
train
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
train
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
train
saltstack/salt
salt/modules/win_dacl.py
daclConstants.getPermissionText
def getPermissionText(self, t, m): ''' returns the permission textual representation of a specified permission bit/object type ''' try: return self.rights[t][m]['TEXT'] except KeyError: raise CommandExecutionError(( 'No right "{0}". It sho...
python
def getPermissionText(self, t, m): ''' returns the permission textual representation of a specified permission bit/object type ''' try: return self.rights[t][m]['TEXT'] except KeyError: raise CommandExecutionError(( 'No right "{0}". It sho...
[ "def", "getPermissionText", "(", "self", ",", "t", ",", "m", ")", ":", "try", ":", "return", "self", ".", "rights", "[", "t", "]", "[", "m", "]", "[", "'TEXT'", "]", "except", "KeyError", ":", "raise", "CommandExecutionError", "(", "(", "'No right \"{0...
returns the permission textual representation of a specified permission bit/object type
[ "returns", "the", "permission", "textual", "representation", "of", "a", "specified", "permission", "bit", "/", "object", "type" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dacl.py#L233-L242
train
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
train
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
train
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
train
saltstack/salt
salt/modules/win_dacl.py
daclConstants.processPath
def processPath(self, path, objectType): ''' processes a path/object type combo and returns: registry types with the correct HKEY text representation files/directories with environment variables expanded ''' if objectType == win32security.SE_REGISTRY_KEY: ...
python
def processPath(self, path, objectType): ''' processes a path/object type combo and returns: registry types with the correct HKEY text representation files/directories with environment variables expanded ''' if objectType == win32security.SE_REGISTRY_KEY: ...
[ "def", "processPath", "(", "self", ",", "path", ",", "objectType", ")", ":", "if", "objectType", "==", "win32security", ".", "SE_REGISTRY_KEY", ":", "splt", "=", "path", ".", "split", "(", "\"\\\\\"", ")", "hive", "=", "self", ".", "getSecurityHkey", "(", ...
processes a path/object type combo and returns: registry types with the correct HKEY text representation files/directories with environment variables expanded
[ "processes", "a", "path", "/", "object", "type", "combo", "and", "returns", ":", "registry", "types", "with", "the", "correct", "HKEY", "text", "representation", "files", "/", "directories", "with", "environment", "variables", "expanded" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dacl.py#L288-L301
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train