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/minion.py
get_proc_dir
python
def get_proc_dir(cachedir, **kwargs): ''' Given the cache directory, return the directory that process data is stored in, creating it if it doesn't exist. The following optional Keyword Arguments are handled: mode: which is anything os.makedir would accept as mode. uid: the uid to set, if not ...
Given the cache directory, return the directory that process data is stored in, creating it if it doesn't exist. The following optional Keyword Arguments are handled: mode: which is anything os.makedir would accept as mode. uid: the uid to set, if not set, or it is None or -1 no changes are m...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L272-L320
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
load_args_and_kwargs
python
def load_args_and_kwargs(func, args, data=None, ignore_invalid=False): ''' Detect the args and kwargs that need to be passed to a function call, and check them against what was passed. ''' argspec = salt.utils.args.get_function_argspec(func) _args = [] _kwargs = {} invalid_kwargs = [] ...
Detect the args and kwargs that need to be passed to a function call, and check them against what was passed.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L323-L372
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def iterkeys(d, **kw):\n return d.iterkeys(**kw)\n", "def get_function_argspec(func, is_class_method=None):\n '''\n A small wrapper around getargspec that also supports callable classes\n :param is_class_method: Pass True if you are sure th...
# -*- 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
eval_master_func
python
def eval_master_func(opts): ''' Evaluate master function if master type is 'func' and save it result in opts['master'] ''' if '__master_func_evaluated' not in opts: # split module and function and try loading the module mod_fun = opts['master'] mod, fun = mod_fun.split('.') ...
Evaluate master function if master type is 'func' and save it result in opts['master']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L375-L400
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
master_event
python
def master_event(type, master=None): ''' Centralized master event function which will return event type based on event_map ''' event_map = {'connected': '__master_connected', 'disconnected': '__master_disconnected', 'failback': '__master_failback', 'ali...
Centralized master event function which will return event type based on event_map
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L403-L415
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
MinionBase.process_beacons
python
def process_beacons(self, functions): ''' Evaluate all of the configured beacons, grab the config again in case the pillar or grains changed ''' if 'config.merge' in functions: b_conf = functions['config.merge']('beacons', self.opts['beacons'], omit_opts=True) ...
Evaluate all of the configured beacons, grab the config again in case the pillar or grains changed
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L448-L457
null
class MinionBase(object): def __init__(self, opts): self.opts = opts @staticmethod def process_schedule(minion, loop_interval): try: if hasattr(minion, 'schedule'): minion.schedule.eval() else: log.error('Minion scheduler not initializ...
saltstack/salt
salt/minion.py
MinionBase.eval_master
python
def eval_master(self, opts, timeout=60, safe=True, failed=False, failback=False): ''' Evaluates and returns a tuple of the current master address and the pub_channel. In standard mode, just creat...
Evaluates and returns a tuple of the current master address and the pub_channel. In standard mode, just creates a pub_channel with the given master address. With master_type=func evaluates the current master address from the given module and then creates a pub_channel. With master_typ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L460-L729
[ "def eval_master_func(opts):\n '''\n Evaluate master function if master type is 'func'\n and save it result in opts['master']\n '''\n if '__master_func_evaluated' not in opts:\n # split module and function and try loading the module\n mod_fun = opts['master']\n mod, fun = mod_fun...
class MinionBase(object): def __init__(self, opts): self.opts = opts @staticmethod def process_schedule(minion, loop_interval): try: if hasattr(minion, 'schedule'): minion.schedule.eval() else: log.error('Minion scheduler not initializ...
saltstack/salt
salt/minion.py
MinionBase._discover_masters
python
def _discover_masters(self): ''' Discover master(s) and decide where to connect, if SSDP is around. This modifies the configuration on the fly. :return: ''' if self.opts['master'] == DEFAULT_MINION_OPTS['master'] and self.opts['discovery'] is not False: master...
Discover master(s) and decide where to connect, if SSDP is around. This modifies the configuration on the fly. :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L731-L771
[ "def discover(self):\n '''\n Gather the information of currently declared servers.\n\n :return:\n '''\n response = {}\n masters = {}\n self.log.info(\"Looking for a server discovery\")\n self._query()\n self._collect_masters_map(response)\n if not response:\n msg = 'No master ha...
class MinionBase(object): def __init__(self, opts): self.opts = opts @staticmethod def process_schedule(minion, loop_interval): try: if hasattr(minion, 'schedule'): minion.schedule.eval() else: log.error('Minion scheduler not initializ...
saltstack/salt
salt/minion.py
MinionBase._return_retry_timer
python
def _return_retry_timer(self): ''' Based on the minion configuration, either return a randomized timer or just return the value of the return_retry_timer. ''' msg = 'Minion return retry timer set to %s seconds' if self.opts.get('return_retry_timer_max'): try: ...
Based on the minion configuration, either return a randomized timer or just return the value of the return_retry_timer.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L773-L798
null
class MinionBase(object): def __init__(self, opts): self.opts = opts @staticmethod def process_schedule(minion, loop_interval): try: if hasattr(minion, 'schedule'): minion.schedule.eval() else: log.error('Minion scheduler not initializ...
saltstack/salt
salt/minion.py
SMinion.gen_modules
python
def gen_modules(self, initial_load=False): ''' Tell the minion to reload the execution modules CLI Example: .. code-block:: bash salt '*' sys.reload_modules ''' self.opts['pillar'] = salt.pillar.get_pillar( self.opts, self.opts['grai...
Tell the minion to reload the execution modules CLI Example: .. code-block:: bash salt '*' sys.reload_modules
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L847-L880
[ "def get_pillar(opts, grains, minion_id, saltenv=None, ext=None, funcs=None,\n pillar_override=None, pillarenv=None, extra_minion_data=None):\n '''\n Return the correct pillar driver based on the file_client option\n '''\n file_client = opts['file_client']\n if opts.get('master_type') =...
class SMinion(MinionBase): ''' Create an object that has loaded all of the minion module functions, grains, modules, returners etc. The SMinion allows developers to generate all of the salt minion functions and present them with these functions for general use. ''' def __init__(self, opts):...
saltstack/salt
salt/minion.py
MasterMinion.gen_modules
python
def gen_modules(self, initial_load=False): ''' Tell the minion to reload the execution modules CLI Example: .. code-block:: bash salt '*' sys.reload_modules ''' self.utils = salt.loader.utils(self.opts) self.functions = salt.loader.minion_mods( ...
Tell the minion to reload the execution modules CLI Example: .. code-block:: bash salt '*' sys.reload_modules
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L913-L941
null
class MasterMinion(object): ''' Create a fully loaded minion function object for generic use on the master. What makes this class different is that the pillar is omitted, otherwise everything else is loaded cleanly. ''' def __init__( self, opts, returners=True...
saltstack/salt
salt/minion.py
MinionManager._create_minion_object
python
def _create_minion_object(self, opts, timeout, safe, io_loop=None, loaded_base_name=None, jid_queue=None): ''' Helper function to return the correct type of object ''' return Minion(opts, timeout, ...
Helper function to return the correct type of object
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L979-L990
null
class MinionManager(MinionBase): ''' Create a multi minion interface, this creates as many minions as are defined in the master option and binds each minion object to a respective master. ''' def __init__(self, opts): super(MinionManager, self).__init__(opts) self.auth_wait = sel...
saltstack/salt
salt/minion.py
MinionManager._spawn_minions
python
def _spawn_minions(self, timeout=60): ''' Spawn all the coroutines which will sign in to masters ''' # Run masters discovery over SSDP. This may modify the whole configuration, # depending of the networking and sets of masters. If match is 'any' we let # eval_master handl...
Spawn all the coroutines which will sign in to masters
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1001-L1027
[ "def _create_minion_object(self, opts, timeout, safe,\n io_loop=None, loaded_base_name=None,\n jid_queue=None):\n '''\n Helper function to return the correct type of object\n '''\n return Minion(opts,\n timeout,\n safe,\...
class MinionManager(MinionBase): ''' Create a multi minion interface, this creates as many minions as are defined in the master option and binds each minion object to a respective master. ''' def __init__(self, opts): super(MinionManager, self).__init__(opts) self.auth_wait = sel...
saltstack/salt
salt/minion.py
MinionManager._connect_minion
python
def _connect_minion(self, minion): ''' Create a minion, and asynchronously connect it to a master ''' auth_wait = minion.opts['acceptance_wait_time'] failed = False while True: if failed: if auth_wait < self.max_auth_wait: a...
Create a minion, and asynchronously connect it to a master
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1030-L1072
null
class MinionManager(MinionBase): ''' Create a multi minion interface, this creates as many minions as are defined in the master option and binds each minion object to a respective master. ''' def __init__(self, opts): super(MinionManager, self).__init__(opts) self.auth_wait = sel...
saltstack/salt
salt/minion.py
Minion.sync_connect_master
python
def sync_connect_master(self, timeout=None, failed=False): ''' Block until we are connected to a master ''' self._sync_connect_master_success = False log.debug("sync_connect_master") def on_connect_master_future_done(future): self._sync_connect_master_success...
Block until we are connected to a master
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1209-L1238
[ "def destroy(self):\n '''\n Tear down the minion\n '''\n if self._running is False:\n return\n\n self._running = False\n if hasattr(self, 'schedule'):\n del self.schedule\n if hasattr(self, 'pub_channel') and self.pub_channel is not None:\n self.pub_channel.on_recv(None)\n ...
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion.connect_master
python
def connect_master(self, failed=False): ''' Return a future which will complete when you are connected to a master ''' master, self.pub_channel = yield self.eval_master(self.opts, self.timeout, self.safe, failed) yield self._post_master_init(master)
Return a future which will complete when you are connected to a master
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1241-L1246
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion._post_master_init
python
def _post_master_init(self, master): ''' Function to finish init after connecting to a master This is primarily loading modules, pillars, etc. (since they need to know which master they connected to) If this function is changed, please check ProxyMinion._post_master_init ...
Function to finish init after connecting to a master This is primarily loading modules, pillars, etc. (since they need to know which master they connected to) If this function is changed, please check ProxyMinion._post_master_init to see if those changes need to be propagated. ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1250-L1346
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion._prep_mod_opts
python
def _prep_mod_opts(self): ''' Returns a copy of the opts with key bits stripped out ''' mod_opts = {} for key, val in six.iteritems(self.opts): if key == 'logger': continue mod_opts[key] = val return mod_opts
Returns a copy of the opts with key bits stripped out
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1348-L1357
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion._load_modules
python
def _load_modules(self, force_refresh=False, notify=False, grains=None, opts=None): ''' Return the functions and the returners loaded up from the loader module ''' opt_in = True if not opts: opts = self.opts opt_in = False # if this is a *n...
Return the functions and the returners loaded up from the loader module
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1359-L1419
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion._fire_master
python
def _fire_master(self, data=None, tag=None, events=None, pretag=None, timeout=60, sync=True, timeout_handler=None): ''' Fire an event on the master, or drop message if unable to send. ''' load = {'id': self.opts['id'], 'cmd': '_minion_event', 'pretag': pre...
Fire an event on the master, or drop message if unable to send.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1451-L1492
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion.ctx
python
def ctx(self): ''' Return a single context manager for the minion's data ''' if six.PY2: return contextlib.nested( self.functions.context_dict.clone(), self.returners.context_dict.clone(), self.executors.context_dict.clone(), ...
Return a single context manager for the minion's data
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1581-L1596
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion._thread_return
python
def _thread_return(cls, minion_instance, opts, data): ''' This method should be used as a threading target, start the actual minion side execution. ''' fn_ = os.path.join(minion_instance.proc_dir, data['jid']) if opts['multiprocessing'] and not salt.utils.platform.is_win...
This method should be used as a threading target, start the actual minion side execution.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1631-L1851
[ "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 ...
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion._thread_multi_return
python
def _thread_multi_return(cls, minion_instance, opts, data): ''' This method should be used as a threading target, start the actual minion side execution. ''' fn_ = os.path.join(minion_instance.proc_dir, data['jid']) if opts['multiprocessing'] and not salt.utils.platform....
This method should be used as a threading target, start the actual minion side execution.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1854-L1971
[ "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 ...
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion._return_pub_multi
python
def _return_pub_multi(self, rets, ret_cmd='_return', timeout=60, sync=True): ''' Return the data from the executed command to the master server ''' if not isinstance(rets, list): rets = [rets] jids = {} for ret in rets: jid = ret.get('jid', ret.get...
Return the data from the executed command to the master server
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2058-L2142
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion._state_run
python
def _state_run(self): ''' Execute a state run based on information set in the minion config file ''' if self.opts['startup_states']: if self.opts.get('master_type', 'str') == 'disable' and \ self.opts.get('file_client', 'remote') == 'remote': ...
Execute a state run based on information set in the minion config file
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2144-L2167
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion._refresh_grains_watcher
python
def _refresh_grains_watcher(self, refresh_interval_in_minutes): ''' Create a loop that will fire a pillar refresh to inform a master about a change in the grains of this minion :param refresh_interval_in_minutes: :return: None ''' if '__update_grains' not in self.opts.get...
Create a loop that will fire a pillar refresh to inform a master about a change in the grains of this minion :param refresh_interval_in_minutes: :return: None
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2169-L2185
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion.module_refresh
python
def module_refresh(self, force_refresh=False, notify=False): ''' Refresh the functions and returners. ''' log.debug('Refreshing modules. Notify=%s', notify) self.functions, self.returners, _, self.executors = self._load_modules(force_refresh, notify=notify) self.schedule...
Refresh the functions and returners.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2207-L2215
[ "def _load_modules(self, force_refresh=False, notify=False, grains=None, opts=None):\n '''\n Return the functions and the returners loaded up from the loader\n module\n '''\n opt_in = True\n if not opts:\n opts = self.opts\n opt_in = False\n # if this is a *nix system AND modules_...
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion.beacons_refresh
python
def beacons_refresh(self): ''' Refresh the functions and returners. ''' log.debug('Refreshing beacons.') self.beacons = salt.beacons.Beacon(self.opts, self.functions)
Refresh the functions and returners.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2217-L2222
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion.matchers_refresh
python
def matchers_refresh(self): ''' Refresh the matchers ''' log.debug('Refreshing matchers.') self.matchers = salt.loader.matchers(self.opts)
Refresh the matchers
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2224-L2229
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion.pillar_refresh
python
def pillar_refresh(self, force_refresh=False, notify=False): ''' Refresh the pillar ''' if self.connected: log.debug('Refreshing pillar. Notify: %s', notify) async_pillar = salt.pillar.get_async_pillar( self.opts, self.opts['grains'...
Refresh the pillar
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2233-L2259
[ "def get_event(\n node, sock_dir=None, transport='zeromq',\n opts=None, listen=True, io_loop=None, keep_loop=False, raise_errors=False):\n '''\n Return an event object suitable for the named transport\n\n :param IOLoop io_loop: Pass in an io_loop if you want asynchronous\n ...
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion.manage_schedule
python
def manage_schedule(self, tag, data): ''' Refresh the functions and returners. ''' func = data.get('func', None) name = data.get('name', None) schedule = data.get('schedule', None) where = data.get('where', None) persist = data.get('persist', None) ...
Refresh the functions and returners.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2261-L2293
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion.manage_beacons
python
def manage_beacons(self, tag, data): ''' Manage Beacons ''' func = data.get('func', None) name = data.get('name', None) beacon_data = data.get('beacon_data', None) include_pillar = data.get('include_pillar', None) include_opts = data.get('include_opts', No...
Manage Beacons
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2295-L2330
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion.environ_setenv
python
def environ_setenv(self, tag, data): ''' Set the salt-minion main process environment according to the data contained in the minion event data ''' environ = data.get('environ', None) if environ is None: return False false_unsets = data.get('false_unset...
Set the salt-minion main process environment according to the data contained in the minion event data
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2332-L2343
[ "def setenv(environ, false_unsets=False, clear_all=False, update_minion=False, permanent=False):\n '''\n Set multiple salt process environment variables from a dict.\n Returns a dict.\n\n environ\n Must be a dict. The top-level keys of the dict are the names\n of the environment variables ...
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion._pre_tune
python
def _pre_tune(self): ''' Set the minion running flag and issue the appropriate warnings if the minion cannot be started or is already running ''' if self._running is None: self._running = True elif self._running is False: log.error( ...
Set the minion running flag and issue the appropriate warnings if the minion cannot be started or is already running
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2345-L2378
[ "def get_user():\n '''\n Get the current user\n '''\n if HAS_PWD:\n ret = pwd.getpwuid(os.geteuid()).pw_name\n elif HAS_WIN_FUNCTIONS and salt.utils.win_functions.HAS_WIN32:\n ret = salt.utils.win_functions.get_current_user()\n else:\n raise CommandExecutionError(\n ...
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion._mine_send
python
def _mine_send(self, tag, data): ''' Send mine data to the master ''' channel = salt.transport.client.ReqChannel.factory(self.opts) data['tok'] = self.tok try: ret = channel.send(data) return ret except SaltReqTimeoutError: log....
Send mine data to the master
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2380-L2393
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion._handle_tag_module_refresh
python
def _handle_tag_module_refresh(self, tag, data): ''' Handle a module_refresh event ''' self.module_refresh( force_refresh=data.get('force_refresh', False), notify=data.get('notify', False) )
Handle a module_refresh event
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2395-L2402
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion._handle_tag_pillar_refresh
python
def _handle_tag_pillar_refresh(self, tag, data): ''' Handle a pillar_refresh event ''' yield self.pillar_refresh( force_refresh=data.get('force_refresh', False), notify=data.get('notify', False) )
Handle a pillar_refresh event
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2405-L2412
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion._handle_tag_grains_refresh
python
def _handle_tag_grains_refresh(self, tag, data): ''' Handle a grains_refresh event ''' if (data.get('force_refresh', False) or self.grains_cache != self.opts['grains']): self.pillar_refresh(force_refresh=True) self.grains_cache = self.opts['grains'...
Handle a grains_refresh event
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2438-L2445
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion._handle_tag_fire_master
python
def _handle_tag_fire_master(self, tag, data): ''' Handle a fire_master event ''' if self.connected: log.debug('Forwarding master event tag=%s', data['tag']) self._fire_master(data['data'], data['tag'], data['events'], data['pretag'])
Handle a fire_master event
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2459-L2465
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion._handle_tag_master_disconnected_failback
python
def _handle_tag_master_disconnected_failback(self, tag, data): ''' Handle a master_disconnected_failback event ''' # if the master disconnect event is for a different master, raise an exception if tag.startswith(master_event(type='disconnected')) and data['master'] != self.opts['...
Handle a master_disconnected_failback event
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2467-L2581
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion._handle_tag_master_connected
python
def _handle_tag_master_connected(self, tag, data): ''' Handle a master_connected event ''' # handle this event only once. otherwise it will pollute the log # also if master type is failover all the reconnection work is done # by `disconnected` event handler and this event...
Handle a master_connected event
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2583-L2611
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion._handle_tag_schedule_return
python
def _handle_tag_schedule_return(self, tag, data): ''' Handle a _schedule_return event ''' # reporting current connection with master if data['schedule'].startswith(master_event(type='alive', master='')): if data['return']: log.debug( ...
Handle a _schedule_return event
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2613-L2624
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion._handle_tag_salt_error
python
def _handle_tag_salt_error(self, tag, data): ''' Handle a _salt_error event ''' if self.connected: log.debug('Forwarding salt error event tag=%s', tag) self._fire_master(data, tag)
Handle a _salt_error event
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2626-L2632
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion._handle_tag_salt_auth_creds
python
def _handle_tag_salt_auth_creds(self, tag, data): ''' Handle a salt_auth_creds event ''' key = tuple(data['key']) log.debug( 'Updating auth data for %s: %s -> %s', key, salt.crypt.AsyncAuth.creds_map.get(key), data['creds'] ) salt.crypt.Asy...
Handle a salt_auth_creds event
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2634-L2643
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion.handle_event
python
def handle_event(self, package): ''' Handle an event from the epull_sock (all local minion events) ''' if not self.ready: raise tornado.gen.Return() tag, data = salt.utils.event.SaltEvent.unpack(package) log.debug( 'Minion of \'%s\' is handling eve...
Handle an event from the epull_sock (all local minion events)
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2646-L2679
[ "def master_event(type, master=None):\n '''\n Centralized master event function which will return event type based on event_map\n '''\n event_map = {'connected': '__master_connected',\n 'disconnected': '__master_disconnected',\n 'failback': '__master_failback',\n ...
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion._fallback_cleanups
python
def _fallback_cleanups(self): ''' Fallback cleanup routines, attempting to fix leaked processes, threads, etc. ''' # Add an extra fallback in case a forked process leaks through multiprocessing.active_children() # Cleanup Windows threads if not salt.utils.platfor...
Fallback cleanup routines, attempting to fix leaked processes, threads, etc.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2681-L2698
null
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion._setup_core
python
def _setup_core(self): ''' Set up the core minion attributes. This is safe to call multiple times. ''' if not self.ready: # First call. Initialize. self.functions, self.returners, self.function_errors, self.executors = self._load_modules() self...
Set up the core minion attributes. This is safe to call multiple times.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2700-L2716
[ "def get_proc_dir(cachedir, **kwargs):\n '''\n Given the cache directory, return the directory that process data is\n stored in, creating it if it doesn't exist.\n The following optional Keyword Arguments are handled:\n\n mode: which is anything os.makedir would accept as mode.\n\n uid: the uid to...
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion.setup_beacons
python
def setup_beacons(self, before_connect=False): ''' Set up the beacons. This is safe to call multiple times. ''' self._setup_core() loop_interval = self.opts['loop_interval'] new_periodic_callbacks = {} if 'beacons' not in self.periodic_callbacks: ...
Set up the beacons. This is safe to call multiple times.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2718-L2755
[ "def itervalues(d, **kw):\n return d.itervalues(**kw)\n", " def _setup_core(self):\n '''\n Set up the core minion attributes.\n This is safe to call multiple times.\n '''\n if not self.ready:\n # First call. Initialize.\n self.functions, self.returner...
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion.setup_scheduler
python
def setup_scheduler(self, before_connect=False): ''' Set up the scheduler. This is safe to call multiple times. ''' self._setup_core() loop_interval = self.opts['loop_interval'] new_periodic_callbacks = {} if 'schedule' not in self.periodic_callbacks: ...
Set up the scheduler. This is safe to call multiple times.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2757-L2808
[ "def itervalues(d, **kw):\n return d.itervalues(**kw)\n", "def master_event(type, master=None):\n '''\n Centralized master event function which will return event type based on event_map\n '''\n event_map = {'connected': '__master_connected',\n 'disconnected': '__master_disconnected'...
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion.tune_in
python
def tune_in(self, start=True): ''' Lock onto the publisher. This is the main event loop for the minion :rtype : None ''' self._pre_tune() log.debug('Minion \'%s\' trying to tune in', self.opts['id']) if start: if self.opts.get('beacons_before_connect...
Lock onto the publisher. This is the main event loop for the minion :rtype : None
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2811-L2883
[ "def enable_sigusr1_handler():\n '''\n Pretty print a stack trace to the console or a debug log under /tmp\n when any of the salt daemons such as salt-master are sent a SIGUSR1\n '''\n enable_sig_handler('SIGUSR1', _handle_sigusr1)\n # Also canonical BSD-way of printing progress is SIGINFO\n # ...
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Minion.destroy
python
def destroy(self): ''' Tear down the minion ''' if self._running is False: return self._running = False if hasattr(self, 'schedule'): del self.schedule if hasattr(self, 'pub_channel') and self.pub_channel is not None: self.pub_...
Tear down the minion
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2928-L2945
[ "def itervalues(d, **kw):\n return d.itervalues(**kw)\n" ]
class Minion(MinionBase): ''' This class instantiates a minion, runs connections for a minion, and loads all of the functions into the minion ''' def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None): # pylint: disable=W0231 ''' Pass in...
saltstack/salt
salt/minion.py
Syndic._handle_decoded_payload
python
def _handle_decoded_payload(self, data): ''' Override this method if you wish to handle the decoded data differently. ''' # TODO: even do this?? data['to'] = int(data.get('to', self.opts['timeout'])) - 1 # Only forward the command if it didn't originate from ourse...
Override this method if you wish to handle the decoded data differently.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2969-L2978
null
class Syndic(Minion): ''' Make a Syndic minion, this minion will use the minion keys on the master to authenticate with a higher level master. ''' def __init__(self, opts, **kwargs): self._syndic_interface = opts.get('interface') self._syndic = True # force auth_safemode True...
saltstack/salt
salt/minion.py
Syndic.syndic_cmd
python
def syndic_cmd(self, data): ''' Take the now clear load and forward it on to the client cmd ''' # Set up default tgt_type if 'tgt_type' not in data: data['tgt_type'] = 'glob' kwargs = {} # optionally add a few fields to the publish data for fi...
Take the now clear load and forward it on to the client cmd
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L2980-L3010
null
class Syndic(Minion): ''' Make a Syndic minion, this minion will use the minion keys on the master to authenticate with a higher level master. ''' def __init__(self, opts, **kwargs): self._syndic_interface = opts.get('interface') self._syndic = True # force auth_safemode True...
saltstack/salt
salt/minion.py
Syndic.tune_in_no_block
python
def tune_in_no_block(self): ''' Executes the tune_in sequence but omits extra logging and the management of the event bus assuming that these are handled outside the tune_in sequence ''' # Instantiate the local client self.local = salt.client.get_local_client( ...
Executes the tune_in sequence but omits extra logging and the management of the event bus assuming that these are handled outside the tune_in sequence
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L3034-L3045
[ "def get_local_client(\n c_path=os.path.join(syspaths.CONFIG_DIR, 'master'),\n mopts=None,\n skip_perm_errors=False,\n io_loop=None,\n auto_reconnect=False):\n '''\n .. versionadded:: 2014.7.0\n\n Read in the config and return the correct LocalClient object based on\n ...
class Syndic(Minion): ''' Make a Syndic minion, this minion will use the minion keys on the master to authenticate with a higher level master. ''' def __init__(self, opts, **kwargs): self._syndic_interface = opts.get('interface') self._syndic = True # force auth_safemode True...
saltstack/salt
salt/minion.py
Syndic.destroy
python
def destroy(self): ''' Tear down the syndic minion ''' # We borrowed the local clients poller so give it back before # it's destroyed. Reset the local poller reference. super(Syndic, self).destroy() if hasattr(self, 'local'): del self.local if...
Tear down the syndic minion
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L3074-L3085
[ "def destroy(self):\n '''\n Tear down the minion\n '''\n if self._running is False:\n return\n\n self._running = False\n if hasattr(self, 'schedule'):\n del self.schedule\n if hasattr(self, 'pub_channel') and self.pub_channel is not None:\n self.pub_channel.on_recv(None)\n ...
class Syndic(Minion): ''' Make a Syndic minion, this minion will use the minion keys on the master to authenticate with a higher level master. ''' def __init__(self, opts, **kwargs): self._syndic_interface = opts.get('interface') self._syndic = True # force auth_safemode True...
saltstack/salt
salt/minion.py
SyndicManager._spawn_syndics
python
def _spawn_syndics(self): ''' Spawn all the coroutines which will sign in the syndics ''' self._syndics = OrderedDict() # mapping of opts['master'] -> syndic masters = self.opts['master'] if not isinstance(masters, list): masters = [masters] for maste...
Spawn all the coroutines which will sign in the syndics
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L3142-L3153
null
class SyndicManager(MinionBase): ''' Make a MultiMaster syndic minion, this minion will handle relaying jobs and returns from all minions connected to it to the list of masters it is connected to. Modes (controlled by `syndic_mode`: sync: This mode will synchronize all events and publishes from...
saltstack/salt
salt/minion.py
SyndicManager._connect_syndic
python
def _connect_syndic(self, opts): ''' Create a syndic, and asynchronously connect it to a master ''' auth_wait = opts['acceptance_wait_time'] failed = False while True: if failed: if auth_wait < self.max_auth_wait: auth_wait ...
Create a syndic, and asynchronously connect it to a master
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L3156-L3210
null
class SyndicManager(MinionBase): ''' Make a MultiMaster syndic minion, this minion will handle relaying jobs and returns from all minions connected to it to the list of masters it is connected to. Modes (controlled by `syndic_mode`: sync: This mode will synchronize all events and publishes from...
saltstack/salt
salt/minion.py
SyndicManager._mark_master_dead
python
def _mark_master_dead(self, master): ''' Mark a master as dead. This will start the sign-in routine ''' # if its connected, mark it dead if self._syndics[master].done(): syndic = self._syndics[master].result() # pylint: disable=no-member self._syndics[mas...
Mark a master as dead. This will start the sign-in routine
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L3212-L3225
null
class SyndicManager(MinionBase): ''' Make a MultiMaster syndic minion, this minion will handle relaying jobs and returns from all minions connected to it to the list of masters it is connected to. Modes (controlled by `syndic_mode`: sync: This mode will synchronize all events and publishes from...
saltstack/salt
salt/minion.py
SyndicManager._call_syndic
python
def _call_syndic(self, func, args=(), kwargs=None, master_id=None): ''' Wrapper to call a given func on a syndic, best effort to get the one you asked for ''' if kwargs is None: kwargs = {} successful = False # Call for each master for master, syndic_f...
Wrapper to call a given func on a syndic, best effort to get the one you asked for
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L3227-L3253
null
class SyndicManager(MinionBase): ''' Make a MultiMaster syndic minion, this minion will handle relaying jobs and returns from all minions connected to it to the list of masters it is connected to. Modes (controlled by `syndic_mode`: sync: This mode will synchronize all events and publishes from...
saltstack/salt
salt/minion.py
SyndicManager._return_pub_syndic
python
def _return_pub_syndic(self, values, master_id=None): ''' Wrapper to call the '_return_pub_multi' a syndic, best effort to get the one you asked for ''' func = '_return_pub_multi' for master, syndic_future in self.iter_master_options(master_id): if not syndic_future.d...
Wrapper to call the '_return_pub_multi' a syndic, best effort to get the one you asked for
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L3255-L3295
null
class SyndicManager(MinionBase): ''' Make a MultiMaster syndic minion, this minion will handle relaying jobs and returns from all minions connected to it to the list of masters it is connected to. Modes (controlled by `syndic_mode`: sync: This mode will synchronize all events and publishes from...
saltstack/salt
salt/minion.py
SyndicManager.iter_master_options
python
def iter_master_options(self, master_id=None): ''' Iterate (in order) over your options for master ''' masters = list(self._syndics.keys()) if self.opts['syndic_failover'] == 'random': shuffle(masters) if master_id not in self._syndics: master_id =...
Iterate (in order) over your options for master
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L3297-L3313
null
class SyndicManager(MinionBase): ''' Make a MultiMaster syndic minion, this minion will handle relaying jobs and returns from all minions connected to it to the list of masters it is connected to. Modes (controlled by `syndic_mode`: sync: This mode will synchronize all events and publishes from...
saltstack/salt
salt/minion.py
SyndicManager.tune_in
python
def tune_in(self): ''' Lock onto the publisher. This is the main event loop for the syndic ''' self._spawn_syndics() # Instantiate the local client self.local = salt.client.get_local_client( self.opts['_minion_conf_file'], io_loop=self.io_loop) self.lo...
Lock onto the publisher. This is the main event loop for the syndic
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L3324-L3352
[ "def get_local_client(\n c_path=os.path.join(syspaths.CONFIG_DIR, 'master'),\n mopts=None,\n skip_perm_errors=False,\n io_loop=None,\n auto_reconnect=False):\n '''\n .. versionadded:: 2014.7.0\n\n Read in the config and return the correct LocalClient object based on\n ...
class SyndicManager(MinionBase): ''' Make a MultiMaster syndic minion, this minion will handle relaying jobs and returns from all minions connected to it to the list of masters it is connected to. Modes (controlled by `syndic_mode`: sync: This mode will synchronize all events and publishes from...
saltstack/salt
salt/minion.py
ProxyMinion._post_master_init
python
def _post_master_init(self, master): ''' Function to finish init after connecting to a master This is primarily loading modules, pillars, etc. (since they need to know which master they connected to) If this function is changed, please check Minion._post_master_init to ...
Function to finish init after connecting to a master This is primarily loading modules, pillars, etc. (since they need to know which master they connected to) If this function is changed, please check Minion._post_master_init to see if those changes need to be propagated. Prox...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L3471-L3486
null
class ProxyMinion(Minion): ''' This class instantiates a 'proxy' minion--a minion that does not manipulate the host it runs on, but instead manipulates a device that cannot run a minion. ''' # TODO: better name... @tornado.gen.coroutine def _target_load(self, load): ''' Ve...
saltstack/salt
salt/minion.py
ProxyMinion._target_load
python
def _target_load(self, load): ''' Verify that the publication is valid and applies to this minion ''' mp_call = _metaproxy_call(self.opts, 'target_load') return mp_call(self, load)
Verify that the publication is valid and applies to this minion
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L3488-L3493
null
class ProxyMinion(Minion): ''' This class instantiates a 'proxy' minion--a minion that does not manipulate the host it runs on, but instead manipulates a device that cannot run a minion. ''' # TODO: better name... @tornado.gen.coroutine def _post_master_init(self, master): ''' ...
saltstack/salt
salt/minion.py
SProxyMinion.gen_modules
python
def gen_modules(self, initial_load=False): ''' Tell the minion to reload the execution modules CLI Example: .. code-block:: bash salt '*' sys.reload_modules ''' self.opts['grains'] = salt.loader.grains(self.opts) self.opts['pillar'] = salt.pillar.ge...
Tell the minion to reload the execution modules CLI Example: .. code-block:: bash salt '*' sys.reload_modules
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L3528-L3607
[ "def get_pillar(opts, grains, minion_id, saltenv=None, ext=None, funcs=None,\n pillar_override=None, pillarenv=None, extra_minion_data=None):\n '''\n Return the correct pillar driver based on the file_client option\n '''\n file_client = opts['file_client']\n if opts.get('master_type') =...
class SProxyMinion(SMinion): ''' Create an object that has loaded all of the minion module functions, grains, modules, returners etc. The SProxyMinion allows developers to generate all of the salt minion functions and present them with these functions for general use. '''
saltstack/salt
salt/states/pkg.py
_get_comparison_spec
python
def _get_comparison_spec(pkgver): ''' Return a tuple containing the comparison operator and the version. If no comparison operator was passed, the comparison is assumed to be an "equals" comparison, and "==" will be the operator returned. ''' oper, verstr = salt.utils.pkg.split_comparison(pkgver...
Return a tuple containing the comparison operator and the version. If no comparison operator was passed, the comparison is assumed to be an "equals" comparison, and "==" will be the operator returned.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L153-L162
null
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
_parse_version_string
python
def _parse_version_string(version_conditions_string): ''' Returns a list of two-tuples containing (operator, version). ''' result = [] version_conditions_string = version_conditions_string.strip() if not version_conditions_string: return result for version_condition in version_condit...
Returns a list of two-tuples containing (operator, version).
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L165-L176
[ "def _get_comparison_spec(pkgver):\n '''\n Return a tuple containing the comparison operator and the version. If no\n comparison operator was passed, the comparison is assumed to be an \"equals\"\n comparison, and \"==\" will be the operator returned.\n '''\n oper, verstr = salt.utils.pkg.split_co...
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
_fulfills_version_string
python
def _fulfills_version_string(installed_versions, version_conditions_string, ignore_epoch=False, allow_updates=False): ''' Returns True if any of the installed versions match the specified version conditions, otherwise returns False. installed_versions The installed versions version_conditi...
Returns True if any of the installed versions match the specified version conditions, otherwise returns False. installed_versions The installed versions version_conditions_string The string containing all version conditions. E.G. 1.2.3-4 >=1.2.3-4 >=1.2.3-4, <2.3.4-...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L179-L215
[ "def _fulfills_version_spec(versions, oper, desired_version,\n ignore_epoch=False):\n '''\n Returns True if any of the installed versions match the specified version,\n otherwise returns False\n '''\n cmp_func = __salt__.get('pkg.version_cmp')\n # stripping \"with_origin\...
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
_fulfills_version_spec
python
def _fulfills_version_spec(versions, oper, desired_version, ignore_epoch=False): ''' Returns True if any of the installed versions match the specified version, otherwise returns False ''' cmp_func = __salt__.get('pkg.version_cmp') # stripping "with_origin" dict wrapper...
Returns True if any of the installed versions match the specified version, otherwise returns False
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L218-L237
[ "def compare(ver1='', oper='==', ver2='', cmp_func=None, ignore_epoch=False):\n '''\n Compares two version numbers. Accepts a custom function to perform the\n cmp-style version comparison, otherwise uses version_cmp().\n '''\n cmp_map = {'<': (-1,), '<=': (-1, 0), '==': (0,),\n '>=': (0...
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
_find_unpurge_targets
python
def _find_unpurge_targets(desired, **kwargs): ''' Find packages which are marked to be purged but can't yet be removed because they are dependencies for other installed packages. These are the packages which will need to be 'unpurged' because they are part of pkg.installed states. This really just a...
Find packages which are marked to be purged but can't yet be removed because they are dependencies for other installed packages. These are the packages which will need to be 'unpurged' because they are part of pkg.installed states. This really just applies to Debian-based Linuxes.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L240-L250
null
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
_find_download_targets
python
def _find_download_targets(name=None, version=None, pkgs=None, normalize=True, skip_suggestions=False, ignore_epoch=False, **kwargs): ''' Inspect the ...
Inspect the arguments to pkg.downloaded and discover what packages need to be downloaded. Return a dict of packages to download.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L253-L372
null
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
_find_advisory_targets
python
def _find_advisory_targets(name=None, advisory_ids=None, **kwargs): ''' Inspect the arguments to pkg.patch_installed and discover what advisory patches need to be installed. Return a dict of advisory patches to install. ''' cur_patches = __salt__...
Inspect the arguments to pkg.patch_installed and discover what advisory patches need to be installed. Return a dict of advisory patches to install.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L375-L412
null
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
_find_remove_targets
python
def _find_remove_targets(name=None, version=None, pkgs=None, normalize=True, ignore_epoch=False, **kwargs): ''' Inspect the arguments to pkg.removed and discover what packages need to ...
Inspect the arguments to pkg.removed and discover what packages need to be removed. Return a dict of packages to remove.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L415-L493
null
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
_find_install_targets
python
def _find_install_targets(name=None, version=None, pkgs=None, sources=None, skip_suggestions=False, pkg_verify=False, normalize=True, igno...
Inspect the arguments to pkg.installed and discover what packages need to be installed. Return a dict of desired packages
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L496-L837
null
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
_verify_install
python
def _verify_install(desired, new_pkgs, ignore_epoch=False, new_caps=None): ''' Determine whether or not the installed packages match what was requested in the SLS file. ''' ok = [] failed = [] if not new_caps: new_caps = dict() for pkgname, pkgver in desired.items(): # Fr...
Determine whether or not the installed packages match what was requested in the SLS file.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L840-L884
null
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
_get_desired_pkg
python
def _get_desired_pkg(name, desired): ''' Helper function that retrieves and nicely formats the desired pkg (and version if specified) so that helpful information can be printed in the comment for the state. ''' if not desired[name] or desired[name].startswith(('<', '>', '=')): oper = '' ...
Helper function that retrieves and nicely formats the desired pkg (and version if specified) so that helpful information can be printed in the comment for the state.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L887-L898
null
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
_preflight_check
python
def _preflight_check(desired, fromrepo, **kwargs): ''' Perform platform-specific checks on desired packages ''' if 'pkg.check_db' not in __salt__: return {} ret = {'suggest': {}, 'no_suggest': []} pkginfo = __salt__['pkg.check_db']( *list(desired.keys()), fromrepo=fromrepo, **kwa...
Perform platform-specific checks on desired packages
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L901-L917
null
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
_nested_output
python
def _nested_output(obj): ''' Serialize obj and format for output ''' nested.__opts__ = __opts__ ret = nested.output(obj).rstrip() return ret
Serialize obj and format for output
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L920-L926
null
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
_resolve_capabilities
python
def _resolve_capabilities(pkgs, refresh=False, **kwargs): ''' Resolve capabilities in ``pkgs`` and exchange them with real package names, when the result is distinct. This feature can be turned on while setting the paramter ``resolve_capabilities`` to True. Return the input dictionary with repl...
Resolve capabilities in ``pkgs`` and exchange them with real package names, when the result is distinct. This feature can be turned on while setting the paramter ``resolve_capabilities`` to True. Return the input dictionary with replaced capability names and as second return value a bool which say ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L929-L946
null
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
installed
python
def installed( name, version=None, refresh=None, fromrepo=None, skip_verify=False, skip_suggestions=False, pkgs=None, sources=None, allow_updates=False, pkg_verify=False, normalize=True, ignore_epoch=False, reinstall...
Ensure that the package is installed, and that it is the correct version (if specified). :param str name: The name of the package to be installed. This parameter is ignored if either "pkgs" or "sources" is used. Additionally, please note that this option can only be used to install pack...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L949-L2023
[ "def check_refresh(opts, refresh=None):\n '''\n Check whether or not a refresh is necessary\n\n Returns:\n\n - True if refresh evaluates as True\n - False if refresh is False\n - A boolean if refresh is not False and the rtag file exists\n '''\n return bool(\n salt.utils.data.is_true(...
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
downloaded
python
def downloaded(name, version=None, pkgs=None, fromrepo=None, ignore_epoch=None, **kwargs): ''' .. versionadded:: 2017.7.0 Ensure that the package is downloaded, and that it is the correct version (if specified). Currently s...
.. versionadded:: 2017.7.0 Ensure that the package is downloaded, and that it is the correct version (if specified). Currently supported for the following pkg providers: :mod:`yumpkg <salt.modules.yumpkg>` and :mod:`zypper <salt.modules.zypper>` :param str name: The name of the package to...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L2026-L2181
[ "def _find_download_targets(name=None,\n version=None,\n pkgs=None,\n normalize=True,\n skip_suggestions=False,\n ignore_epoch=False,\n **kwargs):\n '''\n ...
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
patch_installed
python
def patch_installed(name, advisory_ids=None, downloadonly=None, **kwargs): ''' .. versionadded:: 2017.7.0 Ensure that packages related to certain advisory ids are installed. Currently supported for the following pkg providers: :mod:`yumpkg <salt.modules.yumpkg>` and :mod:`zypper <salt.modules.zypp...
.. versionadded:: 2017.7.0 Ensure that packages related to certain advisory ids are installed. Currently supported for the following pkg providers: :mod:`yumpkg <salt.modules.yumpkg>` and :mod:`zypper <salt.modules.zypper>` CLI Example: .. code-block:: yaml issue-foo-fixed: pk...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L2184-L2261
[ "def _find_advisory_targets(name=None,\n advisory_ids=None,\n **kwargs):\n '''\n Inspect the arguments to pkg.patch_installed and discover what advisory\n patches need to be installed. Return a dict of advisory patches to install.\n '''\n cur_patche...
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
patch_downloaded
python
def patch_downloaded(name, advisory_ids=None, **kwargs): ''' .. versionadded:: 2017.7.0 Ensure that packages related to certain advisory ids are downloaded. Currently supported for the following pkg providers: :mod:`yumpkg <salt.modules.yumpkg>` and :mod:`zypper <salt.modules.zypper>` CLI Exa...
.. versionadded:: 2017.7.0 Ensure that packages related to certain advisory ids are downloaded. Currently supported for the following pkg providers: :mod:`yumpkg <salt.modules.yumpkg>` and :mod:`zypper <salt.modules.zypper>` CLI Example: .. code-block:: yaml preparing-to-fix-issues: ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L2264-L2295
[ "def patch_installed(name, advisory_ids=None, downloadonly=None, **kwargs):\n '''\n .. versionadded:: 2017.7.0\n\n Ensure that packages related to certain advisory ids are installed.\n\n Currently supported for the following pkg providers:\n :mod:`yumpkg <salt.modules.yumpkg>` and :mod:`zypper <salt....
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
_uninstall
python
def _uninstall( action='remove', name=None, version=None, pkgs=None, normalize=True, ignore_epoch=False, **kwargs): ''' Common function for package removal ''' if action not in ('remove', 'purge'): return {'name': name, 'changes': {}, '...
Common function for package removal
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L2666-L2767
[ "def _find_remove_targets(name=None,\n version=None,\n pkgs=None,\n normalize=True,\n ignore_epoch=False,\n **kwargs):\n '''\n Inspect the arguments to pkg.removed and discover what packages...
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
purged
python
def purged(name, version=None, pkgs=None, normalize=True, ignore_epoch=False, **kwargs): ''' Verify that a package is not installed, calling ``pkg.purge`` if necessary to purge the package. All configuration files are also removed. name The...
Verify that a package is not installed, calling ``pkg.purge`` if necessary to purge the package. All configuration files are also removed. name The name of the package to be purged. version The version of the package that should be removed. Don't do anything if the package is insta...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L2876-L2979
[ "def _uninstall(\n action='remove',\n name=None,\n version=None,\n pkgs=None,\n normalize=True,\n ignore_epoch=False,\n **kwargs):\n '''\n Common function for package removal\n '''\n if action not in ('remove', 'purge'):\n return {'name': name,\n 'changes': {},...
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
uptodate
python
def uptodate(name, refresh=False, pkgs=None, **kwargs): ''' .. versionadded:: 2014.7.0 .. versionchanged:: 2018.3.0 Added support for the ``pkgin`` provider. Verify that the system is completely up to date. name The name has no functional value and is only used as a tracking ...
.. versionadded:: 2014.7.0 .. versionchanged:: 2018.3.0 Added support for the ``pkgin`` provider. Verify that the system is completely up to date. name The name has no functional value and is only used as a tracking reference refresh refresh the package database befor...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L2982-L3089
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def iterkeys(d, **kw):\n return d.iterkeys(**kw)\n", "def _resolve_capabilities(pkgs, refresh=False, **kwargs):\n '''\n Resolve capabilities in ``pkgs`` and exchange them with real package\n names, when the result is distinct.\n This fea...
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
group_installed
python
def group_installed(name, skip=None, include=None, **kwargs): ''' .. versionadded:: 2015.8.0 .. versionchanged:: 2016.11.0 Added support in :mod:`pacman <salt.modules.pacman>` Ensure that an entire package group is installed. This state is currently only supported for the :mod:`yum <salt.m...
.. versionadded:: 2015.8.0 .. versionchanged:: 2016.11.0 Added support in :mod:`pacman <salt.modules.pacman>` Ensure that an entire package group is installed. This state is currently only supported for the :mod:`yum <salt.modules.yumpkg>` and :mod:`pacman <salt.modules.pacman>` package manage...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L3092-L3237
null
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
mod_init
python
def mod_init(low): ''' Set a flag to tell the install functions to refresh the package database. This ensures that the package database is refreshed only once during a state run significantly improving the speed of package management during a state run. It sets a flag for a number of reasons, p...
Set a flag to tell the install functions to refresh the package database. This ensures that the package database is refreshed only once during a state run significantly improving the speed of package management during a state run. It sets a flag for a number of reasons, primarily due to timeline logic....
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L3240-L3266
[ "def write_rtag(opts):\n '''\n Write the rtag file\n '''\n rtag_file = rtag(opts)\n if not os.path.exists(rtag_file):\n try:\n with salt.utils.files.fopen(rtag_file, 'w+'):\n pass\n except OSError as exc:\n log.warning('Encountered error writing rtag...
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/pkg.py
mod_watch
python
def mod_watch(name, **kwargs): ''' Install/reinstall a package based on a watch requisite .. note:: This state exists to support special handling of the ``watch`` :ref:`requisite <requisites>`. It should not be called directly. Parameters for this function should be set by the stat...
Install/reinstall a package based on a watch requisite .. note:: This state exists to support special handling of the ``watch`` :ref:`requisite <requisites>`. It should not be called directly. Parameters for this function should be set by the state being triggered.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L3329-L3349
null
# -*- coding: utf-8 -*- ''' Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate c...
saltstack/salt
salt/states/openvswitch_port.py
present
python
def present(name, bridge, tunnel_type=None, id=None, remote=None, dst_port=None, internal=False): ''' Ensures that the named port exists on bridge, eventually creates it. Args: name: The name of the port. bridge: The name of the bridge. tunnel_type: Optional type of interface to cre...
Ensures that the named port exists on bridge, eventually creates it. Args: name: The name of the port. bridge: The name of the bridge. tunnel_type: Optional type of interface to create, currently supports: vlan, vxlan and gre. id: Optional tunnel's key. remote: Remote endpoi...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/openvswitch_port.py#L20-L271
[ "def _check_vlan():\n tag = __salt__['openvswitch.port_get_tag'](name)\n interfaces = __salt__['network.interfaces']()\n if not 0 <= id <= 4095:\n ret['result'] = False\n ret['comment'] = comments['comment_vlan_invalid_id']\n elif not internal and name not in interfaces:\n ret['resu...
# -*- coding: utf-8 -*- ''' Management of Open vSwitch ports. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt libs from salt.ext import six def __virtual__(): ''' Only make these states available if Open vSwitch module is available. ''' ...
saltstack/salt
salt/states/openvswitch_port.py
absent
python
def absent(name, bridge=None): ''' Ensures that the named port exists on bridge, eventually deletes it. If bridge is not set, port is removed from whatever bridge contains it. Args: name: The name of the port. bridge: The name of the bridge. ''' ret = {'name': name, 'changes':...
Ensures that the named port exists on bridge, eventually deletes it. If bridge is not set, port is removed from whatever bridge contains it. Args: name: The name of the port. bridge: The name of the bridge.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/openvswitch_port.py#L274-L339
null
# -*- coding: utf-8 -*- ''' Management of Open vSwitch ports. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt libs from salt.ext import six def __virtual__(): ''' Only make these states available if Open vSwitch module is available. ''' ...
saltstack/salt
salt/modules/system_profiler.py
_call_system_profiler
python
def _call_system_profiler(datatype): ''' Call out to system_profiler. Return a dictionary of the stuff we are interested in. ''' p = subprocess.Popen( [PROFILER_BINARY, '-detailLevel', 'full', '-xml', datatype], stdout=subprocess.PIPE) (sysprofresults, sysprof_stderr) = p.comm...
Call out to system_profiler. Return a dictionary of the stuff we are interested in.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/system_profiler.py#L34-L55
null
# -*- coding: utf-8 -*- ''' System Profiler Module Interface with macOS's command-line System Profiler utility to get information about package receipts and installed applications. .. versionadded:: 2015.5.0 ''' from __future__ import absolute_import, unicode_literals, print_function import plistlib import subproc...
saltstack/salt
salt/modules/system_profiler.py
receipts
python
def receipts(): ''' Return the results of a call to ``system_profiler -xml -detail full SPInstallHistoryDataType`` as a dictionary. Top-level keys of the dictionary are the names of each set of install receipts, since there can be multiple receipts with the same name. Contents of each key a...
Return the results of a call to ``system_profiler -xml -detail full SPInstallHistoryDataType`` as a dictionary. Top-level keys of the dictionary are the names of each set of install receipts, since there can be multiple receipts with the same name. Contents of each key are a list of dictionaries. ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/system_profiler.py#L58-L95
[ "def _call_system_profiler(datatype):\n '''\n Call out to system_profiler. Return a dictionary\n of the stuff we are interested in.\n '''\n\n p = subprocess.Popen(\n [PROFILER_BINARY, '-detailLevel', 'full',\n '-xml', datatype], stdout=subprocess.PIPE)\n (sysprofresults, sysprof_st...
# -*- coding: utf-8 -*- ''' System Profiler Module Interface with macOS's command-line System Profiler utility to get information about package receipts and installed applications. .. versionadded:: 2015.5.0 ''' from __future__ import absolute_import, unicode_literals, print_function import plistlib import subproc...
saltstack/salt
salt/states/solrcloud.py
alias
python
def alias(name, collections, **kwargs): ''' Create alias and enforce collection list. Use the solrcloud module to get alias members and set them. You can pass additional arguments that will be forwarded to http.query name The collection name collections list of collections to ...
Create alias and enforce collection list. Use the solrcloud module to get alias members and set them. You can pass additional arguments that will be forwarded to http.query name The collection name collections list of collections to include in the alias
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/solrcloud.py#L19-L75
null
# -*- coding: utf-8 -*- ''' States for solrcloud alias and collection configuration .. versionadded:: 2017.7.0 ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt libs import salt.utils.json # Import 3rd party libs from salt.ext import six def collecti...
saltstack/salt
salt/states/solrcloud.py
collection
python
def collection(name, options=None, **kwargs): ''' Create collection and enforce options. Use the solrcloud module to get collection parameters. You can pass additional arguments that will be forwarded to http.query name The collection name options : {} options to ensure ''...
Create collection and enforce options. Use the solrcloud module to get collection parameters. You can pass additional arguments that will be forwarded to http.query name The collection name options : {} options to ensure
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/solrcloud.py#L78-L159
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def dumps(obj, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.dumps, and assumes that ensure_ascii is False (unless explicitly\n passed as True) for unicode compatibility. Note that setting it to True\n will mess up any unico...
# -*- coding: utf-8 -*- ''' States for solrcloud alias and collection configuration .. versionadded:: 2017.7.0 ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt libs import salt.utils.json # Import 3rd party libs from salt.ext import six def alias(nam...
saltstack/salt
salt/modules/consul.py
_query
python
def _query(function, consul_url, token=None, method='GET', api_version='v1', data=None, query_params=None): ''' Consul object method function to construct and execute on the API URL. :param api_url: The Consul api url. :param api_ver...
Consul object method function to construct and execute on the API URL. :param api_url: The Consul api url. :param api_version The Consul api version :param function: The Consul api function to perform. :param method: The HTTP method, e.g. GET or POST. :param data: The data to be...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/consul.py#L50-L113
[ "def dumps(obj, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.dumps, and assumes that ensure_ascii is False (unless explicitly\n passed as True) for unicode compatibility. Note that setting it to True\n will mess up any unicode characters, as they will be dumped as the string\n lite...
# -*- coding: utf-8 -*- ''' Interact with Consul https://www.consul.io ''' # Import Python Libs from __future__ import absolute_import, print_function, unicode_literals import base64 import logging # Import salt libs import salt.utils.http import salt.utils.json # Import 3rd-party libs from salt.ext import six fro...
saltstack/salt
salt/modules/consul.py
list_
python
def list_(consul_url=None, token=None, key=None, **kwargs): ''' List keys in Consul :param consul_url: The Consul server URL. :param key: The key to use as the starting point for the list. :return: The list of keys. CLI Example: .. code-block:: bash salt '*' consul.list s...
List keys in Consul :param consul_url: The Consul server URL. :param key: The key to use as the starting point for the list. :return: The list of keys. CLI Example: .. code-block:: bash salt '*' consul.list salt '*' consul.list key='web'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/consul.py#L116-L160
[ "def _query(function,\n consul_url,\n token=None,\n method='GET',\n api_version='v1',\n data=None,\n query_params=None):\n '''\n Consul object method function to construct and execute on the API URL.\n\n :param api_url: The Consul api url.\n ...
# -*- coding: utf-8 -*- ''' Interact with Consul https://www.consul.io ''' # Import Python Libs from __future__ import absolute_import, print_function, unicode_literals import base64 import logging # Import salt libs import salt.utils.http import salt.utils.json # Import 3rd-party libs from salt.ext import six fro...
saltstack/salt
salt/modules/consul.py
get
python
def get(consul_url=None, key=None, token=None, recurse=False, decode=False, raw=False): ''' Get key from Consul :param consul_url: The Consul server URL. :param key: The key to use as the starting point for the list. :param recurse: Return values recursively beginning at the value of key. :para...
Get key from Consul :param consul_url: The Consul server URL. :param key: The key to use as the starting point for the list. :param recurse: Return values recursively beginning at the value of key. :param decode: By default values are stored as Base64 encoded values, decode will retu...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/consul.py#L163-L224
[ "def _query(function,\n consul_url,\n token=None,\n method='GET',\n api_version='v1',\n data=None,\n query_params=None):\n '''\n Consul object method function to construct and execute on the API URL.\n\n :param api_url: The Consul api url.\n ...
# -*- coding: utf-8 -*- ''' Interact with Consul https://www.consul.io ''' # Import Python Libs from __future__ import absolute_import, print_function, unicode_literals import base64 import logging # Import salt libs import salt.utils.http import salt.utils.json # Import 3rd-party libs from salt.ext import six fro...
saltstack/salt
salt/modules/consul.py
put
python
def put(consul_url=None, token=None, key=None, value=None, **kwargs): ''' Put values into Consul :param consul_url: The Consul server URL. :param key: The key to use as the starting point for the list. :param value: The value to set the key to. :param flags: This can be used to specify an unsig...
Put values into Consul :param consul_url: The Consul server URL. :param key: The key to use as the starting point for the list. :param value: The value to set the key to. :param flags: This can be used to specify an unsigned value between 0 and 2^64-1. Clients can choose to use ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/consul.py#L227-L345
[ "def get(consul_url=None, key=None, token=None, recurse=False, decode=False, raw=False):\n '''\n Get key from Consul\n\n :param consul_url: The Consul server URL.\n :param key: The key to use as the starting point for the list.\n :param recurse: Return values recursively beginning at the value of key...
# -*- coding: utf-8 -*- ''' Interact with Consul https://www.consul.io ''' # Import Python Libs from __future__ import absolute_import, print_function, unicode_literals import base64 import logging # Import salt libs import salt.utils.http import salt.utils.json # Import 3rd-party libs from salt.ext import six fro...
saltstack/salt
salt/modules/consul.py
delete
python
def delete(consul_url=None, token=None, key=None, **kwargs): ''' Delete values from Consul :param consul_url: The Consul server URL. :param key: The key to use as the starting point for the list. :param recurse: Delete values recursively beginning at the value of key. :param cas: This flag is u...
Delete values from Consul :param consul_url: The Consul server URL. :param key: The key to use as the starting point for the list. :param recurse: Delete values recursively beginning at the value of key. :param cas: This flag is used to turn the DELETE into a Check-And-Set operation. ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/consul.py#L348-L406
[ "def _query(function,\n consul_url,\n token=None,\n method='GET',\n api_version='v1',\n data=None,\n query_params=None):\n '''\n Consul object method function to construct and execute on the API URL.\n\n :param api_url: The Consul api url.\n ...
# -*- coding: utf-8 -*- ''' Interact with Consul https://www.consul.io ''' # Import Python Libs from __future__ import absolute_import, print_function, unicode_literals import base64 import logging # Import salt libs import salt.utils.http import salt.utils.json # Import 3rd-party libs from salt.ext import six fro...
saltstack/salt
salt/modules/consul.py
agent_checks
python
def agent_checks(consul_url=None, token=None): ''' Returns the checks the local agent is managing :param consul_url: The Consul server URL. :return: Returns the checks the local agent is managing CLI Example: .. code-block:: bash salt '*' consul.agent_checks ''' ret = {} ...
Returns the checks the local agent is managing :param consul_url: The Consul server URL. :return: Returns the checks the local agent is managing CLI Example: .. code-block:: bash salt '*' consul.agent_checks
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/consul.py#L409-L437
[ "def _query(function,\n consul_url,\n token=None,\n method='GET',\n api_version='v1',\n data=None,\n query_params=None):\n '''\n Consul object method function to construct and execute on the API URL.\n\n :param api_url: The Consul api url.\n ...
# -*- coding: utf-8 -*- ''' Interact with Consul https://www.consul.io ''' # Import Python Libs from __future__ import absolute_import, print_function, unicode_literals import base64 import logging # Import salt libs import salt.utils.http import salt.utils.json # Import 3rd-party libs from salt.ext import six fro...