INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
Set a container config value
def container_config_set(name, config_key, config_value, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Set a container config value name : Name of the container config_key : The config key to set config_value : The config value to s...
Delete a container config value
def container_config_delete(name, config_key, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Delete a container config value name : Name of the container config_key : The config key to delete remote_addr : An URL to a remote Serve...
Get a container device
def container_device_get(name, device_name, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Get a container device name : Name of the container device_name : The device name to retrieve remote_addr : An URL to a remote Server, you als...
Add a container device
def container_device_add(name, device_name, device_type='disk', remote_addr=None, cert=None, key=None, verify_cert=True, **kwargs): ''' Add a container device name : Name of the container device_name : The devic...
Delete a container device
def container_device_delete(name, device_name, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Delete a container device name : Name of the container device_name : The device name to delete remote_addr : An URL to a remote Server, ...
Put a file into a container
def container_file_put(name, src, dst, recursive=False, overwrite=False, mode=None, uid=None, gid=None, saltenv='base', remote_addr=None, cert=None, key=None, verify_cert=True): ''' Put a file into a container name : Name of the c...
Get a file from a container
def container_file_get(name, src, dst, overwrite=False, mode=None, uid=None, gid=None, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Get a file from a container name : Name of the container src : The source file or directory...
Execute a command list on a container.
def container_execute(name, cmd, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Execute a command list on a container. name : Name of the container cmd : Command to be executed (as a list) Example : '["ls", "-l"]' remote_ad...
Lists all profiles from the LXD.
def profile_list(list_names=False, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Lists all profiles from the LXD. list_names : Return a list of names instead of full blown dicts. remote_addr : An URL to a remote Server, you also have to giv...
Creates a profile.
def profile_create(name, config=None, devices=None, description=None, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Creates a profile. name : The name of the profile to get. config : A config dict or None (None = unset)....
Gets a profile from the LXD
def profile_get(name, remote_addr=None, cert=None, key=None, verify_cert=True, _raw=False): ''' Gets a profile from the LXD name : The name of the profile to get. remote_addr : An URL to a remote Server, you also have to give cert and key if you ...
Deletes a profile.
def profile_delete(name, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Deletes a profile. name : The name of the profile to delete. remote_addr : An URL to a remote Server, you also have to give cert and key if you provide remo...
Get a profile config item.
def profile_config_get(name, config_key, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Get a profile config item. name : The name of the profile to get the config item from. config_key : The key for the item to retrieve. remot...
Set a profile config item.
def profile_config_set(name, config_key, config_value, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Set a profile config item. name : The name of the profile to set the config item to. config_key : The items key...
Delete a profile config item.
def profile_config_delete(name, config_key, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Delete a profile config item. name : The name of the profile to delete the config item. config_key : The config key for the value to retrieve....
Get a profile device.
def profile_device_get(name, device_name, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Get a profile device. name : The name of the profile to get the device from. device_name : The name of the device to retrieve. remote_addr...
Set a profile device.
def profile_device_set(name, device_name, device_type='disk', remote_addr=None, cert=None, key=None, verify_cert=True, **kwargs): ''' Set a profile device. name : The name of the profile to set the device to. device_n...
Delete a profile device.
def profile_device_delete(name, device_name, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Delete a profile device. name : The name of the profile to delete the device. device_name : The name of the device to delete. remote...
Lists all images from the LXD.
def image_list(list_aliases=False, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Lists all images from the LXD. list_aliases : Return a dict with the fingerprint as key and a list of aliases as value instead. remote_addr : An URL ...
Get an image by its fingerprint
def image_get(fingerprint, remote_addr=None, cert=None, key=None, verify_cert=True, _raw=False): ''' Get an image by its fingerprint fingerprint : The fingerprint of the image to retrieve remote_addr : An...
Get an image by an alias
def image_get_by_alias(alias, remote_addr=None, cert=None, key=None, verify_cert=True, _raw=False): ''' Get an image by an alias alias : The alias of the image to retrieve ...
Delete an image by an alias or fingerprint
def image_delete(image, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Delete an image by an alias or fingerprint name : The alias or fingerprint of the image to delete, can be a obj for the states. ...
Create an image from simplestreams
def image_from_simplestreams(server, alias, remote_addr=None, cert=None, key=None, verify_cert=True, aliases=None, pu...
Create an image from a file
def image_from_file(filename, remote_addr=None, cert=None, key=None, verify_cert=True, aliases=None, public=False, saltenv='base', _raw=False): ''' Create a...
Copy an image from another LXD instance
def image_copy_lxd(source, src_remote_addr, src_cert, src_key, src_verify_cert, remote_addr, cert, key, verify_cert=True, aliases=None, ...
Create an alias on the given image
def image_alias_add(image, alias, description='', remote_addr=None, cert=None, key=None, verify_cert=True): ''' Create an alias on the given image image : An image alias, a fi...
Delete an alias ( this is currently not restricted to the image )
def image_alias_delete(image, alias, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Delete an alias (this is currently not restricted to the image) image : An image ...
Get all snapshots for a container
def snapshots_all(container, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Get all snapshots for a container container : The name of the container to get. remote_addr : An URL to a remote server. The 'cert' and 'key' fields must also be provided if 'remote_addr'...
Create a snapshot for a container
def snapshots_create(container, name=None, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Create a snapshot for a container container : The name of the container to get. name : The name of the snapshot. remote_addr : An URL to a remote s...
Delete a snapshot for a container
def snapshots_delete(container, name, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Delete a snapshot for a container container : The name of the container to get. name : The name of the snapshot. remote_addr : An URL to a remote server...
Get information about snapshot for a container
def snapshots_get(container, name, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Get information about snapshot for a container container : The name of the container to get. name : The name of the snapshot. remote_addr : An URL to a remote...
normalize config input so returns can be put into mongodb which doesn t like.
def normalize_input_values(config, devices): ''' normalize config input so returns can be put into mongodb, which doesn't like `.` This is not meant to be used on the commandline. CLI Examples: .. code-block:: bash salt '*' lxd.normalize_input_values config={} devices={} ''' if i...
Syncs the given config and devices with the object ( a profile or a container ) returns a changes dict with all changes made.
def sync_config_devices(obj, newconfig, newdevices, test=False): ''' Syncs the given config and devices with the object (a profile or a container) returns a changes dict with all changes made. obj : The object to sync with / or just test with. newconfig: The...
Sets the dict item key of the attr from obj.
def _set_property_dict_item(obj, prop, key, value): ''' Sets the dict item key of the attr from obj. Basicaly it does getattr(obj, prop)[key] = value. For the disk device we added some checks to make device changes on the CLI saver. ''' attr = getattr(obj, prop) if prop == 'de...
Translates a plyxd model object to a dict
def _pylxd_model_to_dict(obj): '''Translates a plyxd model object to a dict''' marshalled = {} for key in obj.__attributes__.keys(): if hasattr(obj, key): marshalled[key] = getattr(obj, key) return marshalled
Sets the ftp proxy settings
def set_ftp_proxy(server, port, user=None, password=None, network_service="Ethernet", bypass_hosts=None): ''' Sets the ftp proxy settings server The proxy server to use port The port used by the p...
Returns the current domains that can bypass the proxy
def get_proxy_bypass(network_service="Ethernet"): ''' Returns the current domains that can bypass the proxy network_service The network service to get the bypass domains from, this is only necessary on macOS CLI Example: .. code-block:: bash salt '*' proxy.get_proxy_bypas...
Sets the domains that can bypass the proxy
def set_proxy_bypass(domains, network_service="Ethernet"): ''' Sets the domains that can bypass the proxy domains An array of domains allowed to bypass the proxy network_service The network service to apply the changes to, this only necessary on macOS CLI Example: .. ...
Sets the http proxy settings only works with Windows.
def set_proxy_win(server, port, types=None, bypass_hosts=None): ''' Sets the http proxy settings, only works with Windows. server The proxy server to use password The password to use if required by the server types The types of proxy connections should be setup with this s...
Get an SMB connection
def get_conn(host='', username=None, password=None, port=445): ''' Get an SMB connection ''' if HAS_IMPACKET and not HAS_SMBPROTOCOL: salt.utils.versions.warn_until( 'Sodium', 'Support of impacket has been depricated and will be ' 'removed in Sodium. Please in...
Recursively create a directory structure on an SMB share
def _mkdirs_impacket(path, share='C$', conn=None, host=None, username=None, password=None): ''' Recursively create a directory structure on an SMB share Paths should be passed in with forward-slash delimiters, and should not start with a forward-slash. ''' if conn is None: conn = get_co...
Wrapper around impacket. smbconnection. putFile () that allows a string to be uploaded without first writing it as a local file
def put_str(content, path, share='C$', conn=None, host=None, username=None, password=None): ''' Wrapper around impacket.smbconnection.putFile() that allows a string to be uploaded, without first writing it as a local file ''' if HAS_SMBPROTOCOL: return _put_str_smbprotocol( conte...
Wrapper around impacket. smbconnection. putFile () that allows a file to be uploaded
def _put_file_impacket(local_path, path, share='C$', conn=None, host=None, username=None, password=None): ''' Wrapper around impacket.smbconnection.putFile() that allows a file to be uploaded Example usage: import salt.utils.smb smb_conn = salt.utils.smb.get_conn('10.0.0.45', 'vagrant'...
Wrapper around impacket. smbconnection. putFile () that allows a file to be uploaded
def put_file(local_path, path, share='C$', conn=None, host=None, username=None, password=None): ''' Wrapper around impacket.smbconnection.putFile() that allows a file to be uploaded Example usage: import salt.utils.smb smb_conn = salt.utils.smb.get_conn('10.0.0.45', 'vagrant', 'vagrant...
Looks like a file handle
def string(self, writesize=None): ''' Looks like a file handle ''' if not self.finished: self.finished = True return self.content return ''
Get the contents of a template file and provide it as a module type
def _get_template(path, option_key): ''' Get the contents of a template file and provide it as a module type :param path: path to the template.yml file :type path: ``str`` :param option_key: The unique key of this template :type option_key: ``str`` :returns: Details about the template ...
Fetch all of the templates in the src directory
def _fetch_templates(src): ''' Fetch all of the templates in the src directory :param src: The source path :type src: ``str`` :rtype: ``list`` of ``tuple`` :returns: ``list`` of ('key', 'description') ''' templates = [] log.debug('Listing contents of %s', src) for item in os.l...
Akin to shutils. copytree but over existing directories does a recursive merge copy.
def _mergetree(src, dst): ''' Akin to shutils.copytree but over existing directories, does a recursive merge copy. :param src: The source path :type src: ``str`` :param dst: The destination path :type dst: ``str`` ''' for item in os.listdir(src): s = os.path.join(src, item) ...
Merge directory A to directory B apply Jinja2 templating to both the file/ folder names AND to the contents of the files
def _mergetreejinja(src, dst, context): ''' Merge directory A to directory B, apply Jinja2 templating to both the file/folder names AND to the contents of the files :param src: The source path :type src: ``str`` :param dst: The destination path :type dst: ``str`` :param context: The...
Prompt the user to choose between a list of options index each one by adding an enumerator based on https:// github. com/ audreyr/ cookiecutter/ blob/ master/ cookiecutter/ prompt. py#L51
def _prompt_choice(var_name, options): ''' Prompt the user to choose between a list of options, index each one by adding an enumerator based on https://github.com/audreyr/cookiecutter/blob/master/cookiecutter/prompt.py#L51 :param var_name: The question to ask the user :type var_name: ``str`` ...
A template factory for extending the salt ecosystem
def run(extension=None, name=None, description=None, salt_dir=None, merge=False, temp_dir=None): ''' A template factory for extending the salt ecosystem :param extension: The extension type, e.g. 'module', 'state', if omitted, user will be prompted :type extension: ``str`` :param name: Python-fri...
Manage the SNMP sysContact sysLocation and sysServices settings.
def agent_settings(name, contact, location, services=None): ''' Manage the SNMP sysContact, sysLocation, and sysServices settings. :param str contact: The SNMP contact. :param str location: The SNMP location. :param str services: A list of selected services. Example of usage: .. code-bloc...
Manage the sending of authentication traps.
def auth_traps_enabled(name, status=True): ''' Manage the sending of authentication traps. :param bool status: The enabled status. Example of usage: .. code-block:: yaml snmp-auth-traps: win_snmp.auth_traps_enabled: - status: True ''' ret = {'name': na...
Manage the SNMP accepted community names and their permissions.
def community_names(name, communities=None): ''' Manage the SNMP accepted community names and their permissions. :param str communities: A dictionary of SNMP communities and permissions. Example of usage: .. code-block:: yaml snmp-community-names: win_snmp.community_names: ...
Check the version of npm to ensure this module will work. Currently npm must be at least version 1. 2.
def _check_valid_version(): ''' Check the version of npm to ensure this module will work. Currently npm must be at least version 1.2. ''' # Locate the full path to npm npm_path = salt.utils.path.which('npm') # pylint: disable=no-member res = salt.modules.cmdmod.run('{npm} --version'.fo...
Install an NPM package.
def install(pkg=None, pkgs=None, dir=None, runas=None, registry=None, env=None, dry_run=False, silent=True): ''' Install an NPM package. If no directory is specified, the package will be installed globally. If no packag...
Uninstall an NPM package.
def uninstall(pkg, dir=None, runas=None, env=None): ''' Uninstall an NPM package. If no directory is specified, the package will be uninstalled globally. pkg A package name in any format accepted by NPM dir The target directory from which to uninstall the package, or None for ...
List installed NPM packages.
def list_(pkg=None, dir=None, runas=None, env=None, depth=None): ''' List installed NPM packages. If no directory is specified, this will return the list of globally- installed packages. pkg Limit package listing by name dir The directory whose packages will be listed, or None...
Clean cached NPM packages.
def cache_clean(path=None, runas=None, env=None, force=False): ''' Clean cached NPM packages. If no path for a specific package is provided the entire cache will be cleared. path The cache subpath to delete, or None to clear the entire cache runas The user to run NPM with env...
List NPM cached packages.
def cache_list(path=None, runas=None, env=None): ''' List NPM cached packages. If no path for a specific package is provided this will list all the cached packages. path The cache subpath to list, or None to list the entire cache runas The user to run NPM with env Env...
List path of the NPM cache directory.
def cache_path(runas=None, env=None): ''' List path of the NPM cache directory. runas The user to run NPM with env Environment variables to set when invoking npm. Uses the same ``env`` format as the :py:func:`cmd.run <salt.modules.cmdmod.run>` execution function. C...
Send raw ipmi command
def raw_command(netfn, command, bridge_request=None, data=(), retry=True, delay_xmit=None, **kwargs): ''' Send raw ipmi command This allows arbitrary IPMI bytes to be issued. This is commonly used for certain vendor specific commands. :param netfn: Net function number :param command: Command ...
Set channel access
def set_channel_access(channel=14, access_update_mode='non_volatile', alerting=False, per_msg_auth=False, user_level_auth=False, access_mode='always', privilege_update_mode='non_volatile', privilege_level='administrator', **kwargs): ''' Set ch...
: param kwargs: api_host = 127. 0. 0. 1 api_user = admin api_pass = example api_port = 623
def get_channel_access(channel=14, read_mode='non_volatile', **kwargs): ''' :param kwargs:api_host='127.0.0.1' api_user='admin' api_pass='example' api_port=623 :param channel: number [1:7] :param read_mode: - non_volatile = get non-volatile Channel Access - volatile = get present...
Set user access
def set_user_access(uid, channel=14, callback=True, link_auth=True, ipmi_msg=True, privilege_level='administrator', **kwargs): ''' Set user access :param uid: user number [1:16] :param channel: number [1:7] :param callback: User Restricted to Callback - False ...
Get user access
def get_user_access(uid, channel=14, **kwargs): ''' Get user access :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 Return Data .. code-...
Set user name
def set_user_name(uid, name, **kwargs): ''' Set user name :param uid: user number [1:16] :param name: username (limit of 16bytes) :param kwargs: - api_host=127.0.0.1 - api_user=admin - api_pass=example - api_port=623 - api_kg=None CLI Examples: .. c...
Get user name
def get_user_name(uid, return_none_on_error=True, **kwargs): ''' Get user name :param uid: user number [1:16] :param return_none_on_error: return None on error :param kwargs: - api_host=127.0.0.1 - api_user=admin - api_pass=example - api_port=623 - api_kg=Non...
Set user password and ( modes )
def set_user_password(uid, mode='set_password', password=None, **kwargs): ''' Set user password and (modes) :param uid: id number of user. see: get_names_uid()['name'] :param mode: - disable = disable user connections - enable = enable user connections - set_passw...
Get sensor readings
def get_sensor_data(**kwargs): ''' Get sensor readings Iterates sensor reading objects :param kwargs: - api_host=127.0.0.1 - api_user=admin - api_pass=example - api_port=623 - api_kg=None CLI Example: .. code-block:: bash salt-call ipmi.get_se...
Request power state change
def set_power(state='power_on', wait=True, **kwargs): ''' Request power state change :param name: * power_on -- system turn on * power_off -- system turn off (without waiting for OS) * shutdown -- request OS proper shutdown * reset -- reset (without waiting for OS) *...
Set boot device to use on next reboot
def set_bootdev(bootdev='default', persist=False, uefiboot=False, **kwargs): ''' Set boot device to use on next reboot :param bootdev: - network: Request network boot - hd: Boot from hard drive - safe: Boot from hard drive, requesting 'safe mode' - optical: boot from CD/DVD/...
Request identify light
def set_identify(on=True, duration=600, **kwargs): ''' Request identify light Request the identify light to turn off, on for a duration, or on indefinitely. Other than error exceptions, :param on: Set to True to force on or False to force off :param duration: Set if wanting to request turn on...
Get max users in channel
def get_channel_max_user_count(channel=14, **kwargs): ''' Get max users in channel :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 :return: int -- often 16 CLI Examples: ...
Get user from uid and access on channel
def get_user(uid, channel=14, **kwargs): ''' Get user from uid and access on channel :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 Return D...
create/ ensure a user is created with provided settings.
def create_user(uid, name, password, channel=14, callback=False, link_auth=True, ipmi_msg=True, privilege_level='administrator', **kwargs): ''' create/ensure a user is created with provided settings. :param privilege_level: User Privilege Limit. (Determines the maximum privilege lev...
Delete user ( helper )
def user_delete(uid, channel=14, **kwargs): ''' 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: .. co...
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, seconds=0): ''' Verify that a TLS certificate is valid now and (optionally) will be valid for the time specified through weeks, days,...
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') for cmp_key, cmp_value in six.iteritems(cur_cmp): if cmp_key...
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 = mod.values()[0] if not isi...
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] fun_cfg = mod.values()[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
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 = global_settings() if _current['Global Settings']['HTTP_PORT']['VALUE'] == port: return True _xml = """<RIBCL VERS...
Configure the port HTTPS should listen on
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 = global_settings() if _current['Global Settings']['HTTP_PORT']['VALUE'] == port: return True _xml = """<RIBCL ...
Enable SSH on a user defined port
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() if _current['Global Settings']['SSH_PORT']['VALUE'] == port: return True _xml = """<RIBCL VERSION="2.0">...
Create user
def create_user(name, password, *privileges): ''' 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 Enab...
Configure Network Interface
def configure_network(ip, netmask, gateway): ''' Configure Network Interface CLI Example: .. code-block:: bash salt '*' ilo.configure_network [IP ADDRESS] [NETMASK] [GATEWAY] ''' current = network() # Check to see if the network is already configured if (ip in current['Networ...
Configure SNMP
def configure_snmp(community, snmp_port=161, snmp_trapport=161): ''' Configure SNMP CLI Example: .. code-block:: bash salt '*' ilo.configure_snmp [COMMUNITY STRING] [SNMP PORT] [SNMP TRAP PORT] ''' _xml = """<RIBCL VERSION="2.2"> <LOGIN USER_LOGIN="x" PASSWORD="y"> ...
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, 'changes': {}, 'comment': ''} stat = __salt__['rdp.status']() if not stat: if __opts...
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 ret['comment'] = 'RDP will ...
Ensure that a task is present and up - to - date in Kapacitor.
def task_present(name, tick_script, task_type='stream', database=None, retention_policy='default', enable=True, dbrps=None): ''' Ensure that a task is present and up-to-date in Kapacitor. name Name...
Ensure that a task is absent from Kapacitor.
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'](name) if task: if __opts__['test']: ret['result'] = None ...
Set Windows to use a list of NTP servers
def set_servers(*servers): ''' 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' ''' service_name = 'w32time' if not __salt__['service.status'](service_name): if not __salt__['service.start'...
Get list of configured NTP servers
def get_servers(): ''' Get list of configured NTP servers CLI Example: .. code-block:: bash salt '*' ntp.get_servers ''' cmd = ['w32tm', '/query', '/configuration'] lines = __salt__['cmd.run'](cmd, python_shell=False).splitlines() for line in lines: try: if...
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.
def facts_refresh(): ''' 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_...
Displays the facts gathered during the connection. These facts are also stored in Salt grains.
def facts(): ''' 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 ''' ret = {} try: ret['facts'] = __proxy__['junos.get_serialized_facts']() ret['out'...
This function executes the RPC provided as arguments on the junos device. The returned data can be stored in a file.
def rpc(cmd=None, dest=None, **kwargs): ''' 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 store...
Set the device s hostname
def set_hostname(hostname=None, **kwargs): ''' 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 op...
To commit the changes loaded in the candidate configuration.
def commit(**kwargs): ''' 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...
Roll back the last committed configuration changes and commit
def rollback(**kwargs): ''' 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 ...