INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
.. versionadded:: 2018. 3. 4
def unpack(stream, **kwargs): ''' .. versionadded:: 2018.3.4 Wraps msgpack.unpack. By default, this function uses the msgpack module and falls back to msgpack_pure, if the msgpack is not available. You can pass an alternate msgpack module using the _msgpack_module argument. ''' msgpack...
.. versionadded:: 2018. 3. 4
def unpackb(packed, **kwargs): ''' .. versionadded:: 2018.3.4 Wraps msgpack.unpack. By default, this function uses the msgpack module and falls back to msgpack_pure, if the msgpack is not available. You can pass an alternate msgpack module using the _msgpack_module argument. ''' msgpac...
If any minion s status is older than the timeout value then apply the given action to the timed out key. This example will remove keys to minions that have not checked in for 300 seconds ( 5 minutes )
def timeout(name, delete=0, reject=0): ''' If any minion's status is older than the timeout value then apply the given action to the timed out key. This example will remove keys to minions that have not checked in for 300 seconds (5 minutes) USAGE: .. code-block:: yaml statreg: ...
Check the context for the notifier and construct it if not present
def _get_notifier(config): ''' Check the context for the notifier and construct it if not present ''' if 'inotify.notifier' not in __context__: __context__['inotify.queue'] = collections.deque() wm = pyinotify.WatchManager() __context__['inotify.notifier'] = pyinotify.Notifier(wm...
Validate the beacon configuration
def validate(config): ''' Validate the beacon configuration ''' VALID_MASK = [ 'access', 'attrib', 'close_nowrite', 'close_write', 'create', 'delete', 'delete_self', 'excl_unlink', 'ignored', 'modify', 'moved_from',...
Watch the configured files
def beacon(config): ''' Watch the configured files Example Config .. code-block:: yaml beacons: inotify: - files: /path/to/file/or/dir: mask: - open - create - close_write ...
Run the actual gem command. If rvm or rbenv is installed run the command using the corresponding module. rbenv is not available on windows so don t try.
def _gem(command, ruby=None, runas=None, gem_bin=None): ''' Run the actual gem command. If rvm or rbenv is installed, run the command using the corresponding module. rbenv is not available on windows, so don't try. :param command: string Command to run :param ruby: string : None If RVM ...
Installs one or several gems.
def install(gems, # pylint: disable=C0103 ruby=None, gem_bin=None, runas=None, version=None, rdoc=False, ri=False, pre_releases=False, proxy=None, source=None): # pylint: disable=C0103 ''' ...
Uninstall one or several gems.
def uninstall(gems, ruby=None, runas=None, gem_bin=None): ''' Uninstall one or several gems. :param gems: string The gems to uninstall. :param gem_bin: string : None Full path to ``gem`` binary to use. :param ruby: string : None If RVM or rbenv are installed, the ruby versio...
Update one or several gems.
def update(gems, ruby=None, runas=None, gem_bin=None): ''' Update one or several gems. :param gems: string The gems to update. :param gem_bin: string : None Full path to ``gem`` binary to use. :param ruby: string : None If RVM or rbenv are installed, the ruby version and gem...
Update rubygems.
def update_system(version='', ruby=None, runas=None, gem_bin=None): ''' Update rubygems. :param version: string : (newest) The version of rubygems to install. :param gem_bin: string : None Full path to ``gem`` binary to use. :param ruby: string : None If RVM or rbenv are ins...
Print out the version of gem
def version(ruby=None, runas=None, gem_bin=None): ''' Print out the version of gem :param gem_bin: string : None Full path to ``gem`` binary to use. :param ruby: string : None If RVM or rbenv are installed, the ruby version and gemset to use. Ignored if ``gem_bin`` is specified....
List locally installed gems.
def list_(prefix='', ruby=None, runas=None, gem_bin=None): ''' List locally installed gems. :param prefix: string : Only list gems when the name matches this prefix. :param gem_bin: string : None Full path to ``gem`` binary to use. :param ruby: string : None If RVM or rbenv ...
.. versionadded:: 2015. 8. 0
def list_upgrades(ruby=None, runas=None, gem_bin=None): ''' .. versionadded:: 2015.8.0 Check if an upgrade is available for installed gems gem_bin : None Full path to ``gem`` binary to use. ruby : None If RVM or rbenv are installed, the ruby vers...
Add a gem source.
def sources_add(source_uri, ruby=None, runas=None, gem_bin=None): ''' Add a gem source. :param source_uri: string The source URI to add. :param gem_bin: string : None Full path to ``gem`` binary to use. :param ruby: string : None If RVM or rbenv are installed, the ruby versi...
Remove a gem source.
def sources_remove(source_uri, ruby=None, runas=None, gem_bin=None): ''' Remove a gem source. :param source_uri: string The source URI to remove. :param gem_bin: string : None Full path to ``gem`` binary to use. :param ruby: string : None If RVM or rbenv are installed, the r...
List the configured gem sources.
def sources_list(ruby=None, runas=None, gem_bin=None): ''' List the configured gem sources. :param gem_bin: string : None Full path to ``gem`` binary to use. :param ruby: string : None If RVM or rbenv are installed, the ruby version and gemset to use. Ignored if ``gem_bin`` is s...
Generate an icinga2 ticket on the master.
def generate_ticket(name, output=None, grain=None, key=None, overwrite=True): ''' Generate an icinga2 ticket on the master. name The domain name for which this ticket will be generated output grain: output in a grain other: the file to store results None: output to the...
Generate an icinga2 certificate and key on the client.
def generate_cert(name): ''' Generate an icinga2 certificate and key on the client. name The domain name for which this certificate and key will be generated ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} cert = "{0}{1}.crt".forma...
Save the certificate on master icinga2 node.
def save_cert(name, master): ''' Save the certificate on master icinga2 node. name The domain name for which this certificate will be saved master Icinga2 master node for which this certificate will be saved ''' ret = {'name': name, 'changes': {}, 'result'...
Request CA certificate from master icinga2 node.
def request_cert(name, master, ticket, port="5665"): ''' Request CA certificate from master icinga2 node. name The domain name for which this certificate will be saved master Icinga2 master node for which this certificate will be saved ticket Authentication ticket generate...
Setup the icinga2 node.
def node_setup(name, master, ticket): ''' Setup the icinga2 node. name The domain name for which this certificate will be saved master Icinga2 master node for which this certificate will be saved ticket Authentication ticket generated on icinga2 master ''' ret = {'...
Return available Linode images.
def avail_images(call=None): ''' Return available Linode images. CLI Example: .. code-block:: bash salt-cloud --list-images my-linode-config salt-cloud -f avail_images my-linode-config ''' if call == 'action': raise SaltCloudException( 'The avail_images fun...
Return available Linode datacenter locations.
def avail_locations(call=None): ''' Return available Linode datacenter locations. CLI Example: .. code-block:: bash salt-cloud --list-locations my-linode-config salt-cloud -f avail_locations my-linode-config ''' if call == 'action': raise SaltCloudException( ...
Return available Linode sizes.
def avail_sizes(call=None): ''' Return available Linode sizes. CLI Example: .. code-block:: bash salt-cloud --list-sizes my-linode-config salt-cloud -f avail_sizes my-linode-config ''' if call == 'action': raise SaltCloudException( 'The avail_locations func...
Boot a Linode.
def boot(name=None, kwargs=None, call=None): ''' Boot a Linode. name The name of the Linode to boot. Can be used instead of ``linode_id``. linode_id The ID of the Linode to boot. If provided, will be used as an alternative to ``name`` and reduces the number of API calls to ...
Clone a Linode.
def clone(kwargs=None, call=None): ''' Clone a Linode. linode_id The ID of the Linode to clone. Required. datacenter_id The ID of the Datacenter where the Linode will be placed. Required. plan_id The ID of the plan (size) of the Linode. Required. CLI Example: .. ...
Create a single Linode VM.
def create(vm_): ''' Create a single Linode VM. ''' name = vm_['name'] try: # Check for required profile parameters before sending any API calls. if vm_['profile'] and config.is_profile_configured(__opts__, __active_provider_...
Creates a Linode Configuration Profile.
def create_config(kwargs=None, call=None): ''' Creates a Linode Configuration Profile. name The name of the VM to create the config for. linode_id The ID of the Linode to create the configuration for. root_disk_id The Root Disk ID to be used for this config. swap_disk...
r Creates the disk for the Linode from the distribution.
def create_disk_from_distro(vm_, linode_id, swap_size=None): r''' Creates the disk for the Linode from the distribution. vm\_ The VM profile to create the disk for. linode_id The ID of the Linode to create the distribution disk for. Required. swap_size The size of the disk...
r Creates the disk for the specified Linode.
def create_swap_disk(vm_, linode_id, swap_size=None): r''' Creates the disk for the specified Linode. vm\_ The VM profile to create the swap disk for. linode_id The ID of the Linode to create the swap disk for. swap_size The size of the disk, in MB. ''' kwargs = {}...
r Create a data disk for the linode ( type is hardcoded to ext4 at the moment )
def create_data_disk(vm_=None, linode_id=None, data_size=None): r''' Create a data disk for the linode (type is hardcoded to ext4 at the moment) .. versionadded:: 2016.3.0 vm\_ The VM profile to create the data disk for. linode_id The ID of the Linode to create the data disk for. ...
r Creates a private IP for the specified Linode.
def create_private_ip(linode_id): r''' Creates a private IP for the specified Linode. linode_id The ID of the Linode to create the IP address for. ''' kwargs = {'LinodeID': linode_id} result = _query('linode', 'ip.addprivate', args=kwargs) return _clean_data(result)
Returns a config_id for a given linode.
def get_config_id(kwargs=None, call=None): ''' Returns a config_id for a given linode. .. versionadded:: 2015.8.0 name The name of the Linode for which to get the config_id. Can be used instead of ``linode_id``.h linode_id The ID of the Linode for which to get the config_i...
r Returns the size of of the root disk in MB.
def get_disk_size(vm_, swap, linode_id): r''' Returns the size of of the root disk in MB. vm\_ The VM to get the disk size for. ''' disk_size = get_linode(kwargs={'linode_id': linode_id})['TOTALHD'] return config.get_cloud_config_value( 'disk_size', vm_, __opts__, default=disk_s...
Return the size of of the data disk in MB
def get_data_disk_size(vm_, swap, linode_id): ''' Return the size of of the data disk in MB .. versionadded:: 2016.3.0 ''' disk_size = get_linode(kwargs={'linode_id': linode_id})['TOTALHD'] root_disk_size = config.get_cloud_config_value( 'disk_size', vm_, __opts__, default=disk_size - s...
r Returns the distribution ID for a VM
def get_distribution_id(vm_): r''' Returns the distribution ID for a VM vm\_ The VM to get the distribution ID for ''' distributions = _query('avail', 'distributions')['DATA'] vm_image_name = config.get_cloud_config_value('image', vm_, __opts__) distro_id = '' for distro in di...
Returns public and private IP addresses.
def get_ips(linode_id=None): ''' Returns public and private IP addresses. linode_id Limits the IP addresses returned to the specified Linode ID. ''' if linode_id: ips = _query('linode', 'ip.list', args={'LinodeID': linode_id}) else: ips = _query('linode', 'ip.list') ...
Returns data for a single named Linode.
def get_linode(kwargs=None, call=None): ''' Returns data for a single named Linode. name The name of the Linode for which to get data. Can be used instead ``linode_id``. Note this will induce an additional API call compared to using ``linode_id``. linode_id The ID of th...
Returns the Linode ID for a VM from the provided name.
def get_linode_id_from_name(name): ''' Returns the Linode ID for a VM from the provided name. name The name of the Linode from which to get the Linode ID. Required. ''' nodes = _query('linode', 'list')['DATA'] linode_id = '' for node in nodes: if name == node['LABEL']: ...
r Return the password to use for a VM.
def get_password(vm_): r''' Return the password to use for a VM. vm\_ The configuration to obtain the password from. ''' return config.get_cloud_config_value( 'password', vm_, __opts__, default=config.get_cloud_config_value( 'passwd', vm_, __opts__, s...
Attempts to decode a user - supplied Linode plan label into the format in Linode API output
def _decode_linode_plan_label(label): ''' Attempts to decode a user-supplied Linode plan label into the format in Linode API output label The label, or name, of the plan to decode. Example: `Linode 2048` will decode to `Linode 2GB` ''' sizes = avail_sizes() if label no...
Returns the Linode Plan ID.
def get_plan_id(kwargs=None, call=None): ''' Returns the Linode Plan ID. label The label, or name, of the plan to get the ID from. CLI Example: .. code-block:: bash salt-cloud -f get_plan_id linode label="Linode 1024" ''' if call == 'action': raise SaltCloudExcept...
r Returns the VM s size.
def get_vm_size(vm_): r''' Returns the VM's size. vm\_ The VM to get the size for. ''' vm_size = config.get_cloud_config_value('size', vm_, __opts__) ram = avail_sizes()[vm_size]['RAM'] if vm_size.startswith('Linode'): vm_size = vm_size.replace('Linode ', '') if ram ==...
Return a list of the VMs that are on the provider. Only a list of VM names and their state is returned. This is the minimum amount of information needed to check for existing VMs.
def list_nodes_min(call=None): ''' Return a list of the VMs that are on the provider. Only a list of VM names and their state is returned. This is the minimum amount of information needed to check for existing VMs. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt...
Reboot a linode.
def reboot(name, call=None): ''' Reboot a linode. .. versionadded:: 2015.8.0 name The name of the VM to reboot. CLI Example: .. code-block:: bash salt-cloud -a reboot vm_name ''' if call != 'action': raise SaltCloudException( 'The show_instance ac...
Displays details about a particular Linode VM. Either a name or a linode_id must be provided.
def show_instance(name, call=None): ''' Displays details about a particular Linode VM. Either a name or a linode_id must be provided. .. versionadded:: 2015.8.0 name The name of the VM for which to display details. CLI Example: .. code-block:: bash salt-cloud -a show_ins...
Show pricing for a particular profile. This is only an estimate based on unofficial pricing sources.
def show_pricing(kwargs=None, call=None): ''' Show pricing for a particular profile. This is only an estimate, based on unofficial pricing sources. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt-cloud -f show_pricing my-linode-config profile=my-linode-profile '...
Start a VM in Linode.
def start(name, call=None): ''' Start a VM in Linode. name The name of the VM to start. CLI Example: .. code-block:: bash salt-cloud -a stop vm_name ''' if call != 'action': raise SaltCloudException( 'The start action must be called with -a or --action...
Updates a Linode s properties.
def update_linode(linode_id, update_args=None): ''' Updates a Linode's properties. linode_id The ID of the Linode to shutdown. Required. update_args The args to update the Linode with. Must be in dictionary form. ''' update_args.update({'LinodeID': linode_id}) result = _qu...
Returns the DATA response from a Linode API query as a single pre - formatted dictionary
def _clean_data(api_response): ''' Returns the DATA response from a Linode API query as a single pre-formatted dictionary api_response The query to be cleaned. ''' data = {} data.update(api_response['DATA']) if not data: response_data = api_response['DATA'] data.upd...
Helper function to format and parse linode data
def _list_linodes(full=False): ''' Helper function to format and parse linode data ''' nodes = _query('linode', 'list')['DATA'] ips = get_ips() ret = {} for node in nodes: this_node = {} linode_id = six.text_type(node['LINODEID']) this_node['id'] = linode_id ...
Make a web call to the Linode API.
def _query(action=None, command=None, args=None, method='GET', header_dict=None, data=None, url='https://api.linode.com/'): ''' Make a web call to the Linode API. ''' global LASTCALL vm_ = get_configured_provider() ratelimit_slee...
Wait for a Job to return.
def _wait_for_job(linode_id, job_id, timeout=300, quiet=True): ''' Wait for a Job to return. linode_id The ID of the Linode to wait on. Required. job_id The ID of the job to wait for. timeout The amount of time to wait for a status to update. quiet Log status ...
Wait for a certain status from Linode.
def _wait_for_status(linode_id, status=None, timeout=300, quiet=True): ''' Wait for a certain status from Linode. linode_id The ID of the Linode to wait on. Required. status The status to look for to update. timeout The amount of time to wait for a status to update. q...
Return linode status by ID
def _get_status_descr_by_id(status_id): ''' Return linode status by ID status_id linode VM status ID ''' for status_name, status_data in six.iteritems(LINODE_STATUS): if status_data['code'] == int(status_id): return status_data['descr'] return LINODE_STATUS.get(statu...
Checks if the provided name fits Linode s labeling parameters.
def _validate_name(name): ''' Checks if the provided name fits Linode's labeling parameters. .. versionadded:: 2015.5.6 name The VM name to validate ''' name = six.text_type(name) name_length = len(name) regex = re.compile(r'^[a-zA-Z0-9][A-Za-z0-9_-]*[a-zA-Z0-9]$') if name...
Given the following NAPALM grains we can determine the Capirca platform name:
def _get_capirca_platform(): # pylint: disable=too-many-return-statements ''' Given the following NAPALM grains, we can determine the Capirca platform name: - vendor - device model - operating system Not the most optimal. ''' vendor = __grains__['vendor'].lower() os_ = __grains__[...
Generate and load the configuration of a policy term.
def load_term_config(filter_name, term_name, filter_options=None, pillar_key='acl', pillarenv=None, saltenv=None, merge_pillar=True, revision_id=None, r...
Generate and load the configuration of a policy filter.
def load_filter_config(filter_name, filter_options=None, terms=None, prepend=True, pillar_key='acl', pillarenv=None, saltenv=None, merge_pillar=True, ...
Generate and load the configuration of the whole policy.
def load_policy_config(filters=None, prepend=True, pillar_key='acl', pillarenv=None, saltenv=None, merge_pillar=True, only_lower_merge=False, revision_id=None,...
Helper that can be used inside a state SLS in order to get the filter configuration given its name.
def get_filter_pillar(filter_name, pillar_key='acl', pillarenv=None, saltenv=None): ''' Helper that can be used inside a state SLS, in order to get the filter configuration given its name. filter_name The name of the filter. ...
Helper that can be used inside a state SLS in order to get the term configuration given its name under a certain filter uniquely identified by its name.
def get_term_pillar(filter_name, term_name, pillar_key='acl', pillarenv=None, saltenv=None): ''' Helper that can be used inside a state SLS, in order to get the term configuration given its name, under a certain filter uniqu...
Get Pure Storage FlasBlade configuration
def _get_blade(): ''' Get Pure Storage FlasBlade configuration 1) From the minion config pure_tags: fb: san_ip: management vip or hostname for the FlashBlade api_token: A valid api token for the FlashBlade being managed 2) From environment (PUREFB_IP and PUREFB...
Private function to check for existance of a filesystem
def _get_fs(name, blade): ''' Private function to check for existance of a filesystem ''' _fs = [] _fs.append(name) try: res = blade.file_systems.list_file_systems(names=_fs) return res.items[0] except rest.ApiException: return None
Return name of Snapshot or None
def _get_snapshot(name, suffix, blade): ''' Return name of Snapshot or None ''' try: filt = 'source=\'{}\' and suffix=\'{}\''.format(name, suffix) res = blade.file_system_snapshots.list_file_system_snapshots(filter=filt) return res.items[0] except rest.ApiException: ...
Private function to check if a file systeem has already been deleted
def _get_deleted_fs(name, blade): ''' Private function to check if a file systeem has already been deleted ''' try: _fs = _get_fs(name, blade) if _fs and _fs.destroyed: return _fs except rest.ApiException: return None
Ensures that syslog - ng is started via the given parameters.
def started(name=None, user=None, group=None, chroot=None, caps=None, no_caps=False, pidfile=None, enable_core=False, fd_limit=None, verbose=False, debug=False, trace=False, yy...
Prepare the arguments
def _prep_ssh( self, tgt, fun, arg=(), timeout=None, tgt_type='glob', kwarg=None, **kwargs): ''' Prepare the arguments ''' opts = copy.deepcopy(self.opts) opts.update(kwargs) i...
Execute a single command via the salt - ssh subsystem and return a generator
def cmd_iter( self, tgt, fun, arg=(), timeout=None, tgt_type='glob', ret='', kwarg=None, **kwargs): ''' Execute a single command via the salt-ssh subsystem and return a generator ...
Execute a single command via the salt - ssh subsystem and return all routines at once
def cmd(self, tgt, fun, arg=(), timeout=None, tgt_type='glob', kwarg=None, **kwargs): ''' Execute a single command via the salt-ssh subsystem and return all routines at once .. versionadded:: 2015.5.0 ...
Execute a salt - ssh call synchronously.
def cmd_sync(self, low): ''' Execute a salt-ssh call synchronously. .. versionadded:: 2015.5.0 WARNING: Eauth is **NOT** respected .. code-block:: python client.cmd_sync({ 'tgt': 'silver', 'fun': 'test.ping', 'arg': ...
Execute a command on a random subset of the targeted systems
def cmd_subset( self, tgt, fun, arg=(), timeout=None, tgt_type='glob', ret='', kwarg=None, sub=3, **kwargs): ''' Execute a command on a random subset of the targeted systems T...
Verify that the given module is set to the given target
def set_(name, target, module_parameter=None, action_parameter=None): ''' Verify that the given module is set to the given target name The name of the module target The target to be set for this module module_parameter additional params passed to the defined module ac...
Filters a list of dictionary by a set of key - value pair.
def _filter_list(input_list, search_key, search_value): ''' Filters a list of dictionary by a set of key-value pair. :param input_list: is a list of dictionaries :param search_key: is the key we are looking for :param search_value: is the value we are looking for the key specified in search_ke...
Filters a dictionary of dictionaries by a key - value pair.
def _filter_dict(input_dict, search_key, search_value): ''' Filters a dictionary of dictionaries by a key-value pair. :param input_dict: is a dictionary whose values are lists of dictionaries :param search_key: is the key in the leaf dictionaries :param search_values: is the value in the lea...
Will explicily close the config session with the network device when running in a now - always - alive proxy minion or regular minion. This helper must be used in configuration - related functions as the session is preserved and not closed before making any changes.
def _explicit_close(napalm_device): ''' Will explicily close the config session with the network device, when running in a now-always-alive proxy minion or regular minion. This helper must be used in configuration-related functions, as the session is preserved and not closed before making any change...
Builds the config logic for load_config and load_template functions.
def _config_logic(napalm_device, loaded_result, test=False, debug=False, replace=False, commit_config=True, loaded_config=None, commit_in=None, commit_at=None, ...
Returns a dictionary with the raw output of all commands passed as arguments.
def cli(*commands, **kwargs): # pylint: disable=unused-argument ''' Returns a dictionary with the raw output of all commands passed as arguments. commands List of commands to be executed on the device. textfsm_parse: ``False`` Try parsing the outputs using the TextFSM templates. ...
Calls the method traceroute from the NAPALM driver object and returns a dictionary with the result of the traceroute command executed on the device.
def traceroute(destination, source=None, ttl=None, timeout=None, vrf=None, **kwargs): # pylint: disable=unused-argument ''' Calls the method traceroute from the NAPALM driver object and returns a dictionary with the result of the traceroute command executed on the device. destination Hostname...
Executes a ping on the network device and returns a dictionary as a result.
def ping(destination, source=None, ttl=None, timeout=None, size=None, count=None, vrf=None, **kwargs): # pylint: disable=unused-argument ''' Executes a ping on the network device and returns a dictionary as a result. destination Hostname or IP address of remote host source Source add...
NAPALM returns a list of dictionaries with details of the ARP entries.
def arp(interface='', ipaddr='', macaddr='', **kwargs): # pylint: disable=unused-argument ''' NAPALM returns a list of dictionaries with details of the ARP entries. :param interface: interface name to filter on :param ipaddr: IP address to filter on :param macaddr: MAC address to filter on :r...
Returns a detailed view of the LLDP neighbors.
def lldp(interface='', **kwargs): # pylint: disable=unused-argument ''' Returns a detailed view of the LLDP neighbors. :param interface: interface name to filter on :return: A dictionary with the LLDL neighbors. The keys are the interfaces with LLDP activated on. CLI Example: ...
Returns the MAC Address Table on the device.
def mac(address='', interface='', vlan=0, **kwargs): # pylint: disable=unused-argument ''' Returns the MAC Address Table on the device. :param address: MAC address to filter on :param interface: Interface name to filter on :param vlan: VLAN identifier :return: A list of dictio...
Applies configuration changes on the device. It can be loaded from a file or from inline string. If you send both a filename and a string containing the configuration the file has higher precedence.
def load_config(filename=None, text=None, test=False, commit=True, debug=False, replace=False, commit_in=None, commit_at=None, revert_in=None, revert_at=None, c...
Renders a configuration template ( default: Jinja ) and loads the result on the device.
def load_template(template_name=None, template_source=None, context=None, defaults=None, template_engine='jinja', saltenv='base', template_hash=None, template_hash_name=None, s...
Will prompt if the configuration has been changed.
def config_changed(inherit_napalm_device=None, **kwargs): # pylint: disable=unused-argument ''' Will prompt if the configuration has been changed. :return: A tuple with a boolean that specifies if the config was changed on the device.\ And a string that provides more details of the reason why the con...
Will check if the configuration was changed. If differences found will try to commit. In case commit unsuccessful will try to rollback.
def config_control(inherit_napalm_device=None, **kwargs): # pylint: disable=unused-argument ''' Will check if the configuration was changed. If differences found, will try to commit. In case commit unsuccessful, will try to rollback. :return: A tuple with a boolean that specifies if the config wa...
.. versionadded:: 2019. 2. 0
def cancel_commit(jid): ''' .. versionadded:: 2019.2.0 Cancel a commit scheduled to be executed via the ``commit_in`` and ``commit_at`` arguments from the :py:func:`net.load_template <salt.modules.napalm_network.load_template>` or :py:func:`net.load_config <salt.modules.napalm_network.load_conf...
.. versionadded:: 2019. 2. 0
def confirm_commit(jid): ''' .. versionadded:: 2019.2.0 Confirm a commit scheduled to be reverted via the ``revert_in`` and ``revert_at`` arguments from the :mod:`net.load_template <salt.modules.napalm_network.load_template>` or :mod:`net.load_config <salt.modules.napalm_network.load_config>` ...
.. versionadded:: 2019. 2. 0
def save_config(source=None, path=None): ''' .. versionadded:: 2019.2.0 Save the configuration to a file on the local file system. source: ``running`` The configuration source. Choose from: ``running``, ``candidate``, ``startup``. Default: ``running``. path ...
.. versionadded:: 2019. 2. 0
def replace_pattern(pattern, repl, count=0, flags=8, bufsize=1, append_if_not_found=False, prepend_if_not_found=False, not_found_content=None, search_only=False...
.. versionadded:: 2019. 2. 0
def blockreplace(marker_start, marker_end, content='', append_if_not_found=False, prepend_if_not_found=False, show_changes=True, append_newline=False, source='running', path=None, ...
.. versionadded:: 2019. 2. 0
def patch(patchfile, options='', saltenv='base', source_hash=None, show_changes=True, source='running', path=None, test=False, commit=True, debug=False, replace=True): ''' .. versionadded:: 2019.2.0 Apply a ...
Execute salt - run
def run(self): ''' Execute salt-run ''' import salt.runner self.parse_args() # Setup file logging! self.setup_logfile_logger() verify_log(self.config) profiling_enabled = self.options.profiling_enabled runner = salt.runner.Runner(self.con...
Set parameters for iDRAC in a blade.
def blade_idrac(name, idrac_password=None, idrac_ipmi=None, idrac_ip=None, idrac_netmask=None, idrac_gateway=None, idrac_dnsname=None, idrac_dhcp=None): ''' Set parameters for iDRAC in a blade. :param idrac_password: Password to use to connect to the iDRACs d...
Manage a Dell Chassis.
def chassis(name, chassis_name=None, password=None, datacenter=None, location=None, mode=None, idrac_launch=None, slot_names=None, blade_power_states=None): ''' Manage a Dell Chassis. chassis_name The name of the chassis. datacenter The datacenter in which the c...
Manage switches in a Dell Chassis.
def switch(name, ip=None, netmask=None, gateway=None, dhcp=None, password=None, snmp=None): ''' Manage switches in a Dell Chassis. name The switch designation (e.g. switch-1, switch-2) ip The Static IP Address of the switch netmask The netmask for the stati...
Update firmware for a single host
def _firmware_update(firmwarefile='', host='', directory=''): ''' Update firmware for a single host ''' dest = os.path.join(directory, firmwarefile[7:]) __salt__['cp.get_file'](firmwarefile, dest) username = __pillar__['proxy']['admin_user'] password = __pillar__['prox...
State to update the firmware on host using the racadm command
def firmware_update(hosts=None, directory=''): ''' State to update the firmware on host using the ``racadm`` command firmwarefile filename (string) starting with ``salt://`` host string representing the hostname supplied to the ``racadm`` command ...