text
stringlengths
81
112k
Delete user (helper) :param uid: user number [1:16] :param channel: number [1:7] :param kwargs: - api_host=127.0.0.1 - api_user=admin - api_pass=example - api_port=623 - api_kg=None CLI Examples: .. code-block:: bash salt-call ipmi.user_delete uid=...
Verify that a TLS certificate is valid now and (optionally) will be valid for the time specified through weeks, days, hours, minutes, and seconds. def valid_certificate(name, weeks=0, days=0, hours=0, minutes=0, ...
Compares two objects and return a boolean value when there's a match. def _compare(cur_cmp, cur_struct): ''' Compares two objects and return a boolean value when there's a match. ''' if isinstance(cur_cmp, dict) and isinstance(cur_struct, dict): log.debug('Comparing dict to dict') ...
Validate the beacon configuration. def validate(config): ''' Validate the beacon configuration. ''' # Must be a list of dicts. if not isinstance(config, list): return False, 'Configuration for napalm beacon must be a list.' for mod in config: fun = mod.keys()[0] fun_cfg ...
Watch napalm function and fire events. def beacon(config): ''' Watch napalm function and fire events. ''' log.debug('Executing napalm beacon with config:') log.debug(config) ret = [] for mod in config: if not mod: continue event = {} fun = mod.keys()[0] ...
Execute ilom commands def __execute_cmd(name, xml): ''' Execute ilom commands ''' ret = {name.replace('_', ' '): {}} id_num = 0 tmp_dir = os.path.join(__opts__['cachedir'], 'tmp') if not os.path.isdir(tmp_dir): os.mkdir(tmp_dir) with tempfile.NamedTemporaryFile(dir=tmp_dir, ...
Configure the port HTTP should listen on CLI Example: .. code-block:: bash salt '*' ilo.set_http_port 8080 def set_http_port(port=80): ''' Configure the port HTTP should listen on CLI Example: .. code-block:: bash salt '*' ilo.set_http_port 8080 ''' _current = glob...
Configure the port HTTPS should listen on CLI Example: .. code-block:: bash salt '*' ilo.set_https_port 4334 def set_https_port(port=443): ''' Configure the port HTTPS should listen on CLI Example: .. code-block:: bash salt '*' ilo.set_https_port 4334 ''' _current ...
Enable SSH on a user defined port CLI Example: .. code-block:: bash salt '*' ilo.set_ssh_port 2222 def set_ssh_port(port=22): ''' Enable SSH on a user defined port CLI Example: .. code-block:: bash salt '*' ilo.set_ssh_port 2222 ''' _current = global_settings() ...
Create user CLI Example: .. code-block:: bash salt '*' ilo.create_user damian secretagent VIRTUAL_MEDIA_PRIV If no permissions are specify the user will only have a read-only account. Supported privelges: * ADMIN_PRIV Enables the user to administer user accounts. * REMOTE_CO...
Configure Network Interface CLI Example: .. code-block:: bash salt '*' ilo.configure_network [IP ADDRESS] [NETMASK] [GATEWAY] def configure_network(ip, netmask, gateway): ''' Configure Network Interface CLI Example: .. code-block:: bash salt '*' ilo.configure_network [IP A...
Configure SNMP CLI Example: .. code-block:: bash salt '*' ilo.configure_snmp [COMMUNITY STRING] [SNMP PORT] [SNMP TRAP PORT] def configure_snmp(community, snmp_port=161, snmp_trapport=161): ''' Configure SNMP CLI Example: .. code-block:: bash salt '*' ilo.configure_snmp [C...
Enable the RDP service and make sure access to the RDP port is allowed in the firewall configuration def enabled(name): ''' Enable the RDP service and make sure access to the RDP port is allowed in the firewall configuration ''' ret = {'name': name, 'result': True, 'change...
Disable the RDP service def disabled(name): ''' Disable the RDP service ''' ret = {'name': name, 'result': True, 'changes': {}, 'comment': ''} stat = __salt__['rdp.status']() if stat: if __opts__['test']: ret['result'] = None re...
Ensure that a task is present and up-to-date in Kapacitor. name Name of the task. tick_script Path to the TICK script for the task. Can be a salt:// source. task_type Task type. Defaults to 'stream' dbrps A list of databases and retention policies in "dbname"."rpname"...
Ensure that a task is absent from Kapacitor. name Name of the task. def task_absent(name): ''' Ensure that a task is absent from Kapacitor. name Name of the task. ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} task = __salt__['kapacitor.get_task'](...
Set Windows to use a list of NTP servers CLI Example: .. code-block:: bash salt '*' ntp.set_servers 'pool.ntp.org' 'us.pool.ntp.org' def set_servers(*servers): ''' Set Windows to use a list of NTP servers CLI Example: .. code-block:: bash salt '*' ntp.set_servers 'pool.ntp...
Get list of configured NTP servers CLI Example: .. code-block:: bash salt '*' ntp.get_servers def get_servers(): ''' Get list of configured NTP servers CLI Example: .. code-block:: bash salt '*' ntp.get_servers ''' cmd = ['w32tm', '/query', '/configuration'] li...
Reload the facts dictionary from the device. Usually only needed if, the device configuration is changed by some other actor. This function will also refresh the facts stored in the salt grains. CLI Example: .. code-block:: bash salt 'device_name' junos.facts_refresh def facts_refresh(): ...
Displays the facts gathered during the connection. These facts are also stored in Salt grains. CLI Example: .. code-block:: bash salt 'device_name' junos.facts def facts(): ''' Displays the facts gathered during the connection. These facts are also stored in Salt grains. CLI Exa...
This function executes the RPC provided as arguments on the junos device. The returned data can be stored in a file. cmd The RPC to be executed dest Destination file where the RPC output is stored. Note that the file will be stored on the proxy minion. To push the files to the mast...
Set the device's hostname hostname The name to be set comment Provide a comment to the commit dev_timeout : 30 The NETCONF RPC timeout (in seconds) confirm Provide time in minutes for commit confirmation. If this option is specified, the commit will be rolled back...
To commit the changes loaded in the candidate configuration. dev_timeout : 30 The NETCONF RPC timeout (in seconds) comment Provide a comment for the commit confirm Provide time in minutes for commit confirmation. If this option is specified, the commit will be rolled back in the...
Roll back the last committed configuration changes and commit id : 0 The rollback ID value (0-49) dev_timeout : 30 The NETCONF RPC timeout (in seconds) comment Provide a comment for the commit confirm Provide time in minutes for commit confirmation. If this option is ...
Returns the difference between the candidate and the current configuration id : 0 The rollback ID value (0-49) CLI Example: .. code-block:: bash salt 'device_name' junos.diff 3 def diff(**kwargs): ''' Returns the difference between the candidate and the current configuration ...
Send a ping RPC to a device dest_ip The IP of the device to ping dev_timeout : 30 The NETCONF RPC timeout (in seconds) rapid : False When ``True``, executes ping at 100pps instead of 1pps ttl Maximum number of IP routers (IP hops) allowed between source and dest...
Executes the CLI commands and returns the output in specified format. \ (default is text) The output can also be stored in a file. command (required) The command to execute on the Junos CLI format : text Format in which to get the CLI output (either ``text`` or ``xml``) dev_timeout : ...
Shut down (power off) or reboot a device running Junos OS. This includes all Routing Engines in a Virtual Chassis or a dual Routing Engine system. .. note:: One of ``shutdown`` or ``reboot`` must be set to ``True`` or no action will be taken. shutdown : False Set this to ``True...
Installs the given configuration file into the candidate configuration. Commits the changes if the commit checks or throws an error. path (required) Path where the configuration/template file is present. If the file has a ``.conf`` extension, the content is treated as text format. If the ...
Resets the device to default factory settings CLI Example: .. code-block:: bash salt 'device_name' junos.zeroize def zeroize(): ''' Resets the device to default factory settings CLI Example: .. code-block:: bash salt 'device_name' junos.zeroize ''' conn = __proxy__...
Installs the given image on the device. After the installation is complete\ the device is rebooted, if reboot=True is given as a keyworded argument. path (required) Path where the image file is present on the proxy minion remote_path : If the value of path is a file path on the local...
Copies the file from the local device to the junos device src The source path where the file is kept. dest The destination path on the where the file will be copied CLI Example: .. code-block:: bash salt 'device_name' junos.file_copy /home/m2/info.txt info_copy.txt def file...
Attempts an exclusive lock on the candidate configuration. This is a non-blocking call. .. note:: When locking, it is important to remember to call :py:func:`junos.unlock <salt.modules.junos.unlock>` once finished. If locking during orchestration, remember to include a step in the ...
Unlocks the candidate configuration. CLI Example: .. code-block:: bash salt 'device_name' junos.unlock def unlock(): ''' Unlocks the candidate configuration. CLI Example: .. code-block:: bash salt 'device_name' junos.unlock ''' conn = __proxy__['junos.conn']() ...
Loads the configuration from the file provided onto the device. path (required) Path where the configuration/template file is present. If the file has a ``.conf`` extension, the content is treated as text format. If the file has a ``.xml`` extension, the content is treated as XML format. If...
Perform a commit check on the configuration CLI Example: .. code-block:: bash salt 'device_name' junos.commit_check def commit_check(): ''' Perform a commit check on the configuration CLI Example: .. code-block:: bash salt 'device_name' junos.commit_check ''' conn ...
Retrieve data from a Junos device using Tables/Views table (required) Name of PyEZ Table table_file (required) YAML file that has the table specified in table parameter path: Path of location of the YAML file. defaults to op directory in jnpr.junos.op target: ...
Mount an image CLI Example: .. code-block:: bash salt '*' guest.mount /srv/images/fedora.qcow def mount(location, access='rw', root=None): ''' Mount an image CLI Example: .. code-block:: bash salt '*' guest.mount /srv/images/fedora.qcow ''' if root is None: ...
Ensure the user exists on the Dell DRAC name: The users username password The password used to authenticate permission The permissions that should be assigned to a user def present(name, password, permission): ''' Ensure the user exists on the Dell DRAC name: ...
Ensure the DRAC network settings are consistent def network(ip, netmask, gateway): ''' Ensure the DRAC network settings are consistent ''' ret = {'name': ip, 'result': True, 'changes': {}, 'comment': ''} current_network = __salt__['drac.network_info']() new_net...
If we have additional IPC transports other than UxD and TCP, add them here def factory(opts, **kwargs): ''' If we have additional IPC transports other than UxD and TCP, add them here ''' # FIXME for now, just UXD # Obviously, this makes the factory approach pointless, but we'll ...
If we have additional IPC transports other than UXD and TCP, add them here def factory(opts, **kwargs): ''' If we have additional IPC transports other than UXD and TCP, add them here ''' import salt.transport.ipc return salt.transport.ipc.IPCMessageServer(opts, **kwargs)
List currently configured reactors CLI Example: .. code-block:: bash salt-run reactor.list def list_(saltenv='base', test=None): ''' List currently configured reactors CLI Example: .. code-block:: bash salt-run reactor.list ''' sevent = salt.utils.event.get_event( ...
Add a new reactor CLI Example: .. code-block:: bash salt-run reactor.add 'salt/cloud/*/destroyed' reactors='/srv/reactor/destroy/*.sls' def add(event, reactors, saltenv='base', test=None): ''' Add a new reactor CLI Example: .. code-block:: bash salt-run reactor.add 'salt/c...
Delete a reactor CLI Example: .. code-block:: bash salt-run reactor.delete 'salt/cloud/*/destroyed' def delete(event, saltenv='base', test=None): ''' Delete a reactor CLI Example: .. code-block:: bash salt-run reactor.delete 'salt/cloud/*/destroyed' ''' sevent = sa...
Convert IP address representation to ZMQ (URL) format. ZMQ expects brackets around IPv6 literals, since they are used in URLs. def ip_bracket(addr): ''' Convert IP address representation to ZMQ (URL) format. ZMQ expects brackets around IPv6 literals, since they are used in URLs. ''' addr = ipad...
Display output for the salt-run virt.query function def output(data, **kwargs): # pylint: disable=unused-argument ''' Display output for the salt-run virt.query function ''' out = '' for id_ in data['data']: out += '{0}\n'.format(id_) for vm_ in data['data'][id_]['vm_info']: ...
Return all interface configs def _interface_configs(): ''' Return all interface configs ''' cmd = ['netsh', 'interface', 'ip', 'show', 'config'] lines = __salt__['cmd.run'](cmd, python_shell=False).splitlines() ret = {} current_iface = None current_ip_list = None for line in lines:...
Returns ``True`` if interface is enabled, otherwise ``False`` CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.is_enabled 'Local Area Connection #2' def is_enabled(iface): ''' Returns ``True`` if interface is enabled, otherwise ``False`` CLI Example: .. code-block::...
Enable an interface CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.enable 'Local Area Connection #2' def enable(iface): ''' Enable an interface CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.enable 'Local Area Connection #2' ''' ...
Disable an interface CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.disable 'Local Area Connection #2' def disable(iface): ''' Disable an interface CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.disable 'Local Area Connection #2' '''...
Convenience function to convert the netmask to the CIDR subnet length CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.get_subnet_length 255.255.255.0 def get_subnet_length(mask): ''' Convenience function to convert the netmask to the CIDR subnet length CLI Example: ...
Set static IP configuration on a Windows NIC iface The name of the interface to manage addr IP address with subnet length (ex. ``10.1.2.3/24``). The :mod:`ip.get_subnet_length <salt.modules.win_ip.get_subnet_length>` function can be used to calculate the subnet length from a ne...
Set static DNS configuration on a Windows NIC Args: iface (str): The name of the interface to set addrs (*): One or more DNS servers to be added. To clear the list of DNS servers pass an empty list (``[]``). If undefined or ``None`` no changes will be made. ...
Set DNS source to DHCP on Windows CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.get_default_gateway def get_default_gateway(): ''' Set DNS source to DHCP on Windows CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.get_default_gateway ...
Add the specified group CLI Example: .. code-block:: bash salt '*' group.add foo 3456 def add(name, gid=None, **kwargs): ''' Add the specified group CLI Example: .. code-block:: bash salt '*' group.add foo 3456 ''' ### NOTE: **kwargs isn't used here but needs to be...
Return a list of gids in use def _list_gids(): ''' Return a list of gids in use ''' output = __salt__['cmd.run']( ['dscacheutil', '-q', 'group'], output_loglevel='quiet', python_shell=False ) ret = set() for line in salt.utils.itertools.split(output, '\n'): i...
Remove the named group CLI Example: .. code-block:: bash salt '*' group.delete foo def delete(name): ''' Remove the named group CLI Example: .. code-block:: bash salt '*' group.delete foo ''' if salt.utils.stringutils.contains_whitespace(name): raise SaltIn...
Replaces members of the group with a provided list. .. versionadded:: 2016.3.0 CLI Example: salt '*' group.members foo 'user1,user2,user3,...' Replaces a membership list for a local group 'foo'. def members(name, members_list): ''' Replaces members of the group with a provided list. ...
Return information about a group CLI Example: .. code-block:: bash salt '*' group.info foo def info(name): ''' Return information about a group CLI Example: .. code-block:: bash salt '*' group.info foo ''' if salt.utils.stringutils.contains_whitespace(name): ...
Return formatted information in a pretty way. def _format_info(data): ''' Return formatted information in a pretty way. ''' return {'name': data.gr_name, 'gid': data.gr_gid, 'passwd': data.gr_passwd, 'members': data.gr_mem}
Return info on all groups CLI Example: .. code-block:: bash salt '*' group.getent def getent(refresh=False): ''' Return info on all groups CLI Example: .. code-block:: bash salt '*' group.getent ''' if 'group.getent' in __context__ and not refresh: return _...
Change the gid for a named group CLI Example: .. code-block:: bash salt '*' group.chgid foo 4376 def chgid(name, gid): ''' Change the gid for a named group CLI Example: .. code-block:: bash salt '*' group.chgid foo 4376 ''' if not isinstance(gid, int): rais...
.. versionadded:: 2014.7.0 Recurse through etcd and return all values def tree(self, path): ''' .. versionadded:: 2014.7.0 Recurse through etcd and return all values ''' ret = {} try: items = self.read(path) except (etcd.EtcdKeyNotFound, Val...
Read pillar data from Cobbler via its API. def ext_pillar(minion_id, pillar, # pylint: disable=W0613 key=None, only=()): ''' Read pillar data from Cobbler via its API. ''' url = __opts__['cobbler.url'] user = __opts__['cobbler.user'] password = __op...
Verify that ruby is installed, install if unavailable def _check_and_install_ruby(ret, ruby, default=False, user=None, opts=None, env=None): ''' Verify that ruby is installed, install if unavailable ''' ret = _check_ruby(ret, ruby, user=user) if not ret['result']: if __salt__['rvm.install_r...
Check that ruby is installed def _check_ruby(ret, ruby, user=None): ''' Check that ruby is installed ''' match_version = True match_micro_version = False micro_version_regex = re.compile(r'-([0-9]{4}\.[0-9]{2}|p[0-9]+)$') if micro_version_regex.search(ruby): match_micro_version = Tr...
Verify that the specified ruby is installed with RVM. RVM is installed when necessary. name The version of ruby to install default : False Whether to make this ruby the default. user: None The user to run rvm as. env: None A list of environment variables to set (i...
Verify that the gemset is present. name The name of the gemset. ruby: default The ruby version this gemset belongs to. user: None The user to run rvm as. .. versionadded:: 0.17.0 def gemset_present(name, ruby='default', user=None): ''' Verify that the gemset is p...
Ensure that the named tablespace is present with the specified properties. For more information about all of these options run ``man 7 create_tablespace``. name The name of the tablespace to create/manage. directory The directory where the tablespace will be located, must already exist...
Execute queries against SQLCipher, merge and return as a dict def ext_pillar(minion_id, pillar, *args, **kwargs): ''' Execute queries against SQLCipher, merge and return as a dict ''' return SQLCipherExtPillar().fetch(minion_id, pillar, *args, **kwargs)
Yield a SQLCipher cursor def _get_cursor(self): ''' Yield a SQLCipher cursor ''' _options = self._get_options() conn = sqlcipher.connect(_options.get('database'), timeout=float(_options.get('timeout'))) conn.execute('pragma key="{0}"'.for...
Convert an ldap backend exception to an LDAPError and raise it. def _convert_exception(e): '''Convert an ldap backend exception to an LDAPError and raise it.''' args = ('exception in ldap backend: {0}'.format(repr(e)), e) if six.PY2: six.reraise(LDAPError, args, sys.exc_info()[2]) else: ...
Bind helper. def _bind(l, bind=None): '''Bind helper.''' if bind is None: return method = bind.get('method', 'simple') if method is None: return elif method == 'simple': l.simple_bind_s(bind.get('dn', ''), bind.get('password', '')) elif method == 'sasl': sasl_cla...
Connect and optionally bind to an LDAP server. :param connect_spec: This can be an LDAP connection object returned by a previous call to :py:func:`connect` (in which case the argument is simply returned), ``None`` (in which case an empty dict is used), or a dict with the following k...
Search an LDAP database. :param connect_spec: See the documentation for the ``connect_spec`` parameter for :py:func:`connect`. :param base: Distinguished name of the entry at which to start the search. :param scope: One of the following: * ``'subtree'`` ...
Add an entry to an LDAP database. :param connect_spec: See the documentation for the ``connect_spec`` parameter for :py:func:`connect`. :param dn: Distinguished name of the entry. :param attributes: Non-empty dict mapping each of the new entry's attributes to a non...
Delete an entry from an LDAP database. :param connect_spec: See the documentation for the ``connect_spec`` parameter for :py:func:`connect`. :param dn: Distinguished name of the entry. :returns: ``True`` if successful, raises an exception otherwise. CLI example: ...
Modify an entry in an LDAP database. :param connect_spec: See the documentation for the ``connect_spec`` parameter for :py:func:`connect`. :param dn: Distinguished name of the entry. :param directives: Iterable of directives that indicate how to modify the entry. E...
Modify an entry in an LDAP database. This does the same thing as :py:func:`modify`, but with a simpler interface. Instead of taking a list of directives, it takes a before and after view of an entry, determines the differences between the two, computes the directives, and executes them. Any attri...
From a pillar key, or a dictionary, return index and host keys. def _parse_profile(profile): ''' From a pillar key, or a dictionary, return index and host keys. ''' if isinstance(profile, string_types): _profile = __salt__['config.option'](profile) if not _profile: msg = 'Pi...
Check if grafana dashboard row and _row differ def _rows_differ(row, _row): ''' Check if grafana dashboard row and _row differ ''' row_copy = copy.deepcopy(row) _row_copy = copy.deepcopy(_row) # Strip id from all panels in both rows, since they are always generated. for panel in row_copy['p...
Ensure the grafana dashboard exists and is managed. name Name of the grafana dashboard. dashboard A dict that defines a dashboard that should be managed. dashboard_from_pillar A pillar key that contains a grafana dashboard dict. Mutually exclusive with dashboard. rows...
Ensure the named grafana dashboard is deleted. name Name of the grafana dashboard. profile A pillar key or dict that contains a list of hosts and an elasticsearch index to use. def dashboard_absent( name, hosts=None, profile='grafana'): ''' Ensure the n...
Ensure sequenced data. **sequence** ensure that parsed data is a sequence .. code-block:: jinja {% set my_string = "foo" %} {% set my_list = ["bar", ] %} {% set my_dict = {"baz": "qux"} %} {{ my_string|sequence|first }} {{ my_list|sequence|first }} {{...
Returns the logical value. .. code-block:: jinja {{ 'yes' | to_bool }} will be rendered as: .. code-block:: text True def to_bool(val): ''' Returns the logical value. .. code-block:: jinja {{ 'yes' | to_bool }} will be rendered as: .. code-block:: text ...
Implementation of tojson filter (only present in Jinja 2.9 and later). If Jinja 2.9 or later is installed, then the upstream version of this filter will be used. def tojson(val, indent=None): ''' Implementation of tojson filter (only present in Jinja 2.9 and later). If Jinja 2.9 or later is install...
Searches for a pattern in the text. .. code-block:: jinja {% set my_text = 'abcd' %} {{ my_text | regex_search('^(.*)BC(.*)$', ignorecase=True) }} will be rendered as: .. code-block:: text ('a', 'd') def regex_search(txt, rgx, ignorecase=False, multiline=False): ''' Sea...
Searches for a pattern in the text. .. code-block:: jinja {% set my_text = 'abcd' %} {{ my_text | regex_match('^(.*)BC(.*)$', ignorecase=True) }} will be rendered as: .. code-block:: text ('a', 'd') def regex_match(txt, rgx, ignorecase=False, multiline=False): ''' Searc...
r''' Searches for a pattern and replaces with a sequence of characters. .. code-block:: jinja {% set my_text = 'lets replace spaces' %} {{ my_text | regex_replace('\s+', '__') }} will be rendered as: .. code-block:: text lets__replace__spaces def regex_replace(txt, rgx, val...
Returns a UUID corresponding to the value passed as argument. .. code-block:: jinja {{ 'example' | uuid }} will be rendered as: .. code-block:: text f4efeff8-c219-578a-bad7-3dc280612ec8 def uuid_(val): ''' Returns a UUID corresponding to the value passed as argument. .. co...
Removes duplicates from a list. .. code-block:: jinja {% set my_list = ['a', 'b', 'c', 'a', 'b'] -%} {{ my_list | unique }} will be rendered as: .. code-block:: text ['a', 'b', 'c'] def unique(values): ''' Removes duplicates from a list. .. code-block:: jinja ...
Returns the average value of a list. .. code-block:: jinja {% my_list = [1,2,3,4] -%} {{ set my_list | avg }} will be rendered as: .. code-block:: yaml 2.5 def lst_avg(lst): ''' Returns the average value of a list. .. code-block:: jinja {% my_list = [1,2,3...
Returns the union of two lists. .. code-block:: jinja {% my_list = [1,2,3,4] -%} {{ set my_list | union([2, 4, 6]) }} will be rendered as: .. code-block:: text [1, 2, 3, 4, 6] def union(lst1, lst2): ''' Returns the union of two lists. .. code-block:: jinja ...
Returns the intersection of two lists. .. code-block:: jinja {% my_list = [1,2,3,4] -%} {{ set my_list | intersect([2, 4, 6]) }} will be rendered as: .. code-block:: text [2, 4] def intersect(lst1, lst2): ''' Returns the intersection of two lists. .. code-block:: j...
Return a file client. Instantiates on first call. def file_client(self): ''' Return a file client. Instantiates on first call. ''' if not self._file_client: self._file_client = salt.fileclient.get_file_client( self.opts, self.pillar_rend) return self....
Cache a file from the salt master def cache_file(self, template): ''' Cache a file from the salt master ''' saltpath = salt.utils.url.create(template) self.file_client().get_file(saltpath, '', True, self.saltenv)
Cache a file only once def check_cache(self, template): ''' Cache a file only once ''' if template not in self.cached: self.cache_file(template) self.cached.append(template)
Salt-specific loader to find imported jinja files. Jinja imports will be interpreted as originating from the top of each of the directories in the searchpath when the template name does not begin with './' or '../'. When a template name begins with './' or '../' then the import will be...
Ensure that printed mappings are YAML friendly. def finalizer(self, data): ''' Ensure that printed mappings are YAML friendly. ''' def explore(data): if isinstance(data, (dict, OrderedDict)): return PrintableDict( [(key, explore(value)) fo...