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 | Client._extrn_path | Return the extrn_filepath for a given url | salt/fileclient.py | def _extrn_path(self, url, saltenv, cachedir=None):
'''
Return the extrn_filepath for a given url
'''
url_data = urlparse(url)
if salt.utils.platform.is_windows():
netloc = salt.utils.path.sanitize_win_path(url_data.netloc)
else:
netloc = url_data.... | def _extrn_path(self, url, saltenv, cachedir=None):
'''
Return the extrn_filepath for a given url
'''
url_data = urlparse(url)
if salt.utils.platform.is_windows():
netloc = salt.utils.path.sanitize_win_path(url_data.netloc)
else:
netloc = url_data.... | [
"Return",
"the",
"extrn_filepath",
"for",
"a",
"given",
"url"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L794-L826 | [
"def",
"_extrn_path",
"(",
"self",
",",
"url",
",",
"saltenv",
",",
"cachedir",
"=",
"None",
")",
":",
"url_data",
"=",
"urlparse",
"(",
"url",
")",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"netloc",
"=",
"salt",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | PillarClient._find_file | Locate the file path | salt/fileclient.py | def _find_file(self, path, saltenv='base'):
'''
Locate the file path
'''
fnd = {'path': '',
'rel': ''}
if salt.utils.url.is_escaped(path):
# The path arguments are escaped
path = salt.utils.url.unescape(path)
for root in self.opts['... | def _find_file(self, path, saltenv='base'):
'''
Locate the file path
'''
fnd = {'path': '',
'rel': ''}
if salt.utils.url.is_escaped(path):
# The path arguments are escaped
path = salt.utils.url.unescape(path)
for root in self.opts['... | [
"Locate",
"the",
"file",
"path"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L833-L849 | [
"def",
"_find_file",
"(",
"self",
",",
"path",
",",
"saltenv",
"=",
"'base'",
")",
":",
"fnd",
"=",
"{",
"'path'",
":",
"''",
",",
"'rel'",
":",
"''",
"}",
"if",
"salt",
".",
"utils",
".",
"url",
".",
"is_escaped",
"(",
"path",
")",
":",
"# The p... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | PillarClient.get_file | Copies a file from the local files directory into :param:`dest`
gzip compression settings are ignored for local files | salt/fileclient.py | def get_file(self,
path,
dest='',
makedirs=False,
saltenv='base',
gzip=None,
cachedir=None):
'''
Copies a file from the local files directory into :param:`dest`
gzip compression settings are ign... | def get_file(self,
path,
dest='',
makedirs=False,
saltenv='base',
gzip=None,
cachedir=None):
'''
Copies a file from the local files directory into :param:`dest`
gzip compression settings are ign... | [
"Copies",
"a",
"file",
"from",
"the",
"local",
"files",
"directory",
"into",
":",
"param",
":",
"dest",
"gzip",
"compression",
"settings",
"are",
"ignored",
"for",
"local",
"files"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L851-L868 | [
"def",
"get_file",
"(",
"self",
",",
"path",
",",
"dest",
"=",
"''",
",",
"makedirs",
"=",
"False",
",",
"saltenv",
"=",
"'base'",
",",
"gzip",
"=",
"None",
",",
"cachedir",
"=",
"None",
")",
":",
"path",
"=",
"self",
".",
"_check_proto",
"(",
"pat... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | PillarClient.file_list | Return a list of files in the given environment
with optional relative prefix path to limit directory traversal | salt/fileclient.py | def file_list(self, saltenv='base', prefix=''):
'''
Return a list of files in the given environment
with optional relative prefix path to limit directory traversal
'''
ret = []
prefix = prefix.strip('/')
for path in self.opts['pillar_roots'].get(saltenv, []):
... | def file_list(self, saltenv='base', prefix=''):
'''
Return a list of files in the given environment
with optional relative prefix path to limit directory traversal
'''
ret = []
prefix = prefix.strip('/')
for path in self.opts['pillar_roots'].get(saltenv, []):
... | [
"Return",
"a",
"list",
"of",
"files",
"in",
"the",
"given",
"environment",
"with",
"optional",
"relative",
"prefix",
"path",
"to",
"limit",
"directory",
"traversal"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L870-L886 | [
"def",
"file_list",
"(",
"self",
",",
"saltenv",
"=",
"'base'",
",",
"prefix",
"=",
"''",
")",
":",
"ret",
"=",
"[",
"]",
"prefix",
"=",
"prefix",
".",
"strip",
"(",
"'/'",
")",
"for",
"path",
"in",
"self",
".",
"opts",
"[",
"'pillar_roots'",
"]",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | PillarClient.__get_file_path | Return either a file path or the result of a remote find_file call. | salt/fileclient.py | def __get_file_path(self, path, saltenv='base'):
'''
Return either a file path or the result of a remote find_file call.
'''
try:
path = self._check_proto(path)
except MinionError as err:
# Local file path
if not os.path.isfile(path):
... | def __get_file_path(self, path, saltenv='base'):
'''
Return either a file path or the result of a remote find_file call.
'''
try:
path = self._check_proto(path)
except MinionError as err:
# Local file path
if not os.path.isfile(path):
... | [
"Return",
"either",
"a",
"file",
"path",
"or",
"the",
"result",
"of",
"a",
"remote",
"find_file",
"call",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L919-L935 | [
"def",
"__get_file_path",
"(",
"self",
",",
"path",
",",
"saltenv",
"=",
"'base'",
")",
":",
"try",
":",
"path",
"=",
"self",
".",
"_check_proto",
"(",
"path",
")",
"except",
"MinionError",
"as",
"err",
":",
"# Local file path",
"if",
"not",
"os",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | PillarClient.hash_file | Return the hash of a file, to get the hash of a file in the pillar_roots
prepend the path with salt://<file on server> otherwise, prepend the
file with / for a local file. | salt/fileclient.py | def hash_file(self, path, saltenv='base'):
'''
Return the hash of a file, to get the hash of a file in the pillar_roots
prepend the path with salt://<file on server> otherwise, prepend the
file with / for a local file.
'''
ret = {}
fnd = self.__get_file_path(path,... | def hash_file(self, path, saltenv='base'):
'''
Return the hash of a file, to get the hash of a file in the pillar_roots
prepend the path with salt://<file on server> otherwise, prepend the
file with / for a local file.
'''
ret = {}
fnd = self.__get_file_path(path,... | [
"Return",
"the",
"hash",
"of",
"a",
"file",
"to",
"get",
"the",
"hash",
"of",
"a",
"file",
"in",
"the",
"pillar_roots",
"prepend",
"the",
"path",
"with",
"salt",
":",
"//",
"<file",
"on",
"server",
">",
"otherwise",
"prepend",
"the",
"file",
"with",
"/... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L937-L958 | [
"def",
"hash_file",
"(",
"self",
",",
"path",
",",
"saltenv",
"=",
"'base'",
")",
":",
"ret",
"=",
"{",
"}",
"fnd",
"=",
"self",
".",
"__get_file_path",
"(",
"path",
",",
"saltenv",
")",
"if",
"fnd",
"is",
"None",
":",
"return",
"ret",
"try",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | PillarClient.hash_and_stat_file | Return the hash of a file, to get the hash of a file in the pillar_roots
prepend the path with salt://<file on server> otherwise, prepend the
file with / for a local file.
Additionally, return the stat result of the file, or None if no stat
results were found. | salt/fileclient.py | def hash_and_stat_file(self, path, saltenv='base'):
'''
Return the hash of a file, to get the hash of a file in the pillar_roots
prepend the path with salt://<file on server> otherwise, prepend the
file with / for a local file.
Additionally, return the stat result of the file, o... | def hash_and_stat_file(self, path, saltenv='base'):
'''
Return the hash of a file, to get the hash of a file in the pillar_roots
prepend the path with salt://<file on server> otherwise, prepend the
file with / for a local file.
Additionally, return the stat result of the file, o... | [
"Return",
"the",
"hash",
"of",
"a",
"file",
"to",
"get",
"the",
"hash",
"of",
"a",
"file",
"in",
"the",
"pillar_roots",
"prepend",
"the",
"path",
"with",
"salt",
":",
"//",
"<file",
"on",
"server",
">",
"otherwise",
"prepend",
"the",
"file",
"with",
"/... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L960-L989 | [
"def",
"hash_and_stat_file",
"(",
"self",
",",
"path",
",",
"saltenv",
"=",
"'base'",
")",
":",
"ret",
"=",
"{",
"}",
"fnd",
"=",
"self",
".",
"__get_file_path",
"(",
"path",
",",
"saltenv",
")",
"if",
"fnd",
"is",
"None",
":",
"return",
"ret",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | PillarClient.envs | Return the available environments | salt/fileclient.py | def envs(self):
'''
Return the available environments
'''
ret = []
for saltenv in self.opts['pillar_roots']:
ret.append(saltenv)
return ret | def envs(self):
'''
Return the available environments
'''
ret = []
for saltenv in self.opts['pillar_roots']:
ret.append(saltenv)
return ret | [
"Return",
"the",
"available",
"environments"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L1003-L1010 | [
"def",
"envs",
"(",
"self",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"saltenv",
"in",
"self",
".",
"opts",
"[",
"'pillar_roots'",
"]",
":",
"ret",
".",
"append",
"(",
"saltenv",
")",
"return",
"ret"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteClient._refresh_channel | Reset the channel, in the event of an interruption | salt/fileclient.py | def _refresh_channel(self):
'''
Reset the channel, in the event of an interruption
'''
self.channel = salt.transport.client.ReqChannel.factory(self.opts)
return self.channel | def _refresh_channel(self):
'''
Reset the channel, in the event of an interruption
'''
self.channel = salt.transport.client.ReqChannel.factory(self.opts)
return self.channel | [
"Reset",
"the",
"channel",
"in",
"the",
"event",
"of",
"an",
"interruption"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L1041-L1046 | [
"def",
"_refresh_channel",
"(",
"self",
")",
":",
"self",
".",
"channel",
"=",
"salt",
".",
"transport",
".",
"client",
".",
"ReqChannel",
".",
"factory",
"(",
"self",
".",
"opts",
")",
"return",
"self",
".",
"channel"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteClient.get_file | Get a single file from the salt-master
path must be a salt server location, aka, salt://path/to/file, if
dest is omitted, then the downloaded file will be placed in the minion
cache | salt/fileclient.py | def get_file(self,
path,
dest='',
makedirs=False,
saltenv='base',
gzip=None,
cachedir=None):
'''
Get a single file from the salt-master
path must be a salt server location, aka, salt://path/to/f... | def get_file(self,
path,
dest='',
makedirs=False,
saltenv='base',
gzip=None,
cachedir=None):
'''
Get a single file from the salt-master
path must be a salt server location, aka, salt://path/to/f... | [
"Get",
"a",
"single",
"file",
"from",
"the",
"salt",
"-",
"master",
"path",
"must",
"be",
"a",
"salt",
"server",
"location",
"aka",
"salt",
":",
"//",
"path",
"/",
"to",
"/",
"file",
"if",
"dest",
"is",
"omitted",
"then",
"the",
"downloaded",
"file",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L1064-L1262 | [
"def",
"get_file",
"(",
"self",
",",
"path",
",",
"dest",
"=",
"''",
",",
"makedirs",
"=",
"False",
",",
"saltenv",
"=",
"'base'",
",",
"gzip",
"=",
"None",
",",
"cachedir",
"=",
"None",
")",
":",
"path",
",",
"senv",
"=",
"salt",
".",
"utils",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteClient.dir_list | List the dirs on the master | salt/fileclient.py | def dir_list(self, saltenv='base', prefix=''):
'''
List the dirs on the master
'''
load = {'saltenv': saltenv,
'prefix': prefix,
'cmd': '_dir_list'}
return salt.utils.data.decode(self.channel.send(load)) if six.PY2 \
else self.channel.s... | def dir_list(self, saltenv='base', prefix=''):
'''
List the dirs on the master
'''
load = {'saltenv': saltenv,
'prefix': prefix,
'cmd': '_dir_list'}
return salt.utils.data.decode(self.channel.send(load)) if six.PY2 \
else self.channel.s... | [
"List",
"the",
"dirs",
"on",
"the",
"master"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L1284-L1292 | [
"def",
"dir_list",
"(",
"self",
",",
"saltenv",
"=",
"'base'",
",",
"prefix",
"=",
"''",
")",
":",
"load",
"=",
"{",
"'saltenv'",
":",
"saltenv",
",",
"'prefix'",
":",
"prefix",
",",
"'cmd'",
":",
"'_dir_list'",
"}",
"return",
"salt",
".",
"utils",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteClient.__hash_and_stat_file | Common code for hashing and stating files | salt/fileclient.py | def __hash_and_stat_file(self, path, saltenv='base'):
'''
Common code for hashing and stating files
'''
try:
path = self._check_proto(path)
except MinionError as err:
if not os.path.isfile(path):
log.warning(
'specified ... | def __hash_and_stat_file(self, path, saltenv='base'):
'''
Common code for hashing and stating files
'''
try:
path = self._check_proto(path)
except MinionError as err:
if not os.path.isfile(path):
log.warning(
'specified ... | [
"Common",
"code",
"for",
"hashing",
"and",
"stating",
"files"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L1304-L1326 | [
"def",
"__hash_and_stat_file",
"(",
"self",
",",
"path",
",",
"saltenv",
"=",
"'base'",
")",
":",
"try",
":",
"path",
"=",
"self",
".",
"_check_proto",
"(",
"path",
")",
"except",
"MinionError",
"as",
"err",
":",
"if",
"not",
"os",
".",
"path",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteClient.hash_and_stat_file | The same as hash_file, but also return the file's mode, or None if no
mode data is present. | salt/fileclient.py | def hash_and_stat_file(self, path, saltenv='base'):
'''
The same as hash_file, but also return the file's mode, or None if no
mode data is present.
'''
hash_result = self.hash_file(path, saltenv)
try:
path = self._check_proto(path)
except MinionError a... | def hash_and_stat_file(self, path, saltenv='base'):
'''
The same as hash_file, but also return the file's mode, or None if no
mode data is present.
'''
hash_result = self.hash_file(path, saltenv)
try:
path = self._check_proto(path)
except MinionError a... | [
"The",
"same",
"as",
"hash_file",
"but",
"also",
"return",
"the",
"file",
"s",
"mode",
"or",
"None",
"if",
"no",
"mode",
"data",
"is",
"present",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L1336-L1360 | [
"def",
"hash_and_stat_file",
"(",
"self",
",",
"path",
",",
"saltenv",
"=",
"'base'",
")",
":",
"hash_result",
"=",
"self",
".",
"hash_file",
"(",
"path",
",",
"saltenv",
")",
"try",
":",
"path",
"=",
"self",
".",
"_check_proto",
"(",
"path",
")",
"exc... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteClient.list_env | Return a list of the files in the file server's specified environment | salt/fileclient.py | def list_env(self, saltenv='base'):
'''
Return a list of the files in the file server's specified environment
'''
load = {'saltenv': saltenv,
'cmd': '_file_list'}
return salt.utils.data.decode(self.channel.send(load)) if six.PY2 \
else self.channel.sen... | def list_env(self, saltenv='base'):
'''
Return a list of the files in the file server's specified environment
'''
load = {'saltenv': saltenv,
'cmd': '_file_list'}
return salt.utils.data.decode(self.channel.send(load)) if six.PY2 \
else self.channel.sen... | [
"Return",
"a",
"list",
"of",
"the",
"files",
"in",
"the",
"file",
"server",
"s",
"specified",
"environment"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L1362-L1369 | [
"def",
"list_env",
"(",
"self",
",",
"saltenv",
"=",
"'base'",
")",
":",
"load",
"=",
"{",
"'saltenv'",
":",
"saltenv",
",",
"'cmd'",
":",
"'_file_list'",
"}",
"return",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"self",
".",
"channel",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteClient.envs | Return a list of available environments | salt/fileclient.py | def envs(self):
'''
Return a list of available environments
'''
load = {'cmd': '_file_envs'}
return salt.utils.data.decode(self.channel.send(load)) if six.PY2 \
else self.channel.send(load) | def envs(self):
'''
Return a list of available environments
'''
load = {'cmd': '_file_envs'}
return salt.utils.data.decode(self.channel.send(load)) if six.PY2 \
else self.channel.send(load) | [
"Return",
"a",
"list",
"of",
"available",
"environments"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L1371-L1377 | [
"def",
"envs",
"(",
"self",
")",
":",
"load",
"=",
"{",
"'cmd'",
":",
"'_file_envs'",
"}",
"return",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"self",
".",
"channel",
".",
"send",
"(",
"load",
")",
")",
"if",
"six",
".",
"PY2",
"else... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteClient.master_tops | Return the metadata derived from the master_tops system | salt/fileclient.py | def master_tops(self):
'''
Return the metadata derived from the master_tops system
'''
log.debug(
'The _ext_nodes master function has been renamed to _master_tops. '
'To ensure compatibility when using older Salt masters we will '
'continue to invoke t... | def master_tops(self):
'''
Return the metadata derived from the master_tops system
'''
log.debug(
'The _ext_nodes master function has been renamed to _master_tops. '
'To ensure compatibility when using older Salt masters we will '
'continue to invoke t... | [
"Return",
"the",
"metadata",
"derived",
"from",
"the",
"master_tops",
"system"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L1387-L1405 | [
"def",
"master_tops",
"(",
"self",
")",
":",
"log",
".",
"debug",
"(",
"'The _ext_nodes master function has been renamed to _master_tops. '",
"'To ensure compatibility when using older Salt masters we will '",
"'continue to invoke the function as _ext_nodes until the '",
"'Magnesium releas... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltSupportState.check_destination | Check destination for the archives.
:return: | salt/states/saltsupport.py | def check_destination(self, location, group):
'''
Check destination for the archives.
:return:
'''
# Pre-create destination, since rsync will
# put one file named as group
try:
destination = os.path.join(location, group)
if os.path.exists(d... | def check_destination(self, location, group):
'''
Check destination for the archives.
:return:
'''
# Pre-create destination, since rsync will
# put one file named as group
try:
destination = os.path.join(location, group)
if os.path.exists(d... | [
"Check",
"destination",
"for",
"the",
"archives",
".",
":",
"return",
":"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/saltsupport.py#L96-L113 | [
"def",
"check_destination",
"(",
"self",
",",
"location",
",",
"group",
")",
":",
"# Pre-create destination, since rsync will",
"# put one file named as group",
"try",
":",
"destination",
"=",
"os",
".",
"path",
".",
"join",
"(",
"location",
",",
"group",
")",
"if... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltSupportState.collected | Sync archives to a central place.
:param name:
:param group:
:param filename:
:param host:
:param location:
:param move:
:param all:
:return: | salt/states/saltsupport.py | def collected(self, group, filename=None, host=None, location=None, move=True, all=True):
'''
Sync archives to a central place.
:param name:
:param group:
:param filename:
:param host:
:param location:
:param move:
:param all:
:return:
... | def collected(self, group, filename=None, host=None, location=None, move=True, all=True):
'''
Sync archives to a central place.
:param name:
:param group:
:param filename:
:param host:
:param location:
:param move:
:param all:
:return:
... | [
"Sync",
"archives",
"to",
"a",
"central",
"place",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/saltsupport.py#L115-L139 | [
"def",
"collected",
"(",
"self",
",",
"group",
",",
"filename",
"=",
"None",
",",
"host",
"=",
"None",
",",
"location",
"=",
"None",
",",
"move",
"=",
"True",
",",
"all",
"=",
"True",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"'support.collected'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltSupportState.taken | Takes minion support config data.
:param profile:
:param pillar:
:param archive:
:param output:
:return: | salt/states/saltsupport.py | def taken(self, profile='default', pillar=None, archive=None, output='nested'):
'''
Takes minion support config data.
:param profile:
:param pillar:
:param archive:
:param output:
:return:
'''
ret = {
'name': 'support.taken',
... | def taken(self, profile='default', pillar=None, archive=None, output='nested'):
'''
Takes minion support config data.
:param profile:
:param pillar:
:param archive:
:param output:
:return:
'''
ret = {
'name': 'support.taken',
... | [
"Takes",
"minion",
"support",
"config",
"data",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/saltsupport.py#L141-L168 | [
"def",
"taken",
"(",
"self",
",",
"profile",
"=",
"'default'",
",",
"pillar",
"=",
"None",
",",
"archive",
"=",
"None",
",",
"output",
"=",
"'nested'",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"'support.taken'",
",",
"'changes'",
":",
"{",
"}",
",",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_disk | Create a VMM disk with the specified `name` and `size`.
size:
Size in megabytes, or use a specifier such as M, G, T.
CLI Example:
.. code-block:: bash
salt '*' vmctl.create_disk /path/to/disk.img size=10G | salt/modules/vmctl.py | def create_disk(name, size):
'''
Create a VMM disk with the specified `name` and `size`.
size:
Size in megabytes, or use a specifier such as M, G, T.
CLI Example:
.. code-block:: bash
salt '*' vmctl.create_disk /path/to/disk.img size=10G
'''
ret = False
cmd = 'vmctl c... | def create_disk(name, size):
'''
Create a VMM disk with the specified `name` and `size`.
size:
Size in megabytes, or use a specifier such as M, G, T.
CLI Example:
.. code-block:: bash
salt '*' vmctl.create_disk /path/to/disk.img size=10G
'''
ret = False
cmd = 'vmctl c... | [
"Create",
"a",
"VMM",
"disk",
"with",
"the",
"specified",
"name",
"and",
"size",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vmctl.py#L50-L78 | [
"def",
"create_disk",
"(",
"name",
",",
"size",
")",
":",
"ret",
"=",
"False",
"cmd",
"=",
"'vmctl create {0} -s {1}'",
".",
"format",
"(",
"name",
",",
"size",
")",
"result",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"output_loglevel",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | load | Load additional configuration from the specified file.
path
Path to the configuration file.
CLI Example:
.. code-block:: bash
salt '*' vmctl.load path=/etc/vm.switches.conf | salt/modules/vmctl.py | def load(path):
'''
Load additional configuration from the specified file.
path
Path to the configuration file.
CLI Example:
.. code-block:: bash
salt '*' vmctl.load path=/etc/vm.switches.conf
'''
ret = False
cmd = 'vmctl load {0}'.format(path)
result = __salt__['... | def load(path):
'''
Load additional configuration from the specified file.
path
Path to the configuration file.
CLI Example:
.. code-block:: bash
salt '*' vmctl.load path=/etc/vm.switches.conf
'''
ret = False
cmd = 'vmctl load {0}'.format(path)
result = __salt__['... | [
"Load",
"additional",
"configuration",
"from",
"the",
"specified",
"file",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vmctl.py#L81-L107 | [
"def",
"load",
"(",
"path",
")",
":",
"ret",
"=",
"False",
"cmd",
"=",
"'vmctl load {0}'",
".",
"format",
"(",
"path",
")",
"result",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"output_loglevel",
"=",
"'trace'",
",",
"python_shell",
"="... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | reload | Remove all stopped VMs and reload configuration from the default configuration file.
CLI Example:
.. code-block:: bash
salt '*' vmctl.reload | salt/modules/vmctl.py | def reload():
'''
Remove all stopped VMs and reload configuration from the default configuration file.
CLI Example:
.. code-block:: bash
salt '*' vmctl.reload
'''
ret = False
cmd = 'vmctl reload'
result = __salt__['cmd.run_all'](cmd,
output... | def reload():
'''
Remove all stopped VMs and reload configuration from the default configuration file.
CLI Example:
.. code-block:: bash
salt '*' vmctl.reload
'''
ret = False
cmd = 'vmctl reload'
result = __salt__['cmd.run_all'](cmd,
output... | [
"Remove",
"all",
"stopped",
"VMs",
"and",
"reload",
"configuration",
"from",
"the",
"default",
"configuration",
"file",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vmctl.py#L110-L133 | [
"def",
"reload",
"(",
")",
":",
"ret",
"=",
"False",
"cmd",
"=",
"'vmctl reload'",
"result",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"output_loglevel",
"=",
"'trace'",
",",
"python_shell",
"=",
"False",
")",
"if",
"result",
"[",
"'re... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | reset | Reset the running state of VMM or a subsystem.
all:
Reset the running state.
switches:
Reset the configured switches.
vms:
Reset and terminate all VMs.
CLI Example:
.. code-block:: bash
salt '*' vmctl.reset all=True | salt/modules/vmctl.py | def reset(all=False, vms=False, switches=False):
'''
Reset the running state of VMM or a subsystem.
all:
Reset the running state.
switches:
Reset the configured switches.
vms:
Reset and terminate all VMs.
CLI Example:
.. code-block:: bash
salt '*' vmctl... | def reset(all=False, vms=False, switches=False):
'''
Reset the running state of VMM or a subsystem.
all:
Reset the running state.
switches:
Reset the configured switches.
vms:
Reset and terminate all VMs.
CLI Example:
.. code-block:: bash
salt '*' vmctl... | [
"Reset",
"the",
"running",
"state",
"of",
"VMM",
"or",
"a",
"subsystem",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vmctl.py#L136-L177 | [
"def",
"reset",
"(",
"all",
"=",
"False",
",",
"vms",
"=",
"False",
",",
"switches",
"=",
"False",
")",
":",
"ret",
"=",
"False",
"cmd",
"=",
"[",
"'vmctl'",
",",
"'reset'",
"]",
"if",
"all",
":",
"cmd",
".",
"append",
"(",
"'all'",
")",
"elif",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | start | Starts a VM defined by the specified parameters.
When both a name and id are provided, the id is ignored.
name:
Name of the defined VM.
id:
VM id.
bootpath:
Path to a kernel or BIOS image to load.
disk:
Path to a single disk to use.
disks:
List of mul... | salt/modules/vmctl.py | def start(name=None, id=None, bootpath=None, disk=None, disks=None, local_iface=False,
memory=None, nics=0, switch=None):
'''
Starts a VM defined by the specified parameters.
When both a name and id are provided, the id is ignored.
name:
Name of the defined VM.
id:
VM id.... | def start(name=None, id=None, bootpath=None, disk=None, disks=None, local_iface=False,
memory=None, nics=0, switch=None):
'''
Starts a VM defined by the specified parameters.
When both a name and id are provided, the id is ignored.
name:
Name of the defined VM.
id:
VM id.... | [
"Starts",
"a",
"VM",
"defined",
"by",
"the",
"specified",
"parameters",
".",
"When",
"both",
"a",
"name",
"and",
"id",
"are",
"provided",
"the",
"id",
"is",
"ignored",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vmctl.py#L180-L283 | [
"def",
"start",
"(",
"name",
"=",
"None",
",",
"id",
"=",
"None",
",",
"bootpath",
"=",
"None",
",",
"disk",
"=",
"None",
",",
"disks",
"=",
"None",
",",
"local_iface",
"=",
"False",
",",
"memory",
"=",
"None",
",",
"nics",
"=",
"0",
",",
"switch... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | status | List VMs running on the host, or only the VM specified by ``id``. When
both a name and id are provided, the id is ignored.
name:
Name of the defined VM.
id:
VM id.
CLI Example:
.. code-block:: bash
salt '*' vmctl.status # to list all VMs
salt '*' vmctl... | salt/modules/vmctl.py | def status(name=None, id=None):
'''
List VMs running on the host, or only the VM specified by ``id``. When
both a name and id are provided, the id is ignored.
name:
Name of the defined VM.
id:
VM id.
CLI Example:
.. code-block:: bash
salt '*' vmctl.status ... | def status(name=None, id=None):
'''
List VMs running on the host, or only the VM specified by ``id``. When
both a name and id are provided, the id is ignored.
name:
Name of the defined VM.
id:
VM id.
CLI Example:
.. code-block:: bash
salt '*' vmctl.status ... | [
"List",
"VMs",
"running",
"on",
"the",
"host",
"or",
"only",
"the",
"VM",
"specified",
"by",
"id",
".",
"When",
"both",
"a",
"name",
"and",
"id",
"are",
"provided",
"the",
"id",
"is",
"ignored",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vmctl.py#L286-L358 | [
"def",
"status",
"(",
"name",
"=",
"None",
",",
"id",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"[",
"'vmctl'",
",",
"'status'",
"]",
"result",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"output_loglevel",
"=",
"'tr... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | stop | Stop (terminate) the VM identified by the given id or name.
When both a name and id are provided, the id is ignored.
name:
Name of the defined VM.
id:
VM id.
CLI Example:
.. code-block:: bash
salt '*' vmctl.stop name=alpine | salt/modules/vmctl.py | def stop(name=None, id=None):
'''
Stop (terminate) the VM identified by the given id or name.
When both a name and id are provided, the id is ignored.
name:
Name of the defined VM.
id:
VM id.
CLI Example:
.. code-block:: bash
salt '*' vmctl.stop name=alpine
'... | def stop(name=None, id=None):
'''
Stop (terminate) the VM identified by the given id or name.
When both a name and id are provided, the id is ignored.
name:
Name of the defined VM.
id:
VM id.
CLI Example:
.. code-block:: bash
salt '*' vmctl.stop name=alpine
'... | [
"Stop",
"(",
"terminate",
")",
"the",
"VM",
"identified",
"by",
"the",
"given",
"id",
"or",
"name",
".",
"When",
"both",
"a",
"name",
"and",
"id",
"are",
"provided",
"the",
"id",
"is",
"ignored",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vmctl.py#L361-L403 | [
"def",
"stop",
"(",
"name",
"=",
"None",
",",
"id",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"[",
"'vmctl'",
",",
"'stop'",
"]",
"if",
"not",
"(",
"name",
"or",
"id",
")",
":",
"raise",
"SaltInvocationError",
"(",
"'Must provide eit... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | run | Run one or more named munin plugins
CLI Example:
.. code-block:: bash
salt '*' munin.run uptime
salt '*' munin.run uptime,cpu,load,memory | salt/modules/munin.py | def run(plugins):
'''
Run one or more named munin plugins
CLI Example:
.. code-block:: bash
salt '*' munin.run uptime
salt '*' munin.run uptime,cpu,load,memory
'''
all_plugins = list_plugins()
if isinstance(plugins, six.string_types):
plugins = plugins.split(',')
... | def run(plugins):
'''
Run one or more named munin plugins
CLI Example:
.. code-block:: bash
salt '*' munin.run uptime
salt '*' munin.run uptime,cpu,load,memory
'''
all_plugins = list_plugins()
if isinstance(plugins, six.string_types):
plugins = plugins.split(',')
... | [
"Run",
"one",
"or",
"more",
"named",
"munin",
"plugins"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/munin.py#L33-L70 | [
"def",
"run",
"(",
"plugins",
")",
":",
"all_plugins",
"=",
"list_plugins",
"(",
")",
"if",
"isinstance",
"(",
"plugins",
",",
"six",
".",
"string_types",
")",
":",
"plugins",
"=",
"plugins",
".",
"split",
"(",
"','",
")",
"data",
"=",
"{",
"}",
"for... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | run_all | Run all the munin plugins
CLI Example:
.. code-block:: bash
salt '*' munin.run_all | salt/modules/munin.py | def run_all():
'''
Run all the munin plugins
CLI Example:
.. code-block:: bash
salt '*' munin.run_all
'''
plugins = list_plugins()
ret = {}
for plugin in plugins:
ret.update(run(plugin))
return ret | def run_all():
'''
Run all the munin plugins
CLI Example:
.. code-block:: bash
salt '*' munin.run_all
'''
plugins = list_plugins()
ret = {}
for plugin in plugins:
ret.update(run(plugin))
return ret | [
"Run",
"all",
"the",
"munin",
"plugins"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/munin.py#L73-L87 | [
"def",
"run_all",
"(",
")",
":",
"plugins",
"=",
"list_plugins",
"(",
")",
"ret",
"=",
"{",
"}",
"for",
"plugin",
"in",
"plugins",
":",
"ret",
".",
"update",
"(",
"run",
"(",
"plugin",
")",
")",
"return",
"ret"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_plugins | List all the munin plugins
CLI Example:
.. code-block:: bash
salt '*' munin.list_plugins | salt/modules/munin.py | def list_plugins():
'''
List all the munin plugins
CLI Example:
.. code-block:: bash
salt '*' munin.list_plugins
'''
pluginlist = os.listdir(PLUGINDIR)
ret = []
for plugin in pluginlist:
# Check if execute bit
statf = os.path.join(PLUGINDIR, plugin)
try... | def list_plugins():
'''
List all the munin plugins
CLI Example:
.. code-block:: bash
salt '*' munin.list_plugins
'''
pluginlist = os.listdir(PLUGINDIR)
ret = []
for plugin in pluginlist:
# Check if execute bit
statf = os.path.join(PLUGINDIR, plugin)
try... | [
"List",
"all",
"the",
"munin",
"plugins"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/munin.py#L90-L111 | [
"def",
"list_plugins",
"(",
")",
":",
"pluginlist",
"=",
"os",
".",
"listdir",
"(",
"PLUGINDIR",
")",
"ret",
"=",
"[",
"]",
"for",
"plugin",
"in",
"pluginlist",
":",
"# Check if execute bit",
"statf",
"=",
"os",
".",
"path",
".",
"join",
"(",
"PLUGINDIR"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_installed | Return a list of all installed kernels.
CLI Example:
.. code-block:: bash
salt '*' kernelpkg.list_installed | salt/modules/kernelpkg_linux_yum.py | def list_installed():
'''
Return a list of all installed kernels.
CLI Example:
.. code-block:: bash
salt '*' kernelpkg.list_installed
'''
result = __salt__['pkg.version'](_package_name(), versions_as_list=True)
if result is None:
return []
if six.PY2:
return s... | def list_installed():
'''
Return a list of all installed kernels.
CLI Example:
.. code-block:: bash
salt '*' kernelpkg.list_installed
'''
result = __salt__['pkg.version'](_package_name(), versions_as_list=True)
if result is None:
return []
if six.PY2:
return s... | [
"Return",
"a",
"list",
"of",
"all",
"installed",
"kernels",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kernelpkg_linux_yum.py#L64-L81 | [
"def",
"list_installed",
"(",
")",
":",
"result",
"=",
"__salt__",
"[",
"'pkg.version'",
"]",
"(",
"_package_name",
"(",
")",
",",
"versions_as_list",
"=",
"True",
")",
"if",
"result",
"is",
"None",
":",
"return",
"[",
"]",
"if",
"six",
".",
"PY2",
":"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | upgrade | Upgrade the kernel and optionally reboot the system.
reboot : False
Request a reboot if a new kernel is available.
at_time : immediate
Schedule the reboot at some point in the future. This argument
is ignored if ``reboot=False``. See
:py:func:`~salt.modules.system.reboot` for m... | salt/modules/kernelpkg_linux_yum.py | def upgrade(reboot=False, at_time=None):
'''
Upgrade the kernel and optionally reboot the system.
reboot : False
Request a reboot if a new kernel is available.
at_time : immediate
Schedule the reboot at some point in the future. This argument
is ignored if ``reboot=False``. See... | def upgrade(reboot=False, at_time=None):
'''
Upgrade the kernel and optionally reboot the system.
reboot : False
Request a reboot if a new kernel is available.
at_time : immediate
Schedule the reboot at some point in the future. This argument
is ignored if ``reboot=False``. See... | [
"Upgrade",
"the",
"kernel",
"and",
"optionally",
"reboot",
"the",
"system",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kernelpkg_linux_yum.py#L138-L178 | [
"def",
"upgrade",
"(",
"reboot",
"=",
"False",
",",
"at_time",
"=",
"None",
")",
":",
"result",
"=",
"__salt__",
"[",
"'pkg.upgrade'",
"]",
"(",
"name",
"=",
"_package_name",
"(",
")",
")",
"_needs_reboot",
"=",
"needs_reboot",
"(",
")",
"ret",
"=",
"{... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove | Remove a specific version of the kernel.
release
The release number of an installed kernel. This must be the entire release
number as returned by :py:func:`~salt.modules.kernelpkg_linux_yum.list_installed`,
not the package name.
CLI Example:
.. code-block:: bash
salt '*' ... | salt/modules/kernelpkg_linux_yum.py | def remove(release):
'''
Remove a specific version of the kernel.
release
The release number of an installed kernel. This must be the entire release
number as returned by :py:func:`~salt.modules.kernelpkg_linux_yum.list_installed`,
not the package name.
CLI Example:
.. cod... | def remove(release):
'''
Remove a specific version of the kernel.
release
The release number of an installed kernel. This must be the entire release
number as returned by :py:func:`~salt.modules.kernelpkg_linux_yum.list_installed`,
not the package name.
CLI Example:
.. cod... | [
"Remove",
"a",
"specific",
"version",
"of",
"the",
"kernel",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kernelpkg_linux_yum.py#L195-L246 | [
"def",
"remove",
"(",
"release",
")",
":",
"if",
"release",
"not",
"in",
"list_installed",
"(",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'Kernel release \\'{0}\\' is not installed'",
".",
"format",
"(",
"release",
")",
")",
"if",
"release",
"==",
"activ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | context_cache | A decorator to be used module functions which need to cache their
context.
To evaluate a __context__ and re-hydrate it if a given key
is empty or contains no items, pass a list of keys to evaulate. | salt/utils/cache.py | def context_cache(func):
'''
A decorator to be used module functions which need to cache their
context.
To evaluate a __context__ and re-hydrate it if a given key
is empty or contains no items, pass a list of keys to evaulate.
'''
def context_cache_wrap(*args, **kwargs):
func_contex... | def context_cache(func):
'''
A decorator to be used module functions which need to cache their
context.
To evaluate a __context__ and re-hydrate it if a given key
is empty or contains no items, pass a list of keys to evaulate.
'''
def context_cache_wrap(*args, **kwargs):
func_contex... | [
"A",
"decorator",
"to",
"be",
"used",
"module",
"functions",
"which",
"need",
"to",
"cache",
"their",
"context",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cache.py#L344-L363 | [
"def",
"context_cache",
"(",
"func",
")",
":",
"def",
"context_cache_wrap",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"func_context",
"=",
"func",
".",
"__globals__",
"[",
"'__context__'",
"]",
"func_opts",
"=",
"func",
".",
"__globals__",
"[",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CacheDict._enforce_ttl_key | Enforce the TTL to a specific key, delete if its past TTL | salt/utils/cache.py | def _enforce_ttl_key(self, key):
'''
Enforce the TTL to a specific key, delete if its past TTL
'''
if key not in self._key_cache_time or self._ttl == 0:
return
if time.time() - self._key_cache_time[key] > self._ttl:
del self._key_cache_time[key]
... | def _enforce_ttl_key(self, key):
'''
Enforce the TTL to a specific key, delete if its past TTL
'''
if key not in self._key_cache_time or self._ttl == 0:
return
if time.time() - self._key_cache_time[key] > self._ttl:
del self._key_cache_time[key]
... | [
"Enforce",
"the",
"TTL",
"to",
"a",
"specific",
"key",
"delete",
"if",
"its",
"past",
"TTL"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cache.py#L65-L73 | [
"def",
"_enforce_ttl_key",
"(",
"self",
",",
"key",
")",
":",
"if",
"key",
"not",
"in",
"self",
".",
"_key_cache_time",
"or",
"self",
".",
"_ttl",
"==",
"0",
":",
"return",
"if",
"time",
".",
"time",
"(",
")",
"-",
"self",
".",
"_key_cache_time",
"["... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CacheDisk._enforce_ttl_key | Enforce the TTL to a specific key, delete if its past TTL | salt/utils/cache.py | def _enforce_ttl_key(self, key):
'''
Enforce the TTL to a specific key, delete if its past TTL
'''
if key not in self._key_cache_time or self._ttl == 0:
return
if time.time() - self._key_cache_time[key] > self._ttl:
del self._key_cache_time[key]
... | def _enforce_ttl_key(self, key):
'''
Enforce the TTL to a specific key, delete if its past TTL
'''
if key not in self._key_cache_time or self._ttl == 0:
return
if time.time() - self._key_cache_time[key] > self._ttl:
del self._key_cache_time[key]
... | [
"Enforce",
"the",
"TTL",
"to",
"a",
"specific",
"key",
"delete",
"if",
"its",
"past",
"TTL"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cache.py#L106-L114 | [
"def",
"_enforce_ttl_key",
"(",
"self",
",",
"key",
")",
":",
"if",
"key",
"not",
"in",
"self",
".",
"_key_cache_time",
"or",
"self",
".",
"_ttl",
"==",
"0",
":",
"return",
"if",
"time",
".",
"time",
"(",
")",
"-",
"self",
".",
"_key_cache_time",
"["... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CacheDisk._read | Read in from disk | salt/utils/cache.py | def _read(self):
'''
Read in from disk
'''
if msgpack is None:
log.error('Cache cannot be read from the disk: msgpack is missing')
elif not os.path.exists(self._path):
log.debug('Cache path does not exist for reading: %s', self._path)
else:
... | def _read(self):
'''
Read in from disk
'''
if msgpack is None:
log.error('Cache cannot be read from the disk: msgpack is missing')
elif not os.path.exists(self._path):
log.debug('Cache path does not exist for reading: %s', self._path)
else:
... | [
"Read",
"in",
"from",
"disk"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cache.py#L172-L195 | [
"def",
"_read",
"(",
"self",
")",
":",
"if",
"msgpack",
"is",
"None",
":",
"log",
".",
"error",
"(",
"'Cache cannot be read from the disk: msgpack is missing'",
")",
"elif",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"_path",
")",
":",
"log... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CacheDisk.store | Write content of the entire cache to disk | salt/utils/cache.py | def store(self):
'''
Write content of the entire cache to disk
'''
if msgpack is None:
log.error('Cache cannot be stored on disk: msgpack is missing')
else:
# TODO Dir hashing?
try:
with salt.utils.files.fopen(self._path, 'wb+')... | def store(self):
'''
Write content of the entire cache to disk
'''
if msgpack is None:
log.error('Cache cannot be stored on disk: msgpack is missing')
else:
# TODO Dir hashing?
try:
with salt.utils.files.fopen(self._path, 'wb+')... | [
"Write",
"content",
"of",
"the",
"entire",
"cache",
"to",
"disk"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cache.py#L197-L213 | [
"def",
"store",
"(",
"self",
")",
":",
"if",
"msgpack",
"is",
"None",
":",
"log",
".",
"error",
"(",
"'Cache cannot be stored on disk: msgpack is missing'",
")",
"else",
":",
"# TODO Dir hashing?",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CacheCli.put_cache | published the given minions to the ConCache | salt/utils/cache.py | def put_cache(self, minions):
'''
published the given minions to the ConCache
'''
self.cupd_out.send(self.serial.dumps(minions)) | def put_cache(self, minions):
'''
published the given minions to the ConCache
'''
self.cupd_out.send(self.serial.dumps(minions)) | [
"published",
"the",
"given",
"minions",
"to",
"the",
"ConCache"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cache.py#L244-L248 | [
"def",
"put_cache",
"(",
"self",
",",
"minions",
")",
":",
"self",
".",
"cupd_out",
".",
"send",
"(",
"self",
".",
"serial",
".",
"dumps",
"(",
"minions",
")",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CacheCli.get_cached | queries the ConCache for a list of currently connected minions | salt/utils/cache.py | def get_cached(self):
'''
queries the ConCache for a list of currently connected minions
'''
msg = self.serial.dumps('minions')
self.creq_out.send(msg)
min_list = self.serial.loads(self.creq_out.recv())
return min_list | def get_cached(self):
'''
queries the ConCache for a list of currently connected minions
'''
msg = self.serial.dumps('minions')
self.creq_out.send(msg)
min_list = self.serial.loads(self.creq_out.recv())
return min_list | [
"queries",
"the",
"ConCache",
"for",
"a",
"list",
"of",
"currently",
"connected",
"minions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cache.py#L250-L257 | [
"def",
"get_cached",
"(",
"self",
")",
":",
"msg",
"=",
"self",
".",
"serial",
".",
"dumps",
"(",
"'minions'",
")",
"self",
".",
"creq_out",
".",
"send",
"(",
"msg",
")",
"min_list",
"=",
"self",
".",
"serial",
".",
"loads",
"(",
"self",
".",
"creq... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CacheRegex.sweep | Sweep the cache and remove the outdated or least frequently
used entries | salt/utils/cache.py | def sweep(self):
'''
Sweep the cache and remove the outdated or least frequently
used entries
'''
if self.max_age < time.time() - self.timestamp:
self.clear()
self.timestamp = time.time()
else:
paterns = list(self.cache.values())
... | def sweep(self):
'''
Sweep the cache and remove the outdated or least frequently
used entries
'''
if self.max_age < time.time() - self.timestamp:
self.clear()
self.timestamp = time.time()
else:
paterns = list(self.cache.values())
... | [
"Sweep",
"the",
"cache",
"and",
"remove",
"the",
"outdated",
"or",
"least",
"frequently",
"used",
"entries"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cache.py#L286-L298 | [
"def",
"sweep",
"(",
"self",
")",
":",
"if",
"self",
".",
"max_age",
"<",
"time",
".",
"time",
"(",
")",
"-",
"self",
".",
"timestamp",
":",
"self",
".",
"clear",
"(",
")",
"self",
".",
"timestamp",
"=",
"time",
".",
"time",
"(",
")",
"else",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CacheRegex.get | Get a compiled regular expression object based on pattern and
cache it when it is not in the cache already | salt/utils/cache.py | def get(self, pattern):
'''
Get a compiled regular expression object based on pattern and
cache it when it is not in the cache already
'''
try:
self.cache[pattern][0] += 1
return self.cache[pattern][1]
except KeyError:
pass
if l... | def get(self, pattern):
'''
Get a compiled regular expression object based on pattern and
cache it when it is not in the cache already
'''
try:
self.cache[pattern][0] += 1
return self.cache[pattern][1]
except KeyError:
pass
if l... | [
"Get",
"a",
"compiled",
"regular",
"expression",
"object",
"based",
"on",
"pattern",
"and",
"cache",
"it",
"when",
"it",
"is",
"not",
"in",
"the",
"cache",
"already"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cache.py#L300-L315 | [
"def",
"get",
"(",
"self",
",",
"pattern",
")",
":",
"try",
":",
"self",
".",
"cache",
"[",
"pattern",
"]",
"[",
"0",
"]",
"+=",
"1",
"return",
"self",
".",
"cache",
"[",
"pattern",
"]",
"[",
"1",
"]",
"except",
"KeyError",
":",
"pass",
"if",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ContextCache.cache_context | Cache the given context to disk | salt/utils/cache.py | def cache_context(self, context):
'''
Cache the given context to disk
'''
if not os.path.isdir(os.path.dirname(self.cache_path)):
os.mkdir(os.path.dirname(self.cache_path))
with salt.utils.files.fopen(self.cache_path, 'w+b') as cache:
self.serial.dump(cont... | def cache_context(self, context):
'''
Cache the given context to disk
'''
if not os.path.isdir(os.path.dirname(self.cache_path)):
os.mkdir(os.path.dirname(self.cache_path))
with salt.utils.files.fopen(self.cache_path, 'w+b') as cache:
self.serial.dump(cont... | [
"Cache",
"the",
"given",
"context",
"to",
"disk"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cache.py#L327-L334 | [
"def",
"cache_context",
"(",
"self",
",",
"context",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"self",
".",
"cache_path",
")",
")",
":",
"os",
".",
"mkdir",
"(",
"os",
".",
"path",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ContextCache.get_cache_context | Retrieve a context cache from disk | salt/utils/cache.py | def get_cache_context(self):
'''
Retrieve a context cache from disk
'''
with salt.utils.files.fopen(self.cache_path, 'rb') as cache:
return salt.utils.data.decode(self.serial.load(cache)) | def get_cache_context(self):
'''
Retrieve a context cache from disk
'''
with salt.utils.files.fopen(self.cache_path, 'rb') as cache:
return salt.utils.data.decode(self.serial.load(cache)) | [
"Retrieve",
"a",
"context",
"cache",
"from",
"disk"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cache.py#L336-L341 | [
"def",
"get_cache_context",
"(",
"self",
")",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"self",
".",
"cache_path",
",",
"'rb'",
")",
"as",
"cache",
":",
"return",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"self"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | strip_rst | Strip/replace reStructuredText directives in docstrings | salt/utils/doc.py | def strip_rst(docs):
'''
Strip/replace reStructuredText directives in docstrings
'''
for func, docstring in six.iteritems(docs):
log.debug('Stripping docstring for %s', func)
if not docstring:
continue
docstring_new = docstring if six.PY3 else salt.utils.data.encode(d... | def strip_rst(docs):
'''
Strip/replace reStructuredText directives in docstrings
'''
for func, docstring in six.iteritems(docs):
log.debug('Stripping docstring for %s', func)
if not docstring:
continue
docstring_new = docstring if six.PY3 else salt.utils.data.encode(d... | [
"Strip",
"/",
"replace",
"reStructuredText",
"directives",
"in",
"docstrings"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/doc.py#L16-L46 | [
"def",
"strip_rst",
"(",
"docs",
")",
":",
"for",
"func",
",",
"docstring",
"in",
"six",
".",
"iteritems",
"(",
"docs",
")",
":",
"log",
".",
"debug",
"(",
"'Stripping docstring for %s'",
",",
"func",
")",
"if",
"not",
"docstring",
":",
"continue",
"docs... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | parse_docstring | Parse a docstring into its parts.
Currently only parses dependencies, can be extended to parse whatever is
needed.
Parses into a dictionary:
{
'full': full docstring,
'deps': list of dependencies (empty list if none)
} | salt/utils/doc.py | def parse_docstring(docstring):
'''
Parse a docstring into its parts.
Currently only parses dependencies, can be extended to parse whatever is
needed.
Parses into a dictionary:
{
'full': full docstring,
'deps': list of dependencies (empty list if none)
}
... | def parse_docstring(docstring):
'''
Parse a docstring into its parts.
Currently only parses dependencies, can be extended to parse whatever is
needed.
Parses into a dictionary:
{
'full': full docstring,
'deps': list of dependencies (empty list if none)
}
... | [
"Parse",
"a",
"docstring",
"into",
"its",
"parts",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/doc.py#L49-L83 | [
"def",
"parse_docstring",
"(",
"docstring",
")",
":",
"# First try with regex search for :depends:",
"ret",
"=",
"{",
"'full'",
":",
"docstring",
"}",
"regex",
"=",
"r'([ \\t]*):depends:[ \\t]+- (\\w+)[^\\n]*\\n(\\1[ \\t]+- (\\w+)[^\\n]*\\n)*'",
"match",
"=",
"re",
".",
"se... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | present | Ensure the cache cluster exists.
name
Name of the cache cluster (cache cluster id).
engine
The name of the cache engine to be used for this cache cluster. Valid
values are memcached or redis.
cache_node_type
The compute and memory capacity of the nodes in the cache cluster... | salt/states/boto_elasticache.py | def present(
name,
engine=None,
cache_node_type=None,
num_cache_nodes=None,
preferred_availability_zone=None,
port=None,
cache_parameter_group_name=None,
cache_security_group_names=None,
replication_group_id=None,
auto_minor_version_upgrade... | def present(
name,
engine=None,
cache_node_type=None,
num_cache_nodes=None,
preferred_availability_zone=None,
port=None,
cache_parameter_group_name=None,
cache_security_group_names=None,
replication_group_id=None,
auto_minor_version_upgrade... | [
"Ensure",
"the",
"cache",
"cluster",
"exists",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_elasticache.py#L100-L263 | [
"def",
"present",
"(",
"name",
",",
"engine",
"=",
"None",
",",
"cache_node_type",
"=",
"None",
",",
"num_cache_nodes",
"=",
"None",
",",
"preferred_availability_zone",
"=",
"None",
",",
"port",
"=",
"None",
",",
"cache_parameter_group_name",
"=",
"None",
",",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | subnet_group_present | Ensure ElastiCache subnet group exists.
.. versionadded:: 2015.8.0
name
The name for the ElastiCache subnet group. This value is stored as a lowercase string.
subnet_ids
A list of VPC subnet IDs for the cache subnet group. Exclusive with subnet_names.
subnet_names
A list of ... | salt/states/boto_elasticache.py | def subnet_group_present(name, subnet_ids=None, subnet_names=None,
description=None, tags=None, region=None,
key=None, keyid=None, profile=None):
'''
Ensure ElastiCache subnet group exists.
.. versionadded:: 2015.8.0
name
The name for the Elast... | def subnet_group_present(name, subnet_ids=None, subnet_names=None,
description=None, tags=None, region=None,
key=None, keyid=None, profile=None):
'''
Ensure ElastiCache subnet group exists.
.. versionadded:: 2015.8.0
name
The name for the Elast... | [
"Ensure",
"ElastiCache",
"subnet",
"group",
"exists",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_elasticache.py#L266-L329 | [
"def",
"subnet_group_present",
"(",
"name",
",",
"subnet_ids",
"=",
"None",
",",
"subnet_names",
"=",
"None",
",",
"description",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
","... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | creategroup | Ensure the a replication group is create.
name
Name of replication group
wait
Waits for the group to be available
primary_cluster_id
Name of the master cache node
replication_group_description
Description for the group
region
Region to connect to.
ke... | salt/states/boto_elasticache.py | def creategroup(name, primary_cluster_id, replication_group_description, wait=None,
region=None, key=None, keyid=None, profile=None):
'''
Ensure the a replication group is create.
name
Name of replication group
wait
Waits for the group to be available
primary_clust... | def creategroup(name, primary_cluster_id, replication_group_description, wait=None,
region=None, key=None, keyid=None, profile=None):
'''
Ensure the a replication group is create.
name
Name of replication group
wait
Waits for the group to be available
primary_clust... | [
"Ensure",
"the",
"a",
"replication",
"group",
"is",
"create",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_elasticache.py#L386-L438 | [
"def",
"creategroup",
"(",
"name",
",",
"primary_cluster_id",
",",
"replication_group_description",
",",
"wait",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _clear_dict | Eliminates None entries from the features of the endpoint dict. | salt/states/statuspage.py | def _clear_dict(endpoint_props):
'''
Eliminates None entries from the features of the endpoint dict.
'''
return dict(
(prop_name, prop_val)
for prop_name, prop_val in six.iteritems(endpoint_props)
if prop_val is not None
) | def _clear_dict(endpoint_props):
'''
Eliminates None entries from the features of the endpoint dict.
'''
return dict(
(prop_name, prop_val)
for prop_name, prop_val in six.iteritems(endpoint_props)
if prop_val is not None
) | [
"Eliminates",
"None",
"entries",
"from",
"the",
"features",
"of",
"the",
"endpoint",
"dict",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/statuspage.py#L85-L93 | [
"def",
"_clear_dict",
"(",
"endpoint_props",
")",
":",
"return",
"dict",
"(",
"(",
"prop_name",
",",
"prop_val",
")",
"for",
"prop_name",
",",
"prop_val",
"in",
"six",
".",
"iteritems",
"(",
"endpoint_props",
")",
"if",
"prop_val",
"is",
"not",
"None",
")"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _ignore_keys | Ignores some keys that might be different without any important info.
These keys are defined under _DO_NOT_COMPARE_FIELDS. | salt/states/statuspage.py | def _ignore_keys(endpoint_props):
'''
Ignores some keys that might be different without any important info.
These keys are defined under _DO_NOT_COMPARE_FIELDS.
'''
return dict(
(prop_name, prop_val)
for prop_name, prop_val in six.iteritems(endpoint_props)
if prop_name not in... | def _ignore_keys(endpoint_props):
'''
Ignores some keys that might be different without any important info.
These keys are defined under _DO_NOT_COMPARE_FIELDS.
'''
return dict(
(prop_name, prop_val)
for prop_name, prop_val in six.iteritems(endpoint_props)
if prop_name not in... | [
"Ignores",
"some",
"keys",
"that",
"might",
"be",
"different",
"without",
"any",
"important",
"info",
".",
"These",
"keys",
"are",
"defined",
"under",
"_DO_NOT_COMPARE_FIELDS",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/statuspage.py#L96-L105 | [
"def",
"_ignore_keys",
"(",
"endpoint_props",
")",
":",
"return",
"dict",
"(",
"(",
"prop_name",
",",
"prop_val",
")",
"for",
"prop_name",
",",
"prop_val",
"in",
"six",
".",
"iteritems",
"(",
"endpoint_props",
")",
"if",
"prop_name",
"not",
"in",
"_DO_NOT_CO... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _unique | Returns an unique list of dictionaries given a list that may contain duplicates. | salt/states/statuspage.py | def _unique(list_of_dicts):
'''
Returns an unique list of dictionaries given a list that may contain duplicates.
'''
unique_list = []
for ele in list_of_dicts:
if ele not in unique_list:
unique_list.append(ele)
return unique_list | def _unique(list_of_dicts):
'''
Returns an unique list of dictionaries given a list that may contain duplicates.
'''
unique_list = []
for ele in list_of_dicts:
if ele not in unique_list:
unique_list.append(ele)
return unique_list | [
"Returns",
"an",
"unique",
"list",
"of",
"dictionaries",
"given",
"a",
"list",
"that",
"may",
"contain",
"duplicates",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/statuspage.py#L108-L116 | [
"def",
"_unique",
"(",
"list_of_dicts",
")",
":",
"unique_list",
"=",
"[",
"]",
"for",
"ele",
"in",
"list_of_dicts",
":",
"if",
"ele",
"not",
"in",
"unique_list",
":",
"unique_list",
".",
"append",
"(",
"ele",
")",
"return",
"unique_list"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _clear_ignore | Both _clear_dict and _ignore_keys in a single iteration. | salt/states/statuspage.py | def _clear_ignore(endpoint_props):
'''
Both _clear_dict and _ignore_keys in a single iteration.
'''
return dict(
(prop_name, prop_val)
for prop_name, prop_val in six.iteritems(endpoint_props)
if prop_name not in _DO_NOT_COMPARE_FIELDS and prop_val is not None
) | def _clear_ignore(endpoint_props):
'''
Both _clear_dict and _ignore_keys in a single iteration.
'''
return dict(
(prop_name, prop_val)
for prop_name, prop_val in six.iteritems(endpoint_props)
if prop_name not in _DO_NOT_COMPARE_FIELDS and prop_val is not None
) | [
"Both",
"_clear_dict",
"and",
"_ignore_keys",
"in",
"a",
"single",
"iteration",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/statuspage.py#L119-L127 | [
"def",
"_clear_ignore",
"(",
"endpoint_props",
")",
":",
"return",
"dict",
"(",
"(",
"prop_name",
",",
"prop_val",
")",
"for",
"prop_name",
",",
"prop_val",
"in",
"six",
".",
"iteritems",
"(",
"endpoint_props",
")",
"if",
"prop_name",
"not",
"in",
"_DO_NOT_C... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _find_match | Find a matching element in a list. | salt/states/statuspage.py | def _find_match(ele, lst):
'''
Find a matching element in a list.
'''
for _ele in lst:
for match_key in _MATCH_KEYS:
if _ele.get(match_key) == ele.get(match_key):
return ele | def _find_match(ele, lst):
'''
Find a matching element in a list.
'''
for _ele in lst:
for match_key in _MATCH_KEYS:
if _ele.get(match_key) == ele.get(match_key):
return ele | [
"Find",
"a",
"matching",
"element",
"in",
"a",
"list",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/statuspage.py#L140-L147 | [
"def",
"_find_match",
"(",
"ele",
",",
"lst",
")",
":",
"for",
"_ele",
"in",
"lst",
":",
"for",
"match_key",
"in",
"_MATCH_KEYS",
":",
"if",
"_ele",
".",
"get",
"(",
"match_key",
")",
"==",
"ele",
".",
"get",
"(",
"match_key",
")",
":",
"return",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _update_on_fields | Return a dict with fields that differ between two dicts. | salt/states/statuspage.py | def _update_on_fields(prev_ele, new_ele):
'''
Return a dict with fields that differ between two dicts.
'''
fields_update = dict(
(prop_name, prop_val)
for prop_name, prop_val in six.iteritems(new_ele)
if new_ele.get(prop_name) != prev_ele.get(prop_name) or prop_name in _MATCH_KEY... | def _update_on_fields(prev_ele, new_ele):
'''
Return a dict with fields that differ between two dicts.
'''
fields_update = dict(
(prop_name, prop_val)
for prop_name, prop_val in six.iteritems(new_ele)
if new_ele.get(prop_name) != prev_ele.get(prop_name) or prop_name in _MATCH_KEY... | [
"Return",
"a",
"dict",
"with",
"fields",
"that",
"differ",
"between",
"two",
"dicts",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/statuspage.py#L150-L165 | [
"def",
"_update_on_fields",
"(",
"prev_ele",
",",
"new_ele",
")",
":",
"fields_update",
"=",
"dict",
"(",
"(",
"prop_name",
",",
"prop_val",
")",
"for",
"prop_name",
",",
"prop_val",
"in",
"six",
".",
"iteritems",
"(",
"new_ele",
")",
"if",
"new_ele",
".",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _compute_diff | Compares configured endpoints with the expected configuration and returns the differences. | salt/states/statuspage.py | def _compute_diff(expected_endpoints, configured_endpoints):
'''
Compares configured endpoints with the expected configuration and returns the differences.
'''
new_endpoints = []
update_endpoints = []
remove_endpoints = []
ret = _compute_diff_ret()
# noth configured => configure with e... | def _compute_diff(expected_endpoints, configured_endpoints):
'''
Compares configured endpoints with the expected configuration and returns the differences.
'''
new_endpoints = []
update_endpoints = []
remove_endpoints = []
ret = _compute_diff_ret()
# noth configured => configure with e... | [
"Compares",
"configured",
"endpoints",
"with",
"the",
"expected",
"configuration",
"and",
"returns",
"the",
"differences",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/statuspage.py#L168-L218 | [
"def",
"_compute_diff",
"(",
"expected_endpoints",
",",
"configured_endpoints",
")",
":",
"new_endpoints",
"=",
"[",
"]",
"update_endpoints",
"=",
"[",
"]",
"remove_endpoints",
"=",
"[",
"]",
"ret",
"=",
"_compute_diff_ret",
"(",
")",
"# noth configured => configure... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create | Insert a new entry under a specific endpoint.
endpoint: incidents
Insert under this specific endpoint.
page_id
Page ID. Can also be specified in the config file.
api_key
API key. Can also be specified in the config file.
api_version: 1
API version. Can also be specifi... | salt/states/statuspage.py | def create(name,
endpoint='incidents',
api_url=None,
page_id=None,
api_key=None,
api_version=None,
**kwargs):
'''
Insert a new entry under a specific endpoint.
endpoint: incidents
Insert under this specific endpoint.
page_id
... | def create(name,
endpoint='incidents',
api_url=None,
page_id=None,
api_key=None,
api_version=None,
**kwargs):
'''
Insert a new entry under a specific endpoint.
endpoint: incidents
Insert under this specific endpoint.
page_id
... | [
"Insert",
"a",
"new",
"entry",
"under",
"a",
"specific",
"endpoint",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/statuspage.py#L225-L286 | [
"def",
"create",
"(",
"name",
",",
"endpoint",
"=",
"'incidents'",
",",
"api_url",
"=",
"None",
",",
"page_id",
"=",
"None",
",",
"api_key",
"=",
"None",
",",
"api_version",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"_default_ret",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update | Update attribute(s) of a specific endpoint.
id
The unique ID of the enpoint entry.
endpoint: incidents
Endpoint name.
page_id
Page ID. Can also be specified in the config file.
api_key
API key. Can also be specified in the config file.
api_version: 1
API ... | salt/states/statuspage.py | def update(name,
endpoint='incidents',
id=None,
api_url=None,
page_id=None,
api_key=None,
api_version=None,
**kwargs):
'''
Update attribute(s) of a specific endpoint.
id
The unique ID of the enpoint entry.
endpoint: i... | def update(name,
endpoint='incidents',
id=None,
api_url=None,
page_id=None,
api_key=None,
api_version=None,
**kwargs):
'''
Update attribute(s) of a specific endpoint.
id
The unique ID of the enpoint entry.
endpoint: i... | [
"Update",
"attribute",
"(",
"s",
")",
"of",
"a",
"specific",
"endpoint",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/statuspage.py#L289-L356 | [
"def",
"update",
"(",
"name",
",",
"endpoint",
"=",
"'incidents'",
",",
"id",
"=",
"None",
",",
"api_url",
"=",
"None",
",",
"page_id",
"=",
"None",
",",
"api_key",
"=",
"None",
",",
"api_version",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"r... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete | Remove an entry from an endpoint.
endpoint: incidents
Request a specific endpoint.
page_id
Page ID. Can also be specified in the config file.
api_key
API key. Can also be specified in the config file.
api_version: 1
API version. Can also be specified in the config fil... | salt/states/statuspage.py | def delete(name,
endpoint='incidents',
id=None,
api_url=None,
page_id=None,
api_key=None,
api_version=None):
'''
Remove an entry from an endpoint.
endpoint: incidents
Request a specific endpoint.
page_id
Page ID. Can als... | def delete(name,
endpoint='incidents',
id=None,
api_url=None,
page_id=None,
api_key=None,
api_version=None):
'''
Remove an entry from an endpoint.
endpoint: incidents
Request a specific endpoint.
page_id
Page ID. Can als... | [
"Remove",
"an",
"entry",
"from",
"an",
"endpoint",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/statuspage.py#L359-L414 | [
"def",
"delete",
"(",
"name",
",",
"endpoint",
"=",
"'incidents'",
",",
"id",
"=",
"None",
",",
"api_url",
"=",
"None",
",",
"page_id",
"=",
"None",
",",
"api_key",
"=",
"None",
",",
"api_version",
"=",
"None",
")",
":",
"ret",
"=",
"_default_ret",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | managed | Manage the StatusPage configuration.
config
Dictionary with the expected configuration of the StatusPage.
The main level keys of this dictionary represent the endpoint name.
If a certain endpoint does not exist in this structure, it will be ignored / not configured.
page_id
Pag... | salt/states/statuspage.py | def managed(name,
config,
api_url=None,
page_id=None,
api_key=None,
api_version=None,
pace=_PACE,
allow_empty=False):
'''
Manage the StatusPage configuration.
config
Dictionary with the expected configuration of the... | def managed(name,
config,
api_url=None,
page_id=None,
api_key=None,
api_version=None,
pace=_PACE,
allow_empty=False):
'''
Manage the StatusPage configuration.
config
Dictionary with the expected configuration of the... | [
"Manage",
"the",
"StatusPage",
"configuration",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/statuspage.py#L417-L590 | [
"def",
"managed",
"(",
"name",
",",
"config",
",",
"api_url",
"=",
"None",
",",
"page_id",
"=",
"None",
",",
"api_key",
"=",
"None",
",",
"api_version",
"=",
"None",
",",
"pace",
"=",
"_PACE",
",",
"allow_empty",
"=",
"False",
")",
":",
"complete_diff"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | present | Ensure a user is present
.. code-block:: yaml
ensure example test user 1:
splunk.user_present:
- realname: 'Example TestUser1'
- name: 'exampleuser'
- email: 'example@domain.com'
- roles: ['user']
The following parameters are... | salt/states/splunk.py | def present(email, profile="splunk", **kwargs):
'''
Ensure a user is present
.. code-block:: yaml
ensure example test user 1:
splunk.user_present:
- realname: 'Example TestUser1'
- name: 'exampleuser'
- email: 'example@domain.com'
... | def present(email, profile="splunk", **kwargs):
'''
Ensure a user is present
.. code-block:: yaml
ensure example test user 1:
splunk.user_present:
- realname: 'Example TestUser1'
- name: 'exampleuser'
- email: 'example@domain.com'
... | [
"Ensure",
"a",
"user",
"is",
"present"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/splunk.py#L26-L103 | [
"def",
"present",
"(",
"email",
",",
"profile",
"=",
"\"splunk\"",
",",
"*",
"*",
"kwargs",
")",
":",
"name",
"=",
"kwargs",
".",
"get",
"(",
"'name'",
")",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | absent | Ensure a splunk user is absent
.. code-block:: yaml
ensure example test user 1:
splunk.absent:
- email: 'example@domain.com'
- name: 'exampleuser'
The following parameters are required:
email
This is the email of the user in splunk
name
... | salt/states/splunk.py | def absent(email, profile="splunk", **kwargs):
'''
Ensure a splunk user is absent
.. code-block:: yaml
ensure example test user 1:
splunk.absent:
- email: 'example@domain.com'
- name: 'exampleuser'
The following parameters are required:
email
... | def absent(email, profile="splunk", **kwargs):
'''
Ensure a splunk user is absent
.. code-block:: yaml
ensure example test user 1:
splunk.absent:
- email: 'example@domain.com'
- name: 'exampleuser'
The following parameters are required:
email
... | [
"Ensure",
"a",
"splunk",
"user",
"is",
"absent"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/splunk.py#L106-L158 | [
"def",
"absent",
"(",
"email",
",",
"profile",
"=",
"\"splunk\"",
",",
"*",
"*",
"kwargs",
")",
":",
"user_identity",
"=",
"kwargs",
".",
"get",
"(",
"'name'",
")",
"ret",
"=",
"{",
"'name'",
":",
"user_identity",
",",
"'changes'",
":",
"{",
"}",
","... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | system | Set the keyboard layout for the system
name
The keyboard layout to use | salt/states/keyboard.py | def system(name):
'''
Set the keyboard layout for the system
name
The keyboard layout to use
'''
ret = {'name': name,
'changes': {},
'result': None,
'comment': ''}
if __salt__['keyboard.get_sys']() == name:
ret['result'] = True
ret['comme... | def system(name):
'''
Set the keyboard layout for the system
name
The keyboard layout to use
'''
ret = {'name': name,
'changes': {},
'result': None,
'comment': ''}
if __salt__['keyboard.get_sys']() == name:
ret['result'] = True
ret['comme... | [
"Set",
"the",
"keyboard",
"layout",
"for",
"the",
"system"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keyboard.py#L32-L58 | [
"def",
"system",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"if",
"__salt__",
"[",
"'keyboard.get_sys'",
"]",
"(",
")",
"==",
"name... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | xorg | Set the keyboard layout for XOrg
layout
The keyboard layout to use | salt/states/keyboard.py | def xorg(name):
'''
Set the keyboard layout for XOrg
layout
The keyboard layout to use
'''
ret = {'name': name,
'changes': {},
'result': None,
'comment': ''}
if __salt__['keyboard.get_x']() == name:
ret['result'] = True
ret['comment'] = '... | def xorg(name):
'''
Set the keyboard layout for XOrg
layout
The keyboard layout to use
'''
ret = {'name': name,
'changes': {},
'result': None,
'comment': ''}
if __salt__['keyboard.get_x']() == name:
ret['result'] = True
ret['comment'] = '... | [
"Set",
"the",
"keyboard",
"layout",
"for",
"XOrg"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keyboard.py#L61-L87 | [
"def",
"xorg",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"if",
"__salt__",
"[",
"'keyboard.get_x'",
"]",
"(",
")",
"==",
"name",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _status_wait | Helper function that will wait for the status of the service to match the
provided status before an end time expires. Used for service stop and start
.. versionadded:: 2017.7.9,2018.3.4
Args:
service_name (str):
The name of the service
end_time (float):
A future ti... | salt/modules/win_service.py | def _status_wait(service_name, end_time, service_states):
'''
Helper function that will wait for the status of the service to match the
provided status before an end time expires. Used for service stop and start
.. versionadded:: 2017.7.9,2018.3.4
Args:
service_name (str):
The ... | def _status_wait(service_name, end_time, service_states):
'''
Helper function that will wait for the status of the service to match the
provided status before an end time expires. Used for service stop and start
.. versionadded:: 2017.7.9,2018.3.4
Args:
service_name (str):
The ... | [
"Helper",
"function",
"that",
"will",
"wait",
"for",
"the",
"status",
"of",
"the",
"service",
"to",
"match",
"the",
"provided",
"status",
"before",
"an",
"end",
"time",
"expires",
".",
"Used",
"for",
"service",
"stop",
"and",
"start"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L251-L293 | [
"def",
"_status_wait",
"(",
"service_name",
",",
"end_time",
",",
"service_states",
")",
":",
"info_results",
"=",
"info",
"(",
"service_name",
")",
"while",
"info_results",
"[",
"'Status'",
"]",
"in",
"service_states",
"and",
"time",
".",
"time",
"(",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _cmd_quote | r'''
Helper function to properly format the path to the binary for the service
Must be wrapped in double quotes to account for paths that have spaces. For
example:
``"C:\Program Files\Path\to\bin.exe"``
Args:
cmd (str): Full path to the binary
Returns:
str: Properly quoted pat... | salt/modules/win_service.py | def _cmd_quote(cmd):
r'''
Helper function to properly format the path to the binary for the service
Must be wrapped in double quotes to account for paths that have spaces. For
example:
``"C:\Program Files\Path\to\bin.exe"``
Args:
cmd (str): Full path to the binary
Returns:
... | def _cmd_quote(cmd):
r'''
Helper function to properly format the path to the binary for the service
Must be wrapped in double quotes to account for paths that have spaces. For
example:
``"C:\Program Files\Path\to\bin.exe"``
Args:
cmd (str): Full path to the binary
Returns:
... | [
"r",
"Helper",
"function",
"to",
"properly",
"format",
"the",
"path",
"to",
"the",
"binary",
"for",
"the",
"service",
"Must",
"be",
"wrapped",
"in",
"double",
"quotes",
"to",
"account",
"for",
"paths",
"that",
"have",
"spaces",
".",
"For",
"example",
":"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L296-L317 | [
"def",
"_cmd_quote",
"(",
"cmd",
")",
":",
"# Remove all single and double quotes from the beginning and the end",
"pattern",
"=",
"re",
".",
"compile",
"(",
"'^(\\\\\"|\\').*|.*(\\\\\"|\\')$'",
")",
"while",
"pattern",
".",
"match",
"(",
"cmd",
")",
"is",
"not",
"Non... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_enabled | Return a list of enabled services. Enabled is defined as a service that is
marked to Auto Start.
Returns:
list: A list of enabled services
CLI Example:
.. code-block:: bash
salt '*' service.get_enabled | salt/modules/win_service.py | def get_enabled():
'''
Return a list of enabled services. Enabled is defined as a service that is
marked to Auto Start.
Returns:
list: A list of enabled services
CLI Example:
.. code-block:: bash
salt '*' service.get_enabled
'''
raw_services = _get_services()
serv... | def get_enabled():
'''
Return a list of enabled services. Enabled is defined as a service that is
marked to Auto Start.
Returns:
list: A list of enabled services
CLI Example:
.. code-block:: bash
salt '*' service.get_enabled
'''
raw_services = _get_services()
serv... | [
"Return",
"a",
"list",
"of",
"enabled",
"services",
".",
"Enabled",
"is",
"defined",
"as",
"a",
"service",
"that",
"is",
"marked",
"to",
"Auto",
"Start",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L320-L340 | [
"def",
"get_enabled",
"(",
")",
":",
"raw_services",
"=",
"_get_services",
"(",
")",
"services",
"=",
"set",
"(",
")",
"for",
"service",
"in",
"raw_services",
":",
"if",
"info",
"(",
"service",
"[",
"'ServiceName'",
"]",
")",
"[",
"'StartType'",
"]",
"in... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | available | Check if a service is available on the system.
Args:
name (str): The name of the service to check
Returns:
bool: ``True`` if the service is available, ``False`` otherwise
CLI Example:
.. code-block:: bash
salt '*' service.available <service name> | salt/modules/win_service.py | def available(name):
'''
Check if a service is available on the system.
Args:
name (str): The name of the service to check
Returns:
bool: ``True`` if the service is available, ``False`` otherwise
CLI Example:
.. code-block:: bash
salt '*' service.available <service n... | def available(name):
'''
Check if a service is available on the system.
Args:
name (str): The name of the service to check
Returns:
bool: ``True`` if the service is available, ``False`` otherwise
CLI Example:
.. code-block:: bash
salt '*' service.available <service n... | [
"Check",
"if",
"a",
"service",
"is",
"available",
"on",
"the",
"system",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L366-L386 | [
"def",
"available",
"(",
"name",
")",
":",
"for",
"service",
"in",
"get_all",
"(",
")",
":",
"if",
"name",
".",
"lower",
"(",
")",
"==",
"service",
".",
"lower",
"(",
")",
":",
"return",
"True",
"return",
"False"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_services | Returns a list of all services on the system. | salt/modules/win_service.py | def _get_services():
'''
Returns a list of all services on the system.
'''
handle_scm = win32service.OpenSCManager(
None, None, win32service.SC_MANAGER_ENUMERATE_SERVICE)
try:
services = win32service.EnumServicesStatusEx(handle_scm)
except AttributeError:
services = win3... | def _get_services():
'''
Returns a list of all services on the system.
'''
handle_scm = win32service.OpenSCManager(
None, None, win32service.SC_MANAGER_ENUMERATE_SERVICE)
try:
services = win32service.EnumServicesStatusEx(handle_scm)
except AttributeError:
services = win3... | [
"Returns",
"a",
"list",
"of",
"all",
"services",
"on",
"the",
"system",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L408-L422 | [
"def",
"_get_services",
"(",
")",
":",
"handle_scm",
"=",
"win32service",
".",
"OpenSCManager",
"(",
"None",
",",
"None",
",",
"win32service",
".",
"SC_MANAGER_ENUMERATE_SERVICE",
")",
"try",
":",
"services",
"=",
"win32service",
".",
"EnumServicesStatusEx",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_all | Return all installed services
Returns:
list: Returns a list of all services on the system.
CLI Example:
.. code-block:: bash
salt '*' service.get_all | salt/modules/win_service.py | def get_all():
'''
Return all installed services
Returns:
list: Returns a list of all services on the system.
CLI Example:
.. code-block:: bash
salt '*' service.get_all
'''
services = _get_services()
ret = set()
for service in services:
ret.add(service['S... | def get_all():
'''
Return all installed services
Returns:
list: Returns a list of all services on the system.
CLI Example:
.. code-block:: bash
salt '*' service.get_all
'''
services = _get_services()
ret = set()
for service in services:
ret.add(service['S... | [
"Return",
"all",
"installed",
"services"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L425-L444 | [
"def",
"get_all",
"(",
")",
":",
"services",
"=",
"_get_services",
"(",
")",
"ret",
"=",
"set",
"(",
")",
"for",
"service",
"in",
"services",
":",
"ret",
".",
"add",
"(",
"service",
"[",
"'ServiceName'",
"]",
")",
"return",
"sorted",
"(",
"ret",
")"
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_service_name | The Display Name is what is displayed in Windows when services.msc is
executed. Each Display Name has an associated Service Name which is the
actual name of the service. This function allows you to discover the
Service Name by returning a dictionary of Display Names and Service Names,
or filter by add... | salt/modules/win_service.py | def get_service_name(*args):
'''
The Display Name is what is displayed in Windows when services.msc is
executed. Each Display Name has an associated Service Name which is the
actual name of the service. This function allows you to discover the
Service Name by returning a dictionary of Display Name... | def get_service_name(*args):
'''
The Display Name is what is displayed in Windows when services.msc is
executed. Each Display Name has an associated Service Name which is the
actual name of the service. This function allows you to discover the
Service Name by returning a dictionary of Display Name... | [
"The",
"Display",
"Name",
"is",
"what",
"is",
"displayed",
"in",
"Windows",
"when",
"services",
".",
"msc",
"is",
"executed",
".",
"Each",
"Display",
"Name",
"has",
"an",
"associated",
"Service",
"Name",
"which",
"is",
"the",
"actual",
"name",
"of",
"the",... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L447-L482 | [
"def",
"get_service_name",
"(",
"*",
"args",
")",
":",
"raw_services",
"=",
"_get_services",
"(",
")",
"services",
"=",
"dict",
"(",
")",
"for",
"raw_service",
"in",
"raw_services",
":",
"if",
"args",
":",
"if",
"raw_service",
"[",
"'DisplayName'",
"]",
"i... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | info | Get information about a service on the system
Args:
name (str): The name of the service. This is not the display name. Use
``get_service_name`` to find the service name.
Returns:
dict: A dictionary containing information about the service.
CLI Example:
.. code-block:: bas... | salt/modules/win_service.py | def info(name):
'''
Get information about a service on the system
Args:
name (str): The name of the service. This is not the display name. Use
``get_service_name`` to find the service name.
Returns:
dict: A dictionary containing information about the service.
CLI Examp... | def info(name):
'''
Get information about a service on the system
Args:
name (str): The name of the service. This is not the display name. Use
``get_service_name`` to find the service name.
Returns:
dict: A dictionary containing information about the service.
CLI Examp... | [
"Get",
"information",
"about",
"a",
"service",
"on",
"the",
"system"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L485-L591 | [
"def",
"info",
"(",
"name",
")",
":",
"try",
":",
"handle_scm",
"=",
"win32service",
".",
"OpenSCManager",
"(",
"None",
",",
"None",
",",
"win32service",
".",
"SC_MANAGER_CONNECT",
")",
"except",
"pywintypes",
".",
"error",
"as",
"exc",
":",
"raise",
"Comm... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | start | Start the specified service.
.. warning::
You cannot start a disabled service in Windows. If the service is
disabled, it will be changed to ``Manual`` start.
Args:
name (str): The name of the service to start
timeout (int):
The time in seconds to wait for the servi... | salt/modules/win_service.py | def start(name, timeout=90, with_deps=False, with_parents=False):
'''
Start the specified service.
.. warning::
You cannot start a disabled service in Windows. If the service is
disabled, it will be changed to ``Manual`` start.
Args:
name (str): The name of the service to start... | def start(name, timeout=90, with_deps=False, with_parents=False):
'''
Start the specified service.
.. warning::
You cannot start a disabled service in Windows. If the service is
disabled, it will be changed to ``Manual`` start.
Args:
name (str): The name of the service to start... | [
"Start",
"the",
"specified",
"service",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L594-L653 | [
"def",
"start",
"(",
"name",
",",
"timeout",
"=",
"90",
",",
"with_deps",
"=",
"False",
",",
"with_parents",
"=",
"False",
")",
":",
"# Set the service to manual if disabled",
"if",
"disabled",
"(",
"name",
")",
":",
"modify",
"(",
"name",
",",
"start_type",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | stop | Stop the specified service
Args:
name (str): The name of the service to stop
timeout (int):
The time in seconds to wait for the service to stop before
returning. Default is 90 seconds
.. versionadded:: 2017.7.9,2018.3.4
with_deps (bool):
If... | salt/modules/win_service.py | def stop(name, timeout=90, with_deps=False, with_parents=False):
'''
Stop the specified service
Args:
name (str): The name of the service to stop
timeout (int):
The time in seconds to wait for the service to stop before
returning. Default is 90 seconds
... | def stop(name, timeout=90, with_deps=False, with_parents=False):
'''
Stop the specified service
Args:
name (str): The name of the service to stop
timeout (int):
The time in seconds to wait for the service to stop before
returning. Default is 90 seconds
... | [
"Stop",
"the",
"specified",
"service"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L656-L708 | [
"def",
"stop",
"(",
"name",
",",
"timeout",
"=",
"90",
",",
"with_deps",
"=",
"False",
",",
"with_parents",
"=",
"False",
")",
":",
"ret",
"=",
"set",
"(",
")",
"services",
"=",
"ServiceDependencies",
"(",
"name",
",",
"get_all",
",",
"info",
")",
"s... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | restart | Restart the named service. This issues a stop command followed by a start.
Args:
name: The name of the service to restart.
.. note::
If the name passed is ``salt-minion`` a scheduled task is
created and executed to restart the salt-minion service.
timeo... | salt/modules/win_service.py | def restart(name, timeout=90, with_deps=False, with_parents=False):
'''
Restart the named service. This issues a stop command followed by a start.
Args:
name: The name of the service to restart.
.. note::
If the name passed is ``salt-minion`` a scheduled task is
... | def restart(name, timeout=90, with_deps=False, with_parents=False):
'''
Restart the named service. This issues a stop command followed by a start.
Args:
name: The name of the service to restart.
.. note::
If the name passed is ``salt-minion`` a scheduled task is
... | [
"Restart",
"the",
"named",
"service",
".",
"This",
"issues",
"a",
"stop",
"command",
"followed",
"by",
"a",
"start",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L711-L760 | [
"def",
"restart",
"(",
"name",
",",
"timeout",
"=",
"90",
",",
"with_deps",
"=",
"False",
",",
"with_parents",
"=",
"False",
")",
":",
"if",
"'salt-minion'",
"in",
"name",
":",
"create_win_salt_restart_task",
"(",
")",
"return",
"execute_salt_restart_task",
"(... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_win_salt_restart_task | Create a task in Windows task scheduler to enable restarting the salt-minion
Returns:
bool: ``True`` if successful, otherwise ``False``
CLI Example:
.. code-block:: bash
salt '*' service.create_win_salt_restart_task() | salt/modules/win_service.py | def create_win_salt_restart_task():
'''
Create a task in Windows task scheduler to enable restarting the salt-minion
Returns:
bool: ``True`` if successful, otherwise ``False``
CLI Example:
.. code-block:: bash
salt '*' service.create_win_salt_restart_task()
'''
cmd = 'cmd... | def create_win_salt_restart_task():
'''
Create a task in Windows task scheduler to enable restarting the salt-minion
Returns:
bool: ``True`` if successful, otherwise ``False``
CLI Example:
.. code-block:: bash
salt '*' service.create_win_salt_restart_task()
'''
cmd = 'cmd... | [
"Create",
"a",
"task",
"in",
"Windows",
"task",
"scheduler",
"to",
"enable",
"restarting",
"the",
"salt",
"-",
"minion"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L763-L787 | [
"def",
"create_win_salt_restart_task",
"(",
")",
":",
"cmd",
"=",
"'cmd'",
"args",
"=",
"'/c ping -n 3 127.0.0.1 && net stop salt-minion && net start '",
"'salt-minion'",
"return",
"__salt__",
"[",
"'task.create_task'",
"]",
"(",
"name",
"=",
"'restart-salt-minion'",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | status | Return the status for a service.
If the name contains globbing, a dict mapping service name to True/False
values is returned.
.. versionchanged:: 2018.3.0
The service name can now be a glob (e.g. ``salt*``)
Args:
name (str): The name of the service to check
Returns:
bool: ... | salt/modules/win_service.py | def status(name, *args, **kwargs):
'''
Return the status for a service.
If the name contains globbing, a dict mapping service name to True/False
values is returned.
.. versionchanged:: 2018.3.0
The service name can now be a glob (e.g. ``salt*``)
Args:
name (str): The name of th... | def status(name, *args, **kwargs):
'''
Return the status for a service.
If the name contains globbing, a dict mapping service name to True/False
values is returned.
.. versionchanged:: 2018.3.0
The service name can now be a glob (e.g. ``salt*``)
Args:
name (str): The name of th... | [
"Return",
"the",
"status",
"for",
"a",
"service",
".",
"If",
"the",
"name",
"contains",
"globbing",
"a",
"dict",
"mapping",
"service",
"name",
"to",
"True",
"/",
"False",
"values",
"is",
"returned",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L806-L840 | [
"def",
"status",
"(",
"name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"results",
"=",
"{",
"}",
"all_services",
"=",
"get_all",
"(",
")",
"contains_globbing",
"=",
"bool",
"(",
"re",
".",
"search",
"(",
"r'\\*|\\?|\\[.+\\]'",
",",
"name",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | modify | Modify a service's parameters. Changes will not be made for parameters that
are not passed.
.. versionadded:: 2016.11.0
Args:
name (str):
The name of the service. Can be found using the
``service.get_service_name`` function
bin_path (str):
The path to t... | salt/modules/win_service.py | def modify(name,
bin_path=None,
exe_args=None,
display_name=None,
description=None,
service_type=None,
start_type=None,
start_delayed=None,
error_control=None,
load_order_group=None,
dependencies=None,
... | def modify(name,
bin_path=None,
exe_args=None,
display_name=None,
description=None,
service_type=None,
start_type=None,
start_delayed=None,
error_control=None,
load_order_group=None,
dependencies=None,
... | [
"Modify",
"a",
"service",
"s",
"parameters",
".",
"Changes",
"will",
"not",
"be",
"made",
"for",
"parameters",
"that",
"are",
"not",
"passed",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L862-L1100 | [
"def",
"modify",
"(",
"name",
",",
"bin_path",
"=",
"None",
",",
"exe_args",
"=",
"None",
",",
"display_name",
"=",
"None",
",",
"description",
"=",
"None",
",",
"service_type",
"=",
"None",
",",
"start_type",
"=",
"None",
",",
"start_delayed",
"=",
"Non... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | enable | Enable the named service to start at boot
Args:
name (str): The name of the service to enable.
start_type (str): Specifies the service start type. Valid options are as
follows:
- boot: Device driver that is loaded by the boot loader
- system: Device driver that... | salt/modules/win_service.py | def enable(name, start_type='auto', start_delayed=False, **kwargs):
'''
Enable the named service to start at boot
Args:
name (str): The name of the service to enable.
start_type (str): Specifies the service start type. Valid options are as
follows:
- boot: Device d... | def enable(name, start_type='auto', start_delayed=False, **kwargs):
'''
Enable the named service to start at boot
Args:
name (str): The name of the service to enable.
start_type (str): Specifies the service start type. Valid options are as
follows:
- boot: Device d... | [
"Enable",
"the",
"named",
"service",
"to",
"start",
"at",
"boot"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L1103-L1139 | [
"def",
"enable",
"(",
"name",
",",
"start_type",
"=",
"'auto'",
",",
"start_delayed",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"modify",
"(",
"name",
",",
"start_type",
"=",
"start_type",
",",
"start_delayed",
"=",
"start_delayed",
")",
"svcstat",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create | Create the named service.
.. versionadded:: 2015.8.0
Args:
name (str):
Specifies the service name. This is not the display_name
bin_path (str):
Specifies the path to the service binary file. Backslashes must be
escaped, eg: ``C:\\path\\to\\binary.exe``
... | salt/modules/win_service.py | def create(name,
bin_path,
exe_args=None,
display_name=None,
description=None,
service_type='own',
start_type='manual',
start_delayed=False,
error_control='normal',
load_order_group=None,
dependencies=None,
... | def create(name,
bin_path,
exe_args=None,
display_name=None,
description=None,
service_type='own',
start_type='manual',
start_delayed=False,
error_control='normal',
load_order_group=None,
dependencies=None,
... | [
"Create",
"the",
"named",
"service",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L1200-L1391 | [
"def",
"create",
"(",
"name",
",",
"bin_path",
",",
"exe_args",
"=",
"None",
",",
"display_name",
"=",
"None",
",",
"description",
"=",
"None",
",",
"service_type",
"=",
"'own'",
",",
"start_type",
"=",
"'manual'",
",",
"start_delayed",
"=",
"False",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete | Delete the named service
Args:
name (str): The name of the service to delete
timeout (int):
The time in seconds to wait for the service to be deleted before
returning. This is necessary because a service must be stopped
before it can be deleted. Default is 90 s... | salt/modules/win_service.py | def delete(name, timeout=90):
'''
Delete the named service
Args:
name (str): The name of the service to delete
timeout (int):
The time in seconds to wait for the service to be deleted before
returning. This is necessary because a service must be stopped
... | def delete(name, timeout=90):
'''
Delete the named service
Args:
name (str): The name of the service to delete
timeout (int):
The time in seconds to wait for the service to be deleted before
returning. This is necessary because a service must be stopped
... | [
"Delete",
"the",
"named",
"service"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L1394-L1447 | [
"def",
"delete",
"(",
"name",
",",
"timeout",
"=",
"90",
")",
":",
"handle_scm",
"=",
"win32service",
".",
"OpenSCManager",
"(",
"None",
",",
"None",
",",
"win32service",
".",
"SC_MANAGER_CONNECT",
")",
"try",
":",
"handle_svc",
"=",
"win32service",
".",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_conn | Return a conn object for the passed VM data | salt/cloud/clouds/cloudstack.py | def get_conn():
'''
Return a conn object for the passed VM data
'''
driver = get_driver(Provider.CLOUDSTACK)
verify_ssl_cert = config.get_cloud_config_value('verify_ssl_cert',
get_configured_provider(),
__opts__,
default=True,
search_global=False)
... | def get_conn():
'''
Return a conn object for the passed VM data
'''
driver = get_driver(Provider.CLOUDSTACK)
verify_ssl_cert = config.get_cloud_config_value('verify_ssl_cert',
get_configured_provider(),
__opts__,
default=True,
search_global=False)
... | [
"Return",
"a",
"conn",
"object",
"for",
"the",
"passed",
"VM",
"data"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/cloudstack.py#L112-L156 | [
"def",
"get_conn",
"(",
")",
":",
"driver",
"=",
"get_driver",
"(",
"Provider",
".",
"CLOUDSTACK",
")",
"verify_ssl_cert",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'verify_ssl_cert'",
",",
"get_configured_provider",
"(",
")",
",",
"__opts__",
",",
"de... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_location | Return the node location to use | salt/cloud/clouds/cloudstack.py | def get_location(conn, vm_):
'''
Return the node location to use
'''
locations = conn.list_locations()
# Default to Dallas if not otherwise set
loc = config.get_cloud_config_value('location', vm_, __opts__, default=2)
for location in locations:
if six.text_type(loc) in (six.text_type... | def get_location(conn, vm_):
'''
Return the node location to use
'''
locations = conn.list_locations()
# Default to Dallas if not otherwise set
loc = config.get_cloud_config_value('location', vm_, __opts__, default=2)
for location in locations:
if six.text_type(loc) in (six.text_type... | [
"Return",
"the",
"node",
"location",
"to",
"use"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/cloudstack.py#L159-L168 | [
"def",
"get_location",
"(",
"conn",
",",
"vm_",
")",
":",
"locations",
"=",
"conn",
".",
"list_locations",
"(",
")",
"# Default to Dallas if not otherwise set",
"loc",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'location'",
",",
"vm_",
",",
"__opts__",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_security_groups | Return a list of security groups to use, defaulting to ['default'] | salt/cloud/clouds/cloudstack.py | def get_security_groups(conn, vm_):
'''
Return a list of security groups to use, defaulting to ['default']
'''
securitygroup_enabled = config.get_cloud_config_value(
'securitygroup_enabled', vm_, __opts__, default=True
)
if securitygroup_enabled:
return config.get_cloud_config_va... | def get_security_groups(conn, vm_):
'''
Return a list of security groups to use, defaulting to ['default']
'''
securitygroup_enabled = config.get_cloud_config_value(
'securitygroup_enabled', vm_, __opts__, default=True
)
if securitygroup_enabled:
return config.get_cloud_config_va... | [
"Return",
"a",
"list",
"of",
"security",
"groups",
"to",
"use",
"defaulting",
"to",
"[",
"default",
"]"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/cloudstack.py#L171-L183 | [
"def",
"get_security_groups",
"(",
"conn",
",",
"vm_",
")",
":",
"securitygroup_enabled",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'securitygroup_enabled'",
",",
"vm_",
",",
"__opts__",
",",
"default",
"=",
"True",
")",
"if",
"securitygroup_enabled",
":... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_keypair | Return the keypair to use | salt/cloud/clouds/cloudstack.py | def get_keypair(vm_):
'''
Return the keypair to use
'''
keypair = config.get_cloud_config_value('keypair', vm_, __opts__)
if keypair:
return keypair
else:
return False | def get_keypair(vm_):
'''
Return the keypair to use
'''
keypair = config.get_cloud_config_value('keypair', vm_, __opts__)
if keypair:
return keypair
else:
return False | [
"Return",
"the",
"keypair",
"to",
"use"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/cloudstack.py#L206-L215 | [
"def",
"get_keypair",
"(",
"vm_",
")",
":",
"keypair",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'keypair'",
",",
"vm_",
",",
"__opts__",
")",
"if",
"keypair",
":",
"return",
"keypair",
"else",
":",
"return",
"False"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_ip | Return the IP address of the VM
If the VM has public IP as defined by libcloud module then use it
Otherwise try to extract the private IP and use that one. | salt/cloud/clouds/cloudstack.py | def get_ip(data):
'''
Return the IP address of the VM
If the VM has public IP as defined by libcloud module then use it
Otherwise try to extract the private IP and use that one.
'''
try:
ip = data.public_ips[0]
except Exception:
ip = data.private_ips[0]
return ip | def get_ip(data):
'''
Return the IP address of the VM
If the VM has public IP as defined by libcloud module then use it
Otherwise try to extract the private IP and use that one.
'''
try:
ip = data.public_ips[0]
except Exception:
ip = data.private_ips[0]
return ip | [
"Return",
"the",
"IP",
"address",
"of",
"the",
"VM",
"If",
"the",
"VM",
"has",
"public",
"IP",
"as",
"defined",
"by",
"libcloud",
"module",
"then",
"use",
"it",
"Otherwise",
"try",
"to",
"extract",
"the",
"private",
"IP",
"and",
"use",
"that",
"one",
"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/cloudstack.py#L218-L228 | [
"def",
"get_ip",
"(",
"data",
")",
":",
"try",
":",
"ip",
"=",
"data",
".",
"public_ips",
"[",
"0",
"]",
"except",
"Exception",
":",
"ip",
"=",
"data",
".",
"private_ips",
"[",
"0",
"]",
"return",
"ip"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_networkid | Return the networkid to use, only valid for Advanced Zone | salt/cloud/clouds/cloudstack.py | def get_networkid(vm_):
'''
Return the networkid to use, only valid for Advanced Zone
'''
networkid = config.get_cloud_config_value('networkid', vm_, __opts__)
if networkid is not None:
return networkid
else:
return False | def get_networkid(vm_):
'''
Return the networkid to use, only valid for Advanced Zone
'''
networkid = config.get_cloud_config_value('networkid', vm_, __opts__)
if networkid is not None:
return networkid
else:
return False | [
"Return",
"the",
"networkid",
"to",
"use",
"only",
"valid",
"for",
"Advanced",
"Zone"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/cloudstack.py#L231-L240 | [
"def",
"get_networkid",
"(",
"vm_",
")",
":",
"networkid",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'networkid'",
",",
"vm_",
",",
"__opts__",
")",
"if",
"networkid",
"is",
"not",
"None",
":",
"return",
"networkid",
"else",
":",
"return",
"False"
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_project | Return the project to use. | salt/cloud/clouds/cloudstack.py | def get_project(conn, vm_):
'''
Return the project to use.
'''
try:
projects = conn.ex_list_projects()
except AttributeError:
# with versions <0.15 of libcloud this is causing an AttributeError.
log.warning('Cannot get projects, you may need to update libcloud to 0.15 or late... | def get_project(conn, vm_):
'''
Return the project to use.
'''
try:
projects = conn.ex_list_projects()
except AttributeError:
# with versions <0.15 of libcloud this is causing an AttributeError.
log.warning('Cannot get projects, you may need to update libcloud to 0.15 or late... | [
"Return",
"the",
"project",
"to",
"use",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/cloudstack.py#L243-L263 | [
"def",
"get_project",
"(",
"conn",
",",
"vm_",
")",
":",
"try",
":",
"projects",
"=",
"conn",
".",
"ex_list_projects",
"(",
")",
"except",
"AttributeError",
":",
"# with versions <0.15 of libcloud this is causing an AttributeError.",
"log",
".",
"warning",
"(",
"'Ca... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create | Create a single VM from a data dict | salt/cloud/clouds/cloudstack.py | def create(vm_):
'''
Create a single VM from a data dict
'''
try:
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'clo... | def create(vm_):
'''
Create a single VM from a data dict
'''
try:
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'clo... | [
"Create",
"a",
"single",
"VM",
"from",
"a",
"data",
"dict"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/cloudstack.py#L266-L431 | [
"def",
"create",
"(",
"vm_",
")",
":",
"try",
":",
"# Check for required profile parameters before sending any API calls.",
"if",
"vm_",
"[",
"'profile'",
"]",
"and",
"config",
".",
"is_profile_configured",
"(",
"__opts__",
",",
"__active_provider_name__",
"or",
"'cloud... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | destroy | Delete a single VM, and all of its volumes | salt/cloud/clouds/cloudstack.py | def destroy(name, conn=None, call=None):
'''
Delete a single VM, and all of its volumes
'''
if call == 'function':
raise SaltCloudSystemExit(
'The destroy action must be called with -d, --destroy, '
'-a or --action.'
)
__utils__['cloud.fire_event'](
'... | def destroy(name, conn=None, call=None):
'''
Delete a single VM, and all of its volumes
'''
if call == 'function':
raise SaltCloudSystemExit(
'The destroy action must be called with -d, --destroy, '
'-a or --action.'
)
__utils__['cloud.fire_event'](
'... | [
"Delete",
"a",
"single",
"VM",
"and",
"all",
"of",
"its",
"volumes"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/cloudstack.py#L434-L525 | [
"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 | get | Return system rc configuration variables
CLI Example:
.. code-block:: bash
salt '*' sysrc.get includeDefaults=True | salt/modules/sysrc.py | def get(**kwargs):
'''
Return system rc configuration variables
CLI Example:
.. code-block:: bash
salt '*' sysrc.get includeDefaults=True
'''
cmd = 'sysrc -v'
if 'file' in kwargs:
cmd += ' -f '+kwargs['file']
if 'jail' in kwargs:
cmd += ' -j '+kwargs['jail... | def get(**kwargs):
'''
Return system rc configuration variables
CLI Example:
.. code-block:: bash
salt '*' sysrc.get includeDefaults=True
'''
cmd = 'sysrc -v'
if 'file' in kwargs:
cmd += ' -f '+kwargs['file']
if 'jail' in kwargs:
cmd += ' -j '+kwargs['jail... | [
"Return",
"system",
"rc",
"configuration",
"variables"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysrc.py#L30-L74 | [
"def",
"get",
"(",
"*",
"*",
"kwargs",
")",
":",
"cmd",
"=",
"'sysrc -v'",
"if",
"'file'",
"in",
"kwargs",
":",
"cmd",
"+=",
"' -f '",
"+",
"kwargs",
"[",
"'file'",
"]",
"if",
"'jail'",
"in",
"kwargs",
":",
"cmd",
"+=",
"' -j '",
"+",
"kwargs",
"["... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_ | Set system rc configuration variables
CLI Example:
.. code-block:: bash
salt '*' sysrc.set name=sshd_flags value="-p 2222" | salt/modules/sysrc.py | def set_(name, value, **kwargs):
'''
Set system rc configuration variables
CLI Example:
.. code-block:: bash
salt '*' sysrc.set name=sshd_flags value="-p 2222"
'''
cmd = 'sysrc -v'
if 'file' in kwargs:
cmd += ' -f '+kwargs['file']
if 'jail' in kwargs:
cmd ... | def set_(name, value, **kwargs):
'''
Set system rc configuration variables
CLI Example:
.. code-block:: bash
salt '*' sysrc.set name=sshd_flags value="-p 2222"
'''
cmd = 'sysrc -v'
if 'file' in kwargs:
cmd += ' -f '+kwargs['file']
if 'jail' in kwargs:
cmd ... | [
"Set",
"system",
"rc",
"configuration",
"variables"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysrc.py#L77-L123 | [
"def",
"set_",
"(",
"name",
",",
"value",
",",
"*",
"*",
"kwargs",
")",
":",
"cmd",
"=",
"'sysrc -v'",
"if",
"'file'",
"in",
"kwargs",
":",
"cmd",
"+=",
"' -f '",
"+",
"kwargs",
"[",
"'file'",
"]",
"if",
"'jail'",
"in",
"kwargs",
":",
"cmd",
"+=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove | Remove system rc configuration variables
CLI Example:
.. code-block:: bash
salt '*' sysrc.remove name=sshd_enable | salt/modules/sysrc.py | def remove(name, **kwargs):
'''
Remove system rc configuration variables
CLI Example:
.. code-block:: bash
salt '*' sysrc.remove name=sshd_enable
'''
cmd = 'sysrc -v'
if 'file' in kwargs:
cmd += ' -f '+kwargs['file']
if 'jail' in kwargs:
cmd += ' -j '+kwar... | def remove(name, **kwargs):
'''
Remove system rc configuration variables
CLI Example:
.. code-block:: bash
salt '*' sysrc.remove name=sshd_enable
'''
cmd = 'sysrc -v'
if 'file' in kwargs:
cmd += ' -f '+kwargs['file']
if 'jail' in kwargs:
cmd += ' -j '+kwar... | [
"Remove",
"system",
"rc",
"configuration",
"variables"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysrc.py#L126-L151 | [
"def",
"remove",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"cmd",
"=",
"'sysrc -v'",
"if",
"'file'",
"in",
"kwargs",
":",
"cmd",
"+=",
"' -f '",
"+",
"kwargs",
"[",
"'file'",
"]",
"if",
"'jail'",
"in",
"kwargs",
":",
"cmd",
"+=",
"' -j '",
"+... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create | Create a single VM from a data dict | salt/cloud/clouds/dimensiondata.py | def create(vm_):
'''
Create a single VM from a data dict
'''
try:
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(
__opts__,
__active_provider_name__ or 'dimensiondata',
... | def create(vm_):
'''
Create a single VM from a data dict
'''
try:
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(
__opts__,
__active_provider_name__ or 'dimensiondata',
... | [
"Create",
"a",
"single",
"VM",
"from",
"a",
"data",
"dict"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/dimensiondata.py#L193-L346 | [
"def",
"create",
"(",
"vm_",
")",
":",
"try",
":",
"# Check for required profile parameters before sending any API calls.",
"if",
"vm_",
"[",
"'profile'",
"]",
"and",
"config",
".",
"is_profile_configured",
"(",
"__opts__",
",",
"__active_provider_name__",
"or",
"'dimen... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_lb | r'''
Create a load-balancer configuration.
CLI Example:
.. code-block:: bash
salt-cloud -f create_lb dimensiondata \
name=dev-lb port=80 protocol=http \
members=w1,w2,w3 algorithm=ROUND_ROBIN | salt/cloud/clouds/dimensiondata.py | def create_lb(kwargs=None, call=None):
r'''
Create a load-balancer configuration.
CLI Example:
.. code-block:: bash
salt-cloud -f create_lb dimensiondata \
name=dev-lb port=80 protocol=http \
members=w1,w2,w3 algorithm=ROUND_ROBIN
'''
conn = get_conn()
if ca... | def create_lb(kwargs=None, call=None):
r'''
Create a load-balancer configuration.
CLI Example:
.. code-block:: bash
salt-cloud -f create_lb dimensiondata \
name=dev-lb port=80 protocol=http \
members=w1,w2,w3 algorithm=ROUND_ROBIN
'''
conn = get_conn()
if ca... | [
"r",
"Create",
"a",
"load",
"-",
"balancer",
"configuration",
".",
"CLI",
"Example",
":"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/dimensiondata.py#L349-L441 | [
"def",
"create_lb",
"(",
"kwargs",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"conn",
"=",
"get_conn",
"(",
")",
"if",
"call",
"!=",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The create_lb function must be called with -f or --function.'",
")"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | stop | Stop a VM in DimensionData.
name:
The name of the VM to stop.
CLI Example:
.. code-block:: bash
salt-cloud -a stop vm_name | salt/cloud/clouds/dimensiondata.py | def stop(name, call=None):
'''
Stop a VM in DimensionData.
name:
The name of the VM to stop.
CLI Example:
.. code-block:: bash
salt-cloud -a stop vm_name
'''
conn = get_conn()
node = get_node(conn, name) # pylint: disable=not-callable
log.debug('Node of Cloud VM:... | def stop(name, call=None):
'''
Stop a VM in DimensionData.
name:
The name of the VM to stop.
CLI Example:
.. code-block:: bash
salt-cloud -a stop vm_name
'''
conn = get_conn()
node = get_node(conn, name) # pylint: disable=not-callable
log.debug('Node of Cloud VM:... | [
"Stop",
"a",
"VM",
"in",
"DimensionData",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/dimensiondata.py#L483-L503 | [
"def",
"stop",
"(",
"name",
",",
"call",
"=",
"None",
")",
":",
"conn",
"=",
"get_conn",
"(",
")",
"node",
"=",
"get_node",
"(",
"conn",
",",
"name",
")",
"# pylint: disable=not-callable",
"log",
".",
"debug",
"(",
"'Node of Cloud VM: %s'",
",",
"node",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | start | Stop a VM in DimensionData.
:param str name:
The name of the VM to stop.
CLI Example:
.. code-block:: bash
salt-cloud -a stop vm_name | salt/cloud/clouds/dimensiondata.py | def start(name, call=None):
'''
Stop a VM in DimensionData.
:param str name:
The name of the VM to stop.
CLI Example:
.. code-block:: bash
salt-cloud -a stop vm_name
'''
conn = get_conn()
node = get_node(conn, name) # pylint: disable=not-callable
log.debug('Node... | def start(name, call=None):
'''
Stop a VM in DimensionData.
:param str name:
The name of the VM to stop.
CLI Example:
.. code-block:: bash
salt-cloud -a stop vm_name
'''
conn = get_conn()
node = get_node(conn, name) # pylint: disable=not-callable
log.debug('Node... | [
"Stop",
"a",
"VM",
"in",
"DimensionData",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/dimensiondata.py#L506-L527 | [
"def",
"start",
"(",
"name",
",",
"call",
"=",
"None",
")",
":",
"conn",
"=",
"get_conn",
"(",
")",
"node",
"=",
"get_node",
"(",
"conn",
",",
"name",
")",
"# pylint: disable=not-callable",
"log",
".",
"debug",
"(",
"'Node of Cloud VM: %s'",
",",
"node",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_conn | Return a conn object for the passed VM data | salt/cloud/clouds/dimensiondata.py | def get_conn():
'''
Return a conn object for the passed VM data
'''
vm_ = get_configured_provider()
driver = get_driver(Provider.DIMENSIONDATA)
region = config.get_cloud_config_value(
'region', vm_, __opts__
)
user_id = config.get_cloud_config_value(
'user_id', vm_, __... | def get_conn():
'''
Return a conn object for the passed VM data
'''
vm_ = get_configured_provider()
driver = get_driver(Provider.DIMENSIONDATA)
region = config.get_cloud_config_value(
'region', vm_, __opts__
)
user_id = config.get_cloud_config_value(
'user_id', vm_, __... | [
"Return",
"a",
"conn",
"object",
"for",
"the",
"passed",
"VM",
"data"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/dimensiondata.py#L530-L555 | [
"def",
"get_conn",
"(",
")",
":",
"vm_",
"=",
"get_configured_provider",
"(",
")",
"driver",
"=",
"get_driver",
"(",
"Provider",
".",
"DIMENSIONDATA",
")",
"region",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'region'",
",",
"vm_",
",",
"__opts__",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_lb_conn | Return a load-balancer conn object | salt/cloud/clouds/dimensiondata.py | def get_lb_conn(dd_driver=None):
'''
Return a load-balancer conn object
'''
vm_ = get_configured_provider()
region = config.get_cloud_config_value(
'region', vm_, __opts__
)
user_id = config.get_cloud_config_value(
'user_id', vm_, __opts__
)
key = config.get_cloud_co... | def get_lb_conn(dd_driver=None):
'''
Return a load-balancer conn object
'''
vm_ = get_configured_provider()
region = config.get_cloud_config_value(
'region', vm_, __opts__
)
user_id = config.get_cloud_config_value(
'user_id', vm_, __opts__
)
key = config.get_cloud_co... | [
"Return",
"a",
"load",
"-",
"balancer",
"conn",
"object"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/dimensiondata.py#L558-L578 | [
"def",
"get_lb_conn",
"(",
"dd_driver",
"=",
"None",
")",
":",
"vm_",
"=",
"get_configured_provider",
"(",
")",
"region",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'region'",
",",
"vm_",
",",
"__opts__",
")",
"user_id",
"=",
"config",
".",
"get_clo... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _to_event_data | Convert the specified object into a form that can be serialised by msgpack as event data.
:param obj: The object to convert. | salt/cloud/clouds/dimensiondata.py | def _to_event_data(obj):
'''
Convert the specified object into a form that can be serialised by msgpack as event data.
:param obj: The object to convert.
'''
if obj is None:
return None
if isinstance(obj, bool):
return obj
if isinstance(obj, int):
return obj
if ... | def _to_event_data(obj):
'''
Convert the specified object into a form that can be serialised by msgpack as event data.
:param obj: The object to convert.
'''
if obj is None:
return None
if isinstance(obj, bool):
return obj
if isinstance(obj, int):
return obj
if ... | [
"Convert",
"the",
"specified",
"object",
"into",
"a",
"form",
"that",
"can",
"be",
"serialised",
"by",
"msgpack",
"as",
"event",
"data",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/dimensiondata.py#L581-L621 | [
"def",
"_to_event_data",
"(",
"obj",
")",
":",
"if",
"obj",
"is",
"None",
":",
"return",
"None",
"if",
"isinstance",
"(",
"obj",
",",
"bool",
")",
":",
"return",
"obj",
"if",
"isinstance",
"(",
"obj",
",",
"int",
")",
":",
"return",
"obj",
"if",
"i... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | package_install | Install a "package" on the REST server | salt/proxy/dummy.py | def package_install(name, **kwargs):
'''
Install a "package" on the REST server
'''
DETAILS = _load_state()
if kwargs.get('version', False):
version = kwargs['version']
else:
version = '1.0'
DETAILS['packages'][name] = version
_save_state(DETAILS)
return {name: versio... | def package_install(name, **kwargs):
'''
Install a "package" on the REST server
'''
DETAILS = _load_state()
if kwargs.get('version', False):
version = kwargs['version']
else:
version = '1.0'
DETAILS['packages'][name] = version
_save_state(DETAILS)
return {name: versio... | [
"Install",
"a",
"package",
"on",
"the",
"REST",
"server"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/dummy.py#L164-L175 | [
"def",
"package_install",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"DETAILS",
"=",
"_load_state",
"(",
")",
"if",
"kwargs",
".",
"get",
"(",
"'version'",
",",
"False",
")",
":",
"version",
"=",
"kwargs",
"[",
"'version'",
"]",
"else",
":",
"ve... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.