Search is not available for this dataset
text
stringlengths
75
104k
def update(): ''' When we are asked to update (regular interval) lets reap the cache ''' try: salt.fileserver.reap_fileserver_cache_dir( os.path.join(__opts__['cachedir'], 'roots', 'hash'), find_file ) except (IOError, OSError): # Hash file won't exist...
def _file_lists(load, form): ''' Return a dict containing the file lists for files, dirs, emtydirs and symlinks ''' if 'env' in load: # "env" is not supported; Use "saltenv". load.pop('env') saltenv = load['saltenv'] if saltenv not in __opts__['file_roots']: if '__env__'...
def symlink_list(load): ''' Return a dict of all symlinks based on a given path on the Master ''' if 'env' in load: # "env" is not supported; Use "saltenv". load.pop('env') ret = {} if load['saltenv'] not in __opts__['file_roots'] and '__env__' not in __opts__['file_roots']: ...
def validate(config): ''' Validate the beacon configuration ''' # Configuration for load beacon should be a list of dicts if not isinstance(config, list): return False, ('Configuration for load beacon must be a list.') else: _config = {} list(map(_config.update, config))...
def beacon(config): ''' Emit the load averages of this host. Specify thresholds for each load average and only emit a beacon if any of them are exceeded. `onchangeonly`: when `onchangeonly` is True the beacon will fire events only when the load average pass one threshold. Otherwise, it wi...
def init(storage_backend='dir', trust_password=None, network_address=None, network_port=None, storage_create_device=None, storage_create_loop=None, storage_pool=None): ''' Calls lxd init --auto -- opts storage_backend : Storage backend to use (zfs or dir, default: dir) trust_...
def config_set(key, value): ''' Set an LXD daemon config option CLI Examples: To listen on IPv4 and IPv6 port 8443, you can omit the :8443 its the default: .. code-block:: bash salt '*' lxd.config_set core.https_address [::]:8443 To set the server trust password: .. code-bl...
def config_get(key): ''' Get an LXD daemon config option key : The key of the config value to retrieve CLI Examples: .. code-block:: bash salt '*' lxd.config_get core.https_address ''' cmd = 'lxc config get "{0}"'.format( key ) output = __salt__['cmd.run...
def pylxd_client_get(remote_addr=None, cert=None, key=None, verify_cert=True): ''' Get an pyxld client, this is not ment to be runned over the CLI. remote_addr : An URL to a remote Server, you also have to give cert and key if you provide remote_addr and its a TCP Address! Examples...
def pylxd_save_object(obj): ''' Saves an object (profile/image/container) and translate its execpetion on failure obj : The object to save This is an internal method, no CLI Example. ''' try: obj.save() except pylxd.exceptions.LXDAPIException as e: raise Command...
def authenticate(remote_addr, password, cert, key, verify_cert=True): ''' Authenticate with a remote LXDaemon. remote_addr : An URL to a remote Server, you also have to give cert and key if you provide remote_addr and its a TCP Address! Examples: https://myserver.lan:84...
def container_list(list_names=False, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Lists containers list_names : False Only return a list of names when True remote_addr : An URL to a remote Server, you also have to give cert and key if you pro...
def container_create(name, source, profiles=None, config=None, devices=None, architecture='x86_64', ephemeral=False, wait=True, remote_addr=None, cert=None, key=None, verify_cert=True, _raw=False): ''' Create a container na...
def container_get(name=None, remote_addr=None, cert=None, key=None, verify_cert=True, _raw=False): ''' Gets a container from the LXD name : The name of the container to get. remote_addr : An URL to a remote Server, you also have to give cert and key if ...
def container_delete(name, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Delete a container name : Name of the container to delete remote_addr : An URL to a remote Server, you also have to give cert and key if you provide remote_addr and its...
def container_rename(name, newname, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Rename a container name : Name of the container to Rename newname : The new name of the contianer remote_addr : An URL to a remote Server, you also have t...
def container_state(name=None, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Get container state remote_addr : An URL to a remote Server, you also have to give cert and key if you provide remote_addr and its a TCP Address! Examples: h...
def container_start(name, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Start a container name : Name of the container to start remote_addr : An URL to a remote Server, you also have to give cert and key if you provide remote_addr and its a T...
def container_stop(name, timeout=30, force=True, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Stop a container name : Name of the container to stop remote_addr : An URL to a remote Server, you also have to give cert and key if you provide rem...
def container_restart(name, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Restart a container name : Name of the container to restart remote_addr : An URL to a remote Server, you also have to give cert and key if you provide remote_addr and...
def container_freeze(name, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Freeze a container name : Name of the container to freeze remote_addr : An URL to a remote Server, you also have to give cert and key if you provide remote_addr and its...
def container_unfreeze(name, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Unfreeze a container name : Name of the container to unfreeze remote_addr : An URL to a remote Server, you also have to give cert and key if you provide remote_addr...
def container_migrate(name, stop_and_start=False, remote_addr=None, cert=None, key=None, verify_cert=True, src_remote_addr=None, src_cert=None, ...
def container_config_get(name, config_key, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Get a container config value name : Name of the container config_key : The config key to retrieve remote_addr : An URL to a remote Server, you ...
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...
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...
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...
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...
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, ...
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...
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...
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...
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...
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)....
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 ...
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...
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...
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...
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....
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...
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...
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...
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 ...
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...
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 ...
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. ...
def image_from_simplestreams(server, alias, remote_addr=None, cert=None, key=None, verify_cert=True, aliases=None, pu...
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...
def image_copy_lxd(source, src_remote_addr, src_cert, src_key, src_verify_cert, remote_addr, cert, key, verify_cert=True, aliases=None, ...
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...
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 ...
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'...
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...
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...
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...
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...
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...
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...
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
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...
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...
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: .. ...
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...
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...
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...
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...
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'...
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...
def string(self, writesize=None): ''' Looks like a file handle ''' if not self.finished: self.finished = True return self.content return ''
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 ...
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...
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) ...
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...
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`` ...
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...
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...
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...
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: ...
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...
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...
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 ...
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...
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...
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...
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...
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 ...
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...
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...
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 ...
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-...
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...
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...
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...
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...
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) *...
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/...
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...
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: ...
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...
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...