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
execute_return_success
Executes the passed command. Returns True if successful :param str cmd: The command to run :return: True if successful, otherwise False :rtype: bool :raises: Error if command fails or is not supported
salt/utils/mac_utils.py
def execute_return_success(cmd): ''' Executes the passed command. Returns True if successful :param str cmd: The command to run :return: True if successful, otherwise False :rtype: bool :raises: Error if command fails or is not supported ''' ret = _run_all(cmd) if ret['retcode']...
def execute_return_success(cmd): ''' Executes the passed command. Returns True if successful :param str cmd: The command to run :return: True if successful, otherwise False :rtype: bool :raises: Error if command fails or is not supported ''' ret = _run_all(cmd) if ret['retcode']...
[ "Executes", "the", "passed", "command", ".", "Returns", "True", "if", "successful" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/mac_utils.py#L144-L165
[ "def", "execute_return_success", "(", "cmd", ")", ":", "ret", "=", "_run_all", "(", "cmd", ")", "if", "ret", "[", "'retcode'", "]", "!=", "0", "or", "'not supported'", "in", "ret", "[", "'stdout'", "]", ".", "lower", "(", ")", ":", "msg", "=", "'Comm...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
execute_return_result
Executes the passed command. Returns the standard out if successful :param str cmd: The command to run :return: The standard out of the command if successful, otherwise returns an error :rtype: str :raises: Error if command fails or is not supported
salt/utils/mac_utils.py
def execute_return_result(cmd): ''' Executes the passed command. Returns the standard out if successful :param str cmd: The command to run :return: The standard out of the command if successful, otherwise returns an error :rtype: str :raises: Error if command fails or is not supported ...
def execute_return_result(cmd): ''' Executes the passed command. Returns the standard out if successful :param str cmd: The command to run :return: The standard out of the command if successful, otherwise returns an error :rtype: str :raises: Error if command fails or is not supported ...
[ "Executes", "the", "passed", "command", ".", "Returns", "the", "standard", "out", "if", "successful" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/mac_utils.py#L168-L189
[ "def", "execute_return_result", "(", "cmd", ")", ":", "ret", "=", "_run_all", "(", "cmd", ")", "if", "ret", "[", "'retcode'", "]", "!=", "0", "or", "'not supported'", "in", "ret", "[", "'stdout'", "]", ".", "lower", "(", ")", ":", "msg", "=", "'Comma...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
validate_enabled
Helper function to validate the enabled parameter. Boolean values are converted to "on" and "off". String values are checked to make sure they are either "on" or "off"/"yes" or "no". Integer ``0`` will return "off". All other integers will return "on" :param enabled: Enabled can be boolean True or Fals...
salt/utils/mac_utils.py
def validate_enabled(enabled): ''' Helper function to validate the enabled parameter. Boolean values are converted to "on" and "off". String values are checked to make sure they are either "on" or "off"/"yes" or "no". Integer ``0`` will return "off". All other integers will return "on" :param e...
def validate_enabled(enabled): ''' Helper function to validate the enabled parameter. Boolean values are converted to "on" and "off". String values are checked to make sure they are either "on" or "off"/"yes" or "no". Integer ``0`` will return "off". All other integers will return "on" :param e...
[ "Helper", "function", "to", "validate", "the", "enabled", "parameter", ".", "Boolean", "values", "are", "converted", "to", "on", "and", "off", ".", "String", "values", "are", "checked", "to", "make", "sure", "they", "are", "either", "on", "or", "off", "/",...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/mac_utils.py#L213-L236
[ "def", "validate_enabled", "(", "enabled", ")", ":", "if", "isinstance", "(", "enabled", ",", "six", ".", "string_types", ")", ":", "if", "enabled", ".", "lower", "(", ")", "not", "in", "[", "'on'", ",", "'off'", ",", "'yes'", ",", "'no'", "]", ":", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
confirm_updated
Wait up to ``wait`` seconds for a system parameter to be changed before deciding it hasn't changed. :param str value: The value indicating a successful change :param function check_fun: The function whose return is compared with ``value`` :param bool normalize_ret: Whether to normalize the re...
salt/utils/mac_utils.py
def confirm_updated(value, check_fun, normalize_ret=False, wait=5): ''' Wait up to ``wait`` seconds for a system parameter to be changed before deciding it hasn't changed. :param str value: The value indicating a successful change :param function check_fun: The function whose return is compared wi...
def confirm_updated(value, check_fun, normalize_ret=False, wait=5): ''' Wait up to ``wait`` seconds for a system parameter to be changed before deciding it hasn't changed. :param str value: The value indicating a successful change :param function check_fun: The function whose return is compared wi...
[ "Wait", "up", "to", "wait", "seconds", "for", "a", "system", "parameter", "to", "be", "changed", "before", "deciding", "it", "hasn", "t", "changed", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/mac_utils.py#L239-L260
[ "def", "confirm_updated", "(", "value", ",", "check_fun", ",", "normalize_ret", "=", "False", ",", "wait", "=", "5", ")", ":", "for", "i", "in", "range", "(", "wait", ")", ":", "state", "=", "validate_enabled", "(", "check_fun", "(", ")", ")", "if", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
launchctl
Run a launchctl command and raise an error if it fails Args: additional args are passed to launchctl sub_cmd (str): Sub command supplied to launchctl Kwargs: passed to ``cmd.run_all`` return_stdout (bool): A keyword argument. If true return the stdout of the launchctl command ...
salt/utils/mac_utils.py
def launchctl(sub_cmd, *args, **kwargs): ''' Run a launchctl command and raise an error if it fails Args: additional args are passed to launchctl sub_cmd (str): Sub command supplied to launchctl Kwargs: passed to ``cmd.run_all`` return_stdout (bool): A keyword argument. If true return ...
def launchctl(sub_cmd, *args, **kwargs): ''' Run a launchctl command and raise an error if it fails Args: additional args are passed to launchctl sub_cmd (str): Sub command supplied to launchctl Kwargs: passed to ``cmd.run_all`` return_stdout (bool): A keyword argument. If true return ...
[ "Run", "a", "launchctl", "command", "and", "raise", "an", "error", "if", "it", "fails" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/mac_utils.py#L263-L309
[ "def", "launchctl", "(", "sub_cmd", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Get return type", "return_stdout", "=", "kwargs", ".", "pop", "(", "'return_stdout'", ",", "False", ")", "# Construct command", "cmd", "=", "[", "'launchctl'", ",", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_available_services
This is a helper function for getting the available macOS services. The strategy is to look through the known system locations for launchd plist files, parse them, and use their information for populating the list of services. Services can run without a plist file present, but normally services which h...
salt/utils/mac_utils.py
def _available_services(refresh=False): ''' This is a helper function for getting the available macOS services. The strategy is to look through the known system locations for launchd plist files, parse them, and use their information for populating the list of services. Services can run without a p...
def _available_services(refresh=False): ''' This is a helper function for getting the available macOS services. The strategy is to look through the known system locations for launchd plist files, parse them, and use their information for populating the list of services. Services can run without a p...
[ "This", "is", "a", "helper", "function", "for", "getting", "the", "available", "macOS", "services", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/mac_utils.py#L312-L417
[ "def", "_available_services", "(", "refresh", "=", "False", ")", ":", "try", ":", "if", "__context__", "[", "'available_services'", "]", "and", "not", "refresh", ":", "log", ".", "debug", "(", "'Found context for available services.'", ")", "__context__", "[", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
console_user
Gets the UID or Username of the current console user. :return: The uid or username of the console user. :param bool username: Whether to return the username of the console user instead of the UID. Defaults to False :rtype: Interger of the UID, or a string of the username. Raises: Command...
salt/utils/mac_utils.py
def console_user(username=False): ''' Gets the UID or Username of the current console user. :return: The uid or username of the console user. :param bool username: Whether to return the username of the console user instead of the UID. Defaults to False :rtype: Interger of the UID, or a string...
def console_user(username=False): ''' Gets the UID or Username of the current console user. :return: The uid or username of the console user. :param bool username: Whether to return the username of the console user instead of the UID. Defaults to False :rtype: Interger of the UID, or a string...
[ "Gets", "the", "UID", "or", "Username", "of", "the", "current", "console", "user", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/mac_utils.py#L441-L472
[ "def", "console_user", "(", "username", "=", "False", ")", ":", "try", ":", "# returns the 'st_uid' stat from the /dev/console file.", "uid", "=", "os", ".", "stat", "(", "'/dev/console'", ")", "[", "4", "]", "except", "(", "OSError", ",", "IndexError", ")", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
managed
This state manages software package repositories. Currently, :mod:`yum <salt.modules.yumpkg>`, :mod:`apt <salt.modules.aptpkg>`, and :mod:`zypper <salt.modules.zypper>` repositories are supported. **YUM/DNF/ZYPPER-BASED SYSTEMS** .. note:: One of ``baseurl`` or ``mirrorlist`` below is required...
salt/states/pkgrepo.py
def managed(name, ppa=None, **kwargs): ''' This state manages software package repositories. Currently, :mod:`yum <salt.modules.yumpkg>`, :mod:`apt <salt.modules.aptpkg>`, and :mod:`zypper <salt.modules.zypper>` repositories are supported. **YUM/DNF/ZYPPER-BASED SYSTEMS** .. note:: One...
def managed(name, ppa=None, **kwargs): ''' This state manages software package repositories. Currently, :mod:`yum <salt.modules.yumpkg>`, :mod:`apt <salt.modules.aptpkg>`, and :mod:`zypper <salt.modules.zypper>` repositories are supported. **YUM/DNF/ZYPPER-BASED SYSTEMS** .. note:: One...
[ "This", "state", "manages", "software", "package", "repositories", ".", "Currently", ":", "mod", ":", "yum", "<salt", ".", "modules", ".", "yumpkg", ">", ":", "mod", ":", "apt", "<salt", ".", "modules", ".", "aptpkg", ">", "and", ":", "mod", ":", "zypp...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkgrepo.py#L112-L535
[ "def", "managed", "(", "name", ",", "ppa", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "'refresh_db'", "in", "kwargs", ":", "salt", ".", "utils", ".", "versions", ".", "warn_until", "(", "'Neon'", ",", "'The \\'refresh_db\\' argument to \\'pkg.mod_...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
absent
This function deletes the specified repo on the system, if it exists. It is essentially a wrapper around pkg.del_repo. name The name of the package repo, as it would be referred to when running the regular package manager commands. **UBUNTU-SPECIFIC OPTIONS** ppa On Ubuntu, yo...
salt/states/pkgrepo.py
def absent(name, **kwargs): ''' This function deletes the specified repo on the system, if it exists. It is essentially a wrapper around pkg.del_repo. name The name of the package repo, as it would be referred to when running the regular package manager commands. **UBUNTU-SPECIFIC ...
def absent(name, **kwargs): ''' This function deletes the specified repo on the system, if it exists. It is essentially a wrapper around pkg.del_repo. name The name of the package repo, as it would be referred to when running the regular package manager commands. **UBUNTU-SPECIFIC ...
[ "This", "function", "deletes", "the", "specified", "repo", "on", "the", "system", "if", "it", "exists", ".", "It", "is", "essentially", "a", "wrapper", "around", "pkg", ".", "del_repo", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkgrepo.py#L538-L653
[ "def", "absent", "(", "name", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", "}", "if", "'ppa'", "in", "kwargs", "and", "__gra...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ext_pillar
Read pillar data from Foreman via its API.
salt/pillar/foreman.py
def ext_pillar(minion_id, pillar, # pylint: disable=W0613 key=None, only=()): ''' Read pillar data from Foreman via its API. ''' url = __opts__['foreman.url'] user = __opts__['foreman.user'] password = __opts__['foreman.password'] api = __opts__[...
def ext_pillar(minion_id, pillar, # pylint: disable=W0613 key=None, only=()): ''' Read pillar data from Foreman via its API. ''' url = __opts__['foreman.url'] user = __opts__['foreman.user'] password = __opts__['foreman.password'] api = __opts__[...
[ "Read", "pillar", "data", "from", "Foreman", "via", "its", "API", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/foreman.py#L81-L141
[ "def", "ext_pillar", "(", "minion_id", ",", "pillar", ",", "# pylint: disable=W0613", "key", "=", "None", ",", "only", "=", "(", ")", ")", ":", "url", "=", "__opts__", "[", "'foreman.url'", "]", "user", "=", "__opts__", "[", "'foreman.user'", "]", "passwor...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
create_table
Creates a DynamoDB table. CLI Example: .. code-block:: bash salt myminion boto_dynamodb.create_table table_name / region=us-east-1 / hash_key=id / hash_key_data_type=N / range_key=created_at / range_key_data_type=N / read_capacity_units=1 / writ...
salt/modules/boto_dynamodb.py
def create_table(table_name, region=None, key=None, keyid=None, profile=None, read_capacity_units=None, write_capacity_units=None, hash_key=None, hash_key_data_type=None, range_key=None, range_key_data_type=None, local_indexes=None, global_indexes=None...
def create_table(table_name, region=None, key=None, keyid=None, profile=None, read_capacity_units=None, write_capacity_units=None, hash_key=None, hash_key_data_type=None, range_key=None, range_key_data_type=None, local_indexes=None, global_indexes=None...
[ "Creates", "a", "DynamoDB", "table", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_dynamodb.py#L85-L161
[ "def", "create_table", "(", "table_name", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ",", "read_capacity_units", "=", "None", ",", "write_capacity_units", "=", "None", ",", "hash_key", "=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
exists
Check to see if a table exists. CLI Example: .. code-block:: bash salt myminion boto_dynamodb.exists table_name region=us-east-1
salt/modules/boto_dynamodb.py
def exists(table_name, region=None, key=None, keyid=None, profile=None): ''' Check to see if a table exists. CLI Example: .. code-block:: bash salt myminion boto_dynamodb.exists table_name region=us-east-1 ''' try: conn = _get_conn(region=region, key=key, keyid=keyid, profile=...
def exists(table_name, region=None, key=None, keyid=None, profile=None): ''' Check to see if a table exists. CLI Example: .. code-block:: bash salt myminion boto_dynamodb.exists table_name region=us-east-1 ''' try: conn = _get_conn(region=region, key=key, keyid=keyid, profile=...
[ "Check", "to", "see", "if", "a", "table", "exists", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_dynamodb.py#L164-L182
[ "def", "exists", "(", "table_name", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "try", ":", "conn", "=", "_get_conn", "(", "region", "=", "region", ",", "key", "=", "key", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
delete
Delete a DynamoDB table. CLI Example: .. code-block:: bash salt myminion boto_dynamodb.delete table_name region=us-east-1
salt/modules/boto_dynamodb.py
def delete(table_name, region=None, key=None, keyid=None, profile=None): ''' Delete a DynamoDB table. CLI Example: .. code-block:: bash salt myminion boto_dynamodb.delete table_name region=us-east-1 ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) table ...
def delete(table_name, region=None, key=None, keyid=None, profile=None): ''' Delete a DynamoDB table. CLI Example: .. code-block:: bash salt myminion boto_dynamodb.delete table_name region=us-east-1 ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) table ...
[ "Delete", "a", "DynamoDB", "table", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_dynamodb.py#L185-L208
[ "def", "delete", "(", "table_name", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "conn", "=", "_get_conn", "(", "region", "=", "region", ",", "key", "=", "key", ",", "keyid",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
update
Update a DynamoDB table. CLI example:: salt myminion boto_dynamodb.update table_name region=us-east-1
salt/modules/boto_dynamodb.py
def update(table_name, throughput=None, global_indexes=None, region=None, key=None, keyid=None, profile=None): ''' Update a DynamoDB table. CLI example:: salt myminion boto_dynamodb.update table_name region=us-east-1 ''' conn = _get_conn(region=region, key=key, keyid=keyid, prof...
def update(table_name, throughput=None, global_indexes=None, region=None, key=None, keyid=None, profile=None): ''' Update a DynamoDB table. CLI example:: salt myminion boto_dynamodb.update table_name region=us-east-1 ''' conn = _get_conn(region=region, key=key, keyid=keyid, prof...
[ "Update", "a", "DynamoDB", "table", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_dynamodb.py#L211-L222
[ "def", "update", "(", "table_name", ",", "throughput", "=", "None", ",", "global_indexes", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "conn", "=", "_get_conn", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
create_global_secondary_index
Creates a single global secondary index on a DynamoDB table. CLI Example: .. code-block:: bash salt myminion boto_dynamodb.create_global_secondary_index table_name / index_name
salt/modules/boto_dynamodb.py
def create_global_secondary_index(table_name, global_index, region=None, key=None, keyid=None, profile=None): ''' Creates a single global secondary index on a DynamoDB table. CLI Example: .. code-block:: bash salt myminion boto_dynamodb.create_global_secondary...
def create_global_secondary_index(table_name, global_index, region=None, key=None, keyid=None, profile=None): ''' Creates a single global secondary index on a DynamoDB table. CLI Example: .. code-block:: bash salt myminion boto_dynamodb.create_global_secondary...
[ "Creates", "a", "single", "global", "secondary", "index", "on", "a", "DynamoDB", "table", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_dynamodb.py#L225-L238
[ "def", "create_global_secondary_index", "(", "table_name", ",", "global_index", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "conn", "=", "_get_conn", "(", "region", "=", "region", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
update_global_secondary_index
Updates the throughput of the given global secondary indexes. CLI Example: .. code-block:: bash salt myminion boto_dynamodb.update_global_secondary_index table_name / indexes
salt/modules/boto_dynamodb.py
def update_global_secondary_index(table_name, global_indexes, region=None, key=None, keyid=None, profile=None): ''' Updates the throughput of the given global secondary indexes. CLI Example: .. code-block:: bash salt myminion boto_dynamodb.update_global_second...
def update_global_secondary_index(table_name, global_indexes, region=None, key=None, keyid=None, profile=None): ''' Updates the throughput of the given global secondary indexes. CLI Example: .. code-block:: bash salt myminion boto_dynamodb.update_global_second...
[ "Updates", "the", "throughput", "of", "the", "given", "global", "secondary", "indexes", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_dynamodb.py#L241-L254
[ "def", "update_global_secondary_index", "(", "table_name", ",", "global_indexes", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "conn", "=", "_get_conn", "(", "region", "=", "region",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
describe
Describe a DynamoDB table. CLI example:: salt myminion boto_dynamodb.describe table_name region=us-east-1
salt/modules/boto_dynamodb.py
def describe(table_name, region=None, key=None, keyid=None, profile=None): ''' Describe a DynamoDB table. CLI example:: salt myminion boto_dynamodb.describe table_name region=us-east-1 ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) table = Table(table_name, ...
def describe(table_name, region=None, key=None, keyid=None, profile=None): ''' Describe a DynamoDB table. CLI example:: salt myminion boto_dynamodb.describe table_name region=us-east-1 ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) table = Table(table_name, ...
[ "Describe", "a", "DynamoDB", "table", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_dynamodb.py#L257-L267
[ "def", "describe", "(", "table_name", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "conn", "=", "_get_conn", "(", "region", "=", "region", ",", "key", "=", "key", ",", "keyid...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
extract_index
Instantiates and returns an AllIndex object given a valid index configuration CLI Example: salt myminion boto_dynamodb.extract_index index
salt/modules/boto_dynamodb.py
def extract_index(index_data, global_index=False): ''' Instantiates and returns an AllIndex object given a valid index configuration CLI Example: salt myminion boto_dynamodb.extract_index index ''' parsed_data = {} keys = [] for key, value in six.iteritems(index_data): ...
def extract_index(index_data, global_index=False): ''' Instantiates and returns an AllIndex object given a valid index configuration CLI Example: salt myminion boto_dynamodb.extract_index index ''' parsed_data = {} keys = [] for key, value in six.iteritems(index_data): ...
[ "Instantiates", "and", "returns", "an", "AllIndex", "object", "given", "a", "valid", "index", "configuration" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_dynamodb.py#L270-L353
[ "def", "extract_index", "(", "index_data", ",", "global_index", "=", "False", ")", ":", "parsed_data", "=", "{", "}", "keys", "=", "[", "]", "for", "key", ",", "value", "in", "six", ".", "iteritems", "(", "index_data", ")", ":", "for", "item", "in", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
install
Install a Perl module from CPAN CLI Example: .. code-block:: bash salt '*' cpan.install Template::Alloy
salt/modules/cpan.py
def install(module): ''' Install a Perl module from CPAN CLI Example: .. code-block:: bash salt '*' cpan.install Template::Alloy ''' ret = { 'old': None, 'new': None, } old_info = show(module) cmd = 'cpan -i {0}'.format(module) out = __salt__['cmd.run...
def install(module): ''' Install a Perl module from CPAN CLI Example: .. code-block:: bash salt '*' cpan.install Template::Alloy ''' ret = { 'old': None, 'new': None, } old_info = show(module) cmd = 'cpan -i {0}'.format(module) out = __salt__['cmd.run...
[ "Install", "a", "Perl", "module", "from", "CPAN" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cpan.py#L35-L63
[ "def", "install", "(", "module", ")", ":", "ret", "=", "{", "'old'", ":", "None", ",", "'new'", ":", "None", ",", "}", "old_info", "=", "show", "(", "module", ")", "cmd", "=", "'cpan -i {0}'", ".", "format", "(", "module", ")", "out", "=", "__salt_...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
remove
Attempt to remove a Perl module that was installed from CPAN. Because the ``cpan`` command doesn't actually support "uninstall"-like functionality, this function will attempt to do what it can, with what it has from CPAN. Until this function is declared stable, USE AT YOUR OWN RISK! CLI Example: ...
salt/modules/cpan.py
def remove(module, details=False): ''' Attempt to remove a Perl module that was installed from CPAN. Because the ``cpan`` command doesn't actually support "uninstall"-like functionality, this function will attempt to do what it can, with what it has from CPAN. Until this function is declared stable...
def remove(module, details=False): ''' Attempt to remove a Perl module that was installed from CPAN. Because the ``cpan`` command doesn't actually support "uninstall"-like functionality, this function will attempt to do what it can, with what it has from CPAN. Until this function is declared stable...
[ "Attempt", "to", "remove", "a", "Perl", "module", "that", "was", "installed", "from", "CPAN", ".", "Because", "the", "cpan", "command", "doesn", "t", "actually", "support", "uninstall", "-", "like", "functionality", "this", "function", "will", "attempt", "to",...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cpan.py#L66-L130
[ "def", "remove", "(", "module", ",", "details", "=", "False", ")", ":", "ret", "=", "{", "'old'", ":", "None", ",", "'new'", ":", "None", ",", "}", "info", "=", "show", "(", "module", ")", "if", "'error'", "in", "info", ":", "return", "{", "'erro...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_
List installed Perl modules, and the version installed CLI Example: .. code-block:: bash salt '*' cpan.list
salt/modules/cpan.py
def list_(): ''' List installed Perl modules, and the version installed CLI Example: .. code-block:: bash salt '*' cpan.list ''' ret = {} cmd = 'cpan -l' out = __salt__['cmd.run'](cmd).splitlines() for line in out: comps = line.split() ret[comps[0]] = comps...
def list_(): ''' List installed Perl modules, and the version installed CLI Example: .. code-block:: bash salt '*' cpan.list ''' ret = {} cmd = 'cpan -l' out = __salt__['cmd.run'](cmd).splitlines() for line in out: comps = line.split() ret[comps[0]] = comps...
[ "List", "installed", "Perl", "modules", "and", "the", "version", "installed" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cpan.py#L133-L149
[ "def", "list_", "(", ")", ":", "ret", "=", "{", "}", "cmd", "=", "'cpan -l'", "out", "=", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ")", ".", "splitlines", "(", ")", "for", "line", "in", "out", ":", "comps", "=", "line", ".", "split", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
show
Show information about a specific Perl module CLI Example: .. code-block:: bash salt '*' cpan.show Template::Alloy
salt/modules/cpan.py
def show(module): ''' Show information about a specific Perl module CLI Example: .. code-block:: bash salt '*' cpan.show Template::Alloy ''' ret = {} ret['name'] = module # This section parses out details from CPAN, if possible cmd = 'cpan -D {0}'.format(module) out =...
def show(module): ''' Show information about a specific Perl module CLI Example: .. code-block:: bash salt '*' cpan.show Template::Alloy ''' ret = {} ret['name'] = module # This section parses out details from CPAN, if possible cmd = 'cpan -D {0}'.format(module) out =...
[ "Show", "information", "about", "a", "specific", "Perl", "module" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cpan.py#L152-L214
[ "def", "show", "(", "module", ")", ":", "ret", "=", "{", "}", "ret", "[", "'name'", "]", "=", "module", "# This section parses out details from CPAN, if possible", "cmd", "=", "'cpan -D {0}'", ".", "format", "(", "module", ")", "out", "=", "__salt__", "[", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
show_config
Return a dict of CPAN configuration values CLI Example: .. code-block:: bash salt '*' cpan.show_config
salt/modules/cpan.py
def show_config(): ''' Return a dict of CPAN configuration values CLI Example: .. code-block:: bash salt '*' cpan.show_config ''' ret = {} cmd = 'cpan -J' out = __salt__['cmd.run'](cmd).splitlines() for line in out: if '=>' not in line: # TODO: Some opt...
def show_config(): ''' Return a dict of CPAN configuration values CLI Example: .. code-block:: bash salt '*' cpan.show_config ''' ret = {} cmd = 'cpan -J' out = __salt__['cmd.run'](cmd).splitlines() for line in out: if '=>' not in line: # TODO: Some opt...
[ "Return", "a", "dict", "of", "CPAN", "configuration", "values" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cpan.py#L217-L238
[ "def", "show_config", "(", ")", ":", "ret", "=", "{", "}", "cmd", "=", "'cpan -J'", "out", "=", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ")", ".", "splitlines", "(", ")", "for", "line", "in", "out", ":", "if", "'=>'", "not", "in", "line", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
run_query
Get a cursor and run a query. Reconnect up to `retries` times if needed. Returns: cursor, affected rows counter Raises: SaltCacheError, AttributeError, OperationalError
salt/cache/mysql_cache.py
def run_query(conn, query, retries=3): ''' Get a cursor and run a query. Reconnect up to `retries` times if needed. Returns: cursor, affected rows counter Raises: SaltCacheError, AttributeError, OperationalError ''' try: cur = conn.cursor() out = cur.execute(query) re...
def run_query(conn, query, retries=3): ''' Get a cursor and run a query. Reconnect up to `retries` times if needed. Returns: cursor, affected rows counter Raises: SaltCacheError, AttributeError, OperationalError ''' try: cur = conn.cursor() out = cur.execute(query) re...
[ "Get", "a", "cursor", "and", "run", "a", "query", ".", "Reconnect", "up", "to", "retries", "times", "if", "needed", ".", "Returns", ":", "cursor", "affected", "rows", "counter", "Raises", ":", "SaltCacheError", "AttributeError", "OperationalError" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/mysql_cache.py#L92-L118
[ "def", "run_query", "(", "conn", ",", "query", ",", "retries", "=", "3", ")", ":", "try", ":", "cur", "=", "conn", ".", "cursor", "(", ")", "out", "=", "cur", ".", "execute", "(", "query", ")", "return", "cur", ",", "out", "except", "(", "Attribu...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_create_table
Create table if needed
salt/cache/mysql_cache.py
def _create_table(): ''' Create table if needed ''' # Explicitely check if the table already exists as the library logs a # warning on CREATE TABLE query = """SELECT COUNT(TABLE_NAME) FROM information_schema.tables WHERE table_schema = '{0}' AND table_name = '{1}'""".format( ...
def _create_table(): ''' Create table if needed ''' # Explicitely check if the table already exists as the library logs a # warning on CREATE TABLE query = """SELECT COUNT(TABLE_NAME) FROM information_schema.tables WHERE table_schema = '{0}' AND table_name = '{1}'""".format( ...
[ "Create", "table", "if", "needed" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/mysql_cache.py#L121-L146
[ "def", "_create_table", "(", ")", ":", "# Explicitely check if the table already exists as the library logs a", "# warning on CREATE TABLE", "query", "=", "\"\"\"SELECT COUNT(TABLE_NAME) FROM information_schema.tables\n WHERE table_schema = '{0}' AND table_name = '{1}'\"\"\"", ".", "for...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_init_client
Initialize connection and create table if needed
salt/cache/mysql_cache.py
def _init_client(): """Initialize connection and create table if needed """ if client is not None: return global _mysql_kwargs, _table_name _mysql_kwargs = { 'host': __opts__.get('mysql.host', '127.0.0.1'), 'user': __opts__.get('mysql.user', None), 'passwd': __opts__...
def _init_client(): """Initialize connection and create table if needed """ if client is not None: return global _mysql_kwargs, _table_name _mysql_kwargs = { 'host': __opts__.get('mysql.host', '127.0.0.1'), 'user': __opts__.get('mysql.user', None), 'passwd': __opts__...
[ "Initialize", "connection", "and", "create", "table", "if", "needed" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/mysql_cache.py#L149-L176
[ "def", "_init_client", "(", ")", ":", "if", "client", "is", "not", "None", ":", "return", "global", "_mysql_kwargs", ",", "_table_name", "_mysql_kwargs", "=", "{", "'host'", ":", "__opts__", ".", "get", "(", "'mysql.host'", ",", "'127.0.0.1'", ")", ",", "'...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
store
Store a key value.
salt/cache/mysql_cache.py
def store(bank, key, data): ''' Store a key value. ''' _init_client() data = __context__['serial'].dumps(data) query = b"REPLACE INTO {0} (bank, etcd_key, data) values('{1}', '{2}', " \ b"'{3}')".format(_table_name, bank, key, ...
def store(bank, key, data): ''' Store a key value. ''' _init_client() data = __context__['serial'].dumps(data) query = b"REPLACE INTO {0} (bank, etcd_key, data) values('{1}', '{2}', " \ b"'{3}')".format(_table_name, bank, key, ...
[ "Store", "a", "key", "value", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/mysql_cache.py#L179-L196
[ "def", "store", "(", "bank", ",", "key", ",", "data", ")", ":", "_init_client", "(", ")", "data", "=", "__context__", "[", "'serial'", "]", ".", "dumps", "(", "data", ")", "query", "=", "b\"REPLACE INTO {0} (bank, etcd_key, data) values('{1}', '{2}', \"", "b\"'{...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
fetch
Fetch a key value.
salt/cache/mysql_cache.py
def fetch(bank, key): ''' Fetch a key value. ''' _init_client() query = "SELECT data FROM {0} WHERE bank='{1}' AND etcd_key='{2}'".format( _table_name, bank, key) cur, _ = run_query(client, query) r = cur.fetchone() cur.close() if r is None: return {} return __con...
def fetch(bank, key): ''' Fetch a key value. ''' _init_client() query = "SELECT data FROM {0} WHERE bank='{1}' AND etcd_key='{2}'".format( _table_name, bank, key) cur, _ = run_query(client, query) r = cur.fetchone() cur.close() if r is None: return {} return __con...
[ "Fetch", "a", "key", "value", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/mysql_cache.py#L199-L211
[ "def", "fetch", "(", "bank", ",", "key", ")", ":", "_init_client", "(", ")", "query", "=", "\"SELECT data FROM {0} WHERE bank='{1}' AND etcd_key='{2}'\"", ".", "format", "(", "_table_name", ",", "bank", ",", "key", ")", "cur", ",", "_", "=", "run_query", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
flush
Remove the key from the cache bank with all the key content.
salt/cache/mysql_cache.py
def flush(bank, key=None): ''' Remove the key from the cache bank with all the key content. ''' _init_client() query = "DELETE FROM {0} WHERE bank='{1}'".format(_table_name, bank) if key is not None: query += " AND etcd_key='{0}'".format(key) cur, _ = run_query(client, query) cu...
def flush(bank, key=None): ''' Remove the key from the cache bank with all the key content. ''' _init_client() query = "DELETE FROM {0} WHERE bank='{1}'".format(_table_name, bank) if key is not None: query += " AND etcd_key='{0}'".format(key) cur, _ = run_query(client, query) cu...
[ "Remove", "the", "key", "from", "the", "cache", "bank", "with", "all", "the", "key", "content", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/mysql_cache.py#L214-L224
[ "def", "flush", "(", "bank", ",", "key", "=", "None", ")", ":", "_init_client", "(", ")", "query", "=", "\"DELETE FROM {0} WHERE bank='{1}'\"", ".", "format", "(", "_table_name", ",", "bank", ")", "if", "key", "is", "not", "None", ":", "query", "+=", "\"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ls
Return an iterable object containing all entries stored in the specified bank.
salt/cache/mysql_cache.py
def ls(bank): ''' Return an iterable object containing all entries stored in the specified bank. ''' _init_client() query = "SELECT etcd_key FROM {0} WHERE bank='{1}'".format( _table_name, bank) cur, _ = run_query(client, query) out = [row[0] for row in cur.fetchall()] cur.cl...
def ls(bank): ''' Return an iterable object containing all entries stored in the specified bank. ''' _init_client() query = "SELECT etcd_key FROM {0} WHERE bank='{1}'".format( _table_name, bank) cur, _ = run_query(client, query) out = [row[0] for row in cur.fetchall()] cur.cl...
[ "Return", "an", "iterable", "object", "containing", "all", "entries", "stored", "in", "the", "specified", "bank", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/mysql_cache.py#L227-L238
[ "def", "ls", "(", "bank", ")", ":", "_init_client", "(", ")", "query", "=", "\"SELECT etcd_key FROM {0} WHERE bank='{1}'\"", ".", "format", "(", "_table_name", ",", "bank", ")", "cur", ",", "_", "=", "run_query", "(", "client", ",", "query", ")", "out", "=...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
contains
Checks if the specified bank contains the specified key.
salt/cache/mysql_cache.py
def contains(bank, key): ''' Checks if the specified bank contains the specified key. ''' _init_client() query = "SELECT COUNT(data) FROM {0} WHERE bank='{1}' " \ "AND etcd_key='{2}'".format(_table_name, bank, key) cur, _ = run_query(client, query) r = cur.fetchone() cur.close() ...
def contains(bank, key): ''' Checks if the specified bank contains the specified key. ''' _init_client() query = "SELECT COUNT(data) FROM {0} WHERE bank='{1}' " \ "AND etcd_key='{2}'".format(_table_name, bank, key) cur, _ = run_query(client, query) r = cur.fetchone() cur.close() ...
[ "Checks", "if", "the", "specified", "bank", "contains", "the", "specified", "key", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/mysql_cache.py#L241-L251
[ "def", "contains", "(", "bank", ",", "key", ")", ":", "_init_client", "(", ")", "query", "=", "\"SELECT COUNT(data) FROM {0} WHERE bank='{1}' \"", "\"AND etcd_key='{2}'\"", ".", "format", "(", "_table_name", ",", "bank", ",", "key", ")", "cur", ",", "_", "=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
CsvDB.new
Create a new database and opens it. :return:
salt/modules/inspectlib/fsdb.py
def new(self): ''' Create a new database and opens it. :return: ''' dbname = self._label() self.db_path = os.path.join(self.path, dbname) if not os.path.exists(self.db_path): os.makedirs(self.db_path) self._opened = True self.list_tabl...
def new(self): ''' Create a new database and opens it. :return: ''' dbname = self._label() self.db_path = os.path.join(self.path, dbname) if not os.path.exists(self.db_path): os.makedirs(self.db_path) self._opened = True self.list_tabl...
[ "Create", "a", "new", "database", "and", "opens", "it", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L76-L89
[ "def", "new", "(", "self", ")", ":", "dbname", "=", "self", ".", "_label", "(", ")", "self", ".", "db_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "path", ",", "dbname", ")", "if", "not", "os", ".", "path", ".", "exists", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
CsvDB.purge
Purge the database. :param dbid: :return:
salt/modules/inspectlib/fsdb.py
def purge(self, dbid): ''' Purge the database. :param dbid: :return: ''' db_path = os.path.join(self.path, dbid) if os.path.exists(db_path): shutil.rmtree(db_path, ignore_errors=True) return True return False
def purge(self, dbid): ''' Purge the database. :param dbid: :return: ''' db_path = os.path.join(self.path, dbid) if os.path.exists(db_path): shutil.rmtree(db_path, ignore_errors=True) return True return False
[ "Purge", "the", "database", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L91-L102
[ "def", "purge", "(", "self", ",", "dbid", ")", ":", "db_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "path", ",", "dbid", ")", "if", "os", ".", "path", ".", "exists", "(", "db_path", ")", ":", "shutil", ".", "rmtree", "(", "db_...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
CsvDB.flush
Flush table. :param table: :return:
salt/modules/inspectlib/fsdb.py
def flush(self, table): ''' Flush table. :param table: :return: ''' table_path = os.path.join(self.db_path, table) if os.path.exists(table_path): os.unlink(table_path)
def flush(self, table): ''' Flush table. :param table: :return: ''' table_path = os.path.join(self.db_path, table) if os.path.exists(table_path): os.unlink(table_path)
[ "Flush", "table", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L104-L113
[ "def", "flush", "(", "self", ",", "table", ")", ":", "table_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "db_path", ",", "table", ")", "if", "os", ".", "path", ".", "exists", "(", "table_path", ")", ":", "os", ".", "unlink", "(",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
CsvDB.list
List all the databases on the given path. :return:
salt/modules/inspectlib/fsdb.py
def list(self): ''' List all the databases on the given path. :return: ''' databases = [] for dbname in os.listdir(self.path): databases.append(dbname) return list(reversed(sorted(databases)))
def list(self): ''' List all the databases on the given path. :return: ''' databases = [] for dbname in os.listdir(self.path): databases.append(dbname) return list(reversed(sorted(databases)))
[ "List", "all", "the", "databases", "on", "the", "given", "path", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L115-L124
[ "def", "list", "(", "self", ")", ":", "databases", "=", "[", "]", "for", "dbname", "in", "os", ".", "listdir", "(", "self", ".", "path", ")", ":", "databases", ".", "append", "(", "dbname", ")", "return", "list", "(", "reversed", "(", "sorted", "("...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
CsvDB.list_tables
Load existing tables and their descriptions. :return:
salt/modules/inspectlib/fsdb.py
def list_tables(self): ''' Load existing tables and their descriptions. :return: ''' if not self._tables: for table_name in os.listdir(self.db_path): self._tables[table_name] = self._load_table(table_name) return self._tables.keys()
def list_tables(self): ''' Load existing tables and their descriptions. :return: ''' if not self._tables: for table_name in os.listdir(self.db_path): self._tables[table_name] = self._load_table(table_name) return self._tables.keys()
[ "Load", "existing", "tables", "and", "their", "descriptions", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L126-L136
[ "def", "list_tables", "(", "self", ")", ":", "if", "not", "self", ".", "_tables", ":", "for", "table_name", "in", "os", ".", "listdir", "(", "self", ".", "db_path", ")", ":", "self", ".", "_tables", "[", "table_name", "]", "=", "self", ".", "_load_ta...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
CsvDB.open
Open database from the path with the name or latest. If there are no yet databases, create a new implicitly. :return:
salt/modules/inspectlib/fsdb.py
def open(self, dbname=None): ''' Open database from the path with the name or latest. If there are no yet databases, create a new implicitly. :return: ''' databases = self.list() if self.is_closed(): self.db_path = os.path.join(self.path, dbname or (d...
def open(self, dbname=None): ''' Open database from the path with the name or latest. If there are no yet databases, create a new implicitly. :return: ''' databases = self.list() if self.is_closed(): self.db_path = os.path.join(self.path, dbname or (d...
[ "Open", "database", "from", "the", "path", "with", "the", "name", "or", "latest", ".", "If", "there", "are", "no", "yet", "databases", "create", "a", "new", "implicitly", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L142-L154
[ "def", "open", "(", "self", ",", "dbname", "=", "None", ")", ":", "databases", "=", "self", ".", "list", "(", ")", "if", "self", ".", "is_closed", "(", ")", ":", "self", ".", "db_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "pa...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
CsvDB.create_table_from_object
Create a table from the object. NOTE: This method doesn't stores anything. :param obj: :return:
salt/modules/inspectlib/fsdb.py
def create_table_from_object(self, obj): ''' Create a table from the object. NOTE: This method doesn't stores anything. :param obj: :return: ''' get_type = lambda item: str(type(item)).split("'")[1] if not os.path.exists(os.path.join(self.db_path, obj._TA...
def create_table_from_object(self, obj): ''' Create a table from the object. NOTE: This method doesn't stores anything. :param obj: :return: ''' get_type = lambda item: str(type(item)).split("'")[1] if not os.path.exists(os.path.join(self.db_path, obj._TA...
[ "Create", "a", "table", "from", "the", "object", ".", "NOTE", ":", "This", "method", "doesn", "t", "stores", "anything", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L172-L185
[ "def", "create_table_from_object", "(", "self", ",", "obj", ")", ":", "get_type", "=", "lambda", "item", ":", "str", "(", "type", "(", "item", ")", ")", ".", "split", "(", "\"'\"", ")", "[", "1", "]", "if", "not", "os", ".", "path", ".", "exists", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
CsvDB.store
Store an object in the table. :param obj: An object to store :param distinct: Store object only if there is none identical of such. If at least one field is different, store it. :return:
salt/modules/inspectlib/fsdb.py
def store(self, obj, distinct=False): ''' Store an object in the table. :param obj: An object to store :param distinct: Store object only if there is none identical of such. If at least one field is different, store it. :return: ''' if d...
def store(self, obj, distinct=False): ''' Store an object in the table. :param obj: An object to store :param distinct: Store object only if there is none identical of such. If at least one field is different, store it. :return: ''' if d...
[ "Store", "an", "object", "in", "the", "table", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L187-L203
[ "def", "store", "(", "self", ",", "obj", ",", "distinct", "=", "False", ")", ":", "if", "distinct", ":", "fields", "=", "dict", "(", "zip", "(", "self", ".", "_tables", "[", "obj", ".", "_TABLE", "]", ".", "keys", "(", ")", ",", "obj", ".", "_s...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
CsvDB.update
Update object(s) in the database. :param obj: :param matches: :param mt: :param lt: :param eq: :return:
salt/modules/inspectlib/fsdb.py
def update(self, obj, matches=None, mt=None, lt=None, eq=None): ''' Update object(s) in the database. :param obj: :param matches: :param mt: :param lt: :param eq: :return: ''' updated = False objects = list() for _obj in se...
def update(self, obj, matches=None, mt=None, lt=None, eq=None): ''' Update object(s) in the database. :param obj: :param matches: :param mt: :param lt: :param eq: :return: ''' updated = False objects = list() for _obj in se...
[ "Update", "object", "(", "s", ")", "in", "the", "database", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L205-L229
[ "def", "update", "(", "self", ",", "obj", ",", "matches", "=", "None", ",", "mt", "=", "None", ",", "lt", "=", "None", ",", "eq", "=", "None", ")", ":", "updated", "=", "False", "objects", "=", "list", "(", ")", "for", "_obj", "in", "self", "."...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
CsvDB.delete
Delete object from the database. :param obj: :param matches: :param mt: :param lt: :param eq: :return:
salt/modules/inspectlib/fsdb.py
def delete(self, obj, matches=None, mt=None, lt=None, eq=None): ''' Delete object from the database. :param obj: :param matches: :param mt: :param lt: :param eq: :return: ''' deleted = False objects = list() for _obj in sel...
def delete(self, obj, matches=None, mt=None, lt=None, eq=None): ''' Delete object from the database. :param obj: :param matches: :param mt: :param lt: :param eq: :return: ''' deleted = False objects = list() for _obj in sel...
[ "Delete", "object", "from", "the", "database", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L231-L255
[ "def", "delete", "(", "self", ",", "obj", ",", "matches", "=", "None", ",", "mt", "=", "None", ",", "lt", "=", "None", ",", "eq", "=", "None", ")", ":", "deleted", "=", "False", "objects", "=", "list", "(", ")", "for", "_obj", "in", "self", "."...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
CsvDB.__criteria
Returns True if object is aligned to the criteria. :param obj: :param matches: :param mt: :param lt: :param eq: :return: Boolean
salt/modules/inspectlib/fsdb.py
def __criteria(self, obj, matches=None, mt=None, lt=None, eq=None): ''' Returns True if object is aligned to the criteria. :param obj: :param matches: :param mt: :param lt: :param eq: :return: Boolean ''' # Fail matcher if "less than" ...
def __criteria(self, obj, matches=None, mt=None, lt=None, eq=None): ''' Returns True if object is aligned to the criteria. :param obj: :param matches: :param mt: :param lt: :param eq: :return: Boolean ''' # Fail matcher if "less than" ...
[ "Returns", "True", "if", "object", "is", "aligned", "to", "the", "criteria", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L263-L294
[ "def", "__criteria", "(", "self", ",", "obj", ",", "matches", "=", "None", ",", "mt", "=", "None", ",", "lt", "=", "None", ",", "eq", "=", "None", ")", ":", "# Fail matcher if \"less than\"", "for", "field", ",", "value", "in", "(", "mt", "or", "{", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
CsvDB.get
Get objects from the table. :param table_name: :param matches: Regexp. :param mt: More than. :param lt: Less than. :param eq: Equals. :return:
salt/modules/inspectlib/fsdb.py
def get(self, obj, matches=None, mt=None, lt=None, eq=None): ''' Get objects from the table. :param table_name: :param matches: Regexp. :param mt: More than. :param lt: Less than. :param eq: Equals. :return: ''' objects = [] with g...
def get(self, obj, matches=None, mt=None, lt=None, eq=None): ''' Get objects from the table. :param table_name: :param matches: Regexp. :param mt: More than. :param lt: Less than. :param eq: Equals. :return: ''' objects = [] with g...
[ "Get", "objects", "from", "the", "table", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L296-L320
[ "def", "get", "(", "self", ",", "obj", ",", "matches", "=", "None", ",", "mt", "=", "None", ",", "lt", "=", "None", ",", "eq", "=", "None", ")", ":", "objects", "=", "[", "]", "with", "gzip", ".", "open", "(", "os", ".", "path", ".", "join", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
send
Send an event with the given tag and data. This is useful for sending events directly to the master from the shell with salt-run. It is also quite useful for sending events in orchestration states where the ``fire_event`` requisite isn't sufficient because it does not support sending custom data with t...
salt/runners/event.py
def send(tag, data=None): ''' Send an event with the given tag and data. This is useful for sending events directly to the master from the shell with salt-run. It is also quite useful for sending events in orchestration states where the ``fire_event`` requisite isn't sufficient because it does ...
def send(tag, data=None): ''' Send an event with the given tag and data. This is useful for sending events directly to the master from the shell with salt-run. It is also quite useful for sending events in orchestration states where the ``fire_event`` requisite isn't sufficient because it does ...
[ "Send", "an", "event", "with", "the", "given", "tag", "and", "data", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/event.py#L17-L80
[ "def", "send", "(", "tag", ",", "data", "=", "None", ")", ":", "data", "=", "data", "or", "{", "}", "event", "=", "salt", ".", "utils", ".", "event", ".", "get_master_event", "(", "__opts__", ",", "__opts__", "[", "'sock_dir'", "]", ",", "listen", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
grains
.. versionchanged:: 2017.7.0 The ``expr_form`` argument has been renamed to ``tgt_type``, earlier releases must use ``expr_form``. Return cached grains of the targeted minions. tgt Target to match minion ids. .. versionchanged:: 2017.7.5,2018.3.0 The ``tgt`` argume...
salt/runners/cache.py
def grains(tgt=None, tgt_type='glob', **kwargs): ''' .. versionchanged:: 2017.7.0 The ``expr_form`` argument has been renamed to ``tgt_type``, earlier releases must use ``expr_form``. Return cached grains of the targeted minions. tgt Target to match minion ids. .. vers...
def grains(tgt=None, tgt_type='glob', **kwargs): ''' .. versionchanged:: 2017.7.0 The ``expr_form`` argument has been renamed to ``tgt_type``, earlier releases must use ``expr_form``. Return cached grains of the targeted minions. tgt Target to match minion ids. .. vers...
[ "..", "versionchanged", "::", "2017", ".", "7", ".", "0", "The", "expr_form", "argument", "has", "been", "renamed", "to", "tgt_type", "earlier", "releases", "must", "use", "expr_form", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/cache.py#L33-L74
[ "def", "grains", "(", "tgt", "=", "None", ",", "tgt_type", "=", "'glob'", ",", "*", "*", "kwargs", ")", ":", "if", "tgt", "is", "None", ":", "# Change ``tgt=None`` to ``tgt`` (mandatory kwarg) in Salt Sodium.", "# This behavior was changed in PR #45588 to fix Issue #45489...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
pillar
.. versionchanged:: 2017.7.0 The ``expr_form`` argument has been renamed to ``tgt_type``, earlier releases must use ``expr_form``. Return cached pillars of the targeted minions CLI Example: .. code-block:: bash salt-run cache.pillar
salt/runners/cache.py
def pillar(tgt=None, tgt_type='glob', **kwargs): ''' .. versionchanged:: 2017.7.0 The ``expr_form`` argument has been renamed to ``tgt_type``, earlier releases must use ``expr_form``. Return cached pillars of the targeted minions CLI Example: .. code-block:: bash salt-run...
def pillar(tgt=None, tgt_type='glob', **kwargs): ''' .. versionchanged:: 2017.7.0 The ``expr_form`` argument has been renamed to ``tgt_type``, earlier releases must use ``expr_form``. Return cached pillars of the targeted minions CLI Example: .. code-block:: bash salt-run...
[ "..", "versionchanged", "::", "2017", ".", "7", ".", "0", "The", "expr_form", "argument", "has", "been", "renamed", "to", "tgt_type", "earlier", "releases", "must", "use", "expr_form", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/cache.py#L77-L98
[ "def", "pillar", "(", "tgt", "=", "None", ",", "tgt_type", "=", "'glob'", ",", "*", "*", "kwargs", ")", ":", "pillar_util", "=", "salt", ".", "utils", ".", "master", ".", "MasterPillarUtil", "(", "tgt", ",", "tgt_type", ",", "use_cached_grains", "=", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
mine
.. versionchanged:: 2017.7.0 The ``expr_form`` argument has been renamed to ``tgt_type``, earlier releases must use ``expr_form``. Return cached mine data of the targeted minions CLI Example: .. code-block:: bash salt-run cache.mine
salt/runners/cache.py
def mine(tgt=None, tgt_type='glob', **kwargs): ''' .. versionchanged:: 2017.7.0 The ``expr_form`` argument has been renamed to ``tgt_type``, earlier releases must use ``expr_form``. Return cached mine data of the targeted minions CLI Example: .. code-block:: bash salt-run...
def mine(tgt=None, tgt_type='glob', **kwargs): ''' .. versionchanged:: 2017.7.0 The ``expr_form`` argument has been renamed to ``tgt_type``, earlier releases must use ``expr_form``. Return cached mine data of the targeted minions CLI Example: .. code-block:: bash salt-run...
[ "..", "versionchanged", "::", "2017", ".", "7", ".", "0", "The", "expr_form", "argument", "has", "been", "renamed", "to", "tgt_type", "earlier", "releases", "must", "use", "expr_form", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/cache.py#L101-L122
[ "def", "mine", "(", "tgt", "=", "None", ",", "tgt_type", "=", "'glob'", ",", "*", "*", "kwargs", ")", ":", "pillar_util", "=", "salt", ".", "utils", ".", "master", ".", "MasterPillarUtil", "(", "tgt", ",", "tgt_type", ",", "use_cached_grains", "=", "Fa...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_clear_cache
Clear the cached data/files for the targeted minions.
salt/runners/cache.py
def _clear_cache(tgt=None, tgt_type='glob', clear_pillar_flag=False, clear_grains_flag=False, clear_mine_flag=False, clear_mine_func_flag=None): ''' Clear the cached data/files for the targeted minions. ''' if tgt is No...
def _clear_cache(tgt=None, tgt_type='glob', clear_pillar_flag=False, clear_grains_flag=False, clear_mine_flag=False, clear_mine_func_flag=None): ''' Clear the cached data/files for the targeted minions. ''' if tgt is No...
[ "Clear", "the", "cached", "data", "/", "files", "for", "the", "targeted", "minions", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/cache.py#L125-L145
[ "def", "_clear_cache", "(", "tgt", "=", "None", ",", "tgt_type", "=", "'glob'", ",", "clear_pillar_flag", "=", "False", ",", "clear_grains_flag", "=", "False", ",", "clear_mine_flag", "=", "False", ",", "clear_mine_func_flag", "=", "None", ")", ":", "if", "t...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
clear_all
.. versionchanged:: 2017.7.0 The ``expr_form`` argument has been renamed to ``tgt_type``, earlier releases must use ``expr_form``. Clear the cached pillar, grains, and mine data of the targeted minions CLI Example: .. code-block:: bash salt-run cache.clear_all
salt/runners/cache.py
def clear_all(tgt=None, tgt_type='glob'): ''' .. versionchanged:: 2017.7.0 The ``expr_form`` argument has been renamed to ``tgt_type``, earlier releases must use ``expr_form``. Clear the cached pillar, grains, and mine data of the targeted minions CLI Example: .. code-block:: bash...
def clear_all(tgt=None, tgt_type='glob'): ''' .. versionchanged:: 2017.7.0 The ``expr_form`` argument has been renamed to ``tgt_type``, earlier releases must use ``expr_form``. Clear the cached pillar, grains, and mine data of the targeted minions CLI Example: .. code-block:: bash...
[ "..", "versionchanged", "::", "2017", ".", "7", ".", "0", "The", "expr_form", "argument", "has", "been", "renamed", "to", "tgt_type", "earlier", "releases", "must", "use", "expr_form", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/cache.py#L218-L236
[ "def", "clear_all", "(", "tgt", "=", "None", ",", "tgt_type", "=", "'glob'", ")", ":", "return", "_clear_cache", "(", "tgt", ",", "tgt_type", ",", "clear_pillar_flag", "=", "True", ",", "clear_grains_flag", "=", "True", ",", "clear_mine_flag", "=", "True", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
clear_git_lock
.. versionadded:: 2015.8.2 Remove the update locks for Salt components (gitfs, git_pillar, winrepo) which use gitfs backend code from salt.utils.gitfs. .. note:: Running :py:func:`cache.clear_all <salt.runners.cache.clear_all>` will not include this function as it does for pillar, grains, ...
salt/runners/cache.py
def clear_git_lock(role, remote=None, **kwargs): ''' .. versionadded:: 2015.8.2 Remove the update locks for Salt components (gitfs, git_pillar, winrepo) which use gitfs backend code from salt.utils.gitfs. .. note:: Running :py:func:`cache.clear_all <salt.runners.cache.clear_all>` will ...
def clear_git_lock(role, remote=None, **kwargs): ''' .. versionadded:: 2015.8.2 Remove the update locks for Salt components (gitfs, git_pillar, winrepo) which use gitfs backend code from salt.utils.gitfs. .. note:: Running :py:func:`cache.clear_all <salt.runners.cache.clear_all>` will ...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "2" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/cache.py#L239-L343
[ "def", "clear_git_lock", "(", "role", ",", "remote", "=", "None", ",", "*", "*", "kwargs", ")", ":", "kwargs", "=", "salt", ".", "utils", ".", "args", ".", "clean_kwargs", "(", "*", "*", "kwargs", ")", "type_", "=", "salt", ".", "utils", ".", "args...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
cloud
Return cloud cache data for target. .. note:: Only works with glob matching tgt Glob Target to match minion ids provider Cloud Provider CLI Example: .. code-block:: bash salt-run cache.cloud 'salt*' salt-run cache.cloud glance.example.org provider=openstack
salt/runners/cache.py
def cloud(tgt, provider=None): ''' Return cloud cache data for target. .. note:: Only works with glob matching tgt Glob Target to match minion ids provider Cloud Provider CLI Example: .. code-block:: bash salt-run cache.cloud 'salt*' salt-run cache.cloud gla...
def cloud(tgt, provider=None): ''' Return cloud cache data for target. .. note:: Only works with glob matching tgt Glob Target to match minion ids provider Cloud Provider CLI Example: .. code-block:: bash salt-run cache.cloud 'salt*' salt-run cache.cloud gla...
[ "Return", "cloud", "cache", "data", "for", "target", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/cache.py#L346-L385
[ "def", "cloud", "(", "tgt", ",", "provider", "=", "None", ")", ":", "if", "not", "isinstance", "(", "tgt", ",", "six", ".", "string_types", ")", ":", "return", "{", "}", "opts", "=", "salt", ".", "config", ".", "cloud_config", "(", "os", ".", "path...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
store
Lists entries stored in the specified bank. CLI Example: .. code-block:: bash salt-run cache.store mycache mykey 'The time has come the walrus said'
salt/runners/cache.py
def store(bank, key, data, cachedir=None): ''' Lists entries stored in the specified bank. CLI Example: .. code-block:: bash salt-run cache.store mycache mykey 'The time has come the walrus said' ''' if cachedir is None: cachedir = __opts__['cachedir'] try: cache ...
def store(bank, key, data, cachedir=None): ''' Lists entries stored in the specified bank. CLI Example: .. code-block:: bash salt-run cache.store mycache mykey 'The time has come the walrus said' ''' if cachedir is None: cachedir = __opts__['cachedir'] try: cache ...
[ "Lists", "entries", "stored", "in", "the", "specified", "bank", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/cache.py#L388-L405
[ "def", "store", "(", "bank", ",", "key", ",", "data", ",", "cachedir", "=", "None", ")", ":", "if", "cachedir", "is", "None", ":", "cachedir", "=", "__opts__", "[", "'cachedir'", "]", "try", ":", "cache", "=", "salt", ".", "cache", ".", "Cache", "(...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_
Lists entries stored in the specified bank. CLI Example: .. code-block:: bash salt-run cache.list cloud/active/ec2/myec2 cachedir=/var/cache/salt/
salt/runners/cache.py
def list_(bank, cachedir=None): ''' Lists entries stored in the specified bank. CLI Example: .. code-block:: bash salt-run cache.list cloud/active/ec2/myec2 cachedir=/var/cache/salt/ ''' if cachedir is None: cachedir = __opts__['cachedir'] try: cache = salt.cache....
def list_(bank, cachedir=None): ''' Lists entries stored in the specified bank. CLI Example: .. code-block:: bash salt-run cache.list cloud/active/ec2/myec2 cachedir=/var/cache/salt/ ''' if cachedir is None: cachedir = __opts__['cachedir'] try: cache = salt.cache....
[ "Lists", "entries", "stored", "in", "the", "specified", "bank", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/cache.py#L408-L425
[ "def", "list_", "(", "bank", ",", "cachedir", "=", "None", ")", ":", "if", "cachedir", "is", "None", ":", "cachedir", "=", "__opts__", "[", "'cachedir'", "]", "try", ":", "cache", "=", "salt", ".", "cache", ".", "Cache", "(", "__opts__", ",", "cached...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
fetch
Fetch data from a salt.cache bank. CLI Example: .. code-block:: bash salt-run cache.fetch cloud/active/ec2/myec2 myminion cachedir=/var/cache/salt/
salt/runners/cache.py
def fetch(bank, key, cachedir=None): ''' Fetch data from a salt.cache bank. CLI Example: .. code-block:: bash salt-run cache.fetch cloud/active/ec2/myec2 myminion cachedir=/var/cache/salt/ ''' if cachedir is None: cachedir = __opts__['cachedir'] try: cache = salt....
def fetch(bank, key, cachedir=None): ''' Fetch data from a salt.cache bank. CLI Example: .. code-block:: bash salt-run cache.fetch cloud/active/ec2/myec2 myminion cachedir=/var/cache/salt/ ''' if cachedir is None: cachedir = __opts__['cachedir'] try: cache = salt....
[ "Fetch", "data", "from", "a", "salt", ".", "cache", "bank", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/cache.py#L428-L445
[ "def", "fetch", "(", "bank", ",", "key", ",", "cachedir", "=", "None", ")", ":", "if", "cachedir", "is", "None", ":", "cachedir", "=", "__opts__", "[", "'cachedir'", "]", "try", ":", "cache", "=", "salt", ".", "cache", ".", "Cache", "(", "__opts__", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_conn
Return an postgres cursor
salt/queues/pgjsonb_queue.py
def _conn(commit=False): ''' Return an postgres cursor ''' defaults = {'host': 'localhost', 'user': 'salt', 'password': 'salt', 'dbname': 'salt', 'port': 5432} conn_kwargs = {} for key, value in defaults.items(): conn_kwarg...
def _conn(commit=False): ''' Return an postgres cursor ''' defaults = {'host': 'localhost', 'user': 'salt', 'password': 'salt', 'dbname': 'salt', 'port': 5432} conn_kwargs = {} for key, value in defaults.items(): conn_kwarg...
[ "Return", "an", "postgres", "cursor" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/queues/pgjsonb_queue.py#L72-L105
[ "def", "_conn", "(", "commit", "=", "False", ")", ":", "defaults", "=", "{", "'host'", ":", "'localhost'", ",", "'user'", ":", "'salt'", ",", "'password'", ":", "'salt'", ",", "'dbname'", ":", "'salt'", ",", "'port'", ":", "5432", "}", "conn_kwargs", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
insert
Add an item or items to a queue
salt/queues/pgjsonb_queue.py
def insert(queue, items): ''' Add an item or items to a queue ''' handle_queue_creation(queue) with _conn(commit=True) as cur: if isinstance(items, dict): items = salt.utils.json.dumps(items) cmd = str('''INSERT INTO {0}(data) VALUES('{1}')''').format(queue, items) ...
def insert(queue, items): ''' Add an item or items to a queue ''' handle_queue_creation(queue) with _conn(commit=True) as cur: if isinstance(items, dict): items = salt.utils.json.dumps(items) cmd = str('''INSERT INTO {0}(data) VALUES('{1}')''').format(queue, items) ...
[ "Add", "an", "item", "or", "items", "to", "a", "queue" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/queues/pgjsonb_queue.py#L183-L208
[ "def", "insert", "(", "queue", ",", "items", ")", ":", "handle_queue_creation", "(", "queue", ")", "with", "_conn", "(", "commit", "=", "True", ")", "as", "cur", ":", "if", "isinstance", "(", "items", ",", "dict", ")", ":", "items", "=", "salt", ".",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
delete
Delete an item or items from a queue
salt/queues/pgjsonb_queue.py
def delete(queue, items): ''' Delete an item or items from a queue ''' with _conn(commit=True) as cur: if isinstance(items, dict): cmd = str("""DELETE FROM {0} WHERE data = '{1}'""").format( # future lint: disable=blacklisted-function queue, salt.util...
def delete(queue, items): ''' Delete an item or items from a queue ''' with _conn(commit=True) as cur: if isinstance(items, dict): cmd = str("""DELETE FROM {0} WHERE data = '{1}'""").format( # future lint: disable=blacklisted-function queue, salt.util...
[ "Delete", "an", "item", "or", "items", "from", "a", "queue" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/queues/pgjsonb_queue.py#L211-L228
[ "def", "delete", "(", "queue", ",", "items", ")", ":", "with", "_conn", "(", "commit", "=", "True", ")", "as", "cur", ":", "if", "isinstance", "(", "items", ",", "dict", ")", ":", "cmd", "=", "str", "(", "\"\"\"DELETE FROM {0} WHERE data = '{1}'\"\"\"", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
pop
Pop one or more or all items from the queue return them.
salt/queues/pgjsonb_queue.py
def pop(queue, quantity=1, is_runner=False): ''' Pop one or more or all items from the queue return them. ''' cmd = 'SELECT id, data FROM {0}'.format(queue) if quantity != 'all': try: quantity = int(quantity) except ValueError as exc: error_txt = ('Quantity mu...
def pop(queue, quantity=1, is_runner=False): ''' Pop one or more or all items from the queue return them. ''' cmd = 'SELECT id, data FROM {0}'.format(queue) if quantity != 'all': try: quantity = int(quantity) except ValueError as exc: error_txt = ('Quantity mu...
[ "Pop", "one", "or", "more", "or", "all", "items", "from", "the", "queue", "return", "them", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/queues/pgjsonb_queue.py#L231-L259
[ "def", "pop", "(", "queue", ",", "quantity", "=", "1", ",", "is_runner", "=", "False", ")", ":", "cmd", "=", "'SELECT id, data FROM {0}'", ".", "format", "(", "queue", ")", "if", "quantity", "!=", "'all'", ":", "try", ":", "quantity", "=", "int", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
daemonize
Daemonize a process
salt/utils/process.py
def daemonize(redirect_out=True): ''' Daemonize a process ''' # Avoid circular import import salt.utils.crypt try: pid = os.fork() if pid > 0: # exit first parent salt.utils.crypt.reinit_crypto() os._exit(salt.defaults.exitcodes.EX_OK) exce...
def daemonize(redirect_out=True): ''' Daemonize a process ''' # Avoid circular import import salt.utils.crypt try: pid = os.fork() if pid > 0: # exit first parent salt.utils.crypt.reinit_crypto() os._exit(salt.defaults.exitcodes.EX_OK) exce...
[ "Daemonize", "a", "process" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/process.py#L63-L110
[ "def", "daemonize", "(", "redirect_out", "=", "True", ")", ":", "# Avoid circular import", "import", "salt", ".", "utils", ".", "crypt", "try", ":", "pid", "=", "os", ".", "fork", "(", ")", "if", "pid", ">", "0", ":", "# exit first parent", "salt", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
daemonize_if
Daemonize a module function process if multiprocessing is True and the process is not being called by salt-call
salt/utils/process.py
def daemonize_if(opts): ''' Daemonize a module function process if multiprocessing is True and the process is not being called by salt-call ''' if 'salt-call' in sys.argv[0]: return if not opts.get('multiprocessing', True): return if sys.platform.startswith('win'): re...
def daemonize_if(opts): ''' Daemonize a module function process if multiprocessing is True and the process is not being called by salt-call ''' if 'salt-call' in sys.argv[0]: return if not opts.get('multiprocessing', True): return if sys.platform.startswith('win'): re...
[ "Daemonize", "a", "module", "function", "process", "if", "multiprocessing", "is", "True", "and", "the", "process", "is", "not", "being", "called", "by", "salt", "-", "call" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/process.py#L113-L124
[ "def", "daemonize_if", "(", "opts", ")", ":", "if", "'salt-call'", "in", "sys", ".", "argv", "[", "0", "]", ":", "return", "if", "not", "opts", ".", "get", "(", "'multiprocessing'", ",", "True", ")", ":", "return", "if", "sys", ".", "platform", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
notify_systemd
Notify systemd that this process has started
salt/utils/process.py
def notify_systemd(): ''' Notify systemd that this process has started ''' try: import systemd.daemon except ImportError: if salt.utils.path.which('systemd-notify') \ and systemd_notify_call('--booted'): # Notify systemd synchronously notify_so...
def notify_systemd(): ''' Notify systemd that this process has started ''' try: import systemd.daemon except ImportError: if salt.utils.path.which('systemd-notify') \ and systemd_notify_call('--booted'): # Notify systemd synchronously notify_so...
[ "Notify", "systemd", "that", "this", "process", "has", "started" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/process.py#L134-L164
[ "def", "notify_systemd", "(", ")", ":", "try", ":", "import", "systemd", ".", "daemon", "except", "ImportError", ":", "if", "salt", ".", "utils", ".", "path", ".", "which", "(", "'systemd-notify'", ")", "and", "systemd_notify_call", "(", "'--booted'", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_pidfile
Save the pidfile
salt/utils/process.py
def set_pidfile(pidfile, user): ''' Save the pidfile ''' pdir = os.path.dirname(pidfile) if not os.path.isdir(pdir) and pdir: os.makedirs(pdir) try: with salt.utils.files.fopen(pidfile, 'w+') as ofile: ofile.write(str(os.getpid())) # future lint: disable=blacklisted-...
def set_pidfile(pidfile, user): ''' Save the pidfile ''' pdir = os.path.dirname(pidfile) if not os.path.isdir(pdir) and pdir: os.makedirs(pdir) try: with salt.utils.files.fopen(pidfile, 'w+') as ofile: ofile.write(str(os.getpid())) # future lint: disable=blacklisted-...
[ "Save", "the", "pidfile" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/process.py#L167-L215
[ "def", "set_pidfile", "(", "pidfile", ",", "user", ")", ":", "pdir", "=", "os", ".", "path", ".", "dirname", "(", "pidfile", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "pdir", ")", "and", "pdir", ":", "os", ".", "makedirs", "(", "pdi...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_pidfile
Return the pid from a pidfile as an integer
salt/utils/process.py
def get_pidfile(pidfile): ''' Return the pid from a pidfile as an integer ''' try: with salt.utils.files.fopen(pidfile) as pdf: pid = pdf.read().strip() return int(pid) except (OSError, IOError, TypeError, ValueError): return -1
def get_pidfile(pidfile): ''' Return the pid from a pidfile as an integer ''' try: with salt.utils.files.fopen(pidfile) as pdf: pid = pdf.read().strip() return int(pid) except (OSError, IOError, TypeError, ValueError): return -1
[ "Return", "the", "pid", "from", "a", "pidfile", "as", "an", "integer" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/process.py#L225-L234
[ "def", "get_pidfile", "(", "pidfile", ")", ":", "try", ":", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "pidfile", ")", "as", "pdf", ":", "pid", "=", "pdf", ".", "read", "(", ")", ".", "strip", "(", ")", "return", "int", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
clean_proc
Generic method for cleaning up multiprocessing procs
salt/utils/process.py
def clean_proc(proc, wait_for_kill=10): ''' Generic method for cleaning up multiprocessing procs ''' # NoneType and other fun stuff need not apply if not proc: return try: waited = 0 while proc.is_alive(): proc.terminate() waited += 1 t...
def clean_proc(proc, wait_for_kill=10): ''' Generic method for cleaning up multiprocessing procs ''' # NoneType and other fun stuff need not apply if not proc: return try: waited = 0 while proc.is_alive(): proc.terminate() waited += 1 t...
[ "Generic", "method", "for", "cleaning", "up", "multiprocessing", "procs" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/process.py#L237-L257
[ "def", "clean_proc", "(", "proc", ",", "wait_for_kill", "=", "10", ")", ":", "# NoneType and other fun stuff need not apply", "if", "not", "proc", ":", "return", "try", ":", "waited", "=", "0", "while", "proc", ".", "is_alive", "(", ")", ":", "proc", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
os_is_running
Use OS facilities to determine if a process is running
salt/utils/process.py
def os_is_running(pid): ''' Use OS facilities to determine if a process is running ''' if isinstance(pid, six.string_types): pid = int(pid) if HAS_PSUTIL: return psutil.pid_exists(pid) else: try: os.kill(pid, 0) # SIG 0 is the "are you alive?" signal ...
def os_is_running(pid): ''' Use OS facilities to determine if a process is running ''' if isinstance(pid, six.string_types): pid = int(pid) if HAS_PSUTIL: return psutil.pid_exists(pid) else: try: os.kill(pid, 0) # SIG 0 is the "are you alive?" signal ...
[ "Use", "OS", "facilities", "to", "determine", "if", "a", "process", "is", "running" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/process.py#L260-L273
[ "def", "os_is_running", "(", "pid", ")", ":", "if", "isinstance", "(", "pid", ",", "six", ".", "string_types", ")", ":", "pid", "=", "int", "(", "pid", ")", "if", "HAS_PSUTIL", ":", "return", "psutil", ".", "pid_exists", "(", "pid", ")", "else", ":",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ProcessManager.add_process
Create a processes and args + kwargs This will deterimine if it is a Process class, otherwise it assumes it is a function
salt/utils/process.py
def add_process(self, tgt, args=None, kwargs=None, name=None): ''' Create a processes and args + kwargs This will deterimine if it is a Process class, otherwise it assumes it is a function ''' if args is None: args = [] if kwargs is None: ...
def add_process(self, tgt, args=None, kwargs=None, name=None): ''' Create a processes and args + kwargs This will deterimine if it is a Process class, otherwise it assumes it is a function ''' if args is None: args = [] if kwargs is None: ...
[ "Create", "a", "processes", "and", "args", "+", "kwargs", "This", "will", "deterimine", "if", "it", "is", "a", "Process", "class", "otherwise", "it", "assumes", "it", "is", "a", "function" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/process.py#L366-L433
[ "def", "add_process", "(", "self", ",", "tgt", ",", "args", "=", "None", ",", "kwargs", "=", "None", ",", "name", "=", "None", ")", ":", "if", "args", "is", "None", ":", "args", "=", "[", "]", "if", "kwargs", "is", "None", ":", "kwargs", "=", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ProcessManager.restart_process
Create new process (assuming this one is dead), then remove the old one
salt/utils/process.py
def restart_process(self, pid): ''' Create new process (assuming this one is dead), then remove the old one ''' if self._restart_processes is False: return log.info( 'Process %s (%s) died with exit status %s, restarting...', self._process_map[p...
def restart_process(self, pid): ''' Create new process (assuming this one is dead), then remove the old one ''' if self._restart_processes is False: return log.info( 'Process %s (%s) died with exit status %s, restarting...', self._process_map[p...
[ "Create", "new", "process", "(", "assuming", "this", "one", "is", "dead", ")", "then", "remove", "the", "old", "one" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/process.py#L435-L454
[ "def", "restart_process", "(", "self", ",", "pid", ")", ":", "if", "self", ".", "_restart_processes", "is", "False", ":", "return", "log", ".", "info", "(", "'Process %s (%s) died with exit status %s, restarting...'", ",", "self", ".", "_process_map", "[", "pid", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ProcessManager.run
Load and start all available api modules
salt/utils/process.py
def run(self, asynchronous=False): ''' Load and start all available api modules ''' log.debug('Process Manager starting!') appendproctitle(self.name) # make sure to kill the subprocesses if the parent is killed if signal.getsignal(signal.SIGTERM) is signal.SIG_DF...
def run(self, asynchronous=False): ''' Load and start all available api modules ''' log.debug('Process Manager starting!') appendproctitle(self.name) # make sure to kill the subprocesses if the parent is killed if signal.getsignal(signal.SIGTERM) is signal.SIG_DF...
[ "Load", "and", "start", "all", "available", "api", "modules" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/process.py#L485-L522
[ "def", "run", "(", "self", ",", "asynchronous", "=", "False", ")", ":", "log", ".", "debug", "(", "'Process Manager starting!'", ")", "appendproctitle", "(", "self", ".", "name", ")", "# make sure to kill the subprocesses if the parent is killed", "if", "signal", "....
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ProcessManager.check_children
Check the children once
salt/utils/process.py
def check_children(self): ''' Check the children once ''' if self._restart_processes is True: for pid, mapping in six.iteritems(self._process_map): if not mapping['Process'].is_alive(): log.trace('Process restart of %s', pid) ...
def check_children(self): ''' Check the children once ''' if self._restart_processes is True: for pid, mapping in six.iteritems(self._process_map): if not mapping['Process'].is_alive(): log.trace('Process restart of %s', pid) ...
[ "Check", "the", "children", "once" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/process.py#L524-L532
[ "def", "check_children", "(", "self", ")", ":", "if", "self", ".", "_restart_processes", "is", "True", ":", "for", "pid", ",", "mapping", "in", "six", ".", "iteritems", "(", "self", ".", "_process_map", ")", ":", "if", "not", "mapping", "[", "'Process'",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ProcessManager.kill_children
Kill all of the children
salt/utils/process.py
def kill_children(self, *args, **kwargs): ''' Kill all of the children ''' # first lets reset signal handlers to default one to prevent running this twice signal.signal(signal.SIGTERM, signal.SIG_IGN) signal.signal(signal.SIGINT, signal.SIG_IGN) # check that this...
def kill_children(self, *args, **kwargs): ''' Kill all of the children ''' # first lets reset signal handlers to default one to prevent running this twice signal.signal(signal.SIGTERM, signal.SIG_IGN) signal.signal(signal.SIGINT, signal.SIG_IGN) # check that this...
[ "Kill", "all", "of", "the", "children" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/process.py#L534-L657
[ "def", "kill_children", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# first lets reset signal handlers to default one to prevent running this twice", "signal", ".", "signal", "(", "signal", ".", "SIGTERM", ",", "signal", ".", "SIG_IGN", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_query
Make a web call to VictorOps
salt/modules/victorops.py
def _query(action=None, routing_key=None, args=None, method='GET', header_dict=None, data=None): ''' Make a web call to VictorOps ''' api_key = __salt__['config.get']('victorops.api_key') or \ __salt__['config.get']('victorops:api_key') ...
def _query(action=None, routing_key=None, args=None, method='GET', header_dict=None, data=None): ''' Make a web call to VictorOps ''' api_key = __salt__['config.get']('victorops.api_key') or \ __salt__['config.get']('victorops:api_key') ...
[ "Make", "a", "web", "call", "to", "VictorOps" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/victorops.py#L41-L97
[ "def", "_query", "(", "action", "=", "None", ",", "routing_key", "=", "None", ",", "args", "=", "None", ",", "method", "=", "'GET'", ",", "header_dict", "=", "None", ",", "data", "=", "None", ")", ":", "api_key", "=", "__salt__", "[", "'config.get'", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
create_event
Create an event in VictorOps. Designed for use in states. The following parameters are required: :param message_type: One of the following values: INFO, WARNING, ACKNOWLEDGEMENT, CRITICAL, RECOVERY. The following parameters are optional: :param routing_key: The key for where m...
salt/modules/victorops.py
def create_event(message_type=None, routing_key='everybody', **kwargs): ''' Create an event in VictorOps. Designed for use in states. The following parameters are required: :param message_type: One of the following values: INFO, WARNING, ACKNOWLEDGEMENT, CRITICAL, RECOVERY. The followi...
def create_event(message_type=None, routing_key='everybody', **kwargs): ''' Create an event in VictorOps. Designed for use in states. The following parameters are required: :param message_type: One of the following values: INFO, WARNING, ACKNOWLEDGEMENT, CRITICAL, RECOVERY. The followi...
[ "Create", "an", "event", "in", "VictorOps", ".", "Designed", "for", "use", "in", "states", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/victorops.py#L100-L211
[ "def", "create_event", "(", "message_type", "=", "None", ",", "routing_key", "=", "'everybody'", ",", "*", "*", "kwargs", ")", ":", "keyword_args", "=", "{", "'entity_id'", ":", "str", ",", "'state_message'", ":", "str", ",", "'entity_is_host'", ":", "bool",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
present
Ensure the telemetry alert exists. name An optional description of the alarm (not currently supported by telemetry API) deployment_id Specifies the ID of the root deployment resource (replica set cluster or sharded cluster) to which this alert definition is attached metric_name ...
salt/states/telemetry_alert.py
def present(name, deployment_id, metric_name, alert_config, api_key=None, profile='telemetry'): ''' Ensure the telemetry alert exists. name An optional description of the alarm (not currently supported by telemetry API) deployment_id Specifies the ID of the root deployment resource ...
def present(name, deployment_id, metric_name, alert_config, api_key=None, profile='telemetry'): ''' Ensure the telemetry alert exists. name An optional description of the alarm (not currently supported by telemetry API) deployment_id Specifies the ID of the root deployment resource ...
[ "Ensure", "the", "telemetry", "alert", "exists", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/telemetry_alert.py#L40-L155
[ "def", "present", "(", "name", ",", "deployment_id", ",", "metric_name", ",", "alert_config", ",", "api_key", "=", "None", ",", "profile", "=", "'telemetry'", ")", ":", "ret", "=", "{", "'name'", ":", "metric_name", ",", "'result'", ":", "True", ",", "'c...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
absent
Ensure the telemetry alert config is deleted name An optional description of the alarms (not currently supported by telemetry API) deployment_id Specifies the ID of the root deployment resource (replica set cluster or sharded cluster) to which this alert definition is attached met...
salt/states/telemetry_alert.py
def absent(name, deployment_id, metric_name, api_key=None, profile="telemetry"): ''' Ensure the telemetry alert config is deleted name An optional description of the alarms (not currently supported by telemetry API) deployment_id Specifies the ID of the root deployment resource ...
def absent(name, deployment_id, metric_name, api_key=None, profile="telemetry"): ''' Ensure the telemetry alert config is deleted name An optional description of the alarms (not currently supported by telemetry API) deployment_id Specifies the ID of the root deployment resource ...
[ "Ensure", "the", "telemetry", "alert", "config", "is", "deleted" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/telemetry_alert.py#L158-L201
[ "def", "absent", "(", "name", ",", "deployment_id", ",", "metric_name", ",", "api_key", "=", "None", ",", "profile", "=", "\"telemetry\"", ")", ":", "ret", "=", "{", "'name'", ":", "metric_name", ",", "'result'", ":", "True", ",", "'comment'", ":", "''",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_
List the installed packages. :return: A list of installed packages :rtype: list CLI Example: .. code-block:: bash salt '*' pkgutil.list
salt/modules/mac_pkgutil.py
def list_(): ''' List the installed packages. :return: A list of installed packages :rtype: list CLI Example: .. code-block:: bash salt '*' pkgutil.list ''' cmd = 'pkgutil --pkgs' ret = salt.utils.mac_utils.execute_return_result(cmd) return ret.splitlines()
def list_(): ''' List the installed packages. :return: A list of installed packages :rtype: list CLI Example: .. code-block:: bash salt '*' pkgutil.list ''' cmd = 'pkgutil --pkgs' ret = salt.utils.mac_utils.execute_return_result(cmd) return ret.splitlines()
[ "List", "the", "installed", "packages", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_pkgutil.py#L39-L54
[ "def", "list_", "(", ")", ":", "cmd", "=", "'pkgutil --pkgs'", "ret", "=", "salt", ".", "utils", ".", "mac_utils", ".", "execute_return_result", "(", "cmd", ")", "return", "ret", ".", "splitlines", "(", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_install_from_path
Internal function to install a package from the given path
salt/modules/mac_pkgutil.py
def _install_from_path(path): ''' Internal function to install a package from the given path ''' if not os.path.exists(path): msg = 'File not found: {0}'.format(path) raise SaltInvocationError(msg) cmd = 'installer -pkg "{0}" -target /'.format(path) return salt.utils.mac_utils.e...
def _install_from_path(path): ''' Internal function to install a package from the given path ''' if not os.path.exists(path): msg = 'File not found: {0}'.format(path) raise SaltInvocationError(msg) cmd = 'installer -pkg "{0}" -target /'.format(path) return salt.utils.mac_utils.e...
[ "Internal", "function", "to", "install", "a", "package", "from", "the", "given", "path" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_pkgutil.py#L73-L82
[ "def", "_install_from_path", "(", "path", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "msg", "=", "'File not found: {0}'", ".", "format", "(", "path", ")", "raise", "SaltInvocationError", "(", "msg", ")", "cmd", "=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
install
Install a .pkg from an URI or an absolute path. :param str source: The path to a package. :param str package_id: The package ID :return: True if successful, otherwise False :rtype: bool CLI Example: .. code-block:: bash salt '*' pkgutil.install source=/vagrant/build_essentials.pkg ...
salt/modules/mac_pkgutil.py
def install(source, package_id): ''' Install a .pkg from an URI or an absolute path. :param str source: The path to a package. :param str package_id: The package ID :return: True if successful, otherwise False :rtype: bool CLI Example: .. code-block:: bash salt '*' pkgutil....
def install(source, package_id): ''' Install a .pkg from an URI or an absolute path. :param str source: The path to a package. :param str package_id: The package ID :return: True if successful, otherwise False :rtype: bool CLI Example: .. code-block:: bash salt '*' pkgutil....
[ "Install", "a", ".", "pkg", "from", "an", "URI", "or", "an", "absolute", "path", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_pkgutil.py#L85-L112
[ "def", "install", "(", "source", ",", "package_id", ")", ":", "if", "is_installed", "(", "package_id", ")", ":", "return", "True", "uri", "=", "urllib", ".", "parse", ".", "urlparse", "(", "source", ")", "if", "not", "uri", ".", "scheme", "==", "''", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
forget
.. versionadded:: 2016.3.0 Remove the receipt data about the specified package. Does not remove files. .. warning:: DO NOT use this command to fix broken package design :param str package_id: The name of the package to forget :return: True if successful, otherwise False :rtype: bool ...
salt/modules/mac_pkgutil.py
def forget(package_id): ''' .. versionadded:: 2016.3.0 Remove the receipt data about the specified package. Does not remove files. .. warning:: DO NOT use this command to fix broken package design :param str package_id: The name of the package to forget :return: True if successful, o...
def forget(package_id): ''' .. versionadded:: 2016.3.0 Remove the receipt data about the specified package. Does not remove files. .. warning:: DO NOT use this command to fix broken package design :param str package_id: The name of the package to forget :return: True if successful, o...
[ "..", "versionadded", "::", "2016", ".", "3", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_pkgutil.py#L115-L137
[ "def", "forget", "(", "package_id", ")", ":", "cmd", "=", "'pkgutil --forget {0}'", ".", "format", "(", "package_id", ")", "salt", ".", "utils", ".", "mac_utils", ".", "execute_return_success", "(", "cmd", ")", "return", "not", "is_installed", "(", "package_id...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
apps
Return a list of the currently installed app ids. CLI Example: .. code-block:: bash salt marathon-minion-id marathon.apps
salt/modules/marathon.py
def apps(): ''' Return a list of the currently installed app ids. CLI Example: .. code-block:: bash salt marathon-minion-id marathon.apps ''' response = salt.utils.http.query( "{0}/v2/apps".format(_base_url()), decode_type='json', decode=True, ) return ...
def apps(): ''' Return a list of the currently installed app ids. CLI Example: .. code-block:: bash salt marathon-minion-id marathon.apps ''' response = salt.utils.http.query( "{0}/v2/apps".format(_base_url()), decode_type='json', decode=True, ) return ...
[ "Return", "a", "list", "of", "the", "currently", "installed", "app", "ids", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/marathon.py#L55-L70
[ "def", "apps", "(", ")", ":", "response", "=", "salt", ".", "utils", ".", "http", ".", "query", "(", "\"{0}/v2/apps\"", ".", "format", "(", "_base_url", "(", ")", ")", ",", "decode_type", "=", "'json'", ",", "decode", "=", "True", ",", ")", "return",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
update_app
Update the specified app with the given configuration. CLI Example: .. code-block:: bash salt marathon-minion-id marathon.update_app my-app '<config yaml>'
salt/modules/marathon.py
def update_app(id, config): ''' Update the specified app with the given configuration. CLI Example: .. code-block:: bash salt marathon-minion-id marathon.update_app my-app '<config yaml>' ''' if 'id' not in config: config['id'] = id config.pop('version', None) # mirror...
def update_app(id, config): ''' Update the specified app with the given configuration. CLI Example: .. code-block:: bash salt marathon-minion-id marathon.update_app my-app '<config yaml>' ''' if 'id' not in config: config['id'] = id config.pop('version', None) # mirror...
[ "Update", "the", "specified", "app", "with", "the", "given", "configuration", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/marathon.py#L104-L141
[ "def", "update_app", "(", "id", ",", "config", ")", ":", "if", "'id'", "not", "in", "config", ":", "config", "[", "'id'", "]", "=", "id", "config", ".", "pop", "(", "'version'", ",", "None", ")", "# mirror marathon-ui handling for uris deprecation (see", "# ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
rm_app
Remove the specified app from the server. CLI Example: .. code-block:: bash salt marathon-minion-id marathon.rm_app my-app
salt/modules/marathon.py
def rm_app(id): ''' Remove the specified app from the server. CLI Example: .. code-block:: bash salt marathon-minion-id marathon.rm_app my-app ''' response = salt.utils.http.query( "{0}/v2/apps/{1}".format(_base_url(), id), method='DELETE', decode_type='json', ...
def rm_app(id): ''' Remove the specified app from the server. CLI Example: .. code-block:: bash salt marathon-minion-id marathon.rm_app my-app ''' response = salt.utils.http.query( "{0}/v2/apps/{1}".format(_base_url(), id), method='DELETE', decode_type='json', ...
[ "Remove", "the", "specified", "app", "from", "the", "server", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/marathon.py#L144-L160
[ "def", "rm_app", "(", "id", ")", ":", "response", "=", "salt", ".", "utils", ".", "http", ".", "query", "(", "\"{0}/v2/apps/{1}\"", ".", "format", "(", "_base_url", "(", ")", ",", "id", ")", ",", "method", "=", "'DELETE'", ",", "decode_type", "=", "'...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
info
Return configuration and status information about the marathon instance. CLI Example: .. code-block:: bash salt marathon-minion-id marathon.info
salt/modules/marathon.py
def info(): ''' Return configuration and status information about the marathon instance. CLI Example: .. code-block:: bash salt marathon-minion-id marathon.info ''' response = salt.utils.http.query( "{0}/v2/info".format(_base_url()), decode_type='json', decode=...
def info(): ''' Return configuration and status information about the marathon instance. CLI Example: .. code-block:: bash salt marathon-minion-id marathon.info ''' response = salt.utils.http.query( "{0}/v2/info".format(_base_url()), decode_type='json', decode=...
[ "Return", "configuration", "and", "status", "information", "about", "the", "marathon", "instance", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/marathon.py#L163-L178
[ "def", "info", "(", ")", ":", "response", "=", "salt", ".", "utils", ".", "http", ".", "query", "(", "\"{0}/v2/info\"", ".", "format", "(", "_base_url", "(", ")", ")", ",", "decode_type", "=", "'json'", ",", "decode", "=", "True", ",", ")", "return",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
restart_app
Restart the current server configuration for the specified app. :param restart: Restart the app :param force: Override the current deployment CLI Example: .. code-block:: bash salt marathon-minion-id marathon.restart_app my-app By default, this will only check if the app exists in marat...
salt/modules/marathon.py
def restart_app(id, restart=False, force=True): ''' Restart the current server configuration for the specified app. :param restart: Restart the app :param force: Override the current deployment CLI Example: .. code-block:: bash salt marathon-minion-id marathon.restart_app my-app ...
def restart_app(id, restart=False, force=True): ''' Restart the current server configuration for the specified app. :param restart: Restart the app :param force: Override the current deployment CLI Example: .. code-block:: bash salt marathon-minion-id marathon.restart_app my-app ...
[ "Restart", "the", "current", "server", "configuration", "for", "the", "specified", "app", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/marathon.py#L181-L233
[ "def", "restart_app", "(", "id", ",", "restart", "=", "False", ",", "force", "=", "True", ")", ":", "ret", "=", "{", "'restarted'", ":", "None", "}", "if", "not", "restart", ":", "ret", "[", "'restarted'", "]", "=", "False", "return", "ret", "try", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_dns_servers
Return a list of the configured DNS servers of the specified interface CLI Example: .. code-block:: bash salt '*' win_dns_client.get_dns_servers 'Local Area Connection'
salt/modules/win_dns_client.py
def get_dns_servers(interface='Local Area Connection'): ''' Return a list of the configured DNS servers of the specified interface CLI Example: .. code-block:: bash salt '*' win_dns_client.get_dns_servers 'Local Area Connection' ''' # remove any escape characters interface = inter...
def get_dns_servers(interface='Local Area Connection'): ''' Return a list of the configured DNS servers of the specified interface CLI Example: .. code-block:: bash salt '*' win_dns_client.get_dns_servers 'Local Area Connection' ''' # remove any escape characters interface = inter...
[ "Return", "a", "list", "of", "the", "configured", "DNS", "servers", "of", "the", "specified", "interface" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dns_client.py#L30-L54
[ "def", "get_dns_servers", "(", "interface", "=", "'Local Area Connection'", ")", ":", "# remove any escape characters", "interface", "=", "interface", ".", "split", "(", "'\\\\'", ")", "interface", "=", "''", ".", "join", "(", "interface", ")", "with", "salt", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
rm_dns
Remove the DNS server from the network interface CLI Example: .. code-block:: bash salt '*' win_dns_client.rm_dns <ip> <interface>
salt/modules/win_dns_client.py
def rm_dns(ip, interface='Local Area Connection'): ''' Remove the DNS server from the network interface CLI Example: .. code-block:: bash salt '*' win_dns_client.rm_dns <ip> <interface> ''' cmd = ['netsh', 'interface', 'ip', 'delete', 'dns', interface, ip, 'validate=no'] return __...
def rm_dns(ip, interface='Local Area Connection'): ''' Remove the DNS server from the network interface CLI Example: .. code-block:: bash salt '*' win_dns_client.rm_dns <ip> <interface> ''' cmd = ['netsh', 'interface', 'ip', 'delete', 'dns', interface, ip, 'validate=no'] return __...
[ "Remove", "the", "DNS", "server", "from", "the", "network", "interface" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dns_client.py#L57-L68
[ "def", "rm_dns", "(", "ip", ",", "interface", "=", "'Local Area Connection'", ")", ":", "cmd", "=", "[", "'netsh'", ",", "'interface'", ",", "'ip'", ",", "'delete'", ",", "'dns'", ",", "interface", ",", "ip", ",", "'validate=no'", "]", "return", "__salt__"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
add_dns
Add the DNS server to the network interface (index starts from 1) Note: if the interface DNS is configured by DHCP, all the DNS servers will be removed from the interface and the requested DNS will be the only one CLI Example: .. code-block:: bash salt '*' win_dns_client.add_dns <ip> <in...
salt/modules/win_dns_client.py
def add_dns(ip, interface='Local Area Connection', index=1): ''' Add the DNS server to the network interface (index starts from 1) Note: if the interface DNS is configured by DHCP, all the DNS servers will be removed from the interface and the requested DNS will be the only one CLI Example: ...
def add_dns(ip, interface='Local Area Connection', index=1): ''' Add the DNS server to the network interface (index starts from 1) Note: if the interface DNS is configured by DHCP, all the DNS servers will be removed from the interface and the requested DNS will be the only one CLI Example: ...
[ "Add", "the", "DNS", "server", "to", "the", "network", "interface", "(", "index", "starts", "from", "1", ")" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dns_client.py#L71-L105
[ "def", "add_dns", "(", "ip", ",", "interface", "=", "'Local Area Connection'", ",", "index", "=", "1", ")", ":", "servers", "=", "get_dns_servers", "(", "interface", ")", "# Return False if could not find the interface", "if", "servers", "is", "False", ":", "retur...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_dns_config
Get the type of DNS configuration (dhcp / static) CLI Example: .. code-block:: bash salt '*' win_dns_client.get_dns_config 'Local Area Connection'
salt/modules/win_dns_client.py
def get_dns_config(interface='Local Area Connection'): ''' Get the type of DNS configuration (dhcp / static) CLI Example: .. code-block:: bash salt '*' win_dns_client.get_dns_config 'Local Area Connection' ''' # remove any escape characters interface = interface.split('\\') in...
def get_dns_config(interface='Local Area Connection'): ''' Get the type of DNS configuration (dhcp / static) CLI Example: .. code-block:: bash salt '*' win_dns_client.get_dns_config 'Local Area Connection' ''' # remove any escape characters interface = interface.split('\\') in...
[ "Get", "the", "type", "of", "DNS", "configuration", "(", "dhcp", "/", "static", ")" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dns_client.py#L122-L140
[ "def", "get_dns_config", "(", "interface", "=", "'Local Area Connection'", ")", ":", "# remove any escape characters", "interface", "=", "interface", ".", "split", "(", "'\\\\'", ")", "interface", "=", "''", ".", "join", "(", "interface", ")", "with", "salt", "....
e8541fd6e744ab0df786c0f76102e41631f45d46
train
installed
Verify that the given package is installed and is at the correct version (if specified). .. code-block:: yaml underscore: bower.installed: - dir: /path/to/project - user: someuser jquery#2.0: bower.installed: - dir: /path/to/project ...
salt/states/bower.py
def installed(name, dir, pkgs=None, user=None, env=None): ''' Verify that the given package is installed and is at the correct version (if specified). .. code-block:: yaml underscore: bower.installed: - dir: /path/to...
def installed(name, dir, pkgs=None, user=None, env=None): ''' Verify that the given package is installed and is at the correct version (if specified). .. code-block:: yaml underscore: bower.installed: - dir: /path/to...
[ "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/bower.py#L49-L190
[ "def", "installed", "(", "name", ",", "dir", ",", "pkgs", "=", "None", ",", "user", "=", "None", ",", "env", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", ",", "'changes'...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
bootstrap
Bootstraps a frontend distribution. Will execute 'bower install' on the specified directory. user The user to run Bower with
salt/states/bower.py
def bootstrap(name, user=None): ''' Bootstraps a frontend distribution. Will execute 'bower install' on the specified directory. user The user to run Bower with ''' ret = {'name': name, 'result': None, 'comment': '', 'changes': {}} if __opts__['test']: ret['result'] = Non...
def bootstrap(name, user=None): ''' Bootstraps a frontend distribution. Will execute 'bower install' on the specified directory. user The user to run Bower with ''' ret = {'name': name, 'result': None, 'comment': '', 'changes': {}} if __opts__['test']: ret['result'] = Non...
[ "Bootstraps", "a", "frontend", "distribution", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bower.py#L239-L273
[ "def", "bootstrap", "(", "name", ",", "user", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", "}", "if", "__opts__", "[", "'test'", "]", ":...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
pruned
.. versionadded:: 2017.7.0 Cleans up local bower_components directory. Will execute 'bower prune' on the specified directory (param: name) user The user to run Bower with
salt/states/bower.py
def pruned(name, user=None, env=None): ''' .. versionadded:: 2017.7.0 Cleans up local bower_components directory. Will execute 'bower prune' on the specified directory (param: name) user The user to run Bower with ''' ret = {'name': name, 'result': None, 'comment': '', 'changes':...
def pruned(name, user=None, env=None): ''' .. versionadded:: 2017.7.0 Cleans up local bower_components directory. Will execute 'bower prune' on the specified directory (param: name) user The user to run Bower with ''' ret = {'name': name, 'result': None, 'comment': '', 'changes':...
[ "..", "versionadded", "::", "2017", ".", "7", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bower.py#L276-L310
[ "def", "pruned", "(", "name", ",", "user", "=", "None", ",", "env", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", "}", "if", "__opts__", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
present
Ensure that the named export is present with the given options name The export path to configure clients A list of hosts and the options applied to them. This option may not be used in combination with the 'hosts' or 'options' shortcuts. .. code-block:: yaml - cli...
salt/states/nfs_export.py
def present(name, clients=None, hosts=None, options=None, exports='/etc/exports'): ''' Ensure that the named export is present with the given options name The export path to configure clients A list of hosts and the options applied to the...
def present(name, clients=None, hosts=None, options=None, exports='/etc/exports'): ''' Ensure that the named export is present with the given options name The export path to configure clients A list of hosts and the options applied to the...
[ "Ensure", "that", "the", "named", "export", "is", "present", "with", "the", "given", "options" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/nfs_export.py#L79-L180
[ "def", "present", "(", "name", ",", "clients", "=", "None", ",", "hosts", "=", "None", ",", "options", "=", "None", ",", "exports", "=", "'/etc/exports'", ")", ":", "path", "=", "name", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
absent
Ensure that the named path is not exported name The export path to remove
salt/states/nfs_export.py
def absent(name, exports='/etc/exports'): ''' Ensure that the named path is not exported name The export path to remove ''' path = name ret = {'name': name, 'changes': {}, 'result': None, 'comment': ''} old = __salt__['nfs3.list_exports'](exports) ...
def absent(name, exports='/etc/exports'): ''' Ensure that the named path is not exported name The export path to remove ''' path = name ret = {'name': name, 'changes': {}, 'result': None, 'comment': ''} old = __salt__['nfs3.list_exports'](exports) ...
[ "Ensure", "that", "the", "named", "path", "is", "not", "exported" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/nfs_export.py#L183-L218
[ "def", "absent", "(", "name", ",", "exports", "=", "'/etc/exports'", ")", ":", "path", "=", "name", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", "}", "old", "=",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
query
Slack object method function to construct and execute on the API URL. :param api_key: The Slack api key. :param function: The Slack api function to perform. :param method: The HTTP method, e.g. GET or POST. :param data: The data to be sent for POST method. :return: The...
salt/utils/slack.py
def query(function, api_key=None, args=None, method='GET', header_dict=None, data=None, opts=None): ''' Slack object method function to construct and execute on the API URL. :param api_key: The Slack api key. :param function: The Slack ...
def query(function, api_key=None, args=None, method='GET', header_dict=None, data=None, opts=None): ''' Slack object method function to construct and execute on the API URL. :param api_key: The Slack api key. :param function: The Slack ...
[ "Slack", "object", "method", "function", "to", "construct", "and", "execute", "on", "the", "API", "URL", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/slack.py#L32-L131
[ "def", "query", "(", "function", ",", "api_key", "=", "None", ",", "args", "=", "None", ",", "method", "=", "'GET'", ",", "header_dict", "=", "None", ",", "data", "=", "None", ",", "opts", "=", "None", ")", ":", "ret", "=", "{", "'message'", ":", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
validate
Validate the beacon configuration
salt/beacons/pkg.py
def validate(config): ''' Validate the beacon configuration ''' # Configuration for pkg beacon should be a list if not isinstance(config, list): return False, ('Configuration for pkg beacon must be a list.') # Configuration for pkg beacon should contain pkgs pkgs_found = False p...
def validate(config): ''' Validate the beacon configuration ''' # Configuration for pkg beacon should be a list if not isinstance(config, list): return False, ('Configuration for pkg beacon must be a list.') # Configuration for pkg beacon should contain pkgs pkgs_found = False p...
[ "Validate", "the", "beacon", "configuration" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/pkg.py#L25-L44
[ "def", "validate", "(", "config", ")", ":", "# Configuration for pkg beacon should be a list", "if", "not", "isinstance", "(", "config", ",", "list", ")", ":", "return", "False", ",", "(", "'Configuration for pkg beacon must be a list.'", ")", "# Configuration for pkg bea...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
beacon
Check if installed packages are the latest versions and fire an event for those that have upgrades. .. code-block:: yaml beacons: pkg: - pkgs: - zsh - apache2 - refresh: True
salt/beacons/pkg.py
def beacon(config): ''' Check if installed packages are the latest versions and fire an event for those that have upgrades. .. code-block:: yaml beacons: pkg: - pkgs: - zsh - apache2 - refresh: True ''' ret = [] _re...
def beacon(config): ''' Check if installed packages are the latest versions and fire an event for those that have upgrades. .. code-block:: yaml beacons: pkg: - pkgs: - zsh - apache2 - refresh: True ''' ret = [] _re...
[ "Check", "if", "installed", "packages", "are", "the", "latest", "versions", "and", "fire", "an", "event", "for", "those", "that", "have", "upgrades", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/pkg.py#L47-L79
[ "def", "beacon", "(", "config", ")", ":", "ret", "=", "[", "]", "_refresh", "=", "False", "pkgs", "=", "[", "]", "for", "config_item", "in", "config", ":", "if", "'pkgs'", "in", "config_item", ":", "pkgs", "+=", "config_item", "[", "'pkgs'", "]", "if...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_
Set a new value for a specific configuration line. :param str key: The command or block to configure. :param str value: The command value or command of the block specified by the key parameter. :param str setting: The command value for the command specified by the value parameter. :param str conf_file:...
salt/states/logrotate.py
def set_(name, key, value, setting=None, conf_file=_DEFAULT_CONF): ''' Set a new value for a specific configuration line. :param str key: The command or block to configure. :param str value: The command value or command of the block specified by the key parameter. :param str setting: The command va...
def set_(name, key, value, setting=None, conf_file=_DEFAULT_CONF): ''' Set a new value for a specific configuration line. :param str key: The command or block to configure. :param str value: The command value or command of the block specified by the key parameter. :param str setting: The command va...
[ "Set", "a", "new", "value", "for", "a", "specific", "configuration", "line", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/logrotate.py#L51-L131
[ "def", "set_", "(", "name", ",", "key", ",", "value", ",", "setting", "=", "None", ",", "conf_file", "=", "_DEFAULT_CONF", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "dict", "(", ")", ",", "'comment'", ":", "six", ".",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_unlock_cache
Unlock a FS file/dir based lock
salt/fileserver/__init__.py
def _unlock_cache(w_lock): ''' Unlock a FS file/dir based lock ''' if not os.path.exists(w_lock): return try: if os.path.isdir(w_lock): os.rmdir(w_lock) elif os.path.isfile(w_lock): os.unlink(w_lock) except (OSError, IOError) as exc: log.tr...
def _unlock_cache(w_lock): ''' Unlock a FS file/dir based lock ''' if not os.path.exists(w_lock): return try: if os.path.isdir(w_lock): os.rmdir(w_lock) elif os.path.isfile(w_lock): os.unlink(w_lock) except (OSError, IOError) as exc: log.tr...
[ "Unlock", "a", "FS", "file", "/", "dir", "based", "lock" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L39-L51
[ "def", "_unlock_cache", "(", "w_lock", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "w_lock", ")", ":", "return", "try", ":", "if", "os", ".", "path", ".", "isdir", "(", "w_lock", ")", ":", "os", ".", "rmdir", "(", "w_lock", ")",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
wait_lock
If the write lock is there, check to see if the file is actually being written. If there is no change in the file size after a short sleep, remove the lock and move forward.
salt/fileserver/__init__.py
def wait_lock(lk_fn, dest, wait_timeout=0): ''' If the write lock is there, check to see if the file is actually being written. If there is no change in the file size after a short sleep, remove the lock and move forward. ''' if not os.path.exists(lk_fn): return False if not os.path....
def wait_lock(lk_fn, dest, wait_timeout=0): ''' If the write lock is there, check to see if the file is actually being written. If there is no change in the file size after a short sleep, remove the lock and move forward. ''' if not os.path.exists(lk_fn): return False if not os.path....
[ "If", "the", "write", "lock", "is", "there", "check", "to", "see", "if", "the", "file", "is", "actually", "being", "written", ".", "If", "there", "is", "no", "change", "in", "the", "file", "size", "after", "a", "short", "sleep", "remove", "the", "lock"...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L66-L109
[ "def", "wait_lock", "(", "lk_fn", ",", "dest", ",", "wait_timeout", "=", "0", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "lk_fn", ")", ":", "return", "False", "if", "not", "os", ".", "path", ".", "exists", "(", "dest", ")", ":"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
check_file_list_cache
Checks the cache file to see if there is a new enough file list cache, and returns the match (if found, along with booleans used by the fileserver backend to determine if the cache needs to be refreshed/written).
salt/fileserver/__init__.py
def check_file_list_cache(opts, form, list_cache, w_lock): ''' Checks the cache file to see if there is a new enough file list cache, and returns the match (if found, along with booleans used by the fileserver backend to determine if the cache needs to be refreshed/written). ''' refresh_cache = ...
def check_file_list_cache(opts, form, list_cache, w_lock): ''' Checks the cache file to see if there is a new enough file list cache, and returns the match (if found, along with booleans used by the fileserver backend to determine if the cache needs to be refreshed/written). ''' refresh_cache = ...
[ "Checks", "the", "cache", "file", "to", "see", "if", "there", "is", "a", "new", "enough", "file", "list", "cache", "and", "returns", "the", "match", "(", "if", "found", "along", "with", "booleans", "used", "by", "the", "fileserver", "backend", "to", "det...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L112-L173
[ "def", "check_file_list_cache", "(", "opts", ",", "form", ",", "list_cache", ",", "w_lock", ")", ":", "refresh_cache", "=", "False", "save_cache", "=", "True", "serial", "=", "salt", ".", "payload", ".", "Serial", "(", "opts", ")", "wait_lock", "(", "w_loc...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
write_file_list_cache
Checks the cache file to see if there is a new enough file list cache, and returns the match (if found, along with booleans used by the fileserver backend to determine if the cache needs to be refreshed/written).
salt/fileserver/__init__.py
def write_file_list_cache(opts, data, list_cache, w_lock): ''' Checks the cache file to see if there is a new enough file list cache, and returns the match (if found, along with booleans used by the fileserver backend to determine if the cache needs to be refreshed/written). ''' serial = salt.pa...
def write_file_list_cache(opts, data, list_cache, w_lock): ''' Checks the cache file to see if there is a new enough file list cache, and returns the match (if found, along with booleans used by the fileserver backend to determine if the cache needs to be refreshed/written). ''' serial = salt.pa...
[ "Checks", "the", "cache", "file", "to", "see", "if", "there", "is", "a", "new", "enough", "file", "list", "cache", "and", "returns", "the", "match", "(", "if", "found", "along", "with", "booleans", "used", "by", "the", "fileserver", "backend", "to", "det...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L176-L186
[ "def", "write_file_list_cache", "(", "opts", ",", "data", ",", "list_cache", ",", "w_lock", ")", ":", "serial", "=", "salt", ".", "payload", ".", "Serial", "(", "opts", ")", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "list_cache", "...
e8541fd6e744ab0df786c0f76102e41631f45d46