id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
34,300
saltstack/salt
salt/modules/bcache.py
attach_
def attach_(dev=None): ''' Attach a backing devices to a cache set If no dev is given, all backing devices will be attached. CLI example: .. code-block:: bash salt '*' bcache.attach sdc salt '*' bcache.attach /dev/bcache1 :return: bool or None if nuttin' happened ''' ...
python
def attach_(dev=None): ''' Attach a backing devices to a cache set If no dev is given, all backing devices will be attached. CLI example: .. code-block:: bash salt '*' bcache.attach sdc salt '*' bcache.attach /dev/bcache1 :return: bool or None if nuttin' happened ''' ...
[ "def", "attach_", "(", "dev", "=", "None", ")", ":", "cache", "=", "uuid", "(", ")", "if", "not", "cache", ":", "log", ".", "error", "(", "'No cache to attach %s to'", ",", "dev", ")", "return", "False", "if", "dev", "is", "None", ":", "res", "=", ...
Attach a backing devices to a cache set If no dev is given, all backing devices will be attached. CLI example: .. code-block:: bash salt '*' bcache.attach sdc salt '*' bcache.attach /dev/bcache1 :return: bool or None if nuttin' happened
[ "Attach", "a", "backing", "devices", "to", "a", "cache", "set", "If", "no", "dev", "is", "given", "all", "backing", "devices", "will", "be", "attached", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L82-L125
34,301
saltstack/salt
salt/modules/bcache.py
stop
def stop(dev=None): ''' Stop a bcache device If no device is given, all backing devices will be detached from the cache, which will subsequently be stopped. .. warning:: 'Stop' on an individual backing device means hard-stop; no attempt at flushing will be done and the bcache device wil...
python
def stop(dev=None): ''' Stop a bcache device If no device is given, all backing devices will be detached from the cache, which will subsequently be stopped. .. warning:: 'Stop' on an individual backing device means hard-stop; no attempt at flushing will be done and the bcache device wil...
[ "def", "stop", "(", "dev", "=", "None", ")", ":", "if", "dev", "is", "not", "None", ":", "log", ".", "warning", "(", "'Stopping %s, device will only reappear after reregistering!'", ",", "dev", ")", "if", "not", "_bcsys", "(", "dev", ",", "'stop'", ",", "'...
Stop a bcache device If no device is given, all backing devices will be detached from the cache, which will subsequently be stopped. .. warning:: 'Stop' on an individual backing device means hard-stop; no attempt at flushing will be done and the bcache device will seemingly 'disappear' from the...
[ "Stop", "a", "bcache", "device", "If", "no", "device", "is", "given", "all", "backing", "devices", "will", "be", "detached", "from", "the", "cache", "which", "will", "subsequently", "be", "stopped", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L176-L208
34,302
saltstack/salt
salt/modules/bcache.py
back_make
def back_make(dev, cache_mode='writeback', force=False, attach=True, bucket_size=None): ''' Create a backing device for attachment to a set. Because the block size must be the same, a cache set already needs to exist. CLI example: .. code-block:: bash salt '*' bcache.back_make sdc cache_m...
python
def back_make(dev, cache_mode='writeback', force=False, attach=True, bucket_size=None): ''' Create a backing device for attachment to a set. Because the block size must be the same, a cache set already needs to exist. CLI example: .. code-block:: bash salt '*' bcache.back_make sdc cache_m...
[ "def", "back_make", "(", "dev", ",", "cache_mode", "=", "'writeback'", ",", "force", "=", "False", ",", "attach", "=", "True", ",", "bucket_size", "=", "None", ")", ":", "# pylint: disable=too-many-return-statements", "cache", "=", "uuid", "(", ")", "if", "n...
Create a backing device for attachment to a set. Because the block size must be the same, a cache set already needs to exist. CLI example: .. code-block:: bash salt '*' bcache.back_make sdc cache_mode=writeback attach=True :param cache_mode: writethrough, writeback, writearound or none. ...
[ "Create", "a", "backing", "device", "for", "attachment", "to", "a", "set", ".", "Because", "the", "block", "size", "must", "be", "the", "same", "a", "cache", "set", "already", "needs", "to", "exist", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L211-L264
34,303
saltstack/salt
salt/modules/bcache.py
cache_make
def cache_make(dev, reserved=None, force=False, block_size=None, bucket_size=None, attach=True): ''' Create BCache cache on a block device. If blkdiscard is available the entire device will be properly cleared in advance. CLI example: .. code-block:: bash salt '*' bcache.cache_make sdb re...
python
def cache_make(dev, reserved=None, force=False, block_size=None, bucket_size=None, attach=True): ''' Create BCache cache on a block device. If blkdiscard is available the entire device will be properly cleared in advance. CLI example: .. code-block:: bash salt '*' bcache.cache_make sdb re...
[ "def", "cache_make", "(", "dev", ",", "reserved", "=", "None", ",", "force", "=", "False", ",", "block_size", "=", "None", ",", "bucket_size", "=", "None", ",", "attach", "=", "True", ")", ":", "# TODO: multiple devs == md jbod", "# pylint: disable=too-many-retu...
Create BCache cache on a block device. If blkdiscard is available the entire device will be properly cleared in advance. CLI example: .. code-block:: bash salt '*' bcache.cache_make sdb reserved=10% block_size=4096 :param reserved: if dev is a full device, create a partition table with this...
[ "Create", "BCache", "cache", "on", "a", "block", "device", ".", "If", "blkdiscard", "is", "available", "the", "entire", "device", "will", "be", "properly", "cleared", "in", "advance", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L267-L357
34,304
saltstack/salt
salt/modules/bcache.py
config_
def config_(dev=None, **kwargs): ''' Show or update config of a bcache device. If no device is given, operate on the cache set itself. CLI example: .. code-block:: bash salt '*' bcache.config salt '*' bcache.config bcache1 salt '*' bcache.config errors=panic journal_delay...
python
def config_(dev=None, **kwargs): ''' Show or update config of a bcache device. If no device is given, operate on the cache set itself. CLI example: .. code-block:: bash salt '*' bcache.config salt '*' bcache.config bcache1 salt '*' bcache.config errors=panic journal_delay...
[ "def", "config_", "(", "dev", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "dev", "is", "None", ":", "spath", "=", "_fspath", "(", ")", "else", ":", "spath", "=", "_bcpath", "(", "dev", ")", "# filter out 'hidden' kwargs added by our favourite orc...
Show or update config of a bcache device. If no device is given, operate on the cache set itself. CLI example: .. code-block:: bash salt '*' bcache.config salt '*' bcache.config bcache1 salt '*' bcache.config errors=panic journal_delay_ms=150 salt '*' bcache.config bcache...
[ "Show", "or", "update", "config", "of", "a", "bcache", "device", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L360-L401
34,305
saltstack/salt
salt/modules/bcache.py
status
def status(stats=False, config=False, internals=False, superblock=False, alldevs=False): ''' Show the full status of the BCache system and optionally all it's involved devices CLI example: .. code-block:: bash salt '*' bcache.status salt '*' bcache.status stats=True salt '*' b...
python
def status(stats=False, config=False, internals=False, superblock=False, alldevs=False): ''' Show the full status of the BCache system and optionally all it's involved devices CLI example: .. code-block:: bash salt '*' bcache.status salt '*' bcache.status stats=True salt '*' b...
[ "def", "status", "(", "stats", "=", "False", ",", "config", "=", "False", ",", "internals", "=", "False", ",", "superblock", "=", "False", ",", "alldevs", "=", "False", ")", ":", "bdevs", "=", "[", "]", "for", "_", ",", "links", ",", "_", "in", "...
Show the full status of the BCache system and optionally all it's involved devices CLI example: .. code-block:: bash salt '*' bcache.status salt '*' bcache.status stats=True salt '*' bcache.status internals=True alldevs=True :param stats: include statistics :param config: inc...
[ "Show", "the", "full", "status", "of", "the", "BCache", "system", "and", "optionally", "all", "it", "s", "involved", "devices" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L404-L448
34,306
saltstack/salt
salt/modules/bcache.py
super_
def super_(dev): ''' Read out BCache SuperBlock CLI example: .. code-block:: bash salt '*' bcache.device bcache0 salt '*' bcache.device /dev/sdc ''' dev = _devpath(dev) ret = {} res = _run_all('bcache-super-show {0}'.format(dev), 'error', 'Error reading superblock on...
python
def super_(dev): ''' Read out BCache SuperBlock CLI example: .. code-block:: bash salt '*' bcache.device bcache0 salt '*' bcache.device /dev/sdc ''' dev = _devpath(dev) ret = {} res = _run_all('bcache-super-show {0}'.format(dev), 'error', 'Error reading superblock on...
[ "def", "super_", "(", "dev", ")", ":", "dev", "=", "_devpath", "(", "dev", ")", "ret", "=", "{", "}", "res", "=", "_run_all", "(", "'bcache-super-show {0}'", ".", "format", "(", "dev", ")", ",", "'error'", ",", "'Error reading superblock on {0}: %s'", ".",...
Read out BCache SuperBlock CLI example: .. code-block:: bash salt '*' bcache.device bcache0 salt '*' bcache.device /dev/sdc
[ "Read", "out", "BCache", "SuperBlock" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L564-L619
34,307
saltstack/salt
salt/modules/bcache.py
_devbase
def _devbase(dev): ''' Basename of just about any dev ''' dev = os.path.realpath(os.path.expandvars(dev)) dev = os.path.basename(dev) return dev
python
def _devbase(dev): ''' Basename of just about any dev ''' dev = os.path.realpath(os.path.expandvars(dev)) dev = os.path.basename(dev) return dev
[ "def", "_devbase", "(", "dev", ")", ":", "dev", "=", "os", ".", "path", ".", "realpath", "(", "os", ".", "path", ".", "expandvars", "(", "dev", ")", ")", "dev", "=", "os", ".", "path", ".", "basename", "(", "dev", ")", "return", "dev" ]
Basename of just about any dev
[ "Basename", "of", "just", "about", "any", "dev" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L624-L630
34,308
saltstack/salt
salt/modules/bcache.py
_syspath
def _syspath(dev): ''' Full SysFS path of a device ''' dev = _devbase(dev) dev = re.sub(r'^([vhs][a-z]+)([0-9]+)', r'\1/\1\2', dev) # name = re.sub(r'^([a-z]+)(?<!(bcache|md|dm))([0-9]+)', r'\1/\1\2', name) return os.path.join('/sys/block/', dev)
python
def _syspath(dev): ''' Full SysFS path of a device ''' dev = _devbase(dev) dev = re.sub(r'^([vhs][a-z]+)([0-9]+)', r'\1/\1\2', dev) # name = re.sub(r'^([a-z]+)(?<!(bcache|md|dm))([0-9]+)', r'\1/\1\2', name) return os.path.join('/sys/block/', dev)
[ "def", "_syspath", "(", "dev", ")", ":", "dev", "=", "_devbase", "(", "dev", ")", "dev", "=", "re", ".", "sub", "(", "r'^([vhs][a-z]+)([0-9]+)'", ",", "r'\\1/\\1\\2'", ",", "dev", ")", "# name = re.sub(r'^([a-z]+)(?<!(bcache|md|dm))([0-9]+)', r'\\1/\\1\\2', name)", ...
Full SysFS path of a device
[ "Full", "SysFS", "path", "of", "a", "device" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L641-L649
34,309
saltstack/salt
salt/modules/bcache.py
_fssys
def _fssys(name, value=None, log_lvl=None, log_msg=None): ''' Simple wrapper to interface with bcache SysFS ''' fspath = _fspath() if not fspath: return False else: return _sysfs_attr([fspath, name], value, log_lvl, log_msg)
python
def _fssys(name, value=None, log_lvl=None, log_msg=None): ''' Simple wrapper to interface with bcache SysFS ''' fspath = _fspath() if not fspath: return False else: return _sysfs_attr([fspath, name], value, log_lvl, log_msg)
[ "def", "_fssys", "(", "name", ",", "value", "=", "None", ",", "log_lvl", "=", "None", ",", "log_msg", "=", "None", ")", ":", "fspath", "=", "_fspath", "(", ")", "if", "not", "fspath", ":", "return", "False", "else", ":", "return", "_sysfs_attr", "(",...
Simple wrapper to interface with bcache SysFS
[ "Simple", "wrapper", "to", "interface", "with", "bcache", "SysFS" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L686-L694
34,310
saltstack/salt
salt/modules/bcache.py
_bcsys
def _bcsys(dev, name, value=None, log_lvl=None, log_msg=None): ''' Simple wrapper to interface with backing devs SysFS ''' return _sysfs_attr([_bcpath(dev), name], value, log_lvl, log_msg)
python
def _bcsys(dev, name, value=None, log_lvl=None, log_msg=None): ''' Simple wrapper to interface with backing devs SysFS ''' return _sysfs_attr([_bcpath(dev), name], value, log_lvl, log_msg)
[ "def", "_bcsys", "(", "dev", ",", "name", ",", "value", "=", "None", ",", "log_lvl", "=", "None", ",", "log_msg", "=", "None", ")", ":", "return", "_sysfs_attr", "(", "[", "_bcpath", "(", "dev", ")", ",", "name", "]", ",", "value", ",", "log_lvl", ...
Simple wrapper to interface with backing devs SysFS
[ "Simple", "wrapper", "to", "interface", "with", "backing", "devs", "SysFS" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L697-L701
34,311
saltstack/salt
salt/modules/bcache.py
_sysfs_attr
def _sysfs_attr(name, value=None, log_lvl=None, log_msg=None): ''' Simple wrapper with logging around sysfs.attr ''' if isinstance(name, six.string_types): name = [name] res = __salt__['sysfs.attr'](os.path.join(*name), value) if not res and log_lvl is not None and log_msg is not None: ...
python
def _sysfs_attr(name, value=None, log_lvl=None, log_msg=None): ''' Simple wrapper with logging around sysfs.attr ''' if isinstance(name, six.string_types): name = [name] res = __salt__['sysfs.attr'](os.path.join(*name), value) if not res and log_lvl is not None and log_msg is not None: ...
[ "def", "_sysfs_attr", "(", "name", ",", "value", "=", "None", ",", "log_lvl", "=", "None", ",", "log_msg", "=", "None", ")", ":", "if", "isinstance", "(", "name", ",", "six", ".", "string_types", ")", ":", "name", "=", "[", "name", "]", "res", "=",...
Simple wrapper with logging around sysfs.attr
[ "Simple", "wrapper", "with", "logging", "around", "sysfs", ".", "attr" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L704-L713
34,312
saltstack/salt
salt/modules/bcache.py
_size_map
def _size_map(size): ''' Map Bcache's size strings to real bytes ''' try: # I know, I know, EAFP. # But everything else is reason for None if not isinstance(size, int): if re.search(r'[Kk]', size): size = 1024 * float(re.sub(r'[Kk]', '', size)) ...
python
def _size_map(size): ''' Map Bcache's size strings to real bytes ''' try: # I know, I know, EAFP. # But everything else is reason for None if not isinstance(size, int): if re.search(r'[Kk]', size): size = 1024 * float(re.sub(r'[Kk]', '', size)) ...
[ "def", "_size_map", "(", "size", ")", ":", "try", ":", "# I know, I know, EAFP.", "# But everything else is reason for None", "if", "not", "isinstance", "(", "size", ",", "int", ")", ":", "if", "re", ".", "search", "(", "r'[Kk]'", ",", "size", ")", ":", "siz...
Map Bcache's size strings to real bytes
[ "Map", "Bcache", "s", "size", "strings", "to", "real", "bytes" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L829-L844
34,313
saltstack/salt
salt/modules/bcache.py
_wipe
def _wipe(dev): ''' REALLY DESTRUCTIVE STUFF RIGHT AHEAD ''' endres = 0 dev = _devbase(dev) size, block, discard = _sizes(dev) if discard is None: log.error('Unable to read SysFS props for %s', dev) return None elif not discard: log.warning('%s seems unable to d...
python
def _wipe(dev): ''' REALLY DESTRUCTIVE STUFF RIGHT AHEAD ''' endres = 0 dev = _devbase(dev) size, block, discard = _sizes(dev) if discard is None: log.error('Unable to read SysFS props for %s', dev) return None elif not discard: log.warning('%s seems unable to d...
[ "def", "_wipe", "(", "dev", ")", ":", "endres", "=", "0", "dev", "=", "_devbase", "(", "dev", ")", "size", ",", "block", ",", "discard", "=", "_sizes", "(", "dev", ")", "if", "discard", "is", "None", ":", "log", ".", "error", "(", "'Unable to read ...
REALLY DESTRUCTIVE STUFF RIGHT AHEAD
[ "REALLY", "DESTRUCTIVE", "STUFF", "RIGHT", "AHEAD" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L881-L918
34,314
saltstack/salt
salt/modules/salt_version.py
_check_release_cmp
def _check_release_cmp(name): ''' Helper function to compare release codename versions to the minion's current Salt version. If release codename isn't found, the function returns None. Otherwise, it returns the results of the version comparison as documented by the ``versions_cmp`` function in ...
python
def _check_release_cmp(name): ''' Helper function to compare release codename versions to the minion's current Salt version. If release codename isn't found, the function returns None. Otherwise, it returns the results of the version comparison as documented by the ``versions_cmp`` function in ...
[ "def", "_check_release_cmp", "(", "name", ")", ":", "map_version", "=", "get_release_number", "(", "name", ")", "if", "map_version", "is", "None", ":", "log", ".", "info", "(", "'Release codename %s was not found.'", ",", "name", ")", "return", "None", "current_...
Helper function to compare release codename versions to the minion's current Salt version. If release codename isn't found, the function returns None. Otherwise, it returns the results of the version comparison as documented by the ``versions_cmp`` function in ``salt.utils.versions.py``.
[ "Helper", "function", "to", "compare", "release", "codename", "versions", "to", "the", "minion", "s", "current", "Salt", "version", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/salt_version.py#L151-L170
34,315
saltstack/salt
salt/modules/rbenv.py
install
def install(runas=None, path=None): ''' Install rbenv systemwide CLI Example: .. code-block:: bash salt '*' rbenv.install ''' path = path or _rbenv_path(runas) path = os.path.expanduser(path) return _install_rbenv(path, runas) and _install_ruby_build(path, runas)
python
def install(runas=None, path=None): ''' Install rbenv systemwide CLI Example: .. code-block:: bash salt '*' rbenv.install ''' path = path or _rbenv_path(runas) path = os.path.expanduser(path) return _install_rbenv(path, runas) and _install_ruby_build(path, runas)
[ "def", "install", "(", "runas", "=", "None", ",", "path", "=", "None", ")", ":", "path", "=", "path", "or", "_rbenv_path", "(", "runas", ")", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "return", "_install_rbenv", "(", "path"...
Install rbenv systemwide CLI Example: .. code-block:: bash salt '*' rbenv.install
[ "Install", "rbenv", "systemwide" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbenv.py#L159-L171
34,316
saltstack/salt
salt/modules/rbenv.py
update
def update(runas=None, path=None): ''' Updates the current versions of rbenv and ruby-build runas The user under which to run rbenv. If not specified, then rbenv will be run as the user under which Salt is running. CLI Example: .. code-block:: bash salt '*' rbenv.update ...
python
def update(runas=None, path=None): ''' Updates the current versions of rbenv and ruby-build runas The user under which to run rbenv. If not specified, then rbenv will be run as the user under which Salt is running. CLI Example: .. code-block:: bash salt '*' rbenv.update ...
[ "def", "update", "(", "runas", "=", "None", ",", "path", "=", "None", ")", ":", "path", "=", "path", "or", "_rbenv_path", "(", "runas", ")", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "return", "_update_rbenv", "(", "path", ...
Updates the current versions of rbenv and ruby-build runas The user under which to run rbenv. If not specified, then rbenv will be run as the user under which Salt is running. CLI Example: .. code-block:: bash salt '*' rbenv.update
[ "Updates", "the", "current", "versions", "of", "rbenv", "and", "ruby", "-", "build" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbenv.py#L174-L191
34,317
saltstack/salt
salt/modules/rbenv.py
uninstall_ruby
def uninstall_ruby(ruby, runas=None): ''' Uninstall a ruby implementation. ruby The version of ruby to uninstall. Should match one of the versions listed by :py:func:`rbenv.versions <salt.modules.rbenv.versions>`. runas The user under which to run rbenv. If not specified, then ...
python
def uninstall_ruby(ruby, runas=None): ''' Uninstall a ruby implementation. ruby The version of ruby to uninstall. Should match one of the versions listed by :py:func:`rbenv.versions <salt.modules.rbenv.versions>`. runas The user under which to run rbenv. If not specified, then ...
[ "def", "uninstall_ruby", "(", "ruby", ",", "runas", "=", "None", ")", ":", "ruby", "=", "re", ".", "sub", "(", "r'^ruby-'", ",", "''", ",", "ruby", ")", "_rbenv_exec", "(", "[", "'uninstall'", ",", "'--force'", ",", "ruby", "]", ",", "runas", "=", ...
Uninstall a ruby implementation. ruby The version of ruby to uninstall. Should match one of the versions listed by :py:func:`rbenv.versions <salt.modules.rbenv.versions>`. runas The user under which to run rbenv. If not specified, then rbenv will be run as the user under which ...
[ "Uninstall", "a", "ruby", "implementation", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbenv.py#L260-L280
34,318
saltstack/salt
salt/modules/rbenv.py
versions
def versions(runas=None): ''' List the installed versions of ruby CLI Example: .. code-block:: bash salt '*' rbenv.versions ''' ret = _rbenv_exec(['versions', '--bare'], runas=runas) return [] if ret is False else ret.splitlines()
python
def versions(runas=None): ''' List the installed versions of ruby CLI Example: .. code-block:: bash salt '*' rbenv.versions ''' ret = _rbenv_exec(['versions', '--bare'], runas=runas) return [] if ret is False else ret.splitlines()
[ "def", "versions", "(", "runas", "=", "None", ")", ":", "ret", "=", "_rbenv_exec", "(", "[", "'versions'", ",", "'--bare'", "]", ",", "runas", "=", "runas", ")", "return", "[", "]", "if", "ret", "is", "False", "else", "ret", ".", "splitlines", "(", ...
List the installed versions of ruby CLI Example: .. code-block:: bash salt '*' rbenv.versions
[ "List", "the", "installed", "versions", "of", "ruby" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbenv.py#L283-L294
34,319
saltstack/salt
salt/modules/rbenv.py
default
def default(ruby=None, runas=None): ''' Returns or sets the currently defined default ruby ruby The version to set as the default. Should match one of the versions listed by :py:func:`rbenv.versions <salt.modules.rbenv.versions>`. Leave blank to return the current default. CLI ...
python
def default(ruby=None, runas=None): ''' Returns or sets the currently defined default ruby ruby The version to set as the default. Should match one of the versions listed by :py:func:`rbenv.versions <salt.modules.rbenv.versions>`. Leave blank to return the current default. CLI ...
[ "def", "default", "(", "ruby", "=", "None", ",", "runas", "=", "None", ")", ":", "if", "ruby", ":", "_rbenv_exec", "(", "[", "'global'", ",", "ruby", "]", ",", "runas", "=", "runas", ")", "return", "True", "else", ":", "ret", "=", "_rbenv_exec", "(...
Returns or sets the currently defined default ruby ruby The version to set as the default. Should match one of the versions listed by :py:func:`rbenv.versions <salt.modules.rbenv.versions>`. Leave blank to return the current default. CLI Example: .. code-block:: bash salt...
[ "Returns", "or", "sets", "the", "currently", "defined", "default", "ruby" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbenv.py#L297-L318
34,320
saltstack/salt
salt/modules/rbenv.py
list_
def list_(runas=None): ''' List the installable versions of ruby runas The user under which to run rbenv. If not specified, then rbenv will be run as the user under which Salt is running. CLI Example: .. code-block:: bash salt '*' rbenv.list ''' ret = [] outpu...
python
def list_(runas=None): ''' List the installable versions of ruby runas The user under which to run rbenv. If not specified, then rbenv will be run as the user under which Salt is running. CLI Example: .. code-block:: bash salt '*' rbenv.list ''' ret = [] outpu...
[ "def", "list_", "(", "runas", "=", "None", ")", ":", "ret", "=", "[", "]", "output", "=", "_rbenv_exec", "(", "[", "'install'", ",", "'--list'", "]", ",", "runas", "=", "runas", ")", "if", "output", ":", "for", "line", "in", "output", ".", "splitli...
List the installable versions of ruby runas The user under which to run rbenv. If not specified, then rbenv will be run as the user under which Salt is running. CLI Example: .. code-block:: bash salt '*' rbenv.list
[ "List", "the", "installable", "versions", "of", "ruby" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbenv.py#L321-L342
34,321
saltstack/salt
salt/modules/rbenv.py
do
def do(cmdline, runas=None, env=None): ''' Execute a ruby command with rbenv's shims from the user or the system CLI Example: .. code-block:: bash salt '*' rbenv.do 'gem list bundler' salt '*' rbenv.do 'gem list bundler' deploy ''' if not cmdline: # This is a positiona...
python
def do(cmdline, runas=None, env=None): ''' Execute a ruby command with rbenv's shims from the user or the system CLI Example: .. code-block:: bash salt '*' rbenv.do 'gem list bundler' salt '*' rbenv.do 'gem list bundler' deploy ''' if not cmdline: # This is a positiona...
[ "def", "do", "(", "cmdline", ",", "runas", "=", "None", ",", "env", "=", "None", ")", ":", "if", "not", "cmdline", ":", "# This is a positional argument so this should never happen, but this", "# will handle cases where someone explicitly passes a false value for", "# cmdline...
Execute a ruby command with rbenv's shims from the user or the system CLI Example: .. code-block:: bash salt '*' rbenv.do 'gem list bundler' salt '*' rbenv.do 'gem list bundler' deploy
[ "Execute", "a", "ruby", "command", "with", "rbenv", "s", "shims", "from", "the", "user", "or", "the", "system" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbenv.py#L363-L410
34,322
saltstack/salt
salt/modules/rbenv.py
do_with_ruby
def do_with_ruby(ruby, cmdline, runas=None): ''' Execute a ruby command with rbenv's shims using a specific ruby version CLI Example: .. code-block:: bash salt '*' rbenv.do_with_ruby 2.0.0-p0 'gem list bundler' salt '*' rbenv.do_with_ruby 2.0.0-p0 'gem list bundler' runas=deploy '...
python
def do_with_ruby(ruby, cmdline, runas=None): ''' Execute a ruby command with rbenv's shims using a specific ruby version CLI Example: .. code-block:: bash salt '*' rbenv.do_with_ruby 2.0.0-p0 'gem list bundler' salt '*' rbenv.do_with_ruby 2.0.0-p0 'gem list bundler' runas=deploy '...
[ "def", "do_with_ruby", "(", "ruby", ",", "cmdline", ",", "runas", "=", "None", ")", ":", "if", "not", "cmdline", ":", "# This is a positional argument so this should never happen, but this", "# will handle cases where someone explicitly passes a false value for", "# cmdline.", ...
Execute a ruby command with rbenv's shims using a specific ruby version CLI Example: .. code-block:: bash salt '*' rbenv.do_with_ruby 2.0.0-p0 'gem list bundler' salt '*' rbenv.do_with_ruby 2.0.0-p0 'gem list bundler' runas=deploy
[ "Execute", "a", "ruby", "command", "with", "rbenv", "s", "shims", "using", "a", "specific", "ruby", "version" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbenv.py#L413-L442
34,323
saltstack/salt
salt/states/mac_assistive.py
installed
def installed(name, enabled=True): ''' Make sure that we have the given bundle ID or path to command installed in the assistive access panel. name The bundle ID or path to command enable Should assistive access be enabled on this application? ''' ret = {'name': name, ...
python
def installed(name, enabled=True): ''' Make sure that we have the given bundle ID or path to command installed in the assistive access panel. name The bundle ID or path to command enable Should assistive access be enabled on this application? ''' ret = {'name': name, ...
[ "def", "installed", "(", "name", ",", "enabled", "=", "True", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", "}", "is_installed", "=", "__salt__", "[", "...
Make sure that we have the given bundle ID or path to command installed in the assistive access panel. name The bundle ID or path to command enable Should assistive access be enabled on this application?
[ "Make", "sure", "that", "we", "have", "the", "given", "bundle", "ID", "or", "path", "to", "command", "installed", "in", "the", "assistive", "access", "panel", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mac_assistive.py#L38-L70
34,324
saltstack/salt
salt/states/service.py
_available
def _available(name, ret): ''' Check if the service is available ''' avail = False if 'service.available' in __salt__: avail = __salt__['service.available'](name) elif 'service.get_all' in __salt__: avail = name in __salt__['service.get_all']() if not avail: ret['resu...
python
def _available(name, ret): ''' Check if the service is available ''' avail = False if 'service.available' in __salt__: avail = __salt__['service.available'](name) elif 'service.get_all' in __salt__: avail = name in __salt__['service.get_all']() if not avail: ret['resu...
[ "def", "_available", "(", "name", ",", "ret", ")", ":", "avail", "=", "False", "if", "'service.available'", "in", "__salt__", ":", "avail", "=", "__salt__", "[", "'service.available'", "]", "(", "name", ")", "elif", "'service.get_all'", "in", "__salt__", ":"...
Check if the service is available
[ "Check", "if", "the", "service", "is", "available" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/service.py#L323-L335
34,325
saltstack/salt
salt/modules/cp.py
recv
def recv(files, dest): ''' Used with salt-cp, pass the files dict, and the destination. This function receives small fast copy files from the master via salt-cp. It does not work via the CLI. ''' ret = {} for path, data in six.iteritems(files): if os.path.basename(path) == os.path.b...
python
def recv(files, dest): ''' Used with salt-cp, pass the files dict, and the destination. This function receives small fast copy files from the master via salt-cp. It does not work via the CLI. ''' ret = {} for path, data in six.iteritems(files): if os.path.basename(path) == os.path.b...
[ "def", "recv", "(", "files", ",", "dest", ")", ":", "ret", "=", "{", "}", "for", "path", ",", "data", "in", "six", ".", "iteritems", "(", "files", ")", ":", "if", "os", ".", "path", ".", "basename", "(", "path", ")", "==", "os", ".", "path", ...
Used with salt-cp, pass the files dict, and the destination. This function receives small fast copy files from the master via salt-cp. It does not work via the CLI.
[ "Used", "with", "salt", "-", "cp", "pass", "the", "files", "dict", "and", "the", "destination", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L63-L89
34,326
saltstack/salt
salt/modules/cp.py
recv_chunked
def recv_chunked(dest, chunk, append=False, compressed=True, mode=None): ''' This function receives files copied to the minion using ``salt-cp`` and is not intended to be used directly on the CLI. ''' if 'retcode' not in __context__: __context__['retcode'] = 0 def _error(msg): _...
python
def recv_chunked(dest, chunk, append=False, compressed=True, mode=None): ''' This function receives files copied to the minion using ``salt-cp`` and is not intended to be used directly on the CLI. ''' if 'retcode' not in __context__: __context__['retcode'] = 0 def _error(msg): _...
[ "def", "recv_chunked", "(", "dest", ",", "chunk", ",", "append", "=", "False", ",", "compressed", "=", "True", ",", "mode", "=", "None", ")", ":", "if", "'retcode'", "not", "in", "__context__", ":", "__context__", "[", "'retcode'", "]", "=", "0", "def"...
This function receives files copied to the minion using ``salt-cp`` and is not intended to be used directly on the CLI.
[ "This", "function", "receives", "files", "copied", "to", "the", "minion", "using", "salt", "-", "cp", "and", "is", "not", "intended", "to", "be", "used", "directly", "on", "the", "CLI", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L92-L154
34,327
saltstack/salt
salt/modules/cp.py
_mk_client
def _mk_client(): ''' Create a file client and add it to the context. Each file client needs to correspond to a unique copy of the opts dictionary, therefore it's hashed by the id of the __opts__ dict ''' if 'cp.fileclient_{0}'.format(id(__opts__)) not in __context__: __context__['c...
python
def _mk_client(): ''' Create a file client and add it to the context. Each file client needs to correspond to a unique copy of the opts dictionary, therefore it's hashed by the id of the __opts__ dict ''' if 'cp.fileclient_{0}'.format(id(__opts__)) not in __context__: __context__['c...
[ "def", "_mk_client", "(", ")", ":", "if", "'cp.fileclient_{0}'", ".", "format", "(", "id", "(", "__opts__", ")", ")", "not", "in", "__context__", ":", "__context__", "[", "'cp.fileclient_{0}'", ".", "format", "(", "id", "(", "__opts__", ")", ")", "]", "=...
Create a file client and add it to the context. Each file client needs to correspond to a unique copy of the opts dictionary, therefore it's hashed by the id of the __opts__ dict
[ "Create", "a", "file", "client", "and", "add", "it", "to", "the", "context", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L157-L167
34,328
saltstack/salt
salt/modules/cp.py
get_template
def get_template(path, dest, template='jinja', saltenv='base', makedirs=False, **kwargs): ''' Render a file as a template before setting it down. Warning, order is not the same as in fileclient.cp for non breaking old A...
python
def get_template(path, dest, template='jinja', saltenv='base', makedirs=False, **kwargs): ''' Render a file as a template before setting it down. Warning, order is not the same as in fileclient.cp for non breaking old A...
[ "def", "get_template", "(", "path", ",", "dest", ",", "template", "=", "'jinja'", ",", "saltenv", "=", "'base'", ",", "makedirs", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "'salt'", "not", "in", "kwargs", ":", "kwargs", "[", "'salt'", "]...
Render a file as a template before setting it down. Warning, order is not the same as in fileclient.cp for non breaking old API. CLI Example: .. code-block:: bash salt '*' cp.get_template salt://path/to/template /minion/dest
[ "Render", "a", "file", "as", "a", "template", "before", "setting", "it", "down", ".", "Warning", "order", "is", "not", "the", "same", "as", "in", "fileclient", ".", "cp", "for", "non", "breaking", "old", "API", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L317-L348
34,329
saltstack/salt
salt/modules/cp.py
get_dir
def get_dir(path, dest, saltenv='base', template=None, gzip=None, **kwargs): ''' Used to recursively copy a directory from the salt master CLI Example: .. code-block:: bash salt '*' cp.get_dir salt://path/to/dir/ /minion/dest get_dir supports the same template and gzip arguments as get_f...
python
def get_dir(path, dest, saltenv='base', template=None, gzip=None, **kwargs): ''' Used to recursively copy a directory from the salt master CLI Example: .. code-block:: bash salt '*' cp.get_dir salt://path/to/dir/ /minion/dest get_dir supports the same template and gzip arguments as get_f...
[ "def", "get_dir", "(", "path", ",", "dest", ",", "saltenv", "=", "'base'", ",", "template", "=", "None", ",", "gzip", "=", "None", ",", "*", "*", "kwargs", ")", ":", "(", "path", ",", "dest", ")", "=", "_render_filenames", "(", "path", ",", "dest",...
Used to recursively copy a directory from the salt master CLI Example: .. code-block:: bash salt '*' cp.get_dir salt://path/to/dir/ /minion/dest get_dir supports the same template and gzip arguments as get_file.
[ "Used", "to", "recursively", "copy", "a", "directory", "from", "the", "salt", "master" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L351-L365
34,330
saltstack/salt
salt/modules/cp.py
get_file_str
def get_file_str(path, saltenv='base'): ''' Download a file from a URL to the Minion cache directory and return the contents of that file Returns ``False`` if Salt was unable to cache a file from a URL. CLI Example: .. code-block:: bash salt '*' cp.get_file_str salt://my/file '''...
python
def get_file_str(path, saltenv='base'): ''' Download a file from a URL to the Minion cache directory and return the contents of that file Returns ``False`` if Salt was unable to cache a file from a URL. CLI Example: .. code-block:: bash salt '*' cp.get_file_str salt://my/file '''...
[ "def", "get_file_str", "(", "path", ",", "saltenv", "=", "'base'", ")", ":", "fn_", "=", "cache_file", "(", "path", ",", "saltenv", ")", "if", "isinstance", "(", "fn_", ",", "six", ".", "string_types", ")", ":", "try", ":", "with", "salt", ".", "util...
Download a file from a URL to the Minion cache directory and return the contents of that file Returns ``False`` if Salt was unable to cache a file from a URL. CLI Example: .. code-block:: bash salt '*' cp.get_file_str salt://my/file
[ "Download", "a", "file", "from", "a", "URL", "to", "the", "Minion", "cache", "directory", "and", "return", "the", "contents", "of", "that", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L429-L449
34,331
saltstack/salt
salt/modules/cp.py
cache_file
def cache_file(path, saltenv='base', source_hash=None): ''' Used to cache a single file on the Minion Returns the location of the new cached file on the Minion source_hash If ``name`` is an http(s) or ftp URL and the file exists in the minion's file cache, this option can be passed to ...
python
def cache_file(path, saltenv='base', source_hash=None): ''' Used to cache a single file on the Minion Returns the location of the new cached file on the Minion source_hash If ``name`` is an http(s) or ftp URL and the file exists in the minion's file cache, this option can be passed to ...
[ "def", "cache_file", "(", "path", ",", "saltenv", "=", "'base'", ",", "source_hash", "=", "None", ")", ":", "path", "=", "salt", ".", "utils", ".", "data", ".", "decode", "(", "path", ")", "saltenv", "=", "salt", ".", "utils", ".", "data", ".", "de...
Used to cache a single file on the Minion Returns the location of the new cached file on the Minion source_hash If ``name`` is an http(s) or ftp URL and the file exists in the minion's file cache, this option can be passed to keep the minion from re-downloading the file if the cached c...
[ "Used", "to", "cache", "a", "single", "file", "on", "the", "Minion" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L452-L525
34,332
saltstack/salt
salt/modules/cp.py
cache_dir
def cache_dir(path, saltenv='base', include_empty=False, include_pat=None, exclude_pat=None): ''' Download and cache everything under a directory from the master include_pat : None Glob or regex to narrow down the files cached from the given path. If matching with a regex, th...
python
def cache_dir(path, saltenv='base', include_empty=False, include_pat=None, exclude_pat=None): ''' Download and cache everything under a directory from the master include_pat : None Glob or regex to narrow down the files cached from the given path. If matching with a regex, th...
[ "def", "cache_dir", "(", "path", ",", "saltenv", "=", "'base'", ",", "include_empty", "=", "False", ",", "include_pat", "=", "None", ",", "exclude_pat", "=", "None", ")", ":", "return", "_client", "(", ")", ".", "cache_dir", "(", "path", ",", "saltenv", ...
Download and cache everything under a directory from the master include_pat : None Glob or regex to narrow down the files cached from the given path. If matching with a regex, the regex must be prefixed with ``E@``, otherwise the expression will be interpreted as a glob. .. versio...
[ "Download", "and", "cache", "everything", "under", "a", "directory", "from", "the", "master" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L590-L625
34,333
saltstack/salt
salt/modules/cp.py
push
def push(path, keep_symlinks=False, upload_path=None, remove_source=False): ''' WARNING Files pushed to the master will have global read permissions.. Push a file from the minion up to the master, the file will be saved to the salt master in the master's minion files cachedir (defaults to ``/var/ca...
python
def push(path, keep_symlinks=False, upload_path=None, remove_source=False): ''' WARNING Files pushed to the master will have global read permissions.. Push a file from the minion up to the master, the file will be saved to the salt master in the master's minion files cachedir (defaults to ``/var/ca...
[ "def", "push", "(", "path", ",", "keep_symlinks", "=", "False", ",", "upload_path", "=", "None", ",", "remove_source", "=", "False", ")", ":", "log", ".", "debug", "(", "'Trying to copy \\'%s\\' to master'", ",", "path", ")", "if", "'../'", "in", "path", "...
WARNING Files pushed to the master will have global read permissions.. Push a file from the minion up to the master, the file will be saved to the salt master in the master's minion files cachedir (defaults to ``/var/cache/salt/master/minions/minion-id/files``) Since this feature allows a minion to pu...
[ "WARNING", "Files", "pushed", "to", "the", "master", "will", "have", "global", "read", "permissions", ".." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L788-L880
34,334
saltstack/salt
salt/states/glance_image.py
present
def present(name, auth=None, **kwargs): ''' Ensure image exists and is up-to-date name Name of the image enabled Boolean to control if image is enabled description An arbitrary description of the image ''' ret = {'name': name, 'changes': {}, '...
python
def present(name, auth=None, **kwargs): ''' Ensure image exists and is up-to-date name Name of the image enabled Boolean to control if image is enabled description An arbitrary description of the image ''' ret = {'name': name, 'changes': {}, '...
[ "def", "present", "(", "name", ",", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "kwargs", "=", ...
Ensure image exists and is up-to-date name Name of the image enabled Boolean to control if image is enabled description An arbitrary description of the image
[ "Ensure", "image", "exists", "and", "is", "up", "-", "to", "-", "date" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glance_image.py#L37-L75
34,335
saltstack/salt
salt/utils/docker/translate/container.py
_post_processing
def _post_processing(kwargs, skip_translate, invalid): ''' Additional container-specific post-translation processing ''' # Don't allow conflicting options to be set if kwargs.get('port_bindings') is not None \ and kwargs.get('publish_all_ports'): kwargs.pop('port_bindings') ...
python
def _post_processing(kwargs, skip_translate, invalid): ''' Additional container-specific post-translation processing ''' # Don't allow conflicting options to be set if kwargs.get('port_bindings') is not None \ and kwargs.get('publish_all_ports'): kwargs.pop('port_bindings') ...
[ "def", "_post_processing", "(", "kwargs", ",", "skip_translate", ",", "invalid", ")", ":", "# Don't allow conflicting options to be set", "if", "kwargs", ".", "get", "(", "'port_bindings'", ")", "is", "not", "None", "and", "kwargs", ".", "get", "(", "'publish_all_...
Additional container-specific post-translation processing
[ "Additional", "container", "-", "specific", "post", "-", "translation", "processing" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/docker/translate/container.py#L67-L137
34,336
saltstack/salt
salt/utils/docker/translate/container.py
binds
def binds(val, **kwargs): # pylint: disable=unused-argument ''' On the CLI, these are passed as multiple instances of a given CLI option. In Salt, we accept these as a comma-delimited list but the API expects a Python list. ''' if not isinstance(val, dict): if not isinstance(val, list):...
python
def binds(val, **kwargs): # pylint: disable=unused-argument ''' On the CLI, these are passed as multiple instances of a given CLI option. In Salt, we accept these as a comma-delimited list but the API expects a Python list. ''' if not isinstance(val, dict): if not isinstance(val, list):...
[ "def", "binds", "(", "val", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "if", "not", "isinstance", "(", "val", ",", "dict", ")", ":", "if", "not", "isinstance", "(", "val", ",", "list", ")", ":", "try", ":", "val", "=", "h...
On the CLI, these are passed as multiple instances of a given CLI option. In Salt, we accept these as a comma-delimited list but the API expects a Python list.
[ "On", "the", "CLI", "these", "are", "passed", "as", "multiple", "instances", "of", "a", "given", "CLI", "option", ".", "In", "Salt", "we", "accept", "these", "as", "a", "comma", "-", "delimited", "list", "but", "the", "API", "expects", "a", "Python", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/docker/translate/container.py#L145-L160
34,337
saltstack/salt
salt/utils/docker/translate/container.py
user
def user(val, **kwargs): # pylint: disable=unused-argument ''' This can be either a string or a numeric uid ''' if not isinstance(val, six.integer_types): # Try to convert to integer. This will fail if the value is a # username. This is OK, as we check below to make sure that the ...
python
def user(val, **kwargs): # pylint: disable=unused-argument ''' This can be either a string or a numeric uid ''' if not isinstance(val, six.integer_types): # Try to convert to integer. This will fail if the value is a # username. This is OK, as we check below to make sure that the ...
[ "def", "user", "(", "val", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "if", "not", "isinstance", "(", "val", ",", "six", ".", "integer_types", ")", ":", "# Try to convert to integer. This will fail if the value is a", "# username. This is OK...
This can be either a string or a numeric uid
[ "This", "can", "be", "either", "a", "string", "or", "a", "numeric", "uid" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/docker/translate/container.py#L665-L683
34,338
saltstack/salt
salt/utils/docker/translate/container.py
volumes
def volumes(val, **kwargs): # pylint: disable=unused-argument ''' Should be a list of absolute paths ''' val = helpers.translate_stringlist(val) for item in val: if not os.path.isabs(item): raise SaltInvocationError( '\'{0}\' is not an absolute path'.format(item)...
python
def volumes(val, **kwargs): # pylint: disable=unused-argument ''' Should be a list of absolute paths ''' val = helpers.translate_stringlist(val) for item in val: if not os.path.isabs(item): raise SaltInvocationError( '\'{0}\' is not an absolute path'.format(item)...
[ "def", "volumes", "(", "val", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "val", "=", "helpers", ".", "translate_stringlist", "(", "val", ")", "for", "item", "in", "val", ":", "if", "not", "os", ".", "path", ".", "isabs", "(",...
Should be a list of absolute paths
[ "Should", "be", "a", "list", "of", "absolute", "paths" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/docker/translate/container.py#L694-L704
34,339
saltstack/salt
salt/utils/docker/translate/container.py
working_dir
def working_dir(val, **kwargs): # pylint: disable=unused-argument ''' Must be an absolute path ''' try: is_abs = os.path.isabs(val) except AttributeError: is_abs = False if not is_abs: raise SaltInvocationError('\'{0}\' is not an absolute path'.format(val)) return va...
python
def working_dir(val, **kwargs): # pylint: disable=unused-argument ''' Must be an absolute path ''' try: is_abs = os.path.isabs(val) except AttributeError: is_abs = False if not is_abs: raise SaltInvocationError('\'{0}\' is not an absolute path'.format(val)) return va...
[ "def", "working_dir", "(", "val", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "try", ":", "is_abs", "=", "os", ".", "path", ".", "isabs", "(", "val", ")", "except", "AttributeError", ":", "is_abs", "=", "False", "if", "not", "...
Must be an absolute path
[ "Must", "be", "an", "absolute", "path" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/docker/translate/container.py#L711-L721
34,340
saltstack/salt
salt/modules/k8s.py
_kpost
def _kpost(url, data): ''' create any object in kubernetes based on URL ''' # Prepare headers headers = {"Content-Type": "application/json"} # Make request log.trace("url is: %s, data is: %s", url, data) ret = http.query(url, method='POST', header_dict=...
python
def _kpost(url, data): ''' create any object in kubernetes based on URL ''' # Prepare headers headers = {"Content-Type": "application/json"} # Make request log.trace("url is: %s, data is: %s", url, data) ret = http.query(url, method='POST', header_dict=...
[ "def", "_kpost", "(", "url", ",", "data", ")", ":", "# Prepare headers", "headers", "=", "{", "\"Content-Type\"", ":", "\"application/json\"", "}", "# Make request", "log", ".", "trace", "(", "\"url is: %s, data is: %s\"", ",", "url", ",", "data", ")", "ret", ...
create any object in kubernetes based on URL
[ "create", "any", "object", "in", "kubernetes", "based", "on", "URL" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/k8s.py#L70-L85
34,341
saltstack/salt
salt/modules/k8s.py
_kput
def _kput(url, data): ''' put any object in kubernetes based on URL ''' # Prepare headers headers = {"Content-Type": "application/json"} # Make request ret = http.query(url, method='PUT', header_dict=headers, data=salt.utils.json.dumps(...
python
def _kput(url, data): ''' put any object in kubernetes based on URL ''' # Prepare headers headers = {"Content-Type": "application/json"} # Make request ret = http.query(url, method='PUT', header_dict=headers, data=salt.utils.json.dumps(...
[ "def", "_kput", "(", "url", ",", "data", ")", ":", "# Prepare headers", "headers", "=", "{", "\"Content-Type\"", ":", "\"application/json\"", "}", "# Make request", "ret", "=", "http", ".", "query", "(", "url", ",", "method", "=", "'PUT'", ",", "header_dict"...
put any object in kubernetes based on URL
[ "put", "any", "object", "in", "kubernetes", "based", "on", "URL" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/k8s.py#L88-L102
34,342
saltstack/salt
salt/modules/k8s.py
_kpatch
def _kpatch(url, data): ''' patch any object in kubernetes based on URL ''' # Prepare headers headers = {"Content-Type": "application/json-patch+json"} # Make request ret = http.query(url, method='PATCH', header_dict=headers, data=salt.utils.json.dumps(data)) # Check reques...
python
def _kpatch(url, data): ''' patch any object in kubernetes based on URL ''' # Prepare headers headers = {"Content-Type": "application/json-patch+json"} # Make request ret = http.query(url, method='PATCH', header_dict=headers, data=salt.utils.json.dumps(data)) # Check reques...
[ "def", "_kpatch", "(", "url", ",", "data", ")", ":", "# Prepare headers", "headers", "=", "{", "\"Content-Type\"", ":", "\"application/json-patch+json\"", "}", "# Make request", "ret", "=", "http", ".", "query", "(", "url", ",", "method", "=", "'PATCH'", ",", ...
patch any object in kubernetes based on URL
[ "patch", "any", "object", "in", "kubernetes", "based", "on", "URL" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/k8s.py#L105-L118
34,343
saltstack/salt
salt/modules/k8s.py
_kname
def _kname(obj): '''Get name or names out of json result from API server''' if isinstance(obj, dict): return [obj.get("metadata", {}).get("name", "")] elif isinstance(obj, (list, tuple)): names = [] for i in obj: names.append(i.get("metadata", {}).get("name", "")) ...
python
def _kname(obj): '''Get name or names out of json result from API server''' if isinstance(obj, dict): return [obj.get("metadata", {}).get("name", "")] elif isinstance(obj, (list, tuple)): names = [] for i in obj: names.append(i.get("metadata", {}).get("name", "")) ...
[ "def", "_kname", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "dict", ")", ":", "return", "[", "obj", ".", "get", "(", "\"metadata\"", ",", "{", "}", ")", ".", "get", "(", "\"name\"", ",", "\"\"", ")", "]", "elif", "isinstance", "("...
Get name or names out of json result from API server
[ "Get", "name", "or", "names", "out", "of", "json", "result", "from", "API", "server" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/k8s.py#L121-L131
34,344
saltstack/salt
salt/modules/k8s.py
_get_labels
def _get_labels(node, apiserver_url): '''Get all labels from a kube node.''' # Prepare URL url = "{0}/api/v1/nodes/{1}".format(apiserver_url, node) # Make request ret = http.query(url) # Check requests status if 'body' in ret: ret = salt.utils.json.loads(ret.get('body')) elif ret...
python
def _get_labels(node, apiserver_url): '''Get all labels from a kube node.''' # Prepare URL url = "{0}/api/v1/nodes/{1}".format(apiserver_url, node) # Make request ret = http.query(url) # Check requests status if 'body' in ret: ret = salt.utils.json.loads(ret.get('body')) elif ret...
[ "def", "_get_labels", "(", "node", ",", "apiserver_url", ")", ":", "# Prepare URL", "url", "=", "\"{0}/api/v1/nodes/{1}\"", ".", "format", "(", "apiserver_url", ",", "node", ")", "# Make request", "ret", "=", "http", ".", "query", "(", "url", ")", "# Check req...
Get all labels from a kube node.
[ "Get", "all", "labels", "from", "a", "kube", "node", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/k8s.py#L180-L194
34,345
saltstack/salt
salt/modules/k8s.py
_set_labels
def _set_labels(node, apiserver_url, labels): '''Replace labels dict by a new one''' # Prepare URL url = "{0}/api/v1/nodes/{1}".format(apiserver_url, node) # Prepare data data = [{"op": "replace", "path": "/metadata/labels", "value": labels}] # Make request ret = _kpatch(url, data) if re...
python
def _set_labels(node, apiserver_url, labels): '''Replace labels dict by a new one''' # Prepare URL url = "{0}/api/v1/nodes/{1}".format(apiserver_url, node) # Prepare data data = [{"op": "replace", "path": "/metadata/labels", "value": labels}] # Make request ret = _kpatch(url, data) if re...
[ "def", "_set_labels", "(", "node", ",", "apiserver_url", ",", "labels", ")", ":", "# Prepare URL", "url", "=", "\"{0}/api/v1/nodes/{1}\"", ".", "format", "(", "apiserver_url", ",", "node", ")", "# Prepare data", "data", "=", "[", "{", "\"op\"", ":", "\"replace...
Replace labels dict by a new one
[ "Replace", "labels", "dict", "by", "a", "new", "one" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/k8s.py#L197-L207
34,346
saltstack/salt
salt/modules/k8s.py
_get_namespaces
def _get_namespaces(apiserver_url, name=""): '''Get namespace is namespace is defined otherwise return all namespaces''' # Prepare URL url = "{0}/api/v1/namespaces/{1}".format(apiserver_url, name) # Make request ret = http.query(url) if ret.get("body"): return salt.utils.json.loads(ret.g...
python
def _get_namespaces(apiserver_url, name=""): '''Get namespace is namespace is defined otherwise return all namespaces''' # Prepare URL url = "{0}/api/v1/namespaces/{1}".format(apiserver_url, name) # Make request ret = http.query(url) if ret.get("body"): return salt.utils.json.loads(ret.g...
[ "def", "_get_namespaces", "(", "apiserver_url", ",", "name", "=", "\"\"", ")", ":", "# Prepare URL", "url", "=", "\"{0}/api/v1/namespaces/{1}\"", ".", "format", "(", "apiserver_url", ",", "name", ")", "# Make request", "ret", "=", "http", ".", "query", "(", "u...
Get namespace is namespace is defined otherwise return all namespaces
[ "Get", "namespace", "is", "namespace", "is", "defined", "otherwise", "return", "all", "namespaces" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/k8s.py#L390-L399
34,347
saltstack/salt
salt/modules/k8s.py
_update_secret
def _update_secret(namespace, name, data, apiserver_url): '''Replace secrets data by a new one''' # Prepare URL url = "{0}/api/v1/namespaces/{1}/secrets/{2}".format(apiserver_url, namespace, name) # Prepare data data = [{"op": "replace", "path...
python
def _update_secret(namespace, name, data, apiserver_url): '''Replace secrets data by a new one''' # Prepare URL url = "{0}/api/v1/namespaces/{1}/secrets/{2}".format(apiserver_url, namespace, name) # Prepare data data = [{"op": "replace", "path...
[ "def", "_update_secret", "(", "namespace", ",", "name", ",", "data", ",", "apiserver_url", ")", ":", "# Prepare URL", "url", "=", "\"{0}/api/v1/namespaces/{1}/secrets/{2}\"", ".", "format", "(", "apiserver_url", ",", "namespace", ",", "name", ")", "# Prepare data", ...
Replace secrets data by a new one
[ "Replace", "secrets", "data", "by", "a", "new", "one" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/k8s.py#L508-L519
34,348
saltstack/salt
salt/modules/k8s.py
get_secrets
def get_secrets(namespace, name="", apiserver_url=None, decode=False, brief=False): ''' Get k8s namespaces CLI Example: .. code-block:: bash salt '*' k8s.get_secrets namespace_name salt '*' k8s.get_secrets namespace_name secret_name http://kube-master.cluster.local ''' # Try ...
python
def get_secrets(namespace, name="", apiserver_url=None, decode=False, brief=False): ''' Get k8s namespaces CLI Example: .. code-block:: bash salt '*' k8s.get_secrets namespace_name salt '*' k8s.get_secrets namespace_name secret_name http://kube-master.cluster.local ''' # Try ...
[ "def", "get_secrets", "(", "namespace", ",", "name", "=", "\"\"", ",", "apiserver_url", "=", "None", ",", "decode", "=", "False", ",", "brief", "=", "False", ")", ":", "# Try to get kubernetes master", "apiserver_url", "=", "_guess_apiserver", "(", "apiserver_ur...
Get k8s namespaces CLI Example: .. code-block:: bash salt '*' k8s.get_secrets namespace_name salt '*' k8s.get_secrets namespace_name secret_name http://kube-master.cluster.local
[ "Get", "k8s", "namespaces" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/k8s.py#L571-L593
34,349
saltstack/salt
salt/pillar/__init__.py
AsyncRemotePillar.compile_pillar
def compile_pillar(self): ''' Return a future which will contain the pillar data from the master ''' load = {'id': self.minion_id, 'grains': self.grains, 'saltenv': self.opts['saltenv'], 'pillarenv': self.opts['pillarenv'], ...
python
def compile_pillar(self): ''' Return a future which will contain the pillar data from the master ''' load = {'id': self.minion_id, 'grains': self.grains, 'saltenv': self.opts['saltenv'], 'pillarenv': self.opts['pillarenv'], ...
[ "def", "compile_pillar", "(", "self", ")", ":", "load", "=", "{", "'id'", ":", "self", ".", "minion_id", ",", "'grains'", ":", "self", ".", "grains", ",", "'saltenv'", ":", "self", ".", "opts", "[", "'saltenv'", "]", ",", "'pillarenv'", ":", "self", ...
Return a future which will contain the pillar data from the master
[ "Return", "a", "future", "which", "will", "contain", "the", "pillar", "data", "from", "the", "master" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/__init__.py#L163-L192
34,350
saltstack/salt
salt/pillar/__init__.py
RemotePillar.compile_pillar
def compile_pillar(self): ''' Return the pillar data from the master ''' load = {'id': self.minion_id, 'grains': self.grains, 'saltenv': self.opts['saltenv'], 'pillarenv': self.opts['pillarenv'], 'pillar_override': self.pill...
python
def compile_pillar(self): ''' Return the pillar data from the master ''' load = {'id': self.minion_id, 'grains': self.grains, 'saltenv': self.opts['saltenv'], 'pillarenv': self.opts['pillarenv'], 'pillar_override': self.pill...
[ "def", "compile_pillar", "(", "self", ")", ":", "load", "=", "{", "'id'", ":", "self", ".", "minion_id", ",", "'grains'", ":", "self", ".", "grains", ",", "'saltenv'", ":", "self", ".", "opts", "[", "'saltenv'", "]", ",", "'pillarenv'", ":", "self", ...
Return the pillar data from the master
[ "Return", "the", "pillar", "data", "from", "the", "master" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/__init__.py#L233-L257
34,351
saltstack/salt
salt/pillar/__init__.py
PillarCache.fetch_pillar
def fetch_pillar(self): ''' In the event of a cache miss, we need to incur the overhead of caching a new pillar. ''' log.debug('Pillar cache getting external pillar with ext: %s', self.ext) fresh_pillar = Pillar(self.opts, self.grains, ...
python
def fetch_pillar(self): ''' In the event of a cache miss, we need to incur the overhead of caching a new pillar. ''' log.debug('Pillar cache getting external pillar with ext: %s', self.ext) fresh_pillar = Pillar(self.opts, self.grains, ...
[ "def", "fetch_pillar", "(", "self", ")", ":", "log", ".", "debug", "(", "'Pillar cache getting external pillar with ext: %s'", ",", "self", ".", "ext", ")", "fresh_pillar", "=", "Pillar", "(", "self", ".", "opts", ",", "self", ".", "grains", ",", "self", "."...
In the event of a cache miss, we need to incur the overhead of caching a new pillar.
[ "In", "the", "event", "of", "a", "cache", "miss", "we", "need", "to", "incur", "the", "overhead", "of", "caching", "a", "new", "pillar", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/__init__.py#L318-L331
34,352
saltstack/salt
salt/pillar/__init__.py
PillarCache.compile_pillar
def compile_pillar(self, *args, **kwargs): # Will likely just be pillar_dirs ''' Compile pillar and set it to the cache, if not found. :param args: :param kwargs: :return: ''' log.debug('Scanning pillar cache for information about minion %s and pillarenv %s', se...
python
def compile_pillar(self, *args, **kwargs): # Will likely just be pillar_dirs ''' Compile pillar and set it to the cache, if not found. :param args: :param kwargs: :return: ''' log.debug('Scanning pillar cache for information about minion %s and pillarenv %s', se...
[ "def", "compile_pillar", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Will likely just be pillar_dirs", "log", ".", "debug", "(", "'Scanning pillar cache for information about minion %s and pillarenv %s'", ",", "self", ".", "minion_id", ",", "s...
Compile pillar and set it to the cache, if not found. :param args: :param kwargs: :return:
[ "Compile", "pillar", "and", "set", "it", "to", "the", "cache", "if", "not", "found", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/__init__.py#L333-L374
34,353
saltstack/salt
salt/pillar/__init__.py
Pillar.__valid_on_demand_ext_pillar
def __valid_on_demand_ext_pillar(self, opts): ''' Check to see if the on demand external pillar is allowed ''' if not isinstance(self.ext, dict): log.error( 'On-demand pillar %s is not formatted as a dictionary', self.ext ) ...
python
def __valid_on_demand_ext_pillar(self, opts): ''' Check to see if the on demand external pillar is allowed ''' if not isinstance(self.ext, dict): log.error( 'On-demand pillar %s is not formatted as a dictionary', self.ext ) ...
[ "def", "__valid_on_demand_ext_pillar", "(", "self", ",", "opts", ")", ":", "if", "not", "isinstance", "(", "self", ".", "ext", ",", "dict", ")", ":", "log", ".", "error", "(", "'On-demand pillar %s is not formatted as a dictionary'", ",", "self", ".", "ext", "...
Check to see if the on demand external pillar is allowed
[ "Check", "to", "see", "if", "the", "on", "demand", "external", "pillar", "is", "allowed" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/__init__.py#L429-L461
34,354
saltstack/salt
salt/pillar/__init__.py
Pillar.__gather_avail
def __gather_avail(self): ''' Gather the lists of available sls data from the master ''' avail = {} for saltenv in self._get_envs(): avail[saltenv] = self.client.list_states(saltenv) return avail
python
def __gather_avail(self): ''' Gather the lists of available sls data from the master ''' avail = {} for saltenv in self._get_envs(): avail[saltenv] = self.client.list_states(saltenv) return avail
[ "def", "__gather_avail", "(", "self", ")", ":", "avail", "=", "{", "}", "for", "saltenv", "in", "self", ".", "_get_envs", "(", ")", ":", "avail", "[", "saltenv", "]", "=", "self", ".", "client", ".", "list_states", "(", "saltenv", ")", "return", "ava...
Gather the lists of available sls data from the master
[ "Gather", "the", "lists", "of", "available", "sls", "data", "from", "the", "master" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/__init__.py#L463-L470
34,355
saltstack/salt
salt/pillar/__init__.py
Pillar.__gen_opts
def __gen_opts(self, opts_in, grains, saltenv=None, ext=None, pillarenv=None): ''' The options need to be altered to conform to the file client ''' opts = copy.deepcopy(opts_in) opts['file_client'] = 'local' if not grains: opts['grains'] = {} else: ...
python
def __gen_opts(self, opts_in, grains, saltenv=None, ext=None, pillarenv=None): ''' The options need to be altered to conform to the file client ''' opts = copy.deepcopy(opts_in) opts['file_client'] = 'local' if not grains: opts['grains'] = {} else: ...
[ "def", "__gen_opts", "(", "self", ",", "opts_in", ",", "grains", ",", "saltenv", "=", "None", ",", "ext", "=", "None", ",", "pillarenv", "=", "None", ")", ":", "opts", "=", "copy", ".", "deepcopy", "(", "opts_in", ")", "opts", "[", "'file_client'", "...
The options need to be altered to conform to the file client
[ "The", "options", "need", "to", "be", "altered", "to", "conform", "to", "the", "file", "client" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/__init__.py#L472-L510
34,356
saltstack/salt
salt/pillar/__init__.py
Pillar.sort_top_targets
def sort_top_targets(self, top, orders): ''' Returns the sorted high data from the merged top files ''' sorted_top = collections.defaultdict(OrderedDict) # pylint: disable=cell-var-from-loop for saltenv, targets in six.iteritems(top): sorted_targets = sorted(t...
python
def sort_top_targets(self, top, orders): ''' Returns the sorted high data from the merged top files ''' sorted_top = collections.defaultdict(OrderedDict) # pylint: disable=cell-var-from-loop for saltenv, targets in six.iteritems(top): sorted_targets = sorted(t...
[ "def", "sort_top_targets", "(", "self", ",", "top", ",", "orders", ")", ":", "sorted_top", "=", "collections", ".", "defaultdict", "(", "OrderedDict", ")", "# pylint: disable=cell-var-from-loop", "for", "saltenv", ",", "targets", "in", "six", ".", "iteritems", "...
Returns the sorted high data from the merged top files
[ "Returns", "the", "sorted", "high", "data", "from", "the", "merged", "top", "files" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/__init__.py#L653-L665
34,357
saltstack/salt
salt/pillar/__init__.py
Pillar.render_pillar
def render_pillar(self, matches, errors=None): ''' Extract the sls pillar files from the matches and render them into the pillar ''' pillar = copy.copy(self.pillar_override) if errors is None: errors = [] for saltenv, pstates in six.iteritems(matches):...
python
def render_pillar(self, matches, errors=None): ''' Extract the sls pillar files from the matches and render them into the pillar ''' pillar = copy.copy(self.pillar_override) if errors is None: errors = [] for saltenv, pstates in six.iteritems(matches):...
[ "def", "render_pillar", "(", "self", ",", "matches", ",", "errors", "=", "None", ")", ":", "pillar", "=", "copy", ".", "copy", "(", "self", ".", "pillar_override", ")", "if", "errors", "is", "None", ":", "errors", "=", "[", "]", "for", "saltenv", ","...
Extract the sls pillar files from the matches and render them into the pillar
[ "Extract", "the", "sls", "pillar", "files", "from", "the", "matches", "and", "render", "them", "into", "the", "pillar" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/__init__.py#L861-L910
34,358
saltstack/salt
salt/pillar/__init__.py
Pillar._external_pillar_data
def _external_pillar_data(self, pillar, val, key): ''' Builds actual pillar data structure and updates the ``pillar`` variable ''' ext = None args = salt.utils.args.get_function_argspec(self.ext_pillars[key]).args if isinstance(val, dict): if ('extra_minion_d...
python
def _external_pillar_data(self, pillar, val, key): ''' Builds actual pillar data structure and updates the ``pillar`` variable ''' ext = None args = salt.utils.args.get_function_argspec(self.ext_pillars[key]).args if isinstance(val, dict): if ('extra_minion_d...
[ "def", "_external_pillar_data", "(", "self", ",", "pillar", ",", "val", ",", "key", ")", ":", "ext", "=", "None", "args", "=", "salt", ".", "utils", ".", "args", ".", "get_function_argspec", "(", "self", ".", "ext_pillars", "[", "key", "]", ")", ".", ...
Builds actual pillar data structure and updates the ``pillar`` variable
[ "Builds", "actual", "pillar", "data", "structure", "and", "updates", "the", "pillar", "variable" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/__init__.py#L912-L946
34,359
saltstack/salt
salt/pillar/__init__.py
Pillar.ext_pillar
def ext_pillar(self, pillar, errors=None): ''' Render the external pillar data ''' if errors is None: errors = [] try: # Make sure that on-demand git_pillar is fetched before we try to # compile the pillar data. git_pillar will fetch a remote w...
python
def ext_pillar(self, pillar, errors=None): ''' Render the external pillar data ''' if errors is None: errors = [] try: # Make sure that on-demand git_pillar is fetched before we try to # compile the pillar data. git_pillar will fetch a remote w...
[ "def", "ext_pillar", "(", "self", ",", "pillar", ",", "errors", "=", "None", ")", ":", "if", "errors", "is", "None", ":", "errors", "=", "[", "]", "try", ":", "# Make sure that on-demand git_pillar is fetched before we try to", "# compile the pillar data. git_pillar w...
Render the external pillar data
[ "Render", "the", "external", "pillar", "data" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/__init__.py#L948-L1026
34,360
saltstack/salt
salt/pillar/__init__.py
Pillar.compile_pillar
def compile_pillar(self, ext=True): ''' Render the pillar data and return ''' top, top_errors = self.get_top() if ext: if self.opts.get('ext_pillar_first', False): self.opts['pillar'], errors = self.ext_pillar(self.pillar_override) self...
python
def compile_pillar(self, ext=True): ''' Render the pillar data and return ''' top, top_errors = self.get_top() if ext: if self.opts.get('ext_pillar_first', False): self.opts['pillar'], errors = self.ext_pillar(self.pillar_override) self...
[ "def", "compile_pillar", "(", "self", ",", "ext", "=", "True", ")", ":", "top", ",", "top_errors", "=", "self", ".", "get_top", "(", ")", "if", "ext", ":", "if", "self", ".", "opts", ".", "get", "(", "'ext_pillar_first'", ",", "False", ")", ":", "s...
Render the pillar data and return
[ "Render", "the", "pillar", "data", "and", "return" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/__init__.py#L1028-L1083
34,361
saltstack/salt
salt/pillar/__init__.py
Pillar.decrypt_pillar
def decrypt_pillar(self, pillar): ''' Decrypt the specified pillar dictionary items, if configured to do so ''' errors = [] if self.opts.get('decrypt_pillar'): decrypt_pillar = self.opts['decrypt_pillar'] if not isinstance(decrypt_pillar, dict): ...
python
def decrypt_pillar(self, pillar): ''' Decrypt the specified pillar dictionary items, if configured to do so ''' errors = [] if self.opts.get('decrypt_pillar'): decrypt_pillar = self.opts['decrypt_pillar'] if not isinstance(decrypt_pillar, dict): ...
[ "def", "decrypt_pillar", "(", "self", ",", "pillar", ")", ":", "errors", "=", "[", "]", "if", "self", ".", "opts", ".", "get", "(", "'decrypt_pillar'", ")", ":", "decrypt_pillar", "=", "self", ".", "opts", "[", "'decrypt_pillar'", "]", "if", "not", "is...
Decrypt the specified pillar dictionary items, if configured to do so
[ "Decrypt", "the", "specified", "pillar", "dictionary", "items", "if", "configured", "to", "do", "so" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/__init__.py#L1085-L1143
34,362
saltstack/salt
salt/modules/win_pki.py
_cmd_run
def _cmd_run(cmd, as_json=False): ''' Ensure that the Pki module is loaded, and convert to and extract data from Json as needed. ''' cmd_full = ['Import-Module -Name PKI; '] if as_json: cmd_full.append(r'ConvertTo-Json -Compress -Depth 4 -InputObject ' r'@({0})'....
python
def _cmd_run(cmd, as_json=False): ''' Ensure that the Pki module is loaded, and convert to and extract data from Json as needed. ''' cmd_full = ['Import-Module -Name PKI; '] if as_json: cmd_full.append(r'ConvertTo-Json -Compress -Depth 4 -InputObject ' r'@({0})'....
[ "def", "_cmd_run", "(", "cmd", ",", "as_json", "=", "False", ")", ":", "cmd_full", "=", "[", "'Import-Module -Name PKI; '", "]", "if", "as_json", ":", "cmd_full", ".", "append", "(", "r'ConvertTo-Json -Compress -Depth 4 -InputObject '", "r'@({0})'", ".", "format", ...
Ensure that the Pki module is loaded, and convert to and extract data from Json as needed.
[ "Ensure", "that", "the", "Pki", "module", "is", "loaded", "and", "convert", "to", "and", "extract", "data", "from", "Json", "as", "needed", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_pki.py#L65-L91
34,363
saltstack/salt
salt/modules/win_pki.py
_validate_cert_path
def _validate_cert_path(name): ''' Ensure that the certificate path, as determind from user input, is valid. ''' cmd = r"Test-Path -Path '{0}'".format(name) if not ast.literal_eval(_cmd_run(cmd=cmd)): raise SaltInvocationError(r"Invalid path specified: {0}".format(name))
python
def _validate_cert_path(name): ''' Ensure that the certificate path, as determind from user input, is valid. ''' cmd = r"Test-Path -Path '{0}'".format(name) if not ast.literal_eval(_cmd_run(cmd=cmd)): raise SaltInvocationError(r"Invalid path specified: {0}".format(name))
[ "def", "_validate_cert_path", "(", "name", ")", ":", "cmd", "=", "r\"Test-Path -Path '{0}'\"", ".", "format", "(", "name", ")", "if", "not", "ast", ".", "literal_eval", "(", "_cmd_run", "(", "cmd", "=", "cmd", ")", ")", ":", "raise", "SaltInvocationError", ...
Ensure that the certificate path, as determind from user input, is valid.
[ "Ensure", "that", "the", "certificate", "path", "as", "determind", "from", "user", "input", "is", "valid", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_pki.py#L94-L101
34,364
saltstack/salt
salt/modules/win_pki.py
_validate_cert_format
def _validate_cert_format(name): ''' Ensure that the certificate format, as determind from user input, is valid. ''' cert_formats = ['cer', 'pfx'] if name not in cert_formats: message = ("Invalid certificate format '{0}' specified. Valid formats:" ' {1}').format(name, cer...
python
def _validate_cert_format(name): ''' Ensure that the certificate format, as determind from user input, is valid. ''' cert_formats = ['cer', 'pfx'] if name not in cert_formats: message = ("Invalid certificate format '{0}' specified. Valid formats:" ' {1}').format(name, cer...
[ "def", "_validate_cert_format", "(", "name", ")", ":", "cert_formats", "=", "[", "'cer'", ",", "'pfx'", "]", "if", "name", "not", "in", "cert_formats", ":", "message", "=", "(", "\"Invalid certificate format '{0}' specified. Valid formats:\"", "' {1}'", ")", ".", ...
Ensure that the certificate format, as determind from user input, is valid.
[ "Ensure", "that", "the", "certificate", "format", "as", "determind", "from", "user", "input", "is", "valid", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_pki.py#L104-L113
34,365
saltstack/salt
salt/modules/win_pki.py
get_stores
def get_stores(): ''' Get the certificate location contexts and their corresponding stores. :return: A dictionary of the certificate location contexts and stores. :rtype: dict CLI Example: .. code-block:: bash salt '*' win_pki.get_stores ''' ret = dict() cmd = r"Get-Child...
python
def get_stores(): ''' Get the certificate location contexts and their corresponding stores. :return: A dictionary of the certificate location contexts and stores. :rtype: dict CLI Example: .. code-block:: bash salt '*' win_pki.get_stores ''' ret = dict() cmd = r"Get-Child...
[ "def", "get_stores", "(", ")", ":", "ret", "=", "dict", "(", ")", "cmd", "=", "r\"Get-ChildItem -Path 'Cert:\\' | \"", "r\"Select-Object LocationName, StoreNames\"", "items", "=", "_cmd_run", "(", "cmd", "=", "cmd", ",", "as_json", "=", "True", ")", "for", "item...
Get the certificate location contexts and their corresponding stores. :return: A dictionary of the certificate location contexts and stores. :rtype: dict CLI Example: .. code-block:: bash salt '*' win_pki.get_stores
[ "Get", "the", "certificate", "location", "contexts", "and", "their", "corresponding", "stores", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_pki.py#L116-L140
34,366
saltstack/salt
salt/modules/win_pki.py
get_certs
def get_certs(context=_DEFAULT_CONTEXT, store=_DEFAULT_STORE): ''' Get the available certificates in the given store. :param str context: The name of the certificate store location context. :param str store: The name of the certificate store. :return: A dictionary of the certificate thumbprints an...
python
def get_certs(context=_DEFAULT_CONTEXT, store=_DEFAULT_STORE): ''' Get the available certificates in the given store. :param str context: The name of the certificate store location context. :param str store: The name of the certificate store. :return: A dictionary of the certificate thumbprints an...
[ "def", "get_certs", "(", "context", "=", "_DEFAULT_CONTEXT", ",", "store", "=", "_DEFAULT_STORE", ")", ":", "ret", "=", "dict", "(", ")", "cmd", "=", "list", "(", ")", "blacklist_keys", "=", "[", "'DnsNameList'", "]", "store_path", "=", "r'Cert:\\{0}\\{1}'",...
Get the available certificates in the given store. :param str context: The name of the certificate store location context. :param str store: The name of the certificate store. :return: A dictionary of the certificate thumbprints and properties. :rtype: dict CLI Example: .. code-block:: bash ...
[ "Get", "the", "available", "certificates", "in", "the", "given", "store", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_pki.py#L143-L183
34,367
saltstack/salt
salt/modules/win_pki.py
get_cert_file
def get_cert_file(name, cert_format=_DEFAULT_FORMAT, password=''): ''' Get the details of the certificate file. :param str name: The filesystem path of the certificate file. :param str cert_format: The certificate format. Specify 'cer' for X.509, or 'pfx' for PKCS #12. :param str password: ...
python
def get_cert_file(name, cert_format=_DEFAULT_FORMAT, password=''): ''' Get the details of the certificate file. :param str name: The filesystem path of the certificate file. :param str cert_format: The certificate format. Specify 'cer' for X.509, or 'pfx' for PKCS #12. :param str password: ...
[ "def", "get_cert_file", "(", "name", ",", "cert_format", "=", "_DEFAULT_FORMAT", ",", "password", "=", "''", ")", ":", "ret", "=", "dict", "(", ")", "cmd", "=", "list", "(", ")", "blacklist_keys", "=", "[", "'DnsNameList'", "]", "cert_format", "=", "cert...
Get the details of the certificate file. :param str name: The filesystem path of the certificate file. :param str cert_format: The certificate format. Specify 'cer' for X.509, or 'pfx' for PKCS #12. :param str password: The password of the certificate. Only applicable to pfx format. Note th...
[ "Get", "the", "details", "of", "the", "certificate", "file", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_pki.py#L186-L250
34,368
saltstack/salt
salt/modules/win_pki.py
export_cert
def export_cert(name, thumbprint, cert_format=_DEFAULT_FORMAT, context=_DEFAULT_CONTEXT, store=_DEFAULT_STORE, password=''): ''' Export the certificate to a file from the given certificate store. :param str name: The destinatio...
python
def export_cert(name, thumbprint, cert_format=_DEFAULT_FORMAT, context=_DEFAULT_CONTEXT, store=_DEFAULT_STORE, password=''): ''' Export the certificate to a file from the given certificate store. :param str name: The destinatio...
[ "def", "export_cert", "(", "name", ",", "thumbprint", ",", "cert_format", "=", "_DEFAULT_FORMAT", ",", "context", "=", "_DEFAULT_CONTEXT", ",", "store", "=", "_DEFAULT_STORE", ",", "password", "=", "''", ")", ":", "cmd", "=", "list", "(", ")", "thumbprint", ...
Export the certificate to a file from the given certificate store. :param str name: The destination path for the exported certificate file. :param str thumbprint: The thumbprint value of the target certificate. :param str cert_format: The certificate format. Specify 'cer' for X.509, or 'pfx' for PK...
[ "Export", "the", "certificate", "to", "a", "file", "from", "the", "given", "certificate", "store", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_pki.py#L347-L409
34,369
saltstack/salt
salt/states/postgres_schema.py
present
def present(dbname, name, owner=None, user=None, db_user=None, db_password=None, db_host=None, db_port=None): ''' Ensure that the named schema is present in the database. dbname The database's name will work on name The name of the schema to manage ...
python
def present(dbname, name, owner=None, user=None, db_user=None, db_password=None, db_host=None, db_port=None): ''' Ensure that the named schema is present in the database. dbname The database's name will work on name The name of the schema to manage ...
[ "def", "present", "(", "dbname", ",", "name", ",", "owner", "=", "None", ",", "user", "=", "None", ",", "db_user", "=", "None", ",", "db_password", "=", "None", ",", "db_host", "=", "None", ",", "db_port", "=", "None", ")", ":", "ret", "=", "{", ...
Ensure that the named schema is present in the database. dbname The database's name will work on name The name of the schema to manage user system user all operations should be performed on behalf of db_user database username if different from config or default d...
[ "Ensure", "that", "the", "named", "schema", "is", "present", "in", "the", "database", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/postgres_schema.py#L31-L106
34,370
saltstack/salt
salt/returners/memcache_return.py
_get_serv
def _get_serv(ret): ''' Return a memcache server object ''' _options = _get_options(ret) host = _options.get('host') port = _options.get('port') log.debug('memcache server: %s:%s', host, port) if not host or not port: log.error('Host or port not defined in salt config') ...
python
def _get_serv(ret): ''' Return a memcache server object ''' _options = _get_options(ret) host = _options.get('host') port = _options.get('port') log.debug('memcache server: %s:%s', host, port) if not host or not port: log.error('Host or port not defined in salt config') ...
[ "def", "_get_serv", "(", "ret", ")", ":", "_options", "=", "_get_options", "(", "ret", ")", "host", "=", "_options", ".", "get", "(", "'host'", ")", "port", "=", "_options", ".", "get", "(", "'port'", ")", "log", ".", "debug", "(", "'memcache server: %...
Return a memcache server object
[ "Return", "a", "memcache", "server", "object" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/memcache_return.py#L93-L110
34,371
saltstack/salt
salt/returners/memcache_return.py
returner
def returner(ret): ''' Return data to a memcache data store ''' serv = _get_serv(ret) minion = ret['id'] jid = ret['jid'] fun = ret['fun'] rets = salt.utils.json.dumps(ret) serv.set('{0}:{1}'.format(jid, minion), rets) # cache for get_jid serv.set('{0}:{1}'.format(fun, minion), ...
python
def returner(ret): ''' Return data to a memcache data store ''' serv = _get_serv(ret) minion = ret['id'] jid = ret['jid'] fun = ret['fun'] rets = salt.utils.json.dumps(ret) serv.set('{0}:{1}'.format(jid, minion), rets) # cache for get_jid serv.set('{0}:{1}'.format(fun, minion), ...
[ "def", "returner", "(", "ret", ")", ":", "serv", "=", "_get_serv", "(", "ret", ")", "minion", "=", "ret", "[", "'id'", "]", "jid", "=", "ret", "[", "'jid'", "]", "fun", "=", "ret", "[", "'fun'", "]", "rets", "=", "salt", ".", "utils", ".", "jso...
Return data to a memcache data store
[ "Return", "data", "to", "a", "memcache", "data", "store" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/memcache_return.py#L140-L155
34,372
saltstack/salt
salt/states/boto_elb.py
absent
def absent(name, region=None, key=None, keyid=None, profile=None): ''' Ensure an ELB does not exist name name of the ELB ''' ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} exists = __salt__['boto_elb.exists'](name, region, key, keyid, profile) if exists: ...
python
def absent(name, region=None, key=None, keyid=None, profile=None): ''' Ensure an ELB does not exist name name of the ELB ''' ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} exists = __salt__['boto_elb.exists'](name, region, key, keyid, profile) if exists: ...
[ "def", "absent", "(", "name", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'comment'", ":", "''"...
Ensure an ELB does not exist name name of the ELB
[ "Ensure", "an", "ELB", "does", "not", "exist" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_elb.py#L1262-L1288
34,373
saltstack/salt
salt/utils/thread_local_proxy.py
ThreadLocalProxy.get_reference
def get_reference(proxy): ''' Return the object that is referenced by the specified proxy. If the proxy has not been bound to a reference for the current thread, the behavior depends on th the ``fallback_to_shared`` flag that has been specified when creating the proxy. If the fl...
python
def get_reference(proxy): ''' Return the object that is referenced by the specified proxy. If the proxy has not been bound to a reference for the current thread, the behavior depends on th the ``fallback_to_shared`` flag that has been specified when creating the proxy. If the fl...
[ "def", "get_reference", "(", "proxy", ")", ":", "thread_local", "=", "object", ".", "__getattribute__", "(", "proxy", ",", "'_thread_local'", ")", "try", ":", "return", "thread_local", ".", "reference", "except", "AttributeError", ":", "fallback_to_shared", "=", ...
Return the object that is referenced by the specified proxy. If the proxy has not been bound to a reference for the current thread, the behavior depends on th the ``fallback_to_shared`` flag that has been specified when creating the proxy. If the flag has been set, the last reference th...
[ "Return", "the", "object", "that", "is", "referenced", "by", "the", "specified", "proxy", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/thread_local_proxy.py#L47-L92
34,374
saltstack/salt
salt/utils/thread_local_proxy.py
ThreadLocalProxy.set_reference
def set_reference(proxy, new_reference): ''' Set the reference to be used the current thread of execution. After calling this function, the specified proxy will act like it was the referenced object. proxy: proxy object for which the reference shall be set. If the s...
python
def set_reference(proxy, new_reference): ''' Set the reference to be used the current thread of execution. After calling this function, the specified proxy will act like it was the referenced object. proxy: proxy object for which the reference shall be set. If the s...
[ "def", "set_reference", "(", "proxy", ",", "new_reference", ")", ":", "# If the new reference is itself a proxy, we have to ensure that it does", "# not refer to this proxy. If it does, we simply return because updating", "# the reference would result in an inifite loop when trying to use the", ...
Set the reference to be used the current thread of execution. After calling this function, the specified proxy will act like it was the referenced object. proxy: proxy object for which the reference shall be set. If the specified object is not an instance of `ThreadLoca...
[ "Set", "the", "reference", "to", "be", "used", "the", "current", "thread", "of", "execution", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/thread_local_proxy.py#L95-L123
34,375
saltstack/salt
salt/utils/thread_local_proxy.py
ThreadLocalProxy.unproxy
def unproxy(possible_proxy): ''' Unwrap and return the object referenced by a proxy. This function is very similar to :func:`get_reference`, but works for both proxies and regular objects. If the specified object is a proxy, its reference is extracted with ``get_reference`` and ...
python
def unproxy(possible_proxy): ''' Unwrap and return the object referenced by a proxy. This function is very similar to :func:`get_reference`, but works for both proxies and regular objects. If the specified object is a proxy, its reference is extracted with ``get_reference`` and ...
[ "def", "unproxy", "(", "possible_proxy", ")", ":", "while", "isinstance", "(", "possible_proxy", ",", "ThreadLocalProxy", ")", ":", "possible_proxy", "=", "ThreadLocalProxy", ".", "get_reference", "(", "possible_proxy", ")", "return", "possible_proxy" ]
Unwrap and return the object referenced by a proxy. This function is very similar to :func:`get_reference`, but works for both proxies and regular objects. If the specified object is a proxy, its reference is extracted with ``get_reference`` and returned. If it is not a proxy, it is ret...
[ "Unwrap", "and", "return", "the", "object", "referenced", "by", "a", "proxy", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/thread_local_proxy.py#L143-L160
34,376
saltstack/salt
salt/modules/kmod.py
_set_persistent_module
def _set_persistent_module(mod): ''' Add module to configuration file to make it persistent. If module is commented uncomment it. ''' conf = _get_modules_conf() if not os.path.exists(conf): __salt__['file.touch'](conf) mod_name = _strip_module_name(mod) if not mod_name or mod_nam...
python
def _set_persistent_module(mod): ''' Add module to configuration file to make it persistent. If module is commented uncomment it. ''' conf = _get_modules_conf() if not os.path.exists(conf): __salt__['file.touch'](conf) mod_name = _strip_module_name(mod) if not mod_name or mod_nam...
[ "def", "_set_persistent_module", "(", "mod", ")", ":", "conf", "=", "_get_modules_conf", "(", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "conf", ")", ":", "__salt__", "[", "'file.touch'", "]", "(", "conf", ")", "mod_name", "=", "_strip_modu...
Add module to configuration file to make it persistent. If module is commented uncomment it.
[ "Add", "module", "to", "configuration", "file", "to", "make", "it", "persistent", ".", "If", "module", "is", "commented", "uncomment", "it", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kmod.py#L76-L96
34,377
saltstack/salt
salt/modules/kmod.py
_remove_persistent_module
def _remove_persistent_module(mod, comment): ''' Remove module from configuration file. If comment is true only comment line where module is. ''' conf = _get_modules_conf() mod_name = _strip_module_name(mod) if not mod_name or mod_name not in mod_list(True): return set() escape_m...
python
def _remove_persistent_module(mod, comment): ''' Remove module from configuration file. If comment is true only comment line where module is. ''' conf = _get_modules_conf() mod_name = _strip_module_name(mod) if not mod_name or mod_name not in mod_list(True): return set() escape_m...
[ "def", "_remove_persistent_module", "(", "mod", ",", "comment", ")", ":", "conf", "=", "_get_modules_conf", "(", ")", "mod_name", "=", "_strip_module_name", "(", "mod", ")", "if", "not", "mod_name", "or", "mod_name", "not", "in", "mod_list", "(", "True", ")"...
Remove module from configuration file. If comment is true only comment line where module is.
[ "Remove", "module", "from", "configuration", "file", ".", "If", "comment", "is", "true", "only", "comment", "line", "where", "module", "is", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kmod.py#L99-L113
34,378
saltstack/salt
salt/proxy/onyx.py
ping
def ping(): ''' Ping the device on the other end of the connection .. code-block: bash salt '*' onyx.cmd ping ''' if _worker_name() not in DETAILS: init() try: return DETAILS[_worker_name()].conn.isalive() except TerminalException as e: log.error(e) ...
python
def ping(): ''' Ping the device on the other end of the connection .. code-block: bash salt '*' onyx.cmd ping ''' if _worker_name() not in DETAILS: init() try: return DETAILS[_worker_name()].conn.isalive() except TerminalException as e: log.error(e) ...
[ "def", "ping", "(", ")", ":", "if", "_worker_name", "(", ")", "not", "in", "DETAILS", ":", "init", "(", ")", "try", ":", "return", "DETAILS", "[", "_worker_name", "(", ")", "]", ".", "conn", ".", "isalive", "(", ")", "except", "TerminalException", "a...
Ping the device on the other end of the connection .. code-block: bash salt '*' onyx.cmd ping
[ "Ping", "the", "device", "on", "the", "other", "end", "of", "the", "connection" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/onyx.py#L117-L131
34,379
saltstack/salt
salt/proxy/onyx.py
sendline
def sendline(command): ''' Run command through switch's cli .. code-block: bash salt '*' onyx.cmd sendline 'show run | include "username admin password 7"' ''' if ping() is False: init() out, _ = DETAILS[_worker_name()].sendline(command) return out
python
def sendline(command): ''' Run command through switch's cli .. code-block: bash salt '*' onyx.cmd sendline 'show run | include "username admin password 7"' ''' if ping() is False: init() out, _ = DETAILS[_worker_name()].sendline(command) return out
[ "def", "sendline", "(", "command", ")", ":", "if", "ping", "(", ")", "is", "False", ":", "init", "(", ")", "out", ",", "_", "=", "DETAILS", "[", "_worker_name", "(", ")", "]", ".", "sendline", "(", "command", ")", "return", "out" ]
Run command through switch's cli .. code-block: bash salt '*' onyx.cmd sendline 'show run | include "username admin password 7"'
[ "Run", "command", "through", "switch", "s", "cli" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/onyx.py#L141-L153
34,380
saltstack/salt
salt/proxy/onyx.py
grains
def grains(): ''' Get grains for proxy minion .. code-block: bash salt '*' onyx.cmd grains ''' if not DETAILS['grains_cache']: ret = system_info() log.debug(ret) DETAILS['grains_cache'].update(ret) return {'onyx': DETAILS['grains_cache']}
python
def grains(): ''' Get grains for proxy minion .. code-block: bash salt '*' onyx.cmd grains ''' if not DETAILS['grains_cache']: ret = system_info() log.debug(ret) DETAILS['grains_cache'].update(ret) return {'onyx': DETAILS['grains_cache']}
[ "def", "grains", "(", ")", ":", "if", "not", "DETAILS", "[", "'grains_cache'", "]", ":", "ret", "=", "system_info", "(", ")", "log", ".", "debug", "(", "ret", ")", "DETAILS", "[", "'grains_cache'", "]", ".", "update", "(", "ret", ")", "return", "{", ...
Get grains for proxy minion .. code-block: bash salt '*' onyx.cmd grains
[ "Get", "grains", "for", "proxy", "minion" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/onyx.py#L221-L233
34,381
saltstack/salt
salt/proxy/onyx.py
get_user
def get_user(username): ''' Get username line from switch .. code-block: bash salt '*' onyx.cmd get_user username=admin ''' try: enable() configure_terminal() cmd_out = sendline('show running-config | include "username {0} password 7"'.format(username)) cmd_...
python
def get_user(username): ''' Get username line from switch .. code-block: bash salt '*' onyx.cmd get_user username=admin ''' try: enable() configure_terminal() cmd_out = sendline('show running-config | include "username {0} password 7"'.format(username)) cmd_...
[ "def", "get_user", "(", "username", ")", ":", "try", ":", "enable", "(", ")", "configure_terminal", "(", ")", "cmd_out", "=", "sendline", "(", "'show running-config | include \"username {0} password 7\"'", ".", "format", "(", "username", ")", ")", "cmd_out", ".", ...
Get username line from switch .. code-block: bash salt '*' onyx.cmd get_user username=admin
[ "Get", "username", "line", "from", "switch" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/onyx.py#L248-L267
34,382
saltstack/salt
salt/proxy/onyx.py
get_roles
def get_roles(username): ''' Get roles that the username is assigned from switch .. code-block: bash salt '*' onyx.cmd get_roles username=admin ''' info = sendline('show user-account {0}'.format(username)) roles = re.search(r'^\s*roles:(.*)$', info, re.MULTILINE) if roles: ...
python
def get_roles(username): ''' Get roles that the username is assigned from switch .. code-block: bash salt '*' onyx.cmd get_roles username=admin ''' info = sendline('show user-account {0}'.format(username)) roles = re.search(r'^\s*roles:(.*)$', info, re.MULTILINE) if roles: ...
[ "def", "get_roles", "(", "username", ")", ":", "info", "=", "sendline", "(", "'show user-account {0}'", ".", "format", "(", "username", ")", ")", "roles", "=", "re", ".", "search", "(", "r'^\\s*roles:(.*)$'", ",", "info", ",", "re", ".", "MULTILINE", ")", ...
Get roles that the username is assigned from switch .. code-block: bash salt '*' onyx.cmd get_roles username=admin
[ "Get", "roles", "that", "the", "username", "is", "assigned", "from", "switch" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/onyx.py#L270-L284
34,383
saltstack/salt
salt/proxy/onyx.py
remove_user
def remove_user(username): ''' Remove user from switch .. code-block:: bash salt '*' onyx.cmd remove_user username=daniel ''' try: sendline('config terminal') user_line = 'no username {0}'.format(username) ret = sendline(user_line) sendline('end') se...
python
def remove_user(username): ''' Remove user from switch .. code-block:: bash salt '*' onyx.cmd remove_user username=daniel ''' try: sendline('config terminal') user_line = 'no username {0}'.format(username) ret = sendline(user_line) sendline('end') se...
[ "def", "remove_user", "(", "username", ")", ":", "try", ":", "sendline", "(", "'config terminal'", ")", "user_line", "=", "'no username {0}'", ".", "format", "(", "username", ")", "ret", "=", "sendline", "(", "user_line", ")", "sendline", "(", "'end'", ")", ...
Remove user from switch .. code-block:: bash salt '*' onyx.cmd remove_user username=daniel
[ "Remove", "user", "from", "switch" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/onyx.py#L298-L315
34,384
saltstack/salt
salt/proxy/onyx.py
set_role
def set_role(username, role): ''' Assign role to username .. code-block:: bash salt '*' onyx.cmd set_role username=daniel role=vdc-admin ''' try: sendline('config terminal') role_line = 'username {0} role {1}'.format(username, role) ret = sendline(role_line) ...
python
def set_role(username, role): ''' Assign role to username .. code-block:: bash salt '*' onyx.cmd set_role username=daniel role=vdc-admin ''' try: sendline('config terminal') role_line = 'username {0} role {1}'.format(username, role) ret = sendline(role_line) ...
[ "def", "set_role", "(", "username", ",", "role", ")", ":", "try", ":", "sendline", "(", "'config terminal'", ")", "role_line", "=", "'username {0} role {1}'", ".", "format", "(", "username", ",", "role", ")", "ret", "=", "sendline", "(", "role_line", ")", ...
Assign role to username .. code-block:: bash salt '*' onyx.cmd set_role username=daniel role=vdc-admin
[ "Assign", "role", "to", "username" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/onyx.py#L318-L335
34,385
saltstack/salt
salt/proxy/onyx.py
show_run
def show_run(): ''' Shortcut to run `show run` on switch .. code-block:: bash salt '*' onyx.cmd show_run ''' try: enable() configure_terminal() ret = sendline('show running-config') configure_terminal_exit() disable() except TerminalException as ...
python
def show_run(): ''' Shortcut to run `show run` on switch .. code-block:: bash salt '*' onyx.cmd show_run ''' try: enable() configure_terminal() ret = sendline('show running-config') configure_terminal_exit() disable() except TerminalException as ...
[ "def", "show_run", "(", ")", ":", "try", ":", "enable", "(", ")", "configure_terminal", "(", ")", "ret", "=", "sendline", "(", "'show running-config'", ")", "configure_terminal_exit", "(", ")", "disable", "(", ")", "except", "TerminalException", "as", "e", "...
Shortcut to run `show run` on switch .. code-block:: bash salt '*' onyx.cmd show_run
[ "Shortcut", "to", "run", "show", "run", "on", "switch" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/onyx.py#L358-L375
34,386
saltstack/salt
salt/proxy/onyx.py
add_config
def add_config(lines): ''' Add one or more config lines to the switch running config .. code-block:: bash salt '*' onyx.cmd add_config 'snmp-server community TESTSTRINGHERE rw' .. note:: For more than one config added per command, lines should be a list. ''' if not isinstance(...
python
def add_config(lines): ''' Add one or more config lines to the switch running config .. code-block:: bash salt '*' onyx.cmd add_config 'snmp-server community TESTSTRINGHERE rw' .. note:: For more than one config added per command, lines should be a list. ''' if not isinstance(...
[ "def", "add_config", "(", "lines", ")", ":", "if", "not", "isinstance", "(", "lines", ",", "list", ")", ":", "lines", "=", "[", "lines", "]", "try", ":", "enable", "(", ")", "configure_terminal", "(", ")", "for", "line", "in", "lines", ":", "sendline...
Add one or more config lines to the switch running config .. code-block:: bash salt '*' onyx.cmd add_config 'snmp-server community TESTSTRINGHERE rw' .. note:: For more than one config added per command, lines should be a list.
[ "Add", "one", "or", "more", "config", "lines", "to", "the", "switch", "running", "config" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/onyx.py#L394-L418
34,387
saltstack/salt
salt/proxy/onyx.py
delete_config
def delete_config(lines): ''' Delete one or more config lines to the switch running config .. code-block:: bash salt '*' onyx.cmd delete_config 'snmp-server community TESTSTRINGHERE group network-operator' .. note:: For more than one config deleted per command, lines should be a list....
python
def delete_config(lines): ''' Delete one or more config lines to the switch running config .. code-block:: bash salt '*' onyx.cmd delete_config 'snmp-server community TESTSTRINGHERE group network-operator' .. note:: For more than one config deleted per command, lines should be a list....
[ "def", "delete_config", "(", "lines", ")", ":", "if", "not", "isinstance", "(", "lines", ",", "list", ")", ":", "lines", "=", "[", "lines", "]", "try", ":", "sendline", "(", "'config terminal'", ")", "for", "line", "in", "lines", ":", "sendline", "(", ...
Delete one or more config lines to the switch running config .. code-block:: bash salt '*' onyx.cmd delete_config 'snmp-server community TESTSTRINGHERE group network-operator' .. note:: For more than one config deleted per command, lines should be a list.
[ "Delete", "one", "or", "more", "config", "lines", "to", "the", "switch", "running", "config" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/onyx.py#L421-L444
34,388
saltstack/salt
salt/proxy/onyx.py
find
def find(pattern): ''' Find all instances where the pattern is in the running command .. code-block:: bash salt '*' onyx.cmd find '^snmp-server.*$' .. note:: This uses the `re.MULTILINE` regex format for python, and runs the regex against the whole show_run output. ''' ...
python
def find(pattern): ''' Find all instances where the pattern is in the running command .. code-block:: bash salt '*' onyx.cmd find '^snmp-server.*$' .. note:: This uses the `re.MULTILINE` regex format for python, and runs the regex against the whole show_run output. ''' ...
[ "def", "find", "(", "pattern", ")", ":", "matcher", "=", "re", ".", "compile", "(", "pattern", ",", "re", ".", "MULTILINE", ")", "return", "matcher", ".", "findall", "(", "show_run", "(", ")", ")" ]
Find all instances where the pattern is in the running command .. code-block:: bash salt '*' onyx.cmd find '^snmp-server.*$' .. note:: This uses the `re.MULTILINE` regex format for python, and runs the regex against the whole show_run output.
[ "Find", "all", "instances", "where", "the", "pattern", "is", "in", "the", "running", "command" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/onyx.py#L447-L460
34,389
saltstack/salt
salt/proxy/onyx.py
replace
def replace(old_value, new_value, full_match=False): ''' Replace string or full line matches in switch's running config If full_match is set to True, then the whole line will need to be matched as part of the old value. .. code-block:: bash salt '*' onyx.cmd replace 'TESTSTRINGHERE' 'NEWT...
python
def replace(old_value, new_value, full_match=False): ''' Replace string or full line matches in switch's running config If full_match is set to True, then the whole line will need to be matched as part of the old value. .. code-block:: bash salt '*' onyx.cmd replace 'TESTSTRINGHERE' 'NEWT...
[ "def", "replace", "(", "old_value", ",", "new_value", ",", "full_match", "=", "False", ")", ":", "if", "full_match", "is", "False", ":", "matcher", "=", "re", ".", "compile", "(", "'^.*{0}.*$'", ".", "format", "(", "re", ".", "escape", "(", "old_value", ...
Replace string or full line matches in switch's running config If full_match is set to True, then the whole line will need to be matched as part of the old value. .. code-block:: bash salt '*' onyx.cmd replace 'TESTSTRINGHERE' 'NEWTESTSTRINGHERE'
[ "Replace", "string", "or", "full", "line", "matches", "in", "switch", "s", "running", "config" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/onyx.py#L463-L489
34,390
saltstack/salt
salt/states/postgres_group.py
absent
def absent(name, user=None, maintenance_db=None, db_password=None, db_host=None, db_port=None, db_user=None): ''' Ensure that the named group is absent name The groupname of the group to remove user System user all opera...
python
def absent(name, user=None, maintenance_db=None, db_password=None, db_host=None, db_port=None, db_user=None): ''' Ensure that the named group is absent name The groupname of the group to remove user System user all opera...
[ "def", "absent", "(", "name", ",", "user", "=", "None", ",", "maintenance_db", "=", "None", ",", "db_password", "=", "None", ",", "db_host", "=", "None", ",", "db_port", "=", "None", ",", "db_user", "=", "None", ")", ":", "ret", "=", "{", "'name'", ...
Ensure that the named group is absent name The groupname of the group to remove user System user all operations should be performed on behalf of .. versionadded:: 0.17.0 db_user database username if different from config or defaul db_password user password if...
[ "Ensure", "that", "the", "named", "group", "is", "absent" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/postgres_group.py#L216-L273
34,391
saltstack/salt
salt/utils/docker/translate/helpers.py
translate_stringlist
def translate_stringlist(val): ''' On the CLI, these are passed as multiple instances of a given CLI option. In Salt, we accept these as a comma-delimited list but the API expects a Python list. This function accepts input and returns it back as a Python list of strings. If the input is a string whi...
python
def translate_stringlist(val): ''' On the CLI, these are passed as multiple instances of a given CLI option. In Salt, we accept these as a comma-delimited list but the API expects a Python list. This function accepts input and returns it back as a Python list of strings. If the input is a string whi...
[ "def", "translate_stringlist", "(", "val", ")", ":", "if", "not", "isinstance", "(", "val", ",", "list", ")", ":", "try", ":", "val", "=", "split", "(", "val", ")", "except", "AttributeError", ":", "val", "=", "split", "(", "six", ".", "text_type", "...
On the CLI, these are passed as multiple instances of a given CLI option. In Salt, we accept these as a comma-delimited list but the API expects a Python list. This function accepts input and returns it back as a Python list of strings. If the input is a string which is a comma-separated list of items, ...
[ "On", "the", "CLI", "these", "are", "passed", "as", "multiple", "instances", "of", "a", "given", "CLI", "option", ".", "In", "Salt", "we", "accept", "these", "as", "a", "comma", "-", "delimited", "list", "but", "the", "API", "expects", "a", "Python", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/docker/translate/helpers.py#L206-L222
34,392
saltstack/salt
salt/utils/docker/translate/helpers.py
translate_labels
def translate_labels(val): ''' Can either be a list of label names, or a list of name=value pairs. The API can accept either a list of label names or a dictionary mapping names to values, so the value we translate will be different depending on the input. ''' if not isinstance(val, dict): ...
python
def translate_labels(val): ''' Can either be a list of label names, or a list of name=value pairs. The API can accept either a list of label names or a dictionary mapping names to values, so the value we translate will be different depending on the input. ''' if not isinstance(val, dict): ...
[ "def", "translate_labels", "(", "val", ")", ":", "if", "not", "isinstance", "(", "val", ",", "dict", ")", ":", "if", "not", "isinstance", "(", "val", ",", "list", ")", ":", "val", "=", "split", "(", "val", ")", "new_val", "=", "{", "}", "for", "i...
Can either be a list of label names, or a list of name=value pairs. The API can accept either a list of label names or a dictionary mapping names to values, so the value we translate will be different depending on the input.
[ "Can", "either", "be", "a", "list", "of", "label", "names", "or", "a", "list", "of", "name", "=", "value", "pairs", ".", "The", "API", "can", "accept", "either", "a", "list", "of", "label", "names", "or", "a", "dictionary", "mapping", "names", "to", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/docker/translate/helpers.py#L280-L308
34,393
saltstack/salt
salt/states/firewall.py
check
def check(name, port=None, **kwargs): ''' Checks if there is an open connection from the minion to the defined host on a specific port. name host name or ip address to test connection to port The port to test the connection on kwargs Additional parameters, parameters allowe...
python
def check(name, port=None, **kwargs): ''' Checks if there is an open connection from the minion to the defined host on a specific port. name host name or ip address to test connection to port The port to test the connection on kwargs Additional parameters, parameters allowe...
[ "def", "check", "(", "name", ",", "port", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# set name to host as required by the module", "host", "=", "name", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'changes'", ":", "{...
Checks if there is an open connection from the minion to the defined host on a specific port. name host name or ip address to test connection to port The port to test the connection on kwargs Additional parameters, parameters allowed are: proto (tcp or udp) family (i...
[ "Checks", "if", "there", "is", "an", "open", "connection", "from", "the", "minion", "to", "the", "defined", "host", "on", "a", "specific", "port", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/firewall.py#L19-L67
34,394
saltstack/salt
salt/states/selinux.py
_refine_mode
def _refine_mode(mode): ''' Return a mode value that is predictable ''' mode = six.text_type(mode).lower() if any([mode.startswith('e'), mode == '1', mode == 'on']): return 'Enforcing' if any([mode.startswith('p'), mode == '0', mode == 'off...
python
def _refine_mode(mode): ''' Return a mode value that is predictable ''' mode = six.text_type(mode).lower() if any([mode.startswith('e'), mode == '1', mode == 'on']): return 'Enforcing' if any([mode.startswith('p'), mode == '0', mode == 'off...
[ "def", "_refine_mode", "(", "mode", ")", ":", "mode", "=", "six", ".", "text_type", "(", "mode", ")", ".", "lower", "(", ")", "if", "any", "(", "[", "mode", ".", "startswith", "(", "'e'", ")", ",", "mode", "==", "'1'", ",", "mode", "==", "'on'", ...
Return a mode value that is predictable
[ "Return", "a", "mode", "value", "that", "is", "predictable" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/selinux.py#L41-L56
34,395
saltstack/salt
salt/states/selinux.py
mode
def mode(name): ''' Verifies the mode SELinux is running in, can be set to enforcing, permissive, or disabled .. note:: A change to or from disabled mode requires a system reboot. You will need to perform this yourself. name The mode to run SELinux in, permissive, enforcing...
python
def mode(name): ''' Verifies the mode SELinux is running in, can be set to enforcing, permissive, or disabled .. note:: A change to or from disabled mode requires a system reboot. You will need to perform this yourself. name The mode to run SELinux in, permissive, enforcing...
[ "def", "mode", "(", "name", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "False", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", "}", "tmode", "=", "_refine_mode", "(", "name", ")", "if", "tmode", "==", "...
Verifies the mode SELinux is running in, can be set to enforcing, permissive, or disabled .. note:: A change to or from disabled mode requires a system reboot. You will need to perform this yourself. name The mode to run SELinux in, permissive, enforcing, or disabled.
[ "Verifies", "the", "mode", "SELinux", "is", "running", "in", "can", "be", "set", "to", "enforcing", "permissive", "or", "disabled" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/selinux.py#L84-L133
34,396
saltstack/salt
salt/states/selinux.py
boolean
def boolean(name, value, persist=False): ''' Set up an SELinux boolean name The name of the boolean to set value The value to set on the boolean persist Defaults to False, set persist to true to make the boolean apply on a reboot ''' ret = {'name': name, ...
python
def boolean(name, value, persist=False): ''' Set up an SELinux boolean name The name of the boolean to set value The value to set on the boolean persist Defaults to False, set persist to true to make the boolean apply on a reboot ''' ret = {'name': name, ...
[ "def", "boolean", "(", "name", ",", "value", ",", "persist", "=", "False", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", "}", "bools", "=", "__salt__", ...
Set up an SELinux boolean name The name of the boolean to set value The value to set on the boolean persist Defaults to False, set persist to true to make the boolean apply on a reboot
[ "Set", "up", "an", "SELinux", "boolean" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/selinux.py#L136-L191
34,397
saltstack/salt
salt/states/selinux.py
module_install
def module_install(name): ''' Installs custom SELinux module from given file name Path to file with module to install .. versionadded:: 2016.11.6 ''' ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} if __salt__['selinux.install_sem...
python
def module_install(name): ''' Installs custom SELinux module from given file name Path to file with module to install .. versionadded:: 2016.11.6 ''' ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} if __salt__['selinux.install_sem...
[ "def", "module_install", "(", "name", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", "}", "if", "__salt__", "[", "'selinux.install_semod'", "]", "(", "name",...
Installs custom SELinux module from given file name Path to file with module to install .. versionadded:: 2016.11.6
[ "Installs", "custom", "SELinux", "module", "from", "given", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/selinux.py#L271-L289
34,398
saltstack/salt
salt/states/selinux.py
module_remove
def module_remove(name): ''' Removes SELinux module name The name of the module to remove .. versionadded:: 2016.11.6 ''' ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} modules = __salt__['selinux.list_semod']() if name not i...
python
def module_remove(name): ''' Removes SELinux module name The name of the module to remove .. versionadded:: 2016.11.6 ''' ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} modules = __salt__['selinux.list_semod']() if name not i...
[ "def", "module_remove", "(", "name", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", "}", "modules", "=", "__salt__", "[", "'selinux.list_semod'", "]", "(", ...
Removes SELinux module name The name of the module to remove .. versionadded:: 2016.11.6
[ "Removes", "SELinux", "module" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/selinux.py#L292-L315
34,399
saltstack/salt
salt/states/openstack_config.py
present
def present(name, filename, section, value, parameter=None): ''' Ensure a value is set in an OpenStack configuration file. filename The full path to the configuration file section The section in which the parameter will be set parameter (optional) The parameter to change. ...
python
def present(name, filename, section, value, parameter=None): ''' Ensure a value is set in an OpenStack configuration file. filename The full path to the configuration file section The section in which the parameter will be set parameter (optional) The parameter to change. ...
[ "def", "present", "(", "name", ",", "filename", ",", "section", ",", "value", ",", "parameter", "=", "None", ")", ":", "if", "parameter", "is", "None", ":", "parameter", "=", "name", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{",...
Ensure a value is set in an OpenStack configuration file. filename The full path to the configuration file section The section in which the parameter will be set parameter (optional) The parameter to change. If the parameter is not supplied, the name will be used as the parameter...
[ "Ensure", "a", "value", "is", "set", "in", "an", "OpenStack", "configuration", "file", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/openstack_config.py#L33-L90