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
get_minions
Return a list of minions
salt/returners/cassandra_cql_return.py
def get_minions(): ''' Return a list of minions ''' query = '''SELECT DISTINCT minion_id FROM {keyspace}.minions;'''.format(keyspace=_get_keyspace()) ret = [] # cassandra_cql.cql_query may raise a CommandExecutionError try: data = __salt__['cassandra_cql.cql_query'](...
def get_minions(): ''' Return a list of minions ''' query = '''SELECT DISTINCT minion_id FROM {keyspace}.minions;'''.format(keyspace=_get_keyspace()) ret = [] # cassandra_cql.cql_query may raise a CommandExecutionError try: data = __salt__['cassandra_cql.cql_query'](...
[ "Return", "a", "list", "of", "minions" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/cassandra_cql_return.py#L441-L466
[ "def", "get_minions", "(", ")", ":", "query", "=", "'''SELECT DISTINCT minion_id\n FROM {keyspace}.minions;'''", ".", "format", "(", "keyspace", "=", "_get_keyspace", "(", ")", ")", "ret", "=", "[", "]", "# cassandra_cql.cql_query may raise a CommandExecutionE...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
output
Print the output data in JSON
salt/output/json_out.py
def output(data, **kwargs): # pylint: disable=unused-argument ''' Print the output data in JSON ''' try: if 'output_indent' not in __opts__: return salt.utils.json.dumps(data, default=repr, indent=4) indent = __opts__.get('output_indent') sort_keys = False ...
def output(data, **kwargs): # pylint: disable=unused-argument ''' Print the output data in JSON ''' try: if 'output_indent' not in __opts__: return salt.utils.json.dumps(data, default=repr, indent=4) indent = __opts__.get('output_indent') sort_keys = False ...
[ "Print", "the", "output", "data", "in", "JSON" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/json_out.py#L56-L92
[ "def", "output", "(", "data", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "try", ":", "if", "'output_indent'", "not", "in", "__opts__", ":", "return", "salt", ".", "utils", ".", "json", ".", "dumps", "(", "data", ",", "default",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
present
Ensure that the named database is present with the specified options name The name of the database to manage owner Adds owner using AUTHORIZATION option Grants Can only be a list of strings
salt/states/mssql_role.py
def present(name, owner=None, grants=None, **kwargs): ''' Ensure that the named database is present with the specified options name The name of the database to manage owner Adds owner using AUTHORIZATION option Grants Can only be a list of strings ''' ret = {'name': ...
def present(name, owner=None, grants=None, **kwargs): ''' Ensure that the named database is present with the specified options name The name of the database to manage owner Adds owner using AUTHORIZATION option Grants Can only be a list of strings ''' ret = {'name': ...
[ "Ensure", "that", "the", "named", "database", "is", "present", "with", "the", "specified", "options" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mssql_role.py#L24-L55
[ "def", "present", "(", "name", ",", "owner", "=", "None", ",", "grants", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_change_request_state
Set the approval state of a change request/record :param change_id: The ID of the change request, e.g. CHG123545 :type change_id: ``str`` :param state: The target state, e.g. approved :type state: ``str`` CLI Example: .. code-block:: bash salt myminion servicenow.set_change_reques...
salt/modules/servicenow.py
def set_change_request_state(change_id, state='approved'): ''' Set the approval state of a change request/record :param change_id: The ID of the change request, e.g. CHG123545 :type change_id: ``str`` :param state: The target state, e.g. approved :type state: ``str`` CLI Example: ....
def set_change_request_state(change_id, state='approved'): ''' Set the approval state of a change request/record :param change_id: The ID of the change request, e.g. CHG123545 :type change_id: ``str`` :param state: The target state, e.g. approved :type state: ``str`` CLI Example: ....
[ "Set", "the", "approval", "state", "of", "a", "change", "request", "/", "record" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/servicenow.py#L61-L88
[ "def", "set_change_request_state", "(", "change_id", ",", "state", "=", "'approved'", ")", ":", "client", "=", "_get_client", "(", ")", "client", ".", "table", "=", "'change_request'", "# Get the change record first", "record", "=", "client", ".", "get", "(", "{...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
delete_record
Delete an existing record :param table: The table name, e.g. sys_user :type table: ``str`` :param sys_id: The unique ID of the record :type sys_id: ``str`` CLI Example: .. code-block:: bash salt myminion servicenow.delete_record sys_computer 2134566
salt/modules/servicenow.py
def delete_record(table, sys_id): ''' Delete an existing record :param table: The table name, e.g. sys_user :type table: ``str`` :param sys_id: The unique ID of the record :type sys_id: ``str`` CLI Example: .. code-block:: bash salt myminion servicenow.delete_record sys_co...
def delete_record(table, sys_id): ''' Delete an existing record :param table: The table name, e.g. sys_user :type table: ``str`` :param sys_id: The unique ID of the record :type sys_id: ``str`` CLI Example: .. code-block:: bash salt myminion servicenow.delete_record sys_co...
[ "Delete", "an", "existing", "record" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/servicenow.py#L91-L110
[ "def", "delete_record", "(", "table", ",", "sys_id", ")", ":", "client", "=", "_get_client", "(", ")", "client", ".", "table", "=", "table", "response", "=", "client", ".", "delete", "(", "sys_id", ")", "return", "response" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
non_structured_query
Run a non-structed (not a dict) query on a servicenow table. See http://wiki.servicenow.com/index.php?title=Encoded_Query_Strings#gsc.tab=0 for help on constructing a non-structured query string. :param table: The table name, e.g. sys_user :type table: ``str`` :param query: The query to run (or u...
salt/modules/servicenow.py
def non_structured_query(table, query=None, **kwargs): ''' Run a non-structed (not a dict) query on a servicenow table. See http://wiki.servicenow.com/index.php?title=Encoded_Query_Strings#gsc.tab=0 for help on constructing a non-structured query string. :param table: The table name, e.g. sys_user ...
def non_structured_query(table, query=None, **kwargs): ''' Run a non-structed (not a dict) query on a servicenow table. See http://wiki.servicenow.com/index.php?title=Encoded_Query_Strings#gsc.tab=0 for help on constructing a non-structured query string. :param table: The table name, e.g. sys_user ...
[ "Run", "a", "non", "-", "structed", "(", "not", "a", "dict", ")", "query", "on", "a", "servicenow", "table", ".", "See", "http", ":", "//", "wiki", ".", "servicenow", ".", "com", "/", "index", ".", "php?title", "=", "Encoded_Query_Strings#gsc", ".", "t...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/servicenow.py#L113-L145
[ "def", "non_structured_query", "(", "table", ",", "query", "=", "None", ",", "*", "*", "kwargs", ")", ":", "client", "=", "_get_client", "(", ")", "client", ".", "table", "=", "table", "# underlying lib doesn't use six or past.basestring,", "# does isinstance(x, str...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
update_record_field
Update the value of a record's field in a servicenow table :param table: The table name, e.g. sys_user :type table: ``str`` :param sys_id: The unique ID of the record :type sys_id: ``str`` :param field: The new value :type field: ``str`` :param value: The new value :type value: `...
salt/modules/servicenow.py
def update_record_field(table, sys_id, field, value): ''' Update the value of a record's field in a servicenow table :param table: The table name, e.g. sys_user :type table: ``str`` :param sys_id: The unique ID of the record :type sys_id: ``str`` :param field: The new value :type f...
def update_record_field(table, sys_id, field, value): ''' Update the value of a record's field in a servicenow table :param table: The table name, e.g. sys_user :type table: ``str`` :param sys_id: The unique ID of the record :type sys_id: ``str`` :param field: The new value :type f...
[ "Update", "the", "value", "of", "a", "record", "s", "field", "in", "a", "servicenow", "table" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/servicenow.py#L148-L173
[ "def", "update_record_field", "(", "table", ",", "sys_id", ",", "field", ",", "value", ")", ":", "client", "=", "_get_client", "(", ")", "client", ".", "table", "=", "table", "response", "=", "client", ".", "update", "(", "{", "field", ":", "value", "}...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_parse_pkg_string
Parse pkg string and return a tuple of package name, separator, and package version. Cabal support install package with following format: * foo-1.0 * foo < 1.2 * foo > 1.3 For the sake of simplicity only the first form is supported, support for other forms can be added later.
salt/states/cabal.py
def _parse_pkg_string(pkg): ''' Parse pkg string and return a tuple of package name, separator, and package version. Cabal support install package with following format: * foo-1.0 * foo < 1.2 * foo > 1.3 For the sake of simplicity only the first form is supported, support for othe...
def _parse_pkg_string(pkg): ''' Parse pkg string and return a tuple of package name, separator, and package version. Cabal support install package with following format: * foo-1.0 * foo < 1.2 * foo > 1.3 For the sake of simplicity only the first form is supported, support for othe...
[ "Parse", "pkg", "string", "and", "return", "a", "tuple", "of", "package", "name", "separator", "and", "package", "version", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cabal.py#L40-L55
[ "def", "_parse_pkg_string", "(", "pkg", ")", ":", "pkg_name", ",", "separator", ",", "pkg_ver", "=", "pkg", ".", "partition", "(", "'-'", ")", "return", "(", "pkg_name", ".", "strip", "(", ")", ",", "separator", ",", "pkg_ver", ".", "strip", "(", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
installed
Verify that the given package is installed and is at the correct version (if specified). .. code-block:: yaml ShellCheck-0.3.5: cabal: - installed: name The package to install user The user to run cabal install with install_global Install pack...
salt/states/cabal.py
def installed(name, pkgs=None, user=None, install_global=False, env=None): ''' Verify that the given package is installed and is at the correct version (if specified). .. code-block:: yaml ShellCheck-0.3.5: cabal: - ...
def installed(name, pkgs=None, user=None, install_global=False, env=None): ''' Verify that the given package is installed and is at the correct version (if specified). .. code-block:: yaml ShellCheck-0.3.5: cabal: - ...
[ "Verify", "that", "the", "given", "package", "is", "installed", "and", "is", "at", "the", "correct", "version", "(", "if", "specified", ")", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cabal.py#L58-L169
[ "def", "installed", "(", "name", ",", "pkgs", "=", "None", ",", "user", "=", "None", ",", "install_global", "=", "False", ",", "env", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "None", ",", "'comment'", ":"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
removed
Verify that given package is not installed.
salt/states/cabal.py
def removed(name, user=None, env=None): ''' Verify that given package is not installed. ''' ret = {'name': name, 'result': None, 'comment': '', 'changes': {}} try: installed_pkgs = __salt__['cabal.list']( user=user, installed=True, env=env) except (C...
def removed(name, user=None, env=None): ''' Verify that given package is not installed. ''' ret = {'name': name, 'result': None, 'comment': '', 'changes': {}} try: installed_pkgs = __salt__['cabal.list']( user=user, installed=True, env=env) except (C...
[ "Verify", "that", "given", "package", "is", "not", "installed", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cabal.py#L172-L206
[ "def", "removed", "(", "name", ",", "user", "=", "None", ",", "env", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", "}", "try", ":", "in...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
beacon
Scan for the configured services and fire events Example Config .. code-block:: yaml beacons: service: - services: salt-master: {} mysql: {} The config above sets up beacons to check for the salt-master and mysql services. The config...
salt/beacons/service.py
def beacon(config): ''' Scan for the configured services and fire events Example Config .. code-block:: yaml beacons: service: - services: salt-master: {} mysql: {} The config above sets up beacons to check for the salt-master and...
def beacon(config): ''' Scan for the configured services and fire events Example Config .. code-block:: yaml beacons: service: - services: salt-master: {} mysql: {} The config above sets up beacons to check for the salt-master and...
[ "Scan", "for", "the", "configured", "services", "and", "fire", "events" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/service.py#L44-L164
[ "def", "beacon", "(", "config", ")", ":", "ret", "=", "[", "]", "_config", "=", "{", "}", "list", "(", "map", "(", "_config", ".", "update", ",", "config", ")", ")", "for", "service", "in", "_config", ".", "get", "(", "'services'", ",", "{", "}",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_credentials
Returns the credentials merged with the config data (opts + pillar).
salt/modules/jira_mod.py
def _get_credentials(server=None, username=None, password=None): ''' Returns the credentials merged with the config data (opts + pillar). ''' jira_cfg = __salt__['config.merge']('jira', default={}) if not server: server = jira_cfg.get('server') i...
def _get_credentials(server=None, username=None, password=None): ''' Returns the credentials merged with the config data (opts + pillar). ''' jira_cfg = __salt__['config.merge']('jira', default={}) if not server: server = jira_cfg.get('server') i...
[ "Returns", "the", "credentials", "merged", "with", "the", "config", "data", "(", "opts", "+", "pillar", ")", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jira_mod.py#L50-L63
[ "def", "_get_credentials", "(", "server", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ")", ":", "jira_cfg", "=", "__salt__", "[", "'config.merge'", "]", "(", "'jira'", ",", "default", "=", "{", "}", ")", "if", "not", "serve...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
create_issue
Create a JIRA issue using the named settings. Return the JIRA ticket ID. project The name of the project to attach the JIRA ticket to. summary The summary (title) of the JIRA ticket. When the ``template_engine`` argument is set to a proper value of an existing Salt template engine ...
salt/modules/jira_mod.py
def create_issue(project, summary, description, template_engine='jinja', context=None, defaults=None, saltenv='base', issuetype='Bug', priority='Normal', labels=None, ...
def create_issue(project, summary, description, template_engine='jinja', context=None, defaults=None, saltenv='base', issuetype='Bug', priority='Normal', labels=None, ...
[ "Create", "a", "JIRA", "issue", "using", "the", "named", "settings", ".", "Return", "the", "JIRA", "ticket", "ID", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jira_mod.py#L80-L183
[ "def", "create_issue", "(", "project", ",", "summary", ",", "description", ",", "template_engine", "=", "'jinja'", ",", "context", "=", "None", ",", "defaults", "=", "None", ",", "saltenv", "=", "'base'", ",", "issuetype", "=", "'Bug'", ",", "priority", "=...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
assign_issue
Assign the issue to an existing user. Return ``True`` when the issue has been properly assigned. issue_key The JIRA ID of the ticket to manipulate. assignee The name of the user to assign the ticket to. CLI Example: salt '*' jira.assign_issue NET-123 example_user
salt/modules/jira_mod.py
def assign_issue(issue_key, assignee, server=None, username=None, password=None): ''' Assign the issue to an existing user. Return ``True`` when the issue has been properly assigned. issue_key The JIRA ID of the ticket to manip...
def assign_issue(issue_key, assignee, server=None, username=None, password=None): ''' Assign the issue to an existing user. Return ``True`` when the issue has been properly assigned. issue_key The JIRA ID of the ticket to manip...
[ "Assign", "the", "issue", "to", "an", "existing", "user", ".", "Return", "True", "when", "the", "issue", "has", "been", "properly", "assigned", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jira_mod.py#L186-L209
[ "def", "assign_issue", "(", "issue_key", ",", "assignee", ",", "server", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ")", ":", "jira_", "=", "_get_jira", "(", "server", "=", "server", ",", "username", "=", "username", ",", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
add_comment
Add a comment to an existing ticket. Return ``True`` when it successfully added the comment. issue_key The issue ID to add the comment to. comment The body of the comment to be added. visibility: ``None`` A dictionary having two keys: - ``type``: is ``role`` (or ``gro...
salt/modules/jira_mod.py
def add_comment(issue_key, comment, visibility=None, is_internal=False, server=None, username=None, password=None): ''' Add a comment to an existing ticket. Return ``True`` when it successfully added the comment....
def add_comment(issue_key, comment, visibility=None, is_internal=False, server=None, username=None, password=None): ''' Add a comment to an existing ticket. Return ``True`` when it successfully added the comment....
[ "Add", "a", "comment", "to", "an", "existing", "ticket", ".", "Return", "True", "when", "it", "successfully", "added", "the", "comment", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jira_mod.py#L212-L253
[ "def", "add_comment", "(", "issue_key", ",", "comment", ",", "visibility", "=", "None", ",", "is_internal", "=", "False", ",", "server", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ")", ":", "jira_", "=", "_get_jira", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
issue_closed
Check if the issue is closed. issue_key The JIRA iD of the ticket to close. Returns: - ``True``: the ticket exists and it is closed. - ``False``: the ticket exists and it has not been closed. - ``None``: the ticket does not exist. CLI Example: .. code-block:: bash salt ...
salt/modules/jira_mod.py
def issue_closed(issue_key, server=None, username=None, password=None): ''' Check if the issue is closed. issue_key The JIRA iD of the ticket to close. Returns: - ``True``: the ticket exists and it is closed. - ``False``: the ticket e...
def issue_closed(issue_key, server=None, username=None, password=None): ''' Check if the issue is closed. issue_key The JIRA iD of the ticket to close. Returns: - ``True``: the ticket exists and it is closed. - ``False``: the ticket e...
[ "Check", "if", "the", "issue", "is", "closed", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jira_mod.py#L256-L288
[ "def", "issue_closed", "(", "issue_key", ",", "server", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ")", ":", "if", "not", "issue_key", ":", "return", "None", "jira_", "=", "_get_jira", "(", "server", "=", "server", ",", "u...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_remove_complex_types
Linode-python is now returning some complex types that are not serializable by msgpack. Kill those.
salt/grains/junos.py
def _remove_complex_types(dictionary): ''' Linode-python is now returning some complex types that are not serializable by msgpack. Kill those. ''' for k, v in six.iteritems(dictionary): if isinstance(v, dict): dictionary[k] = _remove_complex_types(v) elif hasattr(v, 'to_...
def _remove_complex_types(dictionary): ''' Linode-python is now returning some complex types that are not serializable by msgpack. Kill those. ''' for k, v in six.iteritems(dictionary): if isinstance(v, dict): dictionary[k] = _remove_complex_types(v) elif hasattr(v, 'to_...
[ "Linode", "-", "python", "is", "now", "returning", "some", "complex", "types", "that", "are", "not", "serializable", "by", "msgpack", ".", "Kill", "those", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/junos.py#L30-L41
[ "def", "_remove_complex_types", "(", "dictionary", ")", ":", "for", "k", ",", "v", "in", "six", ".", "iteritems", "(", "dictionary", ")", ":", "if", "isinstance", "(", "v", ",", "dict", ")", ":", "dictionary", "[", "k", "]", "=", "_remove_complex_types",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
run
Run a single module function or a range of module functions in a batch. Supersedes ``module.run`` function, which requires ``m_`` prefix to function-specific parameters. :param returner: Specify a common returner for the whole batch to send the return data :param kwargs: Pass any argum...
salt/states/module.py
def run(**kwargs): ''' Run a single module function or a range of module functions in a batch. Supersedes ``module.run`` function, which requires ``m_`` prefix to function-specific parameters. :param returner: Specify a common returner for the whole batch to send the return data :param...
def run(**kwargs): ''' Run a single module function or a range of module functions in a batch. Supersedes ``module.run`` function, which requires ``m_`` prefix to function-specific parameters. :param returner: Specify a common returner for the whole batch to send the return data :param...
[ "Run", "a", "single", "module", "function", "or", "a", "range", "of", "module", "functions", "in", "a", "batch", ".", "Supersedes", "module", ".", "run", "function", "which", "requires", "m_", "prefix", "to", "function", "-", "specific", "parameters", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/module.py#L350-L436
[ "def", "run", "(", "*", "*", "kwargs", ")", ":", "if", "'name'", "in", "kwargs", ":", "kwargs", ".", "pop", "(", "'name'", ")", "ret", "=", "{", "'name'", ":", "list", "(", "kwargs", ")", ",", "'changes'", ":", "{", "}", ",", "'comment'", ":", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_call_function
Calls a function from the specified module. :param name: :param kwargs: :return:
salt/states/module.py
def _call_function(name, returner=None, **kwargs): ''' Calls a function from the specified module. :param name: :param kwargs: :return: ''' argspec = salt.utils.args.get_function_argspec(__salt__[name]) # func_kw is initialized to a dictionary of keyword arguments the function to be ru...
def _call_function(name, returner=None, **kwargs): ''' Calls a function from the specified module. :param name: :param kwargs: :return: ''' argspec = salt.utils.args.get_function_argspec(__salt__[name]) # func_kw is initialized to a dictionary of keyword arguments the function to be ru...
[ "Calls", "a", "function", "from", "the", "specified", "module", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/module.py#L439-L496
[ "def", "_call_function", "(", "name", ",", "returner", "=", "None", ",", "*", "*", "kwargs", ")", ":", "argspec", "=", "salt", ".", "utils", ".", "args", ".", "get_function_argspec", "(", "__salt__", "[", "name", "]", ")", "# func_kw is initialized to a dict...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_run
.. deprecated:: 2017.7.0 Function name stays the same, behaviour will change. Run a single module function ``name`` The module function to execute ``returner`` Specify the returner to send the return of the module execution to ``kwargs`` Pass any arguments needed to ex...
salt/states/module.py
def _run(name, **kwargs): ''' .. deprecated:: 2017.7.0 Function name stays the same, behaviour will change. Run a single module function ``name`` The module function to execute ``returner`` Specify the returner to send the return of the module execution to ``kwargs`` ...
def _run(name, **kwargs): ''' .. deprecated:: 2017.7.0 Function name stays the same, behaviour will change. Run a single module function ``name`` The module function to execute ``returner`` Specify the returner to send the return of the module execution to ``kwargs`` ...
[ "..", "deprecated", "::", "2017", ".", "7", ".", "0", "Function", "name", "stays", "the", "same", "behaviour", "will", "change", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/module.py#L499-L647
[ "def", "_run", "(", "name", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'comment'", ":", "''", ",", "'result'", ":", "None", "}", "if", "name", "not", "in", "__salt__", ":", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
match
Determines if this host is on the list
salt/matchers/list_match.py
def match(tgt, opts=None): ''' Determines if this host is on the list ''' if not opts: opts = __opts__ try: if ',' + opts['id'] + ',' in tgt \ or tgt.startswith(opts['id'] + ',') \ or tgt.endswith(',' + opts['id']): return True # t...
def match(tgt, opts=None): ''' Determines if this host is on the list ''' if not opts: opts = __opts__ try: if ',' + opts['id'] + ',' in tgt \ or tgt.startswith(opts['id'] + ',') \ or tgt.endswith(',' + opts['id']): return True # t...
[ "Determines", "if", "this", "host", "is", "on", "the", "list" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/matchers/list_match.py#L11-L42
[ "def", "match", "(", "tgt", ",", "opts", "=", "None", ")", ":", "if", "not", "opts", ":", "opts", "=", "__opts__", "try", ":", "if", "','", "+", "opts", "[", "'id'", "]", "+", "','", "in", "tgt", "or", "tgt", ".", "startswith", "(", "opts", "["...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
db_list
List all InfluxDB databases user The user to connect as password The password of the user host The host to connect to port The port to connect to CLI Example: .. code-block:: bash salt '*' influxdb08.db_list salt '*' influxdb08.db_list <user...
salt/modules/influxdb08mod.py
def db_list(user=None, password=None, host=None, port=None): ''' List all InfluxDB databases user The user to connect as password The password of the user host The host to connect to port The port to connect to CLI Example: .. code-block:: bash ...
def db_list(user=None, password=None, host=None, port=None): ''' List all InfluxDB databases user The user to connect as password The password of the user host The host to connect to port The port to connect to CLI Example: .. code-block:: bash ...
[ "List", "all", "InfluxDB", "databases" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L65-L90
[ "def", "db_list", "(", "user", "=", "None", ",", "password", "=", "None", ",", "host", "=", "None", ",", "port", "=", "None", ")", ":", "client", "=", "_client", "(", "user", "=", "user", ",", "password", "=", "password", ",", "host", "=", "host", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
db_exists
Checks if a database exists in Influxdb name Database name to create user The user to connect as password The password of the user host The host to connect to port The port to connect to CLI Example: .. code-block:: bash salt '*' influx...
salt/modules/influxdb08mod.py
def db_exists(name, user=None, password=None, host=None, port=None): ''' Checks if a database exists in Influxdb name Database name to create user The user to connect as password The password of the user host The host to connect to port The port t...
def db_exists(name, user=None, password=None, host=None, port=None): ''' Checks if a database exists in Influxdb name Database name to create user The user to connect as password The password of the user host The host to connect to port The port t...
[ "Checks", "if", "a", "database", "exists", "in", "Influxdb" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L93-L122
[ "def", "db_exists", "(", "name", ",", "user", "=", "None", ",", "password", "=", "None", ",", "host", "=", "None", ",", "port", "=", "None", ")", ":", "dbs", "=", "db_list", "(", "user", ",", "password", ",", "host", ",", "port", ")", "if", "not"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
db_create
Create a database name Database name to create user The user to connect as password The password of the user host The host to connect to port The port to connect to CLI Example: .. code-block:: bash salt '*' influxdb08.db_create <name> ...
salt/modules/influxdb08mod.py
def db_create(name, user=None, password=None, host=None, port=None): ''' Create a database name Database name to create user The user to connect as password The password of the user host The host to connect to port The port to connect to CLI ...
def db_create(name, user=None, password=None, host=None, port=None): ''' Create a database name Database name to create user The user to connect as password The password of the user host The host to connect to port The port to connect to CLI ...
[ "Create", "a", "database" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L125-L156
[ "def", "db_create", "(", "name", ",", "user", "=", "None", ",", "password", "=", "None", ",", "host", "=", "None", ",", "port", "=", "None", ")", ":", "if", "db_exists", "(", "name", ",", "user", ",", "password", ",", "host", ",", "port", ")", ":...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
db_remove
Remove a database name Database name to remove user The user to connect as password The password of the user host The host to connect to port The port to connect to CLI Example: .. code-block:: bash salt '*' influxdb08.db_remove <name> ...
salt/modules/influxdb08mod.py
def db_remove(name, user=None, password=None, host=None, port=None): ''' Remove a database name Database name to remove user The user to connect as password The password of the user host The host to connect to port The port to connect to CLI ...
def db_remove(name, user=None, password=None, host=None, port=None): ''' Remove a database name Database name to remove user The user to connect as password The password of the user host The host to connect to port The port to connect to CLI ...
[ "Remove", "a", "database" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L159-L189
[ "def", "db_remove", "(", "name", ",", "user", "=", "None", ",", "password", "=", "None", ",", "host", "=", "None", ",", "port", "=", "None", ")", ":", "if", "not", "db_exists", "(", "name", ",", "user", ",", "password", ",", "host", ",", "port", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
user_list
List cluster admins or database users. If a database is specified: it will return database users list. If a database is not specified: it will return cluster admins list. database The database to list the users from user The user to connect as password The password of the...
salt/modules/influxdb08mod.py
def user_list(database=None, user=None, password=None, host=None, port=None): ''' List cluster admins or database users. If a database is specified: it will return database users list. If a database is not specified: it will return cluster admins list. database The database to list the use...
def user_list(database=None, user=None, password=None, host=None, port=None): ''' List cluster admins or database users. If a database is specified: it will return database users list. If a database is not specified: it will return cluster admins list. database The database to list the use...
[ "List", "cluster", "admins", "or", "database", "users", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L192-L228
[ "def", "user_list", "(", "database", "=", "None", ",", "user", "=", "None", ",", "password", "=", "None", ",", "host", "=", "None", ",", "port", "=", "None", ")", ":", "client", "=", "_client", "(", "user", "=", "user", ",", "password", "=", "passw...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
user_exists
Checks if a cluster admin or database user exists. If a database is specified: it will check for database user existence. If a database is not specified: it will check for cluster admin existence. name User name database The database to check for the user to exist user Th...
salt/modules/influxdb08mod.py
def user_exists(name, database=None, user=None, password=None, host=None, port=None): ''' Checks if a cluster admin or database user exists. If a database is specified: it will check for database user existence. If a database is not specified: it will check for cluster admin existence. name ...
def user_exists(name, database=None, user=None, password=None, host=None, port=None): ''' Checks if a cluster admin or database user exists. If a database is specified: it will check for database user existence. If a database is not specified: it will check for cluster admin existence. name ...
[ "Checks", "if", "a", "cluster", "admin", "or", "database", "user", "exists", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L231-L277
[ "def", "user_exists", "(", "name", ",", "database", "=", "None", ",", "user", "=", "None", ",", "password", "=", "None", ",", "host", "=", "None", ",", "port", "=", "None", ")", ":", "users", "=", "user_list", "(", "database", ",", "user", ",", "pa...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
user_create
Create a cluster admin or a database user. If a database is specified: it will create database user. If a database is not specified: it will create a cluster admin. name User name for the new user to create passwd Password for the new user to create database The database ...
salt/modules/influxdb08mod.py
def user_create(name, passwd, database=None, user=None, password=None, host=None, port=None): ''' Create a cluster admin or a database user. If a database is specified: it will create database user. If a dat...
def user_create(name, passwd, database=None, user=None, password=None, host=None, port=None): ''' Create a cluster admin or a database user. If a database is specified: it will create database user. If a dat...
[ "Create", "a", "cluster", "admin", "or", "a", "database", "user", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L280-L335
[ "def", "user_create", "(", "name", ",", "passwd", ",", "database", "=", "None", ",", "user", "=", "None", ",", "password", "=", "None", ",", "host", "=", "None", ",", "port", "=", "None", ")", ":", "if", "user_exists", "(", "name", ",", "database", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
user_chpass
Change password for a cluster admin or a database user. If a database is specified: it will update database user password. If a database is not specified: it will update cluster admin password. name User name for whom to change the password passwd New password database Th...
salt/modules/influxdb08mod.py
def user_chpass(name, passwd, database=None, user=None, password=None, host=None, port=None): ''' Change password for a cluster admin or a database user. If a database is specified: it will update database user ...
def user_chpass(name, passwd, database=None, user=None, password=None, host=None, port=None): ''' Change password for a cluster admin or a database user. If a database is specified: it will update database user ...
[ "Change", "password", "for", "a", "cluster", "admin", "or", "a", "database", "user", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L338-L393
[ "def", "user_chpass", "(", "name", ",", "passwd", ",", "database", "=", "None", ",", "user", "=", "None", ",", "password", "=", "None", ",", "host", "=", "None", ",", "port", "=", "None", ")", ":", "if", "not", "user_exists", "(", "name", ",", "dat...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
user_remove
Remove a cluster admin or a database user. If a database is specified: it will remove the database user. If a database is not specified: it will remove the cluster admin. name User name to remove database The database to remove the user from user User name for the new use...
salt/modules/influxdb08mod.py
def user_remove(name, database=None, user=None, password=None, host=None, port=None): ''' Remove a cluster admin or a database user. If a database is specified: it will remove the database user. If a database is not specifi...
def user_remove(name, database=None, user=None, password=None, host=None, port=None): ''' Remove a cluster admin or a database user. If a database is specified: it will remove the database user. If a database is not specifi...
[ "Remove", "a", "cluster", "admin", "or", "a", "database", "user", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L396-L450
[ "def", "user_remove", "(", "name", ",", "database", "=", "None", ",", "user", "=", "None", ",", "password", "=", "None", ",", "host", "=", "None", ",", "port", "=", "None", ")", ":", "if", "not", "user_exists", "(", "name", ",", "database", ",", "u...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
retention_policy_get
Get an existing retention policy. database The database to operate on. name Name of the policy to modify. CLI Example: .. code-block:: bash salt '*' influxdb08.retention_policy_get metrics default
salt/modules/influxdb08mod.py
def retention_policy_get(database, name, user=None, password=None, host=None, port=None): ''' Get an existing retention policy. database The database to operate on. name...
def retention_policy_get(database, name, user=None, password=None, host=None, port=None): ''' Get an existing retention policy. database The database to operate on. name...
[ "Get", "an", "existing", "retention", "policy", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L453-L480
[ "def", "retention_policy_get", "(", "database", ",", "name", ",", "user", "=", "None", ",", "password", "=", "None", ",", "host", "=", "None", ",", "port", "=", "None", ")", ":", "client", "=", "_client", "(", "user", "=", "user", ",", "password", "=...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
retention_policy_exists
Check if a retention policy exists. database The database to operate on. name Name of the policy to modify. CLI Example: .. code-block:: bash salt '*' influxdb08.retention_policy_exists metrics default
salt/modules/influxdb08mod.py
def retention_policy_exists(database, name, user=None, password=None, host=None, port=None): ''' Check if a retention policy exists. database The database to o...
def retention_policy_exists(database, name, user=None, password=None, host=None, port=None): ''' Check if a retention policy exists. database The database to o...
[ "Check", "if", "a", "retention", "policy", "exists", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L483-L505
[ "def", "retention_policy_exists", "(", "database", ",", "name", ",", "user", "=", "None", ",", "password", "=", "None", ",", "host", "=", "None", ",", "port", "=", "None", ")", ":", "policy", "=", "retention_policy_get", "(", "database", ",", "name", ","...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
retention_policy_add
Add a retention policy. database The database to operate on. name Name of the policy to modify. duration How long InfluxDB keeps the data. replication How many copies of the data are stored in the cluster. default Whether this policy should be the default...
salt/modules/influxdb08mod.py
def retention_policy_add(database, name, duration, replication, default=False, user=None, password=None, host=None, port...
def retention_policy_add(database, name, duration, replication, default=False, user=None, password=None, host=None, port...
[ "Add", "a", "retention", "policy", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L508-L543
[ "def", "retention_policy_add", "(", "database", ",", "name", ",", "duration", ",", "replication", ",", "default", "=", "False", ",", "user", "=", "None", ",", "password", "=", "None", ",", "host", "=", "None", ",", "port", "=", "None", ")", ":", "clien...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
retention_policy_alter
Modify an existing retention policy. database The database to operate on. name Name of the policy to modify. duration How long InfluxDB keeps the data. replication How many copies of the data are stored in the cluster. default Whether this policy should b...
salt/modules/influxdb08mod.py
def retention_policy_alter(database, name, duration, replication, default=False, user=None, password=None, host=None, ...
def retention_policy_alter(database, name, duration, replication, default=False, user=None, password=None, host=None, ...
[ "Modify", "an", "existing", "retention", "policy", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L546-L581
[ "def", "retention_policy_alter", "(", "database", ",", "name", ",", "duration", ",", "replication", ",", "default", "=", "False", ",", "user", "=", "None", ",", "password", "=", "None", ",", "host", "=", "None", ",", "port", "=", "None", ")", ":", "cli...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
query
Querying data database The database to query query Query to be executed time_precision Time precision to use ('s', 'm', or 'u') chunked Whether is chunked or not user The user to connect as password The password of the user host ...
salt/modules/influxdb08mod.py
def query(database, query, time_precision='s', chunked=False, user=None, password=None, host=None, port=None): ''' Querying data database The database to query query Query to be executed time_precision T...
def query(database, query, time_precision='s', chunked=False, user=None, password=None, host=None, port=None): ''' Querying data database The database to query query Query to be executed time_precision T...
[ "Querying", "data" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L584-L628
[ "def", "query", "(", "database", ",", "query", ",", "time_precision", "=", "'s'", ",", "chunked", "=", "False", ",", "user", "=", "None", ",", "password", "=", "None", ",", "host", "=", "None", ",", "port", "=", "None", ")", ":", "client", "=", "_c...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
TemporaryLoggingHandler.sync_with_handlers
Sync the stored log records to the provided log handlers.
salt/log/handlers/__init__.py
def sync_with_handlers(self, handlers=()): ''' Sync the stored log records to the provided log handlers. ''' if not handlers: return while self.__messages: record = self.__messages.pop(0) for handler in handlers: if handler.lev...
def sync_with_handlers(self, handlers=()): ''' Sync the stored log records to the provided log handlers. ''' if not handlers: return while self.__messages: record = self.__messages.pop(0) for handler in handlers: if handler.lev...
[ "Sync", "the", "stored", "log", "records", "to", "the", "provided", "log", "handlers", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/handlers/__init__.py#L73-L87
[ "def", "sync_with_handlers", "(", "self", ",", "handlers", "=", "(", ")", ")", ":", "if", "not", "handlers", ":", "return", "while", "self", ".", "__messages", ":", "record", "=", "self", ".", "__messages", ".", "pop", "(", "0", ")", "for", "handler", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
SysLogHandler.handleError
Override the default error handling mechanism for py3 Deal with syslog os errors when the log file does not exist
salt/log/handlers/__init__.py
def handleError(self, record): ''' Override the default error handling mechanism for py3 Deal with syslog os errors when the log file does not exist ''' handled = False if sys.stderr and sys.version_info >= (3, 5, 4): t, v, tb = sys.exc_info() if t...
def handleError(self, record): ''' Override the default error handling mechanism for py3 Deal with syslog os errors when the log file does not exist ''' handled = False if sys.stderr and sys.version_info >= (3, 5, 4): t, v, tb = sys.exc_info() if t...
[ "Override", "the", "default", "error", "handling", "mechanism", "for", "py3", "Deal", "with", "syslog", "os", "errors", "when", "the", "log", "file", "does", "not", "exist" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/handlers/__init__.py#L106-L119
[ "def", "handleError", "(", "self", ",", "record", ")", ":", "handled", "=", "False", "if", "sys", ".", "stderr", "and", "sys", ".", "version_info", ">=", "(", "3", ",", "5", ",", "4", ")", ":", "t", ",", "v", ",", "tb", "=", "sys", ".", "exc_in...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
RotatingFileHandler.handleError
Override the default error handling mechanism Deal with log file rotation errors due to log file in use more softly.
salt/log/handlers/__init__.py
def handleError(self, record): ''' Override the default error handling mechanism Deal with log file rotation errors due to log file in use more softly. ''' handled = False # Can't use "salt.utils.platform.is_windows()" in this file if (sys.platform.start...
def handleError(self, record): ''' Override the default error handling mechanism Deal with log file rotation errors due to log file in use more softly. ''' handled = False # Can't use "salt.utils.platform.is_windows()" in this file if (sys.platform.start...
[ "Override", "the", "default", "error", "handling", "mechanism" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/handlers/__init__.py#L126-L155
[ "def", "handleError", "(", "self", ",", "record", ")", ":", "handled", "=", "False", "# Can't use \"salt.utils.platform.is_windows()\" in this file", "if", "(", "sys", ".", "platform", ".", "startswith", "(", "'win'", ")", "and", "logging", ".", "raiseExceptions", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
beacon
Return status for requested information
salt/beacons/status.py
def beacon(config): ''' Return status for requested information ''' log.debug(config) ctime = datetime.datetime.utcnow().isoformat() if not config: config = [{ 'loadavg': ['all'], 'cpustats': ['all'], 'meminfo': ['all'], 'vmstats': ['all']...
def beacon(config): ''' Return status for requested information ''' log.debug(config) ctime = datetime.datetime.utcnow().isoformat() if not config: config = [{ 'loadavg': ['all'], 'cpustats': ['all'], 'meminfo': ['all'], 'vmstats': ['all']...
[ "Return", "status", "for", "requested", "information" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/status.py#L119-L168
[ "def", "beacon", "(", "config", ")", ":", "log", ".", "debug", "(", "config", ")", "ctime", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", ".", "isoformat", "(", ")", "if", "not", "config", ":", "config", "=", "[", "{", "'loadavg'", ":"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
present
Ensure that the named sysctl value is set in memory and persisted to the named configuration file. The default sysctl configuration file is /etc/sysctl.conf name The name of the sysctl value to edit value The sysctl value to apply config The location of the sysctl configur...
salt/states/sysctl.py
def present(name, value, config=None): ''' Ensure that the named sysctl value is set in memory and persisted to the named configuration file. The default sysctl configuration file is /etc/sysctl.conf name The name of the sysctl value to edit value The sysctl value to apply ...
def present(name, value, config=None): ''' Ensure that the named sysctl value is set in memory and persisted to the named configuration file. The default sysctl configuration file is /etc/sysctl.conf name The name of the sysctl value to edit value The sysctl value to apply ...
[ "Ensure", "that", "the", "named", "sysctl", "value", "is", "set", "in", "memory", "and", "persisted", "to", "the", "named", "configuration", "file", ".", "The", "default", "sysctl", "configuration", "file", "is", "/", "etc", "/", "sysctl", ".", "conf" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/sysctl.py#L33-L131
[ "def", "present", "(", "name", ",", "value", ",", "config", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'changes'", ":", "{", "}", ",", "'comment'", ":", "''", "}", "if", "config", "is", "Non...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
opts
Return the minion configuration settings
salt/grains/opts.py
def opts(): ''' Return the minion configuration settings ''' if __opts__.get('grain_opts', False) or \ (isinstance(__pillar__, dict) and __pillar__.get('grain_opts', False)): return __opts__ return {}
def opts(): ''' Return the minion configuration settings ''' if __opts__.get('grain_opts', False) or \ (isinstance(__pillar__, dict) and __pillar__.get('grain_opts', False)): return __opts__ return {}
[ "Return", "the", "minion", "configuration", "settings" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/opts.py#L9-L16
[ "def", "opts", "(", ")", ":", "if", "__opts__", ".", "get", "(", "'grain_opts'", ",", "False", ")", "or", "(", "isinstance", "(", "__pillar__", ",", "dict", ")", "and", "__pillar__", ".", "get", "(", "'grain_opts'", ",", "False", ")", ")", ":", "retu...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_cmd
.. versionadded:: 2016.3.4 Private function that returns the freebsd-update command string to be executed. It checks if any arguments are given to freebsd-update and appends them accordingly.
salt/modules/freebsd_update.py
def _cmd(**kwargs): ''' .. versionadded:: 2016.3.4 Private function that returns the freebsd-update command string to be executed. It checks if any arguments are given to freebsd-update and appends them accordingly. ''' update_cmd = salt.utils.path.which('freebsd-update') if not update_...
def _cmd(**kwargs): ''' .. versionadded:: 2016.3.4 Private function that returns the freebsd-update command string to be executed. It checks if any arguments are given to freebsd-update and appends them accordingly. ''' update_cmd = salt.utils.path.which('freebsd-update') if not update_...
[ "..", "versionadded", "::", "2016", ".", "3", ".", "4" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsd_update.py#L45-L77
[ "def", "_cmd", "(", "*", "*", "kwargs", ")", ":", "update_cmd", "=", "salt", ".", "utils", ".", "path", ".", "which", "(", "'freebsd-update'", ")", "if", "not", "update_cmd", ":", "raise", "CommandNotFoundError", "(", "'\"freebsd-update\" command not found'", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_wrapper
Helper function that wraps the execution of freebsd-update command. orig: Originating function that called _wrapper(). pre: String that will be prepended to freebsd-update command. post: String that will be appended to freebsd-update command. err_: Dictionary on which...
salt/modules/freebsd_update.py
def _wrapper(orig, pre='', post='', err_=None, run_args=None, **kwargs): ''' Helper function that wraps the execution of freebsd-update command. orig: Originating function that called _wrapper(). pre: String that will be prepended to freebsd-update command. post: String th...
def _wrapper(orig, pre='', post='', err_=None, run_args=None, **kwargs): ''' Helper function that wraps the execution of freebsd-update command. orig: Originating function that called _wrapper(). pre: String that will be prepended to freebsd-update command. post: String th...
[ "Helper", "function", "that", "wraps", "the", "execution", "of", "freebsd", "-", "update", "command", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsd_update.py#L80-L123
[ "def", "_wrapper", "(", "orig", ",", "pre", "=", "''", ",", "post", "=", "''", ",", "err_", "=", "None", ",", "run_args", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "''", "# the message to be returned", "cmd", "=", "_cmd", "(", "*"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
fetch
.. versionadded:: 2016.3.4 freebsd-update fetch wrapper. Based on the currently installed world and the configuration options set, fetch all available binary updates. kwargs: Parameters of freebsd-update command.
salt/modules/freebsd_update.py
def fetch(**kwargs): ''' .. versionadded:: 2016.3.4 freebsd-update fetch wrapper. Based on the currently installed world and the configuration options set, fetch all available binary updates. kwargs: Parameters of freebsd-update command. ''' # fetch continues when no controlling te...
def fetch(**kwargs): ''' .. versionadded:: 2016.3.4 freebsd-update fetch wrapper. Based on the currently installed world and the configuration options set, fetch all available binary updates. kwargs: Parameters of freebsd-update command. ''' # fetch continues when no controlling te...
[ "..", "versionadded", "::", "2016", ".", "3", ".", "4" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsd_update.py#L126-L145
[ "def", "fetch", "(", "*", "*", "kwargs", ")", ":", "# fetch continues when no controlling terminal is present", "pre", "=", "''", "post", "=", "''", "run_args", "=", "{", "}", "if", "float", "(", "__grains__", "[", "'osrelease'", "]", ")", ">=", "10.2", ":",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
update
.. versionadded:: 2016.3.4 Command that simplifies freebsd-update by running freebsd-update fetch first and then freebsd-update install. kwargs: Parameters of freebsd-update command.
salt/modules/freebsd_update.py
def update(**kwargs): ''' .. versionadded:: 2016.3.4 Command that simplifies freebsd-update by running freebsd-update fetch first and then freebsd-update install. kwargs: Parameters of freebsd-update command. ''' stdout = {} for mode in ('fetch', 'install'): err_ = {} ...
def update(**kwargs): ''' .. versionadded:: 2016.3.4 Command that simplifies freebsd-update by running freebsd-update fetch first and then freebsd-update install. kwargs: Parameters of freebsd-update command. ''' stdout = {} for mode in ('fetch', 'install'): err_ = {} ...
[ "..", "versionadded", "::", "2016", ".", "3", ".", "4" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsd_update.py#L174-L193
[ "def", "update", "(", "*", "*", "kwargs", ")", ":", "stdout", "=", "{", "}", "for", "mode", "in", "(", "'fetch'", ",", "'install'", ")", ":", "err_", "=", "{", "}", "ret", "=", "_wrapper", "(", "mode", ",", "err_", "=", "err_", ",", "*", "*", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
uninstalled
Ensure that the named package is not installed. Args: name (str): The flatpak package. Returns: dict: The ``result`` and ``output``. Example: .. code-block:: yaml uninstall_package: flatpack.uninstalled: - name: gimp
salt/states/flatpak.py
def uninstalled(name): ''' Ensure that the named package is not installed. Args: name (str): The flatpak package. Returns: dict: The ``result`` and ``output``. Example: .. code-block:: yaml uninstall_package: flatpack.uninstalled: - name: gimp ...
def uninstalled(name): ''' Ensure that the named package is not installed. Args: name (str): The flatpak package. Returns: dict: The ``result`` and ``output``. Example: .. code-block:: yaml uninstall_package: flatpack.uninstalled: - name: gimp ...
[ "Ensure", "that", "the", "named", "package", "is", "not", "installed", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/flatpak.py#L79-L121
[ "def", "uninstalled", "(", "name", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", "}", "old", "=", "__salt__", "[", "'flatpak.is_installed'", "]", "(", "na...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
add_remote
Adds a new location to install flatpak packages from. Args: name (str): The repository's name. location (str): The location of the repository. Returns: dict: The ``result`` and ``output``. Example: .. code-block:: yaml add_flathub: flatpack.add_remote: ...
salt/states/flatpak.py
def add_remote(name, location): ''' Adds a new location to install flatpak packages from. Args: name (str): The repository's name. location (str): The location of the repository. Returns: dict: The ``result`` and ``output``. Example: .. code-block:: yaml add_...
def add_remote(name, location): ''' Adds a new location to install flatpak packages from. Args: name (str): The repository's name. location (str): The location of the repository. Returns: dict: The ``result`` and ``output``. Example: .. code-block:: yaml add_...
[ "Adds", "a", "new", "location", "to", "install", "flatpak", "packages", "from", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/flatpak.py#L124-L177
[ "def", "add_remote", "(", "name", ",", "location", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", "}", "old", "=", "__salt__", "[", "'flatpak.is_remote_added...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_nictags
List all nictags include_etherstubs : boolean toggle include of etherstubs CLI Example: .. code-block:: bash salt '*' nictagadm.list
salt/modules/smartos_nictagadm.py
def list_nictags(include_etherstubs=True): ''' List all nictags include_etherstubs : boolean toggle include of etherstubs CLI Example: .. code-block:: bash salt '*' nictagadm.list ''' ret = {} cmd = 'nictagadm list -d "|" -p{0}'.format( ' -L' if not include_et...
def list_nictags(include_etherstubs=True): ''' List all nictags include_etherstubs : boolean toggle include of etherstubs CLI Example: .. code-block:: bash salt '*' nictagadm.list ''' ret = {} cmd = 'nictagadm list -d "|" -p{0}'.format( ' -L' if not include_et...
[ "List", "all", "nictags" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_nictagadm.py#L48-L78
[ "def", "list_nictags", "(", "include_etherstubs", "=", "True", ")", ":", "ret", "=", "{", "}", "cmd", "=", "'nictagadm list -d \"|\" -p{0}'", ".", "format", "(", "' -L'", "if", "not", "include_etherstubs", "else", "''", ")", "res", "=", "__salt__", "[", "'cm...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
vms
List all vms connect to nictag nictag : string name of nictag CLI Example: .. code-block:: bash salt '*' nictagadm.vms admin
salt/modules/smartos_nictagadm.py
def vms(nictag): ''' List all vms connect to nictag nictag : string name of nictag CLI Example: .. code-block:: bash salt '*' nictagadm.vms admin ''' ret = {} cmd = 'nictagadm vms {0}'.format(nictag) res = __salt__['cmd.run_all'](cmd) retcode = res['retcode'] ...
def vms(nictag): ''' List all vms connect to nictag nictag : string name of nictag CLI Example: .. code-block:: bash salt '*' nictagadm.vms admin ''' ret = {} cmd = 'nictagadm vms {0}'.format(nictag) res = __salt__['cmd.run_all'](cmd) retcode = res['retcode'] ...
[ "List", "all", "vms", "connect", "to", "nictag" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_nictagadm.py#L81-L102
[ "def", "vms", "(", "nictag", ")", ":", "ret", "=", "{", "}", "cmd", "=", "'nictagadm vms {0}'", ".", "format", "(", "nictag", ")", "res", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ")", "retcode", "=", "res", "[", "'retcode'", "]", "if",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
exists
Check if nictags exists nictag : string one or more nictags to check verbose : boolean return list of nictags CLI Example: .. code-block:: bash salt '*' nictagadm.exists admin
salt/modules/smartos_nictagadm.py
def exists(*nictag, **kwargs): ''' Check if nictags exists nictag : string one or more nictags to check verbose : boolean return list of nictags CLI Example: .. code-block:: bash salt '*' nictagadm.exists admin ''' ret = {} if not nictag: return {'...
def exists(*nictag, **kwargs): ''' Check if nictags exists nictag : string one or more nictags to check verbose : boolean return list of nictags CLI Example: .. code-block:: bash salt '*' nictagadm.exists admin ''' ret = {} if not nictag: return {'...
[ "Check", "if", "nictags", "exists" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_nictagadm.py#L105-L134
[ "def", "exists", "(", "*", "nictag", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "}", "if", "not", "nictag", ":", "return", "{", "'Error'", ":", "'Please provide at least one nictag to check.'", "}", "cmd", "=", "'nictagadm exists -l {0}'", ".", "for...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
add
Add a new nictag name : string name of new nictag mac : string mac of parent interface or 'etherstub' to create a ether stub mtu : int MTU (ignored for etherstubs) CLI Example: .. code-block:: bash salt '*' nictagadm.add storage0 etherstub salt '*' nictaga...
salt/modules/smartos_nictagadm.py
def add(name, mac, mtu=1500): ''' Add a new nictag name : string name of new nictag mac : string mac of parent interface or 'etherstub' to create a ether stub mtu : int MTU (ignored for etherstubs) CLI Example: .. code-block:: bash salt '*' nictagadm.add s...
def add(name, mac, mtu=1500): ''' Add a new nictag name : string name of new nictag mac : string mac of parent interface or 'etherstub' to create a ether stub mtu : int MTU (ignored for etherstubs) CLI Example: .. code-block:: bash salt '*' nictagadm.add s...
[ "Add", "a", "new", "nictag" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_nictagadm.py#L137-L176
[ "def", "add", "(", "name", ",", "mac", ",", "mtu", "=", "1500", ")", ":", "ret", "=", "{", "}", "if", "mtu", ">", "9000", "or", "mtu", "<", "1500", ":", "return", "{", "'Error'", ":", "'mtu must be a value between 1500 and 9000.'", "}", "if", "mac", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
update
Update a nictag name : string name of nictag mac : string optional new mac for nictag mtu : int optional new MTU for nictag CLI Example: .. code-block:: bash salt '*' nictagadm.update trunk mtu=9000
salt/modules/smartos_nictagadm.py
def update(name, mac=None, mtu=None): ''' Update a nictag name : string name of nictag mac : string optional new mac for nictag mtu : int optional new MTU for nictag CLI Example: .. code-block:: bash salt '*' nictagadm.update trunk mtu=9000 ''' ret...
def update(name, mac=None, mtu=None): ''' Update a nictag name : string name of nictag mac : string optional new mac for nictag mtu : int optional new MTU for nictag CLI Example: .. code-block:: bash salt '*' nictagadm.update trunk mtu=9000 ''' ret...
[ "Update", "a", "nictag" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_nictagadm.py#L179-L228
[ "def", "update", "(", "name", ",", "mac", "=", "None", ",", "mtu", "=", "None", ")", ":", "ret", "=", "{", "}", "if", "name", "not", "in", "list_nictags", "(", ")", ":", "return", "{", "'Error'", ":", "'nictag {0} does not exists.'", ".", "format", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
delete
Delete nictag name : string nictag to delete force : boolean force delete even if vms attached CLI Example: .. code-block:: bash salt '*' nictagadm.exists admin
salt/modules/smartos_nictagadm.py
def delete(name, force=False): ''' Delete nictag name : string nictag to delete force : boolean force delete even if vms attached CLI Example: .. code-block:: bash salt '*' nictagadm.exists admin ''' ret = {} if name not in list_nictags(): return ...
def delete(name, force=False): ''' Delete nictag name : string nictag to delete force : boolean force delete even if vms attached CLI Example: .. code-block:: bash salt '*' nictagadm.exists admin ''' ret = {} if name not in list_nictags(): return ...
[ "Delete", "nictag" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_nictagadm.py#L231-L257
[ "def", "delete", "(", "name", ",", "force", "=", "False", ")", ":", "ret", "=", "{", "}", "if", "name", "not", "in", "list_nictags", "(", ")", ":", "return", "True", "cmd", "=", "'nictagadm delete {0}{1}'", ".", "format", "(", "\"-f \"", "if", "force",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
init
Initialize the module.
salt/proxy/philips_hue.py
def init(cnf): ''' Initialize the module. ''' CONFIG['host'] = cnf.get('proxy', {}).get('host') if not CONFIG['host']: raise MinionError(message="Cannot find 'host' parameter in the proxy configuration") CONFIG['user'] = cnf.get('proxy', {}).get('user') if not CONFIG['user']: ...
def init(cnf): ''' Initialize the module. ''' CONFIG['host'] = cnf.get('proxy', {}).get('host') if not CONFIG['host']: raise MinionError(message="Cannot find 'host' parameter in the proxy configuration") CONFIG['user'] = cnf.get('proxy', {}).get('user') if not CONFIG['user']: ...
[ "Initialize", "the", "module", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L79-L91
[ "def", "init", "(", "cnf", ")", ":", "CONFIG", "[", "'host'", "]", "=", "cnf", ".", "get", "(", "'proxy'", ",", "{", "}", ")", ".", "get", "(", "'host'", ")", "if", "not", "CONFIG", "[", "'host'", "]", ":", "raise", "MinionError", "(", "message",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_query
Query the URI :return:
salt/proxy/philips_hue.py
def _query(lamp_id, state, action='', method='GET'): ''' Query the URI :return: ''' # Because salt.utils.query is that dreadful... :( err = None url = "{0}/lights{1}".format(CONFIG['uri'], lamp_id and '/{0}'.format(lamp_id) or '') \ + (action and ...
def _query(lamp_id, state, action='', method='GET'): ''' Query the URI :return: ''' # Because salt.utils.query is that dreadful... :( err = None url = "{0}/lights{1}".format(CONFIG['uri'], lamp_id and '/{0}'.format(lamp_id) or '') \ + (action and ...
[ "Query", "the", "URI" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L110-L137
[ "def", "_query", "(", "lamp_id", ",", "state", ",", "action", "=", "''", ",", "method", "=", "'GET'", ")", ":", "# Because salt.utils.query is that dreadful... :(", "err", "=", "None", "url", "=", "\"{0}/lights{1}\"", ".", "format", "(", "CONFIG", "[", "'uri'"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_set
Set state to the device by ID. :param lamp_id: :param state: :return:
salt/proxy/philips_hue.py
def _set(lamp_id, state, method="state"): ''' Set state to the device by ID. :param lamp_id: :param state: :return: ''' try: res = _query(lamp_id, state, action=method, method='PUT') except Exception as err: raise CommandExecutionError(err) res = len(res) > 1 and re...
def _set(lamp_id, state, method="state"): ''' Set state to the device by ID. :param lamp_id: :param state: :return: ''' try: res = _query(lamp_id, state, action=method, method='PUT') except Exception as err: raise CommandExecutionError(err) res = len(res) > 1 and re...
[ "Set", "state", "to", "the", "device", "by", "ID", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L140-L161
[ "def", "_set", "(", "lamp_id", ",", "state", ",", "method", "=", "\"state\"", ")", ":", "try", ":", "res", "=", "_query", "(", "lamp_id", ",", "state", ",", "action", "=", "method", ",", "method", "=", "'PUT'", ")", "except", "Exception", "as", "err"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_devices
Parse device(s) ID(s) from the common params. :param params: :return:
salt/proxy/philips_hue.py
def _get_devices(params): ''' Parse device(s) ID(s) from the common params. :param params: :return: ''' if 'id' not in params: raise CommandExecutionError("Parameter ID is required.") return type(params['id']) == int and [params['id']] \ or [int(dev) for dev in params['i...
def _get_devices(params): ''' Parse device(s) ID(s) from the common params. :param params: :return: ''' if 'id' not in params: raise CommandExecutionError("Parameter ID is required.") return type(params['id']) == int and [params['id']] \ or [int(dev) for dev in params['i...
[ "Parse", "device", "(", "s", ")", "ID", "(", "s", ")", "from", "the", "common", "params", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L164-L175
[ "def", "_get_devices", "(", "params", ")", ":", "if", "'id'", "not", "in", "params", ":", "raise", "CommandExecutionError", "(", "\"Parameter ID is required.\"", ")", "return", "type", "(", "params", "[", "'id'", "]", ")", "==", "int", "and", "[", "params", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
call_lights
Get info about all available lamps. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. CLI Example: .. code-block:: bash salt '*' hue.lights salt '*' hue.lights id=1 salt '*' hue.lights id=1,2,3
salt/proxy/philips_hue.py
def call_lights(*args, **kwargs): ''' Get info about all available lamps. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. CLI Example: .. code-block:: bash salt '*' hue.lights salt '*' hue.lights id=1 salt '*' hue.lights id...
def call_lights(*args, **kwargs): ''' Get info about all available lamps. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. CLI Example: .. code-block:: bash salt '*' hue.lights salt '*' hue.lights id=1 salt '*' hue.lights id...
[ "Get", "info", "about", "all", "available", "lamps", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L186-L208
[ "def", "call_lights", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "res", "=", "dict", "(", ")", "lights", "=", "_get_lights", "(", ")", "for", "dev_id", "in", "'id'", "in", "kwargs", "and", "_get_devices", "(", "kwargs", ")", "or", "sorted",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
call_switch
Switch lamp ON/OFF. If no particular state is passed, then lamp will be switched to the opposite state. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. * **on**: True or False. Inverted current, if omitted CLI Example: .. code-block:: bash ...
salt/proxy/philips_hue.py
def call_switch(*args, **kwargs): ''' Switch lamp ON/OFF. If no particular state is passed, then lamp will be switched to the opposite state. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. * **on**: True or False. Inverted current, if omitted ...
def call_switch(*args, **kwargs): ''' Switch lamp ON/OFF. If no particular state is passed, then lamp will be switched to the opposite state. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. * **on**: True or False. Inverted current, if omitted ...
[ "Switch", "lamp", "ON", "/", "OFF", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L211-L241
[ "def", "call_switch", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "out", "=", "dict", "(", ")", "devices", "=", "_get_lights", "(", ")", "for", "dev_id", "in", "'id'", "not", "in", "kwargs", "and", "sorted", "(", "devices", ".", "keys", "(...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
call_blink
Blink a lamp. If lamp is ON, then blink ON-OFF-ON, otherwise OFF-ON-OFF. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. * **pause**: Time in seconds. Can be less than 1, i.e. 0.7, 0.5 sec. CLI Example: .. code-block:: bash salt '*' hue.blink ...
salt/proxy/philips_hue.py
def call_blink(*args, **kwargs): ''' Blink a lamp. If lamp is ON, then blink ON-OFF-ON, otherwise OFF-ON-OFF. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. * **pause**: Time in seconds. Can be less than 1, i.e. 0.7, 0.5 sec. CLI Example: .. c...
def call_blink(*args, **kwargs): ''' Blink a lamp. If lamp is ON, then blink ON-OFF-ON, otherwise OFF-ON-OFF. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. * **pause**: Time in seconds. Can be less than 1, i.e. 0.7, 0.5 sec. CLI Example: .. c...
[ "Blink", "a", "lamp", ".", "If", "lamp", "is", "ON", "then", "blink", "ON", "-", "OFF", "-", "ON", "otherwise", "OFF", "-", "ON", "-", "OFF", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L244-L270
[ "def", "call_blink", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "devices", "=", "_get_lights", "(", ")", "pause", "=", "kwargs", ".", "get", "(", "'pause'", ",", "0", ")", "res", "=", "dict", "(", ")", "for", "dev_id", "in", "'id'", "no...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
call_ping
Ping the lamps by issuing a short inversion blink to all available devices. CLI Example: .. code-block:: bash salt '*' hue.ping
salt/proxy/philips_hue.py
def call_ping(*args, **kwargs): ''' Ping the lamps by issuing a short inversion blink to all available devices. CLI Example: .. code-block:: bash salt '*' hue.ping ''' errors = dict() for dev_id, dev_status in call_blink().items(): if not dev_status['result']: ...
def call_ping(*args, **kwargs): ''' Ping the lamps by issuing a short inversion blink to all available devices. CLI Example: .. code-block:: bash salt '*' hue.ping ''' errors = dict() for dev_id, dev_status in call_blink().items(): if not dev_status['result']: ...
[ "Ping", "the", "lamps", "by", "issuing", "a", "short", "inversion", "blink", "to", "all", "available", "devices", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L273-L288
[ "def", "call_ping", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "errors", "=", "dict", "(", ")", "for", "dev_id", ",", "dev_status", "in", "call_blink", "(", ")", ".", "items", "(", ")", ":", "if", "not", "dev_status", "[", "'result'", "]"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
call_status
Return the status of the lamps. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. CLI Example: .. code-block:: bash salt '*' hue.status salt '*' hue.status id=1 salt '*' hue.status id=1,2,3
salt/proxy/philips_hue.py
def call_status(*args, **kwargs): ''' Return the status of the lamps. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. CLI Example: .. code-block:: bash salt '*' hue.status salt '*' hue.status id=1 salt '*' hue.status id=1,2...
def call_status(*args, **kwargs): ''' Return the status of the lamps. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. CLI Example: .. code-block:: bash salt '*' hue.status salt '*' hue.status id=1 salt '*' hue.status id=1,2...
[ "Return", "the", "status", "of", "the", "lamps", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L291-L316
[ "def", "call_status", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "res", "=", "dict", "(", ")", "devices", "=", "_get_lights", "(", ")", "for", "dev_id", "in", "'id'", "not", "in", "kwargs", "and", "sorted", "(", "devices", ".", "keys", "(...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
call_rename
Rename a device. Options: * **id**: Specifies a device ID. Only one device at a time. * **title**: Title of the device. CLI Example: .. code-block:: bash salt '*' hue.rename id=1 title='WC for cats'
salt/proxy/philips_hue.py
def call_rename(*args, **kwargs): ''' Rename a device. Options: * **id**: Specifies a device ID. Only one device at a time. * **title**: Title of the device. CLI Example: .. code-block:: bash salt '*' hue.rename id=1 title='WC for cats' ''' dev_id = _get_devices(kwargs) ...
def call_rename(*args, **kwargs): ''' Rename a device. Options: * **id**: Specifies a device ID. Only one device at a time. * **title**: Title of the device. CLI Example: .. code-block:: bash salt '*' hue.rename id=1 title='WC for cats' ''' dev_id = _get_devices(kwargs) ...
[ "Rename", "a", "device", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L319-L341
[ "def", "call_rename", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "dev_id", "=", "_get_devices", "(", "kwargs", ")", "if", "len", "(", "dev_id", ")", ">", "1", ":", "raise", "CommandExecutionError", "(", "\"Only one device can be renamed at a time\"",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
call_alert
Lamp alert Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. * **on**: Turns on or off an alert. Default is True. CLI Example: .. code-block:: bash salt '*' hue.alert salt '*' hue.alert id=1 salt '*' hue.alert id=1,2,3 on=false
salt/proxy/philips_hue.py
def call_alert(*args, **kwargs): ''' Lamp alert Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. * **on**: Turns on or off an alert. Default is True. CLI Example: .. code-block:: bash salt '*' hue.alert salt '*' hue.alert id=1 ...
def call_alert(*args, **kwargs): ''' Lamp alert Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. * **on**: Turns on or off an alert. Default is True. CLI Example: .. code-block:: bash salt '*' hue.alert salt '*' hue.alert id=1 ...
[ "Lamp", "alert" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L344-L367
[ "def", "call_alert", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "res", "=", "dict", "(", ")", "devices", "=", "_get_lights", "(", ")", "for", "dev_id", "in", "'id'", "not", "in", "kwargs", "and", "sorted", "(", "devices", ".", "keys", "("...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
call_color
Set a color to the lamp. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. * **color**: Fixed color. Values are: red, green, blue, orange, pink, white, yellow, daylight, purple. Default white. * **transition**: Transition 0~200. Advanced:...
salt/proxy/philips_hue.py
def call_color(*args, **kwargs): ''' Set a color to the lamp. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. * **color**: Fixed color. Values are: red, green, blue, orange, pink, white, yellow, daylight, purple. Default white. * **t...
def call_color(*args, **kwargs): ''' Set a color to the lamp. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. * **color**: Fixed color. Values are: red, green, blue, orange, pink, white, yellow, daylight, purple. Default white. * **t...
[ "Set", "a", "color", "to", "the", "lamp", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L396-L454
[ "def", "call_color", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "res", "=", "dict", "(", ")", "colormap", "=", "{", "'red'", ":", "Const", ".", "COLOR_RED", ",", "'green'", ":", "Const", ".", "COLOR_GREEN", ",", "'blue'", ":", "Const", "....
e8541fd6e744ab0df786c0f76102e41631f45d46
train
call_brightness
Set an effect to the lamp. Arguments: * **value**: 0~255 brightness of the lamp. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. * **transition**: Transition 0~200. Default 0. CLI Example: .. code-block:: bash salt '*' hue.brightness...
salt/proxy/philips_hue.py
def call_brightness(*args, **kwargs): ''' Set an effect to the lamp. Arguments: * **value**: 0~255 brightness of the lamp. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. * **transition**: Transition 0~200. Default 0. CLI Example: .. ...
def call_brightness(*args, **kwargs): ''' Set an effect to the lamp. Arguments: * **value**: 0~255 brightness of the lamp. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. * **transition**: Transition 0~200. Default 0. CLI Example: .. ...
[ "Set", "an", "effect", "to", "the", "lamp", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L457-L497
[ "def", "call_brightness", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "res", "=", "dict", "(", ")", "if", "'value'", "not", "in", "kwargs", ":", "raise", "CommandExecutionError", "(", "\"Parameter 'value' is missing\"", ")", "try", ":", "brightness"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
call_temperature
Set the mired color temperature. More: http://en.wikipedia.org/wiki/Mired Arguments: * **value**: 150~500. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. CLI Example: .. code-block:: bash salt '*' hue.temperature value=150 salt ...
salt/proxy/philips_hue.py
def call_temperature(*args, **kwargs): ''' Set the mired color temperature. More: http://en.wikipedia.org/wiki/Mired Arguments: * **value**: 150~500. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. CLI Example: .. code-block:: bash ...
def call_temperature(*args, **kwargs): ''' Set the mired color temperature. More: http://en.wikipedia.org/wiki/Mired Arguments: * **value**: 150~500. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. CLI Example: .. code-block:: bash ...
[ "Set", "the", "mired", "color", "temperature", ".", "More", ":", "http", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Mired" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L500-L533
[ "def", "call_temperature", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "res", "=", "dict", "(", ")", "if", "'value'", "not", "in", "kwargs", ":", "raise", "CommandExecutionError", "(", "\"Parameter 'value' (150~500) is missing\"", ")", "try", ":", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_branch
Find the requested branch in the specified repo
salt/fileserver/hgfs.py
def _get_branch(repo, name): ''' Find the requested branch in the specified repo ''' try: return [x for x in _all_branches(repo) if x[0] == name][0] except IndexError: return False
def _get_branch(repo, name): ''' Find the requested branch in the specified repo ''' try: return [x for x in _all_branches(repo) if x[0] == name][0] except IndexError: return False
[ "Find", "the", "requested", "branch", "in", "the", "specified", "repo" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L111-L118
[ "def", "_get_branch", "(", "repo", ",", "name", ")", ":", "try", ":", "return", "[", "x", "for", "x", "in", "_all_branches", "(", "repo", ")", "if", "x", "[", "0", "]", "==", "name", "]", "[", "0", "]", "except", "IndexError", ":", "return", "Fal...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_bookmark
Find the requested bookmark in the specified repo
salt/fileserver/hgfs.py
def _get_bookmark(repo, name): ''' Find the requested bookmark in the specified repo ''' try: return [x for x in _all_bookmarks(repo) if x[0] == name][0] except IndexError: return False
def _get_bookmark(repo, name): ''' Find the requested bookmark in the specified repo ''' try: return [x for x in _all_bookmarks(repo) if x[0] == name][0] except IndexError: return False
[ "Find", "the", "requested", "bookmark", "in", "the", "specified", "repo" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L132-L139
[ "def", "_get_bookmark", "(", "repo", ",", "name", ")", ":", "try", ":", "return", "[", "x", "for", "x", "in", "_all_bookmarks", "(", "repo", ")", "if", "x", "[", "0", "]", "==", "name", "]", "[", "0", "]", "except", "IndexError", ":", "return", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_tag
Find the requested tag in the specified repo
salt/fileserver/hgfs.py
def _get_tag(repo, name): ''' Find the requested tag in the specified repo ''' try: return [x for x in _all_tags(repo) if x[0] == name][0] except IndexError: return False
def _get_tag(repo, name): ''' Find the requested tag in the specified repo ''' try: return [x for x in _all_tags(repo) if x[0] == name][0] except IndexError: return False
[ "Find", "the", "requested", "tag", "in", "the", "specified", "repo" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L154-L161
[ "def", "_get_tag", "(", "repo", ",", "name", ")", ":", "try", ":", "return", "[", "x", "for", "x", "in", "_all_tags", "(", "repo", ")", "if", "x", "[", "0", "]", "==", "name", "]", "[", "0", "]", "except", "IndexError", ":", "return", "False" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_ref
Return ref tuple if ref is in the repo.
salt/fileserver/hgfs.py
def _get_ref(repo, name): ''' Return ref tuple if ref is in the repo. ''' if name == 'base': name = repo['base'] if name == repo['base'] or name in envs(): if repo['branch_method'] == 'branches': return _get_branch(repo['repo'], name) \ or _get_tag(repo['r...
def _get_ref(repo, name): ''' Return ref tuple if ref is in the repo. ''' if name == 'base': name = repo['base'] if name == repo['base'] or name in envs(): if repo['branch_method'] == 'branches': return _get_branch(repo['repo'], name) \ or _get_tag(repo['r...
[ "Return", "ref", "tuple", "if", "ref", "is", "in", "the", "repo", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L164-L181
[ "def", "_get_ref", "(", "repo", ",", "name", ")", ":", "if", "name", "==", "'base'", ":", "name", "=", "repo", "[", "'base'", "]", "if", "name", "==", "repo", "[", "'base'", "]", "or", "name", "in", "envs", "(", ")", ":", "if", "repo", "[", "'b...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
init
Return a list of hglib objects for the various hgfs remotes
salt/fileserver/hgfs.py
def init(): ''' Return a list of hglib objects for the various hgfs remotes ''' bp_ = os.path.join(__opts__['cachedir'], 'hgfs') new_remote = False repos = [] per_remote_defaults = {} for param in PER_REMOTE_OVERRIDES: per_remote_defaults[param] = \ six.text_type(__o...
def init(): ''' Return a list of hglib objects for the various hgfs remotes ''' bp_ = os.path.join(__opts__['cachedir'], 'hgfs') new_remote = False repos = [] per_remote_defaults = {} for param in PER_REMOTE_OVERRIDES: per_remote_defaults[param] = \ six.text_type(__o...
[ "Return", "a", "list", "of", "hglib", "objects", "for", "the", "various", "hgfs", "remotes" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L193-L341
[ "def", "init", "(", ")", ":", "bp_", "=", "os", ".", "path", ".", "join", "(", "__opts__", "[", "'cachedir'", "]", ",", "'hgfs'", ")", "new_remote", "=", "False", "repos", "=", "[", "]", "per_remote_defaults", "=", "{", "}", "for", "param", "in", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
lock
Place an update.lk ``remote`` can either be a dictionary containing repo configuration information, or a pattern. If the latter, then remotes for which the URL matches the pattern will be locked.
salt/fileserver/hgfs.py
def lock(remote=None): ''' Place an update.lk ``remote`` can either be a dictionary containing repo configuration information, or a pattern. If the latter, then remotes for which the URL matches the pattern will be locked. ''' def _do_lock(repo): success = [] failed = [] ...
def lock(remote=None): ''' Place an update.lk ``remote`` can either be a dictionary containing repo configuration information, or a pattern. If the latter, then remotes for which the URL matches the pattern will be locked. ''' def _do_lock(repo): success = [] failed = [] ...
[ "Place", "an", "update", ".", "lk" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L457-L501
[ "def", "lock", "(", "remote", "=", "None", ")", ":", "def", "_do_lock", "(", "repo", ")", ":", "success", "=", "[", "]", "failed", "=", "[", "]", "if", "not", "os", ".", "path", ".", "exists", "(", "repo", "[", "'lockfile'", "]", ")", ":", "try...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
update
Execute an hg pull on all of the repos
salt/fileserver/hgfs.py
def update(): ''' Execute an hg pull on all of the repos ''' # data for the fileserver event data = {'changed': False, 'backend': 'hgfs'} # _clear_old_remotes runs init(), so use the value from there to avoid a # second init() data['changed'], repos = _clear_old_remotes() ...
def update(): ''' Execute an hg pull on all of the repos ''' # data for the fileserver event data = {'changed': False, 'backend': 'hgfs'} # _clear_old_remotes runs init(), so use the value from there to avoid a # second init() data['changed'], repos = _clear_old_remotes() ...
[ "Execute", "an", "hg", "pull", "on", "all", "of", "the", "repos" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L504-L575
[ "def", "update", "(", ")", ":", "# data for the fileserver event", "data", "=", "{", "'changed'", ":", "False", ",", "'backend'", ":", "'hgfs'", "}", "# _clear_old_remotes runs init(), so use the value from there to avoid a", "# second init()", "data", "[", "'changed'", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
envs
Return a list of refs that can be used as environments
salt/fileserver/hgfs.py
def envs(ignore_cache=False): ''' Return a list of refs that can be used as environments ''' if not ignore_cache: env_cache = os.path.join(__opts__['cachedir'], 'hgfs/envs.p') cache_match = salt.fileserver.check_env_cache(__opts__, env_cache) if cache_match is not None: ...
def envs(ignore_cache=False): ''' Return a list of refs that can be used as environments ''' if not ignore_cache: env_cache = os.path.join(__opts__['cachedir'], 'hgfs/envs.p') cache_match = salt.fileserver.check_env_cache(__opts__, env_cache) if cache_match is not None: ...
[ "Return", "a", "list", "of", "refs", "that", "can", "be", "used", "as", "environments" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L610-L636
[ "def", "envs", "(", "ignore_cache", "=", "False", ")", ":", "if", "not", "ignore_cache", ":", "env_cache", "=", "os", ".", "path", ".", "join", "(", "__opts__", "[", "'cachedir'", "]", ",", "'hgfs/envs.p'", ")", "cache_match", "=", "salt", ".", "fileserv...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
find_file
Find the first file to match the path and ref, read the file out of hg and send the path to the newly cached file
salt/fileserver/hgfs.py
def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613 ''' Find the first file to match the path and ref, read the file out of hg and send the path to the newly cached file ''' fnd = {'path': '', 'rel': ''} if os.path.isabs(path) or tgt_env not in envs(): retu...
def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613 ''' Find the first file to match the path and ref, read the file out of hg and send the path to the newly cached file ''' fnd = {'path': '', 'rel': ''} if os.path.isabs(path) or tgt_env not in envs(): retu...
[ "Find", "the", "first", "file", "to", "match", "the", "path", "and", "ref", "read", "the", "file", "out", "of", "hg", "and", "send", "the", "path", "to", "the", "newly", "cached", "file" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L639-L742
[ "def", "find_file", "(", "path", ",", "tgt_env", "=", "'base'", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=W0613", "fnd", "=", "{", "'path'", ":", "''", ",", "'rel'", ":", "''", "}", "if", "os", ".", "path", ".", "isabs", "(", "path", ")...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
file_hash
Return a file hash, the hash type is set in the master config file
salt/fileserver/hgfs.py
def file_hash(load, fnd): ''' Return a file hash, the hash type is set in the master config file ''' if 'env' in load: # "env" is not supported; Use "saltenv". load.pop('env') if not all(x in load for x in ('path', 'saltenv')): return '' ret = {'hash_type': __opts__['has...
def file_hash(load, fnd): ''' Return a file hash, the hash type is set in the master config file ''' if 'env' in load: # "env" is not supported; Use "saltenv". load.pop('env') if not all(x in load for x in ('path', 'saltenv')): return '' ret = {'hash_type': __opts__['has...
[ "Return", "a", "file", "hash", "the", "hash", "type", "is", "set", "in", "the", "master", "config", "file" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L774-L800
[ "def", "file_hash", "(", "load", ",", "fnd", ")", ":", "if", "'env'", "in", "load", ":", "# \"env\" is not supported; Use \"saltenv\".", "load", ".", "pop", "(", "'env'", ")", "if", "not", "all", "(", "x", "in", "load", "for", "x", "in", "(", "'path'", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_file_lists
Return a dict containing the file lists for files and dirs
salt/fileserver/hgfs.py
def _file_lists(load, form): ''' Return a dict containing the file lists for files and dirs ''' if 'env' in load: # "env" is not supported; Use "saltenv". load.pop('env') list_cachedir = os.path.join(__opts__['cachedir'], 'file_lists/hgfs') if not os.path.isdir(list_cachedir): ...
def _file_lists(load, form): ''' Return a dict containing the file lists for files and dirs ''' if 'env' in load: # "env" is not supported; Use "saltenv". load.pop('env') list_cachedir = os.path.join(__opts__['cachedir'], 'file_lists/hgfs') if not os.path.isdir(list_cachedir): ...
[ "Return", "a", "dict", "containing", "the", "file", "lists", "for", "files", "and", "dirs" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L803-L836
[ "def", "_file_lists", "(", "load", ",", "form", ")", ":", "if", "'env'", "in", "load", ":", "# \"env\" is not supported; Use \"saltenv\".", "load", ".", "pop", "(", "'env'", ")", "list_cachedir", "=", "os", ".", "path", ".", "join", "(", "__opts__", "[", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_file_list
Get a list of all files on the file server in a specified environment
salt/fileserver/hgfs.py
def _get_file_list(load): ''' Get a list of all files on the file server in a specified environment ''' if 'env' in load: # "env" is not supported; Use "saltenv". load.pop('env') if 'saltenv' not in load or load['saltenv'] not in envs(): return [] ret = set() for rep...
def _get_file_list(load): ''' Get a list of all files on the file server in a specified environment ''' if 'env' in load: # "env" is not supported; Use "saltenv". load.pop('env') if 'saltenv' not in load or load['saltenv'] not in envs(): return [] ret = set() for rep...
[ "Get", "a", "list", "of", "all", "files", "on", "the", "file", "server", "in", "a", "specified", "environment" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L846-L868
[ "def", "_get_file_list", "(", "load", ")", ":", "if", "'env'", "in", "load", ":", "# \"env\" is not supported; Use \"saltenv\".", "load", ".", "pop", "(", "'env'", ")", "if", "'saltenv'", "not", "in", "load", "or", "load", "[", "'saltenv'", "]", "not", "in",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_dir_list
Get a list of all directories on the master
salt/fileserver/hgfs.py
def _get_dir_list(load): ''' Get a list of all directories on the master ''' if 'env' in load: # "env" is not supported; Use "saltenv". load.pop('env') if 'saltenv' not in load or load['saltenv'] not in envs(): return [] ret = set() for repo in init(): repo['...
def _get_dir_list(load): ''' Get a list of all directories on the master ''' if 'env' in load: # "env" is not supported; Use "saltenv". load.pop('env') if 'saltenv' not in load or load['saltenv'] not in envs(): return [] ret = set() for repo in init(): repo['...
[ "Get", "a", "list", "of", "all", "directories", "on", "the", "master" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L886-L916
[ "def", "_get_dir_list", "(", "load", ")", ":", "if", "'env'", "in", "load", ":", "# \"env\" is not supported; Use \"saltenv\".", "load", ".", "pop", "(", "'env'", ")", "if", "'saltenv'", "not", "in", "load", "or", "load", "[", "'saltenv'", "]", "not", "in", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
factory
Creates and returns the cache class. If memory caching is enabled by opts MemCache class will be instantiated. If not Cache class will be returned.
salt/cache/__init__.py
def factory(opts, **kwargs): ''' Creates and returns the cache class. If memory caching is enabled by opts MemCache class will be instantiated. If not Cache class will be returned. ''' if opts.get('memcache_expire_seconds', 0): cls = MemCache else: cls = Cache return cls(...
def factory(opts, **kwargs): ''' Creates and returns the cache class. If memory caching is enabled by opts MemCache class will be instantiated. If not Cache class will be returned. ''' if opts.get('memcache_expire_seconds', 0): cls = MemCache else: cls = Cache return cls(...
[ "Creates", "and", "returns", "the", "cache", "class", ".", "If", "memory", "caching", "is", "enabled", "by", "opts", "MemCache", "class", "will", "be", "instantiated", ".", "If", "not", "Cache", "class", "will", "be", "returned", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/__init__.py#L24-L34
[ "def", "factory", "(", "opts", ",", "*", "*", "kwargs", ")", ":", "if", "opts", ".", "get", "(", "'memcache_expire_seconds'", ",", "0", ")", ":", "cls", "=", "MemCache", "else", ":", "cls", "=", "Cache", "return", "cls", "(", "opts", ",", "*", "*",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Cache.cache
Check cache for the data. If it is there, check to see if it needs to be refreshed. If the data is not there, or it needs to be refreshed, then call the callback function (``fun``) with any given ``**kwargs``. In some cases, the callback function returns a list of objects which ...
salt/cache/__init__.py
def cache(self, bank, key, fun, loop_fun=None, **kwargs): ''' Check cache for the data. If it is there, check to see if it needs to be refreshed. If the data is not there, or it needs to be refreshed, then call the callback function (``fun``) with any given ``**kwargs``. ...
def cache(self, bank, key, fun, loop_fun=None, **kwargs): ''' Check cache for the data. If it is there, check to see if it needs to be refreshed. If the data is not there, or it needs to be refreshed, then call the callback function (``fun``) with any given ``**kwargs``. ...
[ "Check", "cache", "for", "the", "data", ".", "If", "it", "is", "there", "check", "to", "see", "if", "it", "needs", "to", "be", "refreshed", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/__init__.py#L96-L132
[ "def", "cache", "(", "self", ",", "bank", ",", "key", ",", "fun", ",", "loop_fun", "=", "None", ",", "*", "*", "kwargs", ")", ":", "expire_seconds", "=", "kwargs", ".", "get", "(", "'expire'", ",", "86400", ")", "# 1 day", "updated", "=", "self", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Cache.store
Store data using the specified module :param bank: The name of the location inside the cache which will hold the key and its associated data. :param key: The name of the key (or file inside a directory) which will hold the data. File extensions should no...
salt/cache/__init__.py
def store(self, bank, key, data): ''' Store data using the specified module :param bank: The name of the location inside the cache which will hold the key and its associated data. :param key: The name of the key (or file inside a directory) which wil...
def store(self, bank, key, data): ''' Store data using the specified module :param bank: The name of the location inside the cache which will hold the key and its associated data. :param key: The name of the key (or file inside a directory) which wil...
[ "Store", "data", "using", "the", "specified", "module" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/__init__.py#L134-L156
[ "def", "store", "(", "self", ",", "bank", ",", "key", ",", "data", ")", ":", "fun", "=", "'{0}.store'", ".", "format", "(", "self", ".", "driver", ")", "return", "self", ".", "modules", "[", "fun", "]", "(", "bank", ",", "key", ",", "data", ",", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Cache.fetch
Fetch data using the specified module :param bank: The name of the location inside the cache which will hold the key and its associated data. :param key: The name of the key (or file inside a directory) which will hold the data. File extensions should no...
salt/cache/__init__.py
def fetch(self, bank, key): ''' Fetch data using the specified module :param bank: The name of the location inside the cache which will hold the key and its associated data. :param key: The name of the key (or file inside a directory) which will hold...
def fetch(self, bank, key): ''' Fetch data using the specified module :param bank: The name of the location inside the cache which will hold the key and its associated data. :param key: The name of the key (or file inside a directory) which will hold...
[ "Fetch", "data", "using", "the", "specified", "module" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/__init__.py#L158-L180
[ "def", "fetch", "(", "self", ",", "bank", ",", "key", ")", ":", "fun", "=", "'{0}.fetch'", ".", "format", "(", "self", ".", "driver", ")", "return", "self", ".", "modules", "[", "fun", "]", "(", "bank", ",", "key", ",", "*", "*", "self", ".", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Cache.list
Lists entries stored in the specified bank. :param bank: The name of the location inside the cache which will hold the key and its associated data. :return: An iterable object containing all bank entries. Returns an empty iterator if the bank doesn't exi...
salt/cache/__init__.py
def list(self, bank): ''' Lists entries stored in the specified bank. :param bank: The name of the location inside the cache which will hold the key and its associated data. :return: An iterable object containing all bank entries. Returns an empty ...
def list(self, bank): ''' Lists entries stored in the specified bank. :param bank: The name of the location inside the cache which will hold the key and its associated data. :return: An iterable object containing all bank entries. Returns an empty ...
[ "Lists", "entries", "stored", "in", "the", "specified", "bank", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/__init__.py#L227-L244
[ "def", "list", "(", "self", ",", "bank", ")", ":", "fun", "=", "'{0}.list'", ".", "format", "(", "self", ".", "driver", ")", "return", "self", ".", "modules", "[", "fun", "]", "(", "bank", ",", "*", "*", "self", ".", "_kwargs", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
error
If name is None Then return empty dict Otherwise raise an exception with __name__ from name, message from message CLI Example: .. code-block:: bash salt-wheel error salt-wheel error.error name="Exception" message="This is an error."
salt/wheel/error.py
def error(name=None, message=''): ''' If name is None Then return empty dict Otherwise raise an exception with __name__ from name, message from message CLI Example: .. code-block:: bash salt-wheel error salt-wheel error.error name="Exception" message="This is an error." ''' ...
def error(name=None, message=''): ''' If name is None Then return empty dict Otherwise raise an exception with __name__ from name, message from message CLI Example: .. code-block:: bash salt-wheel error salt-wheel error.error name="Exception" message="This is an error." ''' ...
[ "If", "name", "is", "None", "Then", "return", "empty", "dict" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/wheel/error.py#L15-L31
[ "def", "error", "(", "name", "=", "None", ",", "message", "=", "''", ")", ":", "ret", "=", "{", "}", "if", "name", "is", "not", "None", ":", "salt", ".", "utils", ".", "error", ".", "raise_error", "(", "name", "=", "name", ",", "message", "=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
present
Ensure the autoscale group exists. name Name of the autoscale group. launch_config_name Name of the launch config to use for the group. Or, if ``launch_config`` is specified, this will be the launch config name's prefix. (see below) launch_config A dictionary of ...
salt/states/boto_asg.py
def present( name, launch_config_name, availability_zones, min_size, max_size, launch_config=None, desired_capacity=None, load_balancers=None, default_cooldown=None, health_check_type=None, health_check_period=None, placemen...
def present( name, launch_config_name, availability_zones, min_size, max_size, launch_config=None, desired_capacity=None, load_balancers=None, default_cooldown=None, health_check_type=None, health_check_period=None, placemen...
[ "Ensure", "the", "autoscale", "group", "exists", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_asg.py#L217-L709
[ "def", "present", "(", "name", ",", "launch_config_name", ",", "availability_zones", ",", "min_size", ",", "max_size", ",", "launch_config", "=", "None", ",", "desired_capacity", "=", "None", ",", "load_balancers", "=", "None", ",", "default_cooldown", "=", "Non...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_determine_termination_policies
helper method for present. ensure that termination_policies are set
salt/states/boto_asg.py
def _determine_termination_policies(termination_policies, termination_policies_from_pillar): ''' helper method for present. ensure that termination_policies are set ''' pillar_termination_policies = copy.deepcopy( __salt__['config.option'](termination_policies_from_pillar, []) ) if not ...
def _determine_termination_policies(termination_policies, termination_policies_from_pillar): ''' helper method for present. ensure that termination_policies are set ''' pillar_termination_policies = copy.deepcopy( __salt__['config.option'](termination_policies_from_pillar, []) ) if not ...
[ "helper", "method", "for", "present", ".", "ensure", "that", "termination_policies", "are", "set" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_asg.py#L712-L721
[ "def", "_determine_termination_policies", "(", "termination_policies", ",", "termination_policies_from_pillar", ")", ":", "pillar_termination_policies", "=", "copy", ".", "deepcopy", "(", "__salt__", "[", "'config.option'", "]", "(", "termination_policies_from_pillar", ",", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_determine_scaling_policies
helper method for present. ensure that scaling_policies are set
salt/states/boto_asg.py
def _determine_scaling_policies(scaling_policies, scaling_policies_from_pillar): ''' helper method for present. ensure that scaling_policies are set ''' pillar_scaling_policies = copy.deepcopy( __salt__['config.option'](scaling_policies_from_pillar, {}) ) if not scaling_policies and pil...
def _determine_scaling_policies(scaling_policies, scaling_policies_from_pillar): ''' helper method for present. ensure that scaling_policies are set ''' pillar_scaling_policies = copy.deepcopy( __salt__['config.option'](scaling_policies_from_pillar, {}) ) if not scaling_policies and pil...
[ "helper", "method", "for", "present", ".", "ensure", "that", "scaling_policies", "are", "set" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_asg.py#L724-L733
[ "def", "_determine_scaling_policies", "(", "scaling_policies", ",", "scaling_policies_from_pillar", ")", ":", "pillar_scaling_policies", "=", "copy", ".", "deepcopy", "(", "__salt__", "[", "'config.option'", "]", "(", "scaling_policies_from_pillar", ",", "{", "}", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_determine_scheduled_actions
helper method for present, ensure scheduled actions are setup
salt/states/boto_asg.py
def _determine_scheduled_actions(scheduled_actions, scheduled_actions_from_pillar): ''' helper method for present, ensure scheduled actions are setup ''' tmp = copy.deepcopy( __salt__['config.option'](scheduled_actions_from_pillar, {}) ) # merge with data from state if scheduled_act...
def _determine_scheduled_actions(scheduled_actions, scheduled_actions_from_pillar): ''' helper method for present, ensure scheduled actions are setup ''' tmp = copy.deepcopy( __salt__['config.option'](scheduled_actions_from_pillar, {}) ) # merge with data from state if scheduled_act...
[ "helper", "method", "for", "present", "ensure", "scheduled", "actions", "are", "setup" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_asg.py#L736-L746
[ "def", "_determine_scheduled_actions", "(", "scheduled_actions", ",", "scheduled_actions_from_pillar", ")", ":", "tmp", "=", "copy", ".", "deepcopy", "(", "__salt__", "[", "'config.option'", "]", "(", "scheduled_actions_from_pillar", ",", "{", "}", ")", ")", "# merg...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_determine_notification_info
helper method for present. ensure that notification_configs are set
salt/states/boto_asg.py
def _determine_notification_info(notification_arn, notification_arn_from_pillar, notification_types, notification_types_from_pillar): ''' helper method for present. ensure that notification_configs are set ''...
def _determine_notification_info(notification_arn, notification_arn_from_pillar, notification_types, notification_types_from_pillar): ''' helper method for present. ensure that notification_configs are set ''...
[ "helper", "method", "for", "present", ".", "ensure", "that", "notification_configs", "are", "set" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_asg.py#L749-L767
[ "def", "_determine_notification_info", "(", "notification_arn", ",", "notification_arn_from_pillar", ",", "notification_types", ",", "notification_types_from_pillar", ")", ":", "pillar_arn_list", "=", "copy", ".", "deepcopy", "(", "__salt__", "[", "'config.option'", "]", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_alarms_present
helper method for present. ensure that cloudwatch_alarms are set
salt/states/boto_asg.py
def _alarms_present(name, min_size_equals_max_size, alarms, alarms_from_pillar, region, key, keyid, profile): ''' helper method for present. ensure that cloudwatch_alarms are set ''' # load data from alarms_from_pillar tmp = copy.deepcopy(__salt__['config.option'](alarms_from_pillar, {})) # mer...
def _alarms_present(name, min_size_equals_max_size, alarms, alarms_from_pillar, region, key, keyid, profile): ''' helper method for present. ensure that cloudwatch_alarms are set ''' # load data from alarms_from_pillar tmp = copy.deepcopy(__salt__['config.option'](alarms_from_pillar, {})) # mer...
[ "helper", "method", "for", "present", ".", "ensure", "that", "cloudwatch_alarms", "are", "set" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_asg.py#L770-L819
[ "def", "_alarms_present", "(", "name", ",", "min_size_equals_max_size", ",", "alarms", ",", "alarms_from_pillar", ",", "region", ",", "key", ",", "keyid", ",", "profile", ")", ":", "# load data from alarms_from_pillar", "tmp", "=", "copy", ".", "deepcopy", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
absent
Ensure the named autoscale group is deleted. name Name of the autoscale group. force Force deletion of autoscale group. remove_lc Delete the launch config as well. region The region to connect to. key Secret key to be used. keyid Access key t...
salt/states/boto_asg.py
def absent( name, force=False, region=None, key=None, keyid=None, profile=None, remove_lc=False): ''' Ensure the named autoscale group is deleted. name Name of the autoscale group. force Force deletion of autoscale group. rem...
def absent( name, force=False, region=None, key=None, keyid=None, profile=None, remove_lc=False): ''' Ensure the named autoscale group is deleted. name Name of the autoscale group. force Force deletion of autoscale group. rem...
[ "Ensure", "the", "named", "autoscale", "group", "is", "deleted", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_asg.py#L822-L892
[ "def", "absent", "(", "name", ",", "force", "=", "False", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ",", "remove_lc", "=", "False", ")", ":", "ret", "=", "{", "'name'", ":", "name...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_setup_conn_old
Setup kubernetes API connection singleton the old way
salt/modules/kubernetesmod.py
def _setup_conn_old(**kwargs): ''' Setup kubernetes API connection singleton the old way ''' host = __salt__['config.option']('kubernetes.api_url', 'http://localhost:8080') username = __salt__['config.option']('kubernetes.user') password = __salt__['config.op...
def _setup_conn_old(**kwargs): ''' Setup kubernetes API connection singleton the old way ''' host = __salt__['config.option']('kubernetes.api_url', 'http://localhost:8080') username = __salt__['config.option']('kubernetes.user') password = __salt__['config.op...
[ "Setup", "kubernetes", "API", "connection", "singleton", "the", "old", "way" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L117-L188
[ "def", "_setup_conn_old", "(", "*", "*", "kwargs", ")", ":", "host", "=", "__salt__", "[", "'config.option'", "]", "(", "'kubernetes.api_url'", ",", "'http://localhost:8080'", ")", "username", "=", "__salt__", "[", "'config.option'", "]", "(", "'kubernetes.user'",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_setup_conn
Setup kubernetes API connection singleton
salt/modules/kubernetesmod.py
def _setup_conn(**kwargs): ''' Setup kubernetes API connection singleton ''' kubeconfig = kwargs.get('kubeconfig') or __salt__['config.option']('kubernetes.kubeconfig') kubeconfig_data = kwargs.get('kubeconfig_data') or __salt__['config.option']('kubernetes.kubeconfig-data') context = kwargs.get...
def _setup_conn(**kwargs): ''' Setup kubernetes API connection singleton ''' kubeconfig = kwargs.get('kubeconfig') or __salt__['config.option']('kubernetes.kubeconfig') kubeconfig_data = kwargs.get('kubeconfig_data') or __salt__['config.option']('kubernetes.kubeconfig-data') context = kwargs.get...
[ "Setup", "kubernetes", "API", "connection", "singleton" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L192-L219
[ "def", "_setup_conn", "(", "*", "*", "kwargs", ")", ":", "kubeconfig", "=", "kwargs", ".", "get", "(", "'kubeconfig'", ")", "or", "__salt__", "[", "'config.option'", "]", "(", "'kubernetes.kubeconfig'", ")", "kubeconfig_data", "=", "kwargs", ".", "get", "(",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ping
Checks connections with the kubernetes API server. Returns True if the connection can be established, False otherwise. CLI Example: salt '*' kubernetes.ping
salt/modules/kubernetesmod.py
def ping(**kwargs): ''' Checks connections with the kubernetes API server. Returns True if the connection can be established, False otherwise. CLI Example: salt '*' kubernetes.ping ''' status = True try: nodes(**kwargs) except CommandExecutionError: status = Fals...
def ping(**kwargs): ''' Checks connections with the kubernetes API server. Returns True if the connection can be established, False otherwise. CLI Example: salt '*' kubernetes.ping ''' status = True try: nodes(**kwargs) except CommandExecutionError: status = Fals...
[ "Checks", "connections", "with", "the", "kubernetes", "API", "server", ".", "Returns", "True", "if", "the", "connection", "can", "be", "established", "False", "otherwise", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L251-L265
[ "def", "ping", "(", "*", "*", "kwargs", ")", ":", "status", "=", "True", "try", ":", "nodes", "(", "*", "*", "kwargs", ")", "except", "CommandExecutionError", ":", "status", "=", "False", "return", "status" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
nodes
Return the names of the nodes composing the kubernetes cluster CLI Examples:: salt '*' kubernetes.nodes salt '*' kubernetes.nodes kubeconfig=/etc/salt/k8s/kubeconfig context=minikube
salt/modules/kubernetesmod.py
def nodes(**kwargs): ''' Return the names of the nodes composing the kubernetes cluster CLI Examples:: salt '*' kubernetes.nodes salt '*' kubernetes.nodes kubeconfig=/etc/salt/k8s/kubeconfig context=minikube ''' cfg = _setup_conn(**kwargs) try: api_instance = kubernetes...
def nodes(**kwargs): ''' Return the names of the nodes composing the kubernetes cluster CLI Examples:: salt '*' kubernetes.nodes salt '*' kubernetes.nodes kubeconfig=/etc/salt/k8s/kubeconfig context=minikube ''' cfg = _setup_conn(**kwargs) try: api_instance = kubernetes...
[ "Return", "the", "names", "of", "the", "nodes", "composing", "the", "kubernetes", "cluster" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L268-L290
[ "def", "nodes", "(", "*", "*", "kwargs", ")", ":", "cfg", "=", "_setup_conn", "(", "*", "*", "kwargs", ")", "try", ":", "api_instance", "=", "kubernetes", ".", "client", ".", "CoreV1Api", "(", ")", "api_response", "=", "api_instance", ".", "list_node", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
node
Return the details of the node identified by the specified name CLI Examples:: salt '*' kubernetes.node name='minikube'
salt/modules/kubernetesmod.py
def node(name, **kwargs): ''' Return the details of the node identified by the specified name CLI Examples:: salt '*' kubernetes.node name='minikube' ''' cfg = _setup_conn(**kwargs) try: api_instance = kubernetes.client.CoreV1Api() api_response = api_instance.list_node(...
def node(name, **kwargs): ''' Return the details of the node identified by the specified name CLI Examples:: salt '*' kubernetes.node name='minikube' ''' cfg = _setup_conn(**kwargs) try: api_instance = kubernetes.client.CoreV1Api() api_response = api_instance.list_node(...
[ "Return", "the", "details", "of", "the", "node", "identified", "by", "the", "specified", "name" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L293-L318
[ "def", "node", "(", "name", ",", "*", "*", "kwargs", ")", ":", "cfg", "=", "_setup_conn", "(", "*", "*", "kwargs", ")", "try", ":", "api_instance", "=", "kubernetes", ".", "client", ".", "CoreV1Api", "(", ")", "api_response", "=", "api_instance", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
node_add_label
Set the value of the label identified by `label_name` to `label_value` on the node identified by the name `node_name`. Creates the lable if not present. CLI Examples:: salt '*' kubernetes.node_add_label node_name="minikube" \ label_name="foo" label_value="bar"
salt/modules/kubernetesmod.py
def node_add_label(node_name, label_name, label_value, **kwargs): ''' Set the value of the label identified by `label_name` to `label_value` on the node identified by the name `node_name`. Creates the lable if not present. CLI Examples:: salt '*' kubernetes.node_add_label node_name="miniku...
def node_add_label(node_name, label_name, label_value, **kwargs): ''' Set the value of the label identified by `label_name` to `label_value` on the node identified by the name `node_name`. Creates the lable if not present. CLI Examples:: salt '*' kubernetes.node_add_label node_name="miniku...
[ "Set", "the", "value", "of", "the", "label", "identified", "by", "label_name", "to", "label_value", "on", "the", "node", "identified", "by", "the", "name", "node_name", ".", "Creates", "the", "lable", "if", "not", "present", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L337-L368
[ "def", "node_add_label", "(", "node_name", ",", "label_name", ",", "label_value", ",", "*", "*", "kwargs", ")", ":", "cfg", "=", "_setup_conn", "(", "*", "*", "kwargs", ")", "try", ":", "api_instance", "=", "kubernetes", ".", "client", ".", "CoreV1Api", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
namespaces
Return the names of the available namespaces CLI Examples:: salt '*' kubernetes.namespaces salt '*' kubernetes.namespaces kubeconfig=/etc/salt/k8s/kubeconfig context=minikube
salt/modules/kubernetesmod.py
def namespaces(**kwargs): ''' Return the names of the available namespaces CLI Examples:: salt '*' kubernetes.namespaces salt '*' kubernetes.namespaces kubeconfig=/etc/salt/k8s/kubeconfig context=minikube ''' cfg = _setup_conn(**kwargs) try: api_instance = kubernetes.cl...
def namespaces(**kwargs): ''' Return the names of the available namespaces CLI Examples:: salt '*' kubernetes.namespaces salt '*' kubernetes.namespaces kubeconfig=/etc/salt/k8s/kubeconfig context=minikube ''' cfg = _setup_conn(**kwargs) try: api_instance = kubernetes.cl...
[ "Return", "the", "names", "of", "the", "available", "namespaces" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L404-L426
[ "def", "namespaces", "(", "*", "*", "kwargs", ")", ":", "cfg", "=", "_setup_conn", "(", "*", "*", "kwargs", ")", "try", ":", "api_instance", "=", "kubernetes", ".", "client", ".", "CoreV1Api", "(", ")", "api_response", "=", "api_instance", ".", "list_nam...
e8541fd6e744ab0df786c0f76102e41631f45d46