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 | Pygit2.write_file | Using the blob object, write the file to the destination path | salt/utils/gitfs.py | def write_file(self, blob, dest):
'''
Using the blob object, write the file to the destination path
'''
with salt.utils.files.fopen(dest, 'wb+') as fp_:
fp_.write(blob.data) | def write_file(self, blob, dest):
'''
Using the blob object, write the file to the destination path
'''
with salt.utils.files.fopen(dest, 'wb+') as fp_:
fp_.write(blob.data) | [
"Using",
"the",
"blob",
"object",
"write",
"the",
"file",
"to",
"the",
"destination",
"path"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L2065-L2070 | [
"def",
"write_file",
"(",
"self",
",",
"blob",
",",
"dest",
")",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"dest",
",",
"'wb+'",
")",
"as",
"fp_",
":",
"fp_",
".",
"write",
"(",
"blob",
".",
"data",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | GitBase.init_remotes | Initialize remotes | salt/utils/gitfs.py | def init_remotes(self, remotes, per_remote_overrides=(),
per_remote_only=PER_REMOTE_ONLY,
global_only=GLOBAL_ONLY):
'''
Initialize remotes
'''
# The global versions of the auth params (gitfs_user,
# gitfs_password, etc.) default to empty ... | def init_remotes(self, remotes, per_remote_overrides=(),
per_remote_only=PER_REMOTE_ONLY,
global_only=GLOBAL_ONLY):
'''
Initialize remotes
'''
# The global versions of the auth params (gitfs_user,
# gitfs_password, etc.) default to empty ... | [
"Initialize",
"remotes"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L2146-L2269 | [
"def",
"init_remotes",
"(",
"self",
",",
"remotes",
",",
"per_remote_overrides",
"=",
"(",
")",
",",
"per_remote_only",
"=",
"PER_REMOTE_ONLY",
",",
"global_only",
"=",
"GLOBAL_ONLY",
")",
":",
"# The global versions of the auth params (gitfs_user,",
"# gitfs_password, et... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | GitBase.clear_old_remotes | Remove cache directories for remotes no longer configured | salt/utils/gitfs.py | def clear_old_remotes(self):
'''
Remove cache directories for remotes no longer configured
'''
try:
cachedir_ls = os.listdir(self.cache_root)
except OSError:
cachedir_ls = []
# Remove actively-used remotes from list
for repo in self.remotes... | def clear_old_remotes(self):
'''
Remove cache directories for remotes no longer configured
'''
try:
cachedir_ls = os.listdir(self.cache_root)
except OSError:
cachedir_ls = []
# Remove actively-used remotes from list
for repo in self.remotes... | [
"Remove",
"cache",
"directories",
"for",
"remotes",
"no",
"longer",
"configured"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L2271-L2310 | [
"def",
"clear_old_remotes",
"(",
"self",
")",
":",
"try",
":",
"cachedir_ls",
"=",
"os",
".",
"listdir",
"(",
"self",
".",
"cache_root",
")",
"except",
"OSError",
":",
"cachedir_ls",
"=",
"[",
"]",
"# Remove actively-used remotes from list",
"for",
"repo",
"in... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | GitBase.clear_cache | Completely clear cache | salt/utils/gitfs.py | def clear_cache(self):
'''
Completely clear cache
'''
errors = []
for rdir in (self.cache_root, self.file_list_cachedir):
if os.path.exists(rdir):
try:
shutil.rmtree(rdir)
except OSError as exc:
e... | def clear_cache(self):
'''
Completely clear cache
'''
errors = []
for rdir in (self.cache_root, self.file_list_cachedir):
if os.path.exists(rdir):
try:
shutil.rmtree(rdir)
except OSError as exc:
e... | [
"Completely",
"clear",
"cache"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L2312-L2325 | [
"def",
"clear_cache",
"(",
"self",
")",
":",
"errors",
"=",
"[",
"]",
"for",
"rdir",
"in",
"(",
"self",
".",
"cache_root",
",",
"self",
".",
"file_list_cachedir",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"rdir",
")",
":",
"try",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | GitBase.clear_lock | Clear update.lk for all remotes | salt/utils/gitfs.py | def clear_lock(self, remote=None, lock_type='update'):
'''
Clear update.lk for all remotes
'''
cleared = []
errors = []
for repo in self.remotes:
if remote:
# Specific remote URL/pattern was passed, ensure that the URL
# matches... | def clear_lock(self, remote=None, lock_type='update'):
'''
Clear update.lk for all remotes
'''
cleared = []
errors = []
for repo in self.remotes:
if remote:
# Specific remote URL/pattern was passed, ensure that the URL
# matches... | [
"Clear",
"update",
".",
"lk",
"for",
"all",
"remotes"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L2327-L2347 | [
"def",
"clear_lock",
"(",
"self",
",",
"remote",
"=",
"None",
",",
"lock_type",
"=",
"'update'",
")",
":",
"cleared",
"=",
"[",
"]",
"errors",
"=",
"[",
"]",
"for",
"repo",
"in",
"self",
".",
"remotes",
":",
"if",
"remote",
":",
"# Specific remote URL/... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | GitBase.fetch_remotes | Fetch all remotes and return a boolean to let the calling function know
whether or not any remotes were updated in the process of fetching | salt/utils/gitfs.py | def fetch_remotes(self, remotes=None):
'''
Fetch all remotes and return a boolean to let the calling function know
whether or not any remotes were updated in the process of fetching
'''
if remotes is None:
remotes = []
elif not isinstance(remotes, list):
... | def fetch_remotes(self, remotes=None):
'''
Fetch all remotes and return a boolean to let the calling function know
whether or not any remotes were updated in the process of fetching
'''
if remotes is None:
remotes = []
elif not isinstance(remotes, list):
... | [
"Fetch",
"all",
"remotes",
"and",
"return",
"a",
"boolean",
"to",
"let",
"the",
"calling",
"function",
"know",
"whether",
"or",
"not",
"any",
"remotes",
"were",
"updated",
"in",
"the",
"process",
"of",
"fetching"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L2349-L2382 | [
"def",
"fetch_remotes",
"(",
"self",
",",
"remotes",
"=",
"None",
")",
":",
"if",
"remotes",
"is",
"None",
":",
"remotes",
"=",
"[",
"]",
"elif",
"not",
"isinstance",
"(",
"remotes",
",",
"list",
")",
":",
"log",
".",
"error",
"(",
"'Invalid \\'remotes... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | GitBase.lock | Place an update.lk | salt/utils/gitfs.py | def lock(self, remote=None):
'''
Place an update.lk
'''
locked = []
errors = []
for repo in self.remotes:
if remote:
# Specific remote URL/pattern was passed, ensure that the URL
# matches or else skip this one
t... | def lock(self, remote=None):
'''
Place an update.lk
'''
locked = []
errors = []
for repo in self.remotes:
if remote:
# Specific remote URL/pattern was passed, ensure that the URL
# matches or else skip this one
t... | [
"Place",
"an",
"update",
".",
"lk"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L2384-L2404 | [
"def",
"lock",
"(",
"self",
",",
"remote",
"=",
"None",
")",
":",
"locked",
"=",
"[",
"]",
"errors",
"=",
"[",
"]",
"for",
"repo",
"in",
"self",
".",
"remotes",
":",
"if",
"remote",
":",
"# Specific remote URL/pattern was passed, ensure that the URL",
"# mat... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | GitBase.update | .. versionchanged:: 2018.3.0
The remotes argument was added. This being a list of remote URLs,
it will only update matching remotes. This actually matches on
repo.id
Execute a git fetch on all of the repos and perform maintenance on the
fileserver cache. | salt/utils/gitfs.py | def update(self, remotes=None):
'''
.. versionchanged:: 2018.3.0
The remotes argument was added. This being a list of remote URLs,
it will only update matching remotes. This actually matches on
repo.id
Execute a git fetch on all of the repos and perform maint... | def update(self, remotes=None):
'''
.. versionchanged:: 2018.3.0
The remotes argument was added. This being a list of remote URLs,
it will only update matching remotes. This actually matches on
repo.id
Execute a git fetch on all of the repos and perform maint... | [
"..",
"versionchanged",
"::",
"2018",
".",
"3",
".",
"0",
"The",
"remotes",
"argument",
"was",
"added",
".",
"This",
"being",
"a",
"list",
"of",
"remote",
"URLs",
"it",
"will",
"only",
"update",
"matching",
"remotes",
".",
"This",
"actually",
"matches",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L2406-L2460 | [
"def",
"update",
"(",
"self",
",",
"remotes",
"=",
"None",
")",
":",
"# data for the fileserver event",
"data",
"=",
"{",
"'changed'",
":",
"False",
",",
"'backend'",
":",
"'gitfs'",
"}",
"data",
"[",
"'changed'",
"]",
"=",
"self",
".",
"clear_old_remotes",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | GitBase.update_intervals | Returns a dictionary mapping remote IDs to their intervals, designed to
be used for variable update intervals in salt.master.FileserverUpdate.
A remote's ID is defined here as a tuple of the GitPython/Pygit2
object's "id" and "name" attributes, with None being assumed as the
"name" valu... | salt/utils/gitfs.py | def update_intervals(self):
'''
Returns a dictionary mapping remote IDs to their intervals, designed to
be used for variable update intervals in salt.master.FileserverUpdate.
A remote's ID is defined here as a tuple of the GitPython/Pygit2
object's "id" and "name" attributes, wi... | def update_intervals(self):
'''
Returns a dictionary mapping remote IDs to their intervals, designed to
be used for variable update intervals in salt.master.FileserverUpdate.
A remote's ID is defined here as a tuple of the GitPython/Pygit2
object's "id" and "name" attributes, wi... | [
"Returns",
"a",
"dictionary",
"mapping",
"remote",
"IDs",
"to",
"their",
"intervals",
"designed",
"to",
"be",
"used",
"for",
"variable",
"update",
"intervals",
"in",
"salt",
".",
"master",
".",
"FileserverUpdate",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L2462-L2472 | [
"def",
"update_intervals",
"(",
"self",
")",
":",
"return",
"{",
"(",
"repo",
".",
"id",
",",
"getattr",
"(",
"repo",
",",
"'name'",
",",
"None",
")",
")",
":",
"repo",
".",
"update_interval",
"for",
"repo",
"in",
"self",
".",
"remotes",
"}"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | GitBase.verify_provider | Determine which provider to use | salt/utils/gitfs.py | def verify_provider(self):
'''
Determine which provider to use
'''
if 'verified_{0}_provider'.format(self.role) in self.opts:
self.provider = self.opts['verified_{0}_provider'.format(self.role)]
else:
desired_provider = self.opts.get('{0}_provider'.format(... | def verify_provider(self):
'''
Determine which provider to use
'''
if 'verified_{0}_provider'.format(self.role) in self.opts:
self.provider = self.opts['verified_{0}_provider'.format(self.role)]
else:
desired_provider = self.opts.get('{0}_provider'.format(... | [
"Determine",
"which",
"provider",
"to",
"use"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L2474-L2511 | [
"def",
"verify_provider",
"(",
"self",
")",
":",
"if",
"'verified_{0}_provider'",
".",
"format",
"(",
"self",
".",
"role",
")",
"in",
"self",
".",
"opts",
":",
"self",
".",
"provider",
"=",
"self",
".",
"opts",
"[",
"'verified_{0}_provider'",
".",
"format"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | GitBase.verify_gitpython | Check if GitPython is available and at a compatible version (>= 0.3.0) | salt/utils/gitfs.py | def verify_gitpython(self, quiet=False):
'''
Check if GitPython is available and at a compatible version (>= 0.3.0)
'''
def _recommend():
if PYGIT2_VERSION and 'pygit2' in self.git_providers:
log.error(_RECOMMEND_PYGIT2, self.role, self.role)
if not G... | def verify_gitpython(self, quiet=False):
'''
Check if GitPython is available and at a compatible version (>= 0.3.0)
'''
def _recommend():
if PYGIT2_VERSION and 'pygit2' in self.git_providers:
log.error(_RECOMMEND_PYGIT2, self.role, self.role)
if not G... | [
"Check",
"if",
"GitPython",
"is",
"available",
"and",
"at",
"a",
"compatible",
"version",
"(",
">",
"=",
"0",
".",
"3",
".",
"0",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L2513-L2557 | [
"def",
"verify_gitpython",
"(",
"self",
",",
"quiet",
"=",
"False",
")",
":",
"def",
"_recommend",
"(",
")",
":",
"if",
"PYGIT2_VERSION",
"and",
"'pygit2'",
"in",
"self",
".",
"git_providers",
":",
"log",
".",
"error",
"(",
"_RECOMMEND_PYGIT2",
",",
"self"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | GitBase.verify_pygit2 | Check if pygit2/libgit2 are available and at a compatible version.
Pygit2 must be at least 0.20.3 and libgit2 must be at least 0.20.0. | salt/utils/gitfs.py | def verify_pygit2(self, quiet=False):
'''
Check if pygit2/libgit2 are available and at a compatible version.
Pygit2 must be at least 0.20.3 and libgit2 must be at least 0.20.0.
'''
def _recommend():
if GITPYTHON_VERSION and 'gitpython' in self.git_providers:
... | def verify_pygit2(self, quiet=False):
'''
Check if pygit2/libgit2 are available and at a compatible version.
Pygit2 must be at least 0.20.3 and libgit2 must be at least 0.20.0.
'''
def _recommend():
if GITPYTHON_VERSION and 'gitpython' in self.git_providers:
... | [
"Check",
"if",
"pygit2",
"/",
"libgit2",
"are",
"available",
"and",
"at",
"a",
"compatible",
"version",
".",
"Pygit2",
"must",
"be",
"at",
"least",
"0",
".",
"20",
".",
"3",
"and",
"libgit2",
"must",
"be",
"at",
"least",
"0",
".",
"20",
".",
"0",
"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L2559-L2614 | [
"def",
"verify_pygit2",
"(",
"self",
",",
"quiet",
"=",
"False",
")",
":",
"def",
"_recommend",
"(",
")",
":",
"if",
"GITPYTHON_VERSION",
"and",
"'gitpython'",
"in",
"self",
".",
"git_providers",
":",
"log",
".",
"error",
"(",
"_RECOMMEND_GITPYTHON",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | GitBase.write_remote_map | Write the remote_map.txt | salt/utils/gitfs.py | def write_remote_map(self):
'''
Write the remote_map.txt
'''
remote_map = salt.utils.path.join(self.cache_root, 'remote_map.txt')
try:
with salt.utils.files.fopen(remote_map, 'w+') as fp_:
timestamp = \
datetime.now().strftime('%d %... | def write_remote_map(self):
'''
Write the remote_map.txt
'''
remote_map = salt.utils.path.join(self.cache_root, 'remote_map.txt')
try:
with salt.utils.files.fopen(remote_map, 'w+') as fp_:
timestamp = \
datetime.now().strftime('%d %... | [
"Write",
"the",
"remote_map",
".",
"txt"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L2616-L2643 | [
"def",
"write_remote_map",
"(",
"self",
")",
":",
"remote_map",
"=",
"salt",
".",
"utils",
".",
"path",
".",
"join",
"(",
"self",
".",
"cache_root",
",",
"'remote_map.txt'",
")",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"("... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | GitBase.do_checkout | Common code for git_pillar/winrepo to handle locking and checking out
of a repo. | salt/utils/gitfs.py | def do_checkout(self, repo):
'''
Common code for git_pillar/winrepo to handle locking and checking out
of a repo.
'''
time_start = time.time()
while time.time() - time_start <= 5:
try:
return repo.checkout()
except GitLockError as e... | def do_checkout(self, repo):
'''
Common code for git_pillar/winrepo to handle locking and checking out
of a repo.
'''
time_start = time.time()
while time.time() - time_start <= 5:
try:
return repo.checkout()
except GitLockError as e... | [
"Common",
"code",
"for",
"git_pillar",
"/",
"winrepo",
"to",
"handle",
"locking",
"and",
"checking",
"out",
"of",
"a",
"repo",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L2645-L2676 | [
"def",
"do_checkout",
"(",
"self",
",",
"repo",
")",
":",
"time_start",
"=",
"time",
".",
"time",
"(",
")",
"while",
"time",
".",
"time",
"(",
")",
"-",
"time_start",
"<=",
"5",
":",
"try",
":",
"return",
"repo",
".",
"checkout",
"(",
")",
"except"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | GitFS.envs | Return a list of refs that can be used as environments | salt/utils/gitfs.py | def envs(self, ignore_cache=False):
'''
Return a list of refs that can be used as environments
'''
if not ignore_cache:
cache_match = salt.fileserver.check_env_cache(
self.opts,
self.env_cache
)
if cache_match is not Non... | def envs(self, ignore_cache=False):
'''
Return a list of refs that can be used as environments
'''
if not ignore_cache:
cache_match = salt.fileserver.check_env_cache(
self.opts,
self.env_cache
)
if cache_match is not Non... | [
"Return",
"a",
"list",
"of",
"refs",
"that",
"can",
"be",
"used",
"as",
"environments"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L2735-L2752 | [
"def",
"envs",
"(",
"self",
",",
"ignore_cache",
"=",
"False",
")",
":",
"if",
"not",
"ignore_cache",
":",
"cache_match",
"=",
"salt",
".",
"fileserver",
".",
"check_env_cache",
"(",
"self",
".",
"opts",
",",
"self",
".",
"env_cache",
")",
"if",
"cache_m... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | GitFS.find_file | Find the first file to match the path and ref, read the file out of git
and send the path to the newly cached file | salt/utils/gitfs.py | def find_file(self, path, tgt_env='base', **kwargs): # pylint: disable=W0613
'''
Find the first file to match the path and ref, read the file out of git
and send the path to the newly cached file
'''
fnd = {'path': '',
'rel': ''}
if os.path.isabs(path) or ... | def find_file(self, path, tgt_env='base', **kwargs): # pylint: disable=W0613
'''
Find the first file to match the path and ref, read the file out of git
and send the path to the newly cached file
'''
fnd = {'path': '',
'rel': ''}
if os.path.isabs(path) or ... | [
"Find",
"the",
"first",
"file",
"to",
"match",
"the",
"path",
"and",
"ref",
"read",
"the",
"file",
"out",
"of",
"git",
"and",
"send",
"the",
"path",
"to",
"the",
"newly",
"cached",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L2754-L2852 | [
"def",
"find_file",
"(",
"self",
",",
"path",
",",
"tgt_env",
"=",
"'base'",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=W0613",
"fnd",
"=",
"{",
"'path'",
":",
"''",
",",
"'rel'",
":",
"''",
"}",
"if",
"os",
".",
"path",
".",
"isabs",
"(... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | GitFS.file_hash | Return a file hash, the hash type is set in the master config file | salt/utils/gitfs.py | def file_hash(self, load, fnd):
'''
Return a file hash, the hash type is set in the master config file
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if not all(x in load for x in ('path', 'saltenv')):
return ''... | def file_hash(self, load, fnd):
'''
Return a file hash, the hash type is set in the master config file
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if not all(x in load for x in ('path', 'saltenv')):
return ''... | [
"Return",
"a",
"file",
"hash",
"the",
"hash",
"type",
"is",
"set",
"in",
"the",
"master",
"config",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L2887-L2921 | [
"def",
"file_hash",
"(",
"self",
",",
"load",
",",
"fnd",
")",
":",
"if",
"'env'",
"in",
"load",
":",
"# \"env\" is not supported; Use \"saltenv\".",
"load",
".",
"pop",
"(",
"'env'",
")",
"if",
"not",
"all",
"(",
"x",
"in",
"load",
"for",
"x",
"in",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | GitFS._file_lists | Return a dict containing the file lists for files and dirs | salt/utils/gitfs.py | def _file_lists(self, load, form):
'''
Return a dict containing the file lists for files and dirs
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if not os.path.isdir(self.file_list_cachedir):
try:
... | def _file_lists(self, load, form):
'''
Return a dict containing the file lists for files and dirs
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if not os.path.isdir(self.file_list_cachedir):
try:
... | [
"Return",
"a",
"dict",
"containing",
"the",
"file",
"lists",
"for",
"files",
"and",
"dirs"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L2923-L2972 | [
"def",
"_file_lists",
"(",
"self",
",",
"load",
",",
"form",
")",
":",
"if",
"'env'",
"in",
"load",
":",
"# \"env\" is not supported; Use \"saltenv\".",
"load",
".",
"pop",
"(",
"'env'",
")",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"self",
"."... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | GitFS.symlink_list | Return a dict of all symlinks based on a given path in the repo | salt/utils/gitfs.py | def symlink_list(self, load):
'''
Return a dict of all symlinks based on a given path in the repo
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if not salt.utils.stringutils.is_hex(load['saltenv']) \
and lo... | def symlink_list(self, load):
'''
Return a dict of all symlinks based on a given path in the repo
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if not salt.utils.stringutils.is_hex(load['saltenv']) \
and lo... | [
"Return",
"a",
"dict",
"of",
"all",
"symlinks",
"based",
"on",
"a",
"given",
"path",
"in",
"the",
"repo"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L2988-L3006 | [
"def",
"symlink_list",
"(",
"self",
",",
"load",
")",
":",
"if",
"'env'",
"in",
"load",
":",
"# \"env\" is not supported; Use \"saltenv\".",
"load",
".",
"pop",
"(",
"'env'",
")",
"if",
"not",
"salt",
".",
"utils",
".",
"stringutils",
".",
"is_hex",
"(",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | GitPillar.checkout | Checkout the targeted branches/tags from the git_pillar remotes | salt/utils/gitfs.py | def checkout(self):
'''
Checkout the targeted branches/tags from the git_pillar remotes
'''
self.pillar_dirs = OrderedDict()
self.pillar_linked_dirs = []
for repo in self.remotes:
cachedir = self.do_checkout(repo)
if cachedir is not None:
... | def checkout(self):
'''
Checkout the targeted branches/tags from the git_pillar remotes
'''
self.pillar_dirs = OrderedDict()
self.pillar_linked_dirs = []
for repo in self.remotes:
cachedir = self.do_checkout(repo)
if cachedir is not None:
... | [
"Checkout",
"the",
"targeted",
"branches",
"/",
"tags",
"from",
"the",
"git_pillar",
"remotes"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L3015-L3042 | [
"def",
"checkout",
"(",
"self",
")",
":",
"self",
".",
"pillar_dirs",
"=",
"OrderedDict",
"(",
")",
"self",
".",
"pillar_linked_dirs",
"=",
"[",
"]",
"for",
"repo",
"in",
"self",
".",
"remotes",
":",
"cachedir",
"=",
"self",
".",
"do_checkout",
"(",
"r... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | GitPillar.link_mountpoint | Ensure that the mountpoint is present in the correct location and
points at the correct path | salt/utils/gitfs.py | def link_mountpoint(self, repo):
'''
Ensure that the mountpoint is present in the correct location and
points at the correct path
'''
lcachelink = salt.utils.path.join(repo.linkdir, repo._mountpoint)
lcachedest = salt.utils.path.join(repo.cachedir, repo.root()).rstrip(os.... | def link_mountpoint(self, repo):
'''
Ensure that the mountpoint is present in the correct location and
points at the correct path
'''
lcachelink = salt.utils.path.join(repo.linkdir, repo._mountpoint)
lcachedest = salt.utils.path.join(repo.cachedir, repo.root()).rstrip(os.... | [
"Ensure",
"that",
"the",
"mountpoint",
"is",
"present",
"in",
"the",
"correct",
"location",
"and",
"points",
"at",
"the",
"correct",
"path"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L3044-L3156 | [
"def",
"link_mountpoint",
"(",
"self",
",",
"repo",
")",
":",
"lcachelink",
"=",
"salt",
".",
"utils",
".",
"path",
".",
"join",
"(",
"repo",
".",
"linkdir",
",",
"repo",
".",
"_mountpoint",
")",
"lcachedest",
"=",
"salt",
".",
"utils",
".",
"path",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | WinRepo.checkout | Checkout the targeted branches/tags from the winrepo remotes | salt/utils/gitfs.py | def checkout(self):
'''
Checkout the targeted branches/tags from the winrepo remotes
'''
self.winrepo_dirs = {}
for repo in self.remotes:
cachedir = self.do_checkout(repo)
if cachedir is not None:
self.winrepo_dirs[repo.id] = cachedir | def checkout(self):
'''
Checkout the targeted branches/tags from the winrepo remotes
'''
self.winrepo_dirs = {}
for repo in self.remotes:
cachedir = self.do_checkout(repo)
if cachedir is not None:
self.winrepo_dirs[repo.id] = cachedir | [
"Checkout",
"the",
"targeted",
"branches",
"/",
"tags",
"from",
"the",
"winrepo",
"remotes"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L3168-L3176 | [
"def",
"checkout",
"(",
"self",
")",
":",
"self",
".",
"winrepo_dirs",
"=",
"{",
"}",
"for",
"repo",
"in",
"self",
".",
"remotes",
":",
"cachedir",
"=",
"self",
".",
"do_checkout",
"(",
"repo",
")",
"if",
"cachedir",
"is",
"not",
"None",
":",
"self",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _is_exposed | Check if the minion is exposed, based on the whitelist and blacklist | salt/fileserver/minionfs.py | def _is_exposed(minion):
'''
Check if the minion is exposed, based on the whitelist and blacklist
'''
return salt.utils.stringutils.check_whitelist_blacklist(
minion,
whitelist=__opts__['minionfs_whitelist'],
blacklist=__opts__['minionfs_blacklist']
) | def _is_exposed(minion):
'''
Check if the minion is exposed, based on the whitelist and blacklist
'''
return salt.utils.stringutils.check_whitelist_blacklist(
minion,
whitelist=__opts__['minionfs_whitelist'],
blacklist=__opts__['minionfs_blacklist']
) | [
"Check",
"if",
"the",
"minion",
"is",
"exposed",
"based",
"on",
"the",
"whitelist",
"and",
"blacklist"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/minionfs.py#L65-L73 | [
"def",
"_is_exposed",
"(",
"minion",
")",
":",
"return",
"salt",
".",
"utils",
".",
"stringutils",
".",
"check_whitelist_blacklist",
"(",
"minion",
",",
"whitelist",
"=",
"__opts__",
"[",
"'minionfs_whitelist'",
"]",
",",
"blacklist",
"=",
"__opts__",
"[",
"'m... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | find_file | Search the environment for the relative path | salt/fileserver/minionfs.py | def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613
'''
Search the environment for the relative path
'''
fnd = {'path': '', 'rel': ''}
if os.path.isabs(path):
return fnd
if tgt_env not in envs():
return fnd
if os.path.basename(path) == 'top.sls':
l... | def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613
'''
Search the environment for the relative path
'''
fnd = {'path': '', 'rel': ''}
if os.path.isabs(path):
return fnd
if tgt_env not in envs():
return fnd
if os.path.basename(path) == 'top.sls':
l... | [
"Search",
"the",
"environment",
"for",
"the",
"relative",
"path"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/minionfs.py#L76-L110 | [
"def",
"find_file",
"(",
"path",
",",
"tgt_env",
"=",
"'base'",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=W0613",
"fnd",
"=",
"{",
"'path'",
":",
"''",
",",
"'rel'",
":",
"''",
"}",
"if",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update | When we are asked to update (regular interval) lets reap the cache | salt/fileserver/minionfs.py | def update():
'''
When we are asked to update (regular interval) lets reap the cache
'''
try:
salt.fileserver.reap_fileserver_cache_dir(
os.path.join(__opts__['cachedir'], 'minionfs/hash'),
find_file)
except os.error:
# Hash file won't exist if no files have y... | def update():
'''
When we are asked to update (regular interval) lets reap the cache
'''
try:
salt.fileserver.reap_fileserver_cache_dir(
os.path.join(__opts__['cachedir'], 'minionfs/hash'),
find_file)
except os.error:
# Hash file won't exist if no files have y... | [
"When",
"we",
"are",
"asked",
"to",
"update",
"(",
"regular",
"interval",
")",
"lets",
"reap",
"the",
"cache"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/minionfs.py#L155-L165 | [
"def",
"update",
"(",
")",
":",
"try",
":",
"salt",
".",
"fileserver",
".",
"reap_fileserver_cache_dir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'cachedir'",
"]",
",",
"'minionfs/hash'",
")",
",",
"find_file",
")",
"except",
"os",
"."... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | file_hash | Return a file hash, the hash type is set in the master config file | salt/fileserver/minionfs.py | def file_hash(load, fnd):
'''
Return a file hash, the hash type is set in the master config file
'''
path = fnd['path']
ret = {}
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if load['saltenv'] not in envs():
return {}
# if the file... | def file_hash(load, fnd):
'''
Return a file hash, the hash type is set in the master config file
'''
path = fnd['path']
ret = {}
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if load['saltenv'] not in envs():
return {}
# if the file... | [
"Return",
"a",
"file",
"hash",
"the",
"hash",
"type",
"is",
"set",
"in",
"the",
"master",
"config",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/minionfs.py#L168-L234 | [
"def",
"file_hash",
"(",
"load",
",",
"fnd",
")",
":",
"path",
"=",
"fnd",
"[",
"'path'",
"]",
"ret",
"=",
"{",
"}",
"if",
"'env'",
"in",
"load",
":",
"# \"env\" is not supported; Use \"saltenv\".",
"load",
".",
"pop",
"(",
"'env'",
")",
"if",
"load",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | file_list | Return a list of all files on the file server in a specified environment | salt/fileserver/minionfs.py | def file_list(load):
'''
Return a list of all files on the file server in a specified environment
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if load['saltenv'] not in envs():
return []
mountpoint = salt.utils.url.strip_proto(__opts__['... | def file_list(load):
'''
Return a list of all files on the file server in a specified environment
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if load['saltenv'] not in envs():
return []
mountpoint = salt.utils.url.strip_proto(__opts__['... | [
"Return",
"a",
"list",
"of",
"all",
"files",
"on",
"the",
"file",
"server",
"in",
"a",
"specified",
"environment"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/minionfs.py#L237-L299 | [
"def",
"file_list",
"(",
"load",
")",
":",
"if",
"'env'",
"in",
"load",
":",
"# \"env\" is not supported; Use \"saltenv\".",
"load",
".",
"pop",
"(",
"'env'",
")",
"if",
"load",
"[",
"'saltenv'",
"]",
"not",
"in",
"envs",
"(",
")",
":",
"return",
"[",
"]... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _subprocess | Function to standardize the subprocess call | salt/modules/trafficserver.py | def _subprocess(cmd):
'''
Function to standardize the subprocess call
'''
log.debug('Running: "%s"', ' '.join(cmd))
try:
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
ret = salt.utils.stringutils.to_unicode(proc.communicate()[0]).strip()
retcode = proc.wait()
... | def _subprocess(cmd):
'''
Function to standardize the subprocess call
'''
log.debug('Running: "%s"', ' '.join(cmd))
try:
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
ret = salt.utils.stringutils.to_unicode(proc.communicate()[0]).strip()
retcode = proc.wait()
... | [
"Function",
"to",
"standardize",
"the",
"subprocess",
"call"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/trafficserver.py#L53-L72 | [
"def",
"_subprocess",
"(",
"cmd",
")",
":",
"log",
".",
"debug",
"(",
"'Running: \"%s\"'",
",",
"' '",
".",
"join",
"(",
"cmd",
")",
")",
"try",
":",
"proc",
"=",
"subprocess",
".",
"Popen",
"(",
"cmd",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | bounce_local | Bounce Traffic Server on the local node. Bouncing Traffic Server shuts down
and immediately restarts the Traffic Server node.
drain
This option modifies the restart behavior such that traffic_server
is not shut down until the number of active client connections
drops to the number given... | salt/modules/trafficserver.py | def bounce_local(drain=False):
'''
Bounce Traffic Server on the local node. Bouncing Traffic Server shuts down
and immediately restarts the Traffic Server node.
drain
This option modifies the restart behavior such that traffic_server
is not shut down until the number of active client co... | def bounce_local(drain=False):
'''
Bounce Traffic Server on the local node. Bouncing Traffic Server shuts down
and immediately restarts the Traffic Server node.
drain
This option modifies the restart behavior such that traffic_server
is not shut down until the number of active client co... | [
"Bounce",
"Traffic",
"Server",
"on",
"the",
"local",
"node",
".",
"Bouncing",
"Traffic",
"Server",
"shuts",
"down",
"and",
"immediately",
"restarts",
"the",
"Traffic",
"Server",
"node",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/trafficserver.py#L93-L118 | [
"def",
"bounce_local",
"(",
"drain",
"=",
"False",
")",
":",
"if",
"_TRAFFICCTL",
":",
"cmd",
"=",
"_traffic_ctl",
"(",
"'server'",
",",
"'restart'",
")",
"else",
":",
"cmd",
"=",
"_traffic_line",
"(",
"'-b'",
")",
"if",
"drain",
":",
"cmd",
"=",
"cmd"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | restart_local | Restart the traffic_manager and traffic_server processes on the local node.
drain
This option modifies the restart behavior such that
``traffic_server`` is not shut down until the number of
active client connections drops to the number given by the
``proxy.config.restart.active_clie... | salt/modules/trafficserver.py | def restart_local(drain=False):
'''
Restart the traffic_manager and traffic_server processes on the local node.
drain
This option modifies the restart behavior such that
``traffic_server`` is not shut down until the number of
active client connections drops to the number given by th... | def restart_local(drain=False):
'''
Restart the traffic_manager and traffic_server processes on the local node.
drain
This option modifies the restart behavior such that
``traffic_server`` is not shut down until the number of
active client connections drops to the number given by th... | [
"Restart",
"the",
"traffic_manager",
"and",
"traffic_server",
"processes",
"on",
"the",
"local",
"node",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/trafficserver.py#L173-L197 | [
"def",
"restart_local",
"(",
"drain",
"=",
"False",
")",
":",
"if",
"_TRAFFICCTL",
":",
"cmd",
"=",
"_traffic_ctl",
"(",
"'server'",
",",
"'restart'",
",",
"'--manager'",
")",
"else",
":",
"cmd",
"=",
"_traffic_line",
"(",
"'-L'",
")",
"if",
"drain",
":"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | match_metric | Display the current values of all metrics whose names match the
given regular expression.
.. versionadded:: 2016.11.0
.. code-block:: bash
salt '*' trafficserver.match_metric regex | salt/modules/trafficserver.py | def match_metric(regex):
'''
Display the current values of all metrics whose names match the
given regular expression.
.. versionadded:: 2016.11.0
.. code-block:: bash
salt '*' trafficserver.match_metric regex
'''
if _TRAFFICCTL:
cmd = _traffic_ctl('metric', 'match', regex... | def match_metric(regex):
'''
Display the current values of all metrics whose names match the
given regular expression.
.. versionadded:: 2016.11.0
.. code-block:: bash
salt '*' trafficserver.match_metric regex
'''
if _TRAFFICCTL:
cmd = _traffic_ctl('metric', 'match', regex... | [
"Display",
"the",
"current",
"values",
"of",
"all",
"metrics",
"whose",
"names",
"match",
"the",
"given",
"regular",
"expression",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/trafficserver.py#L200-L216 | [
"def",
"match_metric",
"(",
"regex",
")",
":",
"if",
"_TRAFFICCTL",
":",
"cmd",
"=",
"_traffic_ctl",
"(",
"'metric'",
",",
"'match'",
",",
"regex",
")",
"else",
":",
"cmd",
"=",
"_traffic_ctl",
"(",
"'-m'",
",",
"regex",
")",
"return",
"_subprocess",
"("... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | match_config | Display the current values of all configuration variables whose
names match the given regular expression.
.. versionadded:: 2016.11.0
.. code-block:: bash
salt '*' trafficserver.match_config regex | salt/modules/trafficserver.py | def match_config(regex):
'''
Display the current values of all configuration variables whose
names match the given regular expression.
.. versionadded:: 2016.11.0
.. code-block:: bash
salt '*' trafficserver.match_config regex
'''
if _TRAFFICCTL:
cmd = _traffic_ctl('config'... | def match_config(regex):
'''
Display the current values of all configuration variables whose
names match the given regular expression.
.. versionadded:: 2016.11.0
.. code-block:: bash
salt '*' trafficserver.match_config regex
'''
if _TRAFFICCTL:
cmd = _traffic_ctl('config'... | [
"Display",
"the",
"current",
"values",
"of",
"all",
"configuration",
"variables",
"whose",
"names",
"match",
"the",
"given",
"regular",
"expression",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/trafficserver.py#L219-L235 | [
"def",
"match_config",
"(",
"regex",
")",
":",
"if",
"_TRAFFICCTL",
":",
"cmd",
"=",
"_traffic_ctl",
"(",
"'config'",
",",
"'match'",
",",
"regex",
")",
"else",
":",
"cmd",
"=",
"_traffic_line",
"(",
"'-m'",
",",
"regex",
")",
"return",
"_subprocess",
"(... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | read_config | Read Traffic Server configuration variable definitions.
.. versionadded:: 2016.11.0
.. code-block:: bash
salt '*' trafficserver.read_config proxy.config.http.keep_alive_post_out | salt/modules/trafficserver.py | def read_config(*args):
'''
Read Traffic Server configuration variable definitions.
.. versionadded:: 2016.11.0
.. code-block:: bash
salt '*' trafficserver.read_config proxy.config.http.keep_alive_post_out
'''
ret = {}
if _TRAFFICCTL:
cmd = _traffic_ctl('config', 'get')
... | def read_config(*args):
'''
Read Traffic Server configuration variable definitions.
.. versionadded:: 2016.11.0
.. code-block:: bash
salt '*' trafficserver.read_config proxy.config.http.keep_alive_post_out
'''
ret = {}
if _TRAFFICCTL:
cmd = _traffic_ctl('config', 'get')
... | [
"Read",
"Traffic",
"Server",
"configuration",
"variable",
"definitions",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/trafficserver.py#L238-L262 | [
"def",
"read_config",
"(",
"*",
"args",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"_TRAFFICCTL",
":",
"cmd",
"=",
"_traffic_ctl",
"(",
"'config'",
",",
"'get'",
")",
"else",
":",
"cmd",
"=",
"_traffic_line",
"(",
"'-r'",
")",
"try",
":",
"for",
"arg",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_config | Set the value of a Traffic Server configuration variable.
variable
Name of a Traffic Server configuration variable.
value
The new value to set.
.. versionadded:: 2016.11.0
.. code-block:: bash
salt '*' trafficserver.set_config proxy.config.http.keep_alive_post_out 0 | salt/modules/trafficserver.py | def set_config(variable, value):
'''
Set the value of a Traffic Server configuration variable.
variable
Name of a Traffic Server configuration variable.
value
The new value to set.
.. versionadded:: 2016.11.0
.. code-block:: bash
salt '*' trafficserver.set_config pro... | def set_config(variable, value):
'''
Set the value of a Traffic Server configuration variable.
variable
Name of a Traffic Server configuration variable.
value
The new value to set.
.. versionadded:: 2016.11.0
.. code-block:: bash
salt '*' trafficserver.set_config pro... | [
"Set",
"the",
"value",
"of",
"a",
"Traffic",
"Server",
"configuration",
"variable",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/trafficserver.py#L292-L315 | [
"def",
"set_config",
"(",
"variable",
",",
"value",
")",
":",
"if",
"_TRAFFICCTL",
":",
"cmd",
"=",
"_traffic_ctl",
"(",
"'config'",
",",
"'set'",
",",
"variable",
",",
"value",
")",
"else",
":",
"cmd",
"=",
"_traffic_line",
"(",
"'-s'",
",",
"variable",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | offline | Mark a cache storage device as offline. The storage is identified by a path
which must match exactly a path specified in storage.config. This removes
the storage from the cache and redirects requests that would have used this
storage to other storage. This has exactly the same effect as a disk
failure f... | salt/modules/trafficserver.py | def offline(path):
'''
Mark a cache storage device as offline. The storage is identified by a path
which must match exactly a path specified in storage.config. This removes
the storage from the cache and redirects requests that would have used this
storage to other storage. This has exactly the same... | def offline(path):
'''
Mark a cache storage device as offline. The storage is identified by a path
which must match exactly a path specified in storage.config. This removes
the storage from the cache and redirects requests that would have used this
storage to other storage. This has exactly the same... | [
"Mark",
"a",
"cache",
"storage",
"device",
"as",
"offline",
".",
"The",
"storage",
"is",
"identified",
"by",
"a",
"path",
"which",
"must",
"match",
"exactly",
"a",
"path",
"specified",
"in",
"storage",
".",
"config",
".",
"This",
"removes",
"the",
"storage... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/trafficserver.py#L411-L430 | [
"def",
"offline",
"(",
"path",
")",
":",
"if",
"_TRAFFICCTL",
":",
"cmd",
"=",
"_traffic_ctl",
"(",
"'storage'",
",",
"'offline'",
",",
"path",
")",
"else",
":",
"cmd",
"=",
"_traffic_line",
"(",
"'--offline'",
",",
"path",
")",
"return",
"_subprocess",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | clear_alarms | Clear (acknowledge) an alarm event. The arguments are “all” for all current
alarms, a specific alarm number (e.g. ‘‘1’‘), or an alarm string identifier
(e.g. ‘’MGMT_ALARM_PROXY_CONFIG_ERROR’‘).
.. code-block:: bash
salt '*' trafficserver.clear_alarms [all | #event | name] | salt/modules/trafficserver.py | def clear_alarms(alarm):
'''
Clear (acknowledge) an alarm event. The arguments are “all” for all current
alarms, a specific alarm number (e.g. ‘‘1’‘), or an alarm string identifier
(e.g. ‘’MGMT_ALARM_PROXY_CONFIG_ERROR’‘).
.. code-block:: bash
salt '*' trafficserver.clear_alarms [all | #ev... | def clear_alarms(alarm):
'''
Clear (acknowledge) an alarm event. The arguments are “all” for all current
alarms, a specific alarm number (e.g. ‘‘1’‘), or an alarm string identifier
(e.g. ‘’MGMT_ALARM_PROXY_CONFIG_ERROR’‘).
.. code-block:: bash
salt '*' trafficserver.clear_alarms [all | #ev... | [
"Clear",
"(",
"acknowledge",
")",
"an",
"alarm",
"event",
".",
"The",
"arguments",
"are",
"“all”",
"for",
"all",
"current",
"alarms",
"a",
"specific",
"alarm",
"number",
"(",
"e",
".",
"g",
".",
"‘‘1’‘",
")",
"or",
"an",
"alarm",
"string",
"identifier",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/trafficserver.py#L450-L466 | [
"def",
"clear_alarms",
"(",
"alarm",
")",
":",
"if",
"_TRAFFICCTL",
":",
"cmd",
"=",
"_traffic_ctl",
"(",
"'alarm'",
",",
"'clear'",
",",
"alarm",
")",
"else",
":",
"cmd",
"=",
"_traffic_line",
"(",
"'--clear_alarms'",
",",
"alarm",
")",
"return",
"_subpro... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | node_state | Libcloud supported node states | salt/cloud/libcloudfuncs.py | def node_state(id_):
'''
Libcloud supported node states
'''
states_int = {
0: 'RUNNING',
1: 'REBOOTING',
2: 'TERMINATED',
3: 'PENDING',
4: 'UNKNOWN',
5: 'STOPPED',
6: 'SUSPENDED',
7: 'ERROR',
8: 'PAUSED'}
states_str = {
... | def node_state(id_):
'''
Libcloud supported node states
'''
states_int = {
0: 'RUNNING',
1: 'REBOOTING',
2: 'TERMINATED',
3: 'PENDING',
4: 'UNKNOWN',
5: 'STOPPED',
6: 'SUSPENDED',
7: 'ERROR',
8: 'PAUSED'}
states_str = {
... | [
"Libcloud",
"supported",
"node",
"states"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/libcloudfuncs.py#L54-L82 | [
"def",
"node_state",
"(",
"id_",
")",
":",
"states_int",
"=",
"{",
"0",
":",
"'RUNNING'",
",",
"1",
":",
"'REBOOTING'",
",",
"2",
":",
"'TERMINATED'",
",",
"3",
":",
"'PENDING'",
",",
"4",
":",
"'UNKNOWN'",
",",
"5",
":",
"'STOPPED'",
",",
"6",
":"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | check_libcloud_version | Compare different libcloud versions | salt/cloud/libcloudfuncs.py | def check_libcloud_version(reqver=LIBCLOUD_MINIMAL_VERSION, why=None):
'''
Compare different libcloud versions
'''
if not HAS_LIBCLOUD:
return False
if not isinstance(reqver, (list, tuple)):
raise RuntimeError(
'\'reqver\' needs to passed as a tuple or list, i.e., (0, 14... | def check_libcloud_version(reqver=LIBCLOUD_MINIMAL_VERSION, why=None):
'''
Compare different libcloud versions
'''
if not HAS_LIBCLOUD:
return False
if not isinstance(reqver, (list, tuple)):
raise RuntimeError(
'\'reqver\' needs to passed as a tuple or list, i.e., (0, 14... | [
"Compare",
"different",
"libcloud",
"versions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/libcloudfuncs.py#L85-L115 | [
"def",
"check_libcloud_version",
"(",
"reqver",
"=",
"LIBCLOUD_MINIMAL_VERSION",
",",
"why",
"=",
"None",
")",
":",
"if",
"not",
"HAS_LIBCLOUD",
":",
"return",
"False",
"if",
"not",
"isinstance",
"(",
"reqver",
",",
"(",
"list",
",",
"tuple",
")",
")",
":"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_node | Return a libcloud node for the named VM | salt/cloud/libcloudfuncs.py | def get_node(conn, name):
'''
Return a libcloud node for the named VM
'''
nodes = conn.list_nodes()
for node in nodes:
if node.name == name:
__utils__['cloud.cache_node'](salt.utils.data.simple_types_filter(node.__dict__), __active_provider_name__, __opts__)
return no... | def get_node(conn, name):
'''
Return a libcloud node for the named VM
'''
nodes = conn.list_nodes()
for node in nodes:
if node.name == name:
__utils__['cloud.cache_node'](salt.utils.data.simple_types_filter(node.__dict__), __active_provider_name__, __opts__)
return no... | [
"Return",
"a",
"libcloud",
"node",
"for",
"the",
"named",
"VM"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/libcloudfuncs.py#L118-L126 | [
"def",
"get_node",
"(",
"conn",
",",
"name",
")",
":",
"nodes",
"=",
"conn",
".",
"list_nodes",
"(",
")",
"for",
"node",
"in",
"nodes",
":",
"if",
"node",
".",
"name",
"==",
"name",
":",
"__utils__",
"[",
"'cloud.cache_node'",
"]",
"(",
"salt",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | avail_locations | Return a dict of all available VM locations on the cloud provider with
relevant data | salt/cloud/libcloudfuncs.py | def avail_locations(conn=None, call=None):
'''
Return a dict of all available VM locations on the cloud provider with
relevant data
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_locations function must be called with '
'-f or --function, or with the -... | def avail_locations(conn=None, call=None):
'''
Return a dict of all available VM locations on the cloud provider with
relevant data
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_locations function must be called with '
'-f or --function, or with the -... | [
"Return",
"a",
"dict",
"of",
"all",
"available",
"VM",
"locations",
"on",
"the",
"cloud",
"provider",
"with",
"relevant",
"data"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/libcloudfuncs.py#L129-L163 | [
"def",
"avail_locations",
"(",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_locations function must be called with '",
"'-f or --function, or with the --list-locations option'"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | avail_images | Return a dict of all available VM images on the cloud provider with
relevant data | salt/cloud/libcloudfuncs.py | def avail_images(conn=None, call=None):
'''
Return a dict of all available VM images on the cloud provider with
relevant data
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-ima... | def avail_images(conn=None, call=None):
'''
Return a dict of all available VM images on the cloud provider with
relevant data
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-ima... | [
"Return",
"a",
"dict",
"of",
"all",
"available",
"VM",
"images",
"on",
"the",
"cloud",
"provider",
"with",
"relevant",
"data"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/libcloudfuncs.py#L166-L198 | [
"def",
"avail_images",
"(",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_images function must be called with '",
"'-f or --function, or with the --list-images option'",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | avail_sizes | Return a dict of all available VM images on the cloud provider with
relevant data | salt/cloud/libcloudfuncs.py | def avail_sizes(conn=None, call=None):
'''
Return a dict of all available VM images on the cloud provider with
relevant data
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_sizes function must be called with '
'-f or --function, or with the --list-sizes... | def avail_sizes(conn=None, call=None):
'''
Return a dict of all available VM images on the cloud provider with
relevant data
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_sizes function must be called with '
'-f or --function, or with the --list-sizes... | [
"Return",
"a",
"dict",
"of",
"all",
"available",
"VM",
"images",
"on",
"the",
"cloud",
"provider",
"with",
"relevant",
"data"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/libcloudfuncs.py#L201-L238 | [
"def",
"avail_sizes",
"(",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_sizes function must be called with '",
"'-f or --function, or with the --list-sizes option'",
")",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_location | Return the location object to use | salt/cloud/libcloudfuncs.py | def get_location(conn, vm_):
'''
Return the location object to use
'''
locations = conn.list_locations()
vm_location = config.get_cloud_config_value('location', vm_, __opts__)
if not six.PY3:
vm_location = vm_location.encode(
'ascii', 'salt-cloud-force-ascii'
)
f... | def get_location(conn, vm_):
'''
Return the location object to use
'''
locations = conn.list_locations()
vm_location = config.get_cloud_config_value('location', vm_, __opts__)
if not six.PY3:
vm_location = vm_location.encode(
'ascii', 'salt-cloud-force-ascii'
)
f... | [
"Return",
"the",
"location",
"object",
"to",
"use"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/libcloudfuncs.py#L241-L270 | [
"def",
"get_location",
"(",
"conn",
",",
"vm_",
")",
":",
"locations",
"=",
"conn",
".",
"list_locations",
"(",
")",
"vm_location",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'location'",
",",
"vm_",
",",
"__opts__",
")",
"if",
"not",
"six",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_image | Return the image object to use | salt/cloud/libcloudfuncs.py | def get_image(conn, vm_):
'''
Return the image object to use
'''
images = conn.list_images()
vm_image = config.get_cloud_config_value('image', vm_, __opts__)
if not six.PY3:
vm_image = vm_image.encode('ascii', 'salt-cloud-force-ascii')
for img in images:
if isinstance(img.i... | def get_image(conn, vm_):
'''
Return the image object to use
'''
images = conn.list_images()
vm_image = config.get_cloud_config_value('image', vm_, __opts__)
if not six.PY3:
vm_image = vm_image.encode('ascii', 'salt-cloud-force-ascii')
for img in images:
if isinstance(img.i... | [
"Return",
"the",
"image",
"object",
"to",
"use"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/libcloudfuncs.py#L273-L299 | [
"def",
"get_image",
"(",
"conn",
",",
"vm_",
")",
":",
"images",
"=",
"conn",
".",
"list_images",
"(",
")",
"vm_image",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'image'",
",",
"vm_",
",",
"__opts__",
")",
"if",
"not",
"six",
".",
"PY3",
":",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_size | Return the VM's size object | salt/cloud/libcloudfuncs.py | def get_size(conn, vm_):
'''
Return the VM's size object
'''
sizes = conn.list_sizes()
vm_size = config.get_cloud_config_value('size', vm_, __opts__)
if not vm_size:
return sizes[0]
for size in sizes:
if vm_size and str(vm_size) in (str(size.id), str(size.name)): # pylint: ... | def get_size(conn, vm_):
'''
Return the VM's size object
'''
sizes = conn.list_sizes()
vm_size = config.get_cloud_config_value('size', vm_, __opts__)
if not vm_size:
return sizes[0]
for size in sizes:
if vm_size and str(vm_size) in (str(size.id), str(size.name)): # pylint: ... | [
"Return",
"the",
"VM",
"s",
"size",
"object"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/libcloudfuncs.py#L302-L316 | [
"def",
"get_size",
"(",
"conn",
",",
"vm_",
")",
":",
"sizes",
"=",
"conn",
".",
"list_sizes",
"(",
")",
"vm_size",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'size'",
",",
"vm_",
",",
"__opts__",
")",
"if",
"not",
"vm_size",
":",
"return",
"s... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | destroy | Delete a single VM | salt/cloud/libcloudfuncs.py | def destroy(name, conn=None, call=None):
'''
Delete a single VM
'''
if call == 'function':
raise SaltCloudSystemExit(
'The destroy action must be called with -d, --destroy, '
'-a or --action.'
)
__utils__['cloud.fire_event'](
'event',
'destroy... | def destroy(name, conn=None, call=None):
'''
Delete a single VM
'''
if call == 'function':
raise SaltCloudSystemExit(
'The destroy action must be called with -d, --destroy, '
'-a or --action.'
)
__utils__['cloud.fire_event'](
'event',
'destroy... | [
"Delete",
"a",
"single",
"VM"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/libcloudfuncs.py#L335-L409 | [
"def",
"destroy",
"(",
"name",
",",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The destroy action must be called with -d, --destroy, '",
"'-a or --action.'",
")",
"__utils__"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | reboot | Reboot a single VM | salt/cloud/libcloudfuncs.py | def reboot(name, conn=None):
'''
Reboot a single VM
'''
if not conn:
conn = get_conn() # pylint: disable=E0602
node = get_node(conn, name)
if node is None:
log.error('Unable to find the VM %s', name)
log.info('Rebooting VM: %s', name)
ret = conn.reboot_node(node)
i... | def reboot(name, conn=None):
'''
Reboot a single VM
'''
if not conn:
conn = get_conn() # pylint: disable=E0602
node = get_node(conn, name)
if node is None:
log.error('Unable to find the VM %s', name)
log.info('Rebooting VM: %s', name)
ret = conn.reboot_node(node)
i... | [
"Reboot",
"a",
"single",
"VM"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/libcloudfuncs.py#L412-L438 | [
"def",
"reboot",
"(",
"name",
",",
"conn",
"=",
"None",
")",
":",
"if",
"not",
"conn",
":",
"conn",
"=",
"get_conn",
"(",
")",
"# pylint: disable=E0602",
"node",
"=",
"get_node",
"(",
"conn",
",",
"name",
")",
"if",
"node",
"is",
"None",
":",
"log",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_nodes | Return a list of the VMs that are on the provider | salt/cloud/libcloudfuncs.py | def list_nodes(conn=None, call=None):
'''
Return a list of the VMs that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
if not conn:
conn = get_conn() # pylint: disable=E0... | def list_nodes(conn=None, call=None):
'''
Return a list of the VMs that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
if not conn:
conn = get_conn() # pylint: disable=E0... | [
"Return",
"a",
"list",
"of",
"the",
"VMs",
"that",
"are",
"on",
"the",
"provider"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/libcloudfuncs.py#L441-L465 | [
"def",
"list_nodes",
"(",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_nodes function must be called with -f or --function.'",
")",
"if",
"not",
"conn",
":",
"conn",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_nodes_full | Return a list of the VMs that are on the provider, with all fields | salt/cloud/libcloudfuncs.py | def list_nodes_full(conn=None, call=None):
'''
Return a list of the VMs that are on the provider, with all fields
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_full function must be called with -f or --function.'
)
if not conn:
conn = get_co... | def list_nodes_full(conn=None, call=None):
'''
Return a list of the VMs that are on the provider, with all fields
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_full function must be called with -f or --function.'
)
if not conn:
conn = get_co... | [
"Return",
"a",
"list",
"of",
"the",
"VMs",
"that",
"are",
"on",
"the",
"provider",
"with",
"all",
"fields"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/libcloudfuncs.py#L468-L490 | [
"def",
"list_nodes_full",
"(",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_nodes_full function must be called with -f or --function.'",
")",
"if",
"not",
"conn",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_nodes_select | Return a list of the VMs that are on the provider, with select fields | salt/cloud/libcloudfuncs.py | def list_nodes_select(conn=None, call=None):
'''
Return a list of the VMs that are on the provider, with select fields
'''
if not conn:
conn = get_conn() # pylint: disable=E0602
return salt.utils.cloud.list_nodes_select(
list_nodes_full(conn, 'function'), __opts__['query.selection... | def list_nodes_select(conn=None, call=None):
'''
Return a list of the VMs that are on the provider, with select fields
'''
if not conn:
conn = get_conn() # pylint: disable=E0602
return salt.utils.cloud.list_nodes_select(
list_nodes_full(conn, 'function'), __opts__['query.selection... | [
"Return",
"a",
"list",
"of",
"the",
"VMs",
"that",
"are",
"on",
"the",
"provider",
"with",
"select",
"fields"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/libcloudfuncs.py#L493-L502 | [
"def",
"list_nodes_select",
"(",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"not",
"conn",
":",
"conn",
"=",
"get_conn",
"(",
")",
"# pylint: disable=E0602",
"return",
"salt",
".",
"utils",
".",
"cloud",
".",
"list_nodes_select",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | conn_has_method | Find if the provided connection object has a specific method | salt/cloud/libcloudfuncs.py | def conn_has_method(conn, method_name):
'''
Find if the provided connection object has a specific method
'''
if method_name in dir(conn):
return True
log.error('Method \'%s\' not yet supported!', method_name)
return False | def conn_has_method(conn, method_name):
'''
Find if the provided connection object has a specific method
'''
if method_name in dir(conn):
return True
log.error('Method \'%s\' not yet supported!', method_name)
return False | [
"Find",
"if",
"the",
"provided",
"connection",
"object",
"has",
"a",
"specific",
"method"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/libcloudfuncs.py#L519-L527 | [
"def",
"conn_has_method",
"(",
"conn",
",",
"method_name",
")",
":",
"if",
"method_name",
"in",
"dir",
"(",
"conn",
")",
":",
"return",
"True",
"log",
".",
"error",
"(",
"'Method \\'%s\\' not yet supported!'",
",",
"method_name",
")",
"return",
"False"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | db_exists | Checks if a database exists in InfluxDB.
name
Name of the database to check.
CLI Example:
.. code-block:: bash
salt '*' influxdb.db_exists <name> | salt/modules/influxdbmod.py | def db_exists(name, **client_args):
'''
Checks if a database exists in InfluxDB.
name
Name of the database to check.
CLI Example:
.. code-block:: bash
salt '*' influxdb.db_exists <name>
'''
if name in [db['name'] for db in list_dbs(**client_args)]:
return True
... | def db_exists(name, **client_args):
'''
Checks if a database exists in InfluxDB.
name
Name of the database to check.
CLI Example:
.. code-block:: bash
salt '*' influxdb.db_exists <name>
'''
if name in [db['name'] for db in list_dbs(**client_args)]:
return True
... | [
"Checks",
"if",
"a",
"database",
"exists",
"in",
"InfluxDB",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L95-L111 | [
"def",
"db_exists",
"(",
"name",
",",
"*",
"*",
"client_args",
")",
":",
"if",
"name",
"in",
"[",
"db",
"[",
"'name'",
"]",
"for",
"db",
"in",
"list_dbs",
"(",
"*",
"*",
"client_args",
")",
"]",
":",
"return",
"True",
"return",
"False"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_db | Create a database.
name
Name of the database to create.
CLI Example:
.. code-block:: bash
salt '*' influxdb.create_db <name> | salt/modules/influxdbmod.py | def create_db(name, **client_args):
'''
Create a database.
name
Name of the database to create.
CLI Example:
.. code-block:: bash
salt '*' influxdb.create_db <name>
'''
if db_exists(name, **client_args):
log.info('DB \'%s\' already exists', name)
return Fa... | def create_db(name, **client_args):
'''
Create a database.
name
Name of the database to create.
CLI Example:
.. code-block:: bash
salt '*' influxdb.create_db <name>
'''
if db_exists(name, **client_args):
log.info('DB \'%s\' already exists', name)
return Fa... | [
"Create",
"a",
"database",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L114-L134 | [
"def",
"create_db",
"(",
"name",
",",
"*",
"*",
"client_args",
")",
":",
"if",
"db_exists",
"(",
"name",
",",
"*",
"*",
"client_args",
")",
":",
"log",
".",
"info",
"(",
"'DB \\'%s\\' already exists'",
",",
"name",
")",
"return",
"False",
"client",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | drop_db | Drop a database.
name
Name of the database to drop.
CLI Example:
.. code-block:: bash
salt '*' influxdb.drop_db <name> | salt/modules/influxdbmod.py | def drop_db(name, **client_args):
'''
Drop a database.
name
Name of the database to drop.
CLI Example:
.. code-block:: bash
salt '*' influxdb.drop_db <name>
'''
if not db_exists(name, **client_args):
log.info('DB \'%s\' does not exist', name)
return False
... | def drop_db(name, **client_args):
'''
Drop a database.
name
Name of the database to drop.
CLI Example:
.. code-block:: bash
salt '*' influxdb.drop_db <name>
'''
if not db_exists(name, **client_args):
log.info('DB \'%s\' does not exist', name)
return False
... | [
"Drop",
"a",
"database",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L137-L157 | [
"def",
"drop_db",
"(",
"name",
",",
"*",
"*",
"client_args",
")",
":",
"if",
"not",
"db_exists",
"(",
"name",
",",
"*",
"*",
"client_args",
")",
":",
"log",
".",
"info",
"(",
"'DB \\'%s\\' does not exist'",
",",
"name",
")",
"return",
"False",
"client",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | user_info | Get information about given user.
name
Name of the user for which to get information.
CLI Example:
.. code-block:: bash
salt '*' influxdb.user_info <name> | salt/modules/influxdbmod.py | def user_info(name, **client_args):
'''
Get information about given user.
name
Name of the user for which to get information.
CLI Example:
.. code-block:: bash
salt '*' influxdb.user_info <name>
'''
matching_users = (user for user in list_users(**client_args)
... | def user_info(name, **client_args):
'''
Get information about given user.
name
Name of the user for which to get information.
CLI Example:
.. code-block:: bash
salt '*' influxdb.user_info <name>
'''
matching_users = (user for user in list_users(**client_args)
... | [
"Get",
"information",
"about",
"given",
"user",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L194-L213 | [
"def",
"user_info",
"(",
"name",
",",
"*",
"*",
"client_args",
")",
":",
"matching_users",
"=",
"(",
"user",
"for",
"user",
"in",
"list_users",
"(",
"*",
"*",
"client_args",
")",
"if",
"user",
".",
"get",
"(",
"'user'",
")",
"==",
"name",
")",
"try",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_user | Create a user.
name
Name of the user to create.
passwd
Password of the new user.
admin : False
Whether the user should have cluster administration
privileges or not.
CLI Example:
.. code-block:: bash
salt '*' influxdb.create_user <name> <password>
... | salt/modules/influxdbmod.py | def create_user(name, passwd, admin=False, **client_args):
'''
Create a user.
name
Name of the user to create.
passwd
Password of the new user.
admin : False
Whether the user should have cluster administration
privileges or not.
CLI Example:
.. code-block... | def create_user(name, passwd, admin=False, **client_args):
'''
Create a user.
name
Name of the user to create.
passwd
Password of the new user.
admin : False
Whether the user should have cluster administration
privileges or not.
CLI Example:
.. code-block... | [
"Create",
"a",
"user",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L216-L244 | [
"def",
"create_user",
"(",
"name",
",",
"passwd",
",",
"admin",
"=",
"False",
",",
"*",
"*",
"client_args",
")",
":",
"if",
"user_exists",
"(",
"name",
",",
"*",
"*",
"client_args",
")",
":",
"log",
".",
"info",
"(",
"\"User '%s' already exists\"",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_user_password | Change password of a user.
name
Name of the user for whom to set the password.
passwd
New password of the user.
CLI Example:
.. code-block:: bash
salt '*' influxdb.set_user_password <name> <password> | salt/modules/influxdbmod.py | def set_user_password(name, passwd, **client_args):
'''
Change password of a user.
name
Name of the user for whom to set the password.
passwd
New password of the user.
CLI Example:
.. code-block:: bash
salt '*' influxdb.set_user_password <name> <password>
'''
... | def set_user_password(name, passwd, **client_args):
'''
Change password of a user.
name
Name of the user for whom to set the password.
passwd
New password of the user.
CLI Example:
.. code-block:: bash
salt '*' influxdb.set_user_password <name> <password>
'''
... | [
"Change",
"password",
"of",
"a",
"user",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L247-L270 | [
"def",
"set_user_password",
"(",
"name",
",",
"passwd",
",",
"*",
"*",
"client_args",
")",
":",
"if",
"not",
"user_exists",
"(",
"name",
",",
"*",
"*",
"client_args",
")",
":",
"log",
".",
"info",
"(",
"'User \\'%s\\' does not exist'",
",",
"name",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | grant_admin_privileges | Grant cluster administration privileges to a user.
name
Name of the user to whom admin privileges will be granted.
CLI Example:
.. code-block:: bash
salt '*' influxdb.grant_admin_privileges <name> | salt/modules/influxdbmod.py | def grant_admin_privileges(name, **client_args):
'''
Grant cluster administration privileges to a user.
name
Name of the user to whom admin privileges will be granted.
CLI Example:
.. code-block:: bash
salt '*' influxdb.grant_admin_privileges <name>
'''
client = _client(*... | def grant_admin_privileges(name, **client_args):
'''
Grant cluster administration privileges to a user.
name
Name of the user to whom admin privileges will be granted.
CLI Example:
.. code-block:: bash
salt '*' influxdb.grant_admin_privileges <name>
'''
client = _client(*... | [
"Grant",
"cluster",
"administration",
"privileges",
"to",
"a",
"user",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L273-L289 | [
"def",
"grant_admin_privileges",
"(",
"name",
",",
"*",
"*",
"client_args",
")",
":",
"client",
"=",
"_client",
"(",
"*",
"*",
"client_args",
")",
"client",
".",
"grant_admin_privileges",
"(",
"name",
")",
"return",
"True"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | revoke_admin_privileges | Revoke cluster administration privileges from a user.
name
Name of the user from whom admin privileges will be revoked.
CLI Example:
.. code-block:: bash
salt '*' influxdb.revoke_admin_privileges <name> | salt/modules/influxdbmod.py | def revoke_admin_privileges(name, **client_args):
'''
Revoke cluster administration privileges from a user.
name
Name of the user from whom admin privileges will be revoked.
CLI Example:
.. code-block:: bash
salt '*' influxdb.revoke_admin_privileges <name>
'''
client = _c... | def revoke_admin_privileges(name, **client_args):
'''
Revoke cluster administration privileges from a user.
name
Name of the user from whom admin privileges will be revoked.
CLI Example:
.. code-block:: bash
salt '*' influxdb.revoke_admin_privileges <name>
'''
client = _c... | [
"Revoke",
"cluster",
"administration",
"privileges",
"from",
"a",
"user",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L292-L308 | [
"def",
"revoke_admin_privileges",
"(",
"name",
",",
"*",
"*",
"client_args",
")",
":",
"client",
"=",
"_client",
"(",
"*",
"*",
"client_args",
")",
"client",
".",
"revoke_admin_privileges",
"(",
"name",
")",
"return",
"True"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove_user | Remove a user.
name
Name of the user to remove
CLI Example:
.. code-block:: bash
salt '*' influxdb.remove_user <name> | salt/modules/influxdbmod.py | def remove_user(name, **client_args):
'''
Remove a user.
name
Name of the user to remove
CLI Example:
.. code-block:: bash
salt '*' influxdb.remove_user <name>
'''
if not user_exists(name, **client_args):
log.info('User \'%s\' does not exist', name)
return... | def remove_user(name, **client_args):
'''
Remove a user.
name
Name of the user to remove
CLI Example:
.. code-block:: bash
salt '*' influxdb.remove_user <name>
'''
if not user_exists(name, **client_args):
log.info('User \'%s\' does not exist', name)
return... | [
"Remove",
"a",
"user",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L311-L331 | [
"def",
"remove_user",
"(",
"name",
",",
"*",
"*",
"client_args",
")",
":",
"if",
"not",
"user_exists",
"(",
"name",
",",
"*",
"*",
"client_args",
")",
":",
"log",
".",
"info",
"(",
"'User \\'%s\\' does not exist'",
",",
"name",
")",
"return",
"False",
"c... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_retention_policy | Get an existing retention policy.
database
Name of the database for which the retention policy was
defined.
name
Name of the retention policy.
CLI Example:
.. code-block:: bash
salt '*' influxdb.get_retention_policy metrics default | salt/modules/influxdbmod.py | def get_retention_policy(database, name, **client_args):
'''
Get an existing retention policy.
database
Name of the database for which the retention policy was
defined.
name
Name of the retention policy.
CLI Example:
.. code-block:: bash
salt '*' influxdb.get... | def get_retention_policy(database, name, **client_args):
'''
Get an existing retention policy.
database
Name of the database for which the retention policy was
defined.
name
Name of the retention policy.
CLI Example:
.. code-block:: bash
salt '*' influxdb.get... | [
"Get",
"an",
"existing",
"retention",
"policy",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L334-L357 | [
"def",
"get_retention_policy",
"(",
"database",
",",
"name",
",",
"*",
"*",
"client_args",
")",
":",
"client",
"=",
"_client",
"(",
"*",
"*",
"client_args",
")",
"try",
":",
"return",
"next",
"(",
"(",
"p",
"for",
"p",
"in",
"client",
".",
"get_list_re... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | retention_policy_exists | Check if retention policy with given name exists.
database
Name of the database for which the retention policy was
defined.
name
Name of the retention policy to check.
CLI Example:
.. code-block:: bash
salt '*' influxdb.retention_policy_exists metrics default | salt/modules/influxdbmod.py | def retention_policy_exists(database, name, **client_args):
'''
Check if retention policy with given name exists.
database
Name of the database for which the retention policy was
defined.
name
Name of the retention policy to check.
CLI Example:
.. code-block:: bash
... | def retention_policy_exists(database, name, **client_args):
'''
Check if retention policy with given name exists.
database
Name of the database for which the retention policy was
defined.
name
Name of the retention policy to check.
CLI Example:
.. code-block:: bash
... | [
"Check",
"if",
"retention",
"policy",
"with",
"given",
"name",
"exists",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L360-L380 | [
"def",
"retention_policy_exists",
"(",
"database",
",",
"name",
",",
"*",
"*",
"client_args",
")",
":",
"if",
"get_retention_policy",
"(",
"database",
",",
"name",
",",
"*",
"*",
"client_args",
")",
":",
"return",
"True",
"return",
"False"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | drop_retention_policy | Drop a retention policy.
database
Name of the database for which the retention policy will be dropped.
name
Name of the retention policy to drop.
CLI Example:
.. code-block:: bash
salt '*' influxdb.drop_retention_policy mydb mypr | salt/modules/influxdbmod.py | def drop_retention_policy(database, name, **client_args):
'''
Drop a retention policy.
database
Name of the database for which the retention policy will be dropped.
name
Name of the retention policy to drop.
CLI Example:
.. code-block:: bash
salt '*' influxdb.drop_re... | def drop_retention_policy(database, name, **client_args):
'''
Drop a retention policy.
database
Name of the database for which the retention policy will be dropped.
name
Name of the retention policy to drop.
CLI Example:
.. code-block:: bash
salt '*' influxdb.drop_re... | [
"Drop",
"a",
"retention",
"policy",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L383-L402 | [
"def",
"drop_retention_policy",
"(",
"database",
",",
"name",
",",
"*",
"*",
"client_args",
")",
":",
"client",
"=",
"_client",
"(",
"*",
"*",
"client_args",
")",
"client",
".",
"drop_retention_policy",
"(",
"name",
",",
"database",
")",
"return",
"True"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_retention_policy | Create a retention policy.
database
Name of the database for which the retention policy will be created.
name
Name of the new retention policy.
duration
Duration of the new retention policy.
Durations such as 1h, 90m, 12h, 7d, and 4w, are all supported and mean
1 ... | salt/modules/influxdbmod.py | def create_retention_policy(database,
name,
duration,
replication,
default=False,
**client_args):
'''
Create a retention policy.
database
Name of the database ... | def create_retention_policy(database,
name,
duration,
replication,
default=False,
**client_args):
'''
Create a retention policy.
database
Name of the database ... | [
"Create",
"a",
"retention",
"policy",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L405-L447 | [
"def",
"create_retention_policy",
"(",
"database",
",",
"name",
",",
"duration",
",",
"replication",
",",
"default",
"=",
"False",
",",
"*",
"*",
"client_args",
")",
":",
"client",
"=",
"_client",
"(",
"*",
"*",
"client_args",
")",
"client",
".",
"create_r... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_privileges | List privileges from a user.
name
Name of the user from whom privileges will be listed.
CLI Example:
.. code-block:: bash
salt '*' influxdb.list_privileges <name> | salt/modules/influxdbmod.py | def list_privileges(name, **client_args):
'''
List privileges from a user.
name
Name of the user from whom privileges will be listed.
CLI Example:
.. code-block:: bash
salt '*' influxdb.list_privileges <name>
'''
client = _client(**client_args)
res = {}
for item ... | def list_privileges(name, **client_args):
'''
List privileges from a user.
name
Name of the user from whom privileges will be listed.
CLI Example:
.. code-block:: bash
salt '*' influxdb.list_privileges <name>
'''
client = _client(**client_args)
res = {}
for item ... | [
"List",
"privileges",
"from",
"a",
"user",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L495-L513 | [
"def",
"list_privileges",
"(",
"name",
",",
"*",
"*",
"client_args",
")",
":",
"client",
"=",
"_client",
"(",
"*",
"*",
"client_args",
")",
"res",
"=",
"{",
"}",
"for",
"item",
"in",
"client",
".",
"get_list_privileges",
"(",
"name",
")",
":",
"res",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | grant_privilege | Grant a privilege on a database to a user.
database
Name of the database to grant the privilege on.
privilege
Privilege to grant. Can be one of 'read', 'write' or 'all'.
username
Name of the user to grant the privilege to. | salt/modules/influxdbmod.py | def grant_privilege(database, privilege, username, **client_args):
'''
Grant a privilege on a database to a user.
database
Name of the database to grant the privilege on.
privilege
Privilege to grant. Can be one of 'read', 'write' or 'all'.
username
Name of the user to gra... | def grant_privilege(database, privilege, username, **client_args):
'''
Grant a privilege on a database to a user.
database
Name of the database to grant the privilege on.
privilege
Privilege to grant. Can be one of 'read', 'write' or 'all'.
username
Name of the user to gra... | [
"Grant",
"a",
"privilege",
"on",
"a",
"database",
"to",
"a",
"user",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L516-L532 | [
"def",
"grant_privilege",
"(",
"database",
",",
"privilege",
",",
"username",
",",
"*",
"*",
"client_args",
")",
":",
"client",
"=",
"_client",
"(",
"*",
"*",
"client_args",
")",
"client",
".",
"grant_privilege",
"(",
"privilege",
",",
"database",
",",
"us... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | revoke_privilege | Revoke a privilege on a database from a user.
database
Name of the database to grant the privilege on.
privilege
Privilege to grant. Can be one of 'read', 'write' or 'all'.
username
Name of the user to grant the privilege to. | salt/modules/influxdbmod.py | def revoke_privilege(database, privilege, username, **client_args):
'''
Revoke a privilege on a database from a user.
database
Name of the database to grant the privilege on.
privilege
Privilege to grant. Can be one of 'read', 'write' or 'all'.
username
Name of the user to... | def revoke_privilege(database, privilege, username, **client_args):
'''
Revoke a privilege on a database from a user.
database
Name of the database to grant the privilege on.
privilege
Privilege to grant. Can be one of 'read', 'write' or 'all'.
username
Name of the user to... | [
"Revoke",
"a",
"privilege",
"on",
"a",
"database",
"from",
"a",
"user",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L535-L551 | [
"def",
"revoke_privilege",
"(",
"database",
",",
"privilege",
",",
"username",
",",
"*",
"*",
"client_args",
")",
":",
"client",
"=",
"_client",
"(",
"*",
"*",
"client_args",
")",
"client",
".",
"revoke_privilege",
"(",
"privilege",
",",
"database",
",",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | continuous_query_exists | Check if continuous query with given name exists on the database.
database
Name of the database for which the continuous query was
defined.
name
Name of the continuous query to check.
CLI Example:
.. code-block:: bash
salt '*' influxdb.continuous_query_exists metrics... | salt/modules/influxdbmod.py | def continuous_query_exists(database, name, **client_args):
'''
Check if continuous query with given name exists on the database.
database
Name of the database for which the continuous query was
defined.
name
Name of the continuous query to check.
CLI Example:
.. code... | def continuous_query_exists(database, name, **client_args):
'''
Check if continuous query with given name exists on the database.
database
Name of the database for which the continuous query was
defined.
name
Name of the continuous query to check.
CLI Example:
.. code... | [
"Check",
"if",
"continuous",
"query",
"with",
"given",
"name",
"exists",
"on",
"the",
"database",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L554-L574 | [
"def",
"continuous_query_exists",
"(",
"database",
",",
"name",
",",
"*",
"*",
"client_args",
")",
":",
"if",
"get_continuous_query",
"(",
"database",
",",
"name",
",",
"*",
"*",
"client_args",
")",
":",
"return",
"True",
"return",
"False"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_continuous_query | Get an existing continuous query.
database
Name of the database for which the continuous query was
defined.
name
Name of the continuous query to get.
CLI Example:
.. code-block:: bash
salt '*' influxdb.get_continuous_query mydb cq_month | salt/modules/influxdbmod.py | def get_continuous_query(database, name, **client_args):
'''
Get an existing continuous query.
database
Name of the database for which the continuous query was
defined.
name
Name of the continuous query to get.
CLI Example:
.. code-block:: bash
salt '*' influ... | def get_continuous_query(database, name, **client_args):
'''
Get an existing continuous query.
database
Name of the database for which the continuous query was
defined.
name
Name of the continuous query to get.
CLI Example:
.. code-block:: bash
salt '*' influ... | [
"Get",
"an",
"existing",
"continuous",
"query",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L577-L602 | [
"def",
"get_continuous_query",
"(",
"database",
",",
"name",
",",
"*",
"*",
"client_args",
")",
":",
"client",
"=",
"_client",
"(",
"*",
"*",
"client_args",
")",
"try",
":",
"for",
"db",
",",
"cqs",
"in",
"client",
".",
"query",
"(",
"'SHOW CONTINUOUS QU... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_continuous_query | Create a continuous query.
database
Name of the database for which the continuous query will be
created on.
name
Name of the continuous query to create.
query
The continuous query string.
resample_time : None
Duration between continuous query resampling.
... | salt/modules/influxdbmod.py | def create_continuous_query(database, name, query, resample_time=None, coverage_period=None, **client_args):
'''
Create a continuous query.
database
Name of the database for which the continuous query will be
created on.
name
Name of the continuous query to create.
query
... | def create_continuous_query(database, name, query, resample_time=None, coverage_period=None, **client_args):
'''
Create a continuous query.
database
Name of the database for which the continuous query will be
created on.
name
Name of the continuous query to create.
query
... | [
"Create",
"a",
"continuous",
"query",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L605-L645 | [
"def",
"create_continuous_query",
"(",
"database",
",",
"name",
",",
"query",
",",
"resample_time",
"=",
"None",
",",
"coverage_period",
"=",
"None",
",",
"*",
"*",
"client_args",
")",
":",
"client",
"=",
"_client",
"(",
"*",
"*",
"client_args",
")",
"full... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | drop_continuous_query | Drop a continuous query.
database
Name of the database for which the continuous query will
be drop from.
name
Name of the continuous query to drop.
CLI Example:
.. code-block:: bash
salt '*' influxdb.drop_continuous_query mydb my_cq | salt/modules/influxdbmod.py | def drop_continuous_query(database, name, **client_args):
'''
Drop a continuous query.
database
Name of the database for which the continuous query will
be drop from.
name
Name of the continuous query to drop.
CLI Example:
.. code-block:: bash
salt '*' influx... | def drop_continuous_query(database, name, **client_args):
'''
Drop a continuous query.
database
Name of the database for which the continuous query will
be drop from.
name
Name of the continuous query to drop.
CLI Example:
.. code-block:: bash
salt '*' influx... | [
"Drop",
"a",
"continuous",
"query",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L648-L669 | [
"def",
"drop_continuous_query",
"(",
"database",
",",
"name",
",",
"*",
"*",
"client_args",
")",
":",
"client",
"=",
"_client",
"(",
"*",
"*",
"client_args",
")",
"query",
"=",
"'DROP CONTINUOUS QUERY {0} ON {1}'",
".",
"format",
"(",
"name",
",",
"database",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _pull_query_results | Parses a ResultSet returned from InfluxDB into a dictionary of results,
grouped by series names and optional JSON-encoded grouping tags. | salt/modules/influxdbmod.py | def _pull_query_results(resultset):
'''
Parses a ResultSet returned from InfluxDB into a dictionary of results,
grouped by series names and optional JSON-encoded grouping tags.
'''
_results = collections.defaultdict(lambda: {})
for _header, _values in resultset.items():
_header, _group_t... | def _pull_query_results(resultset):
'''
Parses a ResultSet returned from InfluxDB into a dictionary of results,
grouped by series names and optional JSON-encoded grouping tags.
'''
_results = collections.defaultdict(lambda: {})
for _header, _values in resultset.items():
_header, _group_t... | [
"Parses",
"a",
"ResultSet",
"returned",
"from",
"InfluxDB",
"into",
"a",
"dictionary",
"of",
"results",
"grouped",
"by",
"series",
"names",
"and",
"optional",
"JSON",
"-",
"encoded",
"grouping",
"tags",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L672-L684 | [
"def",
"_pull_query_results",
"(",
"resultset",
")",
":",
"_results",
"=",
"collections",
".",
"defaultdict",
"(",
"lambda",
":",
"{",
"}",
")",
"for",
"_header",
",",
"_values",
"in",
"resultset",
".",
"items",
"(",
")",
":",
"_header",
",",
"_group_tags"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | query | Execute a query.
database
Name of the database to query on.
query
InfluxQL query string. | salt/modules/influxdbmod.py | def query(database, query, **client_args):
'''
Execute a query.
database
Name of the database to query on.
query
InfluxQL query string.
'''
client = _client(**client_args)
_result = client.query(query, database=database)
if isinstance(_result, collections.Sequence):
... | def query(database, query, **client_args):
'''
Execute a query.
database
Name of the database to query on.
query
InfluxQL query string.
'''
client = _client(**client_args)
_result = client.query(query, database=database)
if isinstance(_result, collections.Sequence):
... | [
"Execute",
"a",
"query",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L687-L702 | [
"def",
"query",
"(",
"database",
",",
"query",
",",
"*",
"*",
"client_args",
")",
":",
"client",
"=",
"_client",
"(",
"*",
"*",
"client_args",
")",
"_result",
"=",
"client",
".",
"query",
"(",
"query",
",",
"database",
"=",
"database",
")",
"if",
"is... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ListDictDiffer._get_recursive_difference | Returns the recursive diff between dict values | salt/utils/listdiffer.py | def _get_recursive_difference(self, type):
'''Returns the recursive diff between dict values'''
if type == 'intersect':
return [recursive_diff(item['old'], item['new']) for item in self._intersect]
elif type == 'added':
return [recursive_diff({}, item) for item in self._a... | def _get_recursive_difference(self, type):
'''Returns the recursive diff between dict values'''
if type == 'intersect':
return [recursive_diff(item['old'], item['new']) for item in self._intersect]
elif type == 'added':
return [recursive_diff({}, item) for item in self._a... | [
"Returns",
"the",
"recursive",
"diff",
"between",
"dict",
"values"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/listdiffer.py#L69-L88 | [
"def",
"_get_recursive_difference",
"(",
"self",
",",
"type",
")",
":",
"if",
"type",
"==",
"'intersect'",
":",
"return",
"[",
"recursive_diff",
"(",
"item",
"[",
"'old'",
"]",
",",
"item",
"[",
"'new'",
"]",
")",
"for",
"item",
"in",
"self",
".",
"_in... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ListDictDiffer.remove_diff | Deletes an attribute from all of the intersect objects | salt/utils/listdiffer.py | def remove_diff(self, diff_key=None, diff_list='intersect'):
'''Deletes an attribute from all of the intersect objects'''
if diff_list == 'intersect':
for item in self._intersect:
item['old'].pop(diff_key, None)
item['new'].pop(diff_key, None)
if diff_... | def remove_diff(self, diff_key=None, diff_list='intersect'):
'''Deletes an attribute from all of the intersect objects'''
if diff_list == 'intersect':
for item in self._intersect:
item['old'].pop(diff_key, None)
item['new'].pop(diff_key, None)
if diff_... | [
"Deletes",
"an",
"attribute",
"from",
"all",
"of",
"the",
"intersect",
"objects"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/listdiffer.py#L105-L113 | [
"def",
"remove_diff",
"(",
"self",
",",
"diff_key",
"=",
"None",
",",
"diff_list",
"=",
"'intersect'",
")",
":",
"if",
"diff_list",
"==",
"'intersect'",
":",
"for",
"item",
"in",
"self",
".",
"_intersect",
":",
"item",
"[",
"'old'",
"]",
".",
"pop",
"(... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ListDictDiffer.diffs | Returns a list of dictionaries with key value pairs.
The values are the differences between the items identified by the key. | salt/utils/listdiffer.py | def diffs(self):
'''
Returns a list of dictionaries with key value pairs.
The values are the differences between the items identified by the key.
'''
differences = []
for item in self._get_recursive_difference(type='all'):
if item.diffs:
if ite... | def diffs(self):
'''
Returns a list of dictionaries with key value pairs.
The values are the differences between the items identified by the key.
'''
differences = []
for item in self._get_recursive_difference(type='all'):
if item.diffs:
if ite... | [
"Returns",
"a",
"list",
"of",
"dictionaries",
"with",
"key",
"value",
"pairs",
".",
"The",
"values",
"are",
"the",
"differences",
"between",
"the",
"items",
"identified",
"by",
"the",
"key",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/listdiffer.py#L116-L128 | [
"def",
"diffs",
"(",
"self",
")",
":",
"differences",
"=",
"[",
"]",
"for",
"item",
"in",
"self",
".",
"_get_recursive_difference",
"(",
"type",
"=",
"'all'",
")",
":",
"if",
"item",
".",
"diffs",
":",
"if",
"item",
".",
"past_dict",
":",
"differences"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ListDictDiffer.changes_str | Returns a string describing the changes | salt/utils/listdiffer.py | def changes_str(self):
'''Returns a string describing the changes'''
changes = ''
for item in self._get_recursive_difference(type='intersect'):
if item.diffs:
changes = ''.join([changes,
# Tabulate comment deeper, show the key attrib... | def changes_str(self):
'''Returns a string describing the changes'''
changes = ''
for item in self._get_recursive_difference(type='intersect'):
if item.diffs:
changes = ''.join([changes,
# Tabulate comment deeper, show the key attrib... | [
"Returns",
"a",
"string",
"describing",
"the",
"changes"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/listdiffer.py#L131-L158 | [
"def",
"changes_str",
"(",
"self",
")",
":",
"changes",
"=",
"''",
"for",
"item",
"in",
"self",
".",
"_get_recursive_difference",
"(",
"type",
"=",
"'intersect'",
")",
":",
"if",
"item",
".",
"diffs",
":",
"changes",
"=",
"''",
".",
"join",
"(",
"[",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ListDictDiffer.changes_str2 | Returns a string in a more compact format describing the changes.
The output better alligns with the one in recursive_diff. | salt/utils/listdiffer.py | def changes_str2(self, tab_string=' '):
'''
Returns a string in a more compact format describing the changes.
The output better alligns with the one in recursive_diff.
'''
changes = []
for item in self._get_recursive_difference(type='intersect'):
if item.dif... | def changes_str2(self, tab_string=' '):
'''
Returns a string in a more compact format describing the changes.
The output better alligns with the one in recursive_diff.
'''
changes = []
for item in self._get_recursive_difference(type='intersect'):
if item.dif... | [
"Returns",
"a",
"string",
"in",
"a",
"more",
"compact",
"format",
"describing",
"the",
"changes",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/listdiffer.py#L161-L185 | [
"def",
"changes_str2",
"(",
"self",
",",
"tab_string",
"=",
"' '",
")",
":",
"changes",
"=",
"[",
"]",
"for",
"item",
"in",
"self",
".",
"_get_recursive_difference",
"(",
"type",
"=",
"'intersect'",
")",
":",
"if",
"item",
".",
"diffs",
":",
"changes",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ListDictDiffer.new_values | Returns the new values from the diff | salt/utils/listdiffer.py | def new_values(self):
'''Returns the new values from the diff'''
def get_new_values_and_key(item):
values = item.new_values
if item.past_dict:
values.update({self._key: item.past_dict[self._key]})
else:
# This is a new item as it has no... | def new_values(self):
'''Returns the new values from the diff'''
def get_new_values_and_key(item):
values = item.new_values
if item.past_dict:
values.update({self._key: item.past_dict[self._key]})
else:
# This is a new item as it has no... | [
"Returns",
"the",
"new",
"values",
"from",
"the",
"diff"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/listdiffer.py#L188-L201 | [
"def",
"new_values",
"(",
"self",
")",
":",
"def",
"get_new_values_and_key",
"(",
"item",
")",
":",
"values",
"=",
"item",
".",
"new_values",
"if",
"item",
".",
"past_dict",
":",
"values",
".",
"update",
"(",
"{",
"self",
".",
"_key",
":",
"item",
".",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ListDictDiffer.old_values | Returns the old values from the diff | salt/utils/listdiffer.py | def old_values(self):
'''Returns the old values from the diff'''
def get_old_values_and_key(item):
values = item.old_values
values.update({self._key: item.past_dict[self._key]})
return values
return [get_old_values_and_key(el)
for el in self._... | def old_values(self):
'''Returns the old values from the diff'''
def get_old_values_and_key(item):
values = item.old_values
values.update({self._key: item.past_dict[self._key]})
return values
return [get_old_values_and_key(el)
for el in self._... | [
"Returns",
"the",
"old",
"values",
"from",
"the",
"diff"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/listdiffer.py#L204-L213 | [
"def",
"old_values",
"(",
"self",
")",
":",
"def",
"get_old_values_and_key",
"(",
"item",
")",
":",
"values",
"=",
"item",
".",
"old_values",
"values",
".",
"update",
"(",
"{",
"self",
".",
"_key",
":",
"item",
".",
"past_dict",
"[",
"self",
".",
"_key... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ListDictDiffer.changed | Returns the list of changed values.
The key is added to each item.
selection
Specifies the desired changes.
Supported values are
``all`` - all changed items are included in the output
``intersect`` - changed items present in both lists are include... | salt/utils/listdiffer.py | def changed(self, selection='all'):
'''
Returns the list of changed values.
The key is added to each item.
selection
Specifies the desired changes.
Supported values are
``all`` - all changed items are included in the output
``inter... | def changed(self, selection='all'):
'''
Returns the list of changed values.
The key is added to each item.
selection
Specifies the desired changes.
Supported values are
``all`` - all changed items are included in the output
``inter... | [
"Returns",
"the",
"list",
"of",
"changed",
"values",
".",
"The",
"key",
"is",
"added",
"to",
"each",
"item",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/listdiffer.py#L215-L250 | [
"def",
"changed",
"(",
"self",
",",
"selection",
"=",
"'all'",
")",
":",
"changed",
"=",
"[",
"]",
"if",
"selection",
"==",
"'all'",
":",
"for",
"recursive_item",
"in",
"self",
".",
"_get_recursive_difference",
"(",
"type",
"=",
"'all'",
")",
":",
"# We ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | cmd | .. versionchanged:: 2018.3.0
Added ``with_pillar`` argument
Execute ``fun`` with the given ``args`` and ``kwargs``. Parameter ``fun``
should be the string :ref:`name <all-salt.modules>` of the execution module
to call.
.. note::
Execution modules will be loaded *every time* this funct... | salt/runners/salt.py | def cmd(fun, *args, **kwargs):
'''
.. versionchanged:: 2018.3.0
Added ``with_pillar`` argument
Execute ``fun`` with the given ``args`` and ``kwargs``. Parameter ``fun``
should be the string :ref:`name <all-salt.modules>` of the execution module
to call.
.. note::
Execution mod... | def cmd(fun, *args, **kwargs):
'''
.. versionchanged:: 2018.3.0
Added ``with_pillar`` argument
Execute ``fun`` with the given ``args`` and ``kwargs``. Parameter ``fun``
should be the string :ref:`name <all-salt.modules>` of the execution module
to call.
.. note::
Execution mod... | [
"..",
"versionchanged",
"::",
"2018",
".",
"3",
".",
"0",
"Added",
"with_pillar",
"argument"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/salt.py#L48-L114 | [
"def",
"cmd",
"(",
"fun",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"log",
".",
"debug",
"(",
"'Called salt.cmd runner with minion function %s'",
",",
"fun",
")",
"kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | execute | .. versionadded:: 2017.7.0
Execute ``fun`` on all minions matched by ``tgt`` and ``tgt_type``.
Parameter ``fun`` is the name of execution module function to call.
This function should mainly be used as a helper for runner modules,
in order to avoid redundant code.
For example, when inside a runner... | salt/runners/salt.py | def execute(tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
jid='',
kwarg=None,
**kwargs):
'''
.. versionadded:: 2017.7.0
Execute ``fun`` on all minions matched by ``tgt`` and ``tgt_type``.
Paramete... | def execute(tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
jid='',
kwarg=None,
**kwargs):
'''
.. versionadded:: 2017.7.0
Execute ``fun`` on all minions matched by ``tgt`` and ``tgt_type``.
Paramete... | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/salt.py#L117-L172 | [
"def",
"execute",
"(",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"timeout",
"=",
"None",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"jid",
"=",
"''",
",",
"kwarg",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cli... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _resolve_symlink | Resolves the given symlink path to its real path, up to a maximum of the
`max_depth` parameter which defaults to 64.
If the path is not a symlink path, it is simply returned. | salt/modules/win_file.py | def _resolve_symlink(path, max_depth=64):
'''
Resolves the given symlink path to its real path, up to a maximum of the
`max_depth` parameter which defaults to 64.
If the path is not a symlink path, it is simply returned.
'''
if sys.getwindowsversion().major < 6:
raise SaltInvocationErro... | def _resolve_symlink(path, max_depth=64):
'''
Resolves the given symlink path to its real path, up to a maximum of the
`max_depth` parameter which defaults to 64.
If the path is not a symlink path, it is simply returned.
'''
if sys.getwindowsversion().major < 6:
raise SaltInvocationErro... | [
"Resolves",
"the",
"given",
"symlink",
"path",
"to",
"its",
"real",
"path",
"up",
"to",
"a",
"maximum",
"of",
"the",
"max_depth",
"parameter",
"which",
"defaults",
"to",
"64",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L214-L236 | [
"def",
"_resolve_symlink",
"(",
"path",
",",
"max_depth",
"=",
"64",
")",
":",
"if",
"sys",
".",
"getwindowsversion",
"(",
")",
".",
"major",
"<",
"6",
":",
"raise",
"SaltInvocationError",
"(",
"'Symlinks are only supported on Windows Vista or later.'",
")",
"# ma... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | gid_to_group | Convert the group id to the group name on this system
Under Windows, because groups are just another ACL entity, this function
behaves the same as uid_to_user.
For maintaining Windows systems, this function is superfluous and only
exists for API compatibility with Unix. Use the uid_to_user function
... | salt/modules/win_file.py | def gid_to_group(gid):
'''
Convert the group id to the group name on this system
Under Windows, because groups are just another ACL entity, this function
behaves the same as uid_to_user.
For maintaining Windows systems, this function is superfluous and only
exists for API compatibility with Un... | def gid_to_group(gid):
'''
Convert the group id to the group name on this system
Under Windows, because groups are just another ACL entity, this function
behaves the same as uid_to_user.
For maintaining Windows systems, this function is superfluous and only
exists for API compatibility with Un... | [
"Convert",
"the",
"group",
"id",
"to",
"the",
"group",
"name",
"on",
"this",
"system"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L239-L268 | [
"def",
"gid_to_group",
"(",
"gid",
")",
":",
"func_name",
"=",
"'{0}.gid_to_group'",
".",
"format",
"(",
"__virtualname__",
")",
"if",
"__opts__",
".",
"get",
"(",
"'fun'",
",",
"''",
")",
"==",
"func_name",
":",
"log",
".",
"info",
"(",
"'The function %s ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | group_to_gid | Convert the group to the gid on this system
Under Windows, because groups are just another ACL entity, this function
behaves the same as user_to_uid, except if None is given, '' is returned.
For maintaining Windows systems, this function is superfluous and only
exists for API compatibility with Unix. ... | salt/modules/win_file.py | def group_to_gid(group):
'''
Convert the group to the gid on this system
Under Windows, because groups are just another ACL entity, this function
behaves the same as user_to_uid, except if None is given, '' is returned.
For maintaining Windows systems, this function is superfluous and only
exi... | def group_to_gid(group):
'''
Convert the group to the gid on this system
Under Windows, because groups are just another ACL entity, this function
behaves the same as user_to_uid, except if None is given, '' is returned.
For maintaining Windows systems, this function is superfluous and only
exi... | [
"Convert",
"the",
"group",
"to",
"the",
"gid",
"on",
"this",
"system"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L271-L303 | [
"def",
"group_to_gid",
"(",
"group",
")",
":",
"func_name",
"=",
"'{0}.group_to_gid'",
".",
"format",
"(",
"__virtualname__",
")",
"if",
"__opts__",
".",
"get",
"(",
"'fun'",
",",
"''",
")",
"==",
"func_name",
":",
"log",
".",
"info",
"(",
"'The function %... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_pgid | Return the id of the primary group that owns a given file (Windows only)
This function will return the rarely used primary group of a file. This
generally has no bearing on permissions unless intentionally configured
and is most commonly used to provide Unix compatibility (e.g. Services
For Unix, NFS s... | salt/modules/win_file.py | def get_pgid(path, follow_symlinks=True):
'''
Return the id of the primary group that owns a given file (Windows only)
This function will return the rarely used primary group of a file. This
generally has no bearing on permissions unless intentionally configured
and is most commonly used to provide... | def get_pgid(path, follow_symlinks=True):
'''
Return the id of the primary group that owns a given file (Windows only)
This function will return the rarely used primary group of a file. This
generally has no bearing on permissions unless intentionally configured
and is most commonly used to provide... | [
"Return",
"the",
"id",
"of",
"the",
"primary",
"group",
"that",
"owns",
"a",
"given",
"file",
"(",
"Windows",
"only",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L306-L345 | [
"def",
"get_pgid",
"(",
"path",
",",
"follow_symlinks",
"=",
"True",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'Path not found: {0}'",
".",
"format",
"(",
"path",
")",
")",
"# ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_gid | Return the id of the group that owns a given file
Under Windows, this will return the uid of the file.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on permissions unless intentionally
configured and is only used to support Unix compatibility ... | salt/modules/win_file.py | def get_gid(path, follow_symlinks=True):
'''
Return the id of the group that owns a given file
Under Windows, this will return the uid of the file.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on permissions unless intentionally
confi... | def get_gid(path, follow_symlinks=True):
'''
Return the id of the group that owns a given file
Under Windows, this will return the uid of the file.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on permissions unless intentionally
confi... | [
"Return",
"the",
"id",
"of",
"the",
"group",
"that",
"owns",
"a",
"given",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L383-L424 | [
"def",
"get_gid",
"(",
"path",
",",
"follow_symlinks",
"=",
"True",
")",
":",
"func_name",
"=",
"'{0}.get_gid'",
".",
"format",
"(",
"__virtualname__",
")",
"if",
"__opts__",
".",
"get",
"(",
"'fun'",
",",
"''",
")",
"==",
"func_name",
":",
"log",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_group | Return the group that owns a given file
Under Windows, this will return the user (owner) of the file.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on permissions unless intentionally
configured and is only used to support Unix compatibility f... | salt/modules/win_file.py | def get_group(path, follow_symlinks=True):
'''
Return the group that owns a given file
Under Windows, this will return the user (owner) of the file.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on permissions unless intentionally
conf... | def get_group(path, follow_symlinks=True):
'''
Return the group that owns a given file
Under Windows, this will return the user (owner) of the file.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on permissions unless intentionally
conf... | [
"Return",
"the",
"group",
"that",
"owns",
"a",
"given",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L427-L468 | [
"def",
"get_group",
"(",
"path",
",",
"follow_symlinks",
"=",
"True",
")",
":",
"func_name",
"=",
"'{0}.get_group'",
".",
"format",
"(",
"__virtualname__",
")",
"if",
"__opts__",
".",
"get",
"(",
"'fun'",
",",
"''",
")",
"==",
"func_name",
":",
"log",
".... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | user_to_uid | Convert user name to a uid
Args:
user (str): The user to lookup
Returns:
str: The user id of the user
CLI Example:
.. code-block:: bash
salt '*' file.user_to_uid myusername | salt/modules/win_file.py | def user_to_uid(user):
'''
Convert user name to a uid
Args:
user (str): The user to lookup
Returns:
str: The user id of the user
CLI Example:
.. code-block:: bash
salt '*' file.user_to_uid myusername
'''
if user is None:
user = salt.utils.user.get_use... | def user_to_uid(user):
'''
Convert user name to a uid
Args:
user (str): The user to lookup
Returns:
str: The user id of the user
CLI Example:
.. code-block:: bash
salt '*' file.user_to_uid myusername
'''
if user is None:
user = salt.utils.user.get_use... | [
"Convert",
"user",
"name",
"to",
"a",
"uid"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L493-L512 | [
"def",
"user_to_uid",
"(",
"user",
")",
":",
"if",
"user",
"is",
"None",
":",
"user",
"=",
"salt",
".",
"utils",
".",
"user",
".",
"get_user",
"(",
")",
"return",
"salt",
".",
"utils",
".",
"win_dacl",
".",
"get_sid_string",
"(",
"user",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_uid | Return the id of the user that owns a given file
Symlinks are followed by default to mimic Unix behavior. Specify
`follow_symlinks=False` to turn off this behavior.
Args:
path (str): The path to the file or directory
follow_symlinks (bool):
If the object specified by ``path`` ... | salt/modules/win_file.py | def get_uid(path, follow_symlinks=True):
'''
Return the id of the user that owns a given file
Symlinks are followed by default to mimic Unix behavior. Specify
`follow_symlinks=False` to turn off this behavior.
Args:
path (str): The path to the file or directory
follow_symlinks (bo... | def get_uid(path, follow_symlinks=True):
'''
Return the id of the user that owns a given file
Symlinks are followed by default to mimic Unix behavior. Specify
`follow_symlinks=False` to turn off this behavior.
Args:
path (str): The path to the file or directory
follow_symlinks (bo... | [
"Return",
"the",
"id",
"of",
"the",
"user",
"that",
"owns",
"a",
"given",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L515-L552 | [
"def",
"get_uid",
"(",
"path",
",",
"follow_symlinks",
"=",
"True",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'Path not found: {0}'",
".",
"format",
"(",
"path",
")",
")",
"# U... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_user | Return the user that owns a given file
Symlinks are followed by default to mimic Unix behavior. Specify
`follow_symlinks=False` to turn off this behavior.
Args:
path (str): The path to the file or directory
follow_symlinks (bool):
If the object specified by ``path`` is a symli... | salt/modules/win_file.py | def get_user(path, follow_symlinks=True):
'''
Return the user that owns a given file
Symlinks are followed by default to mimic Unix behavior. Specify
`follow_symlinks=False` to turn off this behavior.
Args:
path (str): The path to the file or directory
follow_symlinks (bool):
... | def get_user(path, follow_symlinks=True):
'''
Return the user that owns a given file
Symlinks are followed by default to mimic Unix behavior. Specify
`follow_symlinks=False` to turn off this behavior.
Args:
path (str): The path to the file or directory
follow_symlinks (bool):
... | [
"Return",
"the",
"user",
"that",
"owns",
"a",
"given",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L555-L591 | [
"def",
"get_user",
"(",
"path",
",",
"follow_symlinks",
"=",
"True",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'Path not found: {0}'",
".",
"format",
"(",
"path",
")",
")",
"# ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_mode | Return the mode of a file
Right now we're just returning None because Windows' doesn't have a mode
like Linux
Args:
path (str): The path to the file or directory
Returns:
None
CLI Example:
.. code-block:: bash
salt '*' file.get_mode /etc/passwd | salt/modules/win_file.py | def get_mode(path):
'''
Return the mode of a file
Right now we're just returning None because Windows' doesn't have a mode
like Linux
Args:
path (str): The path to the file or directory
Returns:
None
CLI Example:
.. code-block:: bash
salt '*' file.get_mode /... | def get_mode(path):
'''
Return the mode of a file
Right now we're just returning None because Windows' doesn't have a mode
like Linux
Args:
path (str): The path to the file or directory
Returns:
None
CLI Example:
.. code-block:: bash
salt '*' file.get_mode /... | [
"Return",
"the",
"mode",
"of",
"a",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L594-L622 | [
"def",
"get_mode",
"(",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'Path not found: {0}'",
".",
"format",
"(",
"path",
")",
")",
"func_name",
"=",
"'{0}.get_mode'",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | lchown | Chown a file, pass the file the desired user and group without following any
symlinks.
Under Windows, the group parameter will be ignored.
This is because while files in Windows do have a 'primary group'
property, this is rarely used. It generally has no bearing on
permissions unless intentionall... | salt/modules/win_file.py | def lchown(path, user, group=None, pgroup=None):
'''
Chown a file, pass the file the desired user and group without following any
symlinks.
Under Windows, the group parameter will be ignored.
This is because while files in Windows do have a 'primary group'
property, this is rarely used. It ge... | def lchown(path, user, group=None, pgroup=None):
'''
Chown a file, pass the file the desired user and group without following any
symlinks.
Under Windows, the group parameter will be ignored.
This is because while files in Windows do have a 'primary group'
property, this is rarely used. It ge... | [
"Chown",
"a",
"file",
"pass",
"the",
"file",
"the",
"desired",
"user",
"and",
"group",
"without",
"following",
"any",
"symlinks",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L625-L671 | [
"def",
"lchown",
"(",
"path",
",",
"user",
",",
"group",
"=",
"None",
",",
"pgroup",
"=",
"None",
")",
":",
"if",
"group",
":",
"func_name",
"=",
"'{0}.lchown'",
".",
"format",
"(",
"__virtualname__",
")",
"if",
"__opts__",
".",
"get",
"(",
"'fun'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | chown | Chown a file, pass the file the desired user and group
Under Windows, the group parameter will be ignored.
This is because while files in Windows do have a 'primary group'
property, this is rarely used. It generally has no bearing on
permissions unless intentionally configured and is most commonly us... | salt/modules/win_file.py | def chown(path, user, group=None, pgroup=None, follow_symlinks=True):
'''
Chown a file, pass the file the desired user and group
Under Windows, the group parameter will be ignored.
This is because while files in Windows do have a 'primary group'
property, this is rarely used. It generally has no ... | def chown(path, user, group=None, pgroup=None, follow_symlinks=True):
'''
Chown a file, pass the file the desired user and group
Under Windows, the group parameter will be ignored.
This is because while files in Windows do have a 'primary group'
property, this is rarely used. It generally has no ... | [
"Chown",
"a",
"file",
"pass",
"the",
"file",
"the",
"desired",
"user",
"and",
"group"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L674-L728 | [
"def",
"chown",
"(",
"path",
",",
"user",
",",
"group",
"=",
"None",
",",
"pgroup",
"=",
"None",
",",
"follow_symlinks",
"=",
"True",
")",
":",
"# the group parameter is not used; only provided for API compatibility",
"if",
"group",
"is",
"not",
"None",
":",
"fu... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | chgrp | Change the group of a file
Under Windows, this will do nothing.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on permissions unless intentionally
configured and is only used to support Unix compatibility features (e.g.
Services For Unix, N... | salt/modules/win_file.py | def chgrp(path, group):
'''
Change the group of a file
Under Windows, this will do nothing.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on permissions unless intentionally
configured and is only used to support Unix compatibility fea... | def chgrp(path, group):
'''
Change the group of a file
Under Windows, this will do nothing.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on permissions unless intentionally
configured and is only used to support Unix compatibility fea... | [
"Change",
"the",
"group",
"of",
"a",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L759-L799 | [
"def",
"chgrp",
"(",
"path",
",",
"group",
")",
":",
"func_name",
"=",
"'{0}.chgrp'",
".",
"format",
"(",
"__virtualname__",
")",
"if",
"__opts__",
".",
"get",
"(",
"'fun'",
",",
"''",
")",
"==",
"func_name",
":",
"log",
".",
"info",
"(",
"'The functio... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | stats | Return a dict containing the stats about a given file
Under Windows, `gid` will equal `uid` and `group` will equal `user`.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on permissions unless intentionally
configured and is only used to support... | salt/modules/win_file.py | def stats(path, hash_type='sha256', follow_symlinks=True):
'''
Return a dict containing the stats about a given file
Under Windows, `gid` will equal `uid` and `group` will equal `user`.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on perm... | def stats(path, hash_type='sha256', follow_symlinks=True):
'''
Return a dict containing the stats about a given file
Under Windows, `gid` will equal `uid` and `group` will equal `user`.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on perm... | [
"Return",
"a",
"dict",
"containing",
"the",
"stats",
"about",
"a",
"given",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L802-L876 | [
"def",
"stats",
"(",
"path",
",",
"hash_type",
"=",
"'sha256'",
",",
"follow_symlinks",
"=",
"True",
")",
":",
"# This is to mirror the behavior of file.py. `check_file_meta` expects an",
"# empty dictionary when the file does not exist",
"if",
"not",
"os",
".",
"path",
"."... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_attributes | Return a dictionary object with the Windows
file attributes for a file.
Args:
path (str): The path to the file or directory
Returns:
dict: A dictionary of file attributes
CLI Example:
.. code-block:: bash
salt '*' file.get_attributes c:\\temp\\a.txt | salt/modules/win_file.py | def get_attributes(path):
'''
Return a dictionary object with the Windows
file attributes for a file.
Args:
path (str): The path to the file or directory
Returns:
dict: A dictionary of file attributes
CLI Example:
.. code-block:: bash
salt '*' file.get_attributes... | def get_attributes(path):
'''
Return a dictionary object with the Windows
file attributes for a file.
Args:
path (str): The path to the file or directory
Returns:
dict: A dictionary of file attributes
CLI Example:
.. code-block:: bash
salt '*' file.get_attributes... | [
"Return",
"a",
"dictionary",
"object",
"with",
"the",
"Windows",
"file",
"attributes",
"for",
"a",
"file",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L879-L939 | [
"def",
"get_attributes",
"(",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'Path not found: {0}'",
".",
"format",
"(",
"path",
")",
")",
"# set up dictionary for attribute values"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_attributes | Set file attributes for a file. Note that the normal attribute
means that all others are false. So setting it will clear all others.
Args:
path (str): The path to the file or directory
archive (bool): Sets the archive attribute. Default is None
hidden (bool): Sets the hidden attribute... | salt/modules/win_file.py | def set_attributes(path, archive=None, hidden=None, normal=None,
notIndexed=None, readonly=None, system=None, temporary=None):
'''
Set file attributes for a file. Note that the normal attribute
means that all others are false. So setting it will clear all others.
Args:
path... | def set_attributes(path, archive=None, hidden=None, normal=None,
notIndexed=None, readonly=None, system=None, temporary=None):
'''
Set file attributes for a file. Note that the normal attribute
means that all others are false. So setting it will clear all others.
Args:
path... | [
"Set",
"file",
"attributes",
"for",
"a",
"file",
".",
"Note",
"that",
"the",
"normal",
"attribute",
"means",
"that",
"all",
"others",
"are",
"false",
".",
"So",
"setting",
"it",
"will",
"clear",
"all",
"others",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L942-L1016 | [
"def",
"set_attributes",
"(",
"path",
",",
"archive",
"=",
"None",
",",
"hidden",
"=",
"None",
",",
"normal",
"=",
"None",
",",
"notIndexed",
"=",
"None",
",",
"readonly",
"=",
"None",
",",
"system",
"=",
"None",
",",
"temporary",
"=",
"None",
")",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_mode | Set the mode of a file
This just calls get_mode, which returns None because we don't use mode on
Windows
Args:
path: The path to the file or directory
mode: The mode (not used)
Returns:
None
CLI Example:
.. code-block:: bash
salt '*' file.set_mode /etc/passw... | salt/modules/win_file.py | def set_mode(path, mode):
'''
Set the mode of a file
This just calls get_mode, which returns None because we don't use mode on
Windows
Args:
path: The path to the file or directory
mode: The mode (not used)
Returns:
None
CLI Example:
.. code-block:: bash
... | def set_mode(path, mode):
'''
Set the mode of a file
This just calls get_mode, which returns None because we don't use mode on
Windows
Args:
path: The path to the file or directory
mode: The mode (not used)
Returns:
None
CLI Example:
.. code-block:: bash
... | [
"Set",
"the",
"mode",
"of",
"a",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L1019-L1045 | [
"def",
"set_mode",
"(",
"path",
",",
"mode",
")",
":",
"func_name",
"=",
"'{0}.set_mode'",
".",
"format",
"(",
"__virtualname__",
")",
"if",
"__opts__",
".",
"get",
"(",
"'fun'",
",",
"''",
")",
"==",
"func_name",
":",
"log",
".",
"info",
"(",
"'The fu... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.