repository_name stringclasses 316
values | func_path_in_repository stringlengths 6 223 | func_name stringlengths 1 134 | language stringclasses 1
value | func_code_string stringlengths 57 65.5k | func_documentation_string stringlengths 1 46.3k | split_name stringclasses 1
value | func_code_url stringlengths 91 315 | called_functions listlengths 1 156 ⌀ | enclosing_scope stringlengths 2 1.48M |
|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/introspect.py | running_service_owners | python | def running_service_owners(
exclude=('/dev', '/home', '/media', '/proc', '/run', '/sys/', '/tmp',
'/var')
):
'''
Determine which packages own the currently running services. By default,
excludes files whose full path starts with ``/dev``, ``/home``, ``/media``,
``/proc``, ``... | Determine which packages own the currently running services. By default,
excludes files whose full path starts with ``/dev``, ``/home``, ``/media``,
``/proc``, ``/run``, ``/sys``, ``/tmp`` and ``/var``. This can be
overridden by passing in a new list to ``exclude``.
CLI Example:
salt myminion ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/introspect.py#L15-L66 | [
"def itervalues(d, **kw):\n return d.itervalues(**kw)\n"
] | # -*- coding: utf-8 -*-
'''
Functions to perform introspection on a minion, and return data in a format
usable by Salt States
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import os
# Import 3rd-party libs
from salt.ext import six
def enabled_service_owners():
... |
saltstack/salt | salt/modules/introspect.py | enabled_service_owners | python | def enabled_service_owners():
'''
Return which packages own each of the services that are currently enabled.
CLI Example:
salt myminion introspect.enabled_service_owners
'''
error = {}
if 'pkg.owner' not in __salt__:
error['Unsupported Package Manager'] = (
'The mod... | Return which packages own each of the services that are currently enabled.
CLI Example:
salt myminion introspect.enabled_service_owners | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/introspect.py#L69-L104 | [
"def itervalues(d, **kw):\n return d.itervalues(**kw)\n"
] | # -*- coding: utf-8 -*-
'''
Functions to perform introspection on a minion, and return data in a format
usable by Salt States
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import os
# Import 3rd-party libs
from salt.ext import six
def running_service_owners(
... |
saltstack/salt | salt/modules/introspect.py | service_highstate | python | def service_highstate(requires=True):
'''
Return running and enabled services in a highstate structure. By default
also returns package dependencies for those services, which means that
package definitions must be created outside this function. To drop the
package dependencies, set ``requires`` to F... | Return running and enabled services in a highstate structure. By default
also returns package dependencies for those services, which means that
package definitions must be created outside this function. To drop the
package dependencies, set ``requires`` to False.
CLI Example:
salt myminion int... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/introspect.py#L107-L146 | [
"def iterkeys(d, **kw):\n return d.iterkeys(**kw)\n",
"def running_service_owners(\n exclude=('/dev', '/home', '/media', '/proc', '/run', '/sys/', '/tmp',\n '/var')\n ):\n '''\n Determine which packages own the currently running services. By default,\n excludes files whose fu... | # -*- coding: utf-8 -*-
'''
Functions to perform introspection on a minion, and return data in a format
usable by Salt States
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import os
# Import 3rd-party libs
from salt.ext import six
def running_service_owners(
... |
saltstack/salt | salt/roster/clustershell.py | targets | python | def targets(tgt, tgt_type='glob', **kwargs):
'''
Return the targets
'''
ret = {}
ports = __opts__['ssh_scan_ports']
if not isinstance(ports, list):
# Comma-separate list of integers
ports = list(map(int, six.text_type(ports).split(',')))
hosts = list(NodeSet(tgt))
host_a... | Return the targets | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/clustershell.py#L33-L59 | null | # -*- coding: utf-8 -*-
'''
This roster resolves hostname in a pdsh/clustershell style.
:depends: clustershell, https://github.com/cea-hpc/clustershell
When you want to use host globs for target matching, use ``--roster clustershell``. For example:
.. code-block:: bash
salt-ssh --roster clustershell 'server_[1-... |
saltstack/salt | salt/config/__init__.py | _gather_buffer_space | python | def _gather_buffer_space():
'''
Gather some system data and then calculate
buffer space.
Result is in bytes.
'''
if HAS_PSUTIL and psutil.version_info >= (0, 6, 0):
# Oh good, we have psutil. This will be quick.
total_mem = psutil.virtual_memory().total
else:
# Avoid... | Gather some system data and then calculate
buffer space.
Result is in bytes. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L76-L95 | null | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | _normalize_roots | python | def _normalize_roots(file_roots):
'''
Normalize file or pillar roots.
'''
for saltenv, dirs in six.iteritems(file_roots):
normalized_saltenv = six.text_type(saltenv)
if normalized_saltenv != saltenv:
file_roots[normalized_saltenv] = file_roots.pop(saltenv)
if not isin... | Normalize file or pillar roots. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L1956-L1968 | null | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | _validate_pillar_roots | python | def _validate_pillar_roots(pillar_roots):
'''
If the pillar_roots option has a key that is None then we will error out,
just replace it with an empty list
'''
if not isinstance(pillar_roots, dict):
log.warning('The pillar_roots parameter is not properly formatted,'
' usin... | If the pillar_roots option has a key that is None then we will error out,
just replace it with an empty list | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L1971-L1980 | [
"def _expand_glob_path(file_roots):\n '''\n Applies shell globbing to a set of directories and returns\n the expanded paths\n '''\n unglobbed_path = []\n for path in file_roots:\n try:\n if glob.has_magic(path):\n unglobbed_path.extend(glob.glob(path))\n ... | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | _validate_file_roots | python | def _validate_file_roots(file_roots):
'''
If the file_roots option has a key that is None then we will error out,
just replace it with an empty list
'''
if not isinstance(file_roots, dict):
log.warning('The file_roots parameter is not properly formatted,'
' using defaults... | If the file_roots option has a key that is None then we will error out,
just replace it with an empty list | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L1983-L1992 | [
"def _expand_glob_path(file_roots):\n '''\n Applies shell globbing to a set of directories and returns\n the expanded paths\n '''\n unglobbed_path = []\n for path in file_roots:\n try:\n if glob.has_magic(path):\n unglobbed_path.extend(glob.glob(path))\n ... | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | _expand_glob_path | python | def _expand_glob_path(file_roots):
'''
Applies shell globbing to a set of directories and returns
the expanded paths
'''
unglobbed_path = []
for path in file_roots:
try:
if glob.has_magic(path):
unglobbed_path.extend(glob.glob(path))
else:
... | Applies shell globbing to a set of directories and returns
the expanded paths | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L1995-L2009 | null | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | _validate_opts | python | def _validate_opts(opts):
'''
Check that all of the types of values passed into the config are
of the right types
'''
def format_multi_opt(valid_type):
try:
num_types = len(valid_type)
except TypeError:
# Bare type name won't have a length, return the name of ... | Check that all of the types of values passed into the config are
of the right types | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L2012-L2112 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def format_multi_opt(valid_type):\n try:\n num_types = len(valid_type)\n except TypeError:\n # Bare type name won't have a length, return the name of the type\n # passed.\n return valid_type.__name__\n else:\n ... | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | _validate_ssh_minion_opts | python | def _validate_ssh_minion_opts(opts):
'''
Ensure we're not using any invalid ssh_minion_opts. We want to make sure
that the ssh_minion_opts does not override any pillar or fileserver options
inherited from the master config. To add other items, modify the if
statement in the for loop below.
'''
... | Ensure we're not using any invalid ssh_minion_opts. We want to make sure
that the ssh_minion_opts does not override any pillar or fileserver options
inherited from the master config. To add other items, modify the if
statement in the for loop below. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L2115-L2135 | null | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | _append_domain | python | def _append_domain(opts):
'''
Append a domain to the existing id if it doesn't already exist
'''
# Domain already exists
if opts['id'].endswith(opts['append_domain']):
return opts['id']
# Trailing dot should mean an FQDN that is terminated, leave it alone.
if opts['id'].endswith('.')... | Append a domain to the existing id if it doesn't already exist | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L2138-L2148 | null | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | _read_conf_file | python | def _read_conf_file(path):
'''
Read in a config file from a given path and process it into a dictionary
'''
log.debug('Reading configuration from %s', path)
with salt.utils.files.fopen(path, 'r') as conf_file:
try:
conf_opts = salt.utils.yaml.safe_load(conf_file) or {}
ex... | Read in a config file from a given path and process it into a dictionary | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L2151-L2178 | [
"def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ... | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | _absolute_path | python | def _absolute_path(path, relative_to=None):
'''
Return an absolute path. In case ``relative_to`` is passed and ``path`` is
not an absolute path, we try to prepend ``relative_to`` to ``path``and if
that path exists, return that one
'''
if path and os.path.isabs(path):
return path
if ... | Return an absolute path. In case ``relative_to`` is passed and ``path`` is
not an absolute path, we try to prepend ``relative_to`` to ``path``and if
that path exists, return that one | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L2181-L2198 | null | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | load_config | python | def load_config(path, env_var, default_path=None, exit_on_config_errors=True):
'''
Returns configuration dict from parsing either the file described by
``path`` or the environment variable described by ``env_var`` as YAML.
'''
if path is None:
# When the passed path is None, we just want the... | Returns configuration dict from parsing either the file described by
``path`` or the environment variable described by ``env_var`` as YAML. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L2201-L2261 | [
"def _read_conf_file(path):\n '''\n Read in a config file from a given path and process it into a dictionary\n '''\n log.debug('Reading configuration from %s', path)\n with salt.utils.files.fopen(path, 'r') as conf_file:\n try:\n conf_opts = salt.utils.yaml.safe_load(conf_file) or {... | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | include_config | python | def include_config(include, orig_path, verbose, exit_on_config_errors=False):
'''
Parses extra configuration file(s) specified in an include list in the
main config file.
'''
# Protect against empty option
if not include:
return {}
if orig_path is None:
# When the passed pat... | Parses extra configuration file(s) specified in an include list in the
main config file. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L2264-L2318 | [
"def update(dest, upd, recursive_update=True, merge_lists=False):\n '''\n Recursive version of the default dict.update\n\n Merges upd recursively into dest\n\n If recursive_update=False, will use the classic dict.update, or fall back\n on a manual merge (helpful for non-dict types like FunctionWrappe... | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | prepend_root_dir | python | def prepend_root_dir(opts, path_options):
'''
Prepends the options that represent filesystem paths with value of the
'root_dir' option.
'''
root_dir = os.path.abspath(opts['root_dir'])
def_root_dir = salt.syspaths.ROOT_DIR.rstrip(os.sep)
for path_option in path_options:
if path_optio... | Prepends the options that represent filesystem paths with value of the
'root_dir' option. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L2321-L2367 | null | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | insert_system_path | python | def insert_system_path(opts, paths):
'''
Inserts path into python path taking into consideration 'root_dir' option.
'''
if isinstance(paths, six.string_types):
paths = [paths]
for path in paths:
path_options = {'path': path, 'root_dir': opts['root_dir']}
prepend_root_dir(path... | Inserts path into python path taking into consideration 'root_dir' option. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L2370-L2381 | [
"def prepend_root_dir(opts, path_options):\n '''\n Prepends the options that represent filesystem paths with value of the\n 'root_dir' option.\n '''\n root_dir = os.path.abspath(opts['root_dir'])\n def_root_dir = salt.syspaths.ROOT_DIR.rstrip(os.sep)\n for path_option in path_options:\n ... | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | minion_config | python | def minion_config(path,
env_var='SALT_MINION_CONFIG',
defaults=None,
cache_minion_id=False,
ignore_config_errors=True,
minion_id=None,
role='minion'):
'''
Reads in the minion configuration file and sets u... | Reads in the minion configuration file and sets up special options
This is useful for Minion-side operations, such as the
:py:class:`~salt.client.Caller` class, and manually running the loader
interface.
.. code-block:: python
import salt.config
minion_opts = salt.config.minion_config... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L2384-L2433 | [
"def include_config(include, orig_path, verbose, exit_on_config_errors=False):\n '''\n Parses extra configuration file(s) specified in an include list in the\n main config file.\n '''\n # Protect against empty option\n if not include:\n return {}\n\n if orig_path is None:\n # When... | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | apply_sdb | python | def apply_sdb(opts, sdb_opts=None):
'''
Recurse for sdb:// links for opts
'''
# Late load of SDB to keep CLI light
import salt.utils.sdb
if sdb_opts is None:
sdb_opts = opts
if isinstance(sdb_opts, six.string_types) and sdb_opts.startswith('sdb://'):
return salt.utils.sdb.sdb... | Recurse for sdb:// links for opts | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L2560-L2581 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def apply_sdb(opts, sdb_opts=None):\n '''\n Recurse for sdb:// links for opts\n '''\n # Late load of SDB to keep CLI light\n import salt.utils.sdb\n if sdb_opts is None:\n sdb_opts = opts\n if isinstance(sdb_opts, six.string_t... | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | cloud_config | python | def cloud_config(path=None, env_var='SALT_CLOUD_CONFIG', defaults=None,
master_config_path=None, master_config=None,
providers_config_path=None, providers_config=None,
profiles_config_path=None, profiles_config=None):
'''
Read in the Salt Cloud config and retur... | Read in the Salt Cloud config and return the dict | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L2585-L2810 | [
"def master_config(path, env_var='SALT_MASTER_CONFIG', defaults=None, exit_on_config_errors=False):\n '''\n Reads in the master configuration file and sets up default options\n\n This is useful for running the actual master daemon. For running\n Master-side client interfaces that need the master opts se... | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | apply_cloud_config | python | def apply_cloud_config(overrides, defaults=None):
'''
Return a cloud config
'''
if defaults is None:
defaults = DEFAULT_CLOUD_OPTS.copy()
config = defaults.copy()
if overrides:
config.update(overrides)
# If the user defined providers in salt cloud's main configuration file,... | Return a cloud config | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L2813-L2877 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def old_to_new(opts):\n providers = (\n 'AWS',\n 'CLOUDSTACK',\n 'DIGITALOCEAN',\n 'EC2',\n 'GOGRID',\n 'IBMSCE',\n 'JOYENT',\n 'LINODE',\n 'OPENSTACK',\n 'PARALLELS'\n 'RACK... | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | vm_profiles_config | python | def vm_profiles_config(path,
providers,
env_var='SALT_CLOUDVM_CONFIG',
defaults=None):
'''
Read in the salt cloud VM config file
'''
if defaults is None:
defaults = VM_CONFIG_DEFAULTS
overrides = salt.config.load_config(
... | Read in the salt cloud VM config file | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L2916-L2941 | [
"def include_config(include, orig_path, verbose, exit_on_config_errors=False):\n '''\n Parses extra configuration file(s) specified in an include list in the\n main config file.\n '''\n # Protect against empty option\n if not include:\n return {}\n\n if orig_path is None:\n # When... | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | cloud_providers_config | python | def cloud_providers_config(path,
env_var='SALT_CLOUD_PROVIDERS_CONFIG',
defaults=None):
'''
Read in the salt cloud providers configuration file
'''
if defaults is None:
defaults = PROVIDER_CONFIG_DEFAULTS
overrides = salt.config.load_con... | Read in the salt cloud providers configuration file | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3057-L3081 | [
"def include_config(include, orig_path, verbose, exit_on_config_errors=False):\n '''\n Parses extra configuration file(s) specified in an include list in the\n main config file.\n '''\n # Protect against empty option\n if not include:\n return {}\n\n if orig_path is None:\n # When... | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | apply_cloud_providers_config | python | 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. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3084-L3287 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def update(dest, upd, recursive_update=True, merge_lists=False):\n '''\n Recursive version of the default dict.update\n\n Merges upd recursively into dest\n\n If recursive_update=False, will use the classic dict.update, or fall back\n on a... | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | get_cloud_config_value | python | 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:
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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3290-L3364 | null | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | is_provider_configured | python | 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. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3367-L3421 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n"
] | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | is_profile_configured | python | 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.
Required parameters include image and provider for all drivers, while some
drivers also require size keys.
.. versionadded:: 2015.8.0 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3424-L3499 | null | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | check_driver_dependencies | python | 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.
.. versionadded:: 2015.8.0
driver
The name of the driver.
dependencies
The dictionary of dependencies to check. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3502-L3523 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n"
] | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | _cache_id | python | 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. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3528-L3547 | null | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | call_id_function | python | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3550-L3600 | null | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | remove_domain_from_fqdn | python | 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. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3603-L3620 | null | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | get_id | python | 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.
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 ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3623-L3690 | [
"def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ... | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | _update_ssl_config | python | 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. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3693-L3714 | null | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | _adjust_log_file_override | python | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3717-L3732 | null | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | apply_minion_config | python | 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. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3735-L3864 | [
"def to_unicode(s, encoding=None, errors='strict', normalize=False):\n '''\n Given str or unicode, return unicode (str for python 3)\n '''\n def _normalize(s):\n return unicodedata.normalize('NFC', s) if normalize else s\n\n if encoding is None:\n # Try utf-8 first, and fall back to det... | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | _update_discovery_config | python | 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.
:param opts:
:return: | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3867-L3884 | null | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | master_config | python | 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
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`. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3887-L3930 | [
"def include_config(include, orig_path, verbose, exit_on_config_errors=False):\n '''\n Parses extra configuration file(s) specified in an include list in the\n main config file.\n '''\n # Protect against empty option\n if not include:\n return {}\n\n if orig_path is None:\n # When... | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | apply_master_config | python | 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. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L3933-L4089 | [
"def encode(data, encoding=None, errors='strict', keep=False,\n preserve_dict_class=False, preserve_tuples=False):\n '''\n Generic function which will encode whichever type is passed, if necessary\n\n If `strict` is True, and `keep` is False, and we fail to encode, a\n UnicodeEncodeError will ... | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | client_config | python | 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
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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L4092-L4171 | [
"def ip_bracket(addr):\n '''\n Convert IP address representation to ZMQ (URL) format. ZMQ expects\n brackets around IPv6 literals, since they are used in URLs.\n '''\n addr = ipaddress.ip_address(addr)\n return ('[{}]' if addr.version == 6 else '{}').format(addr)\n",
"def fopen(*args, **kwargs):... | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | api_config | python | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L4174-L4197 | [
"def client_config(path, env_var='SALT_CLIENT_CONFIG', defaults=None):\n '''\n Load Master configuration data\n\n Usage:\n\n .. code-block:: python\n\n import salt.config\n master_opts = salt.config.client_config('/etc/salt/master')\n\n Returns a dictionary of the Salt Master configurat... | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | spm_config | python | 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
.. versionadded:: 2015.8.0 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L4200-L4221 | [
"def include_config(include, orig_path, verbose, exit_on_config_errors=False):\n '''\n Parses extra configuration file(s) specified in an include list in the\n main config file.\n '''\n # Protect against empty option\n if not include:\n return {}\n\n if orig_path is None:\n # When... | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/config/__init__.py | apply_spm_config | python | 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.
.. versionadded:: 2015.8.1 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L4224-L4251 | [
"def prepend_root_dir(opts, path_options):\n '''\n Prepends the options that represent filesystem paths with value of the\n 'root_dir' option.\n '''\n root_dir = os.path.abspath(opts['root_dir'])\n def_root_dir = salt.syspaths.ROOT_DIR.rstrip(os.sep)\n for path_option in path_options:\n ... | # -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals, generators
import os
import re
import sys
import glob
import time
import codecs
import logging
import types
from copy impor... |
saltstack/salt | salt/pillar/pillar_ldap.py | _render_template | python | 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. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/pillar_ldap.py#L156-L163 | null | # -*- coding: utf-8 -*-
'''
Use LDAP data as a Pillar source
This pillar module executes a series of LDAP searches.
Data returned by these searches are aggregated, whereby data returned by later
searches override data by previous searches with the same key.
The final result is merged with existing pillar data.
The c... |
saltstack/salt | salt/pillar/pillar_ldap.py | _config | python | 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 str type under python 2. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/pillar_ldap.py#L166-L176 | [
"def decode(data, encoding=None, errors='strict', keep=False,\n normalize=False, preserve_dict_class=False, preserve_tuples=False,\n to_str=False):\n '''\n Generic function which will decode whichever type is passed, if necessary.\n Optionally use to_str=True to ensure strings are str t... | # -*- coding: utf-8 -*-
'''
Use LDAP data as a Pillar source
This pillar module executes a series of LDAP searches.
Data returned by these searches are aggregated, whereby data returned by later
searches override data by previous searches with the same key.
The final result is merged with existing pillar data.
The c... |
saltstack/salt | salt/pillar/pillar_ldap.py | _result_to_dict | python | 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.
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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/pillar_ldap.py#L179-L267 | null | # -*- coding: utf-8 -*-
'''
Use LDAP data as a Pillar source
This pillar module executes a series of LDAP searches.
Data returned by these searches are aggregated, whereby data returned by later
searches override data by previous searches with the same key.
The final result is merged with existing pillar data.
The c... |
saltstack/salt | salt/pillar/pillar_ldap.py | _do_search | python | 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. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/pillar_ldap.py#L270-L306 | null | # -*- coding: utf-8 -*-
'''
Use LDAP data as a Pillar source
This pillar module executes a series of LDAP searches.
Data returned by these searches are aggregated, whereby data returned by later
searches override data by previous searches with the same key.
The final result is merged with existing pillar data.
The c... |
saltstack/salt | salt/pillar/pillar_ldap.py | ext_pillar | python | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/pillar_ldap.py#L309-L365 | [
"def safe_load(stream, Loader=SaltYamlSafeLoader):\n '''\n .. versionadded:: 2018.3.0\n\n Helper function which automagically uses our custom loader.\n '''\n return yaml.load(stream, Loader=Loader)\n",
"def is_console_configured():\n return __CONSOLE_CONFIGURED\n",
"def _render_template(config... | # -*- coding: utf-8 -*-
'''
Use LDAP data as a Pillar source
This pillar module executes a series of LDAP searches.
Data returned by these searches are aggregated, whereby data returned by later
searches override data by previous searches with the same key.
The final result is merged with existing pillar data.
The c... |
saltstack/salt | salt/states/win_pki.py | import_cert | python | 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.
: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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_pki.py#L30-L101 | null | # -*- coding: utf-8 -*-
'''
Microsoft certificate management via the Pki PowerShell module.
:platform: Windows
.. versionadded:: 2016.11.0
'''
# Import python libs
from __future__ import absolute_import, unicode_literals, print_function
_DEFAULT_CONTEXT = 'LocalMachine'
_DEFAULT_FORMAT = 'cer'
_DEFAULT_STORE =... |
saltstack/salt | salt/states/win_pki.py | remove_cert | python | 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.
: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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_pki.py#L104-L157 | null | # -*- coding: utf-8 -*-
'''
Microsoft certificate management via the Pki PowerShell module.
:platform: Windows
.. versionadded:: 2016.11.0
'''
# Import python libs
from __future__ import absolute_import, unicode_literals, print_function
_DEFAULT_CONTEXT = 'LocalMachine'
_DEFAULT_FORMAT = 'cer'
_DEFAULT_STORE =... |
saltstack/salt | salt/sdb/etcd_db.py | set_ | python | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/etcd_db.py#L63-L69 | [
"def get(key, service=None, profile=None): # pylint: disable=W0613\n '''\n Get a value from the etcd service\n '''\n client = _get_conn(profile)\n result = client.get(key)\n return result.value\n",
"def _get_conn(profile):\n '''\n Get a connection\n '''\n return salt.utils.etcd_util... | # -*- coding: utf-8 -*-
'''
etcd Database Module
:maintainer: SaltStack
:maturity: New
:depends: python-etcd
:platform: all
.. versionadded:: 2015.5.0
This module allows access to the etcd database using an ``sdb://`` URI. This
package is located at ``https://pypi.python.org/pypi/python-etcd``.
L... |
saltstack/salt | salt/sdb/etcd_db.py | get | python | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/etcd_db.py#L72-L78 | [
"def _get_conn(profile):\n '''\n Get a connection\n '''\n return salt.utils.etcd_util.get_conn(profile)\n"
] | # -*- coding: utf-8 -*-
'''
etcd Database Module
:maintainer: SaltStack
:maturity: New
:depends: python-etcd
:platform: all
.. versionadded:: 2015.5.0
This module allows access to the etcd database using an ``sdb://`` URI. This
package is located at ``https://pypi.python.org/pypi/python-etcd``.
L... |
saltstack/salt | salt/sdb/etcd_db.py | delete | python | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/etcd_db.py#L81-L90 | [
"def _get_conn(profile):\n '''\n Get a connection\n '''\n return salt.utils.etcd_util.get_conn(profile)\n"
] | # -*- coding: utf-8 -*-
'''
etcd Database Module
:maintainer: SaltStack
:maturity: New
:depends: python-etcd
:platform: all
.. versionadded:: 2015.5.0
This module allows access to the etcd database using an ``sdb://`` URI. This
package is located at ``https://pypi.python.org/pypi/python-etcd``.
L... |
saltstack/salt | salt/states/nftables.py | chain_present | python | 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
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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/nftables.py#L129-L180 | null | # -*- coding: utf-8 -*-
'''
Management of nftables
======================
This is an nftables-specific module designed to manage Linux firewalls. It is
expected that this state module, and other system-specific firewall states, may
at some point be deprecated in favor of a more generic `firewall` state.
.. code-block... |
saltstack/salt | salt/states/nftables.py | chain_absent | python | 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
Verify the chain is absent.
family
Networking family, either ipv4 or ipv6 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/nftables.py#L183-L225 | null | # -*- coding: utf-8 -*-
'''
Management of nftables
======================
This is an nftables-specific module designed to manage Linux firewalls. It is
expected that this state module, and other system-specific firewall states, may
at some point be deprecated in favor of a more generic `firewall` state.
.. code-block... |
saltstack/salt | salt/states/nftables.py | append | python | 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
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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/nftables.py#L228-L305 | null | # -*- coding: utf-8 -*-
'''
Management of nftables
======================
This is an nftables-specific module designed to manage Linux firewalls. It is
expected that this state module, and other system-specific firewall states, may
at some point be deprecated in favor of a more generic `firewall` state.
.. code-block... |
saltstack/salt | salt/states/nftables.py | flush | python | 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
Flush current nftables state
family
Networking family, either ipv4 or ipv6 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/nftables.py#L480-L541 | null | # -*- coding: utf-8 -*-
'''
Management of nftables
======================
This is an nftables-specific module designed to manage Linux firewalls. It is
expected that this state module, and other system-specific firewall states, may
at some point be deprecated in favor of a more generic `firewall` state.
.. code-block... |
saltstack/salt | salt/modules/riak.py | __execute_cmd | python | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/riak.py#L20-L26 | null | # -*- coding: utf-8 -*-
'''
Riak Salt Module
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import salt libs
import salt.utils.path
def __virtual__():
'''
Only available on systems with Riak installed.
'''
if salt.utils.path.which('riak'):
return True
retur... |
saltstack/salt | salt/modules/riak.py | start | python | 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
CLI Example:
.. code-block:: bash
salt '*' riak.start | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/riak.py#L29-L49 | [
"def __execute_cmd(name, cmd):\n '''\n Execute Riak commands\n '''\n return __salt__['cmd.run_all'](\n '{0} {1}'.format(salt.utils.path.which(name), cmd)\n )\n"
] | # -*- coding: utf-8 -*-
'''
Riak Salt Module
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import salt libs
import salt.utils.path
def __virtual__():
'''
Only available on systems with Riak installed.
'''
if salt.utils.path.which('riak'):
return True
retur... |
saltstack/salt | salt/modules/riak.py | stop | python | 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
.. versionchanged:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' riak.stop | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/riak.py#L52-L74 | [
"def __execute_cmd(name, cmd):\n '''\n Execute Riak commands\n '''\n return __salt__['cmd.run_all'](\n '{0} {1}'.format(salt.utils.path.which(name), cmd)\n )\n"
] | # -*- coding: utf-8 -*-
'''
Riak Salt Module
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import salt libs
import salt.utils.path
def __virtual__():
'''
Only available on systems with Riak installed.
'''
if salt.utils.path.which('riak'):
return True
retur... |
saltstack/salt | salt/modules/riak.py | cluster_join | python | 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
.. 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/riak.py#L77-L104 | [
"def __execute_cmd(name, cmd):\n '''\n Execute Riak commands\n '''\n return __salt__['cmd.run_all'](\n '{0} {1}'.format(salt.utils.path.which(name), cmd)\n )\n"
] | # -*- coding: utf-8 -*-
'''
Riak Salt Module
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import salt libs
import salt.utils.path
def __virtual__():
'''
Only available on systems with Riak installed.
'''
if salt.utils.path.which('riak'):
return True
retur... |
saltstack/salt | salt/modules/riak.py | cluster_commit | python | 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
.. versionchanged:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' riak.cluster_commit | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/riak.py#L157-L179 | [
"def __execute_cmd(name, cmd):\n '''\n Execute Riak commands\n '''\n return __salt__['cmd.run_all'](\n '{0} {1}'.format(salt.utils.path.which(name), cmd)\n )\n"
] | # -*- coding: utf-8 -*-
'''
Riak Salt Module
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import salt libs
import salt.utils.path
def __virtual__():
'''
Only available on systems with Riak installed.
'''
if salt.utils.path.which('riak'):
return True
retur... |
saltstack/salt | salt/modules/riak.py | member_status | python | 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
.. versionchanged:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' riak.member_status | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/riak.py#L182-L223 | [
"def __execute_cmd(name, cmd):\n '''\n Execute Riak commands\n '''\n return __salt__['cmd.run_all'](\n '{0} {1}'.format(salt.utils.path.which(name), cmd)\n )\n"
] | # -*- coding: utf-8 -*-
'''
Riak Salt Module
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import salt libs
import salt.utils.path
def __virtual__():
'''
Only available on systems with Riak installed.
'''
if salt.utils.path.which('riak'):
return True
retur... |
saltstack/salt | salt/modules/riak.py | status | python | 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
.. versionadded:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' riak.status | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/riak.py#L226-L247 | [
"def __execute_cmd(name, cmd):\n '''\n Execute Riak commands\n '''\n return __salt__['cmd.run_all'](\n '{0} {1}'.format(salt.utils.path.which(name), cmd)\n )\n"
] | # -*- coding: utf-8 -*-
'''
Riak Salt Module
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import salt libs
import salt.utils.path
def __virtual__():
'''
Only available on systems with Riak installed.
'''
if salt.utils.path.which('riak'):
return True
retur... |
saltstack/salt | salt/states/portage_config.py | flags | python | 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.
.. 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 ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/portage_config.py#L63-L168 | [
"def _flags_helper(conf, atom, new_flags, test=False):\n try:\n new_flags = __salt__['portage_config.get_missing_flags'](conf, atom, new_flags)\n except Exception:\n import traceback\n return {'result': False, 'comment': traceback.format_exc()}\n if new_flags:\n old_flags = __sa... | # -*- coding: utf-8 -*-
'''
Management of Portage package configuration on Gentoo
=====================================================
A state module to manage Portage configuration on Gentoo
.. code-block:: yaml
salt:
portage_config.flags:
- use:
- openssl
'''
from __future_... |
saltstack/salt | salt/modules/webutil.py | useradd | python | 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.
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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/webutil.py#L33-L70 | null | # -*- coding: utf-8 -*-
'''
Support for htpasswd command. Requires the apache2-utils package for Debian-based distros.
.. versionadded:: 2014.1.0
The functions here will load inside the webutil module. This allows other
functions that don't use htpasswd to use the webutil module name.
'''
# Import Python libs
from _... |
saltstack/salt | salt/modules/webutil.py | userdel | python | 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.
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 '*... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/webutil.py#L73-L106 | null | # -*- coding: utf-8 -*-
'''
Support for htpasswd command. Requires the apache2-utils package for Debian-based distros.
.. versionadded:: 2014.1.0
The functions here will load inside the webutil module. This allows other
functions that don't use htpasswd to use the webutil module name.
'''
# Import Python libs
from _... |
saltstack/salt | salt/modules/webutil.py | verify | python | 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.
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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/webutil.py#L109-L148 | null | # -*- coding: utf-8 -*-
'''
Support for htpasswd command. Requires the apache2-utils package for Debian-based distros.
.. versionadded:: 2014.1.0
The functions here will load inside the webutil module. This allows other
functions that don't use htpasswd to use the webutil module name.
'''
# Import Python libs
from _... |
saltstack/salt | salt/utils/win_functions.py | is_admin | python | 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
Args:
name (str): The name to check
Returns:
bool: True if user is a member of the Administrators group, False
otherwise | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_functions.py#L51-L68 | [
"def get_user_groups(name, sid=False):\n '''\n Get the groups to which a user belongs\n\n Args:\n name (str): The user name to query\n sid (bool): True will return a list of SIDs, False will return a list of\n group names\n\n Returns:\n list: A list of group names or sids\n ... | # -*- coding: utf-8 -*-
'''
Various functions to be used by windows during start up and to monkey patch
missing functions in other modules
'''
from __future__ import absolute_import, print_function, unicode_literals
import platform
import re
import ctypes
# Import Salt Libs
from salt.exceptions import CommandExecution... |
saltstack/salt | salt/utils/win_functions.py | get_user_groups | python | 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
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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_functions.py#L71-L96 | [
"def get_sid_from_name(name):\n '''\n This is a tool for getting a sid from a name. The name can be any object.\n Usually a user or a group\n\n Args:\n name (str): The name of the user or group for which to get the sid\n\n Returns:\n str: The corresponding SID\n '''\n # If None is... | # -*- coding: utf-8 -*-
'''
Various functions to be used by windows during start up and to monkey patch
missing functions in other modules
'''
from __future__ import absolute_import, print_function, unicode_literals
import platform
import re
import ctypes
# Import Salt Libs
from salt.exceptions import CommandExecution... |
saltstack/salt | salt/utils/win_functions.py | get_sid_from_name | python | 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
Args:
name (str): The name of the user or group for which to get the sid
Returns:
str: The corresponding SID | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_functions.py#L99-L120 | null | # -*- coding: utf-8 -*-
'''
Various functions to be used by windows during start up and to monkey patch
missing functions in other modules
'''
from __future__ import absolute_import, print_function, unicode_literals
import platform
import re
import ctypes
# Import Salt Libs
from salt.exceptions import CommandExecution... |
saltstack/salt | salt/utils/win_functions.py | get_current_user | python | 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
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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_functions.py#L123-L155 | [
"def get_sid_from_name(name):\n '''\n This is a tool for getting a sid from a name. The name can be any object.\n Usually a user or a group\n\n Args:\n name (str): The name of the user or group for which to get the sid\n\n Returns:\n str: The corresponding SID\n '''\n # If None is... | # -*- coding: utf-8 -*-
'''
Various functions to be used by windows during start up and to monkey patch
missing functions in other modules
'''
from __future__ import absolute_import, print_function, unicode_literals
import platform
import re
import ctypes
# Import Salt Libs
from salt.exceptions import CommandExecution... |
saltstack/salt | salt/utils/win_functions.py | get_sam_name | python | 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 will be returned using the local hostname as the domain.
i.e. salt.utils.get_same_name('Administrator') would return 'DOMAIN.COM\Administrato... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_functions.py#L158-L173 | null | # -*- coding: utf-8 -*-
'''
Various functions to be used by windows during start up and to monkey patch
missing functions in other modules
'''
from __future__ import absolute_import, print_function, unicode_literals
import platform
import re
import ctypes
# Import Salt Libs
from salt.exceptions import CommandExecution... |
saltstack/salt | salt/utils/win_functions.py | escape_argument | python | 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-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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_functions.py#L185-L209 | [
"def escape_for_cmd_exe(arg):\n '''\n Escape an argument string to be suitable to be passed to\n cmd.exe on Windows\n\n This method takes an argument that is expected to already be properly\n escaped for the receiving program to be properly parsed. This argument\n will be further escaped to pass t... | # -*- coding: utf-8 -*-
'''
Various functions to be used by windows during start up and to monkey patch
missing functions in other modules
'''
from __future__ import absolute_import, print_function, unicode_literals
import platform
import re
import ctypes
# Import Salt Libs
from salt.exceptions import CommandExecution... |
saltstack/salt | salt/utils/win_functions.py | escape_for_cmd_exe | python | 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
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.
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_functions.py#L212-L239 | null | # -*- coding: utf-8 -*-
'''
Various functions to be used by windows during start up and to monkey patch
missing functions in other modules
'''
from __future__ import absolute_import, print_function, unicode_literals
import platform
import re
import ctypes
# Import Salt Libs
from salt.exceptions import CommandExecution... |
saltstack/salt | salt/utils/win_functions.py | broadcast_setting_change | python | 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
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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_functions.py#L242-L308 | null | # -*- coding: utf-8 -*-
'''
Various functions to be used by windows during start up and to monkey patch
missing functions in other modules
'''
from __future__ import absolute_import, print_function, unicode_literals
import platform
import re
import ctypes
# Import Salt Libs
from salt.exceptions import CommandExecution... |
saltstack/salt | salt/utils/win_functions.py | guid_to_squid | python | 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)
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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_functions.py#L311-L339 | null | # -*- coding: utf-8 -*-
'''
Various functions to be used by windows during start up and to monkey patch
missing functions in other modules
'''
from __future__ import absolute_import, print_function, unicode_literals
import platform
import re
import ctypes
# Import Salt Libs
from salt.exceptions import CommandExecution... |
saltstack/salt | salt/utils/win_functions.py | squid_to_guid | python | 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
Args:
squid (str): A valid compressed GUID
Returns:
str: A valid GUID | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_functions.py#L342-L365 | null | # -*- coding: utf-8 -*-
'''
Various functions to be used by windows during start up and to monkey patch
missing functions in other modules
'''
from __future__ import absolute_import, print_function, unicode_literals
import platform
import re
import ctypes
# Import Salt Libs
from salt.exceptions import CommandExecution... |
saltstack/salt | salt/runners/mine.py | get | python | 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
CLI Example:
.. code-block:: bash
salt-run mine.get '*' network.interfaces | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/mine.py#L16-L28 | [
"def mine_get(tgt, fun, tgt_type='glob', opts=None):\n '''\n Gathers the data from the specified minions' mine, pass in the target,\n function to look up and the target type\n '''\n ret = {}\n serial = salt.payload.Serial(opts)\n checker = CkMinions(opts)\n _res = checker.check_minions(\n ... | # -*- coding: utf-8 -*-
'''
A runner to access data from the salt mine
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import Python Libs
import logging
# Import salt libs
import salt.utils.minions
log = logging.getLevelName(__name__)
def update(tgt,
tgt_type='glob',
... |
saltstack/salt | salt/runners/mine.py | update | python | 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
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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/mine.py#L31-L69 | null | # -*- coding: utf-8 -*-
'''
A runner to access data from the salt mine
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import Python Libs
import logging
# Import salt libs
import salt.utils.minions
log = logging.getLevelName(__name__)
def get(tgt, fun, tgt_type='glob'):
'''
G... |
saltstack/salt | salt/utils/nxos.py | nxapi_request | python | 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.
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.
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nxos.py#L271-L313 | [
"def request(self, type, command_list):\n '''\n Send NX-API JSON request to the NX-OS device.\n '''\n req = self._build_request(type, command_list)\n if self.nxargs['connect_over_uds']:\n self.connection.request('POST', req['url'], req['payload'], req['headers'])\n response = self.conne... | # -*- coding: utf-8 -*-
# Copyright (c) 2018 Cisco and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
saltstack/salt | salt/utils/nxos.py | system_info | python | 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. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nxos.py#L372-L384 | [
"def _parse_software(data):\n '''\n Internal helper function to parse sotware grain information.\n '''\n ret = {'software': {}}\n software = _parser('Software').search(data).group(0)\n matcher = re.compile('^ ([^:]+): *([^\\n]+)', re.MULTILINE)\n for line in matcher.finditer(software):\n ... | # -*- coding: utf-8 -*-
# Copyright (c) 2018 Cisco and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
saltstack/salt | salt/utils/nxos.py | NxapiClient._use_remote_connection | python | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nxos.py#L107-L119 | null | class NxapiClient(object):
'''
Class representing an NX-API client that connects over http(s) or
unix domain socket (UDS).
'''
# Location of unix domain socket for NX-API localhost
NXAPI_UDS = '/tmp/nginx_local/nginx_1_be_nxapi.sock'
# NXAPI listens for remote connections to "http(s)://<swi... |
saltstack/salt | salt/utils/nxos.py | NxapiClient._prepare_conn_args | python | 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. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nxos.py#L121-L140 | [
"def _use_remote_connection(self, kwargs):\n '''\n Determine if connection is local or remote\n '''\n kwargs['host'] = kwargs.get('host')\n kwargs['username'] = kwargs.get('username')\n kwargs['password'] = kwargs.get('password')\n if kwargs['host'] is None or \\\n kwargs['username'] is N... | class NxapiClient(object):
'''
Class representing an NX-API client that connects over http(s) or
unix domain socket (UDS).
'''
# Location of unix domain socket for NX-API localhost
NXAPI_UDS = '/tmp/nginx_local/nginx_1_be_nxapi.sock'
# NXAPI listens for remote connections to "http(s)://<swi... |
saltstack/salt | salt/utils/nxos.py | NxapiClient._build_request | python | 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. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nxos.py#L142-L179 | null | class NxapiClient(object):
'''
Class representing an NX-API client that connects over http(s) or
unix domain socket (UDS).
'''
# Location of unix domain socket for NX-API localhost
NXAPI_UDS = '/tmp/nginx_local/nginx_1_be_nxapi.sock'
# NXAPI listens for remote connections to "http(s)://<swi... |
saltstack/salt | salt/utils/nxos.py | NxapiClient.request | python | 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. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nxos.py#L181-L199 | [
"def _build_request(self, type, commands):\n '''\n Build NX-API JSON request.\n '''\n request = {}\n headers = {\n 'content-type': 'application/json',\n }\n if self.nxargs['connect_over_uds']:\n user = self.nxargs['cookie']\n headers['cookie'] = 'nxapi_auth=' + user + ':loc... | class NxapiClient(object):
'''
Class representing an NX-API client that connects over http(s) or
unix domain socket (UDS).
'''
# Location of unix domain socket for NX-API localhost
NXAPI_UDS = '/tmp/nginx_local/nginx_1_be_nxapi.sock'
# NXAPI listens for remote connections to "http(s)://<swi... |
saltstack/salt | salt/utils/nxos.py | NxapiClient.parse_response | python | 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. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nxos.py#L201-L268 | null | class NxapiClient(object):
'''
Class representing an NX-API client that connects over http(s) or
unix domain socket (UDS).
'''
# Location of unix domain socket for NX-API localhost
NXAPI_UDS = '/tmp/nginx_local/nginx_1_be_nxapi.sock'
# NXAPI listens for remote connections to "http(s)://<swi... |
saltstack/salt | salt/utils/powershell.py | get_modules | python | 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-Object -Expand Name``, without the delay of loading
PowerShell to do so.
Returns:
list: A list of modules available to Powershell... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/powershell.py#L46-L124 | [
"def os_walk(top, *args, **kwargs):\n '''\n This is a helper than ensures that all paths returned from os.walk are\n unicode.\n '''\n if six.PY2 and salt.utils.platform.is_windows():\n top_query = top\n else:\n top_query = salt.utils.stringutils.to_str(top)\n for item in os.walk(t... | # -*- coding: utf-8 -*-
'''
Common functions for working with powershell
.. note:: The PSModulePath environment variable should be set to the default
location for PowerShell modules. This applies to all OS'es that support
powershell. If not set, then Salt will attempt to use some default paths.
If Salt can... |
saltstack/salt | salt/modules/icinga2.py | generate_cert | python | 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.
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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/icinga2.py#L53-L68 | [
"def get_certs_path():\n icinga2_output = __salt__['cmd.run_all']([salt.utils.path.which('icinga2'),\n \"--version\"], python_shell=False)\n version = re.search(r'r\\d+\\.\\d+', icinga2_output['stdout']).group(0)\n # Return new certs path for icinga2 >= 2.8\n ... | # -*- coding: utf-8 -*-
'''
Module to provide icinga2 compatibility to salt.
.. versionadded:: 2017.7.0
:depends: - icinga2 server
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import Salt libs
import salt.utils.path
import salt.utils.platform
f... |
saltstack/salt | salt/modules/icinga2.py | save_cert | python | 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.
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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/icinga2.py#L71-L87 | [
"def get_certs_path():\n icinga2_output = __salt__['cmd.run_all']([salt.utils.path.which('icinga2'),\n \"--version\"], python_shell=False)\n version = re.search(r'r\\d+\\.\\d+', icinga2_output['stdout']).group(0)\n # Return new certs path for icinga2 >= 2.8\n ... | # -*- coding: utf-8 -*-
'''
Module to provide icinga2 compatibility to salt.
.. versionadded:: 2017.7.0
:depends: - icinga2 server
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import Salt libs
import salt.utils.path
import salt.utils.platform
f... |
saltstack/salt | salt/modules/icinga2.py | request_cert | python | 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.
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
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/icinga2.py#L90-L107 | [
"def get_certs_path():\n icinga2_output = __salt__['cmd.run_all']([salt.utils.path.which('icinga2'),\n \"--version\"], python_shell=False)\n version = re.search(r'r\\d+\\.\\d+', icinga2_output['stdout']).group(0)\n # Return new certs path for icinga2 >= 2.8\n ... | # -*- coding: utf-8 -*-
'''
Module to provide icinga2 compatibility to salt.
.. versionadded:: 2017.7.0
:depends: - icinga2 server
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import Salt libs
import salt.utils.path
import salt.utils.platform
f... |
saltstack/salt | salt/modules/icinga2.py | node_setup | python | 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.
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.... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/icinga2.py#L110-L127 | [
"def get_certs_path():\n icinga2_output = __salt__['cmd.run_all']([salt.utils.path.which('icinga2'),\n \"--version\"], python_shell=False)\n version = re.search(r'r\\d+\\.\\d+', icinga2_output['stdout']).group(0)\n # Return new certs path for icinga2 >= 2.8\n ... | # -*- coding: utf-8 -*-
'''
Module to provide icinga2 compatibility to salt.
.. versionadded:: 2017.7.0
:depends: - icinga2 server
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import Salt libs
import salt.utils.path
import salt.utils.platform
f... |
saltstack/salt | salt/roster/terraform.py | _handle_salt_host_resource | python | 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
Returns roster attributes for the resource or None | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/terraform.py#L83-L96 | null | # -*- coding: utf-8 -*-
'''
Dynamic roster from terraform current state
===========================================
This roster module allows you dynamically generate the roster from the terraform
resources defined with the `Terraform Salt`_ provider.
It exposes all salt_host resources with the same attributes to the... |
saltstack/salt | salt/roster/terraform.py | _add_ssh_key | python | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/terraform.py#L99-L116 | null | # -*- coding: utf-8 -*-
'''
Dynamic roster from terraform current state
===========================================
This roster module allows you dynamically generate the roster from the terraform
resources defined with the `Terraform Salt`_ provider.
It exposes all salt_host resources with the same attributes to the... |
saltstack/salt | salt/roster/terraform.py | _cast_output_to_type | python | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/terraform.py#L119-L125 | null | # -*- coding: utf-8 -*-
'''
Dynamic roster from terraform current state
===========================================
This roster module allows you dynamically generate the roster from the terraform
resources defined with the `Terraform Salt`_ provider.
It exposes all salt_host resources with the same attributes to the... |
saltstack/salt | salt/roster/terraform.py | _parse_state_file | python | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/terraform.py#L128-L159 | null | # -*- coding: utf-8 -*-
'''
Dynamic roster from terraform current state
===========================================
This roster module allows you dynamically generate the roster from the terraform
resources defined with the `Terraform Salt`_ provider.
It exposes all salt_host resources with the same attributes to the... |
saltstack/salt | salt/roster/terraform.py | targets | python | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/terraform.py#L162-L182 | null | # -*- coding: utf-8 -*-
'''
Dynamic roster from terraform current state
===========================================
This roster module allows you dynamically generate the roster from the terraform
resources defined with the `Terraform Salt`_ provider.
It exposes all salt_host resources with the same attributes to the... |
saltstack/salt | salt/states/win_powercfg.py | set_timeout | python | 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.
Args:
name (str)
The setting to change, can be one of the following:
- ``monitor``
- ``disk``
- ``standby``
- ``hibernate``
value (int):
Th... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_powercfg.py#L40-L150 | null | # -*- coding: utf-8 -*-
'''
This module allows you to control the power settings of a windows minion via
powercfg.
.. versionadded:: 2015.8.0
.. code-block:: yaml
# Set timeout to 30 minutes on battery power
monitor:
powercfg.set_timeout:
- value: 30
- power: dc
'''
# Import... |
saltstack/salt | salt/minion.py | resolve_dns | python | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L133-L242 | null | # -*- coding: utf-8 -*-
'''
Routines to set up a minion
'''
# Import python libs
from __future__ import absolute_import, print_function, with_statement, unicode_literals
import functools
import os
import sys
import copy
import time
import types
import signal
import random
import logging
import threading
import tracebac... |
saltstack/salt | salt/minion.py | prep_ip_port | python | 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 integer
e.g.:
- master: 'localhost:1234' -> {'master': 'localhost', 'master_port': 1234}
- master: '127.0.0.1:1234' -> {'master': '127.... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L245-L269 | [
"def parse_host_port(host_port):\n \"\"\"\n Takes a string argument specifying host or host:port.\n\n Returns a (hostname, port) or (ip_address, port) tuple. If no port is given,\n the second (port) element of the returned tuple will be None.\n\n host:port argument, for example, is accepted in the fo... | # -*- coding: utf-8 -*-
'''
Routines to set up a minion
'''
# Import python libs
from __future__ import absolute_import, print_function, with_statement, unicode_literals
import functools
import os
import sys
import copy
import time
import types
import signal
import random
import logging
import threading
import tracebac... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.