INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
Return the arp table from the minion
def arp(): ''' Return the arp table from the minion .. versionchanged:: 2015.8.0 Added support for SunOS CLI Example: .. code-block:: bash salt '*' network.arp ''' ret = {} out = __salt__['cmd.run']('arp -an') for line in out.splitlines(): comps = line.spl...
returns the network address subnet mask and broadcast address of a cidr address
def convert_cidr(cidr): ''' returns the network address, subnet mask and broadcast address of a cidr address .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt '*' network.convert_cidr 172.31.0.0/16 ''' ret = {'network': None, 'netmask': None, ...
Modify hostname
def mod_hostname(hostname): ''' Modify hostname .. versionchanged:: 2015.8.0 Added support for SunOS (Solaris 10, Illumos, SmartOS) CLI Example: .. code-block:: bash salt '*' network.mod_hostname master.saltstack.com ''' # # SunOS tested on SmartOS and OmniOS (Solaris...
Return network interface buffer information using ethtool
def _get_bufsize_linux(iface): ''' Return network interface buffer information using ethtool ''' ret = {'result': False} cmd = '/sbin/ethtool -g {0}'.format(iface) out = __salt__['cmd.run'](cmd) pat = re.compile(r'^(.+):\s+(\d+)$') suffix = 'max-' for line in out.splitlines(): ...
Modify network interface buffer sizes using ethtool
def _mod_bufsize_linux(iface, *args, **kwargs): ''' Modify network interface buffer sizes using ethtool ''' ret = {'result': False, 'comment': 'Requires rx=<val> tx==<val> rx-mini=<val> and/or rx-jumbo=<val>'} cmd = '/sbin/ethtool -G ' + iface if not kwargs: return ret if ...
Modify network interface buffers ( currently linux only )
def mod_bufsize(iface, *args, **kwargs): ''' Modify network interface buffers (currently linux only) CLI Example: .. code-block:: bash salt '*' network.mod_bufsize tx=<val> rx=<val> rx-mini=<val> rx-jumbo=<val> ''' if __grains__['kernel'] == 'Linux': if os.path.exists('/sbin/e...
Return currently configured routes from routing table
def routes(family=None): ''' Return currently configured routes from routing table .. versionchanged:: 2015.8.0 Added support for SunOS (Solaris 10, Illumos, SmartOS) .. versionchanged:: 2016.11.4 Added support for AIX CLI Example: .. code-block:: bash salt '*' netwo...
Return default route ( s ) from routing table
def default_route(family=None): ''' Return default route(s) from routing table .. versionchanged:: 2015.8.0 Added support for SunOS (Solaris 10, Illumos, SmartOS) .. versionchanged:: 2016.11.4 Added support for AIX CLI Example: .. code-block:: bash salt '*' network.d...
Return routing information for given destination ip
def get_route(ip): ''' Return routing information for given destination ip .. versionadded:: 2015.5.3 .. versionchanged:: 2015.8.0 Added support for SunOS (Solaris 10, Illumos, SmartOS) Added support for OpenBSD .. versionchanged:: 2016.11.4 Added support for AIX CLI ...
Retrieve the interface name from a specific CIDR
def ifacestartswith(cidr): ''' Retrieve the interface name from a specific CIDR .. versionadded:: 2016.11.0 CLI Example: .. code-block:: bash salt '*' network.ifacestartswith 10.0 ''' net_list = interfaces() intfnames = [] pattern = six.text_type(cidr) size = len(patt...
Retrieve the hexadecimal representation of an IP address
def iphexval(ip): ''' Retrieve the hexadecimal representation of an IP address .. versionadded:: 2016.11.0 CLI Example: .. code-block:: bash salt '*' network.iphexval 10.0.0.1 ''' a = ip.split('.') hexval = ['%02X' % int(x) for x in a] # pylint: disable=E1321 return ''.j...
Ensure trail exists.
def present(name, Name=None, ScheduleExpression=None, EventPattern=None, Description=None, RoleArn=None, State=None, Targets=None, region=None, key=None, keyid=None, profile=None): ''' Ensure trail exists. name The name of...
Ensure CloudWatch event rule with passed properties is absent.
def absent(name, Name=None, region=None, key=None, keyid=None, profile=None): ''' Ensure CloudWatch event rule with passed properties is absent. name The name of the state definition. Name Name of the event rule. Defaults to the value of the 'name' param if not provided. ...
Return a list of nodes
def list_nodes(profile, **libcloud_kwargs): ''' Return a list of nodes :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments for the driver's list_nodes method :type libcloud_kwargs: ``dict`` CLI Example: .. code-block:: bash salt m...
Return a list of node sizes
def list_sizes(profile, location_id=None, **libcloud_kwargs): ''' Return a list of node sizes :param profile: The profile key :type profile: ``str`` :param location_id: The location key, from list_locations :type location_id: ``str`` :param libcloud_kwargs: Extra arguments for the drive...
Return a list of locations for this cloud
def list_locations(profile, **libcloud_kwargs): ''' Return a list of locations for this cloud :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments for the driver's list_locations method :type libcloud_kwargs: ``dict`` CLI Example: .. code-b...
Reboot a node in the cloud
def reboot_node(node_id, profile, **libcloud_kwargs): ''' Reboot a node in the cloud :param node_id: Unique ID of the node to reboot :type node_id: ``str`` :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments for the driver's reboot_node method ...
Return a list of storage volumes for this cloud
def list_volumes(profile, **libcloud_kwargs): ''' Return a list of storage volumes for this cloud :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments for the driver's list_volumes method :type libcloud_kwargs: ``dict`` CLI Example: .. code...
Return a list of storage volumes snapshots for this cloud
def list_volume_snapshots(volume_id, profile, **libcloud_kwargs): ''' Return a list of storage volumes snapshots for this cloud :param volume_id: The volume identifier :type volume_id: ``str`` :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments...
Create a storage volume
def create_volume(size, name, profile, location_id=None, **libcloud_kwargs): ''' Create a storage volume :param size: Size of volume in gigabytes (required) :type size: ``int`` :param name: Name of the volume to be created :type name: ``str`` :param location_id: Which data center to creat...
Create a storage volume snapshot
def create_volume_snapshot(volume_id, profile, name=None, **libcloud_kwargs): ''' Create a storage volume snapshot :param volume_id: Volume ID from which to create the new snapshot. :type volume_id: ``str`` :param profile: The profile key :type profile: ``str`` ...
Attaches volume to node.
def attach_volume(node_id, volume_id, profile, device=None, **libcloud_kwargs): ''' Attaches volume to node. :param node_id: Node ID to target :type node_id: ``str`` :param volume_id: Volume ID from which to attach :type volume_id: ``str`` :param profile: The profile key :type pr...
Detaches a volume from a node.
def detach_volume(volume_id, profile, **libcloud_kwargs): ''' Detaches a volume from a node. :param volume_id: Volume ID from which to detach :type volume_id: ``str`` :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments for the driver's detach_...
Destroy a volume snapshot.
def destroy_volume_snapshot(volume_id, snapshot_id, profile, **libcloud_kwargs): ''' Destroy a volume snapshot. :param volume_id: Volume ID from which the snapshot belongs :type volume_id: ``str`` :param snapshot_id: Volume Snapshot ID from which to destroy :type snapshot_id: ``str`` ...
Return a list of images for this cloud
def list_images(profile, location_id=None, **libcloud_kwargs): ''' Return a list of images for this cloud :param profile: The profile key :type profile: ``str`` :param location_id: The location key, from list_locations :type location_id: ``str`` :param libcloud_kwargs: Extra arguments f...
Create an image from a node
def create_image(node_id, name, profile, description=None, **libcloud_kwargs): ''' Create an image from a node :param node_id: Node to run the task on. :type node_id: ``str`` :param name: name for new image. :type name: ``str`` :param profile: The profile key :type profile: ``str`` ...
Delete an image of a node
def delete_image(image_id, profile, **libcloud_kwargs): ''' Delete an image of a node :param image_id: Image to delete :type image_id: ``str`` :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments for the driver's delete_image method :type li...
Get an image of a node
def get_image(image_id, profile, **libcloud_kwargs): ''' Get an image of a node :param image_id: Image to fetch :type image_id: ``str`` :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments for the driver's delete_image method :type libcloud_...
Copies an image from a source region to the current region.
def copy_image(source_region, image_id, name, profile, description=None, **libcloud_kwargs): ''' Copies an image from a source region to the current region. :param source_region: Region to copy the node from. :type source_region: ``str`` :param image_id: Image to copy. :type image_id: ``str`` ...
List all the available key pair objects.
def list_key_pairs(profile, **libcloud_kwargs): ''' List all the available key pair objects. :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments for the driver's list_key_pairs method :type libcloud_kwargs: ``dict`` CLI Example: .. code-bl...
Get a single key pair by name
def get_key_pair(name, profile, **libcloud_kwargs): ''' Get a single key pair by name :param name: Name of the key pair to retrieve. :type name: ``str`` :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments for the driver's get_key_pair method ...
Import a new public key from string or a file path
def import_key_pair(name, key, profile, key_type=None, **libcloud_kwargs): ''' Import a new public key from string or a file path :param name: Key pair name. :type name: ``str`` :param key: Public key material, the string or a path to a file :type key: ``str`` or path ``str`` :param prof...
Delete a key pair
def delete_key_pair(name, profile, **libcloud_kwargs): ''' Delete a key pair :param name: Key pair name. :type name: ``str`` :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments for the driver's import_key_pair_from_xxx method :type libclou...
Get item from a list by the id field
def _get_by_id(collection, id): ''' Get item from a list by the id field ''' matches = [item for item in collection if item.id == id] if not matches: raise ValueError('Could not find a matching item') elif len(matches) > 1: raise ValueError('The id matched {0} items, not 1'.forma...
Get the summary from module monit and try to see if service is being monitored. If not then monitor the service.
def monitor(name): ''' Get the summary from module monit and try to see if service is being monitored. If not then monitor the service. ''' ret = {'result': None, 'name': name, 'comment': '', 'changes': {} } result = __salt__['monit.summary'](name) ...
Get status of running jboss instance.
def status(jboss_config, host=None, server_config=None): ''' Get status of running jboss instance. jboss_config Configuration dictionary with properties specified above. host The name of the host. JBoss domain mode only - and required if running in domain mode. The host name is ...
Stop running jboss instance
def stop_server(jboss_config, host=None): ''' Stop running jboss instance jboss_config Configuration dictionary with properties specified above. host The name of the host. JBoss domain mode only - and required if running in domain mode. The host name is the "name" attribute of t...
Reload running jboss instance
def reload_(jboss_config, host=None): ''' Reload running jboss instance jboss_config Configuration dictionary with properties specified above. host The name of the host. JBoss domain mode only - and required if running in domain mode. The host name is the "name" attribute of the...
Create datasource in running jboss instance
def create_datasource(jboss_config, name, datasource_properties, profile=None): ''' Create datasource in running jboss instance jboss_config Configuration dictionary with properties specified above. name Datasource name datasource_properties A dictionary of datasource proper...
Update an existing datasource in running jboss instance. If the property doesn t exist if will be created if it does it will be updated with the new value
def update_datasource(jboss_config, name, new_properties, profile=None): ''' Update an existing datasource in running jboss instance. If the property doesn't exist if will be created, if it does, it will be updated with the new value jboss_config Configuration dictionary with properties specifi...
Read datasource properties in the running jboss instance.
def read_datasource(jboss_config, name, profile=None): ''' Read datasource properties in the running jboss instance. jboss_config Configuration dictionary with properties specified above. name Datasource name profile Profile name (JBoss domain mode only) CLI Example: ...
Create a simple jndi binding in the running jboss instance
def create_simple_binding(jboss_config, binding_name, value, profile=None): ''' Create a simple jndi binding in the running jboss instance jboss_config Configuration dictionary with properties specified above. binding_name Binding name to be created value Binding value p...
Read jndi binding in the running jboss instance
def read_simple_binding(jboss_config, binding_name, profile=None): ''' Read jndi binding in the running jboss instance jboss_config Configuration dictionary with properties specified above. binding_name Binding name to be created profile The profile name (JBoss domain mode o...
Remove an existing datasource from the running jboss instance.
def remove_datasource(jboss_config, name, profile=None): ''' Remove an existing datasource from the running jboss instance. jboss_config Configuration dictionary with properties specified above. name Datasource name profile The profile (JBoss domain mode only) CLI Examp...
Deploy the application on the jboss instance from the local file system where minion is running.
def deploy(jboss_config, source_file): ''' Deploy the application on the jboss instance from the local file system where minion is running. jboss_config Configuration dictionary with properties specified above. source_file Source file to deploy from CLI Example: .. code-block:...
List all deployments on the jboss instance
def list_deployments(jboss_config): ''' List all deployments on the jboss instance jboss_config Configuration dictionary with properties specified above. CLI Example: .. code-block:: bash salt '*' jboss7.list_deployments '{"cli_path": "integration.modules.sysmod.SysModuleTest....
Undeploy the application from jboss instance
def undeploy(jboss_config, deployment): ''' Undeploy the application from jboss instance jboss_config Configuration dictionary with properties specified above. deployment Deployment name to undeploy CLI Example: .. code-block:: bash salt '*' jboss7.undeploy '{"cli_pat...
Computes the timestamp for a future event that may occur in time_in time or at time_at.
def get_timestamp_at(time_in=None, time_at=None): ''' Computes the timestamp for a future event that may occur in ``time_in`` time or at ``time_at``. ''' if time_in: if isinstance(time_in, int): hours = 0 minutes = time_in else: time_in = time_in.r...
Return the time in human readable format for a future event that may occur in time_in time or at time_at.
def get_time_at(time_in=None, time_at=None, out_fmt='%Y-%m-%dT%H:%M:%S'): ''' Return the time in human readable format for a future event that may occur in ``time_in`` time, or at ``time_at``. ''' dt = get_timestamp_at(time_in=time_in, time_at=time_at) return time.strftime(out_fmt, time.localtim...
Return a bool telling whether or path is absolute. If path is None return True. This function is designed to validate variables which optionally contain a file path.
def _path_is_abs(path): ''' Return a bool telling whether or ``path`` is absolute. If ``path`` is None, return ``True``. This function is designed to validate variables which optionally contain a file path. ''' if path is None: return True try: return os.path.isabs(path) ...
.. versionadded:: 2014. 1. 0.. versionchanged:: 2016. 11. 0 This state has been rewritten. Some arguments are new to this release and will not be available in the 2016. 3 release cycle ( and earlier ). Additionally the ** ZIP Archive Handling ** section below applies specifically to the 2016. 11. 0 release ( and newer ...
def extracted(name, source, source_hash=None, source_hash_name=None, source_hash_update=False, skip_verify=False, password=None, options=None, list_options=None, force=False, overw...
Get the status of all the firewall profiles
def get_config(): ''' Get the status of all the firewall profiles Returns: dict: A dictionary of all profiles on the system Raises: CommandExecutionError: If the command fails CLI Example: .. code-block:: bash salt '*' firewall.get_config ''' profiles = {} ...
.. versionadded:: 2015. 5. 0
def enable(profile='allprofiles'): ''' .. versionadded:: 2015.5.0 Enable firewall profile Args: profile (Optional[str]): The name of the profile to enable. Default is ``allprofiles``. Valid options are: - allprofiles - domainprofile - privatepro...
.. versionadded:: 2015. 5. 0
def get_rule(name='all'): ''' .. versionadded:: 2015.5.0 Display all matching rules as specified by name Args: name (Optional[str]): The full name of the rule. ``all`` will return all rules. Default is ``all`` Returns: dict: A dictionary of all rules or rules that matc...
.. versionadded:: 2015. 5. 0
def add_rule(name, localport, protocol='tcp', action='allow', dir='in', remoteip='any'): ''' .. versionadded:: 2015.5.0 Add a new inbound or outbound rule to the firewall policy Args: name (str): The name of the rule. Must be unique and cannot be "all". Required. ...
.. versionadded:: 2015. 8. 0
def delete_rule(name=None, localport=None, protocol=None, dir=None, remoteip=None): ''' .. versionadded:: 2015.8.0 Delete an existing firewall rule identified by name and optionally by ports, protocols, direction, and remote IP. Args:...
Get the firewall property from the specified profile in the specified store as returned by netsh advfirewall.
def get_settings(profile, section, store='local'): ''' Get the firewall property from the specified profile in the specified store as returned by ``netsh advfirewall``. .. versionadded:: 2018.3.4 .. versionadded:: 2019.2.0 Args: profile (str): The firewall profile to query...
Gets all the properties for the specified profile in the specified store
def get_all_settings(domain, store='local'): ''' Gets all the properties for the specified profile in the specified store .. versionadded:: 2018.3.4 .. versionadded:: 2019.2.0 Args: profile (str): The firewall profile to query. Valid options are: - domain ...
Set the firewall inbound/ outbound settings for the specified profile and store
def set_firewall_settings(profile, inbound=None, outbound=None, store='local'): ''' Set the firewall inbound/outbound settings for the specified profile and store .. versionadded:: 2018.3.4 .. versionadded:: 2019.2.0 Args: profile (str): The firewall profile to query. Vali...
r Configure logging settings for the Windows firewall.
def set_logging_settings(profile, setting, value, store='local'): r''' Configure logging settings for the Windows firewall. .. versionadded:: 2018.3.4 .. versionadded:: 2019.2.0 Args: profile (str): The firewall profile to configure. Valid options are: - domain ...
Configure firewall settings.
def set_settings(profile, setting, value, store='local'): ''' Configure firewall settings. .. versionadded:: 2018.3.4 .. versionadded:: 2019.2.0 Args: profile (str): The firewall profile to configure. Valid options are: - domain - public - ...
Configure the firewall state.
def set_state(profile, state, store='local'): ''' Configure the firewall state. .. versionadded:: 2018.3.4 .. versionadded:: 2019.2.0 Args: profile (str): The firewall profile to configure. Valid options are: - domain - public - private ...
Return the error line and error message output from a stacktrace. If we are in a macro also output inside the message the exact location of the error in the macro
def _get_jinja_error(trace, context=None): ''' Return the error line and error message output from a stacktrace. If we are in a macro, also output inside the message the exact location of the error in the macro ''' if not context: context = {} out = '' error = _get_jinja_erro...
Render a Genshi template. A method should be passed in as part of the context. If no method is passed in xml is assumed. Valid methods are:
def render_genshi_tmpl(tmplstr, context, tmplpath=None): ''' Render a Genshi template. A method should be passed in as part of the context. If no method is passed in, xml is assumed. Valid methods are: .. code-block: - xml - xhtml - html - text - newtext ...
Render a Cheetah template.
def render_cheetah_tmpl(tmplstr, context, tmplpath=None): ''' Render a Cheetah template. ''' from Cheetah.Template import Template return salt.utils.data.decode(Template(tmplstr, searchList=[context]))
Render a template from a python source file
def py(sfn, string=False, **kwargs): # pylint: disable=C0103 ''' Render a template from a python source file Returns:: {'result': bool, 'data': <Error data or rendered file path>} ''' if not os.path.isfile(sfn): return {} base_fname = os.path.basename(sfn) name =...
Gets information about fund in the user s account. This method returns the following information: Available Balance Account Balance Earned Amount Withdrawable Amount and Funds Required for AutoRenew.
def get_balances(): ''' Gets information about fund in the user's account. This method returns the following information: Available Balance, Account Balance, Earned Amount, Withdrawable Amount and Funds Required for AutoRenew. .. note:: If a domain setup with automatic renewal is expiring w...
Checks if the provided minimum value is present in the user s account.
def check_balances(minimum=100): ''' Checks if the provided minimum value is present in the user's account. Returns a boolean. Returns ``False`` if the user's account balance is less than the provided minimum or ``True`` if greater than the minimum. minimum : 100 The value to check CL...
Return the ZeroMQ URI to connect the Minion to the Master. It supports different source IP/ port given the ZeroMQ syntax:// Connecting using a IP address and bind to an IP address rc = zmq_connect ( socket tcp:// 192. 168. 1. 17: 5555 ; 192. 168. 1. 1: 5555 ) ; assert ( rc == 0 ) ; Source: http:// api. zeromq. org/ 4 -...
def _get_master_uri(master_ip, master_port, source_ip=None, source_port=None): ''' Return the ZeroMQ URI to connect the Minion to the Master. It supports different source IP / port, given the ZeroMQ syntax: // Connecting using a IP address and ...
Ensure that TCP keepalives are set as specified in opts.
def _set_tcp_keepalive(zmq_socket, opts): ''' Ensure that TCP keepalives are set as specified in "opts". Warning: Failure to set TCP keepalives on the salt-master can result in not detecting the loss of a minion when the connection is lost or when it's host has been terminated without first closing...
Send a load across the wire in cleartext
def _uncrypted_transfer(self, load, tries=3, timeout=60): ''' Send a load across the wire in cleartext :param dict load: A load to send across the wire :param int tries: The number of times to make before failure :param int timeout: The number of seconds on a response before fai...
Send a request return a future which will complete when we send the message
def send(self, load, tries=3, timeout=60, raw=False): ''' Send a request, return a future which will complete when we send the message ''' if self.crypt == 'clear': ret = yield self._uncrypted_transfer(load, tries=tries, timeout=timeout) else: ret = yield ...
Return the master publish port
def master_pub(self): ''' Return the master publish port ''' return _get_master_uri(self.opts['master_ip'], self.publish_port, source_ip=self.opts.get('source_ip'), source_port=self.opts.get('sou...
Take the zmq messages decrypt/ decode them into a payload
def _decode_messages(self, messages): ''' Take the zmq messages, decrypt/decode them into a payload :param list messages: A list of messages to be decoded ''' messages_len = len(messages) # if it was one message, then its old style if messages_len == 1: ...
Return the current zmqstream creating one if necessary
def stream(self): ''' Return the current zmqstream, creating one if necessary ''' if not hasattr(self, '_stream'): self._stream = zmq.eventloop.zmqstream.ZMQStream(self._socket, io_loop=self.io_loop) return self._stream
Register a callback for received messages ( that we didn t initiate )
def on_recv(self, callback): ''' Register a callback for received messages (that we didn't initiate) :param func callback: A function which should be called when data is received ''' if callback is None: return self.stream.on_recv(None) @tornado.gen.coroutin...
Multiprocessing target for the zmq queue device
def zmq_device(self): ''' Multiprocessing target for the zmq queue device ''' self.__setup_signals() salt.utils.process.appendproctitle('MWorkerQueue') self.context = zmq.Context(self.opts['worker_threads']) # Prepare the zeromq sockets self.uri = 'tcp://{...
Cleanly shutdown the router socket
def close(self): ''' Cleanly shutdown the router socket ''' if self._closing: return log.info('MWorkerQueue under PID %s is closing', os.getpid()) self._closing = True # pylint: disable=E0203 if getattr(self, '_monitor', None) is not None: ...
Pre - fork we need to create the zmq router device
def pre_fork(self, process_manager): ''' Pre-fork we need to create the zmq router device :param func process_manager: An instance of salt.utils.process.ProcessManager ''' salt.transport.mixins.auth.AESReqServerMixin.pre_fork(self, process_manager) process_manager.add_pr...
Starts ZMQ monitor for debugging purposes.: return:
def _start_zmq_monitor(self): ''' Starts ZMQ monitor for debugging purposes. :return: ''' # Socket monitor shall be used the only for debug # purposes so using threading doesn't look too bad here if HAS_ZMQ_MONITOR and self.opts['zmq_monitor']: log.de...
After forking we need to create all of the local sockets to listen to the router
def post_fork(self, payload_handler, io_loop): ''' After forking we need to create all of the local sockets to listen to the router :param func payload_handler: A function to called to handle incoming payloads as they are picked up off the wire ...
Handle incoming messages from underlying TCP streams
def handle_message(self, stream, payload): ''' Handle incoming messages from underlying TCP streams :stream ZMQStream stream: A ZeroMQ stream. See http://zeromq.github.io/pyzmq/api/generated/zmq.eventloop.zmqstream.html :param dict payload: A payload to process ''' ...
Bind to the interface specified in the configuration file
def _publish_daemon(self, log_queue=None): ''' Bind to the interface specified in the configuration file ''' salt.utils.process.appendproctitle(self.__class__.__name__) if log_queue: salt.log.setup.set_multiprocessing_logging_queue(log_queue) salt.log.setu...
Create and connect this thread s zmq socket. If a publisher socket already exists pub_close is called before creating and connecting a new socket.
def pub_connect(self): ''' Create and connect this thread's zmq socket. If a publisher socket already exists "pub_close" is called before creating and connecting a new socket. ''' if self.pub_sock: self.pub_close() ctx = zmq.Context.instance() ...
Disconnect an existing publisher socket and remove it from the local thread s cache.
def pub_close(self): ''' Disconnect an existing publisher socket and remove it from the local thread's cache. ''' if hasattr(self._sock_data, 'sock'): self._sock_data.sock.close() delattr(self._sock_data, 'sock')
Publish load to minions. This send the load to the publisher daemon process with does the actual sending to minions.
def publish(self, load): ''' Publish "load" to minions. This send the load to the publisher daemon process with does the actual sending to minions. :param dict load: A load to be sent across the wire to minions ''' payload = {'enc': 'aes'} crypticle = salt.crypt....
Handle a message timeout by removing it from the sending queue and informing the caller
def timeout_message(self, message): ''' Handle a message timeout by removing it from the sending queue and informing the caller :raises: SaltReqTimeoutError ''' future = self.send_future_map.pop(message, None) # In a race condition the message might have been sen...
Return a future which will be completed when the message has a response
def send(self, message, timeout=None, tries=3, future=None, callback=None, raw=False): ''' Return a future which will be completed when the message has a response ''' if future is None: future = tornado.concurrent.Future() future.tries = tries future.a...
Return the elasticsearch instance
def _get_instance(hosts=None, profile=None): ''' Return the elasticsearch instance ''' es = None proxies = None use_ssl = False ca_certs = None verify_certs = True http_auth = None timeout = 10 if profile is None: profile = 'elasticsearch' if isinstance(profile,...
.. versionadded:: 2017. 7. 0
def ping(allow_failure=False, hosts=None, profile=None): ''' .. versionadded:: 2017.7.0 Test connection to Elasticsearch instance. This method does not fail if not explicitly specified. allow_failure Throw exception if ping fails CLI example:: salt myminion elasticsearch.ping all...
.. versionadded:: 2017. 7. 0
def info(hosts=None, profile=None): ''' .. versionadded:: 2017.7.0 Return Elasticsearch information. CLI example:: salt myminion elasticsearch.info salt myminion elasticsearch.info profile=elasticsearch-extra ''' es = _get_instance(hosts, profile) try: return es.i...
.. versionadded:: 2017. 7. 0
def node_info(nodes=None, flat_settings=False, hosts=None, profile=None): ''' .. versionadded:: 2017.7.0 Return Elasticsearch node information. nodes List of cluster nodes (id or name) to display stats for. Use _local for connected node, empty for all flat_settings Flatten settings...
.. versionadded:: 2017. 7. 0
def cluster_health(index=None, level='cluster', local=False, hosts=None, profile=None): ''' .. versionadded:: 2017.7.0 Return Elasticsearch cluster health. index Limit the information returned to a specific index level Specify the level of detail for returned information, default '...
.. versionadded:: 2017. 7. 0
def cluster_stats(nodes=None, hosts=None, profile=None): ''' .. versionadded:: 2017.7.0 Return Elasticsearch cluster stats. nodes List of cluster nodes (id or name) to display stats for. Use _local for connected node, empty for all CLI example:: salt myminion elasticsearch.cluste...
Create an alias for a specific index/ indices
def alias_create(indices, alias, hosts=None, body=None, profile=None, source=None): ''' Create an alias for a specific index/indices indices Single or multiple indices separated by comma, use _all to perform the operation on all indices. alias Alias name body Optional defini...
Delete an alias of an index
def alias_delete(indices, aliases, hosts=None, body=None, profile=None, source=None): ''' Delete an alias of an index indices Single or multiple indices separated by comma, use _all to perform the operation on all indices. aliases Alias names separated by comma CLI example:: ...
Return a boolean indicating whether given alias exists
def alias_exists(aliases, indices=None, hosts=None, profile=None): ''' Return a boolean indicating whether given alias exists indices Single or multiple indices separated by comma, use _all to perform the operation on all indices. aliases Alias names separated by comma CLI example:...
Check for the existence of an alias and if it exists return it
def alias_get(indices=None, aliases=None, hosts=None, profile=None): ''' Check for the existence of an alias and if it exists, return it indices Single or multiple indices separated by comma, use _all to perform the operation on all indices. aliases Alias names separated by comma C...
Create a document in a specified index
def document_create(index, doc_type, body=None, id=None, hosts=None, profile=None, source=None): ''' Create a document in a specified index index Index name where the document should reside doc_type Type of the document body Document to store source URL of file s...
Delete a document from an index
def document_delete(index, doc_type, id, hosts=None, profile=None): ''' Delete a document from an index index Index name where the document resides doc_type Type of the document id Document identifier CLI example:: salt myminion elasticsearch.document_delete te...