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 | apply_cloud_providers_config | Apply the loaded cloud providers configuration. | salt/config/__init__.py | def apply_cloud_providers_config(overrides, defaults=None):
'''
Apply the loaded cloud providers configuration.
'''
if defaults is None:
defaults = PROVIDER_CONFIG_DEFAULTS
config = defaults.copy()
if overrides:
config.update(overrides)
# Is the user still using the old for... | def apply_cloud_providers_config(overrides, defaults=None):
'''
Apply the loaded cloud providers configuration.
'''
if defaults is None:
defaults = PROVIDER_CONFIG_DEFAULTS
config = defaults.copy()
if overrides:
config.update(overrides)
# Is the user still using the old for... | [
"Apply",
"the",
"loaded",
"cloud",
"providers",
"configuration",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3084-L3287 | [
"def",
"apply_cloud_providers_config",
"(",
"overrides",
",",
"defaults",
"=",
"None",
")",
":",
"if",
"defaults",
"is",
"None",
":",
"defaults",
"=",
"PROVIDER_CONFIG_DEFAULTS",
"config",
"=",
"defaults",
".",
"copy",
"(",
")",
"if",
"overrides",
":",
"config... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_cloud_config_value | Search and return a setting in a known order:
1. In the virtual machine's configuration
2. In the virtual machine's profile configuration
3. In the virtual machine's provider configuration
4. In the salt cloud configuration if global searching is enabled
5. Return the provided d... | salt/config/__init__.py | def get_cloud_config_value(name, vm_, opts, default=None, search_global=True):
'''
Search and return a setting in a known order:
1. In the virtual machine's configuration
2. In the virtual machine's profile configuration
3. In the virtual machine's provider configuration
4. In t... | def get_cloud_config_value(name, vm_, opts, default=None, search_global=True):
'''
Search and return a setting in a known order:
1. In the virtual machine's configuration
2. In the virtual machine's profile configuration
3. In the virtual machine's provider configuration
4. In t... | [
"Search",
"and",
"return",
"a",
"setting",
"in",
"a",
"known",
"order",
":"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3290-L3364 | [
"def",
"get_cloud_config_value",
"(",
"name",
",",
"vm_",
",",
"opts",
",",
"default",
"=",
"None",
",",
"search_global",
"=",
"True",
")",
":",
"# As a last resort, return the default",
"value",
"=",
"default",
"if",
"search_global",
"is",
"True",
"and",
"opts"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | is_provider_configured | Check and return the first matching and fully configured cloud provider
configuration. | salt/config/__init__.py | def is_provider_configured(opts, provider, required_keys=(), log_message=True, aliases=()):
'''
Check and return the first matching and fully configured cloud provider
configuration.
'''
if ':' in provider:
alias, driver = provider.split(':')
if alias not in opts['providers']:
... | def is_provider_configured(opts, provider, required_keys=(), log_message=True, aliases=()):
'''
Check and return the first matching and fully configured cloud provider
configuration.
'''
if ':' in provider:
alias, driver = provider.split(':')
if alias not in opts['providers']:
... | [
"Check",
"and",
"return",
"the",
"first",
"matching",
"and",
"fully",
"configured",
"cloud",
"provider",
"configuration",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3367-L3421 | [
"def",
"is_provider_configured",
"(",
"opts",
",",
"provider",
",",
"required_keys",
"=",
"(",
")",
",",
"log_message",
"=",
"True",
",",
"aliases",
"=",
"(",
")",
")",
":",
"if",
"':'",
"in",
"provider",
":",
"alias",
",",
"driver",
"=",
"provider",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | is_profile_configured | Check if the requested profile contains the minimum required parameters for
a profile.
Required parameters include image and provider for all drivers, while some
drivers also require size keys.
.. versionadded:: 2015.8.0 | salt/config/__init__.py | def is_profile_configured(opts, provider, profile_name, vm_=None):
'''
Check if the requested profile contains the minimum required parameters for
a profile.
Required parameters include image and provider for all drivers, while some
drivers also require size keys.
.. versionadded:: 2015.8.0
... | def is_profile_configured(opts, provider, profile_name, vm_=None):
'''
Check if the requested profile contains the minimum required parameters for
a profile.
Required parameters include image and provider for all drivers, while some
drivers also require size keys.
.. versionadded:: 2015.8.0
... | [
"Check",
"if",
"the",
"requested",
"profile",
"contains",
"the",
"minimum",
"required",
"parameters",
"for",
"a",
"profile",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3424-L3499 | [
"def",
"is_profile_configured",
"(",
"opts",
",",
"provider",
",",
"profile_name",
",",
"vm_",
"=",
"None",
")",
":",
"# Standard dict keys required by all drivers.",
"required_keys",
"=",
"[",
"'provider'",
"]",
"alias",
",",
"driver",
"=",
"provider",
".",
"spli... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | check_driver_dependencies | Check if the driver's dependencies are available.
.. versionadded:: 2015.8.0
driver
The name of the driver.
dependencies
The dictionary of dependencies to check. | salt/config/__init__.py | def check_driver_dependencies(driver, dependencies):
'''
Check if the driver's dependencies are available.
.. versionadded:: 2015.8.0
driver
The name of the driver.
dependencies
The dictionary of dependencies to check.
'''
ret = True
for key, value in six.iteritems(dep... | def check_driver_dependencies(driver, dependencies):
'''
Check if the driver's dependencies are available.
.. versionadded:: 2015.8.0
driver
The name of the driver.
dependencies
The dictionary of dependencies to check.
'''
ret = True
for key, value in six.iteritems(dep... | [
"Check",
"if",
"the",
"driver",
"s",
"dependencies",
"are",
"available",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3502-L3523 | [
"def",
"check_driver_dependencies",
"(",
"driver",
",",
"dependencies",
")",
":",
"ret",
"=",
"True",
"for",
"key",
",",
"value",
"in",
"six",
".",
"iteritems",
"(",
"dependencies",
")",
":",
"if",
"value",
"is",
"False",
":",
"log",
".",
"warning",
"(",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _cache_id | Helper function, writes minion id to a cache file. | salt/config/__init__.py | def _cache_id(minion_id, cache_file):
'''
Helper function, writes minion id to a cache file.
'''
path = os.path.dirname(cache_file)
try:
if not os.path.isdir(path):
os.makedirs(path)
except OSError as exc:
# Handle race condition where dir is created after os.path.isd... | def _cache_id(minion_id, cache_file):
'''
Helper function, writes minion id to a cache file.
'''
path = os.path.dirname(cache_file)
try:
if not os.path.isdir(path):
os.makedirs(path)
except OSError as exc:
# Handle race condition where dir is created after os.path.isd... | [
"Helper",
"function",
"writes",
"minion",
"id",
"to",
"a",
"cache",
"file",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3528-L3547 | [
"def",
"_cache_id",
"(",
"minion_id",
",",
"cache_file",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"cache_file",
")",
"try",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"os",
".",
"makedirs",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | call_id_function | Evaluate the function that determines the ID if the 'id_function'
option is set and return the result | salt/config/__init__.py | def call_id_function(opts):
'''
Evaluate the function that determines the ID if the 'id_function'
option is set and return the result
'''
if opts.get('id'):
return opts['id']
# Import 'salt.loader' here to avoid a circular dependency
import salt.loader as loader
if isinstance(o... | def call_id_function(opts):
'''
Evaluate the function that determines the ID if the 'id_function'
option is set and return the result
'''
if opts.get('id'):
return opts['id']
# Import 'salt.loader' here to avoid a circular dependency
import salt.loader as loader
if isinstance(o... | [
"Evaluate",
"the",
"function",
"that",
"determines",
"the",
"ID",
"if",
"the",
"id_function",
"option",
"is",
"set",
"and",
"return",
"the",
"result"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3550-L3600 | [
"def",
"call_id_function",
"(",
"opts",
")",
":",
"if",
"opts",
".",
"get",
"(",
"'id'",
")",
":",
"return",
"opts",
"[",
"'id'",
"]",
"# Import 'salt.loader' here to avoid a circular dependency",
"import",
"salt",
".",
"loader",
"as",
"loader",
"if",
"isinstanc... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove_domain_from_fqdn | Depending on the values of `minion_id_remove_domain`,
remove all domains or a single domain from a FQDN, effectivly generating a hostname. | salt/config/__init__.py | def remove_domain_from_fqdn(opts, newid):
'''
Depending on the values of `minion_id_remove_domain`,
remove all domains or a single domain from a FQDN, effectivly generating a hostname.
'''
opt_domain = opts.get('minion_id_remove_domain')
if opt_domain is True:
if '.' in newid:
... | def remove_domain_from_fqdn(opts, newid):
'''
Depending on the values of `minion_id_remove_domain`,
remove all domains or a single domain from a FQDN, effectivly generating a hostname.
'''
opt_domain = opts.get('minion_id_remove_domain')
if opt_domain is True:
if '.' in newid:
... | [
"Depending",
"on",
"the",
"values",
"of",
"minion_id_remove_domain",
"remove",
"all",
"domains",
"or",
"a",
"single",
"domain",
"from",
"a",
"FQDN",
"effectivly",
"generating",
"a",
"hostname",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3603-L3620 | [
"def",
"remove_domain_from_fqdn",
"(",
"opts",
",",
"newid",
")",
":",
"opt_domain",
"=",
"opts",
".",
"get",
"(",
"'minion_id_remove_domain'",
")",
"if",
"opt_domain",
"is",
"True",
":",
"if",
"'.'",
"in",
"newid",
":",
"# Remove any domain",
"newid",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_id | Guess the id of the minion.
If CONFIG_DIR/minion_id exists, use the cached minion ID from that file.
If no minion id is configured, use multiple sources to find a FQDN.
If no FQDN is found you may get an ip address.
Returns two values: the detected ID, and a boolean value noting whether or
not an ... | salt/config/__init__.py | def get_id(opts, cache_minion_id=False):
'''
Guess the id of the minion.
If CONFIG_DIR/minion_id exists, use the cached minion ID from that file.
If no minion id is configured, use multiple sources to find a FQDN.
If no FQDN is found you may get an ip address.
Returns two values: the detected ... | def get_id(opts, cache_minion_id=False):
'''
Guess the id of the minion.
If CONFIG_DIR/minion_id exists, use the cached minion ID from that file.
If no minion id is configured, use multiple sources to find a FQDN.
If no FQDN is found you may get an ip address.
Returns two values: the detected ... | [
"Guess",
"the",
"id",
"of",
"the",
"minion",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3623-L3690 | [
"def",
"get_id",
"(",
"opts",
",",
"cache_minion_id",
"=",
"False",
")",
":",
"if",
"opts",
"[",
"'root_dir'",
"]",
"is",
"None",
":",
"root_dir",
"=",
"salt",
".",
"syspaths",
".",
"ROOT_DIR",
"else",
":",
"root_dir",
"=",
"opts",
"[",
"'root_dir'",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _update_ssl_config | Resolves string names to integer constant in ssl configuration. | salt/config/__init__.py | def _update_ssl_config(opts):
'''
Resolves string names to integer constant in ssl configuration.
'''
if opts['ssl'] in (None, False):
opts['ssl'] = None
return
if opts['ssl'] is True:
opts['ssl'] = {}
return
import ssl
for key, prefix in (('cert_reqs', 'CERT_... | def _update_ssl_config(opts):
'''
Resolves string names to integer constant in ssl configuration.
'''
if opts['ssl'] in (None, False):
opts['ssl'] = None
return
if opts['ssl'] is True:
opts['ssl'] = {}
return
import ssl
for key, prefix in (('cert_reqs', 'CERT_... | [
"Resolves",
"string",
"names",
"to",
"integer",
"constant",
"in",
"ssl",
"configuration",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3693-L3714 | [
"def",
"_update_ssl_config",
"(",
"opts",
")",
":",
"if",
"opts",
"[",
"'ssl'",
"]",
"in",
"(",
"None",
",",
"False",
")",
":",
"opts",
"[",
"'ssl'",
"]",
"=",
"None",
"return",
"if",
"opts",
"[",
"'ssl'",
"]",
"is",
"True",
":",
"opts",
"[",
"'s... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _adjust_log_file_override | Adjusts the log_file based on the log_dir override | salt/config/__init__.py | def _adjust_log_file_override(overrides, default_log_file):
'''
Adjusts the log_file based on the log_dir override
'''
if overrides.get('log_dir'):
# Adjust log_file if a log_dir override is introduced
if overrides.get('log_file'):
if not os.path.isabs(overrides['log_file']):... | def _adjust_log_file_override(overrides, default_log_file):
'''
Adjusts the log_file based on the log_dir override
'''
if overrides.get('log_dir'):
# Adjust log_file if a log_dir override is introduced
if overrides.get('log_file'):
if not os.path.isabs(overrides['log_file']):... | [
"Adjusts",
"the",
"log_file",
"based",
"on",
"the",
"log_dir",
"override"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3717-L3732 | [
"def",
"_adjust_log_file_override",
"(",
"overrides",
",",
"default_log_file",
")",
":",
"if",
"overrides",
".",
"get",
"(",
"'log_dir'",
")",
":",
"# Adjust log_file if a log_dir override is introduced",
"if",
"overrides",
".",
"get",
"(",
"'log_file'",
")",
":",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | apply_minion_config | Returns minion configurations dict. | salt/config/__init__.py | def apply_minion_config(overrides=None,
defaults=None,
cache_minion_id=False,
minion_id=None):
'''
Returns minion configurations dict.
'''
if defaults is None:
defaults = DEFAULT_MINION_OPTS.copy()
if overrides is None:
... | def apply_minion_config(overrides=None,
defaults=None,
cache_minion_id=False,
minion_id=None):
'''
Returns minion configurations dict.
'''
if defaults is None:
defaults = DEFAULT_MINION_OPTS.copy()
if overrides is None:
... | [
"Returns",
"minion",
"configurations",
"dict",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3735-L3864 | [
"def",
"apply_minion_config",
"(",
"overrides",
"=",
"None",
",",
"defaults",
"=",
"None",
",",
"cache_minion_id",
"=",
"False",
",",
"minion_id",
"=",
"None",
")",
":",
"if",
"defaults",
"is",
"None",
":",
"defaults",
"=",
"DEFAULT_MINION_OPTS",
".",
"copy"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _update_discovery_config | Update discovery config for all instances.
:param opts:
:return: | salt/config/__init__.py | def _update_discovery_config(opts):
'''
Update discovery config for all instances.
:param opts:
:return:
'''
if opts.get('discovery') not in (None, False):
if opts['discovery'] is True:
opts['discovery'] = {}
discovery_config = {'attempts': 3, 'pause': 5, 'port': 452... | def _update_discovery_config(opts):
'''
Update discovery config for all instances.
:param opts:
:return:
'''
if opts.get('discovery') not in (None, False):
if opts['discovery'] is True:
opts['discovery'] = {}
discovery_config = {'attempts': 3, 'pause': 5, 'port': 452... | [
"Update",
"discovery",
"config",
"for",
"all",
"instances",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3867-L3884 | [
"def",
"_update_discovery_config",
"(",
"opts",
")",
":",
"if",
"opts",
".",
"get",
"(",
"'discovery'",
")",
"not",
"in",
"(",
"None",
",",
"False",
")",
":",
"if",
"opts",
"[",
"'discovery'",
"]",
"is",
"True",
":",
"opts",
"[",
"'discovery'",
"]",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | master_config | Reads in the master configuration file and sets up default options
This is useful for running the actual master daemon. For running
Master-side client interfaces that need the master opts see
:py:func:`salt.client.client_config`. | salt/config/__init__.py | def master_config(path, env_var='SALT_MASTER_CONFIG', defaults=None, exit_on_config_errors=False):
'''
Reads in the master configuration file and sets up default options
This is useful for running the actual master daemon. For running
Master-side client interfaces that need the master opts see
:py:... | def master_config(path, env_var='SALT_MASTER_CONFIG', defaults=None, exit_on_config_errors=False):
'''
Reads in the master configuration file and sets up default options
This is useful for running the actual master daemon. For running
Master-side client interfaces that need the master opts see
:py:... | [
"Reads",
"in",
"the",
"master",
"configuration",
"file",
"and",
"sets",
"up",
"default",
"options"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3887-L3930 | [
"def",
"master_config",
"(",
"path",
",",
"env_var",
"=",
"'SALT_MASTER_CONFIG'",
",",
"defaults",
"=",
"None",
",",
"exit_on_config_errors",
"=",
"False",
")",
":",
"if",
"defaults",
"is",
"None",
":",
"defaults",
"=",
"DEFAULT_MASTER_OPTS",
".",
"copy",
"(",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | apply_master_config | Returns master configurations dict. | salt/config/__init__.py | def apply_master_config(overrides=None, defaults=None):
'''
Returns master configurations dict.
'''
if defaults is None:
defaults = DEFAULT_MASTER_OPTS.copy()
if overrides is None:
overrides = {}
opts = defaults.copy()
opts['__role'] = 'master'
_adjust_log_file_override(... | def apply_master_config(overrides=None, defaults=None):
'''
Returns master configurations dict.
'''
if defaults is None:
defaults = DEFAULT_MASTER_OPTS.copy()
if overrides is None:
overrides = {}
opts = defaults.copy()
opts['__role'] = 'master'
_adjust_log_file_override(... | [
"Returns",
"master",
"configurations",
"dict",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3933-L4089 | [
"def",
"apply_master_config",
"(",
"overrides",
"=",
"None",
",",
"defaults",
"=",
"None",
")",
":",
"if",
"defaults",
"is",
"None",
":",
"defaults",
"=",
"DEFAULT_MASTER_OPTS",
".",
"copy",
"(",
")",
"if",
"overrides",
"is",
"None",
":",
"overrides",
"=",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | client_config | Load Master configuration data
Usage:
.. code-block:: python
import salt.config
master_opts = salt.config.client_config('/etc/salt/master')
Returns a dictionary of the Salt Master configuration file with necessary
options needed to communicate with a locally-running Salt Master daemo... | salt/config/__init__.py | def client_config(path, env_var='SALT_CLIENT_CONFIG', defaults=None):
'''
Load Master configuration data
Usage:
.. code-block:: python
import salt.config
master_opts = salt.config.client_config('/etc/salt/master')
Returns a dictionary of the Salt Master configuration file with ne... | def client_config(path, env_var='SALT_CLIENT_CONFIG', defaults=None):
'''
Load Master configuration data
Usage:
.. code-block:: python
import salt.config
master_opts = salt.config.client_config('/etc/salt/master')
Returns a dictionary of the Salt Master configuration file with ne... | [
"Load",
"Master",
"configuration",
"data"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L4092-L4171 | [
"def",
"client_config",
"(",
"path",
",",
"env_var",
"=",
"'SALT_CLIENT_CONFIG'",
",",
"defaults",
"=",
"None",
")",
":",
"if",
"defaults",
"is",
"None",
":",
"defaults",
"=",
"DEFAULT_MASTER_OPTS",
".",
"copy",
"(",
")",
"xdg_dir",
"=",
"salt",
".",
"util... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | api_config | Read in the Salt Master config file and add additional configs that
need to be stubbed out for salt-api | salt/config/__init__.py | def api_config(path):
'''
Read in the Salt Master config file and add additional configs that
need to be stubbed out for salt-api
'''
# Let's grab a copy of salt-api's required defaults
opts = DEFAULT_API_OPTS.copy()
# Let's override them with salt's master opts
opts.update(client_confi... | def api_config(path):
'''
Read in the Salt Master config file and add additional configs that
need to be stubbed out for salt-api
'''
# Let's grab a copy of salt-api's required defaults
opts = DEFAULT_API_OPTS.copy()
# Let's override them with salt's master opts
opts.update(client_confi... | [
"Read",
"in",
"the",
"Salt",
"Master",
"config",
"file",
"and",
"add",
"additional",
"configs",
"that",
"need",
"to",
"be",
"stubbed",
"out",
"for",
"salt",
"-",
"api"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L4174-L4197 | [
"def",
"api_config",
"(",
"path",
")",
":",
"# Let's grab a copy of salt-api's required defaults",
"opts",
"=",
"DEFAULT_API_OPTS",
".",
"copy",
"(",
")",
"# Let's override them with salt's master opts",
"opts",
".",
"update",
"(",
"client_config",
"(",
"path",
",",
"de... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | spm_config | Read in the salt master config file and add additional configs that
need to be stubbed out for spm
.. versionadded:: 2015.8.0 | salt/config/__init__.py | def spm_config(path):
'''
Read in the salt master config file and add additional configs that
need to be stubbed out for spm
.. versionadded:: 2015.8.0
'''
# Let's grab a copy of salt's master default opts
defaults = DEFAULT_MASTER_OPTS.copy()
# Let's override them with spm's required d... | def spm_config(path):
'''
Read in the salt master config file and add additional configs that
need to be stubbed out for spm
.. versionadded:: 2015.8.0
'''
# Let's grab a copy of salt's master default opts
defaults = DEFAULT_MASTER_OPTS.copy()
# Let's override them with spm's required d... | [
"Read",
"in",
"the",
"salt",
"master",
"config",
"file",
"and",
"add",
"additional",
"configs",
"that",
"need",
"to",
"be",
"stubbed",
"out",
"for",
"spm"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L4200-L4221 | [
"def",
"spm_config",
"(",
"path",
")",
":",
"# Let's grab a copy of salt's master default opts",
"defaults",
"=",
"DEFAULT_MASTER_OPTS",
".",
"copy",
"(",
")",
"# Let's override them with spm's required defaults",
"defaults",
".",
"update",
"(",
"DEFAULT_SPM_OPTS",
")",
"ov... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | apply_spm_config | Returns the spm configurations dict.
.. versionadded:: 2015.8.1 | salt/config/__init__.py | def apply_spm_config(overrides, defaults):
'''
Returns the spm configurations dict.
.. versionadded:: 2015.8.1
'''
opts = defaults.copy()
_adjust_log_file_override(overrides, defaults['log_file'])
if overrides:
opts.update(overrides)
# Prepend root_dir to other paths
prepen... | def apply_spm_config(overrides, defaults):
'''
Returns the spm configurations dict.
.. versionadded:: 2015.8.1
'''
opts = defaults.copy()
_adjust_log_file_override(overrides, defaults['log_file'])
if overrides:
opts.update(overrides)
# Prepend root_dir to other paths
prepen... | [
"Returns",
"the",
"spm",
"configurations",
"dict",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L4224-L4251 | [
"def",
"apply_spm_config",
"(",
"overrides",
",",
"defaults",
")",
":",
"opts",
"=",
"defaults",
".",
"copy",
"(",
")",
"_adjust_log_file_override",
"(",
"overrides",
",",
"defaults",
"[",
"'log_file'",
"]",
")",
"if",
"overrides",
":",
"opts",
".",
"update"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _render_template | Render config template, substituting grains where found. | salt/pillar/pillar_ldap.py | def _render_template(config_file):
'''
Render config template, substituting grains where found.
'''
dirname, filename = os.path.split(config_file)
env = jinja2.Environment(loader=jinja2.FileSystemLoader(dirname))
template = env.get_template(filename)
return template.render(__grains__) | def _render_template(config_file):
'''
Render config template, substituting grains where found.
'''
dirname, filename = os.path.split(config_file)
env = jinja2.Environment(loader=jinja2.FileSystemLoader(dirname))
template = env.get_template(filename)
return template.render(__grains__) | [
"Render",
"config",
"template",
"substituting",
"grains",
"where",
"found",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/pillar_ldap.py#L156-L163 | [
"def",
"_render_template",
"(",
"config_file",
")",
":",
"dirname",
",",
"filename",
"=",
"os",
".",
"path",
".",
"split",
"(",
"config_file",
")",
"env",
"=",
"jinja2",
".",
"Environment",
"(",
"loader",
"=",
"jinja2",
".",
"FileSystemLoader",
"(",
"dirna... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _config | Return a value for 'name' from the config file options. If the 'name' is
not in the config, the 'default' value is returned. This method converts
unicode values to str type under python 2. | salt/pillar/pillar_ldap.py | def _config(name, conf, default=None):
'''
Return a value for 'name' from the config file options. If the 'name' is
not in the config, the 'default' value is returned. This method converts
unicode values to str type under python 2.
'''
try:
value = conf[name]
except KeyError:
... | def _config(name, conf, default=None):
'''
Return a value for 'name' from the config file options. If the 'name' is
not in the config, the 'default' value is returned. This method converts
unicode values to str type under python 2.
'''
try:
value = conf[name]
except KeyError:
... | [
"Return",
"a",
"value",
"for",
"name",
"from",
"the",
"config",
"file",
"options",
".",
"If",
"the",
"name",
"is",
"not",
"in",
"the",
"config",
"the",
"default",
"value",
"is",
"returned",
".",
"This",
"method",
"converts",
"unicode",
"values",
"to",
"s... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/pillar_ldap.py#L166-L176 | [
"def",
"_config",
"(",
"name",
",",
"conf",
",",
"default",
"=",
"None",
")",
":",
"try",
":",
"value",
"=",
"conf",
"[",
"name",
"]",
"except",
"KeyError",
":",
"value",
"=",
"default",
"return",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _result_to_dict | Aggregates LDAP search result based on rules, returns a dictionary.
Rules:
Attributes tagged in the pillar config as 'attrs' or 'lists' are
scanned for a 'key=value' format (non matching entries are ignored.
Entries matching the 'attrs' tag overwrite previous values where
the key matches a previou... | salt/pillar/pillar_ldap.py | def _result_to_dict(data, result, conf, source):
'''
Aggregates LDAP search result based on rules, returns a dictionary.
Rules:
Attributes tagged in the pillar config as 'attrs' or 'lists' are
scanned for a 'key=value' format (non matching entries are ignored.
Entries matching the 'attrs' tag ... | def _result_to_dict(data, result, conf, source):
'''
Aggregates LDAP search result based on rules, returns a dictionary.
Rules:
Attributes tagged in the pillar config as 'attrs' or 'lists' are
scanned for a 'key=value' format (non matching entries are ignored.
Entries matching the 'attrs' tag ... | [
"Aggregates",
"LDAP",
"search",
"result",
"based",
"on",
"rules",
"returns",
"a",
"dictionary",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/pillar_ldap.py#L179-L267 | [
"def",
"_result_to_dict",
"(",
"data",
",",
"result",
",",
"conf",
",",
"source",
")",
":",
"attrs",
"=",
"_config",
"(",
"'attrs'",
",",
"conf",
")",
"or",
"[",
"]",
"lists",
"=",
"_config",
"(",
"'lists'",
",",
"conf",
")",
"or",
"[",
"]",
"dict_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _do_search | Builds connection and search arguments, performs the LDAP search and
formats the results as a dictionary appropriate for pillar use. | salt/pillar/pillar_ldap.py | def _do_search(conf):
'''
Builds connection and search arguments, performs the LDAP search and
formats the results as a dictionary appropriate for pillar use.
'''
# Build LDAP connection args
connargs = {}
for name in ['server', 'port', 'tls', 'binddn', 'bindpw', 'anonymous']:
connar... | def _do_search(conf):
'''
Builds connection and search arguments, performs the LDAP search and
formats the results as a dictionary appropriate for pillar use.
'''
# Build LDAP connection args
connargs = {}
for name in ['server', 'port', 'tls', 'binddn', 'bindpw', 'anonymous']:
connar... | [
"Builds",
"connection",
"and",
"search",
"arguments",
"performs",
"the",
"LDAP",
"search",
"and",
"formats",
"the",
"results",
"as",
"a",
"dictionary",
"appropriate",
"for",
"pillar",
"use",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/pillar_ldap.py#L270-L306 | [
"def",
"_do_search",
"(",
"conf",
")",
":",
"# Build LDAP connection args",
"connargs",
"=",
"{",
"}",
"for",
"name",
"in",
"[",
"'server'",
",",
"'port'",
",",
"'tls'",
",",
"'binddn'",
",",
"'bindpw'",
",",
"'anonymous'",
"]",
":",
"connargs",
"[",
"name... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ext_pillar | Execute LDAP searches and return the aggregated data | salt/pillar/pillar_ldap.py | def ext_pillar(minion_id, # pylint: disable=W0613
pillar, # pylint: disable=W0613
config_file):
'''
Execute LDAP searches and return the aggregated data
'''
config_template = None
try:
config_template = _render_template(config_file)
except jinja2.exception... | def ext_pillar(minion_id, # pylint: disable=W0613
pillar, # pylint: disable=W0613
config_file):
'''
Execute LDAP searches and return the aggregated data
'''
config_template = None
try:
config_template = _render_template(config_file)
except jinja2.exception... | [
"Execute",
"LDAP",
"searches",
"and",
"return",
"the",
"aggregated",
"data"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/pillar_ldap.py#L309-L365 | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"# pylint: disable=W0613",
"pillar",
",",
"# pylint: disable=W0613",
"config_file",
")",
":",
"config_template",
"=",
"None",
"try",
":",
"config_template",
"=",
"_render_template",
"(",
"config_file",
")",
"except",
"jinja2... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | import_cert | Import the certificate file into the given certificate store.
:param str name: The path of the certificate file to import.
:param str cert_format: The certificate format. Specify 'cer' for X.509, or 'pfx' for PKCS #12.
:param str context: The name of the certificate store location context.
:param str s... | salt/states/win_pki.py | def import_cert(name, cert_format=_DEFAULT_FORMAT, context=_DEFAULT_CONTEXT, store=_DEFAULT_STORE,
exportable=True, password='', saltenv='base'):
'''
Import the certificate file into the given certificate store.
:param str name: The path of the certificate file to import.
:param str cer... | def import_cert(name, cert_format=_DEFAULT_FORMAT, context=_DEFAULT_CONTEXT, store=_DEFAULT_STORE,
exportable=True, password='', saltenv='base'):
'''
Import the certificate file into the given certificate store.
:param str name: The path of the certificate file to import.
:param str cer... | [
"Import",
"the",
"certificate",
"file",
"into",
"the",
"given",
"certificate",
"store",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_pki.py#L30-L101 | [
"def",
"import_cert",
"(",
"name",
",",
"cert_format",
"=",
"_DEFAULT_FORMAT",
",",
"context",
"=",
"_DEFAULT_CONTEXT",
",",
"store",
"=",
"_DEFAULT_STORE",
",",
"exportable",
"=",
"True",
",",
"password",
"=",
"''",
",",
"saltenv",
"=",
"'base'",
")",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove_cert | Remove the certificate from the given certificate store.
:param str thumbprint: The thumbprint value of the target certificate.
:param str context: The name of the certificate store location context.
:param str store: The name of the certificate store.
Example of usage with only the required arguments... | salt/states/win_pki.py | def remove_cert(name, thumbprint, context=_DEFAULT_CONTEXT, store=_DEFAULT_STORE):
'''
Remove the certificate from the given certificate store.
:param str thumbprint: The thumbprint value of the target certificate.
:param str context: The name of the certificate store location context.
:param str s... | def remove_cert(name, thumbprint, context=_DEFAULT_CONTEXT, store=_DEFAULT_STORE):
'''
Remove the certificate from the given certificate store.
:param str thumbprint: The thumbprint value of the target certificate.
:param str context: The name of the certificate store location context.
:param str s... | [
"Remove",
"the",
"certificate",
"from",
"the",
"given",
"certificate",
"store",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_pki.py#L104-L157 | [
"def",
"remove_cert",
"(",
"name",
",",
"thumbprint",
",",
"context",
"=",
"_DEFAULT_CONTEXT",
",",
"store",
"=",
"_DEFAULT_STORE",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"dict",
"(",
")",
",",
"'comment'",
":",
"six",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_ | Set a key/value pair in the etcd service | salt/sdb/etcd_db.py | def set_(key, value, service=None, profile=None): # pylint: disable=W0613
'''
Set a key/value pair in the etcd service
'''
client = _get_conn(profile)
client.set(key, value)
return get(key, service, profile) | def set_(key, value, service=None, profile=None): # pylint: disable=W0613
'''
Set a key/value pair in the etcd service
'''
client = _get_conn(profile)
client.set(key, value)
return get(key, service, profile) | [
"Set",
"a",
"key",
"/",
"value",
"pair",
"in",
"the",
"etcd",
"service"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/etcd_db.py#L63-L69 | [
"def",
"set_",
"(",
"key",
",",
"value",
",",
"service",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"# pylint: disable=W0613",
"client",
"=",
"_get_conn",
"(",
"profile",
")",
"client",
".",
"set",
"(",
"key",
",",
"value",
")",
"return",
"get... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get | Get a value from the etcd service | salt/sdb/etcd_db.py | def get(key, service=None, profile=None): # pylint: disable=W0613
'''
Get a value from the etcd service
'''
client = _get_conn(profile)
result = client.get(key)
return result.value | def get(key, service=None, profile=None): # pylint: disable=W0613
'''
Get a value from the etcd service
'''
client = _get_conn(profile)
result = client.get(key)
return result.value | [
"Get",
"a",
"value",
"from",
"the",
"etcd",
"service"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/etcd_db.py#L72-L78 | [
"def",
"get",
"(",
"key",
",",
"service",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"# pylint: disable=W0613",
"client",
"=",
"_get_conn",
"(",
"profile",
")",
"result",
"=",
"client",
".",
"get",
"(",
"key",
")",
"return",
"result",
".",
"va... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete | Get a value from the etcd service | salt/sdb/etcd_db.py | def delete(key, service=None, profile=None): # pylint: disable=W0613
'''
Get a value from the etcd service
'''
client = _get_conn(profile)
try:
client.delete(key)
return True
except Exception:
return False | def delete(key, service=None, profile=None): # pylint: disable=W0613
'''
Get a value from the etcd service
'''
client = _get_conn(profile)
try:
client.delete(key)
return True
except Exception:
return False | [
"Get",
"a",
"value",
"from",
"the",
"etcd",
"service"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/etcd_db.py#L81-L90 | [
"def",
"delete",
"(",
"key",
",",
"service",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"# pylint: disable=W0613",
"client",
"=",
"_get_conn",
"(",
"profile",
")",
"try",
":",
"client",
".",
"delete",
"(",
"key",
")",
"return",
"True",
"except",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | chain_present | .. versionadded:: 2014.7.0
Verify the chain is exist.
name
A user-defined chain name.
table
The table to own the chain.
family
Networking family, either ipv4 or ipv6 | salt/states/nftables.py | def chain_present(name, table='filter', table_type=None, hook=None, priority=None, family='ipv4'):
'''
.. versionadded:: 2014.7.0
Verify the chain is exist.
name
A user-defined chain name.
table
The table to own the chain.
family
Networking family, either ipv4 or ipv6... | def chain_present(name, table='filter', table_type=None, hook=None, priority=None, family='ipv4'):
'''
.. versionadded:: 2014.7.0
Verify the chain is exist.
name
A user-defined chain name.
table
The table to own the chain.
family
Networking family, either ipv4 or ipv6... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/nftables.py#L129-L180 | [
"def",
"chain_present",
"(",
"name",
",",
"table",
"=",
"'filter'",
",",
"table_type",
"=",
"None",
",",
"hook",
"=",
"None",
",",
"priority",
"=",
"None",
",",
"family",
"=",
"'ipv4'",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | chain_absent | .. versionadded:: 2014.7.0
Verify the chain is absent.
family
Networking family, either ipv4 or ipv6 | salt/states/nftables.py | def chain_absent(name, table='filter', family='ipv4'):
'''
.. versionadded:: 2014.7.0
Verify the chain is absent.
family
Networking family, either ipv4 or ipv6
'''
ret = {'name': name,
'changes': {},
'result': None,
'comment': ''}
chain_check = __... | def chain_absent(name, table='filter', family='ipv4'):
'''
.. versionadded:: 2014.7.0
Verify the chain is absent.
family
Networking family, either ipv4 or ipv6
'''
ret = {'name': name,
'changes': {},
'result': None,
'comment': ''}
chain_check = __... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/nftables.py#L183-L225 | [
"def",
"chain_absent",
"(",
"name",
",",
"table",
"=",
"'filter'",
",",
"family",
"=",
"'ipv4'",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"cha... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | append | .. versionadded:: 0.17.0
Append a rule to a chain
name
A user-defined name to call this rule by in another part of a state or
formula. This should not be an actual rule.
family
Network family, ipv4 or ipv6.
All other arguments are passed in with the same name as the long opti... | salt/states/nftables.py | def append(name, family='ipv4', **kwargs):
'''
.. versionadded:: 0.17.0
Append a rule to a chain
name
A user-defined name to call this rule by in another part of a state or
formula. This should not be an actual rule.
family
Network family, ipv4 or ipv6.
All other argu... | def append(name, family='ipv4', **kwargs):
'''
.. versionadded:: 0.17.0
Append a rule to a chain
name
A user-defined name to call this rule by in another part of a state or
formula. This should not be an actual rule.
family
Network family, ipv4 or ipv6.
All other argu... | [
"..",
"versionadded",
"::",
"0",
".",
"17",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/nftables.py#L228-L305 | [
"def",
"append",
"(",
"name",
",",
"family",
"=",
"'ipv4'",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"for",
"ignore... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | flush | .. versionadded:: 2014.7.0
Flush current nftables state
family
Networking family, either ipv4 or ipv6 | salt/states/nftables.py | def flush(name, family='ipv4', **kwargs):
'''
.. versionadded:: 2014.7.0
Flush current nftables state
family
Networking family, either ipv4 or ipv6
'''
ret = {'name': name,
'changes': {},
'result': None,
'comment': ''}
for ignore in _STATE_INTERNA... | def flush(name, family='ipv4', **kwargs):
'''
.. versionadded:: 2014.7.0
Flush current nftables state
family
Networking family, either ipv4 or ipv6
'''
ret = {'name': name,
'changes': {},
'result': None,
'comment': ''}
for ignore in _STATE_INTERNA... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/nftables.py#L480-L541 | [
"def",
"flush",
"(",
"name",
",",
"family",
"=",
"'ipv4'",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"for",
"ignore"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __execute_cmd | Execute Riak commands | salt/modules/riak.py | def __execute_cmd(name, cmd):
'''
Execute Riak commands
'''
return __salt__['cmd.run_all'](
'{0} {1}'.format(salt.utils.path.which(name), cmd)
) | def __execute_cmd(name, cmd):
'''
Execute Riak commands
'''
return __salt__['cmd.run_all'](
'{0} {1}'.format(salt.utils.path.which(name), cmd)
) | [
"Execute",
"Riak",
"commands"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/riak.py#L20-L26 | [
"def",
"__execute_cmd",
"(",
"name",
",",
"cmd",
")",
":",
"return",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"'{0} {1}'",
".",
"format",
"(",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"name",
")",
",",
"cmd",
")",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | start | Start Riak
CLI Example:
.. code-block:: bash
salt '*' riak.start | salt/modules/riak.py | def start():
'''
Start Riak
CLI Example:
.. code-block:: bash
salt '*' riak.start
'''
ret = {'comment': '', 'success': False}
cmd = __execute_cmd('riak', 'start')
if cmd['retcode'] != 0:
ret['comment'] = cmd['stderr']
else:
ret['comment'] = cmd['stdout']
... | def start():
'''
Start Riak
CLI Example:
.. code-block:: bash
salt '*' riak.start
'''
ret = {'comment': '', 'success': False}
cmd = __execute_cmd('riak', 'start')
if cmd['retcode'] != 0:
ret['comment'] = cmd['stderr']
else:
ret['comment'] = cmd['stdout']
... | [
"Start",
"Riak"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/riak.py#L29-L49 | [
"def",
"start",
"(",
")",
":",
"ret",
"=",
"{",
"'comment'",
":",
"''",
",",
"'success'",
":",
"False",
"}",
"cmd",
"=",
"__execute_cmd",
"(",
"'riak'",
",",
"'start'",
")",
"if",
"cmd",
"[",
"'retcode'",
"]",
"!=",
"0",
":",
"ret",
"[",
"'comment'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | stop | Stop Riak
.. versionchanged:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' riak.stop | salt/modules/riak.py | def stop():
'''
Stop Riak
.. versionchanged:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' riak.stop
'''
ret = {'comment': '', 'success': False}
cmd = __execute_cmd('riak', 'stop')
if cmd['retcode'] != 0:
ret['comment'] = cmd['stderr']
else:
r... | def stop():
'''
Stop Riak
.. versionchanged:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' riak.stop
'''
ret = {'comment': '', 'success': False}
cmd = __execute_cmd('riak', 'stop')
if cmd['retcode'] != 0:
ret['comment'] = cmd['stderr']
else:
r... | [
"Stop",
"Riak"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/riak.py#L52-L74 | [
"def",
"stop",
"(",
")",
":",
"ret",
"=",
"{",
"'comment'",
":",
"''",
",",
"'success'",
":",
"False",
"}",
"cmd",
"=",
"__execute_cmd",
"(",
"'riak'",
",",
"'stop'",
")",
"if",
"cmd",
"[",
"'retcode'",
"]",
"!=",
"0",
":",
"ret",
"[",
"'comment'",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | cluster_join | Join a Riak cluster
.. versionchanged:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' riak.cluster_join <user> <host>
username - The riak username to join the cluster
hostname - The riak hostname you are connecting to | salt/modules/riak.py | def cluster_join(username, hostname):
'''
Join a Riak cluster
.. versionchanged:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' riak.cluster_join <user> <host>
username - The riak username to join the cluster
hostname - The riak hostname you are connecting to
'''
r... | def cluster_join(username, hostname):
'''
Join a Riak cluster
.. versionchanged:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' riak.cluster_join <user> <host>
username - The riak username to join the cluster
hostname - The riak hostname you are connecting to
'''
r... | [
"Join",
"a",
"Riak",
"cluster"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/riak.py#L77-L104 | [
"def",
"cluster_join",
"(",
"username",
",",
"hostname",
")",
":",
"ret",
"=",
"{",
"'comment'",
":",
"''",
",",
"'success'",
":",
"False",
"}",
"cmd",
"=",
"__execute_cmd",
"(",
"'riak-admin'",
",",
"'cluster join {0}@{1}'",
".",
"format",
"(",
"username",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | cluster_commit | Commit Cluster Changes
.. versionchanged:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' riak.cluster_commit | salt/modules/riak.py | def cluster_commit():
'''
Commit Cluster Changes
.. versionchanged:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' riak.cluster_commit
'''
ret = {'comment': '', 'success': False}
cmd = __execute_cmd('riak-admin', 'cluster commit')
if cmd['retcode'] != 0:
r... | def cluster_commit():
'''
Commit Cluster Changes
.. versionchanged:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' riak.cluster_commit
'''
ret = {'comment': '', 'success': False}
cmd = __execute_cmd('riak-admin', 'cluster commit')
if cmd['retcode'] != 0:
r... | [
"Commit",
"Cluster",
"Changes"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/riak.py#L157-L179 | [
"def",
"cluster_commit",
"(",
")",
":",
"ret",
"=",
"{",
"'comment'",
":",
"''",
",",
"'success'",
":",
"False",
"}",
"cmd",
"=",
"__execute_cmd",
"(",
"'riak-admin'",
",",
"'cluster commit'",
")",
"if",
"cmd",
"[",
"'retcode'",
"]",
"!=",
"0",
":",
"r... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | member_status | Get cluster member status
.. versionchanged:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' riak.member_status | salt/modules/riak.py | def member_status():
'''
Get cluster member status
.. versionchanged:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' riak.member_status
'''
ret = {'membership': {},
'summary': {'Valid': 0,
'Leaving': 0,
'Exiting': 0,
... | def member_status():
'''
Get cluster member status
.. versionchanged:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' riak.member_status
'''
ret = {'membership': {},
'summary': {'Valid': 0,
'Leaving': 0,
'Exiting': 0,
... | [
"Get",
"cluster",
"member",
"status"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/riak.py#L182-L223 | [
"def",
"member_status",
"(",
")",
":",
"ret",
"=",
"{",
"'membership'",
":",
"{",
"}",
",",
"'summary'",
":",
"{",
"'Valid'",
":",
"0",
",",
"'Leaving'",
":",
"0",
",",
"'Exiting'",
":",
"0",
",",
"'Joining'",
":",
"0",
",",
"'Down'",
":",
"0",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | status | Current node status
.. versionadded:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' riak.status | salt/modules/riak.py | def status():
'''
Current node status
.. versionadded:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' riak.status
'''
ret = {}
cmd = __execute_cmd('riak-admin', 'status')
for i in cmd['stdout'].splitlines():
if ':' in i:
(name, val) = i.split('... | def status():
'''
Current node status
.. versionadded:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' riak.status
'''
ret = {}
cmd = __execute_cmd('riak-admin', 'status')
for i in cmd['stdout'].splitlines():
if ':' in i:
(name, val) = i.split('... | [
"Current",
"node",
"status"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/riak.py#L226-L247 | [
"def",
"status",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"__execute_cmd",
"(",
"'riak-admin'",
",",
"'status'",
")",
"for",
"i",
"in",
"cmd",
"[",
"'stdout'",
"]",
".",
"splitlines",
"(",
")",
":",
"if",
"':'",
"in",
"i",
":",
"(",
"name... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | flags | Enforce the given flags on the given package or ``DEPEND`` atom.
.. warning::
In most cases, the affected package(s) need to be rebuilt in
order to apply the changes.
name
The name of the package or its DEPEND atom
use
A list of ``USE`` flags
accept_keywords
A ... | salt/states/portage_config.py | def flags(name,
use=None,
accept_keywords=None,
env=None,
license=None,
properties=None,
unmask=False,
mask=False):
'''
Enforce the given flags on the given package or ``DEPEND`` atom.
.. warning::
In most cases, the affected pa... | def flags(name,
use=None,
accept_keywords=None,
env=None,
license=None,
properties=None,
unmask=False,
mask=False):
'''
Enforce the given flags on the given package or ``DEPEND`` atom.
.. warning::
In most cases, the affected pa... | [
"Enforce",
"the",
"given",
"flags",
"on",
"the",
"given",
"package",
"or",
"DEPEND",
"atom",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/portage_config.py#L63-L168 | [
"def",
"flags",
"(",
"name",
",",
"use",
"=",
"None",
",",
"accept_keywords",
"=",
"None",
",",
"env",
"=",
"None",
",",
"license",
"=",
"None",
",",
"properties",
"=",
"None",
",",
"unmask",
"=",
"False",
",",
"mask",
"=",
"False",
")",
":",
"ret"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | useradd | Add a user to htpasswd file using the htpasswd command. If the htpasswd
file does not exist, it will be created.
pwfile
Path to htpasswd file
user
User name
password
User password
opts
Valid options that can be passed are:
- `n` Don't update file; di... | salt/modules/webutil.py | def useradd(pwfile, user, password, opts='', runas=None):
'''
Add a user to htpasswd file using the htpasswd command. If the htpasswd
file does not exist, it will be created.
pwfile
Path to htpasswd file
user
User name
password
User password
opts
Valid opt... | def useradd(pwfile, user, password, opts='', runas=None):
'''
Add a user to htpasswd file using the htpasswd command. If the htpasswd
file does not exist, it will be created.
pwfile
Path to htpasswd file
user
User name
password
User password
opts
Valid opt... | [
"Add",
"a",
"user",
"to",
"htpasswd",
"file",
"using",
"the",
"htpasswd",
"command",
".",
"If",
"the",
"htpasswd",
"file",
"does",
"not",
"exist",
"it",
"will",
"be",
"created",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/webutil.py#L33-L70 | [
"def",
"useradd",
"(",
"pwfile",
",",
"user",
",",
"password",
",",
"opts",
"=",
"''",
",",
"runas",
"=",
"None",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"pwfile",
")",
":",
"opts",
"+=",
"'c'",
"cmd",
"=",
"[",
"'htpasswd'"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | userdel | Delete a user from the specified htpasswd file.
pwfile
Path to htpasswd file
user
User name
runas
The system user to run htpasswd command with
all_results
Return stdout, stderr, and retcode, not just stdout
CLI Examples:
.. code-block:: bash
salt '*... | salt/modules/webutil.py | def userdel(pwfile, user, runas=None, all_results=False):
'''
Delete a user from the specified htpasswd file.
pwfile
Path to htpasswd file
user
User name
runas
The system user to run htpasswd command with
all_results
Return stdout, stderr, and retcode, not jus... | def userdel(pwfile, user, runas=None, all_results=False):
'''
Delete a user from the specified htpasswd file.
pwfile
Path to htpasswd file
user
User name
runas
The system user to run htpasswd command with
all_results
Return stdout, stderr, and retcode, not jus... | [
"Delete",
"a",
"user",
"from",
"the",
"specified",
"htpasswd",
"file",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/webutil.py#L73-L106 | [
"def",
"userdel",
"(",
"pwfile",
",",
"user",
",",
"runas",
"=",
"None",
",",
"all_results",
"=",
"False",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"pwfile",
")",
":",
"return",
"'Error: The specified htpasswd file does not exist'",
"cmd... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | verify | Return True if the htpasswd file exists, the user has an entry, and their
password matches.
pwfile
Fully qualified path to htpasswd file
user
User name
password
User password
opts
Valid options that can be passed are:
- `m` Force MD5 encryption of th... | salt/modules/webutil.py | def verify(pwfile, user, password, opts='', runas=None):
'''
Return True if the htpasswd file exists, the user has an entry, and their
password matches.
pwfile
Fully qualified path to htpasswd file
user
User name
password
User password
opts
Valid options t... | def verify(pwfile, user, password, opts='', runas=None):
'''
Return True if the htpasswd file exists, the user has an entry, and their
password matches.
pwfile
Fully qualified path to htpasswd file
user
User name
password
User password
opts
Valid options t... | [
"Return",
"True",
"if",
"the",
"htpasswd",
"file",
"exists",
"the",
"user",
"has",
"an",
"entry",
"and",
"their",
"password",
"matches",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/webutil.py#L109-L148 | [
"def",
"verify",
"(",
"pwfile",
",",
"user",
",",
"password",
",",
"opts",
"=",
"''",
",",
"runas",
"=",
"None",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"pwfile",
")",
":",
"return",
"False",
"cmd",
"=",
"[",
"'htpasswd'",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | is_admin | Is the passed user a member of the Administrators group
Args:
name (str): The name to check
Returns:
bool: True if user is a member of the Administrators group, False
otherwise | salt/utils/win_functions.py | def is_admin(name):
'''
Is the passed user a member of the Administrators group
Args:
name (str): The name to check
Returns:
bool: True if user is a member of the Administrators group, False
otherwise
'''
groups = get_user_groups(name, True)
for group in groups:
... | def is_admin(name):
'''
Is the passed user a member of the Administrators group
Args:
name (str): The name to check
Returns:
bool: True if user is a member of the Administrators group, False
otherwise
'''
groups = get_user_groups(name, True)
for group in groups:
... | [
"Is",
"the",
"passed",
"user",
"a",
"member",
"of",
"the",
"Administrators",
"group"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_functions.py#L51-L68 | [
"def",
"is_admin",
"(",
"name",
")",
":",
"groups",
"=",
"get_user_groups",
"(",
"name",
",",
"True",
")",
"for",
"group",
"in",
"groups",
":",
"if",
"group",
"in",
"(",
"'S-1-5-32-544'",
",",
"'S-1-5-18'",
")",
":",
"return",
"True",
"return",
"False"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_user_groups | Get the groups to which a user belongs
Args:
name (str): The user name to query
sid (bool): True will return a list of SIDs, False will return a list of
group names
Returns:
list: A list of group names or sids | salt/utils/win_functions.py | def get_user_groups(name, sid=False):
'''
Get the groups to which a user belongs
Args:
name (str): The user name to query
sid (bool): True will return a list of SIDs, False will return a list of
group names
Returns:
list: A list of group names or sids
'''
if nam... | def get_user_groups(name, sid=False):
'''
Get the groups to which a user belongs
Args:
name (str): The user name to query
sid (bool): True will return a list of SIDs, False will return a list of
group names
Returns:
list: A list of group names or sids
'''
if nam... | [
"Get",
"the",
"groups",
"to",
"which",
"a",
"user",
"belongs"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_functions.py#L71-L96 | [
"def",
"get_user_groups",
"(",
"name",
",",
"sid",
"=",
"False",
")",
":",
"if",
"name",
"==",
"'SYSTEM'",
":",
"# 'win32net.NetUserGetLocalGroups' will fail if you pass in 'SYSTEM'.",
"groups",
"=",
"[",
"name",
"]",
"else",
":",
"groups",
"=",
"win32net",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_sid_from_name | This is a tool for getting a sid from a name. The name can be any object.
Usually a user or a group
Args:
name (str): The name of the user or group for which to get the sid
Returns:
str: The corresponding SID | salt/utils/win_functions.py | def get_sid_from_name(name):
'''
This is a tool for getting a sid from a name. The name can be any object.
Usually a user or a group
Args:
name (str): The name of the user or group for which to get the sid
Returns:
str: The corresponding SID
'''
# If None is passed, use the... | def get_sid_from_name(name):
'''
This is a tool for getting a sid from a name. The name can be any object.
Usually a user or a group
Args:
name (str): The name of the user or group for which to get the sid
Returns:
str: The corresponding SID
'''
# If None is passed, use the... | [
"This",
"is",
"a",
"tool",
"for",
"getting",
"a",
"sid",
"from",
"a",
"name",
".",
"The",
"name",
"can",
"be",
"any",
"object",
".",
"Usually",
"a",
"user",
"or",
"a",
"group"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_functions.py#L99-L120 | [
"def",
"get_sid_from_name",
"(",
"name",
")",
":",
"# If None is passed, use the Universal Well-known SID \"Null SID\"",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"'NULL SID'",
"try",
":",
"sid",
"=",
"win32security",
".",
"LookupAccountName",
"(",
"None",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_current_user | Gets the user executing the process
Args:
with_domain (bool):
``True`` will prepend the user name with the machine name or domain
separated by a backslash
Returns:
str: The user name | salt/utils/win_functions.py | def get_current_user(with_domain=True):
'''
Gets the user executing the process
Args:
with_domain (bool):
``True`` will prepend the user name with the machine name or domain
separated by a backslash
Returns:
str: The user name
'''
try:
user_name... | def get_current_user(with_domain=True):
'''
Gets the user executing the process
Args:
with_domain (bool):
``True`` will prepend the user name with the machine name or domain
separated by a backslash
Returns:
str: The user name
'''
try:
user_name... | [
"Gets",
"the",
"user",
"executing",
"the",
"process"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_functions.py#L123-L155 | [
"def",
"get_current_user",
"(",
"with_domain",
"=",
"True",
")",
":",
"try",
":",
"user_name",
"=",
"win32api",
".",
"GetUserNameEx",
"(",
"win32api",
".",
"NameSamCompatible",
")",
"if",
"user_name",
"[",
"-",
"1",
"]",
"==",
"'$'",
":",
"# Make the system ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_sam_name | r'''
Gets the SAM name for a user. It basically prefixes a username without a
backslash with the computer name. If the user does not exist, a SAM
compatible name will be returned using the local hostname as the domain.
i.e. salt.utils.get_same_name('Administrator') would return 'DOMAIN.COM\Administrato... | salt/utils/win_functions.py | def get_sam_name(username):
r'''
Gets the SAM name for a user. It basically prefixes a username without a
backslash with the computer name. If the user does not exist, a SAM
compatible name will be returned using the local hostname as the domain.
i.e. salt.utils.get_same_name('Administrator') would... | def get_sam_name(username):
r'''
Gets the SAM name for a user. It basically prefixes a username without a
backslash with the computer name. If the user does not exist, a SAM
compatible name will be returned using the local hostname as the domain.
i.e. salt.utils.get_same_name('Administrator') would... | [
"r",
"Gets",
"the",
"SAM",
"name",
"for",
"a",
"user",
".",
"It",
"basically",
"prefixes",
"a",
"username",
"without",
"a",
"backslash",
"with",
"the",
"computer",
"name",
".",
"If",
"the",
"user",
"does",
"not",
"exist",
"a",
"SAM",
"compatible",
"name"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_functions.py#L158-L173 | [
"def",
"get_sam_name",
"(",
"username",
")",
":",
"try",
":",
"sid_obj",
"=",
"win32security",
".",
"LookupAccountName",
"(",
"None",
",",
"username",
")",
"[",
"0",
"]",
"except",
"pywintypes",
".",
"error",
":",
"return",
"'\\\\'",
".",
"join",
"(",
"[... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | escape_argument | Escape the argument for the cmd.exe shell.
See http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx
First we escape the quote chars to produce a argument suitable for
CommandLineToArgvW. We don't need to do this for simple arguments.
Args... | salt/utils/win_functions.py | def escape_argument(arg, escape=True):
'''
Escape the argument for the cmd.exe shell.
See http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx
First we escape the quote chars to produce a argument suitable for
CommandLineToArgvW. We do... | def escape_argument(arg, escape=True):
'''
Escape the argument for the cmd.exe shell.
See http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx
First we escape the quote chars to produce a argument suitable for
CommandLineToArgvW. We do... | [
"Escape",
"the",
"argument",
"for",
"the",
"cmd",
".",
"exe",
"shell",
".",
"See",
"http",
":",
"//",
"blogs",
".",
"msdn",
".",
"com",
"/",
"b",
"/",
"twistylittlepassagesallalike",
"/",
"archive",
"/",
"2011",
"/",
"04",
"/",
"23",
"/",
"everyone",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_functions.py#L185-L209 | [
"def",
"escape_argument",
"(",
"arg",
",",
"escape",
"=",
"True",
")",
":",
"if",
"not",
"arg",
"or",
"re",
".",
"search",
"(",
"r'([\"\\s])'",
",",
"arg",
")",
":",
"arg",
"=",
"'\"'",
"+",
"arg",
".",
"replace",
"(",
"'\"'",
",",
"r'\\\"'",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | escape_for_cmd_exe | Escape an argument string to be suitable to be passed to
cmd.exe on Windows
This method takes an argument that is expected to already be properly
escaped for the receiving program to be properly parsed. This argument
will be further escaped to pass the interpolation performed by cmd.exe
unchanged.
... | salt/utils/win_functions.py | def escape_for_cmd_exe(arg):
'''
Escape an argument string to be suitable to be passed to
cmd.exe on Windows
This method takes an argument that is expected to already be properly
escaped for the receiving program to be properly parsed. This argument
will be further escaped to pass the interpola... | def escape_for_cmd_exe(arg):
'''
Escape an argument string to be suitable to be passed to
cmd.exe on Windows
This method takes an argument that is expected to already be properly
escaped for the receiving program to be properly parsed. This argument
will be further escaped to pass the interpola... | [
"Escape",
"an",
"argument",
"string",
"to",
"be",
"suitable",
"to",
"be",
"passed",
"to",
"cmd",
".",
"exe",
"on",
"Windows"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_functions.py#L212-L239 | [
"def",
"escape_for_cmd_exe",
"(",
"arg",
")",
":",
"meta_chars",
"=",
"'()%!^\"<>&|'",
"meta_re",
"=",
"re",
".",
"compile",
"(",
"'('",
"+",
"'|'",
".",
"join",
"(",
"re",
".",
"escape",
"(",
"char",
")",
"for",
"char",
"in",
"list",
"(",
"meta_chars"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | broadcast_setting_change | Send a WM_SETTINGCHANGE Broadcast to all Windows
Args:
message (str):
A string value representing the portion of the system that has been
updated and needs to be refreshed. Default is ``Environment``. These
are some common values:
- "Environment" : to effec... | salt/utils/win_functions.py | def broadcast_setting_change(message='Environment'):
'''
Send a WM_SETTINGCHANGE Broadcast to all Windows
Args:
message (str):
A string value representing the portion of the system that has been
updated and needs to be refreshed. Default is ``Environment``. These
... | def broadcast_setting_change(message='Environment'):
'''
Send a WM_SETTINGCHANGE Broadcast to all Windows
Args:
message (str):
A string value representing the portion of the system that has been
updated and needs to be refreshed. Default is ``Environment``. These
... | [
"Send",
"a",
"WM_SETTINGCHANGE",
"Broadcast",
"to",
"all",
"Windows"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_functions.py#L242-L308 | [
"def",
"broadcast_setting_change",
"(",
"message",
"=",
"'Environment'",
")",
":",
"# Listen for messages sent by this would involve working with the",
"# SetWindowLong function. This can be accessed via win32gui or through",
"# ctypes. You can find examples on how to do this by searching for",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | guid_to_squid | Converts a GUID to a compressed guid (SQUID)
Each Guid has 5 parts separated by '-'. For the first three each one will be
totally reversed, and for the remaining two each one will be reversed by
every other character. Then the final compressed Guid will be constructed by
concatenating all the reverse... | salt/utils/win_functions.py | def guid_to_squid(guid):
'''
Converts a GUID to a compressed guid (SQUID)
Each Guid has 5 parts separated by '-'. For the first three each one will be
totally reversed, and for the remaining two each one will be reversed by
every other character. Then the final compressed Guid will be constructed... | def guid_to_squid(guid):
'''
Converts a GUID to a compressed guid (SQUID)
Each Guid has 5 parts separated by '-'. For the first three each one will be
totally reversed, and for the remaining two each one will be reversed by
every other character. Then the final compressed Guid will be constructed... | [
"Converts",
"a",
"GUID",
"to",
"a",
"compressed",
"guid",
"(",
"SQUID",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_functions.py#L311-L339 | [
"def",
"guid_to_squid",
"(",
"guid",
")",
":",
"guid_pattern",
"=",
"re",
".",
"compile",
"(",
"r'^\\{(\\w{8})-(\\w{4})-(\\w{4})-(\\w\\w)(\\w\\w)-(\\w\\w)(\\w\\w)(\\w\\w)(\\w\\w)(\\w\\w)(\\w\\w)\\}$'",
")",
"guid_match",
"=",
"guid_pattern",
".",
"match",
"(",
"guid",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | squid_to_guid | Converts a compressed GUID (SQUID) back into a GUID
Args:
squid (str): A valid compressed GUID
Returns:
str: A valid GUID | salt/utils/win_functions.py | def squid_to_guid(squid):
'''
Converts a compressed GUID (SQUID) back into a GUID
Args:
squid (str): A valid compressed GUID
Returns:
str: A valid GUID
'''
squid_pattern = re.compile(r'^(\w{8})(\w{4})(\w{4})(\w\w)(\w\w)(\w\w)(\w\w)(\w\w)(\w\w)(\w\w)(\w\w)$')
squid_match = ... | def squid_to_guid(squid):
'''
Converts a compressed GUID (SQUID) back into a GUID
Args:
squid (str): A valid compressed GUID
Returns:
str: A valid GUID
'''
squid_pattern = re.compile(r'^(\w{8})(\w{4})(\w{4})(\w\w)(\w\w)(\w\w)(\w\w)(\w\w)(\w\w)(\w\w)(\w\w)$')
squid_match = ... | [
"Converts",
"a",
"compressed",
"GUID",
"(",
"SQUID",
")",
"back",
"into",
"a",
"GUID"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_functions.py#L342-L365 | [
"def",
"squid_to_guid",
"(",
"squid",
")",
":",
"squid_pattern",
"=",
"re",
".",
"compile",
"(",
"r'^(\\w{8})(\\w{4})(\\w{4})(\\w\\w)(\\w\\w)(\\w\\w)(\\w\\w)(\\w\\w)(\\w\\w)(\\w\\w)(\\w\\w)$'",
")",
"squid_match",
"=",
"squid_pattern",
".",
"match",
"(",
"squid",
")",
"gu... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get | Gathers the data from the specified minions' mine, pass in the target,
function to look up and the target type
CLI Example:
.. code-block:: bash
salt-run mine.get '*' network.interfaces | salt/runners/mine.py | def get(tgt, fun, tgt_type='glob'):
'''
Gathers the data from the specified minions' mine, pass in the target,
function to look up and the target type
CLI Example:
.. code-block:: bash
salt-run mine.get '*' network.interfaces
'''
ret = salt.utils.minions.mine_get(tgt, fun, tgt_typ... | def get(tgt, fun, tgt_type='glob'):
'''
Gathers the data from the specified minions' mine, pass in the target,
function to look up and the target type
CLI Example:
.. code-block:: bash
salt-run mine.get '*' network.interfaces
'''
ret = salt.utils.minions.mine_get(tgt, fun, tgt_typ... | [
"Gathers",
"the",
"data",
"from",
"the",
"specified",
"minions",
"mine",
"pass",
"in",
"the",
"target",
"function",
"to",
"look",
"up",
"and",
"the",
"target",
"type"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/mine.py#L16-L28 | [
"def",
"get",
"(",
"tgt",
",",
"fun",
",",
"tgt_type",
"=",
"'glob'",
")",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"minions",
".",
"mine_get",
"(",
"tgt",
",",
"fun",
",",
"tgt_type",
",",
"__opts__",
")",
"return",
"ret"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update | .. versionadded:: 2017.7.0
Update the mine data on a certain group of minions.
tgt
Which minions to target for the execution.
tgt_type: ``glob``
The type of ``tgt``.
clear: ``False``
Boolean flag specifying whether updating will clear the existing
mines, or will updat... | salt/runners/mine.py | def update(tgt,
tgt_type='glob',
clear=False,
mine_functions=None):
'''
.. versionadded:: 2017.7.0
Update the mine data on a certain group of minions.
tgt
Which minions to target for the execution.
tgt_type: ``glob``
The type of ``tgt``.
clear... | def update(tgt,
tgt_type='glob',
clear=False,
mine_functions=None):
'''
.. versionadded:: 2017.7.0
Update the mine data on a certain group of minions.
tgt
Which minions to target for the execution.
tgt_type: ``glob``
The type of ``tgt``.
clear... | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/mine.py#L31-L69 | [
"def",
"update",
"(",
"tgt",
",",
"tgt_type",
"=",
"'glob'",
",",
"clear",
"=",
"False",
",",
"mine_functions",
"=",
"None",
")",
":",
"ret",
"=",
"__salt__",
"[",
"'salt.execute'",
"]",
"(",
"tgt",
",",
"'mine.update'",
",",
"tgt_type",
"=",
"tgt_type",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | nxapi_request | Send exec and config commands to the NX-OS device over NX-API.
commands
The exec or config commands to be sent.
method:
``cli_show_ascii``: Return raw test or unstructured output.
``cli_show``: Return structured output.
``cli_conf``: Send configuration commands to the device.
... | salt/utils/nxos.py | def nxapi_request(commands,
method='cli_show',
**kwargs):
'''
Send exec and config commands to the NX-OS device over NX-API.
commands
The exec or config commands to be sent.
method:
``cli_show_ascii``: Return raw test or unstructured output.
... | def nxapi_request(commands,
method='cli_show',
**kwargs):
'''
Send exec and config commands to the NX-OS device over NX-API.
commands
The exec or config commands to be sent.
method:
``cli_show_ascii``: Return raw test or unstructured output.
... | [
"Send",
"exec",
"and",
"config",
"commands",
"to",
"the",
"NX",
"-",
"OS",
"device",
"over",
"NX",
"-",
"API",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nxos.py#L271-L313 | [
"def",
"nxapi_request",
"(",
"commands",
",",
"method",
"=",
"'cli_show'",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"NxapiClient",
"(",
"*",
"*",
"kwargs",
")",
"return",
"client",
".",
"request",
"(",
"method",
",",
"commands",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | system_info | Helper method to return parsed system_info
from the 'show version' command. | salt/utils/nxos.py | def system_info(data):
'''
Helper method to return parsed system_info
from the 'show version' command.
'''
if not data:
return {}
info = {
'software': _parse_software(data),
'hardware': _parse_hardware(data),
'plugins': _parse_plugins(data),
}
return {'nxo... | def system_info(data):
'''
Helper method to return parsed system_info
from the 'show version' command.
'''
if not data:
return {}
info = {
'software': _parse_software(data),
'hardware': _parse_hardware(data),
'plugins': _parse_plugins(data),
}
return {'nxo... | [
"Helper",
"method",
"to",
"return",
"parsed",
"system_info",
"from",
"the",
"show",
"version",
"command",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nxos.py#L372-L384 | [
"def",
"system_info",
"(",
"data",
")",
":",
"if",
"not",
"data",
":",
"return",
"{",
"}",
"info",
"=",
"{",
"'software'",
":",
"_parse_software",
"(",
"data",
")",
",",
"'hardware'",
":",
"_parse_hardware",
"(",
"data",
")",
",",
"'plugins'",
":",
"_p... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | NxapiClient._use_remote_connection | Determine if connection is local or remote | salt/utils/nxos.py | def _use_remote_connection(self, kwargs):
'''
Determine if connection is local or remote
'''
kwargs['host'] = kwargs.get('host')
kwargs['username'] = kwargs.get('username')
kwargs['password'] = kwargs.get('password')
if kwargs['host'] is None or \
kwarg... | def _use_remote_connection(self, kwargs):
'''
Determine if connection is local or remote
'''
kwargs['host'] = kwargs.get('host')
kwargs['username'] = kwargs.get('username')
kwargs['password'] = kwargs.get('password')
if kwargs['host'] is None or \
kwarg... | [
"Determine",
"if",
"connection",
"is",
"local",
"or",
"remote"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nxos.py#L107-L119 | [
"def",
"_use_remote_connection",
"(",
"self",
",",
"kwargs",
")",
":",
"kwargs",
"[",
"'host'",
"]",
"=",
"kwargs",
".",
"get",
"(",
"'host'",
")",
"kwargs",
"[",
"'username'",
"]",
"=",
"kwargs",
".",
"get",
"(",
"'username'",
")",
"kwargs",
"[",
"'pa... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | NxapiClient._prepare_conn_args | Set connection arguments for remote or local connection. | salt/utils/nxos.py | def _prepare_conn_args(self, kwargs):
'''
Set connection arguments for remote or local connection.
'''
kwargs['connect_over_uds'] = True
kwargs['timeout'] = kwargs.get('timeout', 60)
kwargs['cookie'] = kwargs.get('cookie', 'admin')
if self._use_remote_connection(k... | def _prepare_conn_args(self, kwargs):
'''
Set connection arguments for remote or local connection.
'''
kwargs['connect_over_uds'] = True
kwargs['timeout'] = kwargs.get('timeout', 60)
kwargs['cookie'] = kwargs.get('cookie', 'admin')
if self._use_remote_connection(k... | [
"Set",
"connection",
"arguments",
"for",
"remote",
"or",
"local",
"connection",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nxos.py#L121-L140 | [
"def",
"_prepare_conn_args",
"(",
"self",
",",
"kwargs",
")",
":",
"kwargs",
"[",
"'connect_over_uds'",
"]",
"=",
"True",
"kwargs",
"[",
"'timeout'",
"]",
"=",
"kwargs",
".",
"get",
"(",
"'timeout'",
",",
"60",
")",
"kwargs",
"[",
"'cookie'",
"]",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | NxapiClient._build_request | Build NX-API JSON request. | salt/utils/nxos.py | def _build_request(self, type, commands):
'''
Build NX-API JSON request.
'''
request = {}
headers = {
'content-type': 'application/json',
}
if self.nxargs['connect_over_uds']:
user = self.nxargs['cookie']
headers['cookie'] = 'nx... | def _build_request(self, type, commands):
'''
Build NX-API JSON request.
'''
request = {}
headers = {
'content-type': 'application/json',
}
if self.nxargs['connect_over_uds']:
user = self.nxargs['cookie']
headers['cookie'] = 'nx... | [
"Build",
"NX",
"-",
"API",
"JSON",
"request",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nxos.py#L142-L179 | [
"def",
"_build_request",
"(",
"self",
",",
"type",
",",
"commands",
")",
":",
"request",
"=",
"{",
"}",
"headers",
"=",
"{",
"'content-type'",
":",
"'application/json'",
",",
"}",
"if",
"self",
".",
"nxargs",
"[",
"'connect_over_uds'",
"]",
":",
"user",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | NxapiClient.request | Send NX-API JSON request to the NX-OS device. | salt/utils/nxos.py | def request(self, type, command_list):
'''
Send NX-API JSON request to the NX-OS device.
'''
req = self._build_request(type, command_list)
if self.nxargs['connect_over_uds']:
self.connection.request('POST', req['url'], req['payload'], req['headers'])
respo... | def request(self, type, command_list):
'''
Send NX-API JSON request to the NX-OS device.
'''
req = self._build_request(type, command_list)
if self.nxargs['connect_over_uds']:
self.connection.request('POST', req['url'], req['payload'], req['headers'])
respo... | [
"Send",
"NX",
"-",
"API",
"JSON",
"request",
"to",
"the",
"NX",
"-",
"OS",
"device",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nxos.py#L181-L199 | [
"def",
"request",
"(",
"self",
",",
"type",
",",
"command_list",
")",
":",
"req",
"=",
"self",
".",
"_build_request",
"(",
"type",
",",
"command_list",
")",
"if",
"self",
".",
"nxargs",
"[",
"'connect_over_uds'",
"]",
":",
"self",
".",
"connection",
".",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | NxapiClient.parse_response | Parse NX-API JSON response from the NX-OS device. | salt/utils/nxos.py | def parse_response(self, response, command_list):
'''
Parse NX-API JSON response from the NX-OS device.
'''
# Check for 500 level NX-API Server Errors
if isinstance(response, collections.Iterable) and 'status' in response:
if int(response['status']) >= 500:
... | def parse_response(self, response, command_list):
'''
Parse NX-API JSON response from the NX-OS device.
'''
# Check for 500 level NX-API Server Errors
if isinstance(response, collections.Iterable) and 'status' in response:
if int(response['status']) >= 500:
... | [
"Parse",
"NX",
"-",
"API",
"JSON",
"response",
"from",
"the",
"NX",
"-",
"OS",
"device",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nxos.py#L201-L268 | [
"def",
"parse_response",
"(",
"self",
",",
"response",
",",
"command_list",
")",
":",
"# Check for 500 level NX-API Server Errors",
"if",
"isinstance",
"(",
"response",
",",
"collections",
".",
"Iterable",
")",
"and",
"'status'",
"in",
"response",
":",
"if",
"int"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_modules | Get a list of the PowerShell modules which are potentially available to be
imported. The intent is to mimic the functionality of ``Get-Module
-ListAvailable | Select-Object -Expand Name``, without the delay of loading
PowerShell to do so.
Returns:
list: A list of modules available to Powershell... | salt/utils/powershell.py | def get_modules():
'''
Get a list of the PowerShell modules which are potentially available to be
imported. The intent is to mimic the functionality of ``Get-Module
-ListAvailable | Select-Object -Expand Name``, without the delay of loading
PowerShell to do so.
Returns:
list: A list of ... | def get_modules():
'''
Get a list of the PowerShell modules which are potentially available to be
imported. The intent is to mimic the functionality of ``Get-Module
-ListAvailable | Select-Object -Expand Name``, without the delay of loading
PowerShell to do so.
Returns:
list: A list of ... | [
"Get",
"a",
"list",
"of",
"the",
"PowerShell",
"modules",
"which",
"are",
"potentially",
"available",
"to",
"be",
"imported",
".",
"The",
"intent",
"is",
"to",
"mimic",
"the",
"functionality",
"of",
"Get",
"-",
"Module",
"-",
"ListAvailable",
"|",
"Select",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/powershell.py#L46-L124 | [
"def",
"get_modules",
"(",
")",
":",
"ret",
"=",
"list",
"(",
")",
"valid_extensions",
"=",
"(",
"'.psd1'",
",",
"'.psm1'",
",",
"'.cdxml'",
",",
"'.xaml'",
",",
"'.dll'",
")",
"# need to create an info function to get PS information including version",
"# __salt__ is... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | generate_cert | Generate an icinga2 client certificate and key.
Returns::
icinga2 pki new-cert --cn domain.tld --key /etc/icinga2/pki/domain.tld.key --cert /etc/icinga2/pki/domain.tld.crt
CLI Example:
.. code-block:: bash
salt '*' icinga2.generate_cert domain.tld | salt/modules/icinga2.py | def generate_cert(domain):
'''
Generate an icinga2 client certificate and key.
Returns::
icinga2 pki new-cert --cn domain.tld --key /etc/icinga2/pki/domain.tld.key --cert /etc/icinga2/pki/domain.tld.crt
CLI Example:
.. code-block:: bash
salt '*' icinga2.generate_cert domain.tld
... | def generate_cert(domain):
'''
Generate an icinga2 client certificate and key.
Returns::
icinga2 pki new-cert --cn domain.tld --key /etc/icinga2/pki/domain.tld.key --cert /etc/icinga2/pki/domain.tld.crt
CLI Example:
.. code-block:: bash
salt '*' icinga2.generate_cert domain.tld
... | [
"Generate",
"an",
"icinga2",
"client",
"certificate",
"and",
"key",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/icinga2.py#L53-L68 | [
"def",
"generate_cert",
"(",
"domain",
")",
":",
"result",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"[",
"\"icinga2\"",
",",
"\"pki\"",
",",
"\"new-cert\"",
",",
"\"--cn\"",
",",
"domain",
",",
"\"--key\"",
",",
"\"{0}{1}.key\"",
".",
"format",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | save_cert | Save the certificate for master icinga2 node.
Returns::
icinga2 pki save-cert --key /etc/icinga2/pki/domain.tld.key --cert /etc/icinga2/pki/domain.tld.crt --trustedcert /etc/icinga2/pki/trusted-master.crt --host master.domain.tld
CLI Example:
.. code-block:: bash
salt '*' icinga2.save_ce... | salt/modules/icinga2.py | def save_cert(domain, master):
'''
Save the certificate for master icinga2 node.
Returns::
icinga2 pki save-cert --key /etc/icinga2/pki/domain.tld.key --cert /etc/icinga2/pki/domain.tld.crt --trustedcert /etc/icinga2/pki/trusted-master.crt --host master.domain.tld
CLI Example:
.. code-blo... | def save_cert(domain, master):
'''
Save the certificate for master icinga2 node.
Returns::
icinga2 pki save-cert --key /etc/icinga2/pki/domain.tld.key --cert /etc/icinga2/pki/domain.tld.crt --trustedcert /etc/icinga2/pki/trusted-master.crt --host master.domain.tld
CLI Example:
.. code-blo... | [
"Save",
"the",
"certificate",
"for",
"master",
"icinga2",
"node",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/icinga2.py#L71-L87 | [
"def",
"save_cert",
"(",
"domain",
",",
"master",
")",
":",
"result",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"[",
"\"icinga2\"",
",",
"\"pki\"",
",",
"\"save-cert\"",
",",
"\"--key\"",
",",
"\"{0}{1}.key\"",
".",
"format",
"(",
"get_certs_path",
"(... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | request_cert | Request CA cert from master icinga2 node.
Returns::
icinga2 pki request --host master.domain.tld --port 5665 --ticket TICKET_ID --key /etc/icinga2/pki/domain.tld.key --cert /etc/icinga2/pki/domain.tld.crt --trustedcert \
/etc/icinga2/pki/trusted-master.crt --ca /etc/icinga2/pki/ca.crt
... | salt/modules/icinga2.py | def request_cert(domain, master, ticket, port):
'''
Request CA cert from master icinga2 node.
Returns::
icinga2 pki request --host master.domain.tld --port 5665 --ticket TICKET_ID --key /etc/icinga2/pki/domain.tld.key --cert /etc/icinga2/pki/domain.tld.crt --trustedcert \
/etc/icing... | def request_cert(domain, master, ticket, port):
'''
Request CA cert from master icinga2 node.
Returns::
icinga2 pki request --host master.domain.tld --port 5665 --ticket TICKET_ID --key /etc/icinga2/pki/domain.tld.key --cert /etc/icinga2/pki/domain.tld.crt --trustedcert \
/etc/icing... | [
"Request",
"CA",
"cert",
"from",
"master",
"icinga2",
"node",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/icinga2.py#L90-L107 | [
"def",
"request_cert",
"(",
"domain",
",",
"master",
",",
"ticket",
",",
"port",
")",
":",
"result",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"[",
"\"icinga2\"",
",",
"\"pki\"",
",",
"\"request\"",
",",
"\"--host\"",
",",
"master",
",",
"\"--port\"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | node_setup | Setup the icinga2 node.
Returns::
icinga2 node setup --ticket TICKET_ID --endpoint master.domain.tld --zone domain.tld --master_host master.domain.tld --trustedcert \
/etc/icinga2/pki/trusted-master.crt
CLI Example:
.. code-block:: bash
salt '*' icinga2.node_setup domain.... | salt/modules/icinga2.py | def node_setup(domain, master, ticket):
'''
Setup the icinga2 node.
Returns::
icinga2 node setup --ticket TICKET_ID --endpoint master.domain.tld --zone domain.tld --master_host master.domain.tld --trustedcert \
/etc/icinga2/pki/trusted-master.crt
CLI Example:
.. code-block... | def node_setup(domain, master, ticket):
'''
Setup the icinga2 node.
Returns::
icinga2 node setup --ticket TICKET_ID --endpoint master.domain.tld --zone domain.tld --master_host master.domain.tld --trustedcert \
/etc/icinga2/pki/trusted-master.crt
CLI Example:
.. code-block... | [
"Setup",
"the",
"icinga2",
"node",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/icinga2.py#L110-L127 | [
"def",
"node_setup",
"(",
"domain",
",",
"master",
",",
"ticket",
")",
":",
"result",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"[",
"\"icinga2\"",
",",
"\"node\"",
",",
"\"setup\"",
",",
"\"--ticket\"",
",",
"ticket",
",",
"\"--endpoint\"",
",",
"m... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _handle_salt_host_resource | Handles salt_host resources.
See https://github.com/dmacvicar/terraform-provider-salt
Returns roster attributes for the resource or None | salt/roster/terraform.py | def _handle_salt_host_resource(resource):
'''
Handles salt_host resources.
See https://github.com/dmacvicar/terraform-provider-salt
Returns roster attributes for the resource or None
'''
ret = {}
attrs = resource.get('primary', {}).get('attributes', {})
ret[MINION_ID] = attrs.get(MINION... | def _handle_salt_host_resource(resource):
'''
Handles salt_host resources.
See https://github.com/dmacvicar/terraform-provider-salt
Returns roster attributes for the resource or None
'''
ret = {}
attrs = resource.get('primary', {}).get('attributes', {})
ret[MINION_ID] = attrs.get(MINION... | [
"Handles",
"salt_host",
"resources",
".",
"See",
"https",
":",
"//",
"github",
".",
"com",
"/",
"dmacvicar",
"/",
"terraform",
"-",
"provider",
"-",
"salt"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/terraform.py#L83-L96 | [
"def",
"_handle_salt_host_resource",
"(",
"resource",
")",
":",
"ret",
"=",
"{",
"}",
"attrs",
"=",
"resource",
".",
"get",
"(",
"'primary'",
",",
"{",
"}",
")",
".",
"get",
"(",
"'attributes'",
",",
"{",
"}",
")",
"ret",
"[",
"MINION_ID",
"]",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _add_ssh_key | Setups the salt-ssh minion to be accessed with salt-ssh default key | salt/roster/terraform.py | def _add_ssh_key(ret):
'''
Setups the salt-ssh minion to be accessed with salt-ssh default key
'''
priv = None
if __opts__.get('ssh_use_home_key') and os.path.isfile(os.path.expanduser('~/.ssh/id_rsa')):
priv = os.path.expanduser('~/.ssh/id_rsa')
else:
priv = __opts__.get(
... | def _add_ssh_key(ret):
'''
Setups the salt-ssh minion to be accessed with salt-ssh default key
'''
priv = None
if __opts__.get('ssh_use_home_key') and os.path.isfile(os.path.expanduser('~/.ssh/id_rsa')):
priv = os.path.expanduser('~/.ssh/id_rsa')
else:
priv = __opts__.get(
... | [
"Setups",
"the",
"salt",
"-",
"ssh",
"minion",
"to",
"be",
"accessed",
"with",
"salt",
"-",
"ssh",
"default",
"key"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/terraform.py#L99-L116 | [
"def",
"_add_ssh_key",
"(",
"ret",
")",
":",
"priv",
"=",
"None",
"if",
"__opts__",
".",
"get",
"(",
"'ssh_use_home_key'",
")",
"and",
"os",
".",
"path",
".",
"isfile",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
"'~/.ssh/id_rsa'",
")",
")",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _cast_output_to_type | cast the value depending on the terraform type | salt/roster/terraform.py | def _cast_output_to_type(value, typ):
'''cast the value depending on the terraform type'''
if typ == 'b':
return bool(value)
if typ == 'i':
return int(value)
return value | def _cast_output_to_type(value, typ):
'''cast the value depending on the terraform type'''
if typ == 'b':
return bool(value)
if typ == 'i':
return int(value)
return value | [
"cast",
"the",
"value",
"depending",
"on",
"the",
"terraform",
"type"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/terraform.py#L119-L125 | [
"def",
"_cast_output_to_type",
"(",
"value",
",",
"typ",
")",
":",
"if",
"typ",
"==",
"'b'",
":",
"return",
"bool",
"(",
"value",
")",
"if",
"typ",
"==",
"'i'",
":",
"return",
"int",
"(",
"value",
")",
"return",
"value"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_state_file | Parses the terraform state file passing different resource types to the right handler | salt/roster/terraform.py | def _parse_state_file(state_file_path='terraform.tfstate'):
'''
Parses the terraform state file passing different resource types to the right handler
'''
ret = {}
with salt.utils.files.fopen(state_file_path, 'r') as fh_:
tfstate = salt.utils.json.load(fh_)
modules = tfstate.get('modules... | def _parse_state_file(state_file_path='terraform.tfstate'):
'''
Parses the terraform state file passing different resource types to the right handler
'''
ret = {}
with salt.utils.files.fopen(state_file_path, 'r') as fh_:
tfstate = salt.utils.json.load(fh_)
modules = tfstate.get('modules... | [
"Parses",
"the",
"terraform",
"state",
"file",
"passing",
"different",
"resource",
"types",
"to",
"the",
"right",
"handler"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/terraform.py#L128-L159 | [
"def",
"_parse_state_file",
"(",
"state_file_path",
"=",
"'terraform.tfstate'",
")",
":",
"ret",
"=",
"{",
"}",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"state_file_path",
",",
"'r'",
")",
"as",
"fh_",
":",
"tfstate",
"=",
"salt",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | targets | Returns the roster from the terraform state file, checks opts for location, but defaults to terraform.tfstate | salt/roster/terraform.py | def targets(tgt, tgt_type='glob', **kwargs): # pylint: disable=W0613
'''
Returns the roster from the terraform state file, checks opts for location, but defaults to terraform.tfstate
'''
roster_file = os.path.abspath('terraform.tfstate')
if __opts__.get('roster_file'):
roster_file = os.path... | def targets(tgt, tgt_type='glob', **kwargs): # pylint: disable=W0613
'''
Returns the roster from the terraform state file, checks opts for location, but defaults to terraform.tfstate
'''
roster_file = os.path.abspath('terraform.tfstate')
if __opts__.get('roster_file'):
roster_file = os.path... | [
"Returns",
"the",
"roster",
"from",
"the",
"terraform",
"state",
"file",
"checks",
"opts",
"for",
"location",
"but",
"defaults",
"to",
"terraform",
".",
"tfstate"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/terraform.py#L162-L182 | [
"def",
"targets",
"(",
"tgt",
",",
"tgt_type",
"=",
"'glob'",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=W0613",
"roster_file",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"'terraform.tfstate'",
")",
"if",
"__opts__",
".",
"get",
"(",
"'roster_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_timeout | Set the sleep timeouts of specific items such as disk, monitor, etc.
Args:
name (str)
The setting to change, can be one of the following:
- ``monitor``
- ``disk``
- ``standby``
- ``hibernate``
value (int):
Th... | salt/states/win_powercfg.py | def set_timeout(name, value, power='ac', scheme=None):
'''
Set the sleep timeouts of specific items such as disk, monitor, etc.
Args:
name (str)
The setting to change, can be one of the following:
- ``monitor``
- ``disk``
- ``standby``
... | def set_timeout(name, value, power='ac', scheme=None):
'''
Set the sleep timeouts of specific items such as disk, monitor, etc.
Args:
name (str)
The setting to change, can be one of the following:
- ``monitor``
- ``disk``
- ``standby``
... | [
"Set",
"the",
"sleep",
"timeouts",
"of",
"specific",
"items",
"such",
"as",
"disk",
"monitor",
"etc",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_powercfg.py#L40-L150 | [
"def",
"set_timeout",
"(",
"name",
",",
"value",
",",
"power",
"=",
"'ac'",
",",
"scheme",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | resolve_dns | Resolves the master_ip and master_uri options | salt/minion.py | def resolve_dns(opts, fallback=True):
'''
Resolves the master_ip and master_uri options
'''
ret = {}
check_dns = True
if (opts.get('file_client', 'remote') == 'local' and
not opts.get('use_master_when_local', False)):
check_dns = False
# Since salt.log is imported below, ... | def resolve_dns(opts, fallback=True):
'''
Resolves the master_ip and master_uri options
'''
ret = {}
check_dns = True
if (opts.get('file_client', 'remote') == 'local' and
not opts.get('use_master_when_local', False)):
check_dns = False
# Since salt.log is imported below, ... | [
"Resolves",
"the",
"master_ip",
"and",
"master_uri",
"options"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L133-L242 | [
"def",
"resolve_dns",
"(",
"opts",
",",
"fallback",
"=",
"True",
")",
":",
"ret",
"=",
"{",
"}",
"check_dns",
"=",
"True",
"if",
"(",
"opts",
".",
"get",
"(",
"'file_client'",
",",
"'remote'",
")",
"==",
"'local'",
"and",
"not",
"opts",
".",
"get",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | prep_ip_port | parse host:port values from opts['master'] and return valid:
master: ip address or hostname as a string
master_port: (optional) master returner port as integer
e.g.:
- master: 'localhost:1234' -> {'master': 'localhost', 'master_port': 1234}
- master: '127.0.0.1:1234' -> {'master': '127.... | salt/minion.py | def prep_ip_port(opts):
'''
parse host:port values from opts['master'] and return valid:
master: ip address or hostname as a string
master_port: (optional) master returner port as integer
e.g.:
- master: 'localhost:1234' -> {'master': 'localhost', 'master_port': 1234}
- master: ... | def prep_ip_port(opts):
'''
parse host:port values from opts['master'] and return valid:
master: ip address or hostname as a string
master_port: (optional) master returner port as integer
e.g.:
- master: 'localhost:1234' -> {'master': 'localhost', 'master_port': 1234}
- master: ... | [
"parse",
"host",
":",
"port",
"values",
"from",
"opts",
"[",
"master",
"]",
"and",
"return",
"valid",
":",
"master",
":",
"ip",
"address",
"or",
"hostname",
"as",
"a",
"string",
"master_port",
":",
"(",
"optional",
")",
"master",
"returner",
"port",
"as"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L245-L269 | [
"def",
"prep_ip_port",
"(",
"opts",
")",
":",
"ret",
"=",
"{",
"}",
"# Use given master IP if \"ip_only\" is set or if master_ip is an ipv6 address without",
"# a port specified. The is_ipv6 check returns False if brackets are used in the IP",
"# definition such as master: '[::1]:1234'.",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_proc_dir | Given the cache directory, return the directory that process data is
stored in, creating it if it doesn't exist.
The following optional Keyword Arguments are handled:
mode: which is anything os.makedir would accept as mode.
uid: the uid to set, if not set, or it is None or -1 no changes are
m... | salt/minion.py | def get_proc_dir(cachedir, **kwargs):
'''
Given the cache directory, return the directory that process data is
stored in, creating it if it doesn't exist.
The following optional Keyword Arguments are handled:
mode: which is anything os.makedir would accept as mode.
uid: the uid to set, if not ... | def get_proc_dir(cachedir, **kwargs):
'''
Given the cache directory, return the directory that process data is
stored in, creating it if it doesn't exist.
The following optional Keyword Arguments are handled:
mode: which is anything os.makedir would accept as mode.
uid: the uid to set, if not ... | [
"Given",
"the",
"cache",
"directory",
"return",
"the",
"directory",
"that",
"process",
"data",
"is",
"stored",
"in",
"creating",
"it",
"if",
"it",
"doesn",
"t",
"exist",
".",
"The",
"following",
"optional",
"Keyword",
"Arguments",
"are",
"handled",
":"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L272-L320 | [
"def",
"get_proc_dir",
"(",
"cachedir",
",",
"*",
"*",
"kwargs",
")",
":",
"fn_",
"=",
"os",
".",
"path",
".",
"join",
"(",
"cachedir",
",",
"'proc'",
")",
"mode",
"=",
"kwargs",
".",
"pop",
"(",
"'mode'",
",",
"None",
")",
"if",
"mode",
"is",
"N... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | load_args_and_kwargs | Detect the args and kwargs that need to be passed to a function call, and
check them against what was passed. | salt/minion.py | def load_args_and_kwargs(func, args, data=None, ignore_invalid=False):
'''
Detect the args and kwargs that need to be passed to a function call, and
check them against what was passed.
'''
argspec = salt.utils.args.get_function_argspec(func)
_args = []
_kwargs = {}
invalid_kwargs = []
... | def load_args_and_kwargs(func, args, data=None, ignore_invalid=False):
'''
Detect the args and kwargs that need to be passed to a function call, and
check them against what was passed.
'''
argspec = salt.utils.args.get_function_argspec(func)
_args = []
_kwargs = {}
invalid_kwargs = []
... | [
"Detect",
"the",
"args",
"and",
"kwargs",
"that",
"need",
"to",
"be",
"passed",
"to",
"a",
"function",
"call",
"and",
"check",
"them",
"against",
"what",
"was",
"passed",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L323-L372 | [
"def",
"load_args_and_kwargs",
"(",
"func",
",",
"args",
",",
"data",
"=",
"None",
",",
"ignore_invalid",
"=",
"False",
")",
":",
"argspec",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"get_function_argspec",
"(",
"func",
")",
"_args",
"=",
"[",
"]",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | eval_master_func | Evaluate master function if master type is 'func'
and save it result in opts['master'] | salt/minion.py | def eval_master_func(opts):
'''
Evaluate master function if master type is 'func'
and save it result in opts['master']
'''
if '__master_func_evaluated' not in opts:
# split module and function and try loading the module
mod_fun = opts['master']
mod, fun = mod_fun.split('.')
... | def eval_master_func(opts):
'''
Evaluate master function if master type is 'func'
and save it result in opts['master']
'''
if '__master_func_evaluated' not in opts:
# split module and function and try loading the module
mod_fun = opts['master']
mod, fun = mod_fun.split('.')
... | [
"Evaluate",
"master",
"function",
"if",
"master",
"type",
"is",
"func",
"and",
"save",
"it",
"result",
"in",
"opts",
"[",
"master",
"]"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L375-L400 | [
"def",
"eval_master_func",
"(",
"opts",
")",
":",
"if",
"'__master_func_evaluated'",
"not",
"in",
"opts",
":",
"# split module and function and try loading the module",
"mod_fun",
"=",
"opts",
"[",
"'master'",
"]",
"mod",
",",
"fun",
"=",
"mod_fun",
".",
"split",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | master_event | Centralized master event function which will return event type based on event_map | salt/minion.py | def master_event(type, master=None):
'''
Centralized master event function which will return event type based on event_map
'''
event_map = {'connected': '__master_connected',
'disconnected': '__master_disconnected',
'failback': '__master_failback',
'ali... | def master_event(type, master=None):
'''
Centralized master event function which will return event type based on event_map
'''
event_map = {'connected': '__master_connected',
'disconnected': '__master_disconnected',
'failback': '__master_failback',
'ali... | [
"Centralized",
"master",
"event",
"function",
"which",
"will",
"return",
"event",
"type",
"based",
"on",
"event_map"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L403-L415 | [
"def",
"master_event",
"(",
"type",
",",
"master",
"=",
"None",
")",
":",
"event_map",
"=",
"{",
"'connected'",
":",
"'__master_connected'",
",",
"'disconnected'",
":",
"'__master_disconnected'",
",",
"'failback'",
":",
"'__master_failback'",
",",
"'alive'",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | MinionBase.process_beacons | Evaluate all of the configured beacons, grab the config again in case
the pillar or grains changed | salt/minion.py | def process_beacons(self, functions):
'''
Evaluate all of the configured beacons, grab the config again in case
the pillar or grains changed
'''
if 'config.merge' in functions:
b_conf = functions['config.merge']('beacons', self.opts['beacons'], omit_opts=True)
... | def process_beacons(self, functions):
'''
Evaluate all of the configured beacons, grab the config again in case
the pillar or grains changed
'''
if 'config.merge' in functions:
b_conf = functions['config.merge']('beacons', self.opts['beacons'], omit_opts=True)
... | [
"Evaluate",
"all",
"of",
"the",
"configured",
"beacons",
"grab",
"the",
"config",
"again",
"in",
"case",
"the",
"pillar",
"or",
"grains",
"changed"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L448-L457 | [
"def",
"process_beacons",
"(",
"self",
",",
"functions",
")",
":",
"if",
"'config.merge'",
"in",
"functions",
":",
"b_conf",
"=",
"functions",
"[",
"'config.merge'",
"]",
"(",
"'beacons'",
",",
"self",
".",
"opts",
"[",
"'beacons'",
"]",
",",
"omit_opts",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | MinionBase.eval_master | Evaluates and returns a tuple of the current master address and the pub_channel.
In standard mode, just creates a pub_channel with the given master address.
With master_type=func evaluates the current master address from the given
module and then creates a pub_channel.
With master_typ... | salt/minion.py | def eval_master(self,
opts,
timeout=60,
safe=True,
failed=False,
failback=False):
'''
Evaluates and returns a tuple of the current master address and the pub_channel.
In standard mode, just creat... | def eval_master(self,
opts,
timeout=60,
safe=True,
failed=False,
failback=False):
'''
Evaluates and returns a tuple of the current master address and the pub_channel.
In standard mode, just creat... | [
"Evaluates",
"and",
"returns",
"a",
"tuple",
"of",
"the",
"current",
"master",
"address",
"and",
"the",
"pub_channel",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L460-L729 | [
"def",
"eval_master",
"(",
"self",
",",
"opts",
",",
"timeout",
"=",
"60",
",",
"safe",
"=",
"True",
",",
"failed",
"=",
"False",
",",
"failback",
"=",
"False",
")",
":",
"# return early if we are not connecting to a master",
"if",
"opts",
"[",
"'master_type'"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | MinionBase._discover_masters | Discover master(s) and decide where to connect, if SSDP is around.
This modifies the configuration on the fly.
:return: | salt/minion.py | def _discover_masters(self):
'''
Discover master(s) and decide where to connect, if SSDP is around.
This modifies the configuration on the fly.
:return:
'''
if self.opts['master'] == DEFAULT_MINION_OPTS['master'] and self.opts['discovery'] is not False:
master... | def _discover_masters(self):
'''
Discover master(s) and decide where to connect, if SSDP is around.
This modifies the configuration on the fly.
:return:
'''
if self.opts['master'] == DEFAULT_MINION_OPTS['master'] and self.opts['discovery'] is not False:
master... | [
"Discover",
"master",
"(",
"s",
")",
"and",
"decide",
"where",
"to",
"connect",
"if",
"SSDP",
"is",
"around",
".",
"This",
"modifies",
"the",
"configuration",
"on",
"the",
"fly",
".",
":",
"return",
":"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L731-L771 | [
"def",
"_discover_masters",
"(",
"self",
")",
":",
"if",
"self",
".",
"opts",
"[",
"'master'",
"]",
"==",
"DEFAULT_MINION_OPTS",
"[",
"'master'",
"]",
"and",
"self",
".",
"opts",
"[",
"'discovery'",
"]",
"is",
"not",
"False",
":",
"master_discovery_client",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | MinionBase._return_retry_timer | Based on the minion configuration, either return a randomized timer or
just return the value of the return_retry_timer. | salt/minion.py | def _return_retry_timer(self):
'''
Based on the minion configuration, either return a randomized timer or
just return the value of the return_retry_timer.
'''
msg = 'Minion return retry timer set to %s seconds'
if self.opts.get('return_retry_timer_max'):
try:
... | def _return_retry_timer(self):
'''
Based on the minion configuration, either return a randomized timer or
just return the value of the return_retry_timer.
'''
msg = 'Minion return retry timer set to %s seconds'
if self.opts.get('return_retry_timer_max'):
try:
... | [
"Based",
"on",
"the",
"minion",
"configuration",
"either",
"return",
"a",
"randomized",
"timer",
"or",
"just",
"return",
"the",
"value",
"of",
"the",
"return_retry_timer",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L773-L798 | [
"def",
"_return_retry_timer",
"(",
"self",
")",
":",
"msg",
"=",
"'Minion return retry timer set to %s seconds'",
"if",
"self",
".",
"opts",
".",
"get",
"(",
"'return_retry_timer_max'",
")",
":",
"try",
":",
"random_retry",
"=",
"randint",
"(",
"self",
".",
"opt... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SMinion.gen_modules | Tell the minion to reload the execution modules
CLI Example:
.. code-block:: bash
salt '*' sys.reload_modules | salt/minion.py | def gen_modules(self, initial_load=False):
'''
Tell the minion to reload the execution modules
CLI Example:
.. code-block:: bash
salt '*' sys.reload_modules
'''
self.opts['pillar'] = salt.pillar.get_pillar(
self.opts,
self.opts['grai... | def gen_modules(self, initial_load=False):
'''
Tell the minion to reload the execution modules
CLI Example:
.. code-block:: bash
salt '*' sys.reload_modules
'''
self.opts['pillar'] = salt.pillar.get_pillar(
self.opts,
self.opts['grai... | [
"Tell",
"the",
"minion",
"to",
"reload",
"the",
"execution",
"modules"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L847-L880 | [
"def",
"gen_modules",
"(",
"self",
",",
"initial_load",
"=",
"False",
")",
":",
"self",
".",
"opts",
"[",
"'pillar'",
"]",
"=",
"salt",
".",
"pillar",
".",
"get_pillar",
"(",
"self",
".",
"opts",
",",
"self",
".",
"opts",
"[",
"'grains'",
"]",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | MasterMinion.gen_modules | Tell the minion to reload the execution modules
CLI Example:
.. code-block:: bash
salt '*' sys.reload_modules | salt/minion.py | def gen_modules(self, initial_load=False):
'''
Tell the minion to reload the execution modules
CLI Example:
.. code-block:: bash
salt '*' sys.reload_modules
'''
self.utils = salt.loader.utils(self.opts)
self.functions = salt.loader.minion_mods(
... | def gen_modules(self, initial_load=False):
'''
Tell the minion to reload the execution modules
CLI Example:
.. code-block:: bash
salt '*' sys.reload_modules
'''
self.utils = salt.loader.utils(self.opts)
self.functions = salt.loader.minion_mods(
... | [
"Tell",
"the",
"minion",
"to",
"reload",
"the",
"execution",
"modules"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L913-L941 | [
"def",
"gen_modules",
"(",
"self",
",",
"initial_load",
"=",
"False",
")",
":",
"self",
".",
"utils",
"=",
"salt",
".",
"loader",
".",
"utils",
"(",
"self",
".",
"opts",
")",
"self",
".",
"functions",
"=",
"salt",
".",
"loader",
".",
"minion_mods",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | MinionManager._create_minion_object | Helper function to return the correct type of object | salt/minion.py | def _create_minion_object(self, opts, timeout, safe,
io_loop=None, loaded_base_name=None,
jid_queue=None):
'''
Helper function to return the correct type of object
'''
return Minion(opts,
timeout,
... | def _create_minion_object(self, opts, timeout, safe,
io_loop=None, loaded_base_name=None,
jid_queue=None):
'''
Helper function to return the correct type of object
'''
return Minion(opts,
timeout,
... | [
"Helper",
"function",
"to",
"return",
"the",
"correct",
"type",
"of",
"object"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L979-L990 | [
"def",
"_create_minion_object",
"(",
"self",
",",
"opts",
",",
"timeout",
",",
"safe",
",",
"io_loop",
"=",
"None",
",",
"loaded_base_name",
"=",
"None",
",",
"jid_queue",
"=",
"None",
")",
":",
"return",
"Minion",
"(",
"opts",
",",
"timeout",
",",
"safe... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | MinionManager._spawn_minions | Spawn all the coroutines which will sign in to masters | salt/minion.py | def _spawn_minions(self, timeout=60):
'''
Spawn all the coroutines which will sign in to masters
'''
# Run masters discovery over SSDP. This may modify the whole configuration,
# depending of the networking and sets of masters. If match is 'any' we let
# eval_master handl... | def _spawn_minions(self, timeout=60):
'''
Spawn all the coroutines which will sign in to masters
'''
# Run masters discovery over SSDP. This may modify the whole configuration,
# depending of the networking and sets of masters. If match is 'any' we let
# eval_master handl... | [
"Spawn",
"all",
"the",
"coroutines",
"which",
"will",
"sign",
"in",
"to",
"masters"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1001-L1027 | [
"def",
"_spawn_minions",
"(",
"self",
",",
"timeout",
"=",
"60",
")",
":",
"# Run masters discovery over SSDP. This may modify the whole configuration,",
"# depending of the networking and sets of masters. If match is 'any' we let",
"# eval_master handle the discovery instead so disconnectio... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | MinionManager._connect_minion | Create a minion, and asynchronously connect it to a master | salt/minion.py | def _connect_minion(self, minion):
'''
Create a minion, and asynchronously connect it to a master
'''
auth_wait = minion.opts['acceptance_wait_time']
failed = False
while True:
if failed:
if auth_wait < self.max_auth_wait:
a... | def _connect_minion(self, minion):
'''
Create a minion, and asynchronously connect it to a master
'''
auth_wait = minion.opts['acceptance_wait_time']
failed = False
while True:
if failed:
if auth_wait < self.max_auth_wait:
a... | [
"Create",
"a",
"minion",
"and",
"asynchronously",
"connect",
"it",
"to",
"a",
"master"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1030-L1072 | [
"def",
"_connect_minion",
"(",
"self",
",",
"minion",
")",
":",
"auth_wait",
"=",
"minion",
".",
"opts",
"[",
"'acceptance_wait_time'",
"]",
"failed",
"=",
"False",
"while",
"True",
":",
"if",
"failed",
":",
"if",
"auth_wait",
"<",
"self",
".",
"max_auth_w... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Minion.sync_connect_master | Block until we are connected to a master | salt/minion.py | def sync_connect_master(self, timeout=None, failed=False):
'''
Block until we are connected to a master
'''
self._sync_connect_master_success = False
log.debug("sync_connect_master")
def on_connect_master_future_done(future):
self._sync_connect_master_success... | def sync_connect_master(self, timeout=None, failed=False):
'''
Block until we are connected to a master
'''
self._sync_connect_master_success = False
log.debug("sync_connect_master")
def on_connect_master_future_done(future):
self._sync_connect_master_success... | [
"Block",
"until",
"we",
"are",
"connected",
"to",
"a",
"master"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1209-L1238 | [
"def",
"sync_connect_master",
"(",
"self",
",",
"timeout",
"=",
"None",
",",
"failed",
"=",
"False",
")",
":",
"self",
".",
"_sync_connect_master_success",
"=",
"False",
"log",
".",
"debug",
"(",
"\"sync_connect_master\"",
")",
"def",
"on_connect_master_future_don... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Minion.connect_master | Return a future which will complete when you are connected to a master | salt/minion.py | def connect_master(self, failed=False):
'''
Return a future which will complete when you are connected to a master
'''
master, self.pub_channel = yield self.eval_master(self.opts, self.timeout, self.safe, failed)
yield self._post_master_init(master) | def connect_master(self, failed=False):
'''
Return a future which will complete when you are connected to a master
'''
master, self.pub_channel = yield self.eval_master(self.opts, self.timeout, self.safe, failed)
yield self._post_master_init(master) | [
"Return",
"a",
"future",
"which",
"will",
"complete",
"when",
"you",
"are",
"connected",
"to",
"a",
"master"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1241-L1246 | [
"def",
"connect_master",
"(",
"self",
",",
"failed",
"=",
"False",
")",
":",
"master",
",",
"self",
".",
"pub_channel",
"=",
"yield",
"self",
".",
"eval_master",
"(",
"self",
".",
"opts",
",",
"self",
".",
"timeout",
",",
"self",
".",
"safe",
",",
"f... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Minion._post_master_init | Function to finish init after connecting to a master
This is primarily loading modules, pillars, etc. (since they need
to know which master they connected to)
If this function is changed, please check ProxyMinion._post_master_init
to see if those changes need to be propagated.
... | salt/minion.py | def _post_master_init(self, master):
'''
Function to finish init after connecting to a master
This is primarily loading modules, pillars, etc. (since they need
to know which master they connected to)
If this function is changed, please check ProxyMinion._post_master_init
... | def _post_master_init(self, master):
'''
Function to finish init after connecting to a master
This is primarily loading modules, pillars, etc. (since they need
to know which master they connected to)
If this function is changed, please check ProxyMinion._post_master_init
... | [
"Function",
"to",
"finish",
"init",
"after",
"connecting",
"to",
"a",
"master"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1250-L1346 | [
"def",
"_post_master_init",
"(",
"self",
",",
"master",
")",
":",
"if",
"self",
".",
"connected",
":",
"self",
".",
"opts",
"[",
"'master'",
"]",
"=",
"master",
"# Initialize pillar before loader to make pillar accessible in modules",
"async_pillar",
"=",
"salt",
".... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Minion._prep_mod_opts | Returns a copy of the opts with key bits stripped out | salt/minion.py | def _prep_mod_opts(self):
'''
Returns a copy of the opts with key bits stripped out
'''
mod_opts = {}
for key, val in six.iteritems(self.opts):
if key == 'logger':
continue
mod_opts[key] = val
return mod_opts | def _prep_mod_opts(self):
'''
Returns a copy of the opts with key bits stripped out
'''
mod_opts = {}
for key, val in six.iteritems(self.opts):
if key == 'logger':
continue
mod_opts[key] = val
return mod_opts | [
"Returns",
"a",
"copy",
"of",
"the",
"opts",
"with",
"key",
"bits",
"stripped",
"out"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1348-L1357 | [
"def",
"_prep_mod_opts",
"(",
"self",
")",
":",
"mod_opts",
"=",
"{",
"}",
"for",
"key",
",",
"val",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"opts",
")",
":",
"if",
"key",
"==",
"'logger'",
":",
"continue",
"mod_opts",
"[",
"key",
"]",
"="... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Minion._load_modules | Return the functions and the returners loaded up from the loader
module | salt/minion.py | def _load_modules(self, force_refresh=False, notify=False, grains=None, opts=None):
'''
Return the functions and the returners loaded up from the loader
module
'''
opt_in = True
if not opts:
opts = self.opts
opt_in = False
# if this is a *n... | def _load_modules(self, force_refresh=False, notify=False, grains=None, opts=None):
'''
Return the functions and the returners loaded up from the loader
module
'''
opt_in = True
if not opts:
opts = self.opts
opt_in = False
# if this is a *n... | [
"Return",
"the",
"functions",
"and",
"the",
"returners",
"loaded",
"up",
"from",
"the",
"loader",
"module"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1359-L1419 | [
"def",
"_load_modules",
"(",
"self",
",",
"force_refresh",
"=",
"False",
",",
"notify",
"=",
"False",
",",
"grains",
"=",
"None",
",",
"opts",
"=",
"None",
")",
":",
"opt_in",
"=",
"True",
"if",
"not",
"opts",
":",
"opts",
"=",
"self",
".",
"opts",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Minion._fire_master | Fire an event on the master, or drop message if unable to send. | salt/minion.py | def _fire_master(self, data=None, tag=None, events=None, pretag=None, timeout=60, sync=True, timeout_handler=None):
'''
Fire an event on the master, or drop message if unable to send.
'''
load = {'id': self.opts['id'],
'cmd': '_minion_event',
'pretag': pre... | def _fire_master(self, data=None, tag=None, events=None, pretag=None, timeout=60, sync=True, timeout_handler=None):
'''
Fire an event on the master, or drop message if unable to send.
'''
load = {'id': self.opts['id'],
'cmd': '_minion_event',
'pretag': pre... | [
"Fire",
"an",
"event",
"on",
"the",
"master",
"or",
"drop",
"message",
"if",
"unable",
"to",
"send",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1451-L1492 | [
"def",
"_fire_master",
"(",
"self",
",",
"data",
"=",
"None",
",",
"tag",
"=",
"None",
",",
"events",
"=",
"None",
",",
"pretag",
"=",
"None",
",",
"timeout",
"=",
"60",
",",
"sync",
"=",
"True",
",",
"timeout_handler",
"=",
"None",
")",
":",
"load... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Minion.ctx | Return a single context manager for the minion's data | salt/minion.py | def ctx(self):
'''
Return a single context manager for the minion's data
'''
if six.PY2:
return contextlib.nested(
self.functions.context_dict.clone(),
self.returners.context_dict.clone(),
self.executors.context_dict.clone(),
... | def ctx(self):
'''
Return a single context manager for the minion's data
'''
if six.PY2:
return contextlib.nested(
self.functions.context_dict.clone(),
self.returners.context_dict.clone(),
self.executors.context_dict.clone(),
... | [
"Return",
"a",
"single",
"context",
"manager",
"for",
"the",
"minion",
"s",
"data"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1581-L1596 | [
"def",
"ctx",
"(",
"self",
")",
":",
"if",
"six",
".",
"PY2",
":",
"return",
"contextlib",
".",
"nested",
"(",
"self",
".",
"functions",
".",
"context_dict",
".",
"clone",
"(",
")",
",",
"self",
".",
"returners",
".",
"context_dict",
".",
"clone",
"(... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Minion._thread_return | This method should be used as a threading target, start the actual
minion side execution. | salt/minion.py | def _thread_return(cls, minion_instance, opts, data):
'''
This method should be used as a threading target, start the actual
minion side execution.
'''
fn_ = os.path.join(minion_instance.proc_dir, data['jid'])
if opts['multiprocessing'] and not salt.utils.platform.is_win... | def _thread_return(cls, minion_instance, opts, data):
'''
This method should be used as a threading target, start the actual
minion side execution.
'''
fn_ = os.path.join(minion_instance.proc_dir, data['jid'])
if opts['multiprocessing'] and not salt.utils.platform.is_win... | [
"This",
"method",
"should",
"be",
"used",
"as",
"a",
"threading",
"target",
"start",
"the",
"actual",
"minion",
"side",
"execution",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1631-L1851 | [
"def",
"_thread_return",
"(",
"cls",
",",
"minion_instance",
",",
"opts",
",",
"data",
")",
":",
"fn_",
"=",
"os",
".",
"path",
".",
"join",
"(",
"minion_instance",
".",
"proc_dir",
",",
"data",
"[",
"'jid'",
"]",
")",
"if",
"opts",
"[",
"'multiprocess... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Minion._thread_multi_return | This method should be used as a threading target, start the actual
minion side execution. | salt/minion.py | def _thread_multi_return(cls, minion_instance, opts, data):
'''
This method should be used as a threading target, start the actual
minion side execution.
'''
fn_ = os.path.join(minion_instance.proc_dir, data['jid'])
if opts['multiprocessing'] and not salt.utils.platform.... | def _thread_multi_return(cls, minion_instance, opts, data):
'''
This method should be used as a threading target, start the actual
minion side execution.
'''
fn_ = os.path.join(minion_instance.proc_dir, data['jid'])
if opts['multiprocessing'] and not salt.utils.platform.... | [
"This",
"method",
"should",
"be",
"used",
"as",
"a",
"threading",
"target",
"start",
"the",
"actual",
"minion",
"side",
"execution",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1854-L1971 | [
"def",
"_thread_multi_return",
"(",
"cls",
",",
"minion_instance",
",",
"opts",
",",
"data",
")",
":",
"fn_",
"=",
"os",
".",
"path",
".",
"join",
"(",
"minion_instance",
".",
"proc_dir",
",",
"data",
"[",
"'jid'",
"]",
")",
"if",
"opts",
"[",
"'multip... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Minion._return_pub_multi | Return the data from the executed command to the master server | salt/minion.py | def _return_pub_multi(self, rets, ret_cmd='_return', timeout=60, sync=True):
'''
Return the data from the executed command to the master server
'''
if not isinstance(rets, list):
rets = [rets]
jids = {}
for ret in rets:
jid = ret.get('jid', ret.get... | def _return_pub_multi(self, rets, ret_cmd='_return', timeout=60, sync=True):
'''
Return the data from the executed command to the master server
'''
if not isinstance(rets, list):
rets = [rets]
jids = {}
for ret in rets:
jid = ret.get('jid', ret.get... | [
"Return",
"the",
"data",
"from",
"the",
"executed",
"command",
"to",
"the",
"master",
"server"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2058-L2142 | [
"def",
"_return_pub_multi",
"(",
"self",
",",
"rets",
",",
"ret_cmd",
"=",
"'_return'",
",",
"timeout",
"=",
"60",
",",
"sync",
"=",
"True",
")",
":",
"if",
"not",
"isinstance",
"(",
"rets",
",",
"list",
")",
":",
"rets",
"=",
"[",
"rets",
"]",
"ji... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Minion._state_run | Execute a state run based on information set in the minion config file | salt/minion.py | def _state_run(self):
'''
Execute a state run based on information set in the minion config file
'''
if self.opts['startup_states']:
if self.opts.get('master_type', 'str') == 'disable' and \
self.opts.get('file_client', 'remote') == 'remote':
... | def _state_run(self):
'''
Execute a state run based on information set in the minion config file
'''
if self.opts['startup_states']:
if self.opts.get('master_type', 'str') == 'disable' and \
self.opts.get('file_client', 'remote') == 'remote':
... | [
"Execute",
"a",
"state",
"run",
"based",
"on",
"information",
"set",
"in",
"the",
"minion",
"config",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2144-L2167 | [
"def",
"_state_run",
"(",
"self",
")",
":",
"if",
"self",
".",
"opts",
"[",
"'startup_states'",
"]",
":",
"if",
"self",
".",
"opts",
".",
"get",
"(",
"'master_type'",
",",
"'str'",
")",
"==",
"'disable'",
"and",
"self",
".",
"opts",
".",
"get",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.