repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
saltstack/salt
salt/utils/url.py
split_env
def split_env(url): ''' remove the saltenv query parameter from a 'salt://' url ''' if not url.startswith('salt://'): return url, None path, senv = parse(url) return create(path), senv
python
def split_env(url): ''' remove the saltenv query parameter from a 'salt://' url ''' if not url.startswith('salt://'): return url, None path, senv = parse(url) return create(path), senv
[ "def", "split_env", "(", "url", ")", ":", "if", "not", "url", ".", "startswith", "(", "'salt://'", ")", ":", "return", "url", ",", "None", "path", ",", "senv", "=", "parse", "(", "url", ")", "return", "create", "(", "path", ")", ",", "senv" ]
remove the saltenv query parameter from a 'salt://' url
[ "remove", "the", "saltenv", "query", "parameter", "from", "a", "salt", ":", "//", "url" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/url.py#L124-L132
train
saltstack/salt
salt/utils/url.py
add_http_basic_auth
def add_http_basic_auth(url, user=None, password=None, https_only=False): ''' Return a string with http basic auth incorporated into it ''' if user is None and password is None: return url else: urltuple = urlpar...
python
def add_http_basic_auth(url, user=None, password=None, https_only=False): ''' Return a string with http basic auth incorporated into it ''' if user is None and password is None: return url else: urltuple = urlpar...
[ "def", "add_http_basic_auth", "(", "url", ",", "user", "=", "None", ",", "password", "=", "None", ",", "https_only", "=", "False", ")", ":", "if", "user", "is", "None", "and", "password", "is", "None", ":", "return", "url", "else", ":", "urltuple", "="...
Return a string with http basic auth incorporated into it
[ "Return", "a", "string", "with", "http", "basic", "auth", "incorporated", "into", "it" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/url.py#L152-L179
train
saltstack/salt
salt/utils/url.py
redact_http_basic_auth
def redact_http_basic_auth(output): ''' Remove HTTP user and password ''' # We can't use re.compile because re.compile(someregex).sub() doesn't # support flags even in Python 2.7. url_re = '(https?)://.*@' redacted = r'\1://<redacted>@' if sys.version_info >= (2, 7): # re.sub() s...
python
def redact_http_basic_auth(output): ''' Remove HTTP user and password ''' # We can't use re.compile because re.compile(someregex).sub() doesn't # support flags even in Python 2.7. url_re = '(https?)://.*@' redacted = r'\1://<redacted>@' if sys.version_info >= (2, 7): # re.sub() s...
[ "def", "redact_http_basic_auth", "(", "output", ")", ":", "# We can't use re.compile because re.compile(someregex).sub() doesn't", "# support flags even in Python 2.7.", "url_re", "=", "'(https?)://.*@'", "redacted", "=", "r'\\1://<redacted>@'", "if", "sys", ".", "version_info", ...
Remove HTTP user and password
[ "Remove", "HTTP", "user", "and", "password" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/url.py#L182-L201
train
saltstack/salt
salt/modules/yumpkg.py
_get_hold
def _get_hold(line, pattern=__HOLD_PATTERN, full=True): ''' Resolve a package name from a line containing the hold expression. If the regex is not matched, None is returned. yum ==> 2:vim-enhanced-7.4.629-5.el6.* dnf ==> vim-enhanced-2:7.4.827-1.fc22.* ''' if full: if _yum() == 'dnf...
python
def _get_hold(line, pattern=__HOLD_PATTERN, full=True): ''' Resolve a package name from a line containing the hold expression. If the regex is not matched, None is returned. yum ==> 2:vim-enhanced-7.4.629-5.el6.* dnf ==> vim-enhanced-2:7.4.827-1.fc22.* ''' if full: if _yum() == 'dnf...
[ "def", "_get_hold", "(", "line", ",", "pattern", "=", "__HOLD_PATTERN", ",", "full", "=", "True", ")", ":", "if", "full", ":", "if", "_yum", "(", ")", "==", "'dnf'", ":", "lock_re", "=", "r'({0}-\\S+)'", ".", "format", "(", "pattern", ")", "else", ":...
Resolve a package name from a line containing the hold expression. If the regex is not matched, None is returned. yum ==> 2:vim-enhanced-7.4.629-5.el6.* dnf ==> vim-enhanced-2:7.4.827-1.fc22.*
[ "Resolve", "a", "package", "name", "from", "a", "line", "containing", "the", "hold", "expression", ".", "If", "the", "regex", "is", "not", "matched", "None", "is", "returned", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L109-L136
train
saltstack/salt
salt/modules/yumpkg.py
_yum
def _yum(): ''' Determine package manager name (yum or dnf), depending on the system version. ''' contextkey = 'yum_bin' if contextkey not in __context__: if ('fedora' in __grains__['os'].lower() and int(__grains__['osrelease']) >= 22): __context__[contextkey] = 'd...
python
def _yum(): ''' Determine package manager name (yum or dnf), depending on the system version. ''' contextkey = 'yum_bin' if contextkey not in __context__: if ('fedora' in __grains__['os'].lower() and int(__grains__['osrelease']) >= 22): __context__[contextkey] = 'd...
[ "def", "_yum", "(", ")", ":", "contextkey", "=", "'yum_bin'", "if", "contextkey", "not", "in", "__context__", ":", "if", "(", "'fedora'", "in", "__grains__", "[", "'os'", "]", ".", "lower", "(", ")", "and", "int", "(", "__grains__", "[", "'osrelease'", ...
Determine package manager name (yum or dnf), depending on the system version.
[ "Determine", "package", "manager", "name", "(", "yum", "or", "dnf", ")", "depending", "on", "the", "system", "version", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L139-L153
train
saltstack/salt
salt/modules/yumpkg.py
_call_yum
def _call_yum(args, **kwargs): ''' Call yum/dnf. ''' params = {'output_loglevel': 'trace', 'python_shell': False, 'env': salt.utils.environment.get_module_environment(globals())} params.update(kwargs) cmd = [] if salt.utils.systemd.has_scope(__context__) and __sal...
python
def _call_yum(args, **kwargs): ''' Call yum/dnf. ''' params = {'output_loglevel': 'trace', 'python_shell': False, 'env': salt.utils.environment.get_module_environment(globals())} params.update(kwargs) cmd = [] if salt.utils.systemd.has_scope(__context__) and __sal...
[ "def", "_call_yum", "(", "args", ",", "*", "*", "kwargs", ")", ":", "params", "=", "{", "'output_loglevel'", ":", "'trace'", ",", "'python_shell'", ":", "False", ",", "'env'", ":", "salt", ".", "utils", ".", "environment", ".", "get_module_environment", "(...
Call yum/dnf.
[ "Call", "yum", "/", "dnf", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L156-L170
train
saltstack/salt
salt/modules/yumpkg.py
_yum_pkginfo
def _yum_pkginfo(output): ''' Parse yum/dnf output (which could contain irregular line breaks if package names are long) retrieving the name, version, etc., and return a list of pkginfo namedtuples. ''' cur = {} keys = itertools.cycle(('name', 'version', 'repoid')) values = salt.utils.it...
python
def _yum_pkginfo(output): ''' Parse yum/dnf output (which could contain irregular line breaks if package names are long) retrieving the name, version, etc., and return a list of pkginfo namedtuples. ''' cur = {} keys = itertools.cycle(('name', 'version', 'repoid')) values = salt.utils.it...
[ "def", "_yum_pkginfo", "(", "output", ")", ":", "cur", "=", "{", "}", "keys", "=", "itertools", ".", "cycle", "(", "(", "'name'", ",", "'version'", ",", "'repoid'", ")", ")", "values", "=", "salt", ".", "utils", ".", "itertools", ".", "split", "(", ...
Parse yum/dnf output (which could contain irregular line breaks if package names are long) retrieving the name, version, etc., and return a list of pkginfo namedtuples.
[ "Parse", "yum", "/", "dnf", "output", "(", "which", "could", "contain", "irregular", "line", "breaks", "if", "package", "names", "are", "long", ")", "retrieving", "the", "name", "version", "etc", ".", "and", "return", "a", "list", "of", "pkginfo", "namedtu...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L173-L208
train
saltstack/salt
salt/modules/yumpkg.py
_check_versionlock
def _check_versionlock(): ''' Ensure that the appropriate versionlock plugin is present ''' if _yum() == 'dnf': if int(__grains__.get('osmajorrelease')) >= 26: if six.PY3: vl_plugin = 'python3-dnf-plugin-versionlock' else: vl_plugin = 'pyth...
python
def _check_versionlock(): ''' Ensure that the appropriate versionlock plugin is present ''' if _yum() == 'dnf': if int(__grains__.get('osmajorrelease')) >= 26: if six.PY3: vl_plugin = 'python3-dnf-plugin-versionlock' else: vl_plugin = 'pyth...
[ "def", "_check_versionlock", "(", ")", ":", "if", "_yum", "(", ")", "==", "'dnf'", ":", "if", "int", "(", "__grains__", ".", "get", "(", "'osmajorrelease'", ")", ")", ">=", "26", ":", "if", "six", ".", "PY3", ":", "vl_plugin", "=", "'python3-dnf-plugin...
Ensure that the appropriate versionlock plugin is present
[ "Ensure", "that", "the", "appropriate", "versionlock", "plugin", "is", "present" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L211-L234
train
saltstack/salt
salt/modules/yumpkg.py
_get_options
def _get_options(**kwargs): ''' Returns a list of options to be used in the yum/dnf command, based on the kwargs passed. ''' # Get repo options from the kwargs fromrepo = kwargs.pop('fromrepo', '') repo = kwargs.pop('repo', '') disablerepo = kwargs.pop('disablerepo', '') enablerepo =...
python
def _get_options(**kwargs): ''' Returns a list of options to be used in the yum/dnf command, based on the kwargs passed. ''' # Get repo options from the kwargs fromrepo = kwargs.pop('fromrepo', '') repo = kwargs.pop('repo', '') disablerepo = kwargs.pop('disablerepo', '') enablerepo =...
[ "def", "_get_options", "(", "*", "*", "kwargs", ")", ":", "# Get repo options from the kwargs", "fromrepo", "=", "kwargs", ".", "pop", "(", "'fromrepo'", ",", "''", ")", "repo", "=", "kwargs", ".", "pop", "(", "'repo'", ",", "''", ")", "disablerepo", "=", ...
Returns a list of options to be used in the yum/dnf command, based on the kwargs passed.
[ "Returns", "a", "list", "of", "options", "to", "be", "used", "in", "the", "yum", "/", "dnf", "command", "based", "on", "the", "kwargs", "passed", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L237-L307
train
saltstack/salt
salt/modules/yumpkg.py
_get_yum_config
def _get_yum_config(): ''' Returns a dict representing the yum config options and values. We try to pull all of the yum config options into a standard dict object. This is currently only used to get the reposdir settings, but could be used for other things if needed. If the yum python library ...
python
def _get_yum_config(): ''' Returns a dict representing the yum config options and values. We try to pull all of the yum config options into a standard dict object. This is currently only used to get the reposdir settings, but could be used for other things if needed. If the yum python library ...
[ "def", "_get_yum_config", "(", ")", ":", "# in case of any non-fatal failures, these defaults will be used", "conf", "=", "{", "'reposdir'", ":", "[", "'/etc/yum/repos.d'", ",", "'/etc/yum.repos.d'", "]", ",", "}", "if", "HAS_YUM", ":", "try", ":", "yb", "=", "yum",...
Returns a dict representing the yum config options and values. We try to pull all of the yum config options into a standard dict object. This is currently only used to get the reposdir settings, but could be used for other things if needed. If the yum python library is available, use that, which will ...
[ "Returns", "a", "dict", "representing", "the", "yum", "config", "options", "and", "values", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L310-L382
train
saltstack/salt
salt/modules/yumpkg.py
_get_yum_config_value
def _get_yum_config_value(name): ''' Look for a specific config variable and return its value ''' conf = _get_yum_config() if name in conf.keys(): return conf.get(name) return None
python
def _get_yum_config_value(name): ''' Look for a specific config variable and return its value ''' conf = _get_yum_config() if name in conf.keys(): return conf.get(name) return None
[ "def", "_get_yum_config_value", "(", "name", ")", ":", "conf", "=", "_get_yum_config", "(", ")", "if", "name", "in", "conf", ".", "keys", "(", ")", ":", "return", "conf", ".", "get", "(", "name", ")", "return", "None" ]
Look for a specific config variable and return its value
[ "Look", "for", "a", "specific", "config", "variable", "and", "return", "its", "value" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L385-L392
train
saltstack/salt
salt/modules/yumpkg.py
_normalize_basedir
def _normalize_basedir(basedir=None): ''' Takes a basedir argument as a string or a list. If the string or list is empty, then look up the default from the 'reposdir' option in the yum config. Returns a list of directories. ''' # if we are passed a string (for backward compatibility), conve...
python
def _normalize_basedir(basedir=None): ''' Takes a basedir argument as a string or a list. If the string or list is empty, then look up the default from the 'reposdir' option in the yum config. Returns a list of directories. ''' # if we are passed a string (for backward compatibility), conve...
[ "def", "_normalize_basedir", "(", "basedir", "=", "None", ")", ":", "# if we are passed a string (for backward compatibility), convert to a list", "if", "isinstance", "(", "basedir", ",", "six", ".", "string_types", ")", ":", "basedir", "=", "[", "x", ".", "strip", ...
Takes a basedir argument as a string or a list. If the string or list is empty, then look up the default from the 'reposdir' option in the yum config. Returns a list of directories.
[ "Takes", "a", "basedir", "argument", "as", "a", "string", "or", "a", "list", ".", "If", "the", "string", "or", "list", "is", "empty", "then", "look", "up", "the", "default", "from", "the", "reposdir", "option", "in", "the", "yum", "config", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L395-L417
train
saltstack/salt
salt/modules/yumpkg.py
normalize_name
def normalize_name(name): ''' Strips the architecture from the specified package name, if necessary. Circumstances where this would be done include: * If the arch is 32 bit and the package name ends in a 32-bit arch. * If the arch matches the OS arch, or is ``noarch``. CLI Example: .. cod...
python
def normalize_name(name): ''' Strips the architecture from the specified package name, if necessary. Circumstances where this would be done include: * If the arch is 32 bit and the package name ends in a 32-bit arch. * If the arch matches the OS arch, or is ``noarch``. CLI Example: .. cod...
[ "def", "normalize_name", "(", "name", ")", ":", "try", ":", "arch", "=", "name", ".", "rsplit", "(", "'.'", ",", "1", ")", "[", "-", "1", "]", "if", "arch", "not", "in", "salt", ".", "utils", ".", "pkg", ".", "rpm", ".", "ARCHES", "+", "(", "...
Strips the architecture from the specified package name, if necessary. Circumstances where this would be done include: * If the arch is 32 bit and the package name ends in a 32-bit arch. * If the arch matches the OS arch, or is ``noarch``. CLI Example: .. code-block:: bash salt '*' pkg.n...
[ "Strips", "the", "architecture", "from", "the", "specified", "package", "name", "if", "necessary", ".", "Circumstances", "where", "this", "would", "be", "done", "include", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L420-L443
train
saltstack/salt
salt/modules/yumpkg.py
version_cmp
def version_cmp(pkg1, pkg2, ignore_epoch=False, **kwargs): ''' .. versionadded:: 2015.5.4 Do a cmp-style comparison on two packages. Return -1 if pkg1 < pkg2, 0 if pkg1 == pkg2, and 1 if pkg1 > pkg2. Return None if there was a problem making the comparison. ignore_epoch : False Set to ...
python
def version_cmp(pkg1, pkg2, ignore_epoch=False, **kwargs): ''' .. versionadded:: 2015.5.4 Do a cmp-style comparison on two packages. Return -1 if pkg1 < pkg2, 0 if pkg1 == pkg2, and 1 if pkg1 > pkg2. Return None if there was a problem making the comparison. ignore_epoch : False Set to ...
[ "def", "version_cmp", "(", "pkg1", ",", "pkg2", ",", "ignore_epoch", "=", "False", ",", "*", "*", "kwargs", ")", ":", "return", "__salt__", "[", "'lowpkg.version_cmp'", "]", "(", "pkg1", ",", "pkg2", ",", "ignore_epoch", "=", "ignore_epoch", ")" ]
.. versionadded:: 2015.5.4 Do a cmp-style comparison on two packages. Return -1 if pkg1 < pkg2, 0 if pkg1 == pkg2, and 1 if pkg1 > pkg2. Return None if there was a problem making the comparison. ignore_epoch : False Set to ``True`` to ignore the epoch when comparing versions .. versio...
[ "..", "versionadded", "::", "2015", ".", "5", ".", "4" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L599-L619
train
saltstack/salt
salt/modules/yumpkg.py
list_pkgs
def list_pkgs(versions_as_list=False, **kwargs): ''' List the packages currently installed as a dict. By default, the dict contains versions as a comma separated string:: {'<package_name>': '<version>[,<version>...]'} versions_as_list: If set to true, the versions are provided as a lis...
python
def list_pkgs(versions_as_list=False, **kwargs): ''' List the packages currently installed as a dict. By default, the dict contains versions as a comma separated string:: {'<package_name>': '<version>[,<version>...]'} versions_as_list: If set to true, the versions are provided as a lis...
[ "def", "list_pkgs", "(", "versions_as_list", "=", "False", ",", "*", "*", "kwargs", ")", ":", "versions_as_list", "=", "salt", ".", "utils", ".", "data", ".", "is_true", "(", "versions_as_list", ")", "# not yet implemented or not applicable", "if", "any", "(", ...
List the packages currently installed as a dict. By default, the dict contains versions as a comma separated string:: {'<package_name>': '<version>[,<version>...]'} versions_as_list: If set to true, the versions are provided as a list {'<package_name>': ['<version>', '<version>']} ...
[ "List", "the", "packages", "currently", "installed", "as", "a", "dict", ".", "By", "default", "the", "dict", "contains", "versions", "as", "a", "comma", "separated", "string", "::" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L622-L706
train
saltstack/salt
salt/modules/yumpkg.py
list_repo_pkgs
def list_repo_pkgs(*args, **kwargs): ''' .. versionadded:: 2014.1.0 .. versionchanged:: 2014.7.0 All available versions of each package are now returned. This required a slight modification to the structure of the return dict. The return data shown below reflects the updated return d...
python
def list_repo_pkgs(*args, **kwargs): ''' .. versionadded:: 2014.1.0 .. versionchanged:: 2014.7.0 All available versions of each package are now returned. This required a slight modification to the structure of the return dict. The return data shown below reflects the updated return d...
[ "def", "list_repo_pkgs", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "byrepo", "=", "kwargs", ".", "pop", "(", "'byrepo'", ",", "False", ")", "cacheonly", "=", "kwargs", ".", "pop", "(", "'cacheonly'", ",", "False", ")", "fromrepo", "=", "kw...
.. versionadded:: 2014.1.0 .. versionchanged:: 2014.7.0 All available versions of each package are now returned. This required a slight modification to the structure of the return dict. The return data shown below reflects the updated return dict structure. Note that packages which a...
[ "..", "versionadded", "::", "2014", ".", "1", ".", "0", "..", "versionchanged", "::", "2014", ".", "7", ".", "0", "All", "available", "versions", "of", "each", "package", "are", "now", "returned", ".", "This", "required", "a", "slight", "modification", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L709-L952
train
saltstack/salt
salt/modules/yumpkg.py
list_upgrades
def list_upgrades(refresh=True, **kwargs): ''' Check whether or not an upgrade is available for all packages The ``fromrepo``, ``enablerepo``, and ``disablerepo`` arguments are supported, as used in pkg states, and the ``disableexcludes`` option is also supported. .. versionadded:: 2014.7.0 ...
python
def list_upgrades(refresh=True, **kwargs): ''' Check whether or not an upgrade is available for all packages The ``fromrepo``, ``enablerepo``, and ``disablerepo`` arguments are supported, as used in pkg states, and the ``disableexcludes`` option is also supported. .. versionadded:: 2014.7.0 ...
[ "def", "list_upgrades", "(", "refresh", "=", "True", ",", "*", "*", "kwargs", ")", ":", "options", "=", "_get_options", "(", "*", "*", "kwargs", ")", "if", "salt", ".", "utils", ".", "data", ".", "is_true", "(", "refresh", ")", ":", "refresh_db", "("...
Check whether or not an upgrade is available for all packages The ``fromrepo``, ``enablerepo``, and ``disablerepo`` arguments are supported, as used in pkg states, and the ``disableexcludes`` option is also supported. .. versionadded:: 2014.7.0 Support for the ``disableexcludes`` option C...
[ "Check", "whether", "or", "not", "an", "upgrade", "is", "available", "for", "all", "packages" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L955-L984
train
saltstack/salt
salt/modules/yumpkg.py
list_downloaded
def list_downloaded(**kwargs): ''' .. versionadded:: 2017.7.0 List prefetched packages downloaded by Yum in the local disk. CLI example: .. code-block:: bash salt '*' pkg.list_downloaded ''' CACHE_DIR = os.path.join('/var/cache/', _yum()) ret = {} for root, dirnames, fil...
python
def list_downloaded(**kwargs): ''' .. versionadded:: 2017.7.0 List prefetched packages downloaded by Yum in the local disk. CLI example: .. code-block:: bash salt '*' pkg.list_downloaded ''' CACHE_DIR = os.path.join('/var/cache/', _yum()) ret = {} for root, dirnames, fil...
[ "def", "list_downloaded", "(", "*", "*", "kwargs", ")", ":", "CACHE_DIR", "=", "os", ".", "path", ".", "join", "(", "'/var/cache/'", ",", "_yum", "(", ")", ")", "ret", "=", "{", "}", "for", "root", ",", "dirnames", ",", "filenames", "in", "salt", "...
.. versionadded:: 2017.7.0 List prefetched packages downloaded by Yum in the local disk. CLI example: .. code-block:: bash salt '*' pkg.list_downloaded
[ "..", "versionadded", "::", "2017", ".", "7", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L991-L1017
train
saltstack/salt
salt/modules/yumpkg.py
info_installed
def info_installed(*names, **kwargs): ''' .. versionadded:: 2015.8.1 Return the information of the named package(s), installed on the system. :param all_versions: Include information for all versions of the packages installed on the minion. CLI example: .. code-block:: bash ...
python
def info_installed(*names, **kwargs): ''' .. versionadded:: 2015.8.1 Return the information of the named package(s), installed on the system. :param all_versions: Include information for all versions of the packages installed on the minion. CLI example: .. code-block:: bash ...
[ "def", "info_installed", "(", "*", "names", ",", "*", "*", "kwargs", ")", ":", "all_versions", "=", "kwargs", ".", "get", "(", "'all_versions'", ",", "False", ")", "ret", "=", "dict", "(", ")", "for", "pkg_name", ",", "pkgs_nfo", "in", "__salt__", "[",...
.. versionadded:: 2015.8.1 Return the information of the named package(s), installed on the system. :param all_versions: Include information for all versions of the packages installed on the minion. CLI example: .. code-block:: bash salt '*' pkg.info_installed <package1> sal...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "1" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L1020-L1053
train
saltstack/salt
salt/modules/yumpkg.py
refresh_db
def refresh_db(**kwargs): ''' Check the yum repos for updated packages Returns: - ``True``: Updates are available - ``False``: An error occurred - ``None``: No updates are available repo Refresh just the specified repo disablerepo Do not refresh the specified repo ...
python
def refresh_db(**kwargs): ''' Check the yum repos for updated packages Returns: - ``True``: Updates are available - ``False``: An error occurred - ``None``: No updates are available repo Refresh just the specified repo disablerepo Do not refresh the specified repo ...
[ "def", "refresh_db", "(", "*", "*", "kwargs", ")", ":", "# Remove rtag file to keep multiple refreshes from happening in pkg states", "salt", ".", "utils", ".", "pkg", ".", "clear_rtag", "(", "__opts__", ")", "retcodes", "=", "{", "100", ":", "True", ",", "0", "...
Check the yum repos for updated packages Returns: - ``True``: Updates are available - ``False``: An error occurred - ``None``: No updates are available repo Refresh just the specified repo disablerepo Do not refresh the specified repo enablerepo Refresh a disable...
[ "Check", "the", "yum", "repos", "for", "updated", "packages" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L1056-L1124
train
saltstack/salt
salt/modules/yumpkg.py
install
def install(name=None, refresh=False, skip_verify=False, pkgs=None, sources=None, downloadonly=False, reinstall=False, normalize=True, update_holds=False, saltenv='base', ignore_epoch=False, ...
python
def install(name=None, refresh=False, skip_verify=False, pkgs=None, sources=None, downloadonly=False, reinstall=False, normalize=True, update_holds=False, saltenv='base', ignore_epoch=False, ...
[ "def", "install", "(", "name", "=", "None", ",", "refresh", "=", "False", ",", "skip_verify", "=", "False", ",", "pkgs", "=", "None", ",", "sources", "=", "None", ",", "downloadonly", "=", "False", ",", "reinstall", "=", "False", ",", "normalize", "=",...
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands which modify installed packages from the ``salt-minion`` daemon's control group. This is done to keep systemd from killing any yum/dnf commands spawned by S...
[ "..", "versionchanged", "::", "2015", ".", "8", ".", "12", "2016", ".", "3", ".", "3", "2016", ".", "11", ".", "0", "On", "minions", "running", "systemd", ">", "=", "205", "systemd", "-", "run", "(", "1", ")", "_", "is", "now", "used", "to", "i...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L1158-L1720
train
saltstack/salt
salt/modules/yumpkg.py
upgrade
def upgrade(name=None, pkgs=None, refresh=True, skip_verify=False, normalize=True, minimal=False, obsoletes=True, **kwargs): ''' Run a full system upgrade (a ``yum upgrade`` or ``dnf upgrade``), or upgrade specified packages...
python
def upgrade(name=None, pkgs=None, refresh=True, skip_verify=False, normalize=True, minimal=False, obsoletes=True, **kwargs): ''' Run a full system upgrade (a ``yum upgrade`` or ``dnf upgrade``), or upgrade specified packages...
[ "def", "upgrade", "(", "name", "=", "None", ",", "pkgs", "=", "None", ",", "refresh", "=", "True", ",", "skip_verify", "=", "False", ",", "normalize", "=", "True", ",", "minimal", "=", "False", ",", "obsoletes", "=", "True", ",", "*", "*", "kwargs", ...
Run a full system upgrade (a ``yum upgrade`` or ``dnf upgrade``), or upgrade specified packages. If the packages aren't installed, they will not be installed. .. versionchanged:: 2014.7.0 .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now ...
[ "Run", "a", "full", "system", "upgrade", "(", "a", "yum", "upgrade", "or", "dnf", "upgrade", ")", "or", "upgrade", "specified", "packages", ".", "If", "the", "packages", "aren", "t", "installed", "they", "will", "not", "be", "installed", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L1723-L1923
train
saltstack/salt
salt/modules/yumpkg.py
update
def update(name=None, pkgs=None, refresh=True, skip_verify=False, normalize=True, minimal=False, obsoletes=False, **kwargs): ''' .. versionadded:: 2019.2.0 Calls :py:func:`pkg.upgrade <salt.modules.yumpkg.upgrade>` with ``obso...
python
def update(name=None, pkgs=None, refresh=True, skip_verify=False, normalize=True, minimal=False, obsoletes=False, **kwargs): ''' .. versionadded:: 2019.2.0 Calls :py:func:`pkg.upgrade <salt.modules.yumpkg.upgrade>` with ``obso...
[ "def", "update", "(", "name", "=", "None", ",", "pkgs", "=", "None", ",", "refresh", "=", "True", ",", "skip_verify", "=", "False", ",", "normalize", "=", "True", ",", "minimal", "=", "False", ",", "obsoletes", "=", "False", ",", "*", "*", "kwargs", ...
.. versionadded:: 2019.2.0 Calls :py:func:`pkg.upgrade <salt.modules.yumpkg.upgrade>` with ``obsoletes=False``. Mirrors the CLI behavior of ``yum update``. See :py:func:`pkg.upgrade <salt.modules.yumpkg.upgrade>` for further documentation. .. code-block:: bash salt '*' pkg.update
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L1926-L1946
train
saltstack/salt
salt/modules/yumpkg.py
remove
def remove(name=None, pkgs=None, **kwargs): # pylint: disable=W0613 ''' .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands which modify installed packages from the ``salt-minion`` daemon's control group. Th...
python
def remove(name=None, pkgs=None, **kwargs): # pylint: disable=W0613 ''' .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands which modify installed packages from the ``salt-minion`` daemon's control group. Th...
[ "def", "remove", "(", "name", "=", "None", ",", "pkgs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=W0613", "try", ":", "pkg_params", "=", "__salt__", "[", "'pkg_resource.parse_targets'", "]", "(", "name", ",", "pkgs", ")", "[", "0...
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands which modify installed packages from the ``salt-minion`` daemon's control group. This is done to keep systemd from killing any yum/dnf commands spawned by S...
[ "..", "versionchanged", "::", "2015", ".", "8", ".", "12", "2016", ".", "3", ".", "3", "2016", ".", "11", ".", "0", "On", "minions", "running", "systemd", ">", "=", "205", "systemd", "-", "run", "(", "1", ")", "_", "is", "now", "used", "to", "i...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L1949-L2033
train
saltstack/salt
salt/modules/yumpkg.py
hold
def hold(name=None, pkgs=None, sources=None, normalize=True, **kwargs): # pylint: disable=W0613 ''' .. versionadded:: 2014.7.0 Version-lock packages .. note:: Requires the appropriate ``versionlock`` plugin package to be installed: - On RHEL 5: ``yum-versionlock`` - On RHEL 6...
python
def hold(name=None, pkgs=None, sources=None, normalize=True, **kwargs): # pylint: disable=W0613 ''' .. versionadded:: 2014.7.0 Version-lock packages .. note:: Requires the appropriate ``versionlock`` plugin package to be installed: - On RHEL 5: ``yum-versionlock`` - On RHEL 6...
[ "def", "hold", "(", "name", "=", "None", ",", "pkgs", "=", "None", ",", "sources", "=", "None", ",", "normalize", "=", "True", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=W0613", "_check_versionlock", "(", ")", "if", "not", "name", "and", "no...
.. versionadded:: 2014.7.0 Version-lock packages .. note:: Requires the appropriate ``versionlock`` plugin package to be installed: - On RHEL 5: ``yum-versionlock`` - On RHEL 6 & 7: ``yum-plugin-versionlock`` - On Fedora: ``python-dnf-plugins-extras-versionlock`` name ...
[ "..", "versionadded", "::", "2014", ".", "7", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L2081-L2164
train
saltstack/salt
salt/modules/yumpkg.py
unhold
def unhold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W0613 ''' .. versionadded:: 2014.7.0 Remove version locks .. note:: Requires the appropriate ``versionlock`` plugin package to be installed: - On RHEL 5: ``yum-versionlock`` - On RHEL 6 & 7: ``yum-plu...
python
def unhold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W0613 ''' .. versionadded:: 2014.7.0 Remove version locks .. note:: Requires the appropriate ``versionlock`` plugin package to be installed: - On RHEL 5: ``yum-versionlock`` - On RHEL 6 & 7: ``yum-plu...
[ "def", "unhold", "(", "name", "=", "None", ",", "pkgs", "=", "None", ",", "sources", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=W0613", "_check_versionlock", "(", ")", "if", "not", "name", "and", "not", "pkgs", "and", "not", "so...
.. versionadded:: 2014.7.0 Remove version locks .. note:: Requires the appropriate ``versionlock`` plugin package to be installed: - On RHEL 5: ``yum-versionlock`` - On RHEL 6 & 7: ``yum-plugin-versionlock`` - On Fedora: ``python-dnf-plugins-extras-versionlock`` name ...
[ "..", "versionadded", "::", "2014", ".", "7", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L2167-L2269
train
saltstack/salt
salt/modules/yumpkg.py
list_holds
def list_holds(pattern=__HOLD_PATTERN, full=True): r''' .. versionchanged:: 2016.3.0,2015.8.4,2015.5.10 Function renamed from ``pkg.get_locked_pkgs`` to ``pkg.list_holds``. List information on locked packages .. note:: Requires the appropriate ``versionlock`` plugin package to be insta...
python
def list_holds(pattern=__HOLD_PATTERN, full=True): r''' .. versionchanged:: 2016.3.0,2015.8.4,2015.5.10 Function renamed from ``pkg.get_locked_pkgs`` to ``pkg.list_holds``. List information on locked packages .. note:: Requires the appropriate ``versionlock`` plugin package to be insta...
[ "def", "list_holds", "(", "pattern", "=", "__HOLD_PATTERN", ",", "full", "=", "True", ")", ":", "_check_versionlock", "(", ")", "out", "=", "__salt__", "[", "'cmd.run'", "]", "(", "[", "_yum", "(", ")", ",", "'versionlock'", ",", "'list'", "]", ",", "p...
r''' .. versionchanged:: 2016.3.0,2015.8.4,2015.5.10 Function renamed from ``pkg.get_locked_pkgs`` to ``pkg.list_holds``. List information on locked packages .. note:: Requires the appropriate ``versionlock`` plugin package to be installed: - On RHEL 5: ``yum-versionlock`` ...
[ "r", "..", "versionchanged", "::", "2016", ".", "3", ".", "0", "2015", ".", "8", ".", "4", "2015", ".", "5", ".", "10", "Function", "renamed", "from", "pkg", ".", "get_locked_pkgs", "to", "pkg", ".", "list_holds", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L2272-L2310
train
saltstack/salt
salt/modules/yumpkg.py
group_list
def group_list(): ''' .. versionadded:: 2014.1.0 Lists all groups known by yum on this system CLI Example: .. code-block:: bash salt '*' pkg.group_list ''' ret = {'installed': [], 'available': [], 'installed environments': [], 'available environme...
python
def group_list(): ''' .. versionadded:: 2014.1.0 Lists all groups known by yum on this system CLI Example: .. code-block:: bash salt '*' pkg.group_list ''' ret = {'installed': [], 'available': [], 'installed environments': [], 'available environme...
[ "def", "group_list", "(", ")", ":", "ret", "=", "{", "'installed'", ":", "[", "]", ",", "'available'", ":", "[", "]", ",", "'installed environments'", ":", "[", "]", ",", "'available environments'", ":", "[", "]", ",", "'available languages'", ":", "{", ...
.. versionadded:: 2014.1.0 Lists all groups known by yum on this system CLI Example: .. code-block:: bash salt '*' pkg.group_list
[ "..", "versionadded", "::", "2014", ".", "1", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L2341-L2395
train
saltstack/salt
salt/modules/yumpkg.py
group_info
def group_info(name, expand=False): ''' .. versionadded:: 2014.1.0 .. versionchanged:: 2016.3.0,2015.8.4,2015.5.10 The return data has changed. A new key ``type`` has been added to distinguish environment groups from package groups. Also, keys for the group name and group ID have bee...
python
def group_info(name, expand=False): ''' .. versionadded:: 2014.1.0 .. versionchanged:: 2016.3.0,2015.8.4,2015.5.10 The return data has changed. A new key ``type`` has been added to distinguish environment groups from package groups. Also, keys for the group name and group ID have bee...
[ "def", "group_info", "(", "name", ",", "expand", "=", "False", ")", ":", "pkgtypes", "=", "(", "'mandatory'", ",", "'optional'", ",", "'default'", ",", "'conditional'", ")", "ret", "=", "{", "}", "for", "pkgtype", "in", "pkgtypes", ":", "ret", "[", "pk...
.. versionadded:: 2014.1.0 .. versionchanged:: 2016.3.0,2015.8.4,2015.5.10 The return data has changed. A new key ``type`` has been added to distinguish environment groups from package groups. Also, keys for the group name and group ID have been added. The ``mandatory packages``, ``o...
[ "..", "versionadded", "::", "2014", ".", "1", ".", "0", "..", "versionchanged", "::", "2016", ".", "3", ".", "0", "2015", ".", "8", ".", "4", "2015", ".", "5", ".", "10", "The", "return", "data", "has", "changed", ".", "A", "new", "key", "type", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L2398-L2490
train
saltstack/salt
salt/modules/yumpkg.py
group_diff
def group_diff(name): ''' .. versionadded:: 2014.1.0 .. versionchanged:: 2016.3.0,2015.8.4,2015.5.10 Environment groups are now supported. The key names have been renamed, similar to the changes made in :py:func:`pkg.group_info <salt.modules.yumpkg.group_info>`. Lists which of a...
python
def group_diff(name): ''' .. versionadded:: 2014.1.0 .. versionchanged:: 2016.3.0,2015.8.4,2015.5.10 Environment groups are now supported. The key names have been renamed, similar to the changes made in :py:func:`pkg.group_info <salt.modules.yumpkg.group_info>`. Lists which of a...
[ "def", "group_diff", "(", "name", ")", ":", "pkgtypes", "=", "(", "'mandatory'", ",", "'optional'", ",", "'default'", ",", "'conditional'", ")", "ret", "=", "{", "}", "for", "pkgtype", "in", "pkgtypes", ":", "ret", "[", "pkgtype", "]", "=", "{", "'inst...
.. versionadded:: 2014.1.0 .. versionchanged:: 2016.3.0,2015.8.4,2015.5.10 Environment groups are now supported. The key names have been renamed, similar to the changes made in :py:func:`pkg.group_info <salt.modules.yumpkg.group_info>`. Lists which of a group's packages are installed an...
[ "..", "versionadded", "::", "2014", ".", "1", ".", "0", "..", "versionchanged", "::", "2016", ".", "3", ".", "0", "2015", ".", "8", ".", "4", "2015", ".", "5", ".", "10", "Environment", "groups", "are", "now", "supported", ".", "The", "key", "names...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L2493-L2523
train
saltstack/salt
salt/modules/yumpkg.py
group_install
def group_install(name, skip=(), include=(), **kwargs): ''' .. versionadded:: 2014.1.0 Install the passed package group(s). This is basically a wrapper around :py:func:`pkg.install <salt.modules.yumpkg.install>`, which performs package group res...
python
def group_install(name, skip=(), include=(), **kwargs): ''' .. versionadded:: 2014.1.0 Install the passed package group(s). This is basically a wrapper around :py:func:`pkg.install <salt.modules.yumpkg.install>`, which performs package group res...
[ "def", "group_install", "(", "name", ",", "skip", "=", "(", ")", ",", "include", "=", "(", ")", ",", "*", "*", "kwargs", ")", ":", "groups", "=", "name", ".", "split", "(", "','", ")", "if", "isinstance", "(", "name", ",", "six", ".", "string_typ...
.. versionadded:: 2014.1.0 Install the passed package group(s). This is basically a wrapper around :py:func:`pkg.install <salt.modules.yumpkg.install>`, which performs package group resolution for the user. This function is currently considered experimental, and should be expected to undergo changes. ...
[ "..", "versionadded", "::", "2014", ".", "1", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L2526-L2617
train
saltstack/salt
salt/modules/yumpkg.py
list_repos
def list_repos(basedir=None, **kwargs): ''' Lists all repos in <basedir> (default: all dirs in `reposdir` yum option). CLI Example: .. code-block:: bash salt '*' pkg.list_repos salt '*' pkg.list_repos basedir=/path/to/dir salt '*' pkg.list_repos basedir=/path/to/dir,/path/to/a...
python
def list_repos(basedir=None, **kwargs): ''' Lists all repos in <basedir> (default: all dirs in `reposdir` yum option). CLI Example: .. code-block:: bash salt '*' pkg.list_repos salt '*' pkg.list_repos basedir=/path/to/dir salt '*' pkg.list_repos basedir=/path/to/dir,/path/to/a...
[ "def", "list_repos", "(", "basedir", "=", "None", ",", "*", "*", "kwargs", ")", ":", "basedirs", "=", "_normalize_basedir", "(", "basedir", ")", "repos", "=", "{", "}", "log", ".", "debug", "(", "'Searching for repos in %s'", ",", "basedirs", ")", "for", ...
Lists all repos in <basedir> (default: all dirs in `reposdir` yum option). CLI Example: .. code-block:: bash salt '*' pkg.list_repos salt '*' pkg.list_repos basedir=/path/to/dir salt '*' pkg.list_repos basedir=/path/to/dir,/path/to/another/dir
[ "Lists", "all", "repos", "in", "<basedir", ">", "(", "default", ":", "all", "dirs", "in", "reposdir", "yum", "option", ")", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L2623-L2651
train
saltstack/salt
salt/modules/yumpkg.py
get_repo
def get_repo(name, basedir=None, **kwargs): # pylint: disable=W0613 ''' Display a repo from <basedir> (default basedir: all dirs in ``reposdir`` yum option). CLI Examples: .. code-block:: bash salt '*' pkg.get_repo myrepo salt '*' pkg.get_repo myrepo basedir=/path/to/dir ...
python
def get_repo(name, basedir=None, **kwargs): # pylint: disable=W0613 ''' Display a repo from <basedir> (default basedir: all dirs in ``reposdir`` yum option). CLI Examples: .. code-block:: bash salt '*' pkg.get_repo myrepo salt '*' pkg.get_repo myrepo basedir=/path/to/dir ...
[ "def", "get_repo", "(", "name", ",", "basedir", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=W0613", "repos", "=", "list_repos", "(", "basedir", ")", "# Find out what file the repo lives in", "repofile", "=", "''", "for", "repo", "in", "r...
Display a repo from <basedir> (default basedir: all dirs in ``reposdir`` yum option). CLI Examples: .. code-block:: bash salt '*' pkg.get_repo myrepo salt '*' pkg.get_repo myrepo basedir=/path/to/dir salt '*' pkg.get_repo myrepo basedir=/path/to/dir,/path/to/another/dir
[ "Display", "a", "repo", "from", "<basedir", ">", "(", "default", "basedir", ":", "all", "dirs", "in", "reposdir", "yum", "option", ")", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L2654-L2679
train
saltstack/salt
salt/modules/yumpkg.py
del_repo
def del_repo(repo, basedir=None, **kwargs): # pylint: disable=W0613 ''' Delete a repo from <basedir> (default basedir: all dirs in `reposdir` yum option). If the .repo file in which the repo exists does not contain any other repo configuration, the file itself will be deleted. CLI Examples: ...
python
def del_repo(repo, basedir=None, **kwargs): # pylint: disable=W0613 ''' Delete a repo from <basedir> (default basedir: all dirs in `reposdir` yum option). If the .repo file in which the repo exists does not contain any other repo configuration, the file itself will be deleted. CLI Examples: ...
[ "def", "del_repo", "(", "repo", ",", "basedir", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=W0613", "# this is so we know which dirs are searched for our error messages below", "basedirs", "=", "_normalize_basedir", "(", "basedir", ")", "repos", "...
Delete a repo from <basedir> (default basedir: all dirs in `reposdir` yum option). If the .repo file in which the repo exists does not contain any other repo configuration, the file itself will be deleted. CLI Examples: .. code-block:: bash salt '*' pkg.del_repo myrepo salt '*' p...
[ "Delete", "a", "repo", "from", "<basedir", ">", "(", "default", "basedir", ":", "all", "dirs", "in", "reposdir", "yum", "option", ")", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L2682-L2745
train
saltstack/salt
salt/modules/yumpkg.py
mod_repo
def mod_repo(repo, basedir=None, **kwargs): ''' Modify one or more values for a repo. If the repo does not exist, it will be created, so long as the following values are specified: repo name by which the yum refers to the repo name a human-readable name for the repo baseurl ...
python
def mod_repo(repo, basedir=None, **kwargs): ''' Modify one or more values for a repo. If the repo does not exist, it will be created, so long as the following values are specified: repo name by which the yum refers to the repo name a human-readable name for the repo baseurl ...
[ "def", "mod_repo", "(", "repo", ",", "basedir", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# Filter out '__pub' arguments, as well as saltenv", "repo_opts", "=", "dict", "(", "(", "x", ",", "kwargs", "[", "x", "]", ")", "for", "x", "in", "kwargs", ...
Modify one or more values for a repo. If the repo does not exist, it will be created, so long as the following values are specified: repo name by which the yum refers to the repo name a human-readable name for the repo baseurl the URL for yum to reference mirrorlist ...
[ "Modify", "one", "or", "more", "values", "for", "a", "repo", ".", "If", "the", "repo", "does", "not", "exist", "it", "will", "be", "created", "so", "long", "as", "the", "following", "values", "are", "specified", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L2748-L2903
train
saltstack/salt
salt/modules/yumpkg.py
_parse_repo_file
def _parse_repo_file(filename): ''' Turn a single repo file into a dict ''' parsed = configparser.ConfigParser() config = {} try: parsed.read(filename) except configparser.MissingSectionHeaderError as err: log.error( 'Failed to parse file %s, error: %s', ...
python
def _parse_repo_file(filename): ''' Turn a single repo file into a dict ''' parsed = configparser.ConfigParser() config = {} try: parsed.read(filename) except configparser.MissingSectionHeaderError as err: log.error( 'Failed to parse file %s, error: %s', ...
[ "def", "_parse_repo_file", "(", "filename", ")", ":", "parsed", "=", "configparser", ".", "ConfigParser", "(", ")", "config", "=", "{", "}", "try", ":", "parsed", ".", "read", "(", "filename", ")", "except", "configparser", ".", "MissingSectionHeaderError", ...
Turn a single repo file into a dict
[ "Turn", "a", "single", "repo", "file", "into", "a", "dict" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L2906-L2952
train
saltstack/salt
salt/modules/yumpkg.py
owner
def owner(*paths, **kwargs): ''' .. versionadded:: 2014.7.0 Return the name of the package that owns the file. Multiple file paths can be passed. Like :mod:`pkg.version <salt.modules.yumpkg.version>`, if a single path is passed, a string will be returned, and if multiple paths are passed, a dic...
python
def owner(*paths, **kwargs): ''' .. versionadded:: 2014.7.0 Return the name of the package that owns the file. Multiple file paths can be passed. Like :mod:`pkg.version <salt.modules.yumpkg.version>`, if a single path is passed, a string will be returned, and if multiple paths are passed, a dic...
[ "def", "owner", "(", "*", "paths", ",", "*", "*", "kwargs", ")", ":", "if", "not", "paths", ":", "return", "''", "ret", "=", "{", "}", "cmd_prefix", "=", "[", "'rpm'", ",", "'-qf'", ",", "'--queryformat'", ",", "'%{name}'", "]", "for", "path", "in"...
.. versionadded:: 2014.7.0 Return the name of the package that owns the file. Multiple file paths can be passed. Like :mod:`pkg.version <salt.modules.yumpkg.version>`, if a single path is passed, a string will be returned, and if multiple paths are passed, a dictionary of file/package name pairs will b...
[ "..", "versionadded", "::", "2014", ".", "7", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L2993-L3026
train
saltstack/salt
salt/modules/yumpkg.py
download
def download(*packages, **kwargs): ''' .. versionadded:: 2015.5.0 Download packages to the local disk. Requires ``yumdownloader`` from ``yum-utils`` package. .. note:: ``yum-utils`` will already be installed on the minion if the package was installed from the Fedora / EPEL reposit...
python
def download(*packages, **kwargs): ''' .. versionadded:: 2015.5.0 Download packages to the local disk. Requires ``yumdownloader`` from ``yum-utils`` package. .. note:: ``yum-utils`` will already be installed on the minion if the package was installed from the Fedora / EPEL reposit...
[ "def", "download", "(", "*", "packages", ",", "*", "*", "kwargs", ")", ":", "if", "not", "packages", ":", "raise", "SaltInvocationError", "(", "'No packages were specified'", ")", "CACHE_DIR", "=", "'/var/cache/yum/packages'", "if", "not", "os", ".", "path", "...
.. versionadded:: 2015.5.0 Download packages to the local disk. Requires ``yumdownloader`` from ``yum-utils`` package. .. note:: ``yum-utils`` will already be installed on the minion if the package was installed from the Fedora / EPEL repositories. CLI example: .. code-block:: b...
[ "..", "versionadded", "::", "2015", ".", "5", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L3081-L3150
train
saltstack/salt
salt/modules/yumpkg.py
diff
def diff(*paths, **kwargs): ''' Return a formatted diff between current files and original in a package. NOTE: this function includes all files (configuration and not), but does not work on binary content. :param path: Full path to the installed file :return: Difference string or raises and exc...
python
def diff(*paths, **kwargs): ''' Return a formatted diff between current files and original in a package. NOTE: this function includes all files (configuration and not), but does not work on binary content. :param path: Full path to the installed file :return: Difference string or raises and exc...
[ "def", "diff", "(", "*", "paths", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "}", "pkg_to_paths", "=", "{", "}", "for", "pth", "in", "paths", ":", "pth_pkg", "=", "__salt__", "[", "'lowpkg.owner'", "]", "(", "pth", ")", "if", "not", "pth...
Return a formatted diff between current files and original in a package. NOTE: this function includes all files (configuration and not), but does not work on binary content. :param path: Full path to the installed file :return: Difference string or raises and exception if examined file is binary. ...
[ "Return", "a", "formatted", "diff", "between", "current", "files", "and", "original", "in", "a", "package", ".", "NOTE", ":", "this", "function", "includes", "all", "files", "(", "configuration", "and", "not", ")", "but", "does", "not", "work", "on", "bina...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L3153-L3187
train
saltstack/salt
salt/modules/yumpkg.py
_get_patches
def _get_patches(installed_only=False): ''' List all known patches in repos. ''' patches = {} cmd = [_yum(), '--quiet', 'updateinfo', 'list', 'all'] ret = __salt__['cmd.run_stdout']( cmd, python_shell=False ) for line in salt.utils.itertools.split(ret, os.linesep): ...
python
def _get_patches(installed_only=False): ''' List all known patches in repos. ''' patches = {} cmd = [_yum(), '--quiet', 'updateinfo', 'list', 'all'] ret = __salt__['cmd.run_stdout']( cmd, python_shell=False ) for line in salt.utils.itertools.split(ret, os.linesep): ...
[ "def", "_get_patches", "(", "installed_only", "=", "False", ")", ":", "patches", "=", "{", "}", "cmd", "=", "[", "_yum", "(", ")", ",", "'--quiet'", ",", "'updateinfo'", ",", "'list'", ",", "'all'", "]", "ret", "=", "__salt__", "[", "'cmd.run_stdout'", ...
List all known patches in repos.
[ "List", "all", "known", "patches", "in", "repos", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L3190-L3210
train
saltstack/salt
salt/modules/yumpkg.py
complete_transaction
def complete_transaction(cleanup_only=False, recursive=False, max_attempts=3): ''' .. versionadded:: Fluorine Execute ``yum-complete-transaction``, which is provided by the ``yum-utils`` package. cleanup_only Specify if the ``--cleanup-only`` option should be supplied. recursive S...
python
def complete_transaction(cleanup_only=False, recursive=False, max_attempts=3): ''' .. versionadded:: Fluorine Execute ``yum-complete-transaction``, which is provided by the ``yum-utils`` package. cleanup_only Specify if the ``--cleanup-only`` option should be supplied. recursive S...
[ "def", "complete_transaction", "(", "cleanup_only", "=", "False", ",", "recursive", "=", "False", ",", "max_attempts", "=", "3", ")", ":", "return", "_complete_transaction", "(", "cleanup_only", ",", "recursive", ",", "max_attempts", ",", "1", ",", "[", "]", ...
.. versionadded:: Fluorine Execute ``yum-complete-transaction``, which is provided by the ``yum-utils`` package. cleanup_only Specify if the ``--cleanup-only`` option should be supplied. recursive Specify if ``yum-complete-transaction`` should be called recursively (it only comple...
[ "..", "versionadded", "::", "Fluorine" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L3252-L3286
train
saltstack/salt
salt/modules/yumpkg.py
_complete_transaction
def _complete_transaction(cleanup_only, recursive, max_attempts, run_count, cmd_ret_list): ''' .. versionadded:: Fluorine Called from ``complete_transaction`` to protect the arguments used for tail recursion, ``run_count`` and ``cmd_ret_list``. ''' cmd = ['yum-complete-transaction'] if cle...
python
def _complete_transaction(cleanup_only, recursive, max_attempts, run_count, cmd_ret_list): ''' .. versionadded:: Fluorine Called from ``complete_transaction`` to protect the arguments used for tail recursion, ``run_count`` and ``cmd_ret_list``. ''' cmd = ['yum-complete-transaction'] if cle...
[ "def", "_complete_transaction", "(", "cleanup_only", ",", "recursive", ",", "max_attempts", ",", "run_count", ",", "cmd_ret_list", ")", ":", "cmd", "=", "[", "'yum-complete-transaction'", "]", "if", "cleanup_only", ":", "cmd", ".", "append", "(", "'--cleanup-only'...
.. versionadded:: Fluorine Called from ``complete_transaction`` to protect the arguments used for tail recursion, ``run_count`` and ``cmd_ret_list``.
[ "..", "versionadded", "::", "Fluorine" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/yumpkg.py#L3289-L3320
train
saltstack/salt
salt/states/boto_route53.py
present
def present(name, value, zone, record_type, ttl=None, identifier=None, region=None, key=None, keyid=None, profile=None, wait_for_sync=True, split_dns=False, private_zone=False): ''' Ensure the Route53 record is present. name Name of the record. value Value of the record. A...
python
def present(name, value, zone, record_type, ttl=None, identifier=None, region=None, key=None, keyid=None, profile=None, wait_for_sync=True, split_dns=False, private_zone=False): ''' Ensure the Route53 record is present. name Name of the record. value Value of the record. A...
[ "def", "present", "(", "name", ",", "value", ",", "zone", ",", "record_type", ",", "ttl", "=", "None", ",", "identifier", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ",",...
Ensure the Route53 record is present. name Name of the record. value Value of the record. As a special case, you can pass in: `private:<Name tag>` to have the function autodetermine the private IP `public:<Name tag>` to have the function autodetermine the public IP ...
[ "Ensure", "the", "Route53", "record", "is", "present", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_route53.py#L99-L256
train
saltstack/salt
salt/states/boto_route53.py
absent
def absent( name, zone, record_type, identifier=None, region=None, key=None, keyid=None, profile=None, wait_for_sync=True, split_dns=False, private_zone=False): ''' Ensure the Route53 record is deleted. name Nam...
python
def absent( name, zone, record_type, identifier=None, region=None, key=None, keyid=None, profile=None, wait_for_sync=True, split_dns=False, private_zone=False): ''' Ensure the Route53 record is deleted. name Nam...
[ "def", "absent", "(", "name", ",", "zone", ",", "record_type", ",", "identifier", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ",", "wait_for_sync", "=", "True", ",", "split...
Ensure the Route53 record is deleted. name Name of the record. zone The zone to delete the record from. record_type The record type (A, NS, MX, TXT, etc.) identifier An identifier to match for deletion. region The region to connect to. key Se...
[ "Ensure", "the", "Route53", "record", "is", "deleted", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_route53.py#L263-L341
train
saltstack/salt
salt/states/boto_route53.py
hosted_zone_present
def hosted_zone_present(name, domain_name=None, private_zone=False, caller_ref=None, comment='', vpc_id=None, vpc_name=None, vpc_region=None, region=None, key=None, keyid=None, profile=None): ''' Ensure a hosted zone exists with the given attributes. Note that mos...
python
def hosted_zone_present(name, domain_name=None, private_zone=False, caller_ref=None, comment='', vpc_id=None, vpc_name=None, vpc_region=None, region=None, key=None, keyid=None, profile=None): ''' Ensure a hosted zone exists with the given attributes. Note that mos...
[ "def", "hosted_zone_present", "(", "name", ",", "domain_name", "=", "None", ",", "private_zone", "=", "False", ",", "caller_ref", "=", "None", ",", "comment", "=", "''", ",", "vpc_id", "=", "None", ",", "vpc_name", "=", "None", ",", "vpc_region", "=", "N...
Ensure a hosted zone exists with the given attributes. Note that most things cannot be modified once a zone is created - it must be deleted and re-spun to update these attributes: - private_zone (AWS API limitation). - comment (the appropriate call exists in the AWS API and in boto3, but has not,...
[ "Ensure", "a", "hosted", "zone", "exists", "with", "the", "given", "attributes", ".", "Note", "that", "most", "things", "cannot", "be", "modified", "once", "a", "zone", "is", "created", "-", "it", "must", "be", "deleted", "and", "re", "-", "spun", "to", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_route53.py#L344-L489
train
saltstack/salt
salt/states/boto_route53.py
hosted_zone_absent
def hosted_zone_absent(name, domain_name=None, region=None, key=None, keyid=None, profile=None): ''' Ensure the Route53 Hostes Zone described is absent name The name of the state definition. domain_name The FQDN (including final period) of the zone you wish absen...
python
def hosted_zone_absent(name, domain_name=None, region=None, key=None, keyid=None, profile=None): ''' Ensure the Route53 Hostes Zone described is absent name The name of the state definition. domain_name The FQDN (including final period) of the zone you wish absen...
[ "def", "hosted_zone_absent", "(", "name", ",", "domain_name", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "domain_name", "=", "domain_name", "if", "domain_name", "els...
Ensure the Route53 Hostes Zone described is absent name The name of the state definition. domain_name The FQDN (including final period) of the zone you wish absent. If not provided, the value of name will be used.
[ "Ensure", "the", "Route53", "Hostes", "Zone", "described", "is", "absent" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_route53.py#L492-L532
train
saltstack/salt
salt/utils/ssdp.py
SSDPBase.get_self_ip
def get_self_ip(): ''' Find out localhost outside IP. :return: ''' sck = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: sck.connect(('1.255.255.255', 1)) # Does not needs to be reachable ip_addr = sck.getsockname()[0] except Except...
python
def get_self_ip(): ''' Find out localhost outside IP. :return: ''' sck = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: sck.connect(('1.255.255.255', 1)) # Does not needs to be reachable ip_addr = sck.getsockname()[0] except Except...
[ "def", "get_self_ip", "(", ")", ":", "sck", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_DGRAM", ")", "try", ":", "sck", ".", "connect", "(", "(", "'1.255.255.255'", ",", "1", ")", ")", "# Does not needs to be re...
Find out localhost outside IP. :return:
[ "Find", "out", "localhost", "outside", "IP", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/ssdp.py#L89-L103
train
saltstack/salt
salt/utils/ssdp.py
SSDPFactory._sendto
def _sendto(self, data, addr=None, attempts=10): ''' On multi-master environments, running on the same machine, transport sending to the destination can be allowed only at once. Since every machine will immediately respond, high chance to get sending fired at the same time, which...
python
def _sendto(self, data, addr=None, attempts=10): ''' On multi-master environments, running on the same machine, transport sending to the destination can be allowed only at once. Since every machine will immediately respond, high chance to get sending fired at the same time, which...
[ "def", "_sendto", "(", "self", ",", "data", ",", "addr", "=", "None", ",", "attempts", "=", "10", ")", ":", "tries", "=", "0", "slp_time", "=", "lambda", ":", "0.5", "/", "random", ".", "randint", "(", "10", ",", "30", ")", "slp", "=", "slp_time"...
On multi-master environments, running on the same machine, transport sending to the destination can be allowed only at once. Since every machine will immediately respond, high chance to get sending fired at the same time, which will result to a PermissionError at socket level. We are att...
[ "On", "multi", "-", "master", "environments", "running", "on", "the", "same", "machine", "transport", "sending", "to", "the", "destination", "can", "be", "allowed", "only", "at", "once", ".", "Since", "every", "machine", "will", "immediately", "respond", "high...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/ssdp.py#L141-L165
train
saltstack/salt
salt/utils/ssdp.py
SSDPFactory.datagram_received
def datagram_received(self, data, addr): ''' On datagram receive. :param data: :param addr: :return: ''' message = salt.utils.stringutils.to_unicode(data) if message.startswith(self.signature): try: timestamp = float(message[le...
python
def datagram_received(self, data, addr): ''' On datagram receive. :param data: :param addr: :return: ''' message = salt.utils.stringutils.to_unicode(data) if message.startswith(self.signature): try: timestamp = float(message[le...
[ "def", "datagram_received", "(", "self", ",", "data", ",", "addr", ")", ":", "message", "=", "salt", ".", "utils", ".", "stringutils", ".", "to_unicode", "(", "data", ")", "if", "message", ".", "startswith", "(", "self", ".", "signature", ")", ":", "tr...
On datagram receive. :param data: :param addr: :return:
[ "On", "datagram", "receive", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/ssdp.py#L167-L210
train
saltstack/salt
salt/utils/ssdp.py
SSDPDiscoveryServer.create_datagram_endpoint
def create_datagram_endpoint(loop, protocol_factory, local_addr=None, remote_addr=None, family=0, proto=0, flags=0): ''' Create datagram connection. Based on code from Python 3.5 version, this method is used only in Python 2.7+ versions, since Trollius library did not ported UDP...
python
def create_datagram_endpoint(loop, protocol_factory, local_addr=None, remote_addr=None, family=0, proto=0, flags=0): ''' Create datagram connection. Based on code from Python 3.5 version, this method is used only in Python 2.7+ versions, since Trollius library did not ported UDP...
[ "def", "create_datagram_endpoint", "(", "loop", ",", "protocol_factory", ",", "local_addr", "=", "None", ",", "remote_addr", "=", "None", ",", "family", "=", "0", ",", "proto", "=", "0", ",", "flags", "=", "0", ")", ":", "if", "not", "(", "local_addr", ...
Create datagram connection. Based on code from Python 3.5 version, this method is used only in Python 2.7+ versions, since Trollius library did not ported UDP packets broadcast.
[ "Create", "datagram", "connection", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/ssdp.py#L238-L305
train
saltstack/salt
salt/utils/ssdp.py
SSDPDiscoveryServer.run
def run(self): ''' Run server. :return: ''' listen_ip = self._config.get(self.LISTEN_IP, self.DEFAULTS[self.LISTEN_IP]) port = self._config.get(self.PORT, self.DEFAULTS[self.PORT]) self.log.info('Starting service discovery listener on udp://%s:%s', listen_ip, port...
python
def run(self): ''' Run server. :return: ''' listen_ip = self._config.get(self.LISTEN_IP, self.DEFAULTS[self.LISTEN_IP]) port = self._config.get(self.PORT, self.DEFAULTS[self.PORT]) self.log.info('Starting service discovery listener on udp://%s:%s', listen_ip, port...
[ "def", "run", "(", "self", ")", ":", "listen_ip", "=", "self", ".", "_config", ".", "get", "(", "self", ".", "LISTEN_IP", ",", "self", ".", "DEFAULTS", "[", "self", ".", "LISTEN_IP", "]", ")", "port", "=", "self", ".", "_config", ".", "get", "(", ...
Run server. :return:
[ "Run", "server", ".", ":", "return", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/ssdp.py#L307-L328
train
saltstack/salt
salt/utils/ssdp.py
SSDPDiscoveryClient._query
def _query(self): ''' Query the broadcast for defined services. :return: ''' query = salt.utils.stringutils.to_bytes( "{}{}".format(self.signature, time.time())) self._socket.sendto(query, ('<broadcast>', self.port)) return query
python
def _query(self): ''' Query the broadcast for defined services. :return: ''' query = salt.utils.stringutils.to_bytes( "{}{}".format(self.signature, time.time())) self._socket.sendto(query, ('<broadcast>', self.port)) return query
[ "def", "_query", "(", "self", ")", ":", "query", "=", "salt", ".", "utils", ".", "stringutils", ".", "to_bytes", "(", "\"{}{}\"", ".", "format", "(", "self", ".", "signature", ",", "time", ".", "time", "(", ")", ")", ")", "self", ".", "_socket", "....
Query the broadcast for defined services. :return:
[ "Query", "the", "broadcast", "for", "defined", "services", ".", ":", "return", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/ssdp.py#L355-L364
train
saltstack/salt
salt/utils/ssdp.py
SSDPDiscoveryClient._collect_masters_map
def _collect_masters_map(self, response): ''' Collect masters map from the network. :return: ''' while True: try: data, addr = self._socket.recvfrom(0x400) if data: if addr not in response: re...
python
def _collect_masters_map(self, response): ''' Collect masters map from the network. :return: ''' while True: try: data, addr = self._socket.recvfrom(0x400) if data: if addr not in response: re...
[ "def", "_collect_masters_map", "(", "self", ",", "response", ")", ":", "while", "True", ":", "try", ":", "data", ",", "addr", "=", "self", ".", "_socket", ".", "recvfrom", "(", "0x400", ")", "if", "data", ":", "if", "addr", "not", "in", "response", "...
Collect masters map from the network. :return:
[ "Collect", "masters", "map", "from", "the", "network", ".", ":", "return", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/ssdp.py#L366-L383
train
saltstack/salt
salt/utils/ssdp.py
SSDPDiscoveryClient.discover
def discover(self): ''' Gather the information of currently declared servers. :return: ''' response = {} masters = {} self.log.info("Looking for a server discovery") self._query() self._collect_masters_map(response) if not response: ...
python
def discover(self): ''' Gather the information of currently declared servers. :return: ''' response = {} masters = {} self.log.info("Looking for a server discovery") self._query() self._collect_masters_map(response) if not response: ...
[ "def", "discover", "(", "self", ")", ":", "response", "=", "{", "}", "masters", "=", "{", "}", "self", ".", "log", ".", "info", "(", "\"Looking for a server discovery\"", ")", "self", ".", "_query", "(", ")", "self", ".", "_collect_masters_map", "(", "re...
Gather the information of currently declared servers. :return:
[ "Gather", "the", "information", "of", "currently", "declared", "servers", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/ssdp.py#L385-L423
train
saltstack/salt
salt/states/zabbix_user.py
admin_password_present
def admin_password_present(name, password=None, **kwargs): ''' Initial change of Zabbix Admin password to password taken from one of the sources (only the most prioritized one): 1. 'password' parameter 2. '_connection_password' parameter 3. pillar 'zabbix.password' setting 1) Tries ...
python
def admin_password_present(name, password=None, **kwargs): ''' Initial change of Zabbix Admin password to password taken from one of the sources (only the most prioritized one): 1. 'password' parameter 2. '_connection_password' parameter 3. pillar 'zabbix.password' setting 1) Tries ...
[ "def", "admin_password_present", "(", "name", ",", "password", "=", "None", ",", "*", "*", "kwargs", ")", ":", "dry_run", "=", "__opts__", "[", "'test'", "]", "default_zabbix_user", "=", "'Admin'", "default_zabbix_password", "=", "'zabbix'", "ret", "=", "{", ...
Initial change of Zabbix Admin password to password taken from one of the sources (only the most prioritized one): 1. 'password' parameter 2. '_connection_password' parameter 3. pillar 'zabbix.password' setting 1) Tries to log in as Admin with password found in state password parameter or _...
[ "Initial", "change", "of", "Zabbix", "Admin", "password", "to", "password", "taken", "from", "one", "of", "the", "sources", "(", "only", "the", "most", "prioritized", "one", ")", ":", "1", ".", "password", "parameter", "2", ".", "_connection_password", "para...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_user.py#L27-L118
train
saltstack/salt
salt/states/zabbix_user.py
present
def present(alias, passwd, usrgrps, medias=None, password_reset=False, **kwargs): ''' Ensures that the user exists, eventually creates new user. NOTE: use argument firstname instead of name to not mess values with name from salt sls. .. versionadded:: 2016.3.0 :param alias: user alias :param p...
python
def present(alias, passwd, usrgrps, medias=None, password_reset=False, **kwargs): ''' Ensures that the user exists, eventually creates new user. NOTE: use argument firstname instead of name to not mess values with name from salt sls. .. versionadded:: 2016.3.0 :param alias: user alias :param p...
[ "def", "present", "(", "alias", ",", "passwd", ",", "usrgrps", ",", "medias", "=", "None", ",", "password_reset", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "medias", "is", "None", ":", "medias", "=", "[", "]", "connection_args", "=", "{"...
Ensures that the user exists, eventually creates new user. NOTE: use argument firstname instead of name to not mess values with name from salt sls. .. versionadded:: 2016.3.0 :param alias: user alias :param passwd: user's password :param usrgrps: user groups to add the user to :param medias: O...
[ "Ensures", "that", "the", "user", "exists", "eventually", "creates", "new", "user", ".", "NOTE", ":", "use", "argument", "firstname", "instead", "of", "name", "to", "not", "mess", "values", "with", "name", "from", "salt", "sls", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_user.py#L121-L352
train
saltstack/salt
salt/states/zabbix_user.py
absent
def absent(name, **kwargs): ''' Ensures that the user does not exist, eventually delete user. .. versionadded:: 2016.3.0 :param name: user alias :param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring) :param _connection_password: Optional - z...
python
def absent(name, **kwargs): ''' Ensures that the user does not exist, eventually delete user. .. versionadded:: 2016.3.0 :param name: user alias :param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring) :param _connection_password: Optional - z...
[ "def", "absent", "(", "name", ",", "*", "*", "kwargs", ")", ":", "connection_args", "=", "{", "}", "if", "'_connection_user'", "in", "kwargs", ":", "connection_args", "[", "'_connection_user'", "]", "=", "kwargs", "[", "'_connection_user'", "]", "if", "'_con...
Ensures that the user does not exist, eventually delete user. .. versionadded:: 2016.3.0 :param name: user alias :param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring) :param _connection_password: Optional - zabbix password (can also be set in opts ...
[ "Ensures", "that", "the", "user", "does", "not", "exist", "eventually", "delete", "user", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_user.py#L355-L421
train
saltstack/salt
salt/utils/pushover.py
query
def query(function, token=None, api_version='1', method='POST', header_dict=None, data=None, query_params=None, opts=None): ''' PushOver object method function to construct and execute on the API URL. :param token: The PushOver api...
python
def query(function, token=None, api_version='1', method='POST', header_dict=None, data=None, query_params=None, opts=None): ''' PushOver object method function to construct and execute on the API URL. :param token: The PushOver api...
[ "def", "query", "(", "function", ",", "token", "=", "None", ",", "api_version", "=", "'1'", ",", "method", "=", "'POST'", ",", "header_dict", "=", "None", ",", "data", "=", "None", ",", "query_params", "=", "None", ",", "opts", "=", "None", ")", ":",...
PushOver object method function to construct and execute on the API URL. :param token: The PushOver api key. :param api_version: The PushOver API version to use, defaults to version 1. :param function: The PushOver api function to perform. :param method: The HTTP method, e.g. GET or POST....
[ "PushOver", "object", "method", "function", "to", "construct", "and", "execute", "on", "the", "API", "URL", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pushover.py#L32-L110
train
saltstack/salt
salt/utils/pushover.py
validate_sound
def validate_sound(sound, token): ''' Send a message to a Pushover user or group. :param sound: The sound that we want to verify :param token: The PushOver token. ''' ret = { 'message': 'Sound is invalid', 'res': False } param...
python
def validate_sound(sound, token): ''' Send a message to a Pushover user or group. :param sound: The sound that we want to verify :param token: The PushOver token. ''' ret = { 'message': 'Sound is invalid', 'res': False } param...
[ "def", "validate_sound", "(", "sound", ",", "token", ")", ":", "ret", "=", "{", "'message'", ":", "'Sound is invalid'", ",", "'res'", ":", "False", "}", "parameters", "=", "dict", "(", ")", "parameters", "[", "'token'", "]", "=", "token", "response", "="...
Send a message to a Pushover user or group. :param sound: The sound that we want to verify :param token: The PushOver token.
[ "Send", "a", "message", "to", "a", "Pushover", "user", "or", "group", ".", ":", "param", "sound", ":", "The", "sound", "that", "we", "want", "to", "verify", ":", "param", "token", ":", "The", "PushOver", "token", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pushover.py#L113-L145
train
saltstack/salt
salt/utils/pushover.py
validate_user
def validate_user(user, device, token): ''' Send a message to a Pushover user or group. :param user: The user or group name, either will work. :param device: The device for the user. :param token: The PushOver token. ''' res = { ...
python
def validate_user(user, device, token): ''' Send a message to a Pushover user or group. :param user: The user or group name, either will work. :param device: The device for the user. :param token: The PushOver token. ''' res = { ...
[ "def", "validate_user", "(", "user", ",", "device", ",", "token", ")", ":", "res", "=", "{", "'message'", ":", "'User key is invalid'", ",", "'result'", ":", "False", "}", "parameters", "=", "dict", "(", ")", "parameters", "[", "'user'", "]", "=", "user"...
Send a message to a Pushover user or group. :param user: The user or group name, either will work. :param device: The device for the user. :param token: The PushOver token.
[ "Send", "a", "message", "to", "a", "Pushover", "user", "or", "group", ".", ":", "param", "user", ":", "The", "user", "or", "group", "name", "either", "will", "work", ".", ":", "param", "device", ":", "The", "device", "for", "the", "user", ".", ":", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pushover.py#L148-L183
train
saltstack/salt
salt/modules/inspectlib/collector.py
is_alive
def is_alive(pidfile): ''' Check if PID is still alive. ''' try: with salt.utils.files.fopen(pidfile) as fp_: os.kill(int(fp_.read().strip()), 0) return True except Exception as ex: if os.access(pidfile, os.W_OK) and os.path.isfile(pidfile): os.unlink(...
python
def is_alive(pidfile): ''' Check if PID is still alive. ''' try: with salt.utils.files.fopen(pidfile) as fp_: os.kill(int(fp_.read().strip()), 0) return True except Exception as ex: if os.access(pidfile, os.W_OK) and os.path.isfile(pidfile): os.unlink(...
[ "def", "is_alive", "(", "pidfile", ")", ":", "try", ":", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "pidfile", ")", "as", "fp_", ":", "os", ".", "kill", "(", "int", "(", "fp_", ".", "read", "(", ")", ".", "strip", "(", ")", ...
Check if PID is still alive.
[ "Check", "if", "PID", "is", "still", "alive", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/collector.py#L475-L486
train
saltstack/salt
salt/modules/inspectlib/collector.py
main
def main(dbfile, pidfile, mode): ''' Main analyzer routine. ''' Inspector(dbfile, pidfile).reuse_snapshot().snapshot(mode)
python
def main(dbfile, pidfile, mode): ''' Main analyzer routine. ''' Inspector(dbfile, pidfile).reuse_snapshot().snapshot(mode)
[ "def", "main", "(", "dbfile", ",", "pidfile", ",", "mode", ")", ":", "Inspector", "(", "dbfile", ",", "pidfile", ")", ".", "reuse_snapshot", "(", ")", ".", "snapshot", "(", "mode", ")" ]
Main analyzer routine.
[ "Main", "analyzer", "routine", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/collector.py#L489-L493
train
saltstack/salt
salt/modules/inspectlib/collector.py
Inspector._syscall
def _syscall(self, command, input=None, env=None, *params): ''' Call an external system command. ''' return Popen([command] + list(params), stdout=PIPE, stdin=PIPE, stderr=STDOUT, env=env or os.environ).communicate(input=input)
python
def _syscall(self, command, input=None, env=None, *params): ''' Call an external system command. ''' return Popen([command] + list(params), stdout=PIPE, stdin=PIPE, stderr=STDOUT, env=env or os.environ).communicate(input=input)
[ "def", "_syscall", "(", "self", ",", "command", ",", "input", "=", "None", ",", "env", "=", "None", ",", "*", "params", ")", ":", "return", "Popen", "(", "[", "command", "]", "+", "list", "(", "params", ")", ",", "stdout", "=", "PIPE", ",", "stdi...
Call an external system command.
[ "Call", "an", "external", "system", "command", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/collector.py#L77-L82
train
saltstack/salt
salt/modules/inspectlib/collector.py
Inspector._get_cfg_pkgs
def _get_cfg_pkgs(self): ''' Package scanner switcher between the platforms. :return: ''' if self.grains_core.os_data().get('os_family') == 'Debian': return self.__get_cfg_pkgs_dpkg() elif self.grains_core.os_data().get('os_family') in ['Suse', 'redhat']: ...
python
def _get_cfg_pkgs(self): ''' Package scanner switcher between the platforms. :return: ''' if self.grains_core.os_data().get('os_family') == 'Debian': return self.__get_cfg_pkgs_dpkg() elif self.grains_core.os_data().get('os_family') in ['Suse', 'redhat']: ...
[ "def", "_get_cfg_pkgs", "(", "self", ")", ":", "if", "self", ".", "grains_core", ".", "os_data", "(", ")", ".", "get", "(", "'os_family'", ")", "==", "'Debian'", ":", "return", "self", ".", "__get_cfg_pkgs_dpkg", "(", ")", "elif", "self", ".", "grains_co...
Package scanner switcher between the platforms. :return:
[ "Package", "scanner", "switcher", "between", "the", "platforms", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/collector.py#L84-L95
train
saltstack/salt
salt/modules/inspectlib/collector.py
Inspector.__get_cfg_pkgs_dpkg
def __get_cfg_pkgs_dpkg(self): ''' Get packages with configuration files on Dpkg systems. :return: ''' # Get list of all available packages data = dict() for pkg_name in salt.utils.stringutils.to_str(self._syscall('dpkg-query', None, None, ...
python
def __get_cfg_pkgs_dpkg(self): ''' Get packages with configuration files on Dpkg systems. :return: ''' # Get list of all available packages data = dict() for pkg_name in salt.utils.stringutils.to_str(self._syscall('dpkg-query', None, None, ...
[ "def", "__get_cfg_pkgs_dpkg", "(", "self", ")", ":", "# Get list of all available packages", "data", "=", "dict", "(", ")", "for", "pkg_name", "in", "salt", ".", "utils", ".", "stringutils", ".", "to_str", "(", "self", ".", "_syscall", "(", "'dpkg-query'", ","...
Get packages with configuration files on Dpkg systems. :return:
[ "Get", "packages", "with", "configuration", "files", "on", "Dpkg", "systems", ".", ":", "return", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/collector.py#L97-L124
train
saltstack/salt
salt/modules/inspectlib/collector.py
Inspector.__get_cfg_pkgs_rpm
def __get_cfg_pkgs_rpm(self): ''' Get packages with configuration files on RPM systems. ''' out, err = self._syscall('rpm', None, None, '-qa', '--configfiles', '--queryformat', '%{name}-%{version}-%{release}\\n') data = dict() pkg_name = N...
python
def __get_cfg_pkgs_rpm(self): ''' Get packages with configuration files on RPM systems. ''' out, err = self._syscall('rpm', None, None, '-qa', '--configfiles', '--queryformat', '%{name}-%{version}-%{release}\\n') data = dict() pkg_name = N...
[ "def", "__get_cfg_pkgs_rpm", "(", "self", ")", ":", "out", ",", "err", "=", "self", ".", "_syscall", "(", "'rpm'", ",", "None", ",", "None", ",", "'-qa'", ",", "'--configfiles'", ",", "'--queryformat'", ",", "'%{name}-%{version}-%{release}\\\\n'", ")", "data",...
Get packages with configuration files on RPM systems.
[ "Get", "packages", "with", "configuration", "files", "on", "RPM", "systems", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/collector.py#L126-L152
train
saltstack/salt
salt/modules/inspectlib/collector.py
Inspector._get_changed_cfg_pkgs
def _get_changed_cfg_pkgs(self, data): ''' Filter out unchanged packages on the Debian or RPM systems. :param data: Structure {package-name -> [ file .. file1 ]} :return: Same structure as data, except only files that were changed. ''' f_data = dict() for pkg_nam...
python
def _get_changed_cfg_pkgs(self, data): ''' Filter out unchanged packages on the Debian or RPM systems. :param data: Structure {package-name -> [ file .. file1 ]} :return: Same structure as data, except only files that were changed. ''' f_data = dict() for pkg_nam...
[ "def", "_get_changed_cfg_pkgs", "(", "self", ",", "data", ")", ":", "f_data", "=", "dict", "(", ")", "for", "pkg_name", ",", "pkg_files", "in", "data", ".", "items", "(", ")", ":", "cfgs", "=", "list", "(", ")", "cfg_data", "=", "list", "(", ")", "...
Filter out unchanged packages on the Debian or RPM systems. :param data: Structure {package-name -> [ file .. file1 ]} :return: Same structure as data, except only files that were changed.
[ "Filter", "out", "unchanged", "packages", "on", "the", "Debian", "or", "RPM", "systems", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/collector.py#L154-L182
train
saltstack/salt
salt/modules/inspectlib/collector.py
Inspector._save_cfg_packages
def _save_cfg_packages(self, data): ''' Save configuration packages. (NG) :param data: :return: ''' pkg_id = 0 pkg_cfg_id = 0 for pkg_name, pkg_configs in data.items(): pkg = Package() pkg.id = pkg_id pkg.name = pkg_nam...
python
def _save_cfg_packages(self, data): ''' Save configuration packages. (NG) :param data: :return: ''' pkg_id = 0 pkg_cfg_id = 0 for pkg_name, pkg_configs in data.items(): pkg = Package() pkg.id = pkg_id pkg.name = pkg_nam...
[ "def", "_save_cfg_packages", "(", "self", ",", "data", ")", ":", "pkg_id", "=", "0", "pkg_cfg_id", "=", "0", "for", "pkg_name", ",", "pkg_configs", "in", "data", ".", "items", "(", ")", ":", "pkg", "=", "Package", "(", ")", "pkg", ".", "id", "=", "...
Save configuration packages. (NG) :param data: :return:
[ "Save", "configuration", "packages", ".", "(", "NG", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/collector.py#L184-L207
train
saltstack/salt
salt/modules/inspectlib/collector.py
Inspector._save_payload
def _save_payload(self, files, directories, links): ''' Save payload (unmanaged files) :param files: :param directories: :param links: :return: ''' idx = 0 for p_type, p_list in (('f', files), ('d', directories), ('l', links,),): for ...
python
def _save_payload(self, files, directories, links): ''' Save payload (unmanaged files) :param files: :param directories: :param links: :return: ''' idx = 0 for p_type, p_list in (('f', files), ('d', directories), ('l', links,),): for ...
[ "def", "_save_payload", "(", "self", ",", "files", ",", "directories", ",", "links", ")", ":", "idx", "=", "0", "for", "p_type", ",", "p_list", "in", "(", "(", "'f'", ",", "files", ")", ",", "(", "'d'", ",", "directories", ")", ",", "(", "'l'", "...
Save payload (unmanaged files) :param files: :param directories: :param links: :return:
[ "Save", "payload", "(", "unmanaged", "files", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/collector.py#L209-L237
train
saltstack/salt
salt/modules/inspectlib/collector.py
Inspector._get_managed_files
def _get_managed_files(self): ''' Build a in-memory data of all managed files. ''' if self.grains_core.os_data().get('os_family') == 'Debian': return self.__get_managed_files_dpkg() elif self.grains_core.os_data().get('os_family') in ['Suse', 'redhat']: re...
python
def _get_managed_files(self): ''' Build a in-memory data of all managed files. ''' if self.grains_core.os_data().get('os_family') == 'Debian': return self.__get_managed_files_dpkg() elif self.grains_core.os_data().get('os_family') in ['Suse', 'redhat']: re...
[ "def", "_get_managed_files", "(", "self", ")", ":", "if", "self", ".", "grains_core", ".", "os_data", "(", ")", ".", "get", "(", "'os_family'", ")", "==", "'Debian'", ":", "return", "self", ".", "__get_managed_files_dpkg", "(", ")", "elif", "self", ".", ...
Build a in-memory data of all managed files.
[ "Build", "a", "in", "-", "memory", "data", "of", "all", "managed", "files", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/collector.py#L239-L248
train
saltstack/salt
salt/modules/inspectlib/collector.py
Inspector.__get_managed_files_dpkg
def __get_managed_files_dpkg(self): ''' Get a list of all system files, belonging to the Debian package manager. ''' dirs = set() links = set() files = set() for pkg_name in salt.utils.stringutils.to_str(self._syscall("dpkg-query", None, None, ...
python
def __get_managed_files_dpkg(self): ''' Get a list of all system files, belonging to the Debian package manager. ''' dirs = set() links = set() files = set() for pkg_name in salt.utils.stringutils.to_str(self._syscall("dpkg-query", None, None, ...
[ "def", "__get_managed_files_dpkg", "(", "self", ")", ":", "dirs", "=", "set", "(", ")", "links", "=", "set", "(", ")", "files", "=", "set", "(", ")", "for", "pkg_name", "in", "salt", ".", "utils", ".", "stringutils", ".", "to_str", "(", "self", ".", ...
Get a list of all system files, belonging to the Debian package manager.
[ "Get", "a", "list", "of", "all", "system", "files", "belonging", "to", "the", "Debian", "package", "manager", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/collector.py#L250-L274
train
saltstack/salt
salt/modules/inspectlib/collector.py
Inspector.__get_managed_files_rpm
def __get_managed_files_rpm(self): ''' Get a list of all system files, belonging to the RedHat package manager. ''' dirs = set() links = set() files = set() for line in salt.utils.stringutils.to_str(self._syscall("rpm", None, None, '-qlav')[0]).split(os.linesep):...
python
def __get_managed_files_rpm(self): ''' Get a list of all system files, belonging to the RedHat package manager. ''' dirs = set() links = set() files = set() for line in salt.utils.stringutils.to_str(self._syscall("rpm", None, None, '-qlav')[0]).split(os.linesep):...
[ "def", "__get_managed_files_rpm", "(", "self", ")", ":", "dirs", "=", "set", "(", ")", "links", "=", "set", "(", ")", "files", "=", "set", "(", ")", "for", "line", "in", "salt", ".", "utils", ".", "stringutils", ".", "to_str", "(", "self", ".", "_s...
Get a list of all system files, belonging to the RedHat package manager.
[ "Get", "a", "list", "of", "all", "system", "files", "belonging", "to", "the", "RedHat", "package", "manager", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/collector.py#L276-L296
train
saltstack/salt
salt/modules/inspectlib/collector.py
Inspector._get_all_files
def _get_all_files(self, path, *exclude): ''' Walk implementation. Version in python 2.x and 3.x works differently. ''' files = list() dirs = list() links = list() if os.access(path, os.R_OK): for obj in os.listdir(path): obj = os.path...
python
def _get_all_files(self, path, *exclude): ''' Walk implementation. Version in python 2.x and 3.x works differently. ''' files = list() dirs = list() links = list() if os.access(path, os.R_OK): for obj in os.listdir(path): obj = os.path...
[ "def", "_get_all_files", "(", "self", ",", "path", ",", "*", "exclude", ")", ":", "files", "=", "list", "(", ")", "dirs", "=", "list", "(", ")", "links", "=", "list", "(", ")", "if", "os", ".", "access", "(", "path", ",", "os", ".", "R_OK", ")"...
Walk implementation. Version in python 2.x and 3.x works differently.
[ "Walk", "implementation", ".", "Version", "in", "python", "2", ".", "x", "and", "3", ".", "x", "works", "differently", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/collector.py#L298-L327
train
saltstack/salt
salt/modules/inspectlib/collector.py
Inspector._get_unmanaged_files
def _get_unmanaged_files(self, managed, system_all): ''' Get the intersection between all files and managed files. ''' m_files, m_dirs, m_links = managed s_files, s_dirs, s_links = system_all return (sorted(list(set(s_files).difference(m_files))), sorted(...
python
def _get_unmanaged_files(self, managed, system_all): ''' Get the intersection between all files and managed files. ''' m_files, m_dirs, m_links = managed s_files, s_dirs, s_links = system_all return (sorted(list(set(s_files).difference(m_files))), sorted(...
[ "def", "_get_unmanaged_files", "(", "self", ",", "managed", ",", "system_all", ")", ":", "m_files", ",", "m_dirs", ",", "m_links", "=", "managed", "s_files", ",", "s_dirs", ",", "s_links", "=", "system_all", "return", "(", "sorted", "(", "list", "(", "set"...
Get the intersection between all files and managed files.
[ "Get", "the", "intersection", "between", "all", "files", "and", "managed", "files", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/collector.py#L329-L338
train
saltstack/salt
salt/modules/inspectlib/collector.py
Inspector._scan_payload
def _scan_payload(self): ''' Scan the system. ''' # Get ignored points allowed = list() for allowed_dir in self.db.get(AllowedDir): if os.path.exists(allowed_dir.path): allowed.append(allowed_dir.path) ignored = list() if not a...
python
def _scan_payload(self): ''' Scan the system. ''' # Get ignored points allowed = list() for allowed_dir in self.db.get(AllowedDir): if os.path.exists(allowed_dir.path): allowed.append(allowed_dir.path) ignored = list() if not a...
[ "def", "_scan_payload", "(", "self", ")", ":", "# Get ignored points", "allowed", "=", "list", "(", ")", "for", "allowed_dir", "in", "self", ".", "db", ".", "get", "(", "AllowedDir", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "allowed_dir", ...
Scan the system.
[ "Scan", "the", "system", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/collector.py#L340-L369
train
saltstack/salt
salt/modules/inspectlib/collector.py
Inspector._prepare_full_scan
def _prepare_full_scan(self, **kwargs): ''' Prepare full system scan by setting up the database etc. ''' self.db.open(new=True) # Add ignored filesystems ignored_fs = set() ignored_fs |= set(self.IGNORE_PATHS) mounts = salt.utils.fsutils._get_mounts() ...
python
def _prepare_full_scan(self, **kwargs): ''' Prepare full system scan by setting up the database etc. ''' self.db.open(new=True) # Add ignored filesystems ignored_fs = set() ignored_fs |= set(self.IGNORE_PATHS) mounts = salt.utils.fsutils._get_mounts() ...
[ "def", "_prepare_full_scan", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "db", ".", "open", "(", "new", "=", "True", ")", "# Add ignored filesystems", "ignored_fs", "=", "set", "(", ")", "ignored_fs", "|=", "set", "(", "self", ".", "IG...
Prepare full system scan by setting up the database etc.
[ "Prepare", "full", "system", "scan", "by", "setting", "up", "the", "database", "etc", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/collector.py#L371-L412
train
saltstack/salt
salt/modules/inspectlib/collector.py
Inspector._init_env
def _init_env(self): ''' Initialize some Salt environment. ''' from salt.config import minion_config from salt.grains import core as g_core g_core.__opts__ = minion_config(self.DEFAULT_MINION_CONFIG_PATH) self.grains_core = g_core
python
def _init_env(self): ''' Initialize some Salt environment. ''' from salt.config import minion_config from salt.grains import core as g_core g_core.__opts__ = minion_config(self.DEFAULT_MINION_CONFIG_PATH) self.grains_core = g_core
[ "def", "_init_env", "(", "self", ")", ":", "from", "salt", ".", "config", "import", "minion_config", "from", "salt", ".", "grains", "import", "core", "as", "g_core", "g_core", ".", "__opts__", "=", "minion_config", "(", "self", ".", "DEFAULT_MINION_CONFIG_PATH...
Initialize some Salt environment.
[ "Initialize", "some", "Salt", "environment", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/collector.py#L414-L421
train
saltstack/salt
salt/modules/inspectlib/collector.py
Inspector.snapshot
def snapshot(self, mode): ''' Take a snapshot of the system. ''' self._init_env() self._save_cfg_packages(self._get_changed_cfg_pkgs(self._get_cfg_pkgs())) self._save_payload(*self._scan_payload())
python
def snapshot(self, mode): ''' Take a snapshot of the system. ''' self._init_env() self._save_cfg_packages(self._get_changed_cfg_pkgs(self._get_cfg_pkgs())) self._save_payload(*self._scan_payload())
[ "def", "snapshot", "(", "self", ",", "mode", ")", ":", "self", ".", "_init_env", "(", ")", "self", ".", "_save_cfg_packages", "(", "self", ".", "_get_changed_cfg_pkgs", "(", "self", ".", "_get_cfg_pkgs", "(", ")", ")", ")", "self", ".", "_save_payload", ...
Take a snapshot of the system.
[ "Take", "a", "snapshot", "of", "the", "system", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/collector.py#L423-L430
train
saltstack/salt
salt/modules/inspectlib/collector.py
Inspector.request_snapshot
def request_snapshot(self, mode, priority=19, **kwargs): ''' Take a snapshot of the system. ''' if mode not in self.MODE: raise InspectorSnapshotException("Unknown mode: '{0}'".format(mode)) if is_alive(self.pidfile): raise CommandExecutionError('Inspecti...
python
def request_snapshot(self, mode, priority=19, **kwargs): ''' Take a snapshot of the system. ''' if mode not in self.MODE: raise InspectorSnapshotException("Unknown mode: '{0}'".format(mode)) if is_alive(self.pidfile): raise CommandExecutionError('Inspecti...
[ "def", "request_snapshot", "(", "self", ",", "mode", ",", "priority", "=", "19", ",", "*", "*", "kwargs", ")", ":", "if", "mode", "not", "in", "self", ".", "MODE", ":", "raise", "InspectorSnapshotException", "(", "\"Unknown mode: '{0}'\"", ".", "format", "...
Take a snapshot of the system.
[ "Take", "a", "snapshot", "of", "the", "system", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/collector.py#L432-L445
train
saltstack/salt
salt/modules/inspectlib/collector.py
Inspector.export
def export(self, description, local=False, path='/tmp', format='qcow2'): ''' Export description for Kiwi. :param local: :param path: :return: ''' kiwiproc.__salt__ = __salt__ return kiwiproc.KiwiExporter(grains=__grains__, ...
python
def export(self, description, local=False, path='/tmp', format='qcow2'): ''' Export description for Kiwi. :param local: :param path: :return: ''' kiwiproc.__salt__ = __salt__ return kiwiproc.KiwiExporter(grains=__grains__, ...
[ "def", "export", "(", "self", ",", "description", ",", "local", "=", "False", ",", "path", "=", "'/tmp'", ",", "format", "=", "'qcow2'", ")", ":", "kiwiproc", ".", "__salt__", "=", "__salt__", "return", "kiwiproc", ".", "KiwiExporter", "(", "grains", "="...
Export description for Kiwi. :param local: :param path: :return:
[ "Export", "description", "for", "Kiwi", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/collector.py#L447-L457
train
saltstack/salt
salt/modules/inspectlib/collector.py
Inspector.build
def build(self, format='qcow2', path='/tmp'): ''' Build an image using Kiwi. :param format: :param path: :return: ''' if kiwi is None: msg = 'Unable to build the image due to the missing dependencies: Kiwi module is not available.' log.err...
python
def build(self, format='qcow2', path='/tmp'): ''' Build an image using Kiwi. :param format: :param path: :return: ''' if kiwi is None: msg = 'Unable to build the image due to the missing dependencies: Kiwi module is not available.' log.err...
[ "def", "build", "(", "self", ",", "format", "=", "'qcow2'", ",", "path", "=", "'/tmp'", ")", ":", "if", "kiwi", "is", "None", ":", "msg", "=", "'Unable to build the image due to the missing dependencies: Kiwi module is not available.'", "log", ".", "error", "(", "...
Build an image using Kiwi. :param format: :param path: :return:
[ "Build", "an", "image", "using", "Kiwi", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/collector.py#L459-L472
train
saltstack/salt
salt/states/xml.py
value_present
def value_present(name, xpath, value, **kwargs): ''' .. versionadded:: Neon Manages a given XML file name : string The location of the XML file to manage, as an absolute path. xpath : string xpath location to manage value : string value to ensure present .. code-...
python
def value_present(name, xpath, value, **kwargs): ''' .. versionadded:: Neon Manages a given XML file name : string The location of the XML file to manage, as an absolute path. xpath : string xpath location to manage value : string value to ensure present .. code-...
[ "def", "value_present", "(", "name", ",", "xpath", ",", "value", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "if", "'t...
.. versionadded:: Neon Manages a given XML file name : string The location of the XML file to manage, as an absolute path. xpath : string xpath location to manage value : string value to ensure present .. code-block:: yaml ensure_value_true: xml.value_...
[ "..", "versionadded", "::", "Neon" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/xml.py#L26-L76
train
saltstack/salt
salt/states/boto_iot.py
thing_type_present
def thing_type_present(name, thingTypeName, thingTypeDescription, searchableAttributesList, region=None, key=None, keyid=None, profile=None): ''' Ensure thing type exists. .. versionadded:: 2016.11.0 name The name of the state definition thingTypeName Name of the thing typ...
python
def thing_type_present(name, thingTypeName, thingTypeDescription, searchableAttributesList, region=None, key=None, keyid=None, profile=None): ''' Ensure thing type exists. .. versionadded:: 2016.11.0 name The name of the state definition thingTypeName Name of the thing typ...
[ "def", "thing_type_present", "(", "name", ",", "thingTypeName", ",", "thingTypeDescription", ",", "searchableAttributesList", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "ret", "=", ...
Ensure thing type exists. .. versionadded:: 2016.11.0 name The name of the state definition thingTypeName Name of the thing type thingTypeDescription Description of the thing type searchableAttributesList List of string attributes that are searchable for ...
[ "Ensure", "thing", "type", "exists", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_iot.py#L97-L178
train
saltstack/salt
salt/states/boto_iot.py
thing_type_absent
def thing_type_absent(name, thingTypeName, region=None, key=None, keyid=None, profile=None): ''' Ensure thing type with passed properties is absent. .. versionadded:: 2016.11.0 name The name of the state definition. thingTypeName Name of the thing type. regi...
python
def thing_type_absent(name, thingTypeName, region=None, key=None, keyid=None, profile=None): ''' Ensure thing type with passed properties is absent. .. versionadded:: 2016.11.0 name The name of the state definition. thingTypeName Name of the thing type. regi...
[ "def", "thing_type_absent", "(", "name", ",", "thingTypeName", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "thingTypeName", ",", "'result'", ":",...
Ensure thing type with passed properties is absent. .. versionadded:: 2016.11.0 name The name of the state definition. thingTypeName Name of the thing type. region Region to connect to. key Secret key to be used. keyid Access key to be used. pro...
[ "Ensure", "thing", "type", "with", "passed", "properties", "is", "absent", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_iot.py#L181-L296
train
saltstack/salt
salt/states/boto_iot.py
policy_present
def policy_present(name, policyName, policyDocument, region=None, key=None, keyid=None, profile=None): ''' Ensure policy exists. name The name of the state definition policyName Name of the policy. policyDocument The JSON document that describes the policy. The...
python
def policy_present(name, policyName, policyDocument, region=None, key=None, keyid=None, profile=None): ''' Ensure policy exists. name The name of the state definition policyName Name of the policy. policyDocument The JSON document that describes the policy. The...
[ "def", "policy_present", "(", "name", ",", "policyName", ",", "policyDocument", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "policyName", ",", ...
Ensure policy exists. name The name of the state definition policyName Name of the policy. policyDocument The JSON document that describes the policy. The length of the policyDocument must be a minimum length of 1, with a maximum length of 2048, excluding whitespac...
[ "Ensure", "policy", "exists", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_iot.py#L299-L405
train
saltstack/salt
salt/states/boto_iot.py
policy_attached
def policy_attached(name, policyName, principal, region=None, key=None, keyid=None, profile=None): ''' Ensure policy is attached to the given principal. name The name of the state definition policyName Name of the policy. principal The principal which can be a ...
python
def policy_attached(name, policyName, principal, region=None, key=None, keyid=None, profile=None): ''' Ensure policy is attached to the given principal. name The name of the state definition policyName Name of the policy. principal The principal which can be a ...
[ "def", "policy_attached", "(", "name", ",", "policyName", ",", "principal", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "policyName", ",", "'re...
Ensure policy is attached to the given principal. name The name of the state definition policyName Name of the policy. principal The principal which can be a certificate ARN or a Cognito ID. region Region to connect to. key Secret key to be used. key...
[ "Ensure", "policy", "is", "attached", "to", "the", "given", "principal", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_iot.py#L490-L557
train
saltstack/salt
salt/states/boto_iot.py
topic_rule_present
def topic_rule_present(name, ruleName, sql, actions, description='', ruleDisabled=False, region=None, key=None, keyid=None, profile=None): ''' Ensure topic rule exists. name The name of the state definition ruleName Name of the rule. sql The SQL sta...
python
def topic_rule_present(name, ruleName, sql, actions, description='', ruleDisabled=False, region=None, key=None, keyid=None, profile=None): ''' Ensure topic rule exists. name The name of the state definition ruleName Name of the rule. sql The SQL sta...
[ "def", "topic_rule_present", "(", "name", ",", "ruleName", ",", "sql", ",", "actions", ",", "description", "=", "''", ",", "ruleDisabled", "=", "False", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "="...
Ensure topic rule exists. name The name of the state definition ruleName Name of the rule. sql The SQL statement used to query the topic. actions The actions associated with the rule. description The description of the rule. ruleDisable Speci...
[ "Ensure", "topic", "rule", "exists", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_iot.py#L631-L746
train
saltstack/salt
salt/states/boto_iot.py
topic_rule_absent
def topic_rule_absent(name, ruleName, region=None, key=None, keyid=None, profile=None): ''' Ensure topic rule with passed properties is absent. name The name of the state definition. ruleName Name of the policy. region Region to connect to. key ...
python
def topic_rule_absent(name, ruleName, region=None, key=None, keyid=None, profile=None): ''' Ensure topic rule with passed properties is absent. name The name of the state definition. ruleName Name of the policy. region Region to connect to. key ...
[ "def", "topic_rule_absent", "(", "name", ",", "ruleName", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "ruleName", ",", "'result'", ":", "True",...
Ensure topic rule with passed properties is absent. name The name of the state definition. ruleName Name of the policy. region Region to connect to. key Secret key to be used. keyid Access key to be used. profile A dict with region, key and k...
[ "Ensure", "topic", "rule", "with", "passed", "properties", "is", "absent", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_iot.py#L749-L805
train
saltstack/salt
salt/modules/useradd.py
_quote_username
def _quote_username(name): ''' Usernames can only contain ascii chars, so make sure we return a str type ''' if not isinstance(name, six.string_types): return str(name) # future lint: disable=blacklisted-function else: return salt.utils.stringutils.to_str(name)
python
def _quote_username(name): ''' Usernames can only contain ascii chars, so make sure we return a str type ''' if not isinstance(name, six.string_types): return str(name) # future lint: disable=blacklisted-function else: return salt.utils.stringutils.to_str(name)
[ "def", "_quote_username", "(", "name", ")", ":", "if", "not", "isinstance", "(", "name", ",", "six", ".", "string_types", ")", ":", "return", "str", "(", "name", ")", "# future lint: disable=blacklisted-function", "else", ":", "return", "salt", ".", "utils", ...
Usernames can only contain ascii chars, so make sure we return a str type
[ "Usernames", "can", "only", "contain", "ascii", "chars", "so", "make", "sure", "we", "return", "a", "str", "type" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/useradd.py#L50-L57
train
saltstack/salt
salt/modules/useradd.py
_get_gecos
def _get_gecos(name, root=None): ''' Retrieve GECOS field info and return it in dictionary form ''' if root is not None and __grains__['kernel'] != 'AIX': getpwnam = functools.partial(_getpwnam, root=root) else: getpwnam = functools.partial(pwd.getpwnam) gecos_field = salt.utils....
python
def _get_gecos(name, root=None): ''' Retrieve GECOS field info and return it in dictionary form ''' if root is not None and __grains__['kernel'] != 'AIX': getpwnam = functools.partial(_getpwnam, root=root) else: getpwnam = functools.partial(pwd.getpwnam) gecos_field = salt.utils....
[ "def", "_get_gecos", "(", "name", ",", "root", "=", "None", ")", ":", "if", "root", "is", "not", "None", "and", "__grains__", "[", "'kernel'", "]", "!=", "'AIX'", ":", "getpwnam", "=", "functools", ".", "partial", "(", "_getpwnam", ",", "root", "=", ...
Retrieve GECOS field info and return it in dictionary form
[ "Retrieve", "GECOS", "field", "info", "and", "return", "it", "in", "dictionary", "form" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/useradd.py#L60-L81
train
saltstack/salt
salt/modules/useradd.py
_update_gecos
def _update_gecos(name, key, value, root=None): ''' Common code to change a user's GECOS information ''' if value is None: value = '' elif not isinstance(value, six.string_types): value = six.text_type(value) else: value = salt.utils.stringutils.to_unicode(value) pre_...
python
def _update_gecos(name, key, value, root=None): ''' Common code to change a user's GECOS information ''' if value is None: value = '' elif not isinstance(value, six.string_types): value = six.text_type(value) else: value = salt.utils.stringutils.to_unicode(value) pre_...
[ "def", "_update_gecos", "(", "name", ",", "key", ",", "value", ",", "root", "=", "None", ")", ":", "if", "value", "is", "None", ":", "value", "=", "''", "elif", "not", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", ":", "value", ...
Common code to change a user's GECOS information
[ "Common", "code", "to", "change", "a", "user", "s", "GECOS", "information" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/useradd.py#L96-L120
train
saltstack/salt
salt/modules/useradd.py
add
def add(name, uid=None, gid=None, groups=None, home=None, shell=None, unique=True, system=False, fullname='', roomnumber='', workphone='', homephone='', other='', createhome=True, loginclass=None, nol...
python
def add(name, uid=None, gid=None, groups=None, home=None, shell=None, unique=True, system=False, fullname='', roomnumber='', workphone='', homephone='', other='', createhome=True, loginclass=None, nol...
[ "def", "add", "(", "name", ",", "uid", "=", "None", ",", "gid", "=", "None", ",", "groups", "=", "None", ",", "home", "=", "None", ",", "shell", "=", "None", ",", "unique", "=", "True", ",", "system", "=", "False", ",", "fullname", "=", "''", "...
Add a user to the minion name Username LOGIN to add uid User ID of the new account gid Name or ID of the primary group of the new account groups List of supplementary groups of the new account home Home directory of the new account shell Logi...
[ "Add", "a", "user", "to", "the", "minion" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/useradd.py#L123-L313
train
saltstack/salt
salt/modules/useradd.py
delete
def delete(name, remove=False, force=False, root=None): ''' Remove a user from the minion name Username to delete remove Remove home directory and mail spool force Force some actions that would fail otherwise root Directory to chroot into CLI Example: ...
python
def delete(name, remove=False, force=False, root=None): ''' Remove a user from the minion name Username to delete remove Remove home directory and mail spool force Force some actions that would fail otherwise root Directory to chroot into CLI Example: ...
[ "def", "delete", "(", "name", ",", "remove", "=", "False", ",", "force", "=", "False", ",", "root", "=", "None", ")", ":", "cmd", "=", "[", "'userdel'", "]", "if", "remove", ":", "cmd", ".", "append", "(", "'-r'", ")", "if", "force", "and", "__gr...
Remove a user from the minion name Username to delete remove Remove home directory and mail spool force Force some actions that would fail otherwise root Directory to chroot into CLI Example: .. code-block:: bash salt '*' user.delete name remove=Tru...
[ "Remove", "a", "user", "from", "the", "minion" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/useradd.py#L316-L372
train
saltstack/salt
salt/modules/useradd.py
getent
def getent(refresh=False, root=None): ''' Return the list of all info for all users refresh Force a refresh of user information root Directory to chroot into CLI Example: .. code-block:: bash salt '*' user.getent ''' if 'user.getent' in __context__ and not re...
python
def getent(refresh=False, root=None): ''' Return the list of all info for all users refresh Force a refresh of user information root Directory to chroot into CLI Example: .. code-block:: bash salt '*' user.getent ''' if 'user.getent' in __context__ and not re...
[ "def", "getent", "(", "refresh", "=", "False", ",", "root", "=", "None", ")", ":", "if", "'user.getent'", "in", "__context__", "and", "not", "refresh", ":", "return", "__context__", "[", "'user.getent'", "]", "ret", "=", "[", "]", "if", "root", "is", "...
Return the list of all info for all users refresh Force a refresh of user information root Directory to chroot into CLI Example: .. code-block:: bash salt '*' user.getent
[ "Return", "the", "list", "of", "all", "info", "for", "all", "users" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/useradd.py#L375-L403
train
saltstack/salt
salt/modules/useradd.py
_chattrib
def _chattrib(name, key, value, param, persist=False, root=None): ''' Change an attribute for a named user ''' pre_info = info(name, root=root) if not pre_info: raise CommandExecutionError('User \'{0}\' does not exist'.format(name)) if value == pre_info[key]: return True cm...
python
def _chattrib(name, key, value, param, persist=False, root=None): ''' Change an attribute for a named user ''' pre_info = info(name, root=root) if not pre_info: raise CommandExecutionError('User \'{0}\' does not exist'.format(name)) if value == pre_info[key]: return True cm...
[ "def", "_chattrib", "(", "name", ",", "key", ",", "value", ",", "param", ",", "persist", "=", "False", ",", "root", "=", "None", ")", ":", "pre_info", "=", "info", "(", "name", ",", "root", "=", "root", ")", "if", "not", "pre_info", ":", "raise", ...
Change an attribute for a named user
[ "Change", "an", "attribute", "for", "a", "named", "user" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/useradd.py#L406-L428
train
saltstack/salt
salt/modules/useradd.py
chhome
def chhome(name, home, persist=False, root=None): ''' Change the home directory of the user, pass True for persist to move files to the new home directory if the old home directory exist. name User to modify home New home directory for the user account presist Move con...
python
def chhome(name, home, persist=False, root=None): ''' Change the home directory of the user, pass True for persist to move files to the new home directory if the old home directory exist. name User to modify home New home directory for the user account presist Move con...
[ "def", "chhome", "(", "name", ",", "home", ",", "persist", "=", "False", ",", "root", "=", "None", ")", ":", "return", "_chattrib", "(", "name", ",", "'home'", ",", "home", ",", "'-d'", ",", "persist", "=", "persist", ",", "root", "=", "root", ")" ...
Change the home directory of the user, pass True for persist to move files to the new home directory if the old home directory exist. name User to modify home New home directory for the user account presist Move contents of the home directory to the new location root ...
[ "Change", "the", "home", "directory", "of", "the", "user", "pass", "True", "for", "persist", "to", "move", "files", "to", "the", "new", "home", "directory", "if", "the", "old", "home", "directory", "exist", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/useradd.py#L497-L520
train
saltstack/salt
salt/modules/useradd.py
chgroups
def chgroups(name, groups, append=False, root=None): ''' Change the groups to which this user belongs name User to modify groups Groups to set for the user append : False If ``True``, append the specified group(s). Otherwise, this function will replace the user's g...
python
def chgroups(name, groups, append=False, root=None): ''' Change the groups to which this user belongs name User to modify groups Groups to set for the user append : False If ``True``, append the specified group(s). Otherwise, this function will replace the user's g...
[ "def", "chgroups", "(", "name", ",", "groups", ",", "append", "=", "False", ",", "root", "=", "None", ")", ":", "if", "isinstance", "(", "groups", ",", "six", ".", "string_types", ")", ":", "groups", "=", "groups", ".", "split", "(", "','", ")", "u...
Change the groups to which this user belongs name User to modify groups Groups to set for the user append : False If ``True``, append the specified group(s). Otherwise, this function will replace the user's groups with the specified group(s). root Directory to...
[ "Change", "the", "groups", "to", "which", "this", "user", "belongs" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/useradd.py#L523-L583
train
saltstack/salt
salt/modules/useradd.py
chloginclass
def chloginclass(name, loginclass, root=None): ''' Change the default login class of the user name User to modify loginclass Login class for the new account root Directory to chroot into .. note:: This function only applies to OpenBSD systems. CLI Example...
python
def chloginclass(name, loginclass, root=None): ''' Change the default login class of the user name User to modify loginclass Login class for the new account root Directory to chroot into .. note:: This function only applies to OpenBSD systems. CLI Example...
[ "def", "chloginclass", "(", "name", ",", "loginclass", ",", "root", "=", "None", ")", ":", "if", "__grains__", "[", "'kernel'", "]", "!=", "'OpenBSD'", ":", "return", "False", "if", "loginclass", "==", "get_loginclass", "(", "name", ")", ":", "return", "...
Change the default login class of the user name User to modify loginclass Login class for the new account root Directory to chroot into .. note:: This function only applies to OpenBSD systems. CLI Example: .. code-block:: bash salt '*' user.chloginc...
[ "Change", "the", "default", "login", "class", "of", "the", "user" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/useradd.py#L687-L721
train
saltstack/salt
salt/modules/useradd.py
info
def info(name, root=None): ''' Return user information name User to get the information root Directory to chroot into CLI Example: .. code-block:: bash salt '*' user.info root ''' # If root is provided, we use a less portable solution that # depends on an...
python
def info(name, root=None): ''' Return user information name User to get the information root Directory to chroot into CLI Example: .. code-block:: bash salt '*' user.info root ''' # If root is provided, we use a less portable solution that # depends on an...
[ "def", "info", "(", "name", ",", "root", "=", "None", ")", ":", "# If root is provided, we use a less portable solution that", "# depends on analyzing /etc/passwd manually. Of course we cannot", "# find users from NIS nor LDAP, but in those cases do not makes", "# sense to provide a root p...
Return user information name User to get the information root Directory to chroot into CLI Example: .. code-block:: bash salt '*' user.info root
[ "Return", "user", "information" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/useradd.py#L724-L757
train
saltstack/salt
salt/modules/useradd.py
get_loginclass
def get_loginclass(name): ''' Get the login class of the user name User to get the information .. note:: This function only applies to OpenBSD systems. CLI Example: .. code-block:: bash salt '*' user.get_loginclass foo ''' if __grains__['kernel'] != 'OpenBSD'...
python
def get_loginclass(name): ''' Get the login class of the user name User to get the information .. note:: This function only applies to OpenBSD systems. CLI Example: .. code-block:: bash salt '*' user.get_loginclass foo ''' if __grains__['kernel'] != 'OpenBSD'...
[ "def", "get_loginclass", "(", "name", ")", ":", "if", "__grains__", "[", "'kernel'", "]", "!=", "'OpenBSD'", ":", "return", "False", "userinfo", "=", "__salt__", "[", "'cmd.run_stdout'", "]", "(", "[", "'userinfo'", ",", "name", "]", ",", "python_shell", "...
Get the login class of the user name User to get the information .. note:: This function only applies to OpenBSD systems. CLI Example: .. code-block:: bash salt '*' user.get_loginclass foo
[ "Get", "the", "login", "class", "of", "the", "user" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/useradd.py#L760-L790
train