INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
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
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...
Refresh the functions and returners.
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.
def beacons_refresh(self): ''' Refresh the functions and returners. ''' log.debug('Refreshing beacons.') self.beacons = salt.beacons.Beacon(self.opts, self.functions)
Refresh the matchers
def matchers_refresh(self): ''' Refresh the matchers ''' log.debug('Refreshing matchers.') self.matchers = salt.loader.matchers(self.opts)
Refresh the pillar
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 functions and returners.
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) ...
Manage Beacons
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...
Set the salt - minion main process environment according to the data contained in the minion event data
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 minion running flag and issue the appropriate warnings if the minion cannot be started or is already running
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( ...
Send mine data to the master
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....
Handle a module_refresh event
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 pillar_refresh event
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 grains_refresh event
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 fire_master event
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 master_disconnected_failback event
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_connected event
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 _schedule_return event
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 _salt_error event
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_auth_creds event
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 an event from the epull_sock ( all local minion events )
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...
Fallback cleanup routines attempting to fix leaked processes threads etc.
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...
Set up the core minion attributes. This is safe to call multiple times.
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 beacons. This is safe to call multiple times.
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 scheduler. This is safe to call multiple times.
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: ...
Lock onto the publisher. This is the main event loop for the minion: rtype: None
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...
Tear down the minion
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_...
Override this method if you wish to handle the decoded data differently.
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...
Take the now clear load and forward it on to the client cmd
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...
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
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( ...
Tear down the syndic minion
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...
Spawn all the coroutines which will sign in the syndics
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...
Create a syndic and asynchronously connect it to a master
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 ...
Mark a master as dead. This will start the sign - in routine
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...
Wrapper to call a given func on a syndic best effort to get the one you asked for
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 the _return_pub_multi a syndic best effort to get the one you asked for
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...
Iterate ( in order ) over your options for master
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 =...
Lock onto the publisher. This is the main event loop for the syndic
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...
Function to finish init after connecting to a master
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 ...
Verify that the publication is valid and applies to this minion
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)
Tell the minion to reload the execution modules
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...
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.
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...
Returns a list of two - tuples containing ( operator version ).
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 True if any of the installed versions match the specified version conditions otherwise returns False.
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 otherwise returns False
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...
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.
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...
Inspect the arguments to pkg. downloaded and discover what packages need to be downloaded. Return a dict of packages to download.
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. patch_installed and discover what advisory patches need to be installed. Return a dict of advisory patches to install.
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. removed and discover what packages need to be removed. Return a dict of packages to remove.
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. installed and discover what packages need to be installed. Return a dict of desired packages
def _find_install_targets(name=None, version=None, pkgs=None, sources=None, skip_suggestions=False, pkg_verify=False, normalize=True, igno...
Determine whether or not the installed packages match what was requested in the SLS file.
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...
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.
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 = '' ...
Perform platform - specific checks on desired packages
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...
Serialize obj and format for output
def _nested_output(obj): ''' Serialize obj and format for output ''' nested.__opts__ = __opts__ ret = nested.output(obj).rstrip() return ret
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.
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...
Ensure that the package is installed and that it is the correct version ( if specified ).
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...
.. versionadded:: 2017. 7. 0
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
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
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...
Common function for package removal
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': {}, '...
Verify that a package is not installed calling pkg. purge if necessary to purge the package. All configuration files are also removed.
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...
.. versionadded:: 2014. 7. 0.. versionchanged:: 2018. 3. 0
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:: 2015. 8. 0
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...
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.
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...
Install/ reinstall a package based on a watch requisite
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...
Ensures that the named port exists on bridge eventually creates it.
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 deletes it. If bridge is not set port is removed from whatever bridge contains it.
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':...
Call out to system_profiler. Return a dictionary of the stuff we are interested in.
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...
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.
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...
Create alias and enforce collection list.
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 collection and enforce options.
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 ''...
Consul object method function to construct and execute on the API URL.
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...
List keys in Consul
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...
Get key from Consul
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...
Put values into Consul
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...
Delete values from Consul
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...
Returns the checks the local agent is managing
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 members as seen by the local serf agent
def agent_members(consul_url=None, token=None, **kwargs): ''' Returns the members as seen by the local serf agent :param consul_url: The Consul server URL. :return: Returns the members as seen by the local serf agent CLI Example: .. code-block:: bash salt '*' consul.agent_members ...
Returns the local node configuration
def agent_self(consul_url=None, token=None): ''' Returns the local node configuration :param consul_url: The Consul server URL. :return: Returns the local node configuration CLI Example: .. code-block:: bash salt '*' consul.agent_self ''' ret = {} query_params = {} i...
Manages node maintenance mode
def agent_maintenance(consul_url=None, token=None, **kwargs): ''' Manages node maintenance mode :param consul_url: The Consul server URL. :param enable: The enable flag is required. Acceptable values are either true (to enter maintenance mode) or ...
Used to instruct the agent to force a node into the left state.
def agent_leave(consul_url=None, token=None, node=None): ''' Used to instruct the agent to force a node into the left state. :param consul_url: The Consul server URL. :param node: The node the agent will force into left state :return: Boolean and message indicating success or failure. CLI Exam...
The register endpoint is used to add a new check to the local agent.
def agent_check_register(consul_url=None, token=None, **kwargs): ''' The register endpoint is used to add a new check to the local agent. :param consul_url: The Consul server URL. :param name: The description of what the check is for. :param id: The unique name to use for the check, if not ...
The agent will take care of deregistering the check from the Catalog.
def agent_check_deregister(consul_url=None, token=None, checkid=None): ''' The agent will take care of deregistering the check from the Catalog. :param consul_url: The Consul server URL. :param checkid: The ID of the check to deregister from Consul. :return: Boolean and message indicating success o...
This endpoint is used with a check that is of the TTL type. When this is called the status of the check is set to warning and the TTL clock is reset.
def agent_check_warn(consul_url=None, token=None, checkid=None, **kwargs): ''' This endpoint is used with a check that is of the TTL type. When this is called, the status of the check is set to warning and the TTL clock is reset. :param consul_url: The Consul server URL. :param checkid: The ID ...
The used to add a new service with an optional health check to the local agent.
def agent_service_register(consul_url=None, token=None, **kwargs): ''' The used to add a new service, with an optional health check, to the local agent. :param consul_url: The Consul server URL. :param name: A name describing the service. :param address: The address used by the service, default...
Used to remove a service.
def agent_service_deregister(consul_url=None, token=None, serviceid=None): ''' Used to remove a service. :param consul_url: The Consul server URL. :param serviceid: A serviceid describing the service. :return: Boolean and message indicating success or failure. CLI Example: .. code-block::...
Used to place a service into maintenance mode.
def agent_service_maintenance(consul_url=None, token=None, serviceid=None, **kwargs): ''' Used to place a service into maintenance mode. :param consul_url: The Consul server URL. :param serviceid: A name of the service. :param enable: Whether the service should be enabled or disabled. :param re...
Used to create a session.
def session_create(consul_url=None, token=None, **kwargs): ''' Used to create a session. :param consul_url: The Consul server URL. :param lockdelay: Duration string using a "s" suffix for seconds. The default is 15s. :param node: Must refer to a node that is already registered...
Used to list sessions.
def session_list(consul_url=None, token=None, return_list=False, **kwargs): ''' Used to list sessions. :param consul_url: The Consul server URL. :param dc: By default, the datacenter of the agent is queried; however, the dc can be provided using the "dc" parameter. :param return_list...
Destroy session
def session_destroy(consul_url=None, token=None, session=None, **kwargs): ''' Destroy session :param consul_url: The Consul server URL. :param session: The ID of the session to destroy. :param dc: By default, the datacenter of the agent is queried; however, the dc can be provided usi...
Information about a session
def session_info(consul_url=None, token=None, session=None, **kwargs): ''' Information about a session :param consul_url: The Consul server URL. :param session: The ID of the session to return information about. :param dc: By default, the datacenter of the agent is queried; however, ...
Registers a new node service or check
def catalog_register(consul_url=None, token=None, **kwargs): ''' Registers a new node, service, or check :param consul_url: The Consul server URL. :param dc: By default, the datacenter of the agent is queried; however, the dc can be provided using the "dc" parameter. :param node: The...
Return list of available datacenters from catalog.
def catalog_datacenters(consul_url=None, token=None): ''' Return list of available datacenters from catalog. :param consul_url: The Consul server URL. :return: The list of available datacenters. CLI Example: .. code-block:: bash salt '*' consul.catalog_datacenters ''' ret = ...
Return list of available nodes from catalog.
def catalog_nodes(consul_url=None, token=None, **kwargs): ''' Return list of available nodes from catalog. :param consul_url: The Consul server URL. :param dc: By default, the datacenter of the agent is queried; however, the dc can be provided using the "dc" parameter. :return: The l...
Health information about the registered node.
def health_node(consul_url=None, token=None, node=None, **kwargs): ''' Health information about the registered node. :param consul_url: The Consul server URL. :param node: The node to request health information about. :param dc: By default, the datacenter of the agent is queried; how...
Health information about the registered service.
def health_checks(consul_url=None, token=None, service=None, **kwargs): ''' Health information about the registered service. :param consul_url: The Consul server URL. :param service: The service to request health information about. :param dc: By default, the datacenter of the agent is queried; ...
Returns the checks in the state provided on the path.
def health_state(consul_url=None, token=None, state=None, **kwargs): ''' Returns the checks in the state provided on the path. :param consul_url: The Consul server URL. :param state: The state to show checks for. The supported states are any, unknown, passing, warning, or critical. ...
Delete an ACL token.
def acl_delete(consul_url=None, token=None, **kwargs): ''' Delete an ACL token. :param consul_url: The Consul server URL. :param id: Unique identifier for the ACL to update. :return: Boolean & message of success or failure. CLI Example: .. code-block:: bash salt '*' consul.acl_de...
Information about an ACL token.
def acl_info(consul_url=None, **kwargs): ''' Information about an ACL token. :param consul_url: The Consul server URL. :param id: Unique identifier for the ACL to update. :return: Information about the ACL requested. CLI Example: .. code-block:: bash salt '*' consul.acl_info id='...
List the ACL tokens.
def acl_list(consul_url=None, token=None, **kwargs): ''' List the ACL tokens. :param consul_url: The Consul server URL. :return: List of ACLs CLI Example: .. code-block:: bash salt '*' consul.acl_list ''' ret = {} data = {} if not consul_url: consul_url = _ge...
List the ACL tokens.
def event_fire(consul_url=None, token=None, name=None, **kwargs): ''' List the ACL tokens. :param consul_url: The Consul server URL. :param name: The name of the event to fire. :param dc: By default, the datacenter of the agent is queried; however, the dc can be provided using the "d...