INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Ensures that the given application is deployed on server. | def deployed(name, jboss_config, salt_source=None):
'''Ensures that the given application is deployed on server.
jboss_config:
Dict with connection properties (see state description)
salt_source:
How to find the artifact to be deployed.
target_file:
Where to look... |
Reloads configuration of jboss server. | def reloaded(name, jboss_config, timeout=60, interval=5):
'''
Reloads configuration of jboss server.
jboss_config:
Dict with connection properties (see state description)
timeout:
Time to wait until jboss is back in running state. Default timeout is 60s.
interval:
Interval b... |
Validates a username based on the guidelines in useradd ( 8 ) | def valid_username(user):
'''
Validates a username based on the guidelines in `useradd(8)`
'''
if not isinstance(user, six.string_types):
return False
if len(user) > 32:
return False
return VALID_USERNAME.match(user) is not None |
This loads our states into the salt __context__ | def load_states():
'''
This loads our states into the salt __context__
'''
states = {}
# the loader expects to find pillar & grain data
__opts__['grains'] = salt.loader.grains(__opts__)
__opts__['pillar'] = __pillar__
lazy_utils = salt.loader.utils(__opts__)
lazy_funcs = salt.loader... |
Send a message to the google chat room specified in the webhook url. | def send_message(url, message):
'''
Send a message to the google chat room specified in the webhook url.
.. code-block:: bash
salt '*' google_chat.send_message "https://chat.googleapis.com/v1/spaces/example_space/messages?key=example_key" "This is a test message"
'''
headers = {'Content-Ty... |
Raise an exception with __name__ from name args from args If args is None Otherwise message from message \ If name is empty then use Exception | def raise_error(name=None, args=None, message=''):
'''
Raise an exception with __name__ from name, args from args
If args is None Otherwise message from message\
If name is empty then use "Exception"
'''
name = name or 'Exception'
if hasattr(salt.exceptions, name):
ex = getattr(salt.... |
Fire raw exception across the event bus | def fire_exception(exc, opts, job=None, node='minion'):
'''
Fire raw exception across the event bus
'''
if job is None:
job = {}
event = salt.utils.event.SaltEvent(node, opts=opts, listen=False)
event.fire_event(pack_exception(exc), '_salt_error') |
Accepts a message pack string or a file object renders said data back to a python dict. | def render(msgpack_data, saltenv='base', sls='', **kws):
'''
Accepts a message pack string or a file object, renders said data back to
a python dict.
.. note:
This renderer is NOT intended for use in creating sls files by hand,
but exists to allow for data backends to serialize the high... |
Clear out the ext pillar caches used when the master starts | def init_git_pillar(opts):
'''
Clear out the ext pillar caches, used when the master starts
'''
ret = []
for opts_dict in [x for x in opts.get('ext_pillar', [])]:
if 'git' in opts_dict:
try:
pillar = salt.utils.gitfs.GitPillar(
opts,
... |
Clean out the old fileserver backends | def clean_fsbackend(opts):
'''
Clean out the old fileserver backends
'''
# Clear remote fileserver backend caches so they get recreated
for backend in ('git', 'hg', 'svn'):
if backend in opts['fileserver_backend']:
env_cache = os.path.join(
opts['cachedir'],
... |
Clean expired tokens from the master | def clean_expired_tokens(opts):
'''
Clean expired tokens from the master
'''
loadauth = salt.auth.LoadAuth(opts)
for tok in loadauth.list_tokens():
token_data = loadauth.get_tok(tok)
if 'expire' not in token_data or token_data.get('expire', 0) < time.time():
loadauth.rm_t... |
Clean out the old jobs from the job cache | def clean_old_jobs(opts):
'''
Clean out the old jobs from the job cache
'''
# TODO: better way to not require creating the masterminion every time?
mminion = salt.minion.MasterMinion(
opts,
states=False,
rend=False,
)
# If the maste... |
Clean out old tracked jobs running on the master | def clean_proc_dir(opts):
'''
Clean out old tracked jobs running on the master
Generally, anything tracking a job should remove the job
once the job has finished. However, this will remove any
jobs that for some reason were not properly removed
when finished or errored.
'''
serial = sal... |
A key needs to be placed in the filesystem with permissions 0400 so clients are required to run as root. | def access_keys(opts):
'''
A key needs to be placed in the filesystem with permissions 0400 so
clients are required to run as root.
'''
# TODO: Need a way to get all available users for systems not supported by pwd module.
# For now users pattern matching will not work for publisher_acl.
... |
Update the fileserver backends requires that a salt. fileserver. Fileserver object be passed in | def fileserver_update(fileserver):
'''
Update the fileserver backends, requires that a salt.fileserver.Fileserver
object be passed in
'''
try:
if not fileserver.servers:
log.error(
'No fileservers loaded, the master will not be able to '
'serve fil... |
Check if the specified filename has correct permissions | def check_permissions(self, filename):
'''
Check if the specified filename has correct permissions
'''
if salt.utils.platform.is_windows():
return True
# After we've ascertained we're not on windows
groups = salt.utils.user.get_gid_list(self.opts['user'], inc... |
Check a keyid for membership in a signing file | def check_signing_file(self, keyid, signing_file):
'''
Check a keyid for membership in a signing file
'''
if not signing_file or not os.path.exists(signing_file):
return False
if not self.check_permissions(signing_file):
log.warning('Wrong permissions for... |
Check a keyid for membership in a autosign directory. | def check_autosign_dir(self, keyid):
'''
Check a keyid for membership in a autosign directory.
'''
autosign_dir = os.path.join(self.opts['pki_dir'], 'minions_autosign')
# cleanup expired files
expire_minutes = self.opts.get('autosign_timeout', 120)
if expire_minu... |
Check for matching grains in the autosign_grains_dir. | def check_autosign_grains(self, autosign_grains):
'''
Check for matching grains in the autosign_grains_dir.
'''
if not autosign_grains or 'autosign_grains_dir' not in self.opts:
return False
autosign_grains_dir = self.opts['autosign_grains_dir']
for root, dir... |
Checks if the specified keyid should automatically be signed. | def check_autosign(self, keyid, autosign_grains=None):
'''
Checks if the specified keyid should automatically be signed.
'''
if self.opts['auto_accept']:
return True
if self.check_signing_file(keyid, self.opts.get('autosign_file', None)):
return True
... |
Set the local file objects from the file server interface | def __setup_fileserver(self):
'''
Set the local file objects from the file server interface
'''
fs_ = salt.fileserver.Fileserver(self.opts)
self._serve_file = fs_.serve_file
self._file_find = fs_._find_file
self._file_hash = fs_.file_hash
self._file_list =... |
Verify that the passed information authorized a minion to execute | def __verify_minion_publish(self, load):
'''
Verify that the passed information authorized a minion to execute
'''
# Verify that the load is valid
if 'peer' not in self.opts:
return False
if not isinstance(self.opts['peer'], dict):
return False
... |
Return the master options to the minion | def _master_opts(self, load):
'''
Return the master options to the minion
'''
mopts = {}
file_roots = {}
envs = self._file_envs()
for saltenv in envs:
if saltenv not in file_roots:
file_roots[saltenv] = []
mopts['file_roots'] = ... |
Return the results from master_tops if configured | def _master_tops(self, load, skip_verify=False):
'''
Return the results from master_tops if configured
'''
if not skip_verify:
if 'id' not in load:
log.error('Received call for external nodes without an id')
return {}
if not salt.ut... |
Gathers the data from the specified minions mine | def _mine_get(self, load, skip_verify=False):
'''
Gathers the data from the specified minions' mine
'''
if not skip_verify:
if any(key not in load for key in ('id', 'tgt', 'fun')):
return {}
if isinstance(load['fun'], six.string_types):
fu... |
Return the mine data | def _mine(self, load, skip_verify=False):
'''
Return the mine data
'''
if not skip_verify:
if 'id' not in load or 'data' not in load:
return False
if self.opts.get('minion_data_cache', False) or self.opts.get('enforce_mine_cache', False):
c... |
Allow the minion to delete a specific function from its own mine | def _mine_delete(self, load):
'''
Allow the minion to delete a specific function from its own mine
'''
if 'id' not in load or 'fun' not in load:
return False
if self.opts.get('minion_data_cache', False) or self.opts.get('enforce_mine_cache', False):
cbank ... |
Allow the minion to delete all of its own mine contents | def _mine_flush(self, load, skip_verify=False):
'''
Allow the minion to delete all of its own mine contents
'''
if not skip_verify and 'id' not in load:
return False
if self.opts.get('minion_data_cache', False) or self.opts.get('enforce_mine_cache', False):
... |
Allows minions to send files to the master files are sent to the master file cache | def _file_recv(self, load):
'''
Allows minions to send files to the master, files are sent to the
master file cache
'''
if any(key not in load for key in ('id', 'path', 'loc')):
return False
if not self.opts['file_recv'] or os.path.isabs(load['path']):
... |
Return the pillar data for the minion | def _pillar(self, load):
'''
Return the pillar data for the minion
'''
if any(key not in load for key in ('id', 'grains')):
return False
# pillar = salt.pillar.Pillar(
log.debug('Master _pillar using ext: %s', load.get('ext'))
pillar = salt.pillar.get_p... |
Receive an event from the minion and fire it on the master event interface | def _minion_event(self, load):
'''
Receive an event from the minion and fire it on the master event
interface
'''
if 'id' not in load:
return False
if 'events' not in load and ('tag' not in load or 'data' not in load):
return False
if 'even... |
Handle the return data sent from the minions | def _return(self, load):
'''
Handle the return data sent from the minions
'''
# Generate EndTime
endtime = salt.utils.jid.jid_to_time(salt.utils.jid.gen_jid(self.opts))
# If the return data is invalid, just ignore it
if any(key not in load for key in ('return', 'j... |
Receive a syndic minion return and format it to look like returns from individual minions. | def _syndic_return(self, load):
'''
Receive a syndic minion return and format it to look like returns from
individual minions.
'''
# Verify the load
if any(key not in load for key in ('return', 'jid', 'id')):
return None
# if we have a load, save it
... |
Execute a runner from a minion return the runner s function data | def minion_runner(self, load):
'''
Execute a runner from a minion, return the runner's function data
'''
if 'peer_run' not in self.opts:
return {}
if not isinstance(self.opts['peer_run'], dict):
return {}
if any(key not in load for key in ('fun', '... |
Request the return data from a specific jid only allowed if the requesting minion also initialted the execution. | def pub_ret(self, load, skip_verify=False):
'''
Request the return data from a specific jid, only allowed
if the requesting minion also initialted the execution.
'''
if not skip_verify and any(key not in load for key in ('jid', 'id')):
return {}
else:
... |
Publish a command initiated from a minion this method executes minion restrictions so that the minion publication will only work if it is enabled in the config. The configuration on the master allows minions to be matched to salt functions so the minions can only publish allowed salt functions The config will look like... | def minion_pub(self, load):
'''
Publish a command initiated from a minion, this method executes minion
restrictions so that the minion publication will only work if it is
enabled in the config.
The configuration on the master allows minions to be matched to
salt functions... |
Publish a command initiated from a minion this method executes minion restrictions so that the minion publication will only work if it is enabled in the config. The configuration on the master allows minions to be matched to salt functions so the minions can only publish allowed salt functions The config will look like... | def minion_publish(self, load):
'''
Publish a command initiated from a minion, this method executes minion
restrictions so that the minion publication will only work if it is
enabled in the config.
The configuration on the master allows minions to be matched to
salt funct... |
Allow a minion to request revocation of its own key | def revoke_auth(self, load):
'''
Allow a minion to request revocation of its own key
'''
if 'id' not in load:
return False
keyapi = salt.key.Key(self.opts)
keyapi.delete_key(load['id'],
preserve_minions=load.get('preserve_minion_cache... |
Send a master control function back to the runner system | def runner(self, load):
'''
Send a master control function back to the runner system
'''
# All runner opts pass through eauth
auth_type, err_name, key = self._prep_auth_info(load)
# Authenticate
auth_check = self.loadauth.check_authentication(load, auth_type)
... |
Send a master control function back to the wheel system | def wheel(self, load):
'''
Send a master control function back to the wheel system
'''
# All wheel ops pass through eauth
auth_type, err_name, key = self._prep_auth_info(load)
# Authenticate
auth_check = self.loadauth.check_authentication(
load,
... |
Create and return an authentication token the clear load needs to contain the eauth key and the needed authentication creds. | def mk_token(self, load):
'''
Create and return an authentication token, the clear load needs to
contain the eauth key and the needed authentication creds.
'''
token = self.loadauth.mk_token(load)
if not token:
log.warning('Authentication failure of type "eaut... |
This method sends out publications to the minions it can only be used by the LocalClient. | def publish(self, load):
'''
This method sends out publications to the minions, it can only be used
by the LocalClient.
'''
extra = load.get('kwargs', {})
publisher_acl = salt.acl.PublisherACL(self.opts['publisher_acl_blacklist'])
if publisher_acl.user_is_blackl... |
Listen to slack events and forward them to salt new version | def start(token,
control=False,
trigger='!',
groups=None,
groups_pillar_name=None,
fire_all=False,
tag='salt/engines/slack'):
'''
Listen to slack events and forward them to salt, new version
'''
if (not token) or (not token.startswith('xoxb'))... |
Get all users from Slack | def get_slack_users(self, token):
'''
Get all users from Slack
'''
ret = salt.utils.slack.query(function='users',
api_key=token,
opts=__opts__)
users = {}
if 'message' in ret:
for item ... |
Get all channel names from Slack | def get_slack_channels(self, token):
'''
Get all channel names from Slack
'''
ret = salt.utils.slack.query(
function='rooms',
api_key=token,
# These won't be honored until https://github.com/saltstack/salt/pull/41187/files is merged
opts={... |
get info from groups in config and from the named pillar | def get_config_groups(self, groups_conf, groups_pillar_name):
'''
get info from groups in config, and from the named pillar
todo: add specification for the minion to use to recover pillar
'''
# Get groups
# Default to returning something that'll never match
ret_g... |
pillar_prefix is the pillar. get syntax for the pillar to be queried. Group name is gotten via the equivalent of using salt [ pillar. get ] ( {}: {}. format ( pillar_prefix group_name )) in a jinja template. | def _groups_from_pillar(self, pillar_name):
'''
pillar_prefix is the pillar.get syntax for the pillar to be queried.
Group name is gotten via the equivalent of using
``salt['pillar.get']('{}:{}'.format(pillar_prefix, group_name))``
in a jinja template.
returns a dictiona... |
This replaces a function in main called fire | def fire(self, tag, msg):
'''
This replaces a function in main called 'fire'
It fires an event into the salt bus.
'''
if __opts__.get('__role') == 'master':
fire_master = salt.utils.event.get_master_event(
__opts__,
__opts__['sock_dir'... |
Break out the permissions into the following: | def can_user_run(self, user, command, groups):
'''
Break out the permissions into the following:
Check whether a user is in any group, including whether a group has the '*' membership
:type user: str
:param user: The username being checked against
:type command: str
... |
cmdline_str is the string of the command line trigger_string is the trigger string to be removed | def commandline_to_list(self, cmdline_str, trigger_string):
'''
cmdline_str is the string of the command line
trigger_string is the trigger string, to be removed
'''
cmdline = salt.utils.args.shlex_split(cmdline_str[len(trigger_string):])
# Remove slack url parsing
... |
Returns a tuple of ( target cmdline ) for the response | def control_message_target(self, slack_user_name, text, loaded_groups, trigger_string):
'''Returns a tuple of (target, cmdline,) for the response
Raises IndexError if a user can't be looked up from all_slack_users
Returns (False, False) if the user doesn't have permission
These are re... |
Raises ValueError if a value doesn t work out and TypeError if this isn t a message type | def message_text(self, m_data):
'''
Raises ValueError if a value doesn't work out, and TypeError if
this isn't a message type
'''
if m_data.get('type') != 'message':
raise TypeError('This is not a message')
# Edited messages have text in message
_text ... |
slack_token = string trigger_string = string input_valid_users = set input_valid_commands = set | def generate_triggered_messages(self, token, trigger_string, groups, groups_pillar_name):
'''
slack_token = string
trigger_string = string
input_valid_users = set
input_valid_commands = set
When the trigger_string prefixes the message text, yields a dictionary
of... |
When we are permitted to run a command on a target look to see what the default targeting is for that group and for that specific command ( if provided ). | def get_target(self, permitted_group, cmdline, alias_cmdline):
'''
When we are permitted to run a command on a target, look to see
what the default targeting is for that group, and for that specific
command (if provided).
It's possible for None or False to be the result of eithe... |
Print out YAML using the block mode | def format_return_text(self, data, function, **kwargs): # pylint: disable=unused-argument
'''
Print out YAML using the block mode
'''
# emulate the yaml_out output formatter. It relies on a global __opts__ object which
# we can't obviously pass in
try:
try:
... |
cmdline: list | def parse_args_and_kwargs(self, cmdline):
'''
cmdline: list
returns tuple of: args (list), kwargs (dict)
'''
# Parse args and kwargs
args = []
kwargs = {}
if len(cmdline) > 1:
for item in cmdline[1:]:
if '=' in item:
... |
Given a list of job_ids return a dictionary of those job_ids that have completed and their results. | def get_jobs_from_runner(self, outstanding_jids):
'''
Given a list of job_ids, return a dictionary of those job_ids that have
completed and their results.
Query the salt event bus via the jobs runner. jobs.list_job will show
a job in progress, jobs.lookup_jid will return a job t... |
Pull any pending messages from the message_generator sending each one to either the event bus the command_async or both depending on the values of fire_all and command | def run_commands_from_slack_async(self, message_generator, fire_all, tag, control, interval=1):
'''
Pull any pending messages from the message_generator, sending each
one to either the event bus, the command_async or both, depending on
the values of fire_all and command
'''
... |
: type message_generator: generator of dict: param message_generator: Generates messages from slack that should be run | def run_command_async(self, msg):
'''
:type message_generator: generator of dict
:param message_generator: Generates messages from slack that should be run
:type fire_all: bool
:param fire_all: Whether to also fire messages to the event bus
:type tag: str
:para... |
Return a Pg cursor | def _get_serv(ret=None, commit=False):
'''
Return a Pg cursor
'''
_options = _get_options(ret)
try:
conn = psycopg2.connect(host=_options.get('host'),
user=_options.get('user'),
password=_options.get('passwd'),
... |
Return data to a postgres server | def returner(ret):
'''
Return data to a postgres server
'''
try:
with _get_serv(ret, commit=True) as cur:
sql = '''INSERT INTO salt_returns
(fun, jid, return, id, success, full_ret)
VALUES (%s, %s, %s, %s, %s, %s)'''
cur.execute(
... |
Return a list of all job ids | def get_jids():
'''
Return a list of all job ids
'''
with _get_serv(ret=None, commit=True) as cur:
sql = '''SELECT jid, load
FROM jids'''
cur.execute(sql)
data = cur.fetchall()
ret = {}
for jid, load in data:
ret[jid] = salt.utils.jid... |
Ensures that the host group exists eventually creates new host group. | def present(name, **kwargs):
'''
Ensures that the host group exists, eventually creates new host group.
.. versionadded:: 2016.3.0
:param name: name of the host group
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_... |
Ensures that the host group does not exist eventually delete host group. | def absent(name, **kwargs):
'''
Ensures that the host group does not exist, eventually delete host group.
.. versionadded:: 2016.3.0
:param name: name of the host group
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connectio... |
Encode json values in unicode to match that of the API | def _json_to_unicode(data):
'''
Encode json values in unicode to match that of the API
'''
ret = {}
for key, value in data.items():
if not isinstance(value, six.text_type):
if isinstance(value, dict):
ret[key] = _json_to_unicode(value)
else:
... |
Compare the API results to the current statefile data | def _is_updated(old_conf, new_conf):
'''
Compare the API results to the current statefile data
'''
changed = {}
# Dirty json hacking to get parameters in the same format
new_conf = _json_to_unicode(salt.utils.json.loads(
salt.utils.json.dumps(new_conf, ensure_ascii=False)))
old_conf... |
Generic function to create or update an element | def _do_element_present(name, elem_type, data, server=None):
'''
Generic function to create or update an element
'''
ret = {'changes': {}, 'update': False, 'create': False, 'error': None}
try:
elements = __salt__['glassfish.enum_{0}'.format(elem_type)]()
except requests.ConnectionError a... |
Generic function to delete an element | def _do_element_absent(name, elem_type, data, server=None):
'''
Generic function to delete an element
'''
ret = {'delete': False, 'error': None}
try:
elements = __salt__['glassfish.enum_{0}'.format(elem_type)]()
except requests.ConnectionError as error:
if __opts__['test']:
... |
Ensures that the Connection Factory is present | def connection_factory_present(name,
restype='connection_factory',
description='',
enabled=True,
min_size=1,
max_size=250,
resize_quan... |
Ensures the transaction factory is absent. | def connection_factory_absent(name, both=True, server=None):
'''
Ensures the transaction factory is absent.
name
Name of the connection factory
both
Delete both the pool and the resource, defaults to ``true``
'''
ret = {'name': name, 'result': None, 'comment': None, 'changes': ... |
Ensures that the JMS Destination Resource ( queue or topic ) is present | def destination_present(name,
physical,
restype='queue',
description='',
enabled=True,
server=None):
'''
Ensures that the JMS Destination Resource (queue or topic) is present
name
... |
Ensures that the JMS Destination doesn t exists | def destination_absent(name, server=None):
'''
Ensures that the JMS Destination doesn't exists
name
Name of the JMS Destination
'''
ret = {'name': name, 'result': None, 'comment': None, 'changes': {}}
jms_ret = _do_element_absent(name, 'admin_object_resource', {}, server)
if not jms... |
Ensures that the JDBC Datasource exists | def jdbc_datasource_present(name,
description='',
enabled=True,
restype='datasource',
vendor='mysql',
sql_url='',
sql_user='',
... |
Ensures the JDBC Datasource doesn t exists | def jdbc_datasource_absent(name, both=True, server=None):
'''
Ensures the JDBC Datasource doesn't exists
name
Name of the datasource
both
Delete both the pool and the resource, defaults to ``true``
'''
ret = {'name': name, 'result': None, 'comment': None, 'changes': {}}
pool... |
Ensures that the system properties are present | def system_properties_present(server=None, **kwargs):
'''
Ensures that the system properties are present
properties
The system properties
'''
ret = {'name': '', 'result': None, 'comment': None, 'changes': {}}
del kwargs['name']
try:
data = __salt__['glassfish.get_system_pro... |
Ensures that the system property doesn t exists | def system_properties_absent(name, server=None):
'''
Ensures that the system property doesn't exists
name
Name of the system property
'''
ret = {'name': '', 'result': None, 'comment': None, 'changes': {}}
try:
data = __salt__['glassfish.get_system_properties'](server=server)
... |
Parse target_expressing splitting it into engine delimiter pattern - returns a dict | def parse_target(target_expression):
'''Parse `target_expressing` splitting it into `engine`, `delimiter`,
`pattern` - returns a dict'''
match = TARGET_REX.match(target_expression)
if not match:
log.warning('Unable to parse target "%s"', target_expression)
ret = {
'engine':... |
Get the grains/ pillar for a specific minion. If minion is None it will return the grains/ pillar for the first minion it finds. | def get_minion_data(minion, opts):
'''
Get the grains/pillar for a specific minion. If minion is None, it
will return the grains/pillar for the first minion it finds.
Return value is a tuple of the minion ID, grains, and pillar
'''
grains = None
pillar = None
if opts.get('minion_data_c... |
Recursively expand nodegroup from nodegroups ; ignore nodegroups in skip | def nodegroup_comp(nodegroup, nodegroups, skip=None, first_call=True):
'''
Recursively expand ``nodegroup`` from ``nodegroups``; ignore nodegroups in ``skip``
If a top-level (non-recursive) call finds no nodegroups, return the original
nodegroup definition (for backwards compatibility). Keep track of r... |
Gathers the data from the specified minions mine pass in the target function to look up and the target type | def mine_get(tgt, fun, tgt_type='glob', opts=None):
'''
Gathers the data from the specified minions' mine, pass in the target,
function to look up and the target type
'''
ret = {}
serial = salt.payload.Serial(opts)
checker = CkMinions(opts)
_res = checker.check_minions(
tgt,
... |
Return minions found by looking at nodegroups | def _check_nodegroup_minions(self, expr, greedy): # pylint: disable=unused-argument
'''
Return minions found by looking at nodegroups
'''
return self._check_compound_minions(nodegroup_comp(expr, self.opts['nodegroups']),
DEFAULT_TARGET_DELIM,
greedy) |
Return the minions found by looking via a list | def _check_list_minions(self, expr, greedy, ignore_missing=False): # pylint: disable=unused-argument
'''
Return the minions found by looking via a list
'''
if isinstance(expr, six.string_types):
expr = [m for m in expr.split(',') if m]
minions = self._pki_minions()
... |
Return the minions found by looking via regular expressions | def _check_pcre_minions(self, expr, greedy): # pylint: disable=unused-argument
'''
Return the minions found by looking via regular expressions
'''
reg = re.compile(expr)
return {'minions': [m for m in self._pki_minions() if reg.match(m)],
'missing': []} |
Retreive complete minion list from PKI dir. Respects cache if configured | def _pki_minions(self):
'''
Retreive complete minion list from PKI dir.
Respects cache if configured
'''
minions = []
pki_cache_fn = os.path.join(self.opts['pki_dir'], self.acc, '.key_cache')
try:
os.makedirs(os.path.dirname(pki_cache_fn))
exce... |
Helper function to search for minions in master caches If greedy then return accepted minions matched by the condition or those absent from the cache. If not greedy return the only minions have cache data and matched by the condition. | def _check_cache_minions(self,
expr,
delimiter,
greedy,
search_type,
regex_match=False,
exact_match=False):
'''
Helper function to... |
Return the minions found by looking via grains | def _check_grain_minions(self, expr, delimiter, greedy):
'''
Return the minions found by looking via grains
'''
return self._check_cache_minions(expr, delimiter, greedy, 'grains') |
Return the minions found by looking via grains with PCRE | def _check_grain_pcre_minions(self, expr, delimiter, greedy):
'''
Return the minions found by looking via grains with PCRE
'''
return self._check_cache_minions(expr,
delimiter,
greedy,
... |
Return the minions found by looking via pillar | def _check_pillar_minions(self, expr, delimiter, greedy):
'''
Return the minions found by looking via pillar
'''
return self._check_cache_minions(expr, delimiter, greedy, 'pillar') |
Return the minions found by looking via pillar with PCRE | def _check_pillar_pcre_minions(self, expr, delimiter, greedy):
'''
Return the minions found by looking via pillar with PCRE
'''
return self._check_cache_minions(expr,
delimiter,
greedy,
... |
Return the minions found by looking via pillar | def _check_pillar_exact_minions(self, expr, delimiter, greedy):
'''
Return the minions found by looking via pillar
'''
return self._check_cache_minions(expr,
delimiter,
greedy,
... |
Return the minions found by looking via ipcidr | def _check_ipcidr_minions(self, expr, greedy):
'''
Return the minions found by looking via ipcidr
'''
cache_enabled = self.opts.get('minion_data_cache', False)
if greedy:
minions = self._pki_minions()
elif cache_enabled:
minions = self.cache.list(... |
Return the minions found by looking via range expression | def _check_range_minions(self, expr, greedy):
'''
Return the minions found by looking via range expression
'''
if not HAS_RANGE:
raise CommandExecutionError(
'Range matcher unavailable (unable to import seco.range, '
'module most likely not ins... |
Return the minions found by looking via compound matcher | def _check_compound_pillar_exact_minions(self, expr, delimiter, greedy):
'''
Return the minions found by looking via compound matcher
Disable pillar glob matching
'''
return self._check_compound_minions(expr,
delimiter,
... |
Return the minions found by looking via compound matcher | def _check_compound_minions(self,
expr,
delimiter,
greedy,
pillar_exact=False): # pylint: disable=unused-argument
'''
Return the minions found by looking via compound matcher
... |
Return a set of all connected minion ids optionally within a subset | def connected_ids(self, subset=None, show_ip=False, show_ipv4=None, include_localhost=None):
'''
Return a set of all connected minion ids, optionally within a subset
'''
if include_localhost is not None:
salt.utils.versions.warn_until(
'Sodium',
... |
Return a list of all minions that have auth d | def _all_minions(self, expr=None):
'''
Return a list of all minions that have auth'd
'''
mlist = []
for fn_ in salt.utils.data.sorted_ignorecase(os.listdir(os.path.join(self.opts['pki_dir'], self.acc))):
if not fn_.startswith('.') and os.path.isfile(os.path.join(self.... |
Check the passed regex against the available minions public keys stored for authentication. This should return a set of ids which match the regex this will then be used to parse the returns to make sure everyone has checked back in. | def check_minions(self,
expr,
tgt_type='glob',
delimiter=DEFAULT_TARGET_DELIM,
greedy=True):
'''
Check the passed regex against the available minions' public keys
stored for authentication. This should return... |
Return a Bool. This function returns if the expression sent in is within the scope of the valid expression | def validate_tgt(self, valid, expr, tgt_type, minions=None, expr_form=None):
'''
Return a Bool. This function returns if the expression sent in is
within the scope of the valid expression
'''
v_minions = set(self.check_minions(valid, 'compound').get('minions', []))
if mi... |
Validate a single regex to function comparison the function argument can be a list of functions. It is all or nothing for a list of functions | def match_check(self, regex, fun):
'''
Validate a single regex to function comparison, the function argument
can be a list of functions. It is all or nothing for a list of
functions
'''
vals = []
if isinstance(fun, six.string_types):
fun = [fun]
... |
Read in the form and determine which auth check routine to execute | def any_auth(self, form, auth_list, fun, arg, tgt=None, tgt_type='glob'):
'''
Read in the form and determine which auth check routine to execute
'''
# This function is only called from salt.auth.Authorize(), which is also
# deprecated and will be removed in Neon.
salt.uti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.