partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | check_env_cache | Returns cached env names, if present. Otherwise returns None. | salt/fileserver/__init__.py | def check_env_cache(opts, env_cache):
'''
Returns cached env names, if present. Otherwise returns None.
'''
if not os.path.isfile(env_cache):
return None
try:
with salt.utils.files.fopen(env_cache, 'rb') as fp_:
log.trace('Returning env cache data from %s', env_cache)
... | def check_env_cache(opts, env_cache):
'''
Returns cached env names, if present. Otherwise returns None.
'''
if not os.path.isfile(env_cache):
return None
try:
with salt.utils.files.fopen(env_cache, 'rb') as fp_:
log.trace('Returning env cache data from %s', env_cache)
... | [
"Returns",
"cached",
"env",
"names",
"if",
"present",
".",
"Otherwise",
"returns",
"None",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L189-L202 | [
"def",
"check_env_cache",
"(",
"opts",
",",
"env_cache",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"env_cache",
")",
":",
"return",
"None",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"env_cache",
",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | generate_mtime_map | Generate a dict of filename -> mtime | salt/fileserver/__init__.py | def generate_mtime_map(opts, path_map):
'''
Generate a dict of filename -> mtime
'''
file_map = {}
for saltenv, path_list in six.iteritems(path_map):
for path in path_list:
for directory, _, filenames in salt.utils.path.os_walk(path):
for item in filenames:
... | def generate_mtime_map(opts, path_map):
'''
Generate a dict of filename -> mtime
'''
file_map = {}
for saltenv, path_list in six.iteritems(path_map):
for path in path_list:
for directory, _, filenames in salt.utils.path.os_walk(path):
for item in filenames:
... | [
"Generate",
"a",
"dict",
"of",
"filename",
"-",
">",
"mtime"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L205-L228 | [
"def",
"generate_mtime_map",
"(",
"opts",
",",
"path_map",
")",
":",
"file_map",
"=",
"{",
"}",
"for",
"saltenv",
",",
"path_list",
"in",
"six",
".",
"iteritems",
"(",
"path_map",
")",
":",
"for",
"path",
"in",
"path_list",
":",
"for",
"directory",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | diff_mtime_map | Is there a change to the mtime map? return a boolean | salt/fileserver/__init__.py | def diff_mtime_map(map1, map2):
'''
Is there a change to the mtime map? return a boolean
'''
# check if the mtimes are the same
if sorted(map1) != sorted(map2):
return True
# map1 and map2 are guaranteed to have same keys,
# so compare mtimes
for filename, mtime in six.iteritems... | def diff_mtime_map(map1, map2):
'''
Is there a change to the mtime map? return a boolean
'''
# check if the mtimes are the same
if sorted(map1) != sorted(map2):
return True
# map1 and map2 are guaranteed to have same keys,
# so compare mtimes
for filename, mtime in six.iteritems... | [
"Is",
"there",
"a",
"change",
"to",
"the",
"mtime",
"map?",
"return",
"a",
"boolean"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L231-L246 | [
"def",
"diff_mtime_map",
"(",
"map1",
",",
"map2",
")",
":",
"# check if the mtimes are the same",
"if",
"sorted",
"(",
"map1",
")",
"!=",
"sorted",
"(",
"map2",
")",
":",
"return",
"True",
"# map1 and map2 are guaranteed to have same keys,",
"# so compare mtimes",
"f... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | reap_fileserver_cache_dir | Remove unused cache items assuming the cache directory follows a directory
convention:
cache_base -> saltenv -> relpath | salt/fileserver/__init__.py | def reap_fileserver_cache_dir(cache_base, find_func):
'''
Remove unused cache items assuming the cache directory follows a directory
convention:
cache_base -> saltenv -> relpath
'''
for saltenv in os.listdir(cache_base):
env_base = os.path.join(cache_base, saltenv)
for root, dir... | def reap_fileserver_cache_dir(cache_base, find_func):
'''
Remove unused cache items assuming the cache directory follows a directory
convention:
cache_base -> saltenv -> relpath
'''
for saltenv in os.listdir(cache_base):
env_base = os.path.join(cache_base, saltenv)
for root, dir... | [
"Remove",
"unused",
"cache",
"items",
"assuming",
"the",
"cache",
"directory",
"follows",
"a",
"directory",
"convention",
":"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L249-L284 | [
"def",
"reap_fileserver_cache_dir",
"(",
"cache_base",
",",
"find_func",
")",
":",
"for",
"saltenv",
"in",
"os",
".",
"listdir",
"(",
"cache_base",
")",
":",
"env_base",
"=",
"os",
".",
"path",
".",
"join",
"(",
"cache_base",
",",
"saltenv",
")",
"for",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | is_file_ignored | If file_ignore_regex or file_ignore_glob were given in config,
compare the given file path against all of them and return True
on the first match. | salt/fileserver/__init__.py | def is_file_ignored(opts, fname):
'''
If file_ignore_regex or file_ignore_glob were given in config,
compare the given file path against all of them and return True
on the first match.
'''
if opts['file_ignore_regex']:
for regex in opts['file_ignore_regex']:
if re.search(rege... | def is_file_ignored(opts, fname):
'''
If file_ignore_regex or file_ignore_glob were given in config,
compare the given file path against all of them and return True
on the first match.
'''
if opts['file_ignore_regex']:
for regex in opts['file_ignore_regex']:
if re.search(rege... | [
"If",
"file_ignore_regex",
"or",
"file_ignore_glob",
"were",
"given",
"in",
"config",
"compare",
"the",
"given",
"file",
"path",
"against",
"all",
"of",
"them",
"and",
"return",
"True",
"on",
"the",
"first",
"match",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L287-L310 | [
"def",
"is_file_ignored",
"(",
"opts",
",",
"fname",
")",
":",
"if",
"opts",
"[",
"'file_ignore_regex'",
"]",
":",
"for",
"regex",
"in",
"opts",
"[",
"'file_ignore_regex'",
"]",
":",
"if",
"re",
".",
"search",
"(",
"regex",
",",
"fname",
")",
":",
"log... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | clear_lock | Function to allow non-fileserver functions to clear update locks
clear_func
A function reference. This function will be run (with the ``remote``
param as an argument) to clear the lock, and must return a 2-tuple of
lists, one containing messages describing successfully cleared locks,
... | salt/fileserver/__init__.py | def clear_lock(clear_func, role, remote=None, lock_type='update'):
'''
Function to allow non-fileserver functions to clear update locks
clear_func
A function reference. This function will be run (with the ``remote``
param as an argument) to clear the lock, and must return a 2-tuple of
... | def clear_lock(clear_func, role, remote=None, lock_type='update'):
'''
Function to allow non-fileserver functions to clear update locks
clear_func
A function reference. This function will be run (with the ``remote``
param as an argument) to clear the lock, and must return a 2-tuple of
... | [
"Function",
"to",
"allow",
"non",
"-",
"fileserver",
"functions",
"to",
"clear",
"update",
"locks"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L313-L340 | [
"def",
"clear_lock",
"(",
"clear_func",
",",
"role",
",",
"remote",
"=",
"None",
",",
"lock_type",
"=",
"'update'",
")",
":",
"msg",
"=",
"'Clearing {0} lock for {1} remotes'",
".",
"format",
"(",
"lock_type",
",",
"role",
")",
"if",
"remote",
":",
"msg",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Fileserver.backends | Return the backend list | salt/fileserver/__init__.py | def backends(self, back=None):
'''
Return the backend list
'''
if not back:
back = self.opts['fileserver_backend']
else:
if not isinstance(back, list):
try:
back = back.split(',')
except AttributeError:
... | def backends(self, back=None):
'''
Return the backend list
'''
if not back:
back = self.opts['fileserver_backend']
else:
if not isinstance(back, list):
try:
back = back.split(',')
except AttributeError:
... | [
"Return",
"the",
"backend",
"list"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L353-L401 | [
"def",
"backends",
"(",
"self",
",",
"back",
"=",
"None",
")",
":",
"if",
"not",
"back",
":",
"back",
"=",
"self",
".",
"opts",
"[",
"'fileserver_backend'",
"]",
"else",
":",
"if",
"not",
"isinstance",
"(",
"back",
",",
"list",
")",
":",
"try",
":"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Fileserver.clear_cache | Clear the cache of all of the fileserver backends that support the
clear_cache function or the named backend(s) only. | salt/fileserver/__init__.py | def clear_cache(self, back=None):
'''
Clear the cache of all of the fileserver backends that support the
clear_cache function or the named backend(s) only.
'''
back = self.backends(back)
cleared = []
errors = []
for fsb in back:
fstr = '{0}.cle... | def clear_cache(self, back=None):
'''
Clear the cache of all of the fileserver backends that support the
clear_cache function or the named backend(s) only.
'''
back = self.backends(back)
cleared = []
errors = []
for fsb in back:
fstr = '{0}.cle... | [
"Clear",
"the",
"cache",
"of",
"all",
"of",
"the",
"fileserver",
"backends",
"that",
"support",
"the",
"clear_cache",
"function",
"or",
"the",
"named",
"backend",
"(",
"s",
")",
"only",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L418-L438 | [
"def",
"clear_cache",
"(",
"self",
",",
"back",
"=",
"None",
")",
":",
"back",
"=",
"self",
".",
"backends",
"(",
"back",
")",
"cleared",
"=",
"[",
"]",
"errors",
"=",
"[",
"]",
"for",
"fsb",
"in",
"back",
":",
"fstr",
"=",
"'{0}.clear_cache'",
"."... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Fileserver.lock | ``remote`` can either be a dictionary containing repo configuration
information, or a pattern. If the latter, then remotes for which the URL
matches the pattern will be locked. | salt/fileserver/__init__.py | def lock(self, back=None, remote=None):
'''
``remote`` can either be a dictionary containing repo configuration
information, or a pattern. If the latter, then remotes for which the URL
matches the pattern will be locked.
'''
back = self.backends(back)
locked = []
... | def lock(self, back=None, remote=None):
'''
``remote`` can either be a dictionary containing repo configuration
information, or a pattern. If the latter, then remotes for which the URL
matches the pattern will be locked.
'''
back = self.backends(back)
locked = []
... | [
"remote",
"can",
"either",
"be",
"a",
"dictionary",
"containing",
"repo",
"configuration",
"information",
"or",
"a",
"pattern",
".",
"If",
"the",
"latter",
"then",
"remotes",
"for",
"which",
"the",
"URL",
"matches",
"the",
"pattern",
"will",
"be",
"locked",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L440-L466 | [
"def",
"lock",
"(",
"self",
",",
"back",
"=",
"None",
",",
"remote",
"=",
"None",
")",
":",
"back",
"=",
"self",
".",
"backends",
"(",
"back",
")",
"locked",
"=",
"[",
"]",
"errors",
"=",
"[",
"]",
"for",
"fsb",
"in",
"back",
":",
"fstr",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Fileserver.clear_lock | Clear the update lock for the enabled fileserver backends
back
Only clear the update lock for the specified backend(s). The
default is to clear the lock for all enabled backends
remote
If specified, then any remotes which contain the passed string will
h... | salt/fileserver/__init__.py | def clear_lock(self, back=None, remote=None):
'''
Clear the update lock for the enabled fileserver backends
back
Only clear the update lock for the specified backend(s). The
default is to clear the lock for all enabled backends
remote
If specified, t... | def clear_lock(self, back=None, remote=None):
'''
Clear the update lock for the enabled fileserver backends
back
Only clear the update lock for the specified backend(s). The
default is to clear the lock for all enabled backends
remote
If specified, t... | [
"Clear",
"the",
"update",
"lock",
"for",
"the",
"enabled",
"fileserver",
"backends"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L468-L491 | [
"def",
"clear_lock",
"(",
"self",
",",
"back",
"=",
"None",
",",
"remote",
"=",
"None",
")",
":",
"back",
"=",
"self",
".",
"backends",
"(",
"back",
")",
"cleared",
"=",
"[",
"]",
"errors",
"=",
"[",
"]",
"for",
"fsb",
"in",
"back",
":",
"fstr",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Fileserver.update | Update all of the enabled fileserver backends which support the update
function, or | salt/fileserver/__init__.py | def update(self, back=None):
'''
Update all of the enabled fileserver backends which support the update
function, or
'''
back = self.backends(back)
for fsb in back:
fstr = '{0}.update'.format(fsb)
if fstr in self.servers:
log.debug(... | def update(self, back=None):
'''
Update all of the enabled fileserver backends which support the update
function, or
'''
back = self.backends(back)
for fsb in back:
fstr = '{0}.update'.format(fsb)
if fstr in self.servers:
log.debug(... | [
"Update",
"all",
"of",
"the",
"enabled",
"fileserver",
"backends",
"which",
"support",
"the",
"update",
"function",
"or"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L493-L503 | [
"def",
"update",
"(",
"self",
",",
"back",
"=",
"None",
")",
":",
"back",
"=",
"self",
".",
"backends",
"(",
"back",
")",
"for",
"fsb",
"in",
"back",
":",
"fstr",
"=",
"'{0}.update'",
".",
"format",
"(",
"fsb",
")",
"if",
"fstr",
"in",
"self",
".... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Fileserver.update_intervals | Return the update intervals for all of the enabled fileserver backends
which support variable update intervals. | salt/fileserver/__init__.py | def update_intervals(self, back=None):
'''
Return the update intervals for all of the enabled fileserver backends
which support variable update intervals.
'''
back = self.backends(back)
ret = {}
for fsb in back:
fstr = '{0}.update_intervals'.format(fsb... | def update_intervals(self, back=None):
'''
Return the update intervals for all of the enabled fileserver backends
which support variable update intervals.
'''
back = self.backends(back)
ret = {}
for fsb in back:
fstr = '{0}.update_intervals'.format(fsb... | [
"Return",
"the",
"update",
"intervals",
"for",
"all",
"of",
"the",
"enabled",
"fileserver",
"backends",
"which",
"support",
"variable",
"update",
"intervals",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L505-L516 | [
"def",
"update_intervals",
"(",
"self",
",",
"back",
"=",
"None",
")",
":",
"back",
"=",
"self",
".",
"backends",
"(",
"back",
")",
"ret",
"=",
"{",
"}",
"for",
"fsb",
"in",
"back",
":",
"fstr",
"=",
"'{0}.update_intervals'",
".",
"format",
"(",
"fsb... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Fileserver.envs | Return the environments for the named backend or all backends | salt/fileserver/__init__.py | def envs(self, back=None, sources=False):
'''
Return the environments for the named backend or all backends
'''
back = self.backends(back)
ret = set()
if sources:
ret = {}
for fsb in back:
fstr = '{0}.envs'.format(fsb)
kwargs = ... | def envs(self, back=None, sources=False):
'''
Return the environments for the named backend or all backends
'''
back = self.backends(back)
ret = set()
if sources:
ret = {}
for fsb in back:
fstr = '{0}.envs'.format(fsb)
kwargs = ... | [
"Return",
"the",
"environments",
"for",
"the",
"named",
"backend",
"or",
"all",
"backends"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L518-L538 | [
"def",
"envs",
"(",
"self",
",",
"back",
"=",
"None",
",",
"sources",
"=",
"False",
")",
":",
"back",
"=",
"self",
".",
"backends",
"(",
"back",
")",
"ret",
"=",
"set",
"(",
")",
"if",
"sources",
":",
"ret",
"=",
"{",
"}",
"for",
"fsb",
"in",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Fileserver.file_envs | Return environments for all backends for requests from fileclient | salt/fileserver/__init__.py | def file_envs(self, load=None):
'''
Return environments for all backends for requests from fileclient
'''
if load is None:
load = {}
load.pop('cmd', None)
return self.envs(**load) | def file_envs(self, load=None):
'''
Return environments for all backends for requests from fileclient
'''
if load is None:
load = {}
load.pop('cmd', None)
return self.envs(**load) | [
"Return",
"environments",
"for",
"all",
"backends",
"for",
"requests",
"from",
"fileclient"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L540-L547 | [
"def",
"file_envs",
"(",
"self",
",",
"load",
"=",
"None",
")",
":",
"if",
"load",
"is",
"None",
":",
"load",
"=",
"{",
"}",
"load",
".",
"pop",
"(",
"'cmd'",
",",
"None",
")",
"return",
"self",
".",
"envs",
"(",
"*",
"*",
"load",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Fileserver.init | Initialize the backend, only do so if the fs supports an init function | salt/fileserver/__init__.py | def init(self, back=None):
'''
Initialize the backend, only do so if the fs supports an init function
'''
back = self.backends(back)
for fsb in back:
fstr = '{0}.init'.format(fsb)
if fstr in self.servers:
self.servers[fstr]() | def init(self, back=None):
'''
Initialize the backend, only do so if the fs supports an init function
'''
back = self.backends(back)
for fsb in back:
fstr = '{0}.init'.format(fsb)
if fstr in self.servers:
self.servers[fstr]() | [
"Initialize",
"the",
"backend",
"only",
"do",
"so",
"if",
"the",
"fs",
"supports",
"an",
"init",
"function"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L549-L557 | [
"def",
"init",
"(",
"self",
",",
"back",
"=",
"None",
")",
":",
"back",
"=",
"self",
".",
"backends",
"(",
"back",
")",
"for",
"fsb",
"in",
"back",
":",
"fstr",
"=",
"'{0}.init'",
".",
"format",
"(",
"fsb",
")",
"if",
"fstr",
"in",
"self",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Fileserver._find_file | Convenience function for calls made using the RemoteClient | salt/fileserver/__init__.py | def _find_file(self, load):
'''
Convenience function for calls made using the RemoteClient
'''
path = load.get('path')
if not path:
return {'path': '',
'rel': ''}
tgt_env = load.get('saltenv', 'base')
return self.find_file(path, tgt... | def _find_file(self, load):
'''
Convenience function for calls made using the RemoteClient
'''
path = load.get('path')
if not path:
return {'path': '',
'rel': ''}
tgt_env = load.get('saltenv', 'base')
return self.find_file(path, tgt... | [
"Convenience",
"function",
"for",
"calls",
"made",
"using",
"the",
"RemoteClient"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L559-L568 | [
"def",
"_find_file",
"(",
"self",
",",
"load",
")",
":",
"path",
"=",
"load",
".",
"get",
"(",
"'path'",
")",
"if",
"not",
"path",
":",
"return",
"{",
"'path'",
":",
"''",
",",
"'rel'",
":",
"''",
"}",
"tgt_env",
"=",
"load",
".",
"get",
"(",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Fileserver.file_find | Convenience function for calls made using the LocalClient | salt/fileserver/__init__.py | def file_find(self, load):
'''
Convenience function for calls made using the LocalClient
'''
path = load.get('path')
if not path:
return {'path': '',
'rel': ''}
tgt_env = load.get('saltenv', 'base')
return self.find_file(path, tgt_e... | def file_find(self, load):
'''
Convenience function for calls made using the LocalClient
'''
path = load.get('path')
if not path:
return {'path': '',
'rel': ''}
tgt_env = load.get('saltenv', 'base')
return self.find_file(path, tgt_e... | [
"Convenience",
"function",
"for",
"calls",
"made",
"using",
"the",
"LocalClient"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L570-L579 | [
"def",
"file_find",
"(",
"self",
",",
"load",
")",
":",
"path",
"=",
"load",
".",
"get",
"(",
"'path'",
")",
"if",
"not",
"path",
":",
"return",
"{",
"'path'",
":",
"''",
",",
"'rel'",
":",
"''",
"}",
"tgt_env",
"=",
"load",
".",
"get",
"(",
"'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Fileserver.find_file | Find the path and return the fnd structure, this structure is passed
to other backend interfaces. | salt/fileserver/__init__.py | def find_file(self, path, saltenv, back=None):
'''
Find the path and return the fnd structure, this structure is passed
to other backend interfaces.
'''
path = salt.utils.stringutils.to_unicode(path)
saltenv = salt.utils.stringutils.to_unicode(saltenv)
back = self... | def find_file(self, path, saltenv, back=None):
'''
Find the path and return the fnd structure, this structure is passed
to other backend interfaces.
'''
path = salt.utils.stringutils.to_unicode(path)
saltenv = salt.utils.stringutils.to_unicode(saltenv)
back = self... | [
"Find",
"the",
"path",
"and",
"return",
"the",
"fnd",
"structure",
"this",
"structure",
"is",
"passed",
"to",
"other",
"backend",
"interfaces",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L581-L627 | [
"def",
"find_file",
"(",
"self",
",",
"path",
",",
"saltenv",
",",
"back",
"=",
"None",
")",
":",
"path",
"=",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_unicode",
"(",
"path",
")",
"saltenv",
"=",
"salt",
".",
"utils",
".",
"stringutils",
".... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Fileserver.serve_file | Serve up a chunk of a file | salt/fileserver/__init__.py | def serve_file(self, load):
'''
Serve up a chunk of a file
'''
ret = {'data': '',
'dest': ''}
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if 'path' not in load or 'loc' not in load or 'saltenv' not in... | def serve_file(self, load):
'''
Serve up a chunk of a file
'''
ret = {'data': '',
'dest': ''}
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if 'path' not in load or 'loc' not in load or 'saltenv' not in... | [
"Serve",
"up",
"a",
"chunk",
"of",
"a",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L629-L651 | [
"def",
"serve_file",
"(",
"self",
",",
"load",
")",
":",
"ret",
"=",
"{",
"'data'",
":",
"''",
",",
"'dest'",
":",
"''",
"}",
"if",
"'env'",
"in",
"load",
":",
"# \"env\" is not supported; Use \"saltenv\".",
"load",
".",
"pop",
"(",
"'env'",
")",
"if",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Fileserver.__file_hash_and_stat | Common code for hashing and stating files | salt/fileserver/__init__.py | def __file_hash_and_stat(self, load):
'''
Common code for hashing and stating files
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if 'path' not in load or 'saltenv' not in load:
return '', None
if not i... | def __file_hash_and_stat(self, load):
'''
Common code for hashing and stating files
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if 'path' not in load or 'saltenv' not in load:
return '', None
if not i... | [
"Common",
"code",
"for",
"hashing",
"and",
"stating",
"files"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L653-L674 | [
"def",
"__file_hash_and_stat",
"(",
"self",
",",
"load",
")",
":",
"if",
"'env'",
"in",
"load",
":",
"# \"env\" is not supported; Use \"saltenv\".",
"load",
".",
"pop",
"(",
"'env'",
")",
"if",
"'path'",
"not",
"in",
"load",
"or",
"'saltenv'",
"not",
"in",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Fileserver.clear_file_list_cache | Deletes the file_lists cache files | salt/fileserver/__init__.py | def clear_file_list_cache(self, load):
'''
Deletes the file_lists cache files
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
saltenv = load.get('saltenv', [])
if saltenv is not None:
if not isinstance(sa... | def clear_file_list_cache(self, load):
'''
Deletes the file_lists cache files
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
saltenv = load.get('saltenv', [])
if saltenv is not None:
if not isinstance(sa... | [
"Deletes",
"the",
"file_lists",
"cache",
"files"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L694-L769 | [
"def",
"clear_file_list_cache",
"(",
"self",
",",
"load",
")",
":",
"if",
"'env'",
"in",
"load",
":",
"# \"env\" is not supported; Use \"saltenv\".",
"load",
".",
"pop",
"(",
"'env'",
")",
"saltenv",
"=",
"load",
".",
"get",
"(",
"'saltenv'",
",",
"[",
"]",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Fileserver.file_list | Return a list of files from the dominant environment | salt/fileserver/__init__.py | def file_list(self, load):
'''
Return a list of files from the dominant environment
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
ret = set()
if 'saltenv' not in load:
return []
if not isinstanc... | def file_list(self, load):
'''
Return a list of files from the dominant environment
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
ret = set()
if 'saltenv' not in load:
return []
if not isinstanc... | [
"Return",
"a",
"list",
"of",
"files",
"from",
"the",
"dominant",
"environment"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L772-L794 | [
"def",
"file_list",
"(",
"self",
",",
"load",
")",
":",
"if",
"'env'",
"in",
"load",
":",
"# \"env\" is not supported; Use \"saltenv\".",
"load",
".",
"pop",
"(",
"'env'",
")",
"ret",
"=",
"set",
"(",
")",
"if",
"'saltenv'",
"not",
"in",
"load",
":",
"re... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Fileserver.symlink_list | Return a list of symlinked files and dirs | salt/fileserver/__init__.py | def symlink_list(self, load):
'''
Return a list of symlinked files and dirs
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
ret = {}
if 'saltenv' not in load:
return {}
if not isinstance(load['sal... | def symlink_list(self, load):
'''
Return a list of symlinked files and dirs
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
ret = {}
if 'saltenv' not in load:
return {}
if not isinstance(load['sal... | [
"Return",
"a",
"list",
"of",
"symlinked",
"files",
"and",
"dirs"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L847-L871 | [
"def",
"symlink_list",
"(",
"self",
",",
"load",
")",
":",
"if",
"'env'",
"in",
"load",
":",
"# \"env\" is not supported; Use \"saltenv\".",
"load",
".",
"pop",
"(",
"'env'",
")",
"ret",
"=",
"{",
"}",
"if",
"'saltenv'",
"not",
"in",
"load",
":",
"return",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | FSChan.send | Emulate the channel send method, the tries and timeout are not used | salt/fileserver/__init__.py | def send(self, load, tries=None, timeout=None, raw=False): # pylint: disable=unused-argument
'''
Emulate the channel send method, the tries and timeout are not used
'''
if 'cmd' not in load:
log.error('Malformed request, no cmd: %s', load)
return {}
cmd =... | def send(self, load, tries=None, timeout=None, raw=False): # pylint: disable=unused-argument
'''
Emulate the channel send method, the tries and timeout are not used
'''
if 'cmd' not in load:
log.error('Malformed request, no cmd: %s', load)
return {}
cmd =... | [
"Emulate",
"the",
"channel",
"send",
"method",
"the",
"tries",
"and",
"timeout",
"are",
"not",
"used"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L893-L906 | [
"def",
"send",
"(",
"self",
",",
"load",
",",
"tries",
"=",
"None",
",",
"timeout",
"=",
"None",
",",
"raw",
"=",
"False",
")",
":",
"# pylint: disable=unused-argument",
"if",
"'cmd'",
"not",
"in",
"load",
":",
"log",
".",
"error",
"(",
"'Malformed reque... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | render | Accepts DSON data as a string or as a file object and runs it through the
JSON parser.
:rtype: A Python data structure | salt/renderers/dson.py | def render(dson_input, saltenv='base', sls='', **kwargs):
'''
Accepts DSON data as a string or as a file object and runs it through the
JSON parser.
:rtype: A Python data structure
'''
if not isinstance(dson_input, six.string_types):
dson_input = dson_input.read()
log.debug('DSON i... | def render(dson_input, saltenv='base', sls='', **kwargs):
'''
Accepts DSON data as a string or as a file object and runs it through the
JSON parser.
:rtype: A Python data structure
'''
if not isinstance(dson_input, six.string_types):
dson_input = dson_input.read()
log.debug('DSON i... | [
"Accepts",
"DSON",
"data",
"as",
"a",
"string",
"or",
"as",
"a",
"file",
"object",
"and",
"runs",
"it",
"through",
"the",
"JSON",
"parser",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/dson.py#L37-L53 | [
"def",
"render",
"(",
"dson_input",
",",
"saltenv",
"=",
"'base'",
",",
"sls",
"=",
"''",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"dson_input",
",",
"six",
".",
"string_types",
")",
":",
"dson_input",
"=",
"dson_input",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | targets | Return the targets from the flat yaml file, checks opts for location but
defaults to /etc/salt/roster | salt/roster/scan.py | def targets(tgt, tgt_type='glob', **kwargs):
'''
Return the targets from the flat yaml file, checks opts for location but
defaults to /etc/salt/roster
'''
rmatcher = RosterMatcher(tgt, tgt_type)
return rmatcher.targets() | def targets(tgt, tgt_type='glob', **kwargs):
'''
Return the targets from the flat yaml file, checks opts for location but
defaults to /etc/salt/roster
'''
rmatcher = RosterMatcher(tgt, tgt_type)
return rmatcher.targets() | [
"Return",
"the",
"targets",
"from",
"the",
"flat",
"yaml",
"file",
"checks",
"opts",
"for",
"location",
"but",
"defaults",
"to",
"/",
"etc",
"/",
"salt",
"/",
"roster"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/scan.py#L23-L29 | [
"def",
"targets",
"(",
"tgt",
",",
"tgt_type",
"=",
"'glob'",
",",
"*",
"*",
"kwargs",
")",
":",
"rmatcher",
"=",
"RosterMatcher",
"(",
"tgt",
",",
"tgt_type",
")",
"return",
"rmatcher",
".",
"targets",
"(",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RosterMatcher.targets | Return ip addrs based on netmask, sitting in the "glob" spot because
it is the default | salt/roster/scan.py | def targets(self):
'''
Return ip addrs based on netmask, sitting in the "glob" spot because
it is the default
'''
addrs = ()
ret = {}
ports = __opts__['ssh_scan_ports']
if not isinstance(ports, list):
# Comma-separate list of integers
... | def targets(self):
'''
Return ip addrs based on netmask, sitting in the "glob" spot because
it is the default
'''
addrs = ()
ret = {}
ports = __opts__['ssh_scan_ports']
if not isinstance(ports, list):
# Comma-separate list of integers
... | [
"Return",
"ip",
"addrs",
"based",
"on",
"netmask",
"sitting",
"in",
"the",
"glob",
"spot",
"because",
"it",
"is",
"the",
"default"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/scan.py#L40-L73 | [
"def",
"targets",
"(",
"self",
")",
":",
"addrs",
"=",
"(",
")",
"ret",
"=",
"{",
"}",
"ports",
"=",
"__opts__",
"[",
"'ssh_scan_ports'",
"]",
"if",
"not",
"isinstance",
"(",
"ports",
",",
"list",
")",
":",
"# Comma-separate list of integers",
"ports",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | evaluate | Evaluate a jsonnet input string.
contents
Raw jsonnet string to evaluate.
jsonnet_library_paths
List of jsonnet library paths. | salt/modules/jsonnet.py | def evaluate(contents, jsonnet_library_paths=None):
'''
Evaluate a jsonnet input string.
contents
Raw jsonnet string to evaluate.
jsonnet_library_paths
List of jsonnet library paths.
'''
if not jsonnet_library_paths:
jsonnet_library_paths = __salt__['config.option'](
... | def evaluate(contents, jsonnet_library_paths=None):
'''
Evaluate a jsonnet input string.
contents
Raw jsonnet string to evaluate.
jsonnet_library_paths
List of jsonnet library paths.
'''
if not jsonnet_library_paths:
jsonnet_library_paths = __salt__['config.option'](
... | [
"Evaluate",
"a",
"jsonnet",
"input",
"string",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jsonnet.py#L71-L90 | [
"def",
"evaluate",
"(",
"contents",
",",
"jsonnet_library_paths",
"=",
"None",
")",
":",
"if",
"not",
"jsonnet_library_paths",
":",
"jsonnet_library_paths",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'jsonnet.library_paths'",
",",
"[",
"'.'",
"]",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_fmdump | Parses fmdump output | salt/modules/solaris_fmadm.py | def _parse_fmdump(output):
'''
Parses fmdump output
'''
result = []
output = output.split("\n")
# extract header
header = [field for field in output[0].lower().split(" ") if field]
del output[0]
# parse entries
for entry in output:
entry = [item for item in entry.split(... | def _parse_fmdump(output):
'''
Parses fmdump output
'''
result = []
output = output.split("\n")
# extract header
header = [field for field in output[0].lower().split(" ") if field]
del output[0]
# parse entries
for entry in output:
entry = [item for item in entry.split(... | [
"Parses",
"fmdump",
"output"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L63-L86 | [
"def",
"_parse_fmdump",
"(",
"output",
")",
":",
"result",
"=",
"[",
"]",
"output",
"=",
"output",
".",
"split",
"(",
"\"\\n\"",
")",
"# extract header",
"header",
"=",
"[",
"field",
"for",
"field",
"in",
"output",
"[",
"0",
"]",
".",
"lower",
"(",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_fmdump_verbose | Parses fmdump verbose output | salt/modules/solaris_fmadm.py | def _parse_fmdump_verbose(output):
'''
Parses fmdump verbose output
'''
result = []
output = output.split("\n")
fault = []
verbose_fault = {}
for line in output:
if line.startswith('TIME'):
fault.append(line)
if verbose_fault:
result.appen... | def _parse_fmdump_verbose(output):
'''
Parses fmdump verbose output
'''
result = []
output = output.split("\n")
fault = []
verbose_fault = {}
for line in output:
if line.startswith('TIME'):
fault.append(line)
if verbose_fault:
result.appen... | [
"Parses",
"fmdump",
"verbose",
"output"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L89-L120 | [
"def",
"_parse_fmdump_verbose",
"(",
"output",
")",
":",
"result",
"=",
"[",
"]",
"output",
"=",
"output",
".",
"split",
"(",
"\"\\n\"",
")",
"fault",
"=",
"[",
"]",
"verbose_fault",
"=",
"{",
"}",
"for",
"line",
"in",
"output",
":",
"if",
"line",
".... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_fmadm_config | Parsbb fmdump/fmadm output | salt/modules/solaris_fmadm.py | def _parse_fmadm_config(output):
'''
Parsbb fmdump/fmadm output
'''
result = []
output = output.split("\n")
# extract header
header = [field for field in output[0].lower().split(" ") if field]
del output[0]
# parse entries
for entry in output:
entry = [item for item in ... | def _parse_fmadm_config(output):
'''
Parsbb fmdump/fmadm output
'''
result = []
output = output.split("\n")
# extract header
header = [field for field in output[0].lower().split(" ") if field]
del output[0]
# parse entries
for entry in output:
entry = [item for item in ... | [
"Parsbb",
"fmdump",
"/",
"fmadm",
"output"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L123-L154 | [
"def",
"_parse_fmadm_config",
"(",
"output",
")",
":",
"result",
"=",
"[",
"]",
"output",
"=",
"output",
".",
"split",
"(",
"\"\\n\"",
")",
"# extract header",
"header",
"=",
"[",
"field",
"for",
"field",
"in",
"output",
"[",
"0",
"]",
".",
"lower",
"(... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _fmadm_action_fmri | Internal function for fmadm.repqired, fmadm.replaced, fmadm.flush | salt/modules/solaris_fmadm.py | def _fmadm_action_fmri(action, fmri):
'''
Internal function for fmadm.repqired, fmadm.replaced, fmadm.flush
'''
ret = {}
fmadm = _check_fmadm()
cmd = '{cmd} {action} {fmri}'.format(
cmd=fmadm,
action=action,
fmri=fmri
)
res = __salt__['cmd.run_all'](cmd)
retco... | def _fmadm_action_fmri(action, fmri):
'''
Internal function for fmadm.repqired, fmadm.replaced, fmadm.flush
'''
ret = {}
fmadm = _check_fmadm()
cmd = '{cmd} {action} {fmri}'.format(
cmd=fmadm,
action=action,
fmri=fmri
)
res = __salt__['cmd.run_all'](cmd)
retco... | [
"Internal",
"function",
"for",
"fmadm",
".",
"repqired",
"fmadm",
".",
"replaced",
"fmadm",
".",
"flush"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L157-L176 | [
"def",
"_fmadm_action_fmri",
"(",
"action",
",",
"fmri",
")",
":",
"ret",
"=",
"{",
"}",
"fmadm",
"=",
"_check_fmadm",
"(",
")",
"cmd",
"=",
"'{cmd} {action} {fmri}'",
".",
"format",
"(",
"cmd",
"=",
"fmadm",
",",
"action",
"=",
"action",
",",
"fmri",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_fmadm_faulty | Parse fmadm faulty output | salt/modules/solaris_fmadm.py | def _parse_fmadm_faulty(output):
'''
Parse fmadm faulty output
'''
def _merge_data(summary, fault):
result = {}
uuid = summary['event-id']
del summary['event-id']
result[uuid] = OrderedDict()
result[uuid]['summary'] = summary
result[uuid]['fault'] = fault... | def _parse_fmadm_faulty(output):
'''
Parse fmadm faulty output
'''
def _merge_data(summary, fault):
result = {}
uuid = summary['event-id']
del summary['event-id']
result[uuid] = OrderedDict()
result[uuid]['summary'] = summary
result[uuid]['fault'] = fault... | [
"Parse",
"fmadm",
"faulty",
"output"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L179-L246 | [
"def",
"_parse_fmadm_faulty",
"(",
"output",
")",
":",
"def",
"_merge_data",
"(",
"summary",
",",
"fault",
")",
":",
"result",
"=",
"{",
"}",
"uuid",
"=",
"summary",
"[",
"'event-id'",
"]",
"del",
"summary",
"[",
"'event-id'",
"]",
"result",
"[",
"uuid",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_records | Display fault management logs
after : string
filter events after time, see man fmdump for format
before : string
filter events before time, see man fmdump for format
CLI Example:
.. code-block:: bash
salt '*' fmadm.list | salt/modules/solaris_fmadm.py | def list_records(after=None, before=None):
'''
Display fault management logs
after : string
filter events after time, see man fmdump for format
before : string
filter events before time, see man fmdump for format
CLI Example:
.. code-block:: bash
salt '*' fmadm.list
... | def list_records(after=None, before=None):
'''
Display fault management logs
after : string
filter events after time, see man fmdump for format
before : string
filter events before time, see man fmdump for format
CLI Example:
.. code-block:: bash
salt '*' fmadm.list
... | [
"Display",
"fault",
"management",
"logs"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L249-L280 | [
"def",
"list_records",
"(",
"after",
"=",
"None",
",",
"before",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"fmdump",
"=",
"_check_fmdump",
"(",
")",
"cmd",
"=",
"'{cmd}{after}{before}'",
".",
"format",
"(",
"cmd",
"=",
"fmdump",
",",
"after",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | show | Display log details
uuid: string
uuid of fault
CLI Example:
.. code-block:: bash
salt '*' fmadm.show 11b4070f-4358-62fa-9e1e-998f485977e1 | salt/modules/solaris_fmadm.py | def show(uuid):
'''
Display log details
uuid: string
uuid of fault
CLI Example:
.. code-block:: bash
salt '*' fmadm.show 11b4070f-4358-62fa-9e1e-998f485977e1
'''
ret = {}
fmdump = _check_fmdump()
cmd = '{cmd} -u {uuid} -V'.format(
cmd=fmdump,
uuid=... | def show(uuid):
'''
Display log details
uuid: string
uuid of fault
CLI Example:
.. code-block:: bash
salt '*' fmadm.show 11b4070f-4358-62fa-9e1e-998f485977e1
'''
ret = {}
fmdump = _check_fmdump()
cmd = '{cmd} -u {uuid} -V'.format(
cmd=fmdump,
uuid=... | [
"Display",
"log",
"details"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L283-L310 | [
"def",
"show",
"(",
"uuid",
")",
":",
"ret",
"=",
"{",
"}",
"fmdump",
"=",
"_check_fmdump",
"(",
")",
"cmd",
"=",
"'{cmd} -u {uuid} -V'",
".",
"format",
"(",
"cmd",
"=",
"fmdump",
",",
"uuid",
"=",
"uuid",
")",
"res",
"=",
"__salt__",
"[",
"'cmd.run_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | config | Display fault manager configuration
CLI Example:
.. code-block:: bash
salt '*' fmadm.config | salt/modules/solaris_fmadm.py | def config():
'''
Display fault manager configuration
CLI Example:
.. code-block:: bash
salt '*' fmadm.config
'''
ret = {}
fmadm = _check_fmadm()
cmd = '{cmd} config'.format(
cmd=fmadm
)
res = __salt__['cmd.run_all'](cmd)
retcode = res['retcode']
result... | def config():
'''
Display fault manager configuration
CLI Example:
.. code-block:: bash
salt '*' fmadm.config
'''
ret = {}
fmadm = _check_fmadm()
cmd = '{cmd} config'.format(
cmd=fmadm
)
res = __salt__['cmd.run_all'](cmd)
retcode = res['retcode']
result... | [
"Display",
"fault",
"manager",
"configuration"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L313-L336 | [
"def",
"config",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"fmadm",
"=",
"_check_fmadm",
"(",
")",
"cmd",
"=",
"'{cmd} config'",
".",
"format",
"(",
"cmd",
"=",
"fmadm",
")",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
")",
"retcode",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | load | Load specified fault manager module
path: string
path of fault manager module
CLI Example:
.. code-block:: bash
salt '*' fmadm.load /module/path | salt/modules/solaris_fmadm.py | def load(path):
'''
Load specified fault manager module
path: string
path of fault manager module
CLI Example:
.. code-block:: bash
salt '*' fmadm.load /module/path
'''
ret = {}
fmadm = _check_fmadm()
cmd = '{cmd} load {path}'.format(
cmd=fmadm,
pa... | def load(path):
'''
Load specified fault manager module
path: string
path of fault manager module
CLI Example:
.. code-block:: bash
salt '*' fmadm.load /module/path
'''
ret = {}
fmadm = _check_fmadm()
cmd = '{cmd} load {path}'.format(
cmd=fmadm,
pa... | [
"Load",
"specified",
"fault",
"manager",
"module"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L339-L366 | [
"def",
"load",
"(",
"path",
")",
":",
"ret",
"=",
"{",
"}",
"fmadm",
"=",
"_check_fmadm",
"(",
")",
"cmd",
"=",
"'{cmd} load {path}'",
".",
"format",
"(",
"cmd",
"=",
"fmadm",
",",
"path",
"=",
"path",
")",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | unload | Unload specified fault manager module
module: string
module to unload
CLI Example:
.. code-block:: bash
salt '*' fmadm.unload software-response | salt/modules/solaris_fmadm.py | def unload(module):
'''
Unload specified fault manager module
module: string
module to unload
CLI Example:
.. code-block:: bash
salt '*' fmadm.unload software-response
'''
ret = {}
fmadm = _check_fmadm()
cmd = '{cmd} unload {module}'.format(
cmd=fmadm,
... | def unload(module):
'''
Unload specified fault manager module
module: string
module to unload
CLI Example:
.. code-block:: bash
salt '*' fmadm.unload software-response
'''
ret = {}
fmadm = _check_fmadm()
cmd = '{cmd} unload {module}'.format(
cmd=fmadm,
... | [
"Unload",
"specified",
"fault",
"manager",
"module"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L369-L396 | [
"def",
"unload",
"(",
"module",
")",
":",
"ret",
"=",
"{",
"}",
"fmadm",
"=",
"_check_fmadm",
"(",
")",
"cmd",
"=",
"'{cmd} unload {module}'",
".",
"format",
"(",
"cmd",
"=",
"fmadm",
",",
"module",
"=",
"module",
")",
"res",
"=",
"__salt__",
"[",
"'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | reset | Reset module or sub-component
module: string
module to unload
serd : string
serd sub module
CLI Example:
.. code-block:: bash
salt '*' fmadm.reset software-response | salt/modules/solaris_fmadm.py | def reset(module, serd=None):
'''
Reset module or sub-component
module: string
module to unload
serd : string
serd sub module
CLI Example:
.. code-block:: bash
salt '*' fmadm.reset software-response
'''
ret = {}
fmadm = _check_fmadm()
cmd = '{cmd} rese... | def reset(module, serd=None):
'''
Reset module or sub-component
module: string
module to unload
serd : string
serd sub module
CLI Example:
.. code-block:: bash
salt '*' fmadm.reset software-response
'''
ret = {}
fmadm = _check_fmadm()
cmd = '{cmd} rese... | [
"Reset",
"module",
"or",
"sub",
"-",
"component"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L399-L429 | [
"def",
"reset",
"(",
"module",
",",
"serd",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"fmadm",
"=",
"_check_fmadm",
"(",
")",
"cmd",
"=",
"'{cmd} reset {serd}{module}'",
".",
"format",
"(",
"cmd",
"=",
"fmadm",
",",
"serd",
"=",
"'-s {0} '",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | faulty | Display list of faulty resources
CLI Example:
.. code-block:: bash
salt '*' fmadm.faulty | salt/modules/solaris_fmadm.py | def faulty():
'''
Display list of faulty resources
CLI Example:
.. code-block:: bash
salt '*' fmadm.faulty
'''
fmadm = _check_fmadm()
cmd = '{cmd} faulty'.format(
cmd=fmadm,
)
res = __salt__['cmd.run_all'](cmd)
result = {}
if res['stdout'] == '':
re... | def faulty():
'''
Display list of faulty resources
CLI Example:
.. code-block:: bash
salt '*' fmadm.faulty
'''
fmadm = _check_fmadm()
cmd = '{cmd} faulty'.format(
cmd=fmadm,
)
res = __salt__['cmd.run_all'](cmd)
result = {}
if res['stdout'] == '':
re... | [
"Display",
"list",
"of",
"faulty",
"resources"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L496-L517 | [
"def",
"faulty",
"(",
")",
":",
"fmadm",
"=",
"_check_fmadm",
"(",
")",
"cmd",
"=",
"'{cmd} faulty'",
".",
"format",
"(",
"cmd",
"=",
"fmadm",
",",
")",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
")",
"result",
"=",
"{",
"}",
"i... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _validate_device | Ensure the device name supplied is valid in a manner similar to the
`exists` function, but raise errors on invalid input rather than return
False.
This function only validates a block device, it does not check if the block
device is a drive or a partition or a filesystem, etc. | salt/modules/parted_partition.py | def _validate_device(device):
'''
Ensure the device name supplied is valid in a manner similar to the
`exists` function, but raise errors on invalid input rather than return
False.
This function only validates a block device, it does not check if the block
device is a drive or a partition or a ... | def _validate_device(device):
'''
Ensure the device name supplied is valid in a manner similar to the
`exists` function, but raise errors on invalid input rather than return
False.
This function only validates a block device, it does not check if the block
device is a drive or a partition or a ... | [
"Ensure",
"the",
"device",
"name",
"supplied",
"is",
"valid",
"in",
"a",
"manner",
"similar",
"to",
"the",
"exists",
"function",
"but",
"raise",
"errors",
"on",
"invalid",
"input",
"rather",
"than",
"return",
"False",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L80-L97 | [
"def",
"_validate_device",
"(",
"device",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"device",
")",
":",
"dev",
"=",
"os",
".",
"stat",
"(",
"device",
")",
".",
"st_mode",
"if",
"stat",
".",
"S_ISBLK",
"(",
"dev",
")",
":",
"return",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _validate_partition_boundary | Ensure valid partition boundaries are supplied. | salt/modules/parted_partition.py | def _validate_partition_boundary(boundary):
'''
Ensure valid partition boundaries are supplied.
'''
boundary = six.text_type(boundary)
match = re.search(r'^([\d.]+)(\D*)$', boundary)
if match:
unit = match.group(2)
if not unit or unit in VALID_UNITS:
return
raise ... | def _validate_partition_boundary(boundary):
'''
Ensure valid partition boundaries are supplied.
'''
boundary = six.text_type(boundary)
match = re.search(r'^([\d.]+)(\D*)$', boundary)
if match:
unit = match.group(2)
if not unit or unit in VALID_UNITS:
return
raise ... | [
"Ensure",
"valid",
"partition",
"boundaries",
"are",
"supplied",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L100-L112 | [
"def",
"_validate_partition_boundary",
"(",
"boundary",
")",
":",
"boundary",
"=",
"six",
".",
"text_type",
"(",
"boundary",
")",
"match",
"=",
"re",
".",
"search",
"(",
"r'^([\\d.]+)(\\D*)$'",
",",
"boundary",
")",
"if",
"match",
":",
"unit",
"=",
"match",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | probe | Ask the kernel to update its local partition data. When no args are
specified all block devices are tried.
Caution: Generally only works on devices with no mounted partitions and
may take a long time to return if specified devices are in use.
CLI Examples:
.. code-block:: bash
salt '*' p... | salt/modules/parted_partition.py | def probe(*devices):
'''
Ask the kernel to update its local partition data. When no args are
specified all block devices are tried.
Caution: Generally only works on devices with no mounted partitions and
may take a long time to return if specified devices are in use.
CLI Examples:
.. code... | def probe(*devices):
'''
Ask the kernel to update its local partition data. When no args are
specified all block devices are tried.
Caution: Generally only works on devices with no mounted partitions and
may take a long time to return if specified devices are in use.
CLI Examples:
.. code... | [
"Ask",
"the",
"kernel",
"to",
"update",
"its",
"local",
"partition",
"data",
".",
"When",
"no",
"args",
"are",
"specified",
"all",
"block",
"devices",
"are",
"tried",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L115-L136 | [
"def",
"probe",
"(",
"*",
"devices",
")",
":",
"for",
"device",
"in",
"devices",
":",
"_validate_device",
"(",
"device",
")",
"cmd",
"=",
"'partprobe -- {0}'",
".",
"format",
"(",
"\" \"",
".",
"join",
"(",
"devices",
")",
")",
"out",
"=",
"__salt__",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_ | Prints partition information of given <device>
CLI Examples:
.. code-block:: bash
salt '*' partition.list /dev/sda
salt '*' partition.list /dev/sda unit=s
salt '*' partition.list /dev/sda unit=kB | salt/modules/parted_partition.py | def list_(device, unit=None):
'''
Prints partition information of given <device>
CLI Examples:
.. code-block:: bash
salt '*' partition.list /dev/sda
salt '*' partition.list /dev/sda unit=s
salt '*' partition.list /dev/sda unit=kB
'''
_validate_device(device)
if un... | def list_(device, unit=None):
'''
Prints partition information of given <device>
CLI Examples:
.. code-block:: bash
salt '*' partition.list /dev/sda
salt '*' partition.list /dev/sda unit=s
salt '*' partition.list /dev/sda unit=kB
'''
_validate_device(device)
if un... | [
"Prints",
"partition",
"information",
"of",
"given",
"<device",
">"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L139-L213 | [
"def",
"list_",
"(",
"device",
",",
"unit",
"=",
"None",
")",
":",
"_validate_device",
"(",
"device",
")",
"if",
"unit",
":",
"if",
"unit",
"not",
"in",
"VALID_UNITS",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid unit passed to partition.part_list'",
")... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | align_check | Check if partition satisfies the alignment constraint of part_type.
Type must be "minimal" or "optimal".
CLI Example:
.. code-block:: bash
salt '*' partition.align_check /dev/sda minimal 1 | salt/modules/parted_partition.py | def align_check(device, part_type, partition):
'''
Check if partition satisfies the alignment constraint of part_type.
Type must be "minimal" or "optimal".
CLI Example:
.. code-block:: bash
salt '*' partition.align_check /dev/sda minimal 1
'''
_validate_device(device)
if part... | def align_check(device, part_type, partition):
'''
Check if partition satisfies the alignment constraint of part_type.
Type must be "minimal" or "optimal".
CLI Example:
.. code-block:: bash
salt '*' partition.align_check /dev/sda minimal 1
'''
_validate_device(device)
if part... | [
"Check",
"if",
"partition",
"satisfies",
"the",
"alignment",
"constraint",
"of",
"part_type",
".",
"Type",
"must",
"be",
"minimal",
"or",
"optimal",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L216-L245 | [
"def",
"align_check",
"(",
"device",
",",
"part_type",
",",
"partition",
")",
":",
"_validate_device",
"(",
"device",
")",
"if",
"part_type",
"not",
"in",
"set",
"(",
"[",
"'minimal'",
",",
"'optimal'",
"]",
")",
":",
"raise",
"CommandExecutionError",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | cp | Copies the file system on the partition <from-minor> to partition
<to-minor>, deleting the original contents of the destination
partition.
CLI Example:
.. code-block:: bash
salt '*' partition.cp /dev/sda 2 3 | salt/modules/parted_partition.py | def cp(device, from_minor, to_minor): # pylint: disable=C0103
'''
Copies the file system on the partition <from-minor> to partition
<to-minor>, deleting the original contents of the destination
partition.
CLI Example:
.. code-block:: bash
salt '*' partition.cp /dev/sda 2 3
'''
... | def cp(device, from_minor, to_minor): # pylint: disable=C0103
'''
Copies the file system on the partition <from-minor> to partition
<to-minor>, deleting the original contents of the destination
partition.
CLI Example:
.. code-block:: bash
salt '*' partition.cp /dev/sda 2 3
'''
... | [
"Copies",
"the",
"file",
"system",
"on",
"the",
"partition",
"<from",
"-",
"minor",
">",
"to",
"partition",
"<to",
"-",
"minor",
">",
"deleting",
"the",
"original",
"contents",
"of",
"the",
"destination",
"partition",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L272-L296 | [
"def",
"cp",
"(",
"device",
",",
"from_minor",
",",
"to_minor",
")",
":",
"# pylint: disable=C0103",
"_validate_device",
"(",
"device",
")",
"try",
":",
"int",
"(",
"from_minor",
")",
"int",
"(",
"to_minor",
")",
"except",
"Exception",
":",
"raise",
"Command... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_id | Sets the system ID for the partition. Some typical values are::
b: FAT32 (vfat)
7: HPFS/NTFS
82: Linux Swap
83: Linux
8e: Linux LVM
fd: Linux RAID Auto
CLI Example:
.. code-block:: bash
salt '*' partition.set_id /dev/sda 1 83 | salt/modules/parted_partition.py | def set_id(device, minor, system_id):
'''
Sets the system ID for the partition. Some typical values are::
b: FAT32 (vfat)
7: HPFS/NTFS
82: Linux Swap
83: Linux
8e: Linux LVM
fd: Linux RAID Auto
CLI Example:
.. code-block:: bash
salt '*' parti... | def set_id(device, minor, system_id):
'''
Sets the system ID for the partition. Some typical values are::
b: FAT32 (vfat)
7: HPFS/NTFS
82: Linux Swap
83: Linux
8e: Linux LVM
fd: Linux RAID Auto
CLI Example:
.. code-block:: bash
salt '*' parti... | [
"Sets",
"the",
"system",
"ID",
"for",
"the",
"partition",
".",
"Some",
"typical",
"values",
"are",
"::"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L330-L363 | [
"def",
"set_id",
"(",
"device",
",",
"minor",
",",
"system_id",
")",
":",
"_validate_device",
"(",
"device",
")",
"try",
":",
"int",
"(",
"minor",
")",
"except",
"Exception",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid minor number passed to partition.se... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | system_types | List the system types that are supported by the installed version of sfdisk
CLI Example:
.. code-block:: bash
salt '*' partition.system_types | salt/modules/parted_partition.py | def system_types():
'''
List the system types that are supported by the installed version of sfdisk
CLI Example:
.. code-block:: bash
salt '*' partition.system_types
'''
ret = {}
for line in __salt__['cmd.run']('sfdisk -T').splitlines():
if not line:
continue
... | def system_types():
'''
List the system types that are supported by the installed version of sfdisk
CLI Example:
.. code-block:: bash
salt '*' partition.system_types
'''
ret = {}
for line in __salt__['cmd.run']('sfdisk -T').splitlines():
if not line:
continue
... | [
"List",
"the",
"system",
"types",
"that",
"are",
"supported",
"by",
"the",
"installed",
"version",
"of",
"sfdisk"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L366-L384 | [
"def",
"system_types",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"line",
"in",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'sfdisk -T'",
")",
".",
"splitlines",
"(",
")",
":",
"if",
"not",
"line",
":",
"continue",
"if",
"line",
".",
"startswith",
"(",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | mkfs | Makes a file system <fs_type> on partition <device>, destroying all data
that resides on that partition. <fs_type> must be one of "ext2", "fat32",
"fat16", "linux-swap" or "reiserfs" (if libreiserfs is installed)
CLI Example:
.. code-block:: bash
salt '*' partition.mkfs /dev/sda2 fat32 | salt/modules/parted_partition.py | def mkfs(device, fs_type):
'''
Makes a file system <fs_type> on partition <device>, destroying all data
that resides on that partition. <fs_type> must be one of "ext2", "fat32",
"fat16", "linux-swap" or "reiserfs" (if libreiserfs is installed)
CLI Example:
.. code-block:: bash
salt '*... | def mkfs(device, fs_type):
'''
Makes a file system <fs_type> on partition <device>, destroying all data
that resides on that partition. <fs_type> must be one of "ext2", "fat32",
"fat16", "linux-swap" or "reiserfs" (if libreiserfs is installed)
CLI Example:
.. code-block:: bash
salt '*... | [
"Makes",
"a",
"file",
"system",
"<fs_type",
">",
"on",
"partition",
"<device",
">",
"destroying",
"all",
"data",
"that",
"resides",
"on",
"that",
"partition",
".",
"<fs_type",
">",
"must",
"be",
"one",
"of",
"ext2",
"fat32",
"fat16",
"linux",
"-",
"swap",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L397-L426 | [
"def",
"mkfs",
"(",
"device",
",",
"fs_type",
")",
":",
"_validate_device",
"(",
"device",
")",
"if",
"not",
"_is_fstype",
"(",
"fs_type",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid fs_type passed to partition.mkfs'",
")",
"if",
"fs_type",
"==",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | mklabel | Create a new disklabel (partition table) of label_type.
Type should be one of "aix", "amiga", "bsd", "dvh", "gpt", "loop", "mac",
"msdos", "pc98", or "sun".
CLI Example:
.. code-block:: bash
salt '*' partition.mklabel /dev/sda msdos | salt/modules/parted_partition.py | def mklabel(device, label_type):
'''
Create a new disklabel (partition table) of label_type.
Type should be one of "aix", "amiga", "bsd", "dvh", "gpt", "loop", "mac",
"msdos", "pc98", or "sun".
CLI Example:
.. code-block:: bash
salt '*' partition.mklabel /dev/sda msdos
'''
if... | def mklabel(device, label_type):
'''
Create a new disklabel (partition table) of label_type.
Type should be one of "aix", "amiga", "bsd", "dvh", "gpt", "loop", "mac",
"msdos", "pc98", or "sun".
CLI Example:
.. code-block:: bash
salt '*' partition.mklabel /dev/sda msdos
'''
if... | [
"Create",
"a",
"new",
"disklabel",
"(",
"partition",
"table",
")",
"of",
"label_type",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L429-L451 | [
"def",
"mklabel",
"(",
"device",
",",
"label_type",
")",
":",
"if",
"label_type",
"not",
"in",
"set",
"(",
"[",
"'aix'",
",",
"'amiga'",
",",
"'bsd'",
",",
"'dvh'",
",",
"'gpt'",
",",
"'loop'",
",",
"'mac'",
",",
"'msdos'",
",",
"'pc98'",
",",
"'sun'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | mkpart | Make a part_type partition for filesystem fs_type, beginning at start and
ending at end (by default in megabytes). part_type should be one of
"primary", "logical", or "extended".
CLI Examples:
.. code-block:: bash
salt '*' partition.mkpart /dev/sda primary fs_type=fat32 start=0 end=639
... | salt/modules/parted_partition.py | def mkpart(device, part_type, fs_type=None, start=None, end=None):
'''
Make a part_type partition for filesystem fs_type, beginning at start and
ending at end (by default in megabytes). part_type should be one of
"primary", "logical", or "extended".
CLI Examples:
.. code-block:: bash
... | def mkpart(device, part_type, fs_type=None, start=None, end=None):
'''
Make a part_type partition for filesystem fs_type, beginning at start and
ending at end (by default in megabytes). part_type should be one of
"primary", "logical", or "extended".
CLI Examples:
.. code-block:: bash
... | [
"Make",
"a",
"part_type",
"partition",
"for",
"filesystem",
"fs_type",
"beginning",
"at",
"start",
"and",
"ending",
"at",
"end",
"(",
"by",
"default",
"in",
"megabytes",
")",
".",
"part_type",
"should",
"be",
"one",
"of",
"primary",
"logical",
"or",
"extende... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L454-L493 | [
"def",
"mkpart",
"(",
"device",
",",
"part_type",
",",
"fs_type",
"=",
"None",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
")",
":",
"if",
"part_type",
"not",
"in",
"set",
"(",
"[",
"'primary'",
",",
"'logical'",
",",
"'extended'",
"]",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | mkpartfs | Make a <part_type> partition with a new filesystem of <fs_type>, beginning
at <start> and ending at <end> (by default in megabytes).
<part_type> should be one of "primary", "logical", or "extended". <fs_type>
must be one of "ext2", "fat32", "fat16", "linux-swap" or "reiserfs" (if
libreiserfs is install... | salt/modules/parted_partition.py | def mkpartfs(device, part_type, fs_type, start, end):
'''
Make a <part_type> partition with a new filesystem of <fs_type>, beginning
at <start> and ending at <end> (by default in megabytes).
<part_type> should be one of "primary", "logical", or "extended". <fs_type>
must be one of "ext2", "fat32", ... | def mkpartfs(device, part_type, fs_type, start, end):
'''
Make a <part_type> partition with a new filesystem of <fs_type>, beginning
at <start> and ending at <end> (by default in megabytes).
<part_type> should be one of "primary", "logical", or "extended". <fs_type>
must be one of "ext2", "fat32", ... | [
"Make",
"a",
"<part_type",
">",
"partition",
"with",
"a",
"new",
"filesystem",
"of",
"<fs_type",
">",
"beginning",
"at",
"<start",
">",
"and",
"ending",
"at",
"<end",
">",
"(",
"by",
"default",
"in",
"megabytes",
")",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L496-L530 | [
"def",
"mkpartfs",
"(",
"device",
",",
"part_type",
",",
"fs_type",
",",
"start",
",",
"end",
")",
":",
"_validate_device",
"(",
"device",
")",
"if",
"part_type",
"not",
"in",
"set",
"(",
"[",
"'primary'",
",",
"'logical'",
",",
"'extended'",
"]",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | name | Set the name of partition to name. This option works only on Mac, PC98, and
GPT disklabels. The name can be placed in quotes, if necessary.
CLI Example:
.. code-block:: bash
salt '*' partition.name /dev/sda 1 'My Documents' | salt/modules/parted_partition.py | def name(device, partition, name):
'''
Set the name of partition to name. This option works only on Mac, PC98, and
GPT disklabels. The name can be placed in quotes, if necessary.
CLI Example:
.. code-block:: bash
salt '*' partition.name /dev/sda 1 'My Documents'
'''
_validate_devi... | def name(device, partition, name):
'''
Set the name of partition to name. This option works only on Mac, PC98, and
GPT disklabels. The name can be placed in quotes, if necessary.
CLI Example:
.. code-block:: bash
salt '*' partition.name /dev/sda 1 'My Documents'
'''
_validate_devi... | [
"Set",
"the",
"name",
"of",
"partition",
"to",
"name",
".",
"This",
"option",
"works",
"only",
"on",
"Mac",
"PC98",
"and",
"GPT",
"disklabels",
".",
"The",
"name",
"can",
"be",
"placed",
"in",
"quotes",
"if",
"necessary",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L533-L562 | [
"def",
"name",
"(",
"device",
",",
"partition",
",",
"name",
")",
":",
"_validate_device",
"(",
"device",
")",
"try",
":",
"int",
"(",
"partition",
")",
"except",
"Exception",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid partition passed to partition.name... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | rescue | Rescue a lost partition that was located somewhere between start and end.
If a partition is found, parted will ask if you want to create an
entry for it in the partition table.
CLI Example:
.. code-block:: bash
salt '*' partition.rescue /dev/sda 0 8056 | salt/modules/parted_partition.py | def rescue(device, start, end):
'''
Rescue a lost partition that was located somewhere between start and end.
If a partition is found, parted will ask if you want to create an
entry for it in the partition table.
CLI Example:
.. code-block:: bash
salt '*' partition.rescue /dev/sda 0 8... | def rescue(device, start, end):
'''
Rescue a lost partition that was located somewhere between start and end.
If a partition is found, parted will ask if you want to create an
entry for it in the partition table.
CLI Example:
.. code-block:: bash
salt '*' partition.rescue /dev/sda 0 8... | [
"Rescue",
"a",
"lost",
"partition",
"that",
"was",
"located",
"somewhere",
"between",
"start",
"and",
"end",
".",
"If",
"a",
"partition",
"is",
"found",
"parted",
"will",
"ask",
"if",
"you",
"want",
"to",
"create",
"an",
"entry",
"for",
"it",
"in",
"the"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L565-L583 | [
"def",
"rescue",
"(",
"device",
",",
"start",
",",
"end",
")",
":",
"_validate_device",
"(",
"device",
")",
"_validate_partition_boundary",
"(",
"start",
")",
"_validate_partition_boundary",
"(",
"end",
")",
"cmd",
"=",
"'parted -m -s {0} rescue {1} {2}'",
".",
"f... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | resize | Resizes the partition with number <minor>.
The partition will start <start> from the beginning of the disk, and end
<end> from the beginning of the disk. resize never changes the minor number.
Extended partitions can be resized, so long as the new extended partition
completely contains all logical part... | salt/modules/parted_partition.py | def resize(device, minor, start, end):
'''
Resizes the partition with number <minor>.
The partition will start <start> from the beginning of the disk, and end
<end> from the beginning of the disk. resize never changes the minor number.
Extended partitions can be resized, so long as the new extended... | def resize(device, minor, start, end):
'''
Resizes the partition with number <minor>.
The partition will start <start> from the beginning of the disk, and end
<end> from the beginning of the disk. resize never changes the minor number.
Extended partitions can be resized, so long as the new extended... | [
"Resizes",
"the",
"partition",
"with",
"number",
"<minor",
">",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L586-L618 | [
"def",
"resize",
"(",
"device",
",",
"minor",
",",
"start",
",",
"end",
")",
":",
"_validate_device",
"(",
"device",
")",
"try",
":",
"int",
"(",
"minor",
")",
"except",
"Exception",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid minor number passed to ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | rm | Removes the partition with number <minor>.
CLI Example:
.. code-block:: bash
salt '*' partition.rm /dev/sda 5 | salt/modules/parted_partition.py | def rm(device, minor): # pylint: disable=C0103
'''
Removes the partition with number <minor>.
CLI Example:
.. code-block:: bash
salt '*' partition.rm /dev/sda 5
'''
_validate_device(device)
try:
int(minor)
except Exception:
raise CommandExecutionError(
... | def rm(device, minor): # pylint: disable=C0103
'''
Removes the partition with number <minor>.
CLI Example:
.. code-block:: bash
salt '*' partition.rm /dev/sda 5
'''
_validate_device(device)
try:
int(minor)
except Exception:
raise CommandExecutionError(
... | [
"Removes",
"the",
"partition",
"with",
"number",
"<minor",
">",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L621-L642 | [
"def",
"rm",
"(",
"device",
",",
"minor",
")",
":",
"# pylint: disable=C0103",
"_validate_device",
"(",
"device",
")",
"try",
":",
"int",
"(",
"minor",
")",
"except",
"Exception",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid minor number passed to partition... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_ | Changes a flag on the partition with number <minor>.
A flag can be either "on" or "off" (make sure to use proper quoting, see
:ref:`YAML Idiosyncrasies <yaml-idiosyncrasies>`). Some or all of these
flags will be available, depending on what disk label you are using.
Valid flags are:
* boot
... | salt/modules/parted_partition.py | def set_(device, minor, flag, state):
'''
Changes a flag on the partition with number <minor>.
A flag can be either "on" or "off" (make sure to use proper quoting, see
:ref:`YAML Idiosyncrasies <yaml-idiosyncrasies>`). Some or all of these
flags will be available, depending on what disk label you a... | def set_(device, minor, flag, state):
'''
Changes a flag on the partition with number <minor>.
A flag can be either "on" or "off" (make sure to use proper quoting, see
:ref:`YAML Idiosyncrasies <yaml-idiosyncrasies>`). Some or all of these
flags will be available, depending on what disk label you a... | [
"Changes",
"a",
"flag",
"on",
"the",
"partition",
"with",
"number",
"<minor",
">",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L645-L697 | [
"def",
"set_",
"(",
"device",
",",
"minor",
",",
"flag",
",",
"state",
")",
":",
"_validate_device",
"(",
"device",
")",
"try",
":",
"int",
"(",
"minor",
")",
"except",
"Exception",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid minor number passed to p... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | toggle | Toggle the state of <flag> on <partition>. Valid flags are the same as
the set command.
CLI Example:
.. code-block:: bash
salt '*' partition.toggle /dev/sda 1 boot | salt/modules/parted_partition.py | def toggle(device, partition, flag):
'''
Toggle the state of <flag> on <partition>. Valid flags are the same as
the set command.
CLI Example:
.. code-block:: bash
salt '*' partition.toggle /dev/sda 1 boot
'''
_validate_device(device)
try:
int(partition)
except... | def toggle(device, partition, flag):
'''
Toggle the state of <flag> on <partition>. Valid flags are the same as
the set command.
CLI Example:
.. code-block:: bash
salt '*' partition.toggle /dev/sda 1 boot
'''
_validate_device(device)
try:
int(partition)
except... | [
"Toggle",
"the",
"state",
"of",
"<flag",
">",
"on",
"<partition",
">",
".",
"Valid",
"flags",
"are",
"the",
"same",
"as",
"the",
"set",
"command",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L700-L725 | [
"def",
"toggle",
"(",
"device",
",",
"partition",
",",
"flag",
")",
":",
"_validate_device",
"(",
"device",
")",
"try",
":",
"int",
"(",
"partition",
")",
"except",
"Exception",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid partition number passed to parti... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | disk_set | Changes a flag on selected device.
A flag can be either "on" or "off" (make sure to use proper
quoting, see :ref:`YAML Idiosyncrasies
<yaml-idiosyncrasies>`). Some or all of these flags will be
available, depending on what disk label you are using.
Valid flags are:
* cylinder_alignment
... | salt/modules/parted_partition.py | def disk_set(device, flag, state):
'''
Changes a flag on selected device.
A flag can be either "on" or "off" (make sure to use proper
quoting, see :ref:`YAML Idiosyncrasies
<yaml-idiosyncrasies>`). Some or all of these flags will be
available, depending on what disk label you are using.
Va... | def disk_set(device, flag, state):
'''
Changes a flag on selected device.
A flag can be either "on" or "off" (make sure to use proper
quoting, see :ref:`YAML Idiosyncrasies
<yaml-idiosyncrasies>`). Some or all of these flags will be
available, depending on what disk label you are using.
Va... | [
"Changes",
"a",
"flag",
"on",
"selected",
"device",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L728-L758 | [
"def",
"disk_set",
"(",
"device",
",",
"flag",
",",
"state",
")",
":",
"_validate_device",
"(",
"device",
")",
"if",
"flag",
"not",
"in",
"VALID_DISK_FLAGS",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid flag passed to partition.disk_set'",
")",
"if",
"sta... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | disk_toggle | Toggle the state of <flag> on <device>. Valid flags are the same
as the disk_set command.
CLI Example:
.. code-block:: bash
salt '*' partition.disk_toggle /dev/sda pmbr_boot | salt/modules/parted_partition.py | def disk_toggle(device, flag):
'''
Toggle the state of <flag> on <device>. Valid flags are the same
as the disk_set command.
CLI Example:
.. code-block:: bash
salt '*' partition.disk_toggle /dev/sda pmbr_boot
'''
_validate_device(device)
if flag not in VALID_DISK_FLAGS:
... | def disk_toggle(device, flag):
'''
Toggle the state of <flag> on <device>. Valid flags are the same
as the disk_set command.
CLI Example:
.. code-block:: bash
salt '*' partition.disk_toggle /dev/sda pmbr_boot
'''
_validate_device(device)
if flag not in VALID_DISK_FLAGS:
... | [
"Toggle",
"the",
"state",
"of",
"<flag",
">",
"on",
"<device",
">",
".",
"Valid",
"flags",
"are",
"the",
"same",
"as",
"the",
"disk_set",
"command",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L761-L779 | [
"def",
"disk_toggle",
"(",
"device",
",",
"flag",
")",
":",
"_validate_device",
"(",
"device",
")",
"if",
"flag",
"not",
"in",
"VALID_DISK_FLAGS",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid flag passed to partition.disk_toggle'",
")",
"cmd",
"=",
"[",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | exists | Check to see if the partition exists
CLI Example:
.. code-block:: bash
salt '*' partition.exists /dev/sdb1 | salt/modules/parted_partition.py | def exists(device=''):
'''
Check to see if the partition exists
CLI Example:
.. code-block:: bash
salt '*' partition.exists /dev/sdb1
'''
if os.path.exists(device):
dev = os.stat(device).st_mode
if stat.S_ISBLK(dev):
return True
return False | def exists(device=''):
'''
Check to see if the partition exists
CLI Example:
.. code-block:: bash
salt '*' partition.exists /dev/sdb1
'''
if os.path.exists(device):
dev = os.stat(device).st_mode
if stat.S_ISBLK(dev):
return True
return False | [
"Check",
"to",
"see",
"if",
"the",
"partition",
"exists"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L782-L798 | [
"def",
"exists",
"(",
"device",
"=",
"''",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"device",
")",
":",
"dev",
"=",
"os",
".",
"stat",
"(",
"device",
")",
".",
"st_mode",
"if",
"stat",
".",
"S_ISBLK",
"(",
"dev",
")",
":",
"return... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _paths | Return the full path for the packages and repository freezer
files. | salt/modules/freezer.py | def _paths(name=None):
'''
Return the full path for the packages and repository freezer
files.
'''
name = 'freezer' if not name else name
states_path = _states_path()
return (
os.path.join(states_path, '{}-pkgs.yml'.format(name)),
os.path.join(states_path, '{}-reps.yml'.form... | def _paths(name=None):
'''
Return the full path for the packages and repository freezer
files.
'''
name = 'freezer' if not name else name
states_path = _states_path()
return (
os.path.join(states_path, '{}-pkgs.yml'.format(name)),
os.path.join(states_path, '{}-reps.yml'.form... | [
"Return",
"the",
"full",
"path",
"for",
"the",
"packages",
"and",
"repository",
"freezer",
"files",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freezer.py#L65-L76 | [
"def",
"_paths",
"(",
"name",
"=",
"None",
")",
":",
"name",
"=",
"'freezer'",
"if",
"not",
"name",
"else",
"name",
"states_path",
"=",
"_states_path",
"(",
")",
"return",
"(",
"os",
".",
"path",
".",
"join",
"(",
"states_path",
",",
"'{}-pkgs.yml'",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | status | Return True if there is already a frozen state.
A frozen state is merely a list of packages (including the
version) in a specific time. This information can be used to
compare with the current list of packages, and revert the
installation of some extra packages that are in the system.
name
... | salt/modules/freezer.py | def status(name=None):
'''
Return True if there is already a frozen state.
A frozen state is merely a list of packages (including the
version) in a specific time. This information can be used to
compare with the current list of packages, and revert the
installation of some extra packages that a... | def status(name=None):
'''
Return True if there is already a frozen state.
A frozen state is merely a list of packages (including the
version) in a specific time. This information can be used to
compare with the current list of packages, and revert the
installation of some extra packages that a... | [
"Return",
"True",
"if",
"there",
"is",
"already",
"a",
"frozen",
"state",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freezer.py#L79-L100 | [
"def",
"status",
"(",
"name",
"=",
"None",
")",
":",
"name",
"=",
"'freezer'",
"if",
"not",
"name",
"else",
"name",
"return",
"all",
"(",
"os",
".",
"path",
".",
"isfile",
"(",
"i",
")",
"for",
"i",
"in",
"_paths",
"(",
"name",
")",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_ | Return the list of frozen states.
CLI Example:
.. code-block:: bash
salt '*' freezer.list | salt/modules/freezer.py | def list_():
'''
Return the list of frozen states.
CLI Example:
.. code-block:: bash
salt '*' freezer.list
'''
ret = []
states_path = _states_path()
if not os.path.isdir(states_path):
return ret
for state in os.listdir(states_path):
if state.endswith(('-p... | def list_():
'''
Return the list of frozen states.
CLI Example:
.. code-block:: bash
salt '*' freezer.list
'''
ret = []
states_path = _states_path()
if not os.path.isdir(states_path):
return ret
for state in os.listdir(states_path):
if state.endswith(('-p... | [
"Return",
"the",
"list",
"of",
"frozen",
"states",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freezer.py#L103-L123 | [
"def",
"list_",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"states_path",
"=",
"_states_path",
"(",
")",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"states_path",
")",
":",
"return",
"ret",
"for",
"state",
"in",
"os",
".",
"listdir",
"(",
"states... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | freeze | Save the list of package and repos in a freeze file.
As this module is build on top of the pkg module, the user can
send extra attributes to the underlying pkg module via kwargs.
This function will call ``pkg.list_pkgs`` and ``pkg.list_repos``,
and any additional arguments will be passed through to tho... | salt/modules/freezer.py | def freeze(name=None, force=False, **kwargs):
'''
Save the list of package and repos in a freeze file.
As this module is build on top of the pkg module, the user can
send extra attributes to the underlying pkg module via kwargs.
This function will call ``pkg.list_pkgs`` and ``pkg.list_repos``,
... | def freeze(name=None, force=False, **kwargs):
'''
Save the list of package and repos in a freeze file.
As this module is build on top of the pkg module, the user can
send extra attributes to the underlying pkg module via kwargs.
This function will call ``pkg.list_pkgs`` and ``pkg.list_repos``,
... | [
"Save",
"the",
"list",
"of",
"package",
"and",
"repos",
"in",
"a",
"freeze",
"file",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freezer.py#L126-L169 | [
"def",
"freeze",
"(",
"name",
"=",
"None",
",",
"force",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"states_path",
"=",
"_states_path",
"(",
")",
"try",
":",
"os",
".",
"makedirs",
"(",
"states_path",
")",
"except",
"OSError",
"as",
"e",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | restore | Make sure that the system contains the packages and repos from a
frozen state.
Read the list of packages and repositories from the freeze file,
and compare it with the current list of packages and repos. If
there is any difference, all the missing packages are repos will
be installed, and all the e... | salt/modules/freezer.py | def restore(name=None, **kwargs):
'''
Make sure that the system contains the packages and repos from a
frozen state.
Read the list of packages and repositories from the freeze file,
and compare it with the current list of packages and repos. If
there is any difference, all the missing packages ... | def restore(name=None, **kwargs):
'''
Make sure that the system contains the packages and repos from a
frozen state.
Read the list of packages and repositories from the freeze file,
and compare it with the current list of packages and repos. If
there is any difference, all the missing packages ... | [
"Make",
"sure",
"that",
"the",
"system",
"contains",
"the",
"packages",
"and",
"repos",
"from",
"a",
"frozen",
"state",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freezer.py#L172-L294 | [
"def",
"restore",
"(",
"name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"status",
"(",
"name",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'Frozen state not found.'",
")",
"frozen_pkgs",
"=",
"{",
"}",
"frozen_repos",
"=",
"{",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_rabbitmq_plugin | Returns the rabbitmq-plugin command path if we're running an OS that
doesn't put it in the standard /usr/bin or /usr/local/bin
This works by taking the rabbitmq-server version and looking for where it
seems to be hidden in /usr/lib. | salt/modules/rabbitmq.py | def _get_rabbitmq_plugin():
'''
Returns the rabbitmq-plugin command path if we're running an OS that
doesn't put it in the standard /usr/bin or /usr/local/bin
This works by taking the rabbitmq-server version and looking for where it
seems to be hidden in /usr/lib.
'''
global RABBITMQ_PLUGINS... | def _get_rabbitmq_plugin():
'''
Returns the rabbitmq-plugin command path if we're running an OS that
doesn't put it in the standard /usr/bin or /usr/local/bin
This works by taking the rabbitmq-server version and looking for where it
seems to be hidden in /usr/lib.
'''
global RABBITMQ_PLUGINS... | [
"Returns",
"the",
"rabbitmq",
"-",
"plugin",
"command",
"path",
"if",
"we",
"re",
"running",
"an",
"OS",
"that",
"doesn",
"t",
"put",
"it",
"in",
"the",
"standard",
"/",
"usr",
"/",
"bin",
"or",
"/",
"usr",
"/",
"local",
"/",
"bin",
"This",
"works",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L115-L129 | [
"def",
"_get_rabbitmq_plugin",
"(",
")",
":",
"global",
"RABBITMQ_PLUGINS",
"if",
"RABBITMQ_PLUGINS",
"is",
"None",
":",
"version",
"=",
"__salt__",
"[",
"'pkg.version'",
"]",
"(",
"'rabbitmq-server'",
")",
".",
"split",
"(",
"'-'",
")",
"[",
"0",
"]",
"RABB... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _safe_output | Looks for rabbitmqctl warning, or general formatting, strings that aren't
intended to be parsed as output.
Returns a boolean whether the line can be parsed as rabbitmqctl output. | salt/modules/rabbitmq.py | def _safe_output(line):
'''
Looks for rabbitmqctl warning, or general formatting, strings that aren't
intended to be parsed as output.
Returns a boolean whether the line can be parsed as rabbitmqctl output.
'''
return not any([
line.startswith('Listing') and line.endswith('...'),
... | def _safe_output(line):
'''
Looks for rabbitmqctl warning, or general formatting, strings that aren't
intended to be parsed as output.
Returns a boolean whether the line can be parsed as rabbitmqctl output.
'''
return not any([
line.startswith('Listing') and line.endswith('...'),
... | [
"Looks",
"for",
"rabbitmqctl",
"warning",
"or",
"general",
"formatting",
"strings",
"that",
"aren",
"t",
"intended",
"to",
"be",
"parsed",
"as",
"output",
".",
"Returns",
"a",
"boolean",
"whether",
"the",
"line",
"can",
"be",
"parsed",
"as",
"rabbitmqctl",
"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L132-L143 | [
"def",
"_safe_output",
"(",
"line",
")",
":",
"return",
"not",
"any",
"(",
"[",
"line",
".",
"startswith",
"(",
"'Listing'",
")",
"and",
"line",
".",
"endswith",
"(",
"'...'",
")",
",",
"line",
".",
"startswith",
"(",
"'Listing'",
")",
"and",
"'\\t'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _output_to_dict | Convert rabbitmqctl output to a dict of data
cmdoutput: string output of rabbitmqctl commands
values_mapper: function object to process the values part of each line | salt/modules/rabbitmq.py | def _output_to_dict(cmdoutput, values_mapper=None):
'''
Convert rabbitmqctl output to a dict of data
cmdoutput: string output of rabbitmqctl commands
values_mapper: function object to process the values part of each line
'''
if isinstance(cmdoutput, dict):
if cmdoutput['retcode'] != 0 or... | def _output_to_dict(cmdoutput, values_mapper=None):
'''
Convert rabbitmqctl output to a dict of data
cmdoutput: string output of rabbitmqctl commands
values_mapper: function object to process the values part of each line
'''
if isinstance(cmdoutput, dict):
if cmdoutput['retcode'] != 0 or... | [
"Convert",
"rabbitmqctl",
"output",
"to",
"a",
"dict",
"of",
"data",
"cmdoutput",
":",
"string",
"output",
"of",
"rabbitmqctl",
"commands",
"values_mapper",
":",
"function",
"object",
"to",
"process",
"the",
"values",
"part",
"of",
"each",
"line"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L156-L190 | [
"def",
"_output_to_dict",
"(",
"cmdoutput",
",",
"values_mapper",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"cmdoutput",
",",
"dict",
")",
":",
"if",
"cmdoutput",
"[",
"'retcode'",
"]",
"!=",
"0",
"or",
"cmdoutput",
"[",
"'stderr'",
"]",
":",
"rais... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _output_to_list | Convert rabbitmqctl output to a list of strings (assuming whitespace-delimited output).
Ignores output lines that shouldn't be parsed, like warnings.
cmdoutput: string output of rabbitmqctl commands | salt/modules/rabbitmq.py | def _output_to_list(cmdoutput):
'''
Convert rabbitmqctl output to a list of strings (assuming whitespace-delimited output).
Ignores output lines that shouldn't be parsed, like warnings.
cmdoutput: string output of rabbitmqctl commands
'''
return [item for line in cmdoutput.splitlines() if _safe_... | def _output_to_list(cmdoutput):
'''
Convert rabbitmqctl output to a list of strings (assuming whitespace-delimited output).
Ignores output lines that shouldn't be parsed, like warnings.
cmdoutput: string output of rabbitmqctl commands
'''
return [item for line in cmdoutput.splitlines() if _safe_... | [
"Convert",
"rabbitmqctl",
"output",
"to",
"a",
"list",
"of",
"strings",
"(",
"assuming",
"whitespace",
"-",
"delimited",
"output",
")",
".",
"Ignores",
"output",
"lines",
"that",
"shouldn",
"t",
"be",
"parsed",
"like",
"warnings",
".",
"cmdoutput",
":",
"str... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L193-L199 | [
"def",
"_output_to_list",
"(",
"cmdoutput",
")",
":",
"return",
"[",
"item",
"for",
"line",
"in",
"cmdoutput",
".",
"splitlines",
"(",
")",
"if",
"_safe_output",
"(",
"line",
")",
"for",
"item",
"in",
"line",
".",
"split",
"(",
")",
"]"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_users | Return a list of users based off of rabbitmqctl user_list.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_users | salt/modules/rabbitmq.py | def list_users(runas=None):
'''
Return a list of users based off of rabbitmqctl user_list.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_users
'''
# Windows runas currently requires a password.
# Due to this, don't use a default value for
# runas in Windows.
if ... | def list_users(runas=None):
'''
Return a list of users based off of rabbitmqctl user_list.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_users
'''
# Windows runas currently requires a password.
# Due to this, don't use a default value for
# runas in Windows.
if ... | [
"Return",
"a",
"list",
"of",
"users",
"based",
"off",
"of",
"rabbitmqctl",
"user_list",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L211-L235 | [
"def",
"list_users",
"(",
"runas",
"=",
"None",
")",
":",
"# Windows runas currently requires a password.",
"# Due to this, don't use a default value for",
"# runas in Windows.",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_vhosts | Return a list of vhost based on rabbitmqctl list_vhosts.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_vhosts | salt/modules/rabbitmq.py | def list_vhosts(runas=None):
'''
Return a list of vhost based on rabbitmqctl list_vhosts.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_vhosts
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
res = __salt__['cmd.r... | def list_vhosts(runas=None):
'''
Return a list of vhost based on rabbitmqctl list_vhosts.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_vhosts
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
res = __salt__['cmd.r... | [
"Return",
"a",
"list",
"of",
"vhost",
"based",
"on",
"rabbitmqctl",
"list_vhosts",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L238-L256 | [
"def",
"list_vhosts",
"(",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"user",
".",
"get_user",
"(",
")... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | user_exists | Return whether the user exists based on rabbitmqctl list_users.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.user_exists rabbit_user | salt/modules/rabbitmq.py | def user_exists(name, runas=None):
'''
Return whether the user exists based on rabbitmqctl list_users.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.user_exists rabbit_user
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
... | def user_exists(name, runas=None):
'''
Return whether the user exists based on rabbitmqctl list_users.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.user_exists rabbit_user
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
... | [
"Return",
"whether",
"the",
"user",
"exists",
"based",
"on",
"rabbitmqctl",
"list_users",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L259-L271 | [
"def",
"user_exists",
"(",
"name",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"user",
".",
"get_u... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | vhost_exists | Return whether the vhost exists based on rabbitmqctl list_vhosts.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.vhost_exists rabbit_host | salt/modules/rabbitmq.py | def vhost_exists(name, runas=None):
'''
Return whether the vhost exists based on rabbitmqctl list_vhosts.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.vhost_exists rabbit_host
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_use... | def vhost_exists(name, runas=None):
'''
Return whether the vhost exists based on rabbitmqctl list_vhosts.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.vhost_exists rabbit_host
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_use... | [
"Return",
"whether",
"the",
"vhost",
"exists",
"based",
"on",
"rabbitmqctl",
"list_vhosts",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L274-L286 | [
"def",
"vhost_exists",
"(",
"name",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"user",
".",
"get_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | add_user | Add a rabbitMQ user via rabbitmqctl user_add <user> <password>
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.add_user rabbit_user password | salt/modules/rabbitmq.py | def add_user(name, password=None, runas=None):
'''
Add a rabbitMQ user via rabbitmqctl user_add <user> <password>
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.add_user rabbit_user password
'''
clear_pw = False
if password is None:
# Generate a random, temporary pas... | def add_user(name, password=None, runas=None):
'''
Add a rabbitMQ user via rabbitmqctl user_add <user> <password>
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.add_user rabbit_user password
'''
clear_pw = False
if password is None:
# Generate a random, temporary pas... | [
"Add",
"a",
"rabbitMQ",
"user",
"via",
"rabbitmqctl",
"user_add",
"<user",
">",
"<password",
">"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L289-L343 | [
"def",
"add_user",
"(",
"name",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"clear_pw",
"=",
"False",
"if",
"password",
"is",
"None",
":",
"# Generate a random, temporary password. RabbitMQ requires one.",
"clear_pw",
"=",
"True",
"password"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_user | Deletes a user via rabbitmqctl delete_user.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.delete_user rabbit_user | salt/modules/rabbitmq.py | def delete_user(name, runas=None):
'''
Deletes a user via rabbitmqctl delete_user.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.delete_user rabbit_user
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
res = __salt__['... | def delete_user(name, runas=None):
'''
Deletes a user via rabbitmqctl delete_user.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.delete_user rabbit_user
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
res = __salt__['... | [
"Deletes",
"a",
"user",
"via",
"rabbitmqctl",
"delete_user",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L346-L365 | [
"def",
"delete_user",
"(",
"name",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"user",
".",
"get_u... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | change_password | Changes a user's password.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.change_password rabbit_user password | salt/modules/rabbitmq.py | def change_password(name, password, runas=None):
'''
Changes a user's password.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.change_password rabbit_user password
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
if sal... | def change_password(name, password, runas=None):
'''
Changes a user's password.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.change_password rabbit_user password
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
if sal... | [
"Changes",
"a",
"user",
"s",
"password",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L368-L402 | [
"def",
"change_password",
"(",
"name",
",",
"password",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | check_password | .. versionadded:: 2016.3.0
Checks if a user's password is valid.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.check_password rabbit_user password | salt/modules/rabbitmq.py | def check_password(name, password, runas=None):
'''
.. versionadded:: 2016.3.0
Checks if a user's password is valid.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.check_password rabbit_user password
'''
# try to get the rabbitmq-version - adapted from _get_rabbitmq_plugin
... | def check_password(name, password, runas=None):
'''
.. versionadded:: 2016.3.0
Checks if a user's password is valid.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.check_password rabbit_user password
'''
# try to get the rabbitmq-version - adapted from _get_rabbitmq_plugin
... | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L427-L505 | [
"def",
"check_password",
"(",
"name",
",",
"password",
",",
"runas",
"=",
"None",
")",
":",
"# try to get the rabbitmq-version - adapted from _get_rabbitmq_plugin",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | add_vhost | Adds a vhost via rabbitmqctl add_vhost.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq add_vhost '<vhost_name>' | salt/modules/rabbitmq.py | def add_vhost(vhost, runas=None):
'''
Adds a vhost via rabbitmqctl add_vhost.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq add_vhost '<vhost_name>'
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
res = __salt__['cmd.... | def add_vhost(vhost, runas=None):
'''
Adds a vhost via rabbitmqctl add_vhost.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq add_vhost '<vhost_name>'
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
res = __salt__['cmd.... | [
"Adds",
"a",
"vhost",
"via",
"rabbitmqctl",
"add_vhost",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L508-L527 | [
"def",
"add_vhost",
"(",
"vhost",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"user",
".",
"get_us... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_permissions | Sets permissions for vhost via rabbitmqctl set_permissions
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.set_permissions myvhost myuser | salt/modules/rabbitmq.py | def set_permissions(vhost, user, conf='.*', write='.*', read='.*', runas=None):
'''
Sets permissions for vhost via rabbitmqctl set_permissions
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.set_permissions myvhost myuser
'''
if runas is None and not salt.utils.platform.is_windows... | def set_permissions(vhost, user, conf='.*', write='.*', read='.*', runas=None):
'''
Sets permissions for vhost via rabbitmqctl set_permissions
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.set_permissions myvhost myuser
'''
if runas is None and not salt.utils.platform.is_windows... | [
"Sets",
"permissions",
"for",
"vhost",
"via",
"rabbitmqctl",
"set_permissions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L551-L570 | [
"def",
"set_permissions",
"(",
"vhost",
",",
"user",
",",
"conf",
"=",
"'.*'",
",",
"write",
"=",
"'.*'",
",",
"read",
"=",
"'.*'",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_permissions | Lists permissions for vhost via rabbitmqctl list_permissions
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_permissions /myvhost | salt/modules/rabbitmq.py | def list_permissions(vhost, runas=None):
'''
Lists permissions for vhost via rabbitmqctl list_permissions
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_permissions /myvhost
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_us... | def list_permissions(vhost, runas=None):
'''
Lists permissions for vhost via rabbitmqctl list_permissions
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_permissions /myvhost
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_us... | [
"Lists",
"permissions",
"for",
"vhost",
"via",
"rabbitmqctl",
"list_permissions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L573-L591 | [
"def",
"list_permissions",
"(",
"vhost",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"user",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_user_permissions | List permissions for a user via rabbitmqctl list_user_permissions
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_user_permissions user | salt/modules/rabbitmq.py | def list_user_permissions(name, runas=None):
'''
List permissions for a user via rabbitmqctl list_user_permissions
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_user_permissions user
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.u... | def list_user_permissions(name, runas=None):
'''
List permissions for a user via rabbitmqctl list_user_permissions
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_user_permissions user
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.u... | [
"List",
"permissions",
"for",
"a",
"user",
"via",
"rabbitmqctl",
"list_user_permissions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L594-L612 | [
"def",
"list_user_permissions",
"(",
"name",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"user",
"."... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_user_tags | Add user tags via rabbitmqctl set_user_tags
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.set_user_tags myadmin administrator | salt/modules/rabbitmq.py | def set_user_tags(name, tags, runas=None):
'''Add user tags via rabbitmqctl set_user_tags
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.set_user_tags myadmin administrator
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
... | def set_user_tags(name, tags, runas=None):
'''Add user tags via rabbitmqctl set_user_tags
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.set_user_tags myadmin administrator
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
... | [
"Add",
"user",
"tags",
"via",
"rabbitmqctl",
"set_user_tags"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L615-L636 | [
"def",
"set_user_tags",
"(",
"name",
",",
"tags",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"use... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | join_cluster | Join a rabbit cluster
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.join_cluster rabbit.example.com rabbit | salt/modules/rabbitmq.py | def join_cluster(host, user='rabbit', ram_node=None, runas=None):
'''
Join a rabbit cluster
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.join_cluster rabbit.example.com rabbit
'''
cmd = [RABBITMQCTL, 'join_cluster']
if ram_node:
cmd.append('--ram')
cmd.append('{... | def join_cluster(host, user='rabbit', ram_node=None, runas=None):
'''
Join a rabbit cluster
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.join_cluster rabbit.example.com rabbit
'''
cmd = [RABBITMQCTL, 'join_cluster']
if ram_node:
cmd.append('--ram')
cmd.append('{... | [
"Join",
"a",
"rabbit",
"cluster"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L681-L702 | [
"def",
"join_cluster",
"(",
"host",
",",
"user",
"=",
"'rabbit'",
",",
"ram_node",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"RABBITMQCTL",
",",
"'join_cluster'",
"]",
"if",
"ram_node",
":",
"cmd",
".",
"append",
"(",
"'--ram'"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_queues | Returns queue details of the / virtual host
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_queues messages consumers | salt/modules/rabbitmq.py | def list_queues(runas=None, *args):
'''
Returns queue details of the / virtual host
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_queues messages consumers
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
cmd = [R... | def list_queues(runas=None, *args):
'''
Returns queue details of the / virtual host
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_queues messages consumers
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
cmd = [R... | [
"Returns",
"queue",
"details",
"of",
"the",
"/",
"virtual",
"host"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L789-L805 | [
"def",
"list_queues",
"(",
"runas",
"=",
"None",
",",
"*",
"args",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"user",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_policies | Return a dictionary of policies nested by vhost and name
based on the data returned from rabbitmqctl list_policies.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_policies | salt/modules/rabbitmq.py | def list_policies(vhost="/", runas=None):
'''
Return a dictionary of policies nested by vhost and name
based on the data returned from rabbitmqctl list_policies.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_policies
'''
r... | def list_policies(vhost="/", runas=None):
'''
Return a dictionary of policies nested by vhost and name
based on the data returned from rabbitmqctl list_policies.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_policies
'''
r... | [
"Return",
"a",
"dictionary",
"of",
"policies",
"nested",
"by",
"vhost",
"and",
"name",
"based",
"on",
"the",
"data",
"returned",
"from",
"rabbitmqctl",
"list_policies",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L830-L891 | [
"def",
"list_policies",
"(",
"vhost",
"=",
"\"/\"",
",",
"runas",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_policy | Set a policy based on rabbitmqctl set_policy.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.set_policy / HA '.*' '{"ha-mode":"all"}' | salt/modules/rabbitmq.py | def set_policy(vhost,
name,
pattern,
definition,
priority=None,
runas=None,
apply_to=None):
'''
Set a policy based on rabbitmqctl set_policy.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-b... | def set_policy(vhost,
name,
pattern,
definition,
priority=None,
runas=None,
apply_to=None):
'''
Set a policy based on rabbitmqctl set_policy.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-b... | [
"Set",
"a",
"policy",
"based",
"on",
"rabbitmqctl",
"set_policy",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L894-L928 | [
"def",
"set_policy",
"(",
"vhost",
",",
"name",
",",
"pattern",
",",
"definition",
",",
"priority",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"apply_to",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_policy | Delete a policy based on rabbitmqctl clear_policy.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.delete_policy / HA | salt/modules/rabbitmq.py | def delete_policy(vhost, name, runas=None):
'''
Delete a policy based on rabbitmqctl clear_policy.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.delete_policy / HA
'''
if runas is None and not salt.utils.platform.is_windows():
... | def delete_policy(vhost, name, runas=None):
'''
Delete a policy based on rabbitmqctl clear_policy.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.delete_policy / HA
'''
if runas is None and not salt.utils.platform.is_windows():
... | [
"Delete",
"a",
"policy",
"based",
"on",
"rabbitmqctl",
"clear_policy",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L931-L951 | [
"def",
"delete_policy",
"(",
"vhost",
",",
"name",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"us... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | policy_exists | Return whether the policy exists based on rabbitmqctl list_policies.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.policy_exists / HA | salt/modules/rabbitmq.py | def policy_exists(vhost, name, runas=None):
'''
Return whether the policy exists based on rabbitmqctl list_policies.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.policy_exists / HA
'''
if runas is None and not salt.utils.platform.... | def policy_exists(vhost, name, runas=None):
'''
Return whether the policy exists based on rabbitmqctl list_policies.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.policy_exists / HA
'''
if runas is None and not salt.utils.platform.... | [
"Return",
"whether",
"the",
"policy",
"exists",
"based",
"on",
"rabbitmqctl",
"list_policies",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L954-L969 | [
"def",
"policy_exists",
"(",
"vhost",
",",
"name",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"us... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_available_plugins | Returns a list of the names of all available plugins (enabled and disabled).
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_available_plugins | salt/modules/rabbitmq.py | def list_available_plugins(runas=None):
'''
Returns a list of the names of all available plugins (enabled and disabled).
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_available_plugins
'''
if runas is None and not salt.utils.platform.is_windows():
... | def list_available_plugins(runas=None):
'''
Returns a list of the names of all available plugins (enabled and disabled).
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_available_plugins
'''
if runas is None and not salt.utils.platform.is_windows():
... | [
"Returns",
"a",
"list",
"of",
"the",
"names",
"of",
"all",
"available",
"plugins",
"(",
"enabled",
"and",
"disabled",
")",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L972-L987 | [
"def",
"list_available_plugins",
"(",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"user",
".",
"get_user",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | plugin_is_enabled | Return whether the plugin is enabled.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.plugin_is_enabled rabbitmq_plugin_name | salt/modules/rabbitmq.py | def plugin_is_enabled(name, runas=None):
'''
Return whether the plugin is enabled.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.plugin_is_enabled rabbitmq_plugin_name
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
r... | def plugin_is_enabled(name, runas=None):
'''
Return whether the plugin is enabled.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.plugin_is_enabled rabbitmq_plugin_name
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
r... | [
"Return",
"whether",
"the",
"plugin",
"is",
"enabled",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L1008-L1020 | [
"def",
"plugin_is_enabled",
"(",
"name",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"user",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | enable_plugin | Enable a RabbitMQ plugin via the rabbitmq-plugins command.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.enable_plugin foo | salt/modules/rabbitmq.py | def enable_plugin(name, runas=None):
'''
Enable a RabbitMQ plugin via the rabbitmq-plugins command.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.enable_plugin foo
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
cmd =... | def enable_plugin(name, runas=None):
'''
Enable a RabbitMQ plugin via the rabbitmq-plugins command.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.enable_plugin foo
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
cmd =... | [
"Enable",
"a",
"RabbitMQ",
"plugin",
"via",
"the",
"rabbitmq",
"-",
"plugins",
"command",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L1023-L1037 | [
"def",
"enable_plugin",
"(",
"name",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"user",
".",
"get... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _check_cygwin_installed | Return True or False if cygwin is installed.
Use the cygcheck executable to check install. It is installed as part of
the base package, and we use it to check packages | salt/modules/cyg.py | def _check_cygwin_installed(cyg_arch='x86_64'):
'''
Return True or False if cygwin is installed.
Use the cygcheck executable to check install. It is installed as part of
the base package, and we use it to check packages
'''
path_to_cygcheck = os.sep.join(['C:',
... | def _check_cygwin_installed(cyg_arch='x86_64'):
'''
Return True or False if cygwin is installed.
Use the cygcheck executable to check install. It is installed as part of
the base package, and we use it to check packages
'''
path_to_cygcheck = os.sep.join(['C:',
... | [
"Return",
"True",
"or",
"False",
"if",
"cygwin",
"is",
"installed",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cyg.py#L64-L78 | [
"def",
"_check_cygwin_installed",
"(",
"cyg_arch",
"=",
"'x86_64'",
")",
":",
"path_to_cygcheck",
"=",
"os",
".",
"sep",
".",
"join",
"(",
"[",
"'C:'",
",",
"_get_cyg_dir",
"(",
"cyg_arch",
")",
",",
"'bin'",
",",
"'cygcheck.exe'",
"]",
")",
"LOG",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_all_packages | Return the list of packages based on the mirror provided. | salt/modules/cyg.py | def _get_all_packages(mirror=DEFAULT_MIRROR,
cyg_arch='x86_64'):
'''
Return the list of packages based on the mirror provided.
'''
if 'cyg.all_packages' not in __context__:
__context__['cyg.all_packages'] = {}
if mirror not in __context__['cyg.all_packages']:
__... | def _get_all_packages(mirror=DEFAULT_MIRROR,
cyg_arch='x86_64'):
'''
Return the list of packages based on the mirror provided.
'''
if 'cyg.all_packages' not in __context__:
__context__['cyg.all_packages'] = {}
if mirror not in __context__['cyg.all_packages']:
__... | [
"Return",
"the",
"list",
"of",
"packages",
"based",
"on",
"the",
"mirror",
"provided",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cyg.py#L81-L103 | [
"def",
"_get_all_packages",
"(",
"mirror",
"=",
"DEFAULT_MIRROR",
",",
"cyg_arch",
"=",
"'x86_64'",
")",
":",
"if",
"'cyg.all_packages'",
"not",
"in",
"__context__",
":",
"__context__",
"[",
"'cyg.all_packages'",
"]",
"=",
"{",
"}",
"if",
"mirror",
"not",
"in"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | check_valid_package | Check if the package is valid on the given mirrors.
Args:
package: The name of the package
cyg_arch: The cygwin architecture
mirrors: any mirrors to check
Returns (bool): True if Valid, otherwise False
CLI Example:
.. code-block:: bash
salt '*' cyg.check_valid_packag... | salt/modules/cyg.py | def check_valid_package(package,
cyg_arch='x86_64',
mirrors=None):
'''
Check if the package is valid on the given mirrors.
Args:
package: The name of the package
cyg_arch: The cygwin architecture
mirrors: any mirrors to check
Retu... | def check_valid_package(package,
cyg_arch='x86_64',
mirrors=None):
'''
Check if the package is valid on the given mirrors.
Args:
package: The name of the package
cyg_arch: The cygwin architecture
mirrors: any mirrors to check
Retu... | [
"Check",
"if",
"the",
"package",
"is",
"valid",
"on",
"the",
"given",
"mirrors",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cyg.py#L106-L134 | [
"def",
"check_valid_package",
"(",
"package",
",",
"cyg_arch",
"=",
"'x86_64'",
",",
"mirrors",
"=",
"None",
")",
":",
"if",
"mirrors",
"is",
"None",
":",
"mirrors",
"=",
"[",
"{",
"DEFAULT_MIRROR",
":",
"DEFAULT_MIRROR_KEY",
"}",
"]",
"LOG",
".",
"debug",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _run_silent_cygwin | Retrieve the correct setup.exe.
Run it with the correct arguments to get the bare minimum cygwin
installation up and running. | salt/modules/cyg.py | def _run_silent_cygwin(cyg_arch='x86_64',
args=None,
mirrors=None):
'''
Retrieve the correct setup.exe.
Run it with the correct arguments to get the bare minimum cygwin
installation up and running.
'''
cyg_cache_dir = os.sep.join(['c:', 'cygcache'])... | def _run_silent_cygwin(cyg_arch='x86_64',
args=None,
mirrors=None):
'''
Retrieve the correct setup.exe.
Run it with the correct arguments to get the bare minimum cygwin
installation up and running.
'''
cyg_cache_dir = os.sep.join(['c:', 'cygcache'])... | [
"Retrieve",
"the",
"correct",
"setup",
".",
"exe",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cyg.py#L137-L191 | [
"def",
"_run_silent_cygwin",
"(",
"cyg_arch",
"=",
"'x86_64'",
",",
"args",
"=",
"None",
",",
"mirrors",
"=",
"None",
")",
":",
"cyg_cache_dir",
"=",
"os",
".",
"sep",
".",
"join",
"(",
"[",
"'c:'",
",",
"'cygcache'",
"]",
")",
"cyg_setup",
"=",
"'setu... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _cygcheck | Run the cygcheck executable. | salt/modules/cyg.py | def _cygcheck(args, cyg_arch='x86_64'):
'''
Run the cygcheck executable.
'''
cmd = ' '.join([
os.sep.join(['c:', _get_cyg_dir(cyg_arch), 'bin', 'cygcheck']),
'-c', args])
ret = __salt__['cmd.run_all'](cmd)
if ret['retcode'] == 0:
return ret['stdout']
else:
r... | def _cygcheck(args, cyg_arch='x86_64'):
'''
Run the cygcheck executable.
'''
cmd = ' '.join([
os.sep.join(['c:', _get_cyg_dir(cyg_arch), 'bin', 'cygcheck']),
'-c', args])
ret = __salt__['cmd.run_all'](cmd)
if ret['retcode'] == 0:
return ret['stdout']
else:
r... | [
"Run",
"the",
"cygcheck",
"executable",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cyg.py#L194-L207 | [
"def",
"_cygcheck",
"(",
"args",
",",
"cyg_arch",
"=",
"'x86_64'",
")",
":",
"cmd",
"=",
"' '",
".",
"join",
"(",
"[",
"os",
".",
"sep",
".",
"join",
"(",
"[",
"'c:'",
",",
"_get_cyg_dir",
"(",
"cyg_arch",
")",
",",
"'bin'",
",",
"'cygcheck'",
"]",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | install | Install one or several packages.
packages : None
The packages to install
cyg_arch : x86_64
Specify the architecture to install the package under
Current options are x86 and x86_64
CLI Example:
.. code-block:: bash
salt '*' cyg.install dos2unix
salt '*' cyg.in... | salt/modules/cyg.py | def install(packages=None,
cyg_arch='x86_64',
mirrors=None):
'''
Install one or several packages.
packages : None
The packages to install
cyg_arch : x86_64
Specify the architecture to install the package under
Current options are x86 and x86_64
CLI ... | def install(packages=None,
cyg_arch='x86_64',
mirrors=None):
'''
Install one or several packages.
packages : None
The packages to install
cyg_arch : x86_64
Specify the architecture to install the package under
Current options are x86 and x86_64
CLI ... | [
"Install",
"one",
"or",
"several",
"packages",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cyg.py#L210-L239 | [
"def",
"install",
"(",
"packages",
"=",
"None",
",",
"cyg_arch",
"=",
"'x86_64'",
",",
"mirrors",
"=",
"None",
")",
":",
"args",
"=",
"[",
"]",
"# If we want to install packages",
"if",
"packages",
"is",
"not",
"None",
":",
"args",
".",
"append",
"(",
"'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | uninstall | Uninstall one or several packages.
packages
The packages to uninstall.
cyg_arch : x86_64
Specify the architecture to remove the package from
Current options are x86 and x86_64
CLI Example:
.. code-block:: bash
salt '*' cyg.uninstall dos2unix
salt '*' cyg.unin... | salt/modules/cyg.py | def uninstall(packages,
cyg_arch='x86_64',
mirrors=None):
'''
Uninstall one or several packages.
packages
The packages to uninstall.
cyg_arch : x86_64
Specify the architecture to remove the package from
Current options are x86 and x86_64
CLI Exa... | def uninstall(packages,
cyg_arch='x86_64',
mirrors=None):
'''
Uninstall one or several packages.
packages
The packages to uninstall.
cyg_arch : x86_64
Specify the architecture to remove the package from
Current options are x86 and x86_64
CLI Exa... | [
"Uninstall",
"one",
"or",
"several",
"packages",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cyg.py#L242-L270 | [
"def",
"uninstall",
"(",
"packages",
",",
"cyg_arch",
"=",
"'x86_64'",
",",
"mirrors",
"=",
"None",
")",
":",
"args",
"=",
"[",
"]",
"if",
"packages",
"is",
"not",
"None",
":",
"args",
".",
"append",
"(",
"'--remove-packages {pkgs}'",
".",
"format",
"(",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update | Update all packages.
cyg_arch : x86_64
Specify the cygwin architecture update
Current options are x86 and x86_64
CLI Example:
.. code-block:: bash
salt '*' cyg.update
salt '*' cyg.update dos2unix mirrors="[{'http://mirror': 'http://url/to/public/key}]" | salt/modules/cyg.py | def update(cyg_arch='x86_64', mirrors=None):
'''
Update all packages.
cyg_arch : x86_64
Specify the cygwin architecture update
Current options are x86 and x86_64
CLI Example:
.. code-block:: bash
salt '*' cyg.update
salt '*' cyg.update dos2unix mirrors="[{'http://... | def update(cyg_arch='x86_64', mirrors=None):
'''
Update all packages.
cyg_arch : x86_64
Specify the cygwin architecture update
Current options are x86 and x86_64
CLI Example:
.. code-block:: bash
salt '*' cyg.update
salt '*' cyg.update dos2unix mirrors="[{'http://... | [
"Update",
"all",
"packages",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cyg.py#L273-L296 | [
"def",
"update",
"(",
"cyg_arch",
"=",
"'x86_64'",
",",
"mirrors",
"=",
"None",
")",
":",
"args",
"=",
"[",
"]",
"args",
".",
"append",
"(",
"'--upgrade-also'",
")",
"# Can't update something that isn't installed",
"if",
"not",
"_check_cygwin_installed",
"(",
"c... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.