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
upgrade_available
.. versionadded:: 2015.5.0 Check whether or not an upgrade is available for a given package CLI Example: .. code-block:: bash salt '*' pip.upgrade_available <package name>
salt/modules/pip.py
def upgrade_available(pkg, bin_env=None, user=None, cwd=None): ''' .. versionadded:: 2015.5.0 Check whether or not an upgrade is available for a given package CLI Example: .. code-block:: bash salt '*' pip.upgrade_availabl...
def upgrade_available(pkg, bin_env=None, user=None, cwd=None): ''' .. versionadded:: 2015.5.0 Check whether or not an upgrade is available for a given package CLI Example: .. code-block:: bash salt '*' pip.upgrade_availabl...
[ "..", "versionadded", "::", "2015", ".", "5", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L1390-L1405
[ "def", "upgrade_available", "(", "pkg", ",", "bin_env", "=", "None", ",", "user", "=", "None", ",", "cwd", "=", "None", ")", ":", "return", "pkg", "in", "list_upgrades", "(", "bin_env", "=", "bin_env", ",", "user", "=", "user", ",", "cwd", "=", "cwd"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
upgrade
.. versionadded:: 2015.5.0 Upgrades outdated pip packages. .. note:: On Windows you can't update salt from pip using salt, so salt will be skipped Returns a dict containing the changes. {'<package>': {'old': '<old-version>', 'new': '<new-version>'}} ...
salt/modules/pip.py
def upgrade(bin_env=None, user=None, cwd=None, use_vt=False): ''' .. versionadded:: 2015.5.0 Upgrades outdated pip packages. .. note:: On Windows you can't update salt from pip using salt, so salt will be skipped Returns a dict containing the ch...
def upgrade(bin_env=None, user=None, cwd=None, use_vt=False): ''' .. versionadded:: 2015.5.0 Upgrades outdated pip packages. .. note:: On Windows you can't update salt from pip using salt, so salt will be skipped Returns a dict containing the ch...
[ "..", "versionadded", "::", "2015", ".", "5", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L1408-L1463
[ "def", "upgrade", "(", "bin_env", "=", "None", ",", "user", "=", "None", ",", "cwd", "=", "None", ",", "use_vt", "=", "False", ")", ":", "ret", "=", "{", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", ",", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_all_versions
.. versionadded:: 2017.7.3 List all available versions of a pip package pkg The package to check bin_env Path to pip (or to a virtualenv). This can be used to specify the path to the pip to use when more than one Python release is installed (e.g. ``/usr/bin/pip-2.7`` or ``...
salt/modules/pip.py
def list_all_versions(pkg, bin_env=None, include_alpha=False, include_beta=False, include_rc=False, user=None, cwd=None, index_url=None, extra_i...
def list_all_versions(pkg, bin_env=None, include_alpha=False, include_beta=False, include_rc=False, user=None, cwd=None, index_url=None, extra_i...
[ "..", "versionadded", "::", "2017", ".", "7", ".", "3" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L1466-L1563
[ "def", "list_all_versions", "(", "pkg", ",", "bin_env", "=", "None", ",", "include_alpha", "=", "False", ",", "include_beta", "=", "False", ",", "include_rc", "=", "False", ",", "user", "=", "None", ",", "cwd", "=", "None", ",", "index_url", "=", "None",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
verify_certs
Sanity checking for the specified SSL certificates
salt/netapi/rest_cherrypy/__init__.py
def verify_certs(*args): ''' Sanity checking for the specified SSL certificates ''' msg = ("Could not find a certificate: {0}\n" "If you want to quickly generate a self-signed certificate, " "use the tls.create_self_signed_cert function in Salt") for arg in args: if ...
def verify_certs(*args): ''' Sanity checking for the specified SSL certificates ''' msg = ("Could not find a certificate: {0}\n" "If you want to quickly generate a self-signed certificate, " "use the tls.create_self_signed_cert function in Salt") for arg in args: if ...
[ "Sanity", "checking", "for", "the", "specified", "SSL", "certificates" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/__init__.py#L62-L72
[ "def", "verify_certs", "(", "*", "args", ")", ":", "msg", "=", "(", "\"Could not find a certificate: {0}\\n\"", "\"If you want to quickly generate a self-signed certificate, \"", "\"use the tls.create_self_signed_cert function in Salt\"", ")", "for", "arg", "in", "args", ":", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
start
Start the server loop
salt/netapi/rest_cherrypy/__init__.py
def start(): ''' Start the server loop ''' from . import app root, apiopts, conf = app.get_app(__opts__) if not apiopts.get('disable_ssl', False): if 'ssl_crt' not in apiopts or 'ssl_key' not in apiopts: logger.error("Not starting '%s'. Options 'ssl_crt' and " ...
def start(): ''' Start the server loop ''' from . import app root, apiopts, conf = app.get_app(__opts__) if not apiopts.get('disable_ssl', False): if 'ssl_crt' not in apiopts or 'ssl_key' not in apiopts: logger.error("Not starting '%s'. Options 'ssl_crt' and " ...
[ "Start", "the", "server", "loop" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/__init__.py#L75-L98
[ "def", "start", "(", ")", ":", "from", ".", "import", "app", "root", ",", "apiopts", ",", "conf", "=", "app", ".", "get_app", "(", "__opts__", ")", "if", "not", "apiopts", ".", "get", "(", "'disable_ssl'", ",", "False", ")", ":", "if", "'ssl_crt'", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_osarch
Get the os architecture using rpm --eval
salt/utils/pkg/rpm.py
def get_osarch(): ''' Get the os architecture using rpm --eval ''' if salt.utils.path.which('rpm'): ret = subprocess.Popen( 'rpm --eval "%{_host_cpu}"', shell=True, close_fds=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communi...
def get_osarch(): ''' Get the os architecture using rpm --eval ''' if salt.utils.path.which('rpm'): ret = subprocess.Popen( 'rpm --eval "%{_host_cpu}"', shell=True, close_fds=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communi...
[ "Get", "the", "os", "architecture", "using", "rpm", "--", "eval" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/rpm.py#L46-L60
[ "def", "get_osarch", "(", ")", ":", "if", "salt", ".", "utils", ".", "path", ".", "which", "(", "'rpm'", ")", ":", "ret", "=", "subprocess", ".", "Popen", "(", "'rpm --eval \"%{_host_cpu}\"'", ",", "shell", "=", "True", ",", "close_fds", "=", "True", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
check_32
Returns True if both the OS arch and the passed arch are 32-bit
salt/utils/pkg/rpm.py
def check_32(arch, osarch=None): ''' Returns True if both the OS arch and the passed arch are 32-bit ''' if osarch is None: osarch = get_osarch() return all(x in ARCHES_32 for x in (osarch, arch))
def check_32(arch, osarch=None): ''' Returns True if both the OS arch and the passed arch are 32-bit ''' if osarch is None: osarch = get_osarch() return all(x in ARCHES_32 for x in (osarch, arch))
[ "Returns", "True", "if", "both", "the", "OS", "arch", "and", "the", "passed", "arch", "are", "32", "-", "bit" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/rpm.py#L63-L69
[ "def", "check_32", "(", "arch", ",", "osarch", "=", "None", ")", ":", "if", "osarch", "is", "None", ":", "osarch", "=", "get_osarch", "(", ")", "return", "all", "(", "x", "in", "ARCHES_32", "for", "x", "in", "(", "osarch", ",", "arch", ")", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
pkginfo
Build and return a pkginfo namedtuple
salt/utils/pkg/rpm.py
def pkginfo(name, version, arch, repoid, install_date=None, install_date_time_t=None): ''' Build and return a pkginfo namedtuple ''' pkginfo_tuple = collections.namedtuple( 'PkgInfo', ('name', 'version', 'arch', 'repoid', 'install_date', 'install_date_time_t') ) return p...
def pkginfo(name, version, arch, repoid, install_date=None, install_date_time_t=None): ''' Build and return a pkginfo namedtuple ''' pkginfo_tuple = collections.namedtuple( 'PkgInfo', ('name', 'version', 'arch', 'repoid', 'install_date', 'install_date_time_t') ) return p...
[ "Build", "and", "return", "a", "pkginfo", "namedtuple" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/rpm.py#L72-L82
[ "def", "pkginfo", "(", "name", ",", "version", ",", "arch", ",", "repoid", ",", "install_date", "=", "None", ",", "install_date_time_t", "=", "None", ")", ":", "pkginfo_tuple", "=", "collections", ".", "namedtuple", "(", "'PkgInfo'", ",", "(", "'name'", ",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
resolve_name
Resolve the package name and arch into a unique name referred to by salt. For example, on a 64-bit OS, a 32-bit package will be pkgname.i386.
salt/utils/pkg/rpm.py
def resolve_name(name, arch, osarch=None): ''' Resolve the package name and arch into a unique name referred to by salt. For example, on a 64-bit OS, a 32-bit package will be pkgname.i386. ''' if osarch is None: osarch = get_osarch() if not check_32(arch, osarch) and arch not in (ARCHMA...
def resolve_name(name, arch, osarch=None): ''' Resolve the package name and arch into a unique name referred to by salt. For example, on a 64-bit OS, a 32-bit package will be pkgname.i386. ''' if osarch is None: osarch = get_osarch() if not check_32(arch, osarch) and arch not in (ARCHMA...
[ "Resolve", "the", "package", "name", "and", "arch", "into", "a", "unique", "name", "referred", "to", "by", "salt", ".", "For", "example", "on", "a", "64", "-", "bit", "OS", "a", "32", "-", "bit", "package", "will", "be", "pkgname", ".", "i386", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/rpm.py#L85-L95
[ "def", "resolve_name", "(", "name", ",", "arch", ",", "osarch", "=", "None", ")", ":", "if", "osarch", "is", "None", ":", "osarch", "=", "get_osarch", "(", ")", "if", "not", "check_32", "(", "arch", ",", "osarch", ")", "and", "arch", "not", "in", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
parse_pkginfo
A small helper to parse an rpm/repoquery command's output. Returns a pkginfo namedtuple.
salt/utils/pkg/rpm.py
def parse_pkginfo(line, osarch=None): ''' A small helper to parse an rpm/repoquery command's output. Returns a pkginfo namedtuple. ''' try: name, epoch, version, release, arch, repoid, install_time = line.split('_|-') # Handle unpack errors (should never happen with the queryformat we ar...
def parse_pkginfo(line, osarch=None): ''' A small helper to parse an rpm/repoquery command's output. Returns a pkginfo namedtuple. ''' try: name, epoch, version, release, arch, repoid, install_time = line.split('_|-') # Handle unpack errors (should never happen with the queryformat we ar...
[ "A", "small", "helper", "to", "parse", "an", "rpm", "/", "repoquery", "command", "s", "output", ".", "Returns", "a", "pkginfo", "namedtuple", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/rpm.py#L98-L123
[ "def", "parse_pkginfo", "(", "line", ",", "osarch", "=", "None", ")", ":", "try", ":", "name", ",", "epoch", ",", "version", ",", "release", ",", "arch", ",", "repoid", ",", "install_time", "=", "line", ".", "split", "(", "'_|-'", ")", "# Handle unpack...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
combine_comments
Given a list of comments, strings, a single comment or a single string, return a single string of text containing all of the comments, prepending the '#' and joining with newlines as necessary.
salt/utils/pkg/rpm.py
def combine_comments(comments): ''' Given a list of comments, strings, a single comment or a single string, return a single string of text containing all of the comments, prepending the '#' and joining with newlines as necessary. ''' if not isinstance(comments, list): comments = [comment...
def combine_comments(comments): ''' Given a list of comments, strings, a single comment or a single string, return a single string of text containing all of the comments, prepending the '#' and joining with newlines as necessary. ''' if not isinstance(comments, list): comments = [comment...
[ "Given", "a", "list", "of", "comments", "strings", "a", "single", "comment", "or", "a", "single", "string", "return", "a", "single", "string", "of", "text", "containing", "all", "of", "the", "comments", "prepending", "the", "#", "and", "joining", "with", "...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/rpm.py#L126-L140
[ "def", "combine_comments", "(", "comments", ")", ":", "if", "not", "isinstance", "(", "comments", ",", "list", ")", ":", "comments", "=", "[", "comments", "]", "ret", "=", "[", "]", "for", "comment", "in", "comments", ":", "if", "not", "isinstance", "(...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
version_to_evr
Split the package version string into epoch, version and release. Return this as tuple. The epoch is always not empty. The version and the release can be an empty string if such a component could not be found in the version string. "2:1.0-1.2" => ('2', '1.0', '1.2) "1.0" => ('0', '1.0', '') ""...
salt/utils/pkg/rpm.py
def version_to_evr(verstring): ''' Split the package version string into epoch, version and release. Return this as tuple. The epoch is always not empty. The version and the release can be an empty string if such a component could not be found in the version string. "2:1.0-1.2" => ('2', '1.0',...
def version_to_evr(verstring): ''' Split the package version string into epoch, version and release. Return this as tuple. The epoch is always not empty. The version and the release can be an empty string if such a component could not be found in the version string. "2:1.0-1.2" => ('2', '1.0',...
[ "Split", "the", "package", "version", "string", "into", "epoch", "version", "and", "release", ".", "Return", "this", "as", "tuple", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/rpm.py#L143-L175
[ "def", "version_to_evr", "(", "verstring", ")", ":", "if", "verstring", "in", "[", "None", ",", "''", "]", ":", "return", "'0'", ",", "''", ",", "''", "idx_e", "=", "verstring", ".", "find", "(", "':'", ")", "if", "idx_e", "!=", "-", "1", ":", "t...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
present
Ensure the security group exists with the specified rules. name Name of the security group. description A description of this security group. vpc_id The ID of the VPC to create the security group in, if any. Exclusive with vpc_name. vpc_name The name of the VPC to cre...
salt/states/boto_secgroup.py
def present( name, description, vpc_id=None, vpc_name=None, rules=None, rules_egress=None, delete_ingress_rules=True, delete_egress_rules=True, region=None, key=None, keyid=None, profile=None, tags=None): ''' ...
def present( name, description, vpc_id=None, vpc_name=None, rules=None, rules_egress=None, delete_ingress_rules=True, delete_egress_rules=True, region=None, key=None, keyid=None, profile=None, tags=None): ''' ...
[ "Ensure", "the", "security", "group", "exists", "with", "the", "specified", "rules", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_secgroup.py#L127-L235
[ "def", "present", "(", "name", ",", "description", ",", "vpc_id", "=", "None", ",", "vpc_name", "=", "None", ",", "rules", "=", "None", ",", "rules_egress", "=", "None", ",", "delete_ingress_rules", "=", "True", ",", "delete_egress_rules", "=", "True", ","...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_security_group_present
given a group name or a group name and vpc id (or vpc name): 1. determine if the group exists 2. if the group does not exist, creates the group 3. return the group's configuration and any changes made
salt/states/boto_secgroup.py
def _security_group_present(name, description, vpc_id=None, vpc_name=None, region=None, key=None, keyid=None, profile=None): ''' given a group name or a group name and vpc id (or vpc name): 1. determine if the group exists 2. if the group does not exist, creates the group ...
def _security_group_present(name, description, vpc_id=None, vpc_name=None, region=None, key=None, keyid=None, profile=None): ''' given a group name or a group name and vpc id (or vpc name): 1. determine if the group exists 2. if the group does not exist, creates the group ...
[ "given", "a", "group", "name", "or", "a", "group", "name", "and", "vpc", "id", "(", "or", "vpc", "name", ")", ":", "1", ".", "determine", "if", "the", "group", "exists", "2", ".", "if", "the", "group", "does", "not", "exist", "creates", "the", "gro...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_secgroup.py#L238-L270
[ "def", "_security_group_present", "(", "name", ",", "description", ",", "vpc_id", "=", "None", ",", "vpc_name", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "ret", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_split_rules
Split rules with lists into individual rules. We accept some attributes as lists or strings. The data we get back from the execution module lists rules as individual rules. We need to split the provided rules into individual rules to compare them.
salt/states/boto_secgroup.py
def _split_rules(rules): ''' Split rules with lists into individual rules. We accept some attributes as lists or strings. The data we get back from the execution module lists rules as individual rules. We need to split the provided rules into individual rules to compare them. ''' split = []...
def _split_rules(rules): ''' Split rules with lists into individual rules. We accept some attributes as lists or strings. The data we get back from the execution module lists rules as individual rules. We need to split the provided rules into individual rules to compare them. ''' split = []...
[ "Split", "rules", "with", "lists", "into", "individual", "rules", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_secgroup.py#L273-L303
[ "def", "_split_rules", "(", "rules", ")", ":", "split", "=", "[", "]", "for", "rule", "in", "rules", ":", "cidr_ip", "=", "rule", ".", "get", "(", "'cidr_ip'", ")", "group_name", "=", "rule", ".", "get", "(", "'source_group_name'", ")", "group_id", "="...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_check_rule
Check to see if two rules are the same. Needed to compare rules fetched from boto, since they may not completely match rules defined in sls files but may be functionally equivalent.
salt/states/boto_secgroup.py
def _check_rule(rule, _rule): ''' Check to see if two rules are the same. Needed to compare rules fetched from boto, since they may not completely match rules defined in sls files but may be functionally equivalent. ''' # We need to alter what Boto returns if no ports are specified # so tha...
def _check_rule(rule, _rule): ''' Check to see if two rules are the same. Needed to compare rules fetched from boto, since they may not completely match rules defined in sls files but may be functionally equivalent. ''' # We need to alter what Boto returns if no ports are specified # so tha...
[ "Check", "to", "see", "if", "two", "rules", "are", "the", "same", ".", "Needed", "to", "compare", "rules", "fetched", "from", "boto", "since", "they", "may", "not", "completely", "match", "rules", "defined", "in", "sls", "files", "but", "may", "be", "fun...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_secgroup.py#L306-L338
[ "def", "_check_rule", "(", "rule", ",", "_rule", ")", ":", "# We need to alter what Boto returns if no ports are specified", "# so that we can compare rules fairly.", "#", "# Boto returns None for from_port and to_port where we're required", "# to pass in \"-1\" instead.", "if", "_rule",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_rule_changes
given a list of desired rules (rules) and existing rules (_rules) return a list of rules to delete (to_delete) and to create (to_create)
salt/states/boto_secgroup.py
def _get_rule_changes(rules, _rules): ''' given a list of desired rules (rules) and existing rules (_rules) return a list of rules to delete (to_delete) and to create (to_create) ''' to_delete = [] to_create = [] # for each rule in state file # 1. validate rule # 2. determine if rule...
def _get_rule_changes(rules, _rules): ''' given a list of desired rules (rules) and existing rules (_rules) return a list of rules to delete (to_delete) and to create (to_create) ''' to_delete = [] to_create = [] # for each rule in state file # 1. validate rule # 2. determine if rule...
[ "given", "a", "list", "of", "desired", "rules", "(", "rules", ")", "and", "existing", "rules", "(", "_rules", ")", "return", "a", "list", "of", "rules", "to", "delete", "(", "to_delete", ")", "and", "to", "create", "(", "to_create", ")" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_secgroup.py#L341-L405
[ "def", "_get_rule_changes", "(", "rules", ",", "_rules", ")", ":", "to_delete", "=", "[", "]", "to_create", "=", "[", "]", "# for each rule in state file", "# 1. validate rule", "# 2. determine if rule exists in existing security group rules", "for", "rule", "in", "rules"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_rules_present
given a group name or group name and vpc_id (or vpc name): 1. get lists of desired rule changes (using _get_rule_changes) 2. authorize/create rules missing rules 3. if delete_ingress_rules is True, delete/revoke non-requested rules 4. return 'old' and 'new' group rules
salt/states/boto_secgroup.py
def _rules_present(name, rules, delete_ingress_rules=True, vpc_id=None, vpc_name=None, region=None, key=None, keyid=None, profile=None): ''' given a group name or group name and vpc_id (or vpc name): 1. get lists of desired rule changes (using _get_rule_changes) 2. authorize/create ru...
def _rules_present(name, rules, delete_ingress_rules=True, vpc_id=None, vpc_name=None, region=None, key=None, keyid=None, profile=None): ''' given a group name or group name and vpc_id (or vpc name): 1. get lists of desired rule changes (using _get_rule_changes) 2. authorize/create ru...
[ "given", "a", "group", "name", "or", "group", "name", "and", "vpc_id", "(", "or", "vpc", "name", ")", ":", "1", ".", "get", "lists", "of", "desired", "rule", "changes", "(", "using", "_get_rule_changes", ")", "2", ".", "authorize", "/", "create", "rule...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_secgroup.py#L408-L499
[ "def", "_rules_present", "(", "name", ",", "rules", ",", "delete_ingress_rules", "=", "True", ",", "vpc_id", "=", "None", ",", "vpc_name", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
absent
Ensure a security group with the specified name does not exist. name Name of the security group. vpc_id The ID of the VPC to remove the security group from, if any. Exclusive with vpc_name. vpc_name The name of the VPC to remove the security group from, if any. Exclusive with vpc_...
salt/states/boto_secgroup.py
def absent( name, vpc_id=None, vpc_name=None, region=None, key=None, keyid=None, profile=None): ''' Ensure a security group with the specified name does not exist. name Name of the security group. vpc_id The ID of the VPC to remov...
def absent( name, vpc_id=None, vpc_name=None, region=None, key=None, keyid=None, profile=None): ''' Ensure a security group with the specified name does not exist. name Name of the security group. vpc_id The ID of the VPC to remov...
[ "Ensure", "a", "security", "group", "with", "the", "specified", "name", "does", "not", "exist", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_secgroup.py#L603-L663
[ "def", "absent", "(", "name", ",", "vpc_id", "=", "None", ",", "vpc_name", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_tags_present
helper function to validate tags are correct
salt/states/boto_secgroup.py
def _tags_present(name, tags, vpc_id=None, vpc_name=None, region=None, key=None, keyid=None, profile=None): ''' helper function to validate tags are correct ''' ret = {'result': True, 'comment': '', 'changes': {}} if tags: sg = __salt__['boto_secgroup.get_config'](name=name...
def _tags_present(name, tags, vpc_id=None, vpc_name=None, region=None, key=None, keyid=None, profile=None): ''' helper function to validate tags are correct ''' ret = {'result': True, 'comment': '', 'changes': {}} if tags: sg = __salt__['boto_secgroup.get_config'](name=name...
[ "helper", "function", "to", "validate", "tags", "are", "correct" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_secgroup.py#L666-L761
[ "def", "_tags_present", "(", "name", ",", "tags", ",", "vpc_id", "=", "None", ",", "vpc_name", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "ret", "=", "{", "'...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_ordereddict2dict
Convert ordered dictionary to a dictionary
salt/states/ceph.py
def _ordereddict2dict(input_ordered_dict): ''' Convert ordered dictionary to a dictionary ''' return salt.utils.json.loads(salt.utils.json.dumps(input_ordered_dict))
def _ordereddict2dict(input_ordered_dict): ''' Convert ordered dictionary to a dictionary ''' return salt.utils.json.loads(salt.utils.json.dumps(input_ordered_dict))
[ "Convert", "ordered", "dictionary", "to", "a", "dictionary" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ceph.py#L47-L51
[ "def", "_ordereddict2dict", "(", "input_ordered_dict", ")", ":", "return", "salt", ".", "utils", ".", "json", ".", "loads", "(", "salt", ".", "utils", ".", "json", ".", "dumps", "(", "input_ordered_dict", ")", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
quorum
Quorum state This state checks the mon daemons are in quorum. It does not alter the cluster but can be used in formula as a dependency for many cluster operations. Example usage in sls file: .. code-block:: yaml quorum: sesceph.quorum: - require: - ses...
salt/states/ceph.py
def quorum(name, **kwargs): ''' Quorum state This state checks the mon daemons are in quorum. It does not alter the cluster but can be used in formula as a dependency for many cluster operations. Example usage in sls file: .. code-block:: yaml quorum: sesceph.quorum: ...
def quorum(name, **kwargs): ''' Quorum state This state checks the mon daemons are in quorum. It does not alter the cluster but can be used in formula as a dependency for many cluster operations. Example usage in sls file: .. code-block:: yaml quorum: sesceph.quorum: ...
[ "Quorum", "state" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ceph.py#L54-L83
[ "def", "quorum", "(", "name", ",", "*", "*", "kwargs", ")", ":", "parameters", "=", "_ordereddict2dict", "(", "kwargs", ")", "if", "parameters", "is", "None", ":", "return", "_error", "(", "name", ",", "\"Invalid parameters:%s\"", ")", "if", "__opts__", "[...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ext_pillar
Check consul for all data
salt/pillar/consul_pillar.py
def ext_pillar(minion_id, pillar, # pylint: disable=W0613 conf): ''' Check consul for all data ''' opts = {} temp = conf target_re = re.compile('target="(.*?)"') match = target_re.search(temp) if match: opts['target'] = match.group(1) temp =...
def ext_pillar(minion_id, pillar, # pylint: disable=W0613 conf): ''' Check consul for all data ''' opts = {} temp = conf target_re = re.compile('target="(.*?)"') match = target_re.search(temp) if match: opts['target'] = match.group(1) temp =...
[ "Check", "consul", "for", "all", "data" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/consul_pillar.py#L170-L254
[ "def", "ext_pillar", "(", "minion_id", ",", "pillar", ",", "# pylint: disable=W0613", "conf", ")", ":", "opts", "=", "{", "}", "temp", "=", "conf", "target_re", "=", "re", ".", "compile", "(", "'target=\"(.*?)\"'", ")", "match", "=", "target_re", ".", "sea...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
consul_fetch
Query consul for all keys/values within base path
salt/pillar/consul_pillar.py
def consul_fetch(client, path): ''' Query consul for all keys/values within base path ''' # Unless the root path is blank, it needs a trailing slash for # the kv get from Consul to work as expected return client.kv.get('' if not path else path.rstrip('/') + '/', recurse=True)
def consul_fetch(client, path): ''' Query consul for all keys/values within base path ''' # Unless the root path is blank, it needs a trailing slash for # the kv get from Consul to work as expected return client.kv.get('' if not path else path.rstrip('/') + '/', recurse=True)
[ "Query", "consul", "for", "all", "keys", "/", "values", "within", "base", "path" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/consul_pillar.py#L257-L263
[ "def", "consul_fetch", "(", "client", ",", "path", ")", ":", "# Unless the root path is blank, it needs a trailing slash for", "# the kv get from Consul to work as expected", "return", "client", ".", "kv", ".", "get", "(", "''", "if", "not", "path", "else", "path", ".",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
fetch_tree
Grab data from consul, trim base path and remove any keys which are folders. Take the remaining data and send it to be formatted in such a way as to be used as pillar data.
salt/pillar/consul_pillar.py
def fetch_tree(client, path, expand_keys): ''' Grab data from consul, trim base path and remove any keys which are folders. Take the remaining data and send it to be formatted in such a way as to be used as pillar data. ''' _, items = consul_fetch(client, path) ret = {} has_children = re...
def fetch_tree(client, path, expand_keys): ''' Grab data from consul, trim base path and remove any keys which are folders. Take the remaining data and send it to be formatted in such a way as to be used as pillar data. ''' _, items = consul_fetch(client, path) ret = {} has_children = re...
[ "Grab", "data", "from", "consul", "trim", "base", "path", "and", "remove", "any", "keys", "which", "are", "folders", ".", "Take", "the", "remaining", "data", "and", "send", "it", "to", "be", "formatted", "in", "such", "a", "way", "as", "to", "be", "use...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/consul_pillar.py#L266-L289
[ "def", "fetch_tree", "(", "client", ",", "path", ",", "expand_keys", ")", ":", "_", ",", "items", "=", "consul_fetch", "(", "client", ",", "path", ")", "ret", "=", "{", "}", "has_children", "=", "re", ".", "compile", "(", "r'/$'", ")", "log", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
pillar_format
Perform data formatting to be used as pillar data and merge it with the current pillar data
salt/pillar/consul_pillar.py
def pillar_format(ret, keys, value, expand_keys): ''' Perform data formatting to be used as pillar data and merge it with the current pillar data ''' # if value is empty in Consul then it's None here - skip it if value is None: return ret # If value is not None then it's a string ...
def pillar_format(ret, keys, value, expand_keys): ''' Perform data formatting to be used as pillar data and merge it with the current pillar data ''' # if value is empty in Consul then it's None here - skip it if value is None: return ret # If value is not None then it's a string ...
[ "Perform", "data", "formatting", "to", "be", "used", "as", "pillar", "data", "and", "merge", "it", "with", "the", "current", "pillar", "data" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/consul_pillar.py#L292-L315
[ "def", "pillar_format", "(", "ret", ",", "keys", ",", "value", ",", "expand_keys", ")", ":", "# if value is empty in Consul then it's None here - skip it", "if", "value", "is", "None", ":", "return", "ret", "# If value is not None then it's a string", "# YAML strips whitesp...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_conn
Return a client object for accessing consul
salt/pillar/consul_pillar.py
def get_conn(opts, profile): ''' Return a client object for accessing consul ''' opts_pillar = opts.get('pillar', {}) opts_master = opts_pillar.get('master', {}) opts_merged = {} opts_merged.update(opts_master) opts_merged.update(opts_pillar) opts_merged.update(opts) if profil...
def get_conn(opts, profile): ''' Return a client object for accessing consul ''' opts_pillar = opts.get('pillar', {}) opts_master = opts_pillar.get('master', {}) opts_merged = {} opts_merged.update(opts_master) opts_merged.update(opts_pillar) opts_merged.update(opts) if profil...
[ "Return", "a", "client", "object", "for", "accessing", "consul" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/consul_pillar.py#L318-L355
[ "def", "get_conn", "(", "opts", ",", "profile", ")", ":", "opts_pillar", "=", "opts", ".", "get", "(", "'pillar'", ",", "{", "}", ")", "opts_master", "=", "opts_pillar", ".", "get", "(", "'master'", ",", "{", "}", ")", "opts_merged", "=", "{", "}", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_resolve_datacenter
If ``dc`` is a string - return it as is. If it's a dict then sort it in descending order by key length and try to use keys as RegEx patterns to match against ``pillarenv``. The value for matched pattern should be a string (that can use ``str.format`` syntax togetehr with captured variables from pattern...
salt/pillar/consul_pillar.py
def _resolve_datacenter(dc, pillarenv): ''' If ``dc`` is a string - return it as is. If it's a dict then sort it in descending order by key length and try to use keys as RegEx patterns to match against ``pillarenv``. The value for matched pattern should be a string (that can use ``str.format`` ...
def _resolve_datacenter(dc, pillarenv): ''' If ``dc`` is a string - return it as is. If it's a dict then sort it in descending order by key length and try to use keys as RegEx patterns to match against ``pillarenv``. The value for matched pattern should be a string (that can use ``str.format`` ...
[ "If", "dc", "is", "a", "string", "-", "return", "it", "as", "is", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/consul_pillar.py#L358-L397
[ "def", "_resolve_datacenter", "(", "dc", ",", "pillarenv", ")", ":", "log", ".", "debug", "(", "'Resolving Consul datacenter based on: %s'", ",", "dc", ")", "try", ":", "mappings", "=", "dc", ".", "items", "(", ")", "# is it a dict?", "except", "AttributeError",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_gather_group_members
Gather group members
salt/beacons/btmp.py
def _gather_group_members(group, groups, users): ''' Gather group members ''' _group = __salt__['group.info'](group) if not _group: log.warning('Group %s does not exist, ignoring.', group) return for member in _group['members']: if member not in users: users...
def _gather_group_members(group, groups, users): ''' Gather group members ''' _group = __salt__['group.info'](group) if not _group: log.warning('Group %s does not exist, ignoring.', group) return for member in _group['members']: if member not in users: users...
[ "Gather", "group", "members" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/btmp.py#L168-L180
[ "def", "_gather_group_members", "(", "group", ",", "groups", ",", "users", ")", ":", "_group", "=", "__salt__", "[", "'group.info'", "]", "(", "group", ")", "if", "not", "_group", ":", "log", ".", "warning", "(", "'Group %s does not exist, ignoring.'", ",", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_check_time_range
Check time range
salt/beacons/btmp.py
def _check_time_range(time_range, now): ''' Check time range ''' if _TIME_SUPPORTED: _start = dateutil_parser.parse(time_range['start']) _end = dateutil_parser.parse(time_range['end']) return bool(_start <= now <= _end) else: log.error('Dateutil is required.') ...
def _check_time_range(time_range, now): ''' Check time range ''' if _TIME_SUPPORTED: _start = dateutil_parser.parse(time_range['start']) _end = dateutil_parser.parse(time_range['end']) return bool(_start <= now <= _end) else: log.error('Dateutil is required.') ...
[ "Check", "time", "range" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/btmp.py#L183-L194
[ "def", "_check_time_range", "(", "time_range", ",", "now", ")", ":", "if", "_TIME_SUPPORTED", ":", "_start", "=", "dateutil_parser", ".", "parse", "(", "time_range", "[", "'start'", "]", ")", "_end", "=", "dateutil_parser", ".", "parse", "(", "time_range", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
beacon
Read the last btmp file and return information on the failed logins
salt/beacons/btmp.py
def beacon(config): ''' Read the last btmp file and return information on the failed logins ''' ret = [] users = {} groups = {} defaults = None for config_item in config: if 'users' in config_item: users = config_item['users'] if 'groups' in config_item: ...
def beacon(config): ''' Read the last btmp file and return information on the failed logins ''' ret = [] users = {} groups = {} defaults = None for config_item in config: if 'users' in config_item: users = config_item['users'] if 'groups' in config_item: ...
[ "Read", "the", "last", "btmp", "file", "and", "return", "information", "on", "the", "failed", "logins" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/btmp.py#L266-L331
[ "def", "beacon", "(", "config", ")", ":", "ret", "=", "[", "]", "users", "=", "{", "}", "groups", "=", "{", "}", "defaults", "=", "None", "for", "config_item", "in", "config", ":", "if", "'users'", "in", "config_item", ":", "users", "=", "config_item...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_sprinkle
Sprinkle with grains of salt, that is convert 'test {id} test {host} ' types of strings :param config_str: The string to be sprinkled :return: The string sprinkled
salt/returners/slack_webhook_return.py
def _sprinkle(config_str): ''' Sprinkle with grains of salt, that is convert 'test {id} test {host} ' types of strings :param config_str: The string to be sprinkled :return: The string sprinkled ''' parts = [x for sub in config_str.split('{') for x in sub.split('}')] for i in range(1, le...
def _sprinkle(config_str): ''' Sprinkle with grains of salt, that is convert 'test {id} test {host} ' types of strings :param config_str: The string to be sprinkled :return: The string sprinkled ''' parts = [x for sub in config_str.split('{') for x in sub.split('}')] for i in range(1, le...
[ "Sprinkle", "with", "grains", "of", "salt", "that", "is", "convert", "test", "{", "id", "}", "test", "{", "host", "}", "types", "of", "strings", ":", "param", "config_str", ":", "The", "string", "to", "be", "sprinkled", ":", "return", ":", "The", "stri...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/slack_webhook_return.py#L121-L131
[ "def", "_sprinkle", "(", "config_str", ")", ":", "parts", "=", "[", "x", "for", "sub", "in", "config_str", ".", "split", "(", "'{'", ")", "for", "x", "in", "sub", ".", "split", "(", "'}'", ")", "]", "for", "i", "in", "range", "(", "1", ",", "le...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_generate_payload
Prepare the payload for Slack :param author_icon: The url for the thumbnail to be displayed :param title: The title of the message :param report: A dictionary with the report of the Salt function :return: The payload ready for Slack
salt/returners/slack_webhook_return.py
def _generate_payload(author_icon, title, report): ''' Prepare the payload for Slack :param author_icon: The url for the thumbnail to be displayed :param title: The title of the message :param report: A dictionary with the report of the Salt function :return: The payload ready for Slack ''' ...
def _generate_payload(author_icon, title, report): ''' Prepare the payload for Slack :param author_icon: The url for the thumbnail to be displayed :param title: The title of the message :param report: A dictionary with the report of the Salt function :return: The payload ready for Slack ''' ...
[ "Prepare", "the", "payload", "for", "Slack", ":", "param", "author_icon", ":", "The", "url", "for", "the", "thumbnail", "to", "be", "displayed", ":", "param", "title", ":", "The", "title", "of", "the", "message", ":", "param", "report", ":", "A", "dictio...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/slack_webhook_return.py#L144-L205
[ "def", "_generate_payload", "(", "author_icon", ",", "title", ",", "report", ")", ":", "title", "=", "_sprinkle", "(", "title", ")", "unchanged", "=", "{", "'color'", ":", "'good'", ",", "'title'", ":", "'Unchanged: {unchanged}'", ".", "format", "(", "unchan...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_generate_report
Generate a report of the Salt function :param ret: The Salt return :param show_tasks: Flag to show the name of the changed and failed states :return: The report
salt/returners/slack_webhook_return.py
def _generate_report(ret, show_tasks): ''' Generate a report of the Salt function :param ret: The Salt return :param show_tasks: Flag to show the name of the changed and failed states :return: The report ''' returns = ret.get('return') sorted_data = sorted( returns.items(), ...
def _generate_report(ret, show_tasks): ''' Generate a report of the Salt function :param ret: The Salt return :param show_tasks: Flag to show the name of the changed and failed states :return: The report ''' returns = ret.get('return') sorted_data = sorted( returns.items(), ...
[ "Generate", "a", "report", "of", "the", "Salt", "function", ":", "param", "ret", ":", "The", "Salt", "return", ":", "param", "show_tasks", ":", "Flag", "to", "show", "the", "name", "of", "the", "changed", "and", "failed", "states", ":", "return", ":", ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/slack_webhook_return.py#L208-L280
[ "def", "_generate_report", "(", "ret", ",", "show_tasks", ")", ":", "returns", "=", "ret", ".", "get", "(", "'return'", ")", "sorted_data", "=", "sorted", "(", "returns", ".", "items", "(", ")", ",", "key", "=", "lambda", "s", ":", "s", "[", "1", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_post_message
Send a message to a Slack room through a webhook :param webhook: The url of the incoming webhook :param author_icon: The thumbnail image to be displayed on the right side of the message :param title: The title of the message :param report: The report of the function state :return: ...
salt/returners/slack_webhook_return.py
def _post_message(webhook, author_icon, title, report): ''' Send a message to a Slack room through a webhook :param webhook: The url of the incoming webhook :param author_icon: The thumbnail image to be displayed on the right side of the message :param title: The title of the message :...
def _post_message(webhook, author_icon, title, report): ''' Send a message to a Slack room through a webhook :param webhook: The url of the incoming webhook :param author_icon: The thumbnail image to be displayed on the right side of the message :param title: The title of the message :...
[ "Send", "a", "message", "to", "a", "Slack", "room", "through", "a", "webhook", ":", "param", "webhook", ":", "The", "url", "of", "the", "incoming", "webhook", ":", "param", "author_icon", ":", "The", "thumbnail", "image", "to", "be", "displayed", "on", "...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/slack_webhook_return.py#L283-L309
[ "def", "_post_message", "(", "webhook", ",", "author_icon", ",", "title", ",", "report", ")", ":", "payload", "=", "_generate_payload", "(", "author_icon", ",", "title", ",", "report", ")", "data", "=", "_urlencode", "(", "{", "'payload'", ":", "json", "."...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
returner
Send a slack message with the data through a webhook :param ret: The Salt return :return: The result of the post
salt/returners/slack_webhook_return.py
def returner(ret): ''' Send a slack message with the data through a webhook :param ret: The Salt return :return: The result of the post ''' _options = _get_options(ret) webhook = _options.get('webhook', None) show_tasks = _options.get('show_tasks') author_icon = _options.get('autho...
def returner(ret): ''' Send a slack message with the data through a webhook :param ret: The Salt return :return: The result of the post ''' _options = _get_options(ret) webhook = _options.get('webhook', None) show_tasks = _options.get('show_tasks') author_icon = _options.get('autho...
[ "Send", "a", "slack", "message", "with", "the", "data", "through", "a", "webhook", ":", "param", "ret", ":", "The", "Salt", "return", ":", "return", ":", "The", "result", "of", "the", "post" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/slack_webhook_return.py#L312-L338
[ "def", "returner", "(", "ret", ")", ":", "_options", "=", "_get_options", "(", "ret", ")", "webhook", "=", "_options", ".", "get", "(", "'webhook'", ",", "None", ")", "show_tasks", "=", "_options", ".", "get", "(", "'show_tasks'", ")", "author_icon", "="...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
update_git_repos
Checkout git repos containing :ref:`Windows Software Package Definitions <windows-package-manager>`. .. important:: This function requires `Git for Windows`_ to be installed in order to work. When installing, make sure to select an installation option which permits the git executable to...
salt/modules/winrepo.py
def update_git_repos(clean=False): ''' Checkout git repos containing :ref:`Windows Software Package Definitions <windows-package-manager>`. .. important:: This function requires `Git for Windows`_ to be installed in order to work. When installing, make sure to select an installation opt...
def update_git_repos(clean=False): ''' Checkout git repos containing :ref:`Windows Software Package Definitions <windows-package-manager>`. .. important:: This function requires `Git for Windows`_ to be installed in order to work. When installing, make sure to select an installation opt...
[ "Checkout", "git", "repos", "containing", ":", "ref", ":", "Windows", "Software", "Package", "Definitions", "<windows", "-", "package", "-", "manager", ">", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/winrepo.py#L81-L122
[ "def", "update_git_repos", "(", "clean", "=", "False", ")", ":", "if", "not", "salt", ".", "utils", ".", "path", ".", "which", "(", "'git'", ")", ":", "raise", "CommandExecutionError", "(", "'Git for Windows is not installed, or not configured to be '", "'accessible...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
show_sls
r''' .. versionadded:: 2015.8.0 Display the rendered software definition from a specific sls file in the local winrepo cache. This will parse all Jinja. Run pkg.refresh_db to pull the latest software definitions from the master. .. note:: This function does not ask a master for an sls file...
salt/modules/winrepo.py
def show_sls(name, saltenv='base'): r''' .. versionadded:: 2015.8.0 Display the rendered software definition from a specific sls file in the local winrepo cache. This will parse all Jinja. Run pkg.refresh_db to pull the latest software definitions from the master. .. note:: This functi...
def show_sls(name, saltenv='base'): r''' .. versionadded:: 2015.8.0 Display the rendered software definition from a specific sls file in the local winrepo cache. This will parse all Jinja. Run pkg.refresh_db to pull the latest software definitions from the master. .. note:: This functi...
[ "r", "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/winrepo.py#L125-L210
[ "def", "show_sls", "(", "name", ",", "saltenv", "=", "'base'", ")", ":", "# Passed a filename", "if", "os", ".", "path", ".", "exists", "(", "name", ")", ":", "sls_file", "=", "name", "# Use a winrepo path", "else", ":", "# Get the location of the local repo", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
version
Return the actual lxc client version .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.version
salt/modules/lxc.py
def version(): ''' Return the actual lxc client version .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.version ''' k = 'lxc.version' if not __context__.get(k, None): cversion = __salt__['cmd.run_all']('lxc-info --version') if not cv...
def version(): ''' Return the actual lxc client version .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.version ''' k = 'lxc.version' if not __context__.get(k, None): cversion = __salt__['cmd.run_all']('lxc-info --version') if not cv...
[ "Return", "the", "actual", "lxc", "client", "version" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L111-L132
[ "def", "version", "(", ")", ":", "k", "=", "'lxc.version'", "if", "not", "__context__", ".", "get", "(", "k", ",", "None", ")", ":", "cversion", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "'lxc-info --version'", ")", "if", "not", "cversion", "[", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_clear_context
Clear any lxc variables set in __context__
salt/modules/lxc.py
def _clear_context(): ''' Clear any lxc variables set in __context__ ''' for var in [x for x in __context__ if x.startswith('lxc.')]: log.trace('Clearing __context__[\'%s\']', var) __context__.pop(var, None)
def _clear_context(): ''' Clear any lxc variables set in __context__ ''' for var in [x for x in __context__ if x.startswith('lxc.')]: log.trace('Clearing __context__[\'%s\']', var) __context__.pop(var, None)
[ "Clear", "any", "lxc", "variables", "set", "in", "__context__" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L135-L141
[ "def", "_clear_context", "(", ")", ":", "for", "var", "in", "[", "x", "for", "x", "in", "__context__", "if", "x", ".", "startswith", "(", "'lxc.'", ")", "]", ":", "log", ".", "trace", "(", "'Clearing __context__[\\'%s\\']'", ",", "var", ")", "__context__...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_ip_sort
Ip sorting
salt/modules/lxc.py
def _ip_sort(ip): '''Ip sorting''' idx = '001' if ip == '127.0.0.1': idx = '200' if ip == '::1': idx = '201' elif '::' in ip: idx = '100' return '{0}___{1}'.format(idx, ip)
def _ip_sort(ip): '''Ip sorting''' idx = '001' if ip == '127.0.0.1': idx = '200' if ip == '::1': idx = '201' elif '::' in ip: idx = '100' return '{0}___{1}'.format(idx, ip)
[ "Ip", "sorting" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L144-L153
[ "def", "_ip_sort", "(", "ip", ")", ":", "idx", "=", "'001'", "if", "ip", "==", "'127.0.0.1'", ":", "idx", "=", "'200'", "if", "ip", "==", "'::1'", ":", "idx", "=", "'201'", "elif", "'::'", "in", "ip", ":", "idx", "=", "'100'", "return", "'{0}___{1}...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
search_lxc_bridges
Search which bridges are potentially available as LXC bridges CLI Example: .. code-block:: bash salt '*' lxc.search_lxc_bridges
salt/modules/lxc.py
def search_lxc_bridges(): ''' Search which bridges are potentially available as LXC bridges CLI Example: .. code-block:: bash salt '*' lxc.search_lxc_bridges ''' bridges = __context__.get('lxc.bridges', None) # either match not yet called or no bridges were found # to handle ...
def search_lxc_bridges(): ''' Search which bridges are potentially available as LXC bridges CLI Example: .. code-block:: bash salt '*' lxc.search_lxc_bridges ''' bridges = __context__.get('lxc.bridges', None) # either match not yet called or no bridges were found # to handle ...
[ "Search", "which", "bridges", "are", "potentially", "available", "as", "LXC", "bridges" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L156-L205
[ "def", "search_lxc_bridges", "(", ")", ":", "bridges", "=", "__context__", ".", "get", "(", "'lxc.bridges'", ",", "None", ")", "# either match not yet called or no bridges were found", "# to handle the case where lxc was not installed on the first", "# call", "if", "not", "br...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
cloud_init_interface
Interface between salt.cloud.lxc driver and lxc.init ``vm_`` is a mapping of vm opts in the salt.cloud format as documented for the lxc driver. This can be used either: - from the salt cloud driver - because you find the argument to give easier here than using directly lxc.init .. warni...
salt/modules/lxc.py
def cloud_init_interface(name, vm_=None, **kwargs): ''' Interface between salt.cloud.lxc driver and lxc.init ``vm_`` is a mapping of vm opts in the salt.cloud format as documented for the lxc driver. This can be used either: - from the salt cloud driver - because you find the argument to g...
def cloud_init_interface(name, vm_=None, **kwargs): ''' Interface between salt.cloud.lxc driver and lxc.init ``vm_`` is a mapping of vm opts in the salt.cloud format as documented for the lxc driver. This can be used either: - from the salt cloud driver - because you find the argument to g...
[ "Interface", "between", "salt", ".", "cloud", ".", "lxc", "driver", "and", "lxc", ".", "init", "vm_", "is", "a", "mapping", "of", "vm", "opts", "in", "the", "salt", ".", "cloud", "format", "as", "documented", "for", "the", "lxc", "driver", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L242-L551
[ "def", "cloud_init_interface", "(", "name", ",", "vm_", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "vm_", "is", "None", ":", "vm_", "=", "{", "}", "vm_", "=", "copy", ".", "deepcopy", "(", "vm_", ")", "vm_", "=", "salt", ".", "utils", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_rand_cpu_str
Return a random subset of cpus for the cpuset config
salt/modules/lxc.py
def _rand_cpu_str(cpu): ''' Return a random subset of cpus for the cpuset config ''' cpu = int(cpu) avail = __salt__['status.nproc']() if cpu < avail: return '0-{0}'.format(avail) to_set = set() while len(to_set) < cpu: choice = random.randint(0, avail - 1) if cho...
def _rand_cpu_str(cpu): ''' Return a random subset of cpus for the cpuset config ''' cpu = int(cpu) avail = __salt__['status.nproc']() if cpu < avail: return '0-{0}'.format(avail) to_set = set() while len(to_set) < cpu: choice = random.randint(0, avail - 1) if cho...
[ "Return", "a", "random", "subset", "of", "cpus", "for", "the", "cpuset", "config" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L686-L699
[ "def", "_rand_cpu_str", "(", "cpu", ")", ":", "cpu", "=", "int", "(", "cpu", ")", "avail", "=", "__salt__", "[", "'status.nproc'", "]", "(", ")", "if", "cpu", "<", "avail", ":", "return", "'0-{0}'", ".", "format", "(", "avail", ")", "to_set", "=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_network_conf
Network configuration defaults network_profile as for containers, we can either call this function either with a network_profile dict or network profile name in the kwargs nic_opts overrides or extra nics in the form {nic_name: {set: tings}
salt/modules/lxc.py
def _network_conf(conf_tuples=None, **kwargs): ''' Network configuration defaults network_profile as for containers, we can either call this function either with a network_profile dict or network profile name in the kwargs nic_opts overrides or ex...
def _network_conf(conf_tuples=None, **kwargs): ''' Network configuration defaults network_profile as for containers, we can either call this function either with a network_profile dict or network profile name in the kwargs nic_opts overrides or ex...
[ "Network", "configuration", "defaults" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L702-L874
[ "def", "_network_conf", "(", "conf_tuples", "=", "None", ",", "*", "*", "kwargs", ")", ":", "nic", "=", "kwargs", ".", "get", "(", "'network_profile'", ",", "None", ")", "ret", "=", "[", "]", "nic_opts", "=", "kwargs", ".", "get", "(", "'nic_opts'", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_config_list
Return a list of dicts from the salt level configurations conf_tuples _LXCConfig compatible list of entries which can contain - string line - tuple (lxc config param,value) - dict of one entry: {lxc config param: value) only_net by default we add to the tup...
salt/modules/lxc.py
def _config_list(conf_tuples=None, only_net=False, **kwargs): ''' Return a list of dicts from the salt level configurations conf_tuples _LXCConfig compatible list of entries which can contain - string line - tuple (lxc config param,value) - dict of one entry: {l...
def _config_list(conf_tuples=None, only_net=False, **kwargs): ''' Return a list of dicts from the salt level configurations conf_tuples _LXCConfig compatible list of entries which can contain - string line - tuple (lxc config param,value) - dict of one entry: {l...
[ "Return", "a", "list", "of", "dicts", "from", "the", "salt", "level", "configurations" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L915-L951
[ "def", "_config_list", "(", "conf_tuples", "=", "None", ",", "only_net", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# explicit cast", "only_net", "=", "bool", "(", "only_net", ")", "if", "not", "conf_tuples", ":", "conf_tuples", "=", "[", "]", "kw...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_veths
Parse the nic setup inside lxc conf tuples back to a dictionary indexed by network interface
salt/modules/lxc.py
def _get_veths(net_data): ''' Parse the nic setup inside lxc conf tuples back to a dictionary indexed by network interface ''' if isinstance(net_data, dict): net_data = list(net_data.items()) nics = salt.utils.odict.OrderedDict() current_nic = salt.utils.odict.OrderedDict() no_na...
def _get_veths(net_data): ''' Parse the nic setup inside lxc conf tuples back to a dictionary indexed by network interface ''' if isinstance(net_data, dict): net_data = list(net_data.items()) nics = salt.utils.odict.OrderedDict() current_nic = salt.utils.odict.OrderedDict() no_na...
[ "Parse", "the", "nic", "setup", "inside", "lxc", "conf", "tuples", "back", "to", "a", "dictionary", "indexed", "by", "network", "interface" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L954-L985
[ "def", "_get_veths", "(", "net_data", ")", ":", "if", "isinstance", "(", "net_data", ",", "dict", ")", ":", "net_data", "=", "list", "(", "net_data", ".", "items", "(", ")", ")", "nics", "=", "salt", ".", "utils", ".", "odict", ".", "OrderedDict", "(...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_base
If the needed base does not exist, then create it, if it does exist create nothing and return the name of the base lxc container so it can be cloned.
salt/modules/lxc.py
def _get_base(**kwargs): ''' If the needed base does not exist, then create it, if it does exist create nothing and return the name of the base lxc container so it can be cloned. ''' profile = get_container_profile(copy.deepcopy(kwargs.get('profile'))) kw_overrides = copy.deepcopy(kwargs) ...
def _get_base(**kwargs): ''' If the needed base does not exist, then create it, if it does exist create nothing and return the name of the base lxc container so it can be cloned. ''' profile = get_container_profile(copy.deepcopy(kwargs.get('profile'))) kw_overrides = copy.deepcopy(kwargs) ...
[ "If", "the", "needed", "base", "does", "not", "exist", "then", "create", "it", "if", "it", "does", "exist", "create", "nothing", "and", "return", "the", "name", "of", "the", "base", "lxc", "container", "so", "it", "can", "be", "cloned", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L1070-L1122
[ "def", "_get_base", "(", "*", "*", "kwargs", ")", ":", "profile", "=", "get_container_profile", "(", "copy", ".", "deepcopy", "(", "kwargs", ".", "get", "(", "'profile'", ")", ")", ")", "kw_overrides", "=", "copy", ".", "deepcopy", "(", "kwargs", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
init
Initialize a new container. This is a partial idempotent function as if it is already provisioned, we will reset a bit the lxc configuration file but much of the hard work will be escaped as markers will prevent re-execution of harmful tasks. name Name of the container image A tar...
salt/modules/lxc.py
def init(name, config=None, cpuset=None, cpushare=None, memory=None, profile=None, network_profile=None, nic_opts=None, cpu=None, autostart=True, password=None, password_encrypted=None, users=None, dnsse...
def init(name, config=None, cpuset=None, cpushare=None, memory=None, profile=None, network_profile=None, nic_opts=None, cpu=None, autostart=True, password=None, password_encrypted=None, users=None, dnsse...
[ "Initialize", "a", "new", "container", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L1125-L1642
[ "def", "init", "(", "name", ",", "config", "=", "None", ",", "cpuset", "=", "None", ",", "cpushare", "=", "None", ",", "memory", "=", "None", ",", "profile", "=", "None", ",", "network_profile", "=", "None", ",", "nic_opts", "=", "None", ",", "cpu", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
cloud_init
Thin wrapper to lxc.init to be used from the saltcloud lxc driver name Name of the container may be None and then guessed from saltcloud mapping `vm_` saltcloud mapping defaults for the vm CLI Example: .. code-block:: bash salt '*' lxc.cloud_init foo
salt/modules/lxc.py
def cloud_init(name, vm_=None, **kwargs): ''' Thin wrapper to lxc.init to be used from the saltcloud lxc driver name Name of the container may be None and then guessed from saltcloud mapping `vm_` saltcloud mapping defaults for the vm CLI Example: .. code-block:: bash ...
def cloud_init(name, vm_=None, **kwargs): ''' Thin wrapper to lxc.init to be used from the saltcloud lxc driver name Name of the container may be None and then guessed from saltcloud mapping `vm_` saltcloud mapping defaults for the vm CLI Example: .. code-block:: bash ...
[ "Thin", "wrapper", "to", "lxc", ".", "init", "to", "be", "used", "from", "the", "saltcloud", "lxc", "driver" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L1645-L1663
[ "def", "cloud_init", "(", "name", ",", "vm_", "=", "None", ",", "*", "*", "kwargs", ")", ":", "init_interface", "=", "cloud_init_interface", "(", "name", ",", "vm_", ",", "*", "*", "kwargs", ")", "name", "=", "init_interface", ".", "pop", "(", "'name'"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
images
.. versionadded:: 2015.5.0 List the available images for LXC's ``download`` template. dist : None Filter results to a single Linux distribution CLI Examples: .. code-block:: bash salt myminion lxc.images salt myminion lxc.images dist=centos
salt/modules/lxc.py
def images(dist=None): ''' .. versionadded:: 2015.5.0 List the available images for LXC's ``download`` template. dist : None Filter results to a single Linux distribution CLI Examples: .. code-block:: bash salt myminion lxc.images salt myminion lxc.images dist=centos...
def images(dist=None): ''' .. versionadded:: 2015.5.0 List the available images for LXC's ``download`` template. dist : None Filter results to a single Linux distribution CLI Examples: .. code-block:: bash salt myminion lxc.images salt myminion lxc.images dist=centos...
[ "..", "versionadded", "::", "2015", ".", "5", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L1666-L1714
[ "def", "images", "(", "dist", "=", "None", ")", ":", "out", "=", "__salt__", "[", "'cmd.run_stdout'", "]", "(", "'lxc-create -n __imgcheck -t download -- --list'", ",", "ignore_retcode", "=", "True", ")", "if", "'DIST'", "not", "in", "out", ":", "raise", "Comm...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
templates
.. versionadded:: 2015.5.0 List the available LXC template scripts installed on the minion CLI Examples: .. code-block:: bash salt myminion lxc.templates
salt/modules/lxc.py
def templates(): ''' .. versionadded:: 2015.5.0 List the available LXC template scripts installed on the minion CLI Examples: .. code-block:: bash salt myminion lxc.templates ''' try: template_scripts = os.listdir('/usr/share/lxc/templates') except OSError: re...
def templates(): ''' .. versionadded:: 2015.5.0 List the available LXC template scripts installed on the minion CLI Examples: .. code-block:: bash salt myminion lxc.templates ''' try: template_scripts = os.listdir('/usr/share/lxc/templates') except OSError: re...
[ "..", "versionadded", "::", "2015", ".", "5", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L1717-L1734
[ "def", "templates", "(", ")", ":", "try", ":", "template_scripts", "=", "os", ".", "listdir", "(", "'/usr/share/lxc/templates'", ")", "except", "OSError", ":", "return", "[", "]", "else", ":", "return", "[", "x", "[", "4", ":", "]", "for", "x", "in", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
create
Create a new container. name Name of the container config The config file to use for the container. Defaults to system-wide config (usually in /etc/lxc/lxc.conf). profile Profile to use in container creation (see :mod:`lxc.get_container_profile <salt.module...
salt/modules/lxc.py
def create(name, config=None, profile=None, network_profile=None, nic_opts=None, **kwargs): ''' Create a new container. name Name of the container config The config file to use for the container. Defaults to system-wide con...
def create(name, config=None, profile=None, network_profile=None, nic_opts=None, **kwargs): ''' Create a new container. name Name of the container config The config file to use for the container. Defaults to system-wide con...
[ "Create", "a", "new", "container", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L1774-L1984
[ "def", "create", "(", "name", ",", "config", "=", "None", ",", "profile", "=", "None", ",", "network_profile", "=", "None", ",", "nic_opts", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# Required params for 'download' template", "download_template_deps", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
clone
Create a new container as a clone of another container name Name of the container orig Name of the original container to be cloned profile Profile to use in container cloning (see :mod:`lxc.get_container_profile <salt.modules.lxc.get_container_profile>`). Values in...
salt/modules/lxc.py
def clone(name, orig, profile=None, network_profile=None, nic_opts=None, **kwargs): ''' Create a new container as a clone of another container name Name of the container orig Name of the original container to be cloned profile ...
def clone(name, orig, profile=None, network_profile=None, nic_opts=None, **kwargs): ''' Create a new container as a clone of another container name Name of the container orig Name of the original container to be cloned profile ...
[ "Create", "a", "new", "container", "as", "a", "clone", "of", "another", "container" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L1987-L2106
[ "def", "clone", "(", "name", ",", "orig", ",", "profile", "=", "None", ",", "network_profile", "=", "None", ",", "nic_opts", "=", "None", ",", "*", "*", "kwargs", ")", ":", "profile", "=", "get_container_profile", "(", "copy", ".", "deepcopy", "(", "pr...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ls_
Return a list of the containers available on the minion path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 active If ``True``, return only active (i.e. running) containers .. versionadded:: 2015.5.0 CLI Example: ...
salt/modules/lxc.py
def ls_(active=None, cache=True, path=None): ''' Return a list of the containers available on the minion path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 active If ``True``, return only active (i.e. running) containe...
def ls_(active=None, cache=True, path=None): ''' Return a list of the containers available on the minion path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 active If ``True``, return only active (i.e. running) containe...
[ "Return", "a", "list", "of", "the", "containers", "available", "on", "the", "minion" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2109-L2147
[ "def", "ls_", "(", "active", "=", "None", ",", "cache", "=", "True", ",", "path", "=", "None", ")", ":", "contextvar", "=", "'lxc.ls{0}'", ".", "format", "(", "path", ")", "if", "active", ":", "contextvar", "+=", "'.active'", "if", "cache", "and", "(...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_
List containers classified by state extra Also get per-container specific info. This will change the return data. Instead of returning a list of containers, a dictionary of containers and each container's output from :mod:`lxc.info <salt.modules.lxc.info>`. path path to...
salt/modules/lxc.py
def list_(extra=False, limit=None, path=None): ''' List containers classified by state extra Also get per-container specific info. This will change the return data. Instead of returning a list of containers, a dictionary of containers and each container's output from :mod:`lxc.info ...
def list_(extra=False, limit=None, path=None): ''' List containers classified by state extra Also get per-container specific info. This will change the return data. Instead of returning a list of containers, a dictionary of containers and each container's output from :mod:`lxc.info ...
[ "List", "containers", "classified", "by", "state" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2150-L2235
[ "def", "list_", "(", "extra", "=", "False", ",", "limit", "=", "None", ",", "path", "=", "None", ")", ":", "ctnrs", "=", "ls_", "(", "path", "=", "path", ")", "if", "extra", ":", "stopped", "=", "{", "}", "frozen", "=", "{", "}", "running", "="...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_ensure_exists
Raise an exception if the container does not exist
salt/modules/lxc.py
def _ensure_exists(name, path=None): ''' Raise an exception if the container does not exist ''' if not exists(name, path=path): raise CommandExecutionError( 'Container \'{0}\' does not exist'.format(name) )
def _ensure_exists(name, path=None): ''' Raise an exception if the container does not exist ''' if not exists(name, path=path): raise CommandExecutionError( 'Container \'{0}\' does not exist'.format(name) )
[ "Raise", "an", "exception", "if", "the", "container", "does", "not", "exist" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2302-L2309
[ "def", "_ensure_exists", "(", "name", ",", "path", "=", "None", ")", ":", "if", "not", "exists", "(", "name", ",", "path", "=", "path", ")", ":", "raise", "CommandExecutionError", "(", "'Container \\'{0}\\' does not exist'", ".", "format", "(", "name", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_ensure_running
If the container is not currently running, start it. This function returns the state that the container was in before changing path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0
salt/modules/lxc.py
def _ensure_running(name, no_start=False, path=None): ''' If the container is not currently running, start it. This function returns the state that the container was in before changing path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: ...
def _ensure_running(name, no_start=False, path=None): ''' If the container is not currently running, start it. This function returns the state that the container was in before changing path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: ...
[ "If", "the", "container", "is", "not", "currently", "running", "start", "it", ".", "This", "function", "returns", "the", "state", "that", "the", "container", "was", "in", "before", "changing" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2312-L2340
[ "def", "_ensure_running", "(", "name", ",", "no_start", "=", "False", ",", "path", "=", "None", ")", ":", "_ensure_exists", "(", "name", ",", "path", "=", "path", ")", "pre", "=", "state", "(", "name", ",", "path", "=", "path", ")", "if", "pre", "=...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
restart
.. versionadded:: 2015.5.0 Restart the named container. If the container was not running, the container will merely be started. name The name of the container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 lx...
salt/modules/lxc.py
def restart(name, path=None, lxc_config=None, force=False): ''' .. versionadded:: 2015.5.0 Restart the named container. If the container was not running, the container will merely be started. name The name of the container path path to the container parent directory de...
def restart(name, path=None, lxc_config=None, force=False): ''' .. versionadded:: 2015.5.0 Restart the named container. If the container was not running, the container will merely be started. name The name of the container path path to the container parent directory de...
[ "..", "versionadded", "::", "2015", ".", "5", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2343-L2383
[ "def", "restart", "(", "name", ",", "path", "=", "None", ",", "lxc_config", "=", "None", ",", "force", "=", "False", ")", ":", "_ensure_exists", "(", "name", ",", "path", "=", "path", ")", "orig_state", "=", "state", "(", "name", ",", "path", "=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
start
Start the named container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 lxc_config path to a lxc config file config file will be guessed from container name otherwise .. versionadded:: 2015.8.0 use_v...
salt/modules/lxc.py
def start(name, **kwargs): ''' Start the named container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 lxc_config path to a lxc config file config file will be guessed from container name otherwise ...
def start(name, **kwargs): ''' Start the named container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 lxc_config path to a lxc config file config file will be guessed from container name otherwise ...
[ "Start", "the", "named", "container" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2386-L2437
[ "def", "start", "(", "name", ",", "*", "*", "kwargs", ")", ":", "path", "=", "kwargs", ".", "get", "(", "'path'", ",", "None", ")", "cpath", "=", "get_root_path", "(", "path", ")", "lxc_config", "=", "kwargs", ".", "get", "(", "'lxc_config'", ",", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
stop
Stop the named container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 kill: False Do not wait for the container to stop, kill all tasks in the container. Older LXC versions will stop containers like this irrespec...
salt/modules/lxc.py
def stop(name, kill=False, path=None, use_vt=None): ''' Stop the named container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 kill: False Do not wait for the container to stop, kill all tasks in the container. ...
def stop(name, kill=False, path=None, use_vt=None): ''' Stop the named container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 kill: False Do not wait for the container to stop, kill all tasks in the container. ...
[ "Stop", "the", "named", "container" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2440-L2481
[ "def", "stop", "(", "name", ",", "kill", "=", "False", ",", "path", "=", "None", ",", "use_vt", "=", "None", ")", ":", "_ensure_exists", "(", "name", ",", "path", "=", "path", ")", "orig_state", "=", "state", "(", "name", ",", "path", "=", "path", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
freeze
Freeze the named container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 start : False If ``True`` and the container is stopped, the container will be started before attempting to freeze. .. versionadded:...
salt/modules/lxc.py
def freeze(name, **kwargs): ''' Freeze the named container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 start : False If ``True`` and the container is stopped, the container will be started before attempt...
def freeze(name, **kwargs): ''' Freeze the named container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 start : False If ``True`` and the container is stopped, the container will be started before attempt...
[ "Freeze", "the", "named", "container" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2484-L2530
[ "def", "freeze", "(", "name", ",", "*", "*", "kwargs", ")", ":", "use_vt", "=", "kwargs", ".", "get", "(", "'use_vt'", ",", "None", ")", "path", "=", "kwargs", ".", "get", "(", "'path'", ",", "None", ")", "_ensure_exists", "(", "name", ",", "path",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
unfreeze
Unfreeze the named container. path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 use_vt run the command through VT .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.unfreeze ...
salt/modules/lxc.py
def unfreeze(name, path=None, use_vt=None): ''' Unfreeze the named container. path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 use_vt run the command through VT .. versionadded:: 2015.8.0 CLI Example: ...
def unfreeze(name, path=None, use_vt=None): ''' Unfreeze the named container. path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 use_vt run the command through VT .. versionadded:: 2015.8.0 CLI Example: ...
[ "Unfreeze", "the", "named", "container", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2533-L2562
[ "def", "unfreeze", "(", "name", ",", "path", "=", "None", ",", "use_vt", "=", "None", ")", ":", "_ensure_exists", "(", "name", ",", "path", "=", "path", ")", "if", "state", "(", "name", ",", "path", "=", "path", ")", "==", "'stopped'", ":", "raise"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
destroy
Destroy the named container. .. warning:: Destroys all data associated with the container. path path to the container parent directory (default: /var/lib/lxc) .. versionadded:: 2015.8.0 stop : False If ``True``, the container will be destroyed even if it is runni...
salt/modules/lxc.py
def destroy(name, stop=False, path=None): ''' Destroy the named container. .. warning:: Destroys all data associated with the container. path path to the container parent directory (default: /var/lib/lxc) .. versionadded:: 2015.8.0 stop : False If ``True``, the c...
def destroy(name, stop=False, path=None): ''' Destroy the named container. .. warning:: Destroys all data associated with the container. path path to the container parent directory (default: /var/lib/lxc) .. versionadded:: 2015.8.0 stop : False If ``True``, the c...
[ "Destroy", "the", "named", "container", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2565-L2600
[ "def", "destroy", "(", "name", ",", "stop", "=", "False", ",", "path", "=", "None", ")", ":", "_ensure_exists", "(", "name", ",", "path", "=", "path", ")", "if", "not", "stop", "and", "state", "(", "name", ",", "path", "=", "path", ")", "!=", "'s...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
exists
Returns whether the named container exists. path path to the container parent directory (default: /var/lib/lxc) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.exists name
salt/modules/lxc.py
def exists(name, path=None): ''' Returns whether the named container exists. path path to the container parent directory (default: /var/lib/lxc) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.exists name ''' _exists = name in ls_(path...
def exists(name, path=None): ''' Returns whether the named container exists. path path to the container parent directory (default: /var/lib/lxc) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.exists name ''' _exists = name in ls_(path...
[ "Returns", "whether", "the", "named", "container", "exists", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2607-L2629
[ "def", "exists", "(", "name", ",", "path", "=", "None", ")", ":", "_exists", "=", "name", "in", "ls_", "(", "path", "=", "path", ")", "# container may be just created but we did cached earlier the", "# lxc-ls results", "if", "not", "_exists", ":", "_exists", "="...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
state
Returns the state of a container. path path to the container parent directory (default: /var/lib/lxc) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.state name
salt/modules/lxc.py
def state(name, path=None): ''' Returns the state of a container. path path to the container parent directory (default: /var/lib/lxc) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.state name ''' # Don't use _ensure_exists() here, it wi...
def state(name, path=None): ''' Returns the state of a container. path path to the container parent directory (default: /var/lib/lxc) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.state name ''' # Don't use _ensure_exists() here, it wi...
[ "Returns", "the", "state", "of", "a", "container", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2632-L2674
[ "def", "state", "(", "name", ",", "path", "=", "None", ")", ":", "# Don't use _ensure_exists() here, it will mess with _change_state()", "cachekey", "=", "'lxc.state.{0}{1}'", ".", "format", "(", "name", ",", "path", ")", "try", ":", "return", "__context__", "[", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_parameter
Returns the value of a cgroup parameter for a container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.get_parameter container_name memory.limit_in_bytes
salt/modules/lxc.py
def get_parameter(name, parameter, path=None): ''' Returns the value of a cgroup parameter for a container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.get_par...
def get_parameter(name, parameter, path=None): ''' Returns the value of a cgroup parameter for a container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.get_par...
[ "Returns", "the", "value", "of", "a", "cgroup", "parameter", "for", "a", "container" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2677-L2703
[ "def", "get_parameter", "(", "name", ",", "parameter", ",", "path", "=", "None", ")", ":", "_ensure_exists", "(", "name", ",", "path", "=", "path", ")", "cmd", "=", "'lxc-cgroup'", "if", "path", ":", "cmd", "+=", "' -P {0}'", ".", "format", "(", "pipes...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_parameter
Set the value of a cgroup parameter for a container. path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.set_parameter name parameter value
salt/modules/lxc.py
def set_parameter(name, parameter, value, path=None): ''' Set the value of a cgroup parameter for a container. path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.set...
def set_parameter(name, parameter, value, path=None): ''' Set the value of a cgroup parameter for a container. path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.set...
[ "Set", "the", "value", "of", "a", "cgroup", "parameter", "for", "a", "container", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2706-L2733
[ "def", "set_parameter", "(", "name", ",", "parameter", ",", "value", ",", "path", "=", "None", ")", ":", "if", "not", "exists", "(", "name", ",", "path", "=", "path", ")", ":", "return", "None", "cmd", "=", "'lxc-cgroup'", "if", "path", ":", "cmd", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
info
Returns information about a container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.info name
salt/modules/lxc.py
def info(name, path=None): ''' Returns information about a container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.info name ''' cachekey = 'lxc.info.{0...
def info(name, path=None): ''' Returns information about a container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.info name ''' cachekey = 'lxc.info.{0...
[ "Returns", "information", "about", "a", "container" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2736-L2879
[ "def", "info", "(", "name", ",", "path", "=", "None", ")", ":", "cachekey", "=", "'lxc.info.{0}{1}'", ".", "format", "(", "name", ",", "path", ")", "try", ":", "return", "__context__", "[", "cachekey", "]", "except", "KeyError", ":", "_ensure_exists", "(...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_password
.. versionchanged:: 2015.5.0 Function renamed from ``set_pass`` to ``set_password``. Additionally, this function now supports (and defaults to using) a password hash instead of a plaintext password. Set the password of one or more system users inside containers users Comma-sep...
salt/modules/lxc.py
def set_password(name, users, password, encrypted=True, path=None): ''' .. versionchanged:: 2015.5.0 Function renamed from ``set_pass`` to ``set_password``. Additionally, this function now supports (and defaults to using) a password hash instead of a plaintext password. Set the pass...
def set_password(name, users, password, encrypted=True, path=None): ''' .. versionchanged:: 2015.5.0 Function renamed from ``set_pass`` to ``set_password``. Additionally, this function now supports (and defaults to using) a password hash instead of a plaintext password. Set the pass...
[ "..", "versionchanged", "::", "2015", ".", "5", ".", "0", "Function", "renamed", "from", "set_pass", "to", "set_password", ".", "Additionally", "this", "function", "now", "supports", "(", "and", "defaults", "to", "using", ")", "a", "password", "hash", "inste...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2882-L2945
[ "def", "set_password", "(", "name", ",", "users", ",", "password", ",", "encrypted", "=", "True", ",", "path", "=", "None", ")", ":", "def", "_bad_user_input", "(", ")", ":", "raise", "SaltInvocationError", "(", "'Invalid input for \\'users\\' parameter'", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
update_lxc_conf
Edit LXC configuration options path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion lxc.update_lxc_conf ubuntu \\ lxc_conf="[{'network.ipv4.ip':'10.0.3.5'}]" \\...
salt/modules/lxc.py
def update_lxc_conf(name, lxc_conf, lxc_conf_unset, path=None): ''' Edit LXC configuration options path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion lxc.update_lxc_c...
def update_lxc_conf(name, lxc_conf, lxc_conf_unset, path=None): ''' Edit LXC configuration options path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion lxc.update_lxc_c...
[ "Edit", "LXC", "configuration", "options" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2951-L3051
[ "def", "update_lxc_conf", "(", "name", ",", "lxc_conf", ",", "lxc_conf_unset", ",", "path", "=", "None", ")", ":", "_ensure_exists", "(", "name", ",", "path", "=", "path", ")", "cpath", "=", "get_root_path", "(", "path", ")", "lxc_conf_p", "=", "os", "."...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_dns
.. versionchanged:: 2015.5.0 The ``dnsservers`` and ``searchdomains`` parameters can now be passed as a comma-separated list. Update /etc/resolv.confo path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 CLI Example:...
salt/modules/lxc.py
def set_dns(name, dnsservers=None, searchdomains=None, path=None): ''' .. versionchanged:: 2015.5.0 The ``dnsservers`` and ``searchdomains`` parameters can now be passed as a comma-separated list. Update /etc/resolv.confo path path to the container parent default: /var...
def set_dns(name, dnsservers=None, searchdomains=None, path=None): ''' .. versionchanged:: 2015.5.0 The ``dnsservers`` and ``searchdomains`` parameters can now be passed as a comma-separated list. Update /etc/resolv.confo path path to the container parent default: /var...
[ "..", "versionchanged", "::", "2015", ".", "5", ".", "0", "The", "dnsservers", "and", "searchdomains", "parameters", "can", "now", "be", "passed", "as", "a", "comma", "-", "separated", "list", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L3054-L3147
[ "def", "set_dns", "(", "name", ",", "dnsservers", "=", "None", ",", "searchdomains", "=", "None", ",", "path", "=", "None", ")", ":", "if", "dnsservers", "is", "None", ":", "dnsservers", "=", "[", "'8.8.8.8'", ",", "'4.4.4.4'", "]", "elif", "not", "isi...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
running_systemd
Determine if systemD is running path path to the container parent .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.running_systemd ubuntu
salt/modules/lxc.py
def running_systemd(name, cache=True, path=None): ''' Determine if systemD is running path path to the container parent .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.running_systemd ubuntu ''' k = 'lxc.systemd.test.{0}{1}'.format(name...
def running_systemd(name, cache=True, path=None): ''' Determine if systemD is running path path to the container parent .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.running_systemd ubuntu ''' k = 'lxc.systemd.test.{0}{1}'.format(name...
[ "Determine", "if", "systemD", "is", "running" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L3150-L3224
[ "def", "running_systemd", "(", "name", ",", "cache", "=", "True", ",", "path", "=", "None", ")", ":", "k", "=", "'lxc.systemd.test.{0}{1}'", ".", "format", "(", "name", ",", "path", ")", "ret", "=", "__context__", ".", "get", "(", "k", ",", "None", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
systemd_running_state
Get the operational state of a systemd based container path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion lxc.systemd_running_state ubuntu
salt/modules/lxc.py
def systemd_running_state(name, path=None): ''' Get the operational state of a systemd based container path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion lxc.systemd_...
def systemd_running_state(name, path=None): ''' Get the operational state of a systemd based container path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion lxc.systemd_...
[ "Get", "the", "operational", "state", "of", "a", "systemd", "based", "container" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L3227-L3251
[ "def", "systemd_running_state", "(", "name", ",", "path", "=", "None", ")", ":", "try", ":", "ret", "=", "run_all", "(", "name", ",", "'systemctl is-system-running'", ",", "path", "=", "path", ",", "ignore_retcode", "=", "True", ")", "[", "'stdout'", "]", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
wait_started
Check that the system has fully inited This is actually very important for systemD based containers see https://github.com/saltstack/salt/issues/23847 path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 CLI Example: .. cod...
salt/modules/lxc.py
def wait_started(name, path=None, timeout=300): ''' Check that the system has fully inited This is actually very important for systemD based containers see https://github.com/saltstack/salt/issues/23847 path path to the container parent default: /var/lib/lxc (system default) ...
def wait_started(name, path=None, timeout=300): ''' Check that the system has fully inited This is actually very important for systemD based containers see https://github.com/saltstack/salt/issues/23847 path path to the container parent default: /var/lib/lxc (system default) ...
[ "Check", "that", "the", "system", "has", "fully", "inited" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L3311-L3359
[ "def", "wait_started", "(", "name", ",", "path", "=", "None", ",", "timeout", "=", "300", ")", ":", "if", "not", "exists", "(", "name", ",", "path", "=", "path", ")", ":", "raise", "CommandExecutionError", "(", "'Container {0} does does exists'", ".", "for...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
attachable
Return True if the named container can be attached to via the lxc-attach command path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt 'minion' lxc.attachable ubuntu
salt/modules/lxc.py
def attachable(name, path=None): ''' Return True if the named container can be attached to via the lxc-attach command path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt 'm...
def attachable(name, path=None): ''' Return True if the named container can be attached to via the lxc-attach command path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt 'm...
[ "Return", "True", "if", "the", "named", "container", "can", "be", "attached", "to", "via", "the", "lxc", "-", "attach", "command" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L3586-L3620
[ "def", "attachable", "(", "name", ",", "path", "=", "None", ")", ":", "cachekey", "=", "'lxc.attachable{0}{1}'", ".", "format", "(", "name", ",", "path", ")", "try", ":", "return", "__context__", "[", "cachekey", "]", "except", "KeyError", ":", "_ensure_ex...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_run
Common logic for lxc.run functions path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0
salt/modules/lxc.py
def _run(name, cmd, output=None, no_start=False, preserve_state=True, stdin=None, python_shell=True, output_loglevel='debug', use_vt=False, path=None, ignore_retcode=False, chroot_fallback=None, keep_env='http_pr...
def _run(name, cmd, output=None, no_start=False, preserve_state=True, stdin=None, python_shell=True, output_loglevel='debug', use_vt=False, path=None, ignore_retcode=False, chroot_fallback=None, keep_env='http_pr...
[ "Common", "logic", "for", "lxc", ".", "run", "functions" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L3623-L3691
[ "def", "_run", "(", "name", ",", "cmd", ",", "output", "=", "None", ",", "no_start", "=", "False", ",", "preserve_state", "=", "True", ",", "stdin", "=", "None", ",", "python_shell", "=", "True", ",", "output_loglevel", "=", "'debug'", ",", "use_vt", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
run
.. versionadded:: 2015.8.0 Run :mod:`cmd.run <salt.modules.cmdmod.run>` within a container .. warning:: Many shell builtins do not work, failing with stderr similar to the following: .. code-block:: bash lxc_container: No such file or directory - failed to exec 'command'...
salt/modules/lxc.py
def run(name, cmd, no_start=False, preserve_state=True, stdin=None, python_shell=True, output_loglevel='debug', use_vt=False, path=None, ignore_retcode=False, chroot_fallback=False, keep_env='http_proxy,https_proxy,no_proxy'): '...
def run(name, cmd, no_start=False, preserve_state=True, stdin=None, python_shell=True, output_loglevel='debug', use_vt=False, path=None, ignore_retcode=False, chroot_fallback=False, keep_env='http_proxy,https_proxy,no_proxy'): '...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L3694-L3780
[ "def", "run", "(", "name", ",", "cmd", ",", "no_start", "=", "False", ",", "preserve_state", "=", "True", ",", "stdin", "=", "None", ",", "python_shell", "=", "True", ",", "output_loglevel", "=", "'debug'", ",", "use_vt", "=", "False", ",", "path", "="...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_md5
Get the MD5 checksum of a file from a container
salt/modules/lxc.py
def _get_md5(name, path): ''' Get the MD5 checksum of a file from a container ''' output = run_stdout(name, 'md5sum "{0}"'.format(path), chroot_fallback=True, ignore_retcode=True) try: return output.split()[0] except IndexError: # D...
def _get_md5(name, path): ''' Get the MD5 checksum of a file from a container ''' output = run_stdout(name, 'md5sum "{0}"'.format(path), chroot_fallback=True, ignore_retcode=True) try: return output.split()[0] except IndexError: # D...
[ "Get", "the", "MD5", "checksum", "of", "a", "file", "from", "a", "container" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L4141-L4152
[ "def", "_get_md5", "(", "name", ",", "path", ")", ":", "output", "=", "run_stdout", "(", "name", ",", "'md5sum \"{0}\"'", ".", "format", "(", "path", ")", ",", "chroot_fallback", "=", "True", ",", "ignore_retcode", "=", "True", ")", "try", ":", "return",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
copy_to
.. versionchanged:: 2015.8.0 Function renamed from ``lxc.cp`` to ``lxc.copy_to`` for consistency with other container types. ``lxc.cp`` will continue to work, however. For versions 2015.2.x and earlier, use ``lxc.cp``. Copy a file or directory from the host into a container name ...
salt/modules/lxc.py
def copy_to(name, source, dest, overwrite=False, makedirs=False, path=None): ''' .. versionchanged:: 2015.8.0 Function renamed from ``lxc.cp`` to ``lxc.copy_to`` for consistency with other container types. ``lxc.cp`` will continue to work, however. For versions 2015.2.x and earlier, use ...
def copy_to(name, source, dest, overwrite=False, makedirs=False, path=None): ''' .. versionchanged:: 2015.8.0 Function renamed from ``lxc.cp`` to ``lxc.copy_to`` for consistency with other container types. ``lxc.cp`` will continue to work, however. For versions 2015.2.x and earlier, use ...
[ "..", "versionchanged", "::", "2015", ".", "8", ".", "0", "Function", "renamed", "from", "lxc", ".", "cp", "to", "lxc", ".", "copy_to", "for", "consistency", "with", "other", "container", "types", ".", "lxc", ".", "cp", "will", "continue", "to", "work", ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L4155-L4212
[ "def", "copy_to", "(", "name", ",", "source", ",", "dest", ",", "overwrite", "=", "False", ",", "makedirs", "=", "False", ",", "path", "=", "None", ")", ":", "_ensure_running", "(", "name", ",", "no_start", "=", "True", ",", "path", "=", "path", ")",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
read_conf
Read in an LXC configuration file. By default returns a simple, unsorted dict, but can also return a more detailed structure including blank lines and comments. out_format: set to 'simple' if you need the old and unsupported behavior. This won't support the multiple lxc values (eg: multiple...
salt/modules/lxc.py
def read_conf(conf_file, out_format='simple'): ''' Read in an LXC configuration file. By default returns a simple, unsorted dict, but can also return a more detailed structure including blank lines and comments. out_format: set to 'simple' if you need the old and unsupported behavior. ...
def read_conf(conf_file, out_format='simple'): ''' Read in an LXC configuration file. By default returns a simple, unsorted dict, but can also return a more detailed structure including blank lines and comments. out_format: set to 'simple' if you need the old and unsupported behavior. ...
[ "Read", "in", "an", "LXC", "configuration", "file", ".", "By", "default", "returns", "a", "simple", "unsorted", "dict", "but", "can", "also", "return", "a", "more", "detailed", "structure", "including", "blank", "lines", "and", "comments", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L4218-L4259
[ "def", "read_conf", "(", "conf_file", ",", "out_format", "=", "'simple'", ")", ":", "ret_commented", "=", "[", "]", "ret_simple", "=", "{", "}", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "conf_file", ",", "'r'", ")", "as", "fp_", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
write_conf
Write out an LXC configuration file This is normally only used internally. The format of the data structure must match that which is returned from ``lxc.read_conf()``, with ``out_format`` set to ``commented``. An example might look like: .. code-block:: python [ {'lxc.utsname...
salt/modules/lxc.py
def write_conf(conf_file, conf): ''' Write out an LXC configuration file This is normally only used internally. The format of the data structure must match that which is returned from ``lxc.read_conf()``, with ``out_format`` set to ``commented``. An example might look like: .. code-block:...
def write_conf(conf_file, conf): ''' Write out an LXC configuration file This is normally only used internally. The format of the data structure must match that which is returned from ``lxc.read_conf()``, with ``out_format`` set to ``commented``. An example might look like: .. code-block:...
[ "Write", "out", "an", "LXC", "configuration", "file" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L4262-L4323
[ "def", "write_conf", "(", "conf_file", ",", "conf", ")", ":", "if", "not", "isinstance", "(", "conf", ",", "list", ")", ":", "raise", "SaltInvocationError", "(", "'Configuration must be passed as a list'", ")", "# construct the content prior to write to the file", "# to...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
edit_conf
Edit an LXC configuration file. If a setting is already present inside the file, its value will be replaced. If it does not exist, it will be appended to the end of the file. Comments and blank lines will be kept in-tact if they already exist in the file. out_format: Set to simple if you need b...
salt/modules/lxc.py
def edit_conf(conf_file, out_format='simple', read_only=False, lxc_config=None, **kwargs): ''' Edit an LXC configuration file. If a setting is already present inside the file, its value will be replaced. If it does not exist, it will be appended to...
def edit_conf(conf_file, out_format='simple', read_only=False, lxc_config=None, **kwargs): ''' Edit an LXC configuration file. If a setting is already present inside the file, its value will be replaced. If it does not exist, it will be appended to...
[ "Edit", "an", "LXC", "configuration", "file", ".", "If", "a", "setting", "is", "already", "present", "inside", "the", "file", "its", "value", "will", "be", "replaced", ".", "If", "it", "does", "not", "exist", "it", "will", "be", "appended", "to", "the", ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L4326-L4436
[ "def", "edit_conf", "(", "conf_file", ",", "out_format", "=", "'simple'", ",", "read_only", "=", "False", ",", "lxc_config", "=", "None", ",", "*", "*", "kwargs", ")", ":", "data", "=", "[", "]", "try", ":", "conf", "=", "read_conf", "(", "conf_file", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
reboot
Reboot a container. path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 CLI Examples: .. code-block:: bash salt 'minion' lxc.reboot myvm
salt/modules/lxc.py
def reboot(name, path=None): ''' Reboot a container. path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 CLI Examples: .. code-block:: bash salt 'minion' lxc.reboot myvm ''' ret = {'result': True, ...
def reboot(name, path=None): ''' Reboot a container. path path to the container parent default: /var/lib/lxc (system default) .. versionadded:: 2015.8.0 CLI Examples: .. code-block:: bash salt 'minion' lxc.reboot myvm ''' ret = {'result': True, ...
[ "Reboot", "a", "container", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L4439-L4476
[ "def", "reboot", "(", "name", ",", "path", "=", "None", ")", ":", "ret", "=", "{", "'result'", ":", "True", ",", "'changes'", ":", "{", "}", ",", "'comment'", ":", "'{0} rebooted'", ".", "format", "(", "name", ")", "}", "does_exist", "=", "exists", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
reconfigure
Reconfigure a container. This only applies to a few property name Name of the container. utsname utsname of the container. .. versionadded:: 2016.3.0 rootfs rootfs of the container. .. versionadded:: 2016.3.0 cpu Select a random number of cpu cor...
salt/modules/lxc.py
def reconfigure(name, cpu=None, cpuset=None, cpushare=None, memory=None, profile=None, network_profile=None, nic_opts=None, bridge=None, gateway=None, autostart...
def reconfigure(name, cpu=None, cpuset=None, cpushare=None, memory=None, profile=None, network_profile=None, nic_opts=None, bridge=None, gateway=None, autostart...
[ "Reconfigure", "a", "container", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L4479-L4608
[ "def", "reconfigure", "(", "name", ",", "cpu", "=", "None", ",", "cpuset", "=", "None", ",", "cpushare", "=", "None", ",", "memory", "=", "None", ",", "profile", "=", "None", ",", "network_profile", "=", "None", ",", "nic_opts", "=", "None", ",", "br...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
apply_network_profile
.. versionadded:: 2015.5.0 Apply a network profile to a container network_profile profile name or default values (dict) nic_opts values to override in defaults (dict) indexed by nic card names path path to the container parent .. versionadded:: 2015.8.0 ...
salt/modules/lxc.py
def apply_network_profile(name, network_profile, nic_opts=None, path=None): ''' .. versionadded:: 2015.5.0 Apply a network profile to a container network_profile profile name or default values (dict) nic_opts values to override in defaults (dict) indexed by nic card names ...
def apply_network_profile(name, network_profile, nic_opts=None, path=None): ''' .. versionadded:: 2015.5.0 Apply a network profile to a container network_profile profile name or default values (dict) nic_opts values to override in defaults (dict) indexed by nic card names ...
[ "..", "versionadded", "::", "2015", ".", "5", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L4611-L4678
[ "def", "apply_network_profile", "(", "name", ",", "network_profile", ",", "nic_opts", "=", "None", ",", "path", "=", "None", ")", ":", "cpath", "=", "get_root_path", "(", "path", ")", "cfgpath", "=", "os", ".", "path", ".", "join", "(", "cpath", ",", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_pid
Returns a container pid. Throw an exception if the container isn't running. CLI Example: .. code-block:: bash salt '*' lxc.get_pid name
salt/modules/lxc.py
def get_pid(name, path=None): ''' Returns a container pid. Throw an exception if the container isn't running. CLI Example: .. code-block:: bash salt '*' lxc.get_pid name ''' if name not in list_(limit='running', path=path): raise CommandExecutionError('Container {0} is not...
def get_pid(name, path=None): ''' Returns a container pid. Throw an exception if the container isn't running. CLI Example: .. code-block:: bash salt '*' lxc.get_pid name ''' if name not in list_(limit='running', path=path): raise CommandExecutionError('Container {0} is not...
[ "Returns", "a", "container", "pid", ".", "Throw", "an", "exception", "if", "the", "container", "isn", "t", "running", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L4681-L4696
[ "def", "get_pid", "(", "name", ",", "path", "=", "None", ")", ":", "if", "name", "not", "in", "list_", "(", "limit", "=", "'running'", ",", "path", "=", "path", ")", ":", "raise", "CommandExecutionError", "(", "'Container {0} is not running, can\\'t determine ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
add_veth
Add a veth to a container. Note : this function doesn't update the container config, just add the interface at runtime name Name of the container interface_name Name of the interface in the container bridge Name of the bridge to attach the interface to (facultative) CLI E...
salt/modules/lxc.py
def add_veth(name, interface_name, bridge=None, path=None): ''' Add a veth to a container. Note : this function doesn't update the container config, just add the interface at runtime name Name of the container interface_name Name of the interface in the container bridge ...
def add_veth(name, interface_name, bridge=None, path=None): ''' Add a veth to a container. Note : this function doesn't update the container config, just add the interface at runtime name Name of the container interface_name Name of the interface in the container bridge ...
[ "Add", "a", "veth", "to", "a", "container", ".", "Note", ":", "this", "function", "doesn", "t", "update", "the", "container", "config", "just", "add", "the", "interface", "at", "runtime" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L4699-L4778
[ "def", "add_veth", "(", "name", ",", "interface_name", ",", "bridge", "=", "None", ",", "path", "=", "None", ")", ":", "# Get container init PID", "pid", "=", "get_pid", "(", "name", ",", "path", "=", "path", ")", "# Generate a ramdom string for veth and ensure ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_LXCConfig._filter_data
Removes parameters which match the pattern from the config data
salt/modules/lxc.py
def _filter_data(self, pattern): ''' Removes parameters which match the pattern from the config data ''' removed = [] filtered = [] for param in self.data: if not param[0].startswith(pattern): filtered.append(param) else: ...
def _filter_data(self, pattern): ''' Removes parameters which match the pattern from the config data ''' removed = [] filtered = [] for param in self.data: if not param[0].startswith(pattern): filtered.append(param) else: ...
[ "Removes", "parameters", "which", "match", "the", "pattern", "from", "the", "config", "data" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L1055-L1067
[ "def", "_filter_data", "(", "self", ",", "pattern", ")", ":", "removed", "=", "[", "]", "filtered", "=", "[", "]", "for", "param", "in", "self", ".", "data", ":", "if", "not", "param", "[", "0", "]", ".", "startswith", "(", "pattern", ")", ":", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_serializer
Helper to return known serializer based on pass output argument
salt/engines/script.py
def _get_serializer(output): ''' Helper to return known serializer based on pass output argument ''' serializers = salt.loader.serializers(__opts__) try: return getattr(serializers, output) except AttributeError: raise CommandExecutionError( "Unknown serializer '{...
def _get_serializer(output): ''' Helper to return known serializer based on pass output argument ''' serializers = salt.loader.serializers(__opts__) try: return getattr(serializers, output) except AttributeError: raise CommandExecutionError( "Unknown serializer '{...
[ "Helper", "to", "return", "known", "serializer", "based", "on", "pass", "output", "argument" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/script.py#L51-L62
[ "def", "_get_serializer", "(", "output", ")", ":", "serializers", "=", "salt", ".", "loader", ".", "serializers", "(", "__opts__", ")", "try", ":", "return", "getattr", "(", "serializers", ",", "output", ")", "except", "AttributeError", ":", "raise", "Comman...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
start
Parse stdout of a command and generate an event The script engine will scrap stdout of the given script and generate an event based on the presence of the 'tag' key and it's value. If there is a data obj available, that will also be fired along with the tag. Example: Given the follow...
salt/engines/script.py
def start(cmd, output='json', interval=1): ''' Parse stdout of a command and generate an event The script engine will scrap stdout of the given script and generate an event based on the presence of the 'tag' key and it's value. If there is a data obj available, that will also be fired alon...
def start(cmd, output='json', interval=1): ''' Parse stdout of a command and generate an event The script engine will scrap stdout of the given script and generate an event based on the presence of the 'tag' key and it's value. If there is a data obj available, that will also be fired alon...
[ "Parse", "stdout", "of", "a", "command", "and", "generate", "an", "event" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/script.py#L65-L141
[ "def", "start", "(", "cmd", ",", "output", "=", "'json'", ",", "interval", "=", "1", ")", ":", "try", ":", "cmd", "=", "shlex", ".", "split", "(", "cmd", ")", "except", "AttributeError", ":", "cmd", "=", "shlex", ".", "split", "(", "six", ".", "t...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
version
Return Bluez version from bluetoothd -v CLI Example: .. code-block:: bash salt '*' bluetoothd.version
salt/modules/bluez_bluetooth.py
def version(): ''' Return Bluez version from bluetoothd -v CLI Example: .. code-block:: bash salt '*' bluetoothd.version ''' cmd = 'bluetoothctl -v' out = __salt__['cmd.run'](cmd).splitlines() bluez_version = out[0] pybluez_version = '<= 0.18 (Unknown, but installed)' ...
def version(): ''' Return Bluez version from bluetoothd -v CLI Example: .. code-block:: bash salt '*' bluetoothd.version ''' cmd = 'bluetoothctl -v' out = __salt__['cmd.run'](cmd).splitlines() bluez_version = out[0] pybluez_version = '<= 0.18 (Unknown, but installed)' ...
[ "Return", "Bluez", "version", "from", "bluetoothd", "-", "v" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluez_bluetooth.py#L48-L66
[ "def", "version", "(", ")", ":", "cmd", "=", "'bluetoothctl -v'", "out", "=", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ")", ".", "splitlines", "(", ")", "bluez_version", "=", "out", "[", "0", "]", "pybluez_version", "=", "'<= 0.18 (Unknown, but install...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
address_
Get the many addresses of the Bluetooth adapter CLI Example: .. code-block:: bash salt '*' bluetooth.address
salt/modules/bluez_bluetooth.py
def address_(): ''' Get the many addresses of the Bluetooth adapter CLI Example: .. code-block:: bash salt '*' bluetooth.address ''' ret = {} cmd = 'hciconfig' out = __salt__['cmd.run'](cmd).splitlines() dev = '' for line in out: if line.startswith('hci'): ...
def address_(): ''' Get the many addresses of the Bluetooth adapter CLI Example: .. code-block:: bash salt '*' bluetooth.address ''' ret = {} cmd = 'hciconfig' out = __salt__['cmd.run'](cmd).splitlines() dev = '' for line in out: if line.startswith('hci'): ...
[ "Get", "the", "many", "addresses", "of", "the", "Bluetooth", "adapter" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluez_bluetooth.py#L69-L98
[ "def", "address_", "(", ")", ":", "ret", "=", "{", "}", "cmd", "=", "'hciconfig'", "out", "=", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ")", ".", "splitlines", "(", ")", "dev", "=", "''", "for", "line", "in", "out", ":", "if", "line", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
power
Power a bluetooth device on or off CLI Examples: .. code-block:: bash salt '*' bluetooth.power hci0 on salt '*' bluetooth.power hci0 off
salt/modules/bluez_bluetooth.py
def power(dev, mode): ''' Power a bluetooth device on or off CLI Examples: .. code-block:: bash salt '*' bluetooth.power hci0 on salt '*' bluetooth.power hci0 off ''' if dev not in address_(): raise CommandExecutionError('Invalid dev passed to bluetooth.power') if...
def power(dev, mode): ''' Power a bluetooth device on or off CLI Examples: .. code-block:: bash salt '*' bluetooth.power hci0 on salt '*' bluetooth.power hci0 off ''' if dev not in address_(): raise CommandExecutionError('Invalid dev passed to bluetooth.power') if...
[ "Power", "a", "bluetooth", "device", "on", "or", "off" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluez_bluetooth.py#L101-L126
[ "def", "power", "(", "dev", ",", "mode", ")", ":", "if", "dev", "not", "in", "address_", "(", ")", ":", "raise", "CommandExecutionError", "(", "'Invalid dev passed to bluetooth.power'", ")", "if", "mode", "==", "'on'", "or", "mode", "is", "True", ":", "sta...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
discoverable
Enable this bluetooth device to be discoverable. CLI Example: .. code-block:: bash salt '*' bluetooth.discoverable hci0
salt/modules/bluez_bluetooth.py
def discoverable(dev): ''' Enable this bluetooth device to be discoverable. CLI Example: .. code-block:: bash salt '*' bluetooth.discoverable hci0 ''' if dev not in address_(): raise CommandExecutionError( 'Invalid dev passed to bluetooth.discoverable' ) ...
def discoverable(dev): ''' Enable this bluetooth device to be discoverable. CLI Example: .. code-block:: bash salt '*' bluetooth.discoverable hci0 ''' if dev not in address_(): raise CommandExecutionError( 'Invalid dev passed to bluetooth.discoverable' ) ...
[ "Enable", "this", "bluetooth", "device", "to", "be", "discoverable", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluez_bluetooth.py#L129-L150
[ "def", "discoverable", "(", "dev", ")", ":", "if", "dev", "not", "in", "address_", "(", ")", ":", "raise", "CommandExecutionError", "(", "'Invalid dev passed to bluetooth.discoverable'", ")", "cmd", "=", "'hciconfig {0} iscan'", ".", "format", "(", "dev", ")", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
scan
Scan for bluetooth devices in the area CLI Example: .. code-block:: bash salt '*' bluetooth.scan
salt/modules/bluez_bluetooth.py
def scan(): ''' Scan for bluetooth devices in the area CLI Example: .. code-block:: bash salt '*' bluetooth.scan ''' ret = [] devices = bluetooth.discover_devices(lookup_names=True) for device in devices: ret.append({device[0]: device[1]}) return ret
def scan(): ''' Scan for bluetooth devices in the area CLI Example: .. code-block:: bash salt '*' bluetooth.scan ''' ret = [] devices = bluetooth.discover_devices(lookup_names=True) for device in devices: ret.append({device[0]: device[1]}) return ret
[ "Scan", "for", "bluetooth", "devices", "in", "the", "area" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluez_bluetooth.py#L175-L189
[ "def", "scan", "(", ")", ":", "ret", "=", "[", "]", "devices", "=", "bluetooth", ".", "discover_devices", "(", "lookup_names", "=", "True", ")", "for", "device", "in", "devices", ":", "ret", ".", "append", "(", "{", "device", "[", "0", "]", ":", "d...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
block
Block a specific bluetooth device by BD Address CLI Example: .. code-block:: bash salt '*' bluetooth.block DE:AD:BE:EF:CA:FE
salt/modules/bluez_bluetooth.py
def block(bdaddr): ''' Block a specific bluetooth device by BD Address CLI Example: .. code-block:: bash salt '*' bluetooth.block DE:AD:BE:EF:CA:FE ''' if not salt.utils.validate.net.mac(bdaddr): raise CommandExecutionError( 'Invalid BD address passed to bluetooth....
def block(bdaddr): ''' Block a specific bluetooth device by BD Address CLI Example: .. code-block:: bash salt '*' bluetooth.block DE:AD:BE:EF:CA:FE ''' if not salt.utils.validate.net.mac(bdaddr): raise CommandExecutionError( 'Invalid BD address passed to bluetooth....
[ "Block", "a", "specific", "bluetooth", "device", "by", "BD", "Address" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluez_bluetooth.py#L192-L208
[ "def", "block", "(", "bdaddr", ")", ":", "if", "not", "salt", ".", "utils", ".", "validate", ".", "net", ".", "mac", "(", "bdaddr", ")", ":", "raise", "CommandExecutionError", "(", "'Invalid BD address passed to bluetooth.block'", ")", "cmd", "=", "'hciconfig ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
pair
Pair the bluetooth adapter with a device CLI Example: .. code-block:: bash salt '*' bluetooth.pair DE:AD:BE:EF:CA:FE 1234 Where DE:AD:BE:EF:CA:FE is the address of the device to pair with, and 1234 is the passphrase. TODO: This function is currently broken, as the bluez-simple-agent pro...
salt/modules/bluez_bluetooth.py
def pair(address, key): ''' Pair the bluetooth adapter with a device CLI Example: .. code-block:: bash salt '*' bluetooth.pair DE:AD:BE:EF:CA:FE 1234 Where DE:AD:BE:EF:CA:FE is the address of the device to pair with, and 1234 is the passphrase. TODO: This function is currently b...
def pair(address, key): ''' Pair the bluetooth adapter with a device CLI Example: .. code-block:: bash salt '*' bluetooth.pair DE:AD:BE:EF:CA:FE 1234 Where DE:AD:BE:EF:CA:FE is the address of the device to pair with, and 1234 is the passphrase. TODO: This function is currently b...
[ "Pair", "the", "bluetooth", "adapter", "with", "a", "device" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluez_bluetooth.py#L230-L263
[ "def", "pair", "(", "address", ",", "key", ")", ":", "if", "not", "salt", ".", "utils", ".", "validate", ".", "net", ".", "mac", "(", "address", ")", ":", "raise", "CommandExecutionError", "(", "'Invalid BD address passed to bluetooth.pair'", ")", "try", ":"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
unpair
Unpair the bluetooth adapter from a device CLI Example: .. code-block:: bash salt '*' bluetooth.unpair DE:AD:BE:EF:CA:FE Where DE:AD:BE:EF:CA:FE is the address of the device to unpair. TODO: This function is currently broken, as the bluez-simple-agent program no longer ships with BlueZ ...
salt/modules/bluez_bluetooth.py
def unpair(address): ''' Unpair the bluetooth adapter from a device CLI Example: .. code-block:: bash salt '*' bluetooth.unpair DE:AD:BE:EF:CA:FE Where DE:AD:BE:EF:CA:FE is the address of the device to unpair. TODO: This function is currently broken, as the bluez-simple-agent progra...
def unpair(address): ''' Unpair the bluetooth adapter from a device CLI Example: .. code-block:: bash salt '*' bluetooth.unpair DE:AD:BE:EF:CA:FE Where DE:AD:BE:EF:CA:FE is the address of the device to unpair. TODO: This function is currently broken, as the bluez-simple-agent progra...
[ "Unpair", "the", "bluetooth", "adapter", "from", "a", "device" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluez_bluetooth.py#L266-L288
[ "def", "unpair", "(", "address", ")", ":", "if", "not", "salt", ".", "utils", ".", "validate", ".", "net", ".", "mac", "(", "address", ")", ":", "raise", "CommandExecutionError", "(", "'Invalid BD address passed to bluetooth.unpair'", ")", "cmd", "=", "'bluez-...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
post_card
Send a message to an MS Teams channel. :param message: The message to send to the MS Teams channel. :param hook_url: The Teams webhook URL, if not specified in the configuration. :param title: Optional title for the posted card :param theme_color: Optional hex color highlight for the poste...
salt/modules/msteams.py
def post_card(message, hook_url=None, title=None, theme_color=None): ''' Send a message to an MS Teams channel. :param message: The message to send to the MS Teams channel. :param hook_url: The Teams webhook URL, if not specified in the configuration. ...
def post_card(message, hook_url=None, title=None, theme_color=None): ''' Send a message to an MS Teams channel. :param message: The message to send to the MS Teams channel. :param hook_url: The Teams webhook URL, if not specified in the configuration. ...
[ "Send", "a", "message", "to", "an", "MS", "Teams", "channel", ".", ":", "param", "message", ":", "The", "message", "to", "send", "to", "the", "MS", "Teams", "channel", ".", ":", "param", "hook_url", ":", "The", "Teams", "webhook", "URL", "if", "not", ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/msteams.py#L54-L96
[ "def", "post_card", "(", "message", ",", "hook_url", "=", "None", ",", "title", "=", "None", ",", "theme_color", "=", "None", ")", ":", "if", "not", "hook_url", ":", "hook_url", "=", "_get_hook_url", "(", ")", "if", "not", "message", ":", "log", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46