text
stringlengths
81
112k
Stop a vm vm : string vm to be stopped force : boolean force stop of vm if true key : string [uuid|alias|hostname] value type of 'vm' parameter CLI Example: .. code-block:: bash salt '*' vmadm.stop 186da9ab-7392-4f55-91a5-b8f1fe770543 salt '*' vmadm.stop 1...
Return a list of VMs search : string vmadm filter property sort : string vmadm sort (-s) property order : string vmadm order (-o) property -- Default: uuid,type,ram,state,alias keyed : boolean specified if the output should be an array (False) or dict (True) ...
Return a list of VMs using lookup search : string vmadm filter property order : string vmadm order (-o) property -- Default: uuid,type,ram,state,alias one : boolean return only one result (vmadm's -1) CLI Example: .. code-block:: bash salt '*' vmadm.lookup search=...
Send non-maskable interrupt to vm or capture a screenshot vm : string vm to be targeted action : string nmi or screenshot -- Default: nmi key : string [uuid|alias|hostname] value type of 'vm' parameter CLI Example: .. code-block:: bash salt '*' vmadm.sysrq 186da9a...
Delete a vm vm : string vm to be deleted key : string [uuid|alias|hostname] value type of 'vm' parameter CLI Example: .. code-block:: bash salt '*' vmadm.delete 186da9ab-7392-4f55-91a5-b8f1fe770543 salt '*' vmadm.delete nacl key=alias def delete(vm, key='uuid'): ...
Output the JSON object describing a VM vm : string vm to be targeted key : string [uuid|alias|hostname] value type of 'vm' parameter CLI Example: .. code-block:: bash salt '*' vmadm.get 186da9ab-7392-4f55-91a5-b8f1fe770543 salt '*' vmadm.get nacl key=alias def get(vm...
Lookup info on running kvm vm : string vm to be targeted info_type : string [all|block|blockstats|chardev|cpus|kvm|pci|spice|version|vnc] info type to return key : string [uuid|alias|hostname] value type of 'vm' parameter CLI Example: .. code-block:: bash salt '*'...
Create snapshot of a vm vm : string vm to be targeted name : string snapshot name The snapname must be 64 characters or less and must only contain alphanumeric characters and characters in the set [-_.:%] to comply with ZFS restrictions. key : string [uui...
Reprovision a vm vm : string vm to be reprovisioned image : string uuid of new image key : string [uuid|alias|hostname] value type of 'vm' parameter CLI Example: .. code-block:: bash salt '*' vmadm.reprovision 186da9ab-7392-4f55-91a5-b8f1fe770543 c02a2044-c1bd-11e...
Create a new vm from_file : string json file to create the vm from -- if present, all other options will be ignored kwargs : string|int|... options to set for the vm CLI Example: .. code-block:: bash salt '*' vmadm.create from_file=/tmp/new_vm.json salt '*' vmadm.crea...
Update a new vm vm : string vm to be updated from_file : string json file to update the vm with -- if present, all other options will be ignored key : string [uuid|alias|hostname] value type of 'vm' parameter kwargs : string|int|... options to update for the vm CLI ...
Send a vm to a directory vm : string vm to be sent target : string target directory key : string [uuid|alias|hostname] value type of 'vm' parameter CLI Example: .. code-block:: bash salt '*' vmadm.send 186da9ab-7392-4f55-91a5-b8f1fe770543 /opt/backups salt...
Receive a vm from a directory uuid : string uuid of vm to be received source : string source directory CLI Example: .. code-block:: bash salt '*' vmadm.receive 186da9ab-7392-4f55-91a5-b8f1fe770543 /opt/backups def receive(uuid, source): ''' Receive a vm from a direct...
Install a capability Args: capability (str): The capability to install source (Optional[str]): The optional source of the capability. Default is set by group policy and can be Windows Update. limit_access (Optional[bool]): Prevent DISM from contacting Windows Update ...
Uninstall a capability Args: capability(str): The capability to be removed image (Optional[str]): The path to the root directory of an offline Windows image. If `None` is passed, the running operating system is targeted. Default is None. restart (Optional[bool]): Reb...
List all capabilities on the system Args: image (Optional[str]): The path to the root directory of an offline Windows image. If `None` is passed, the running operating system is targeted. Default is None. Raises: NotImplementedError: For all versions of Windows that are...
List the capabilities installed on the system Args: image (Optional[str]): The path to the root directory of an offline Windows image. If `None` is passed, the running operating system is targeted. Default is None. Raises: NotImplementedError: For all versions of Window...
Install a feature using DISM Args: feature (str): The feature to install package (Optional[str]): The parent package for the feature. You do not have to specify the package if it is the Windows Foundation Package. Otherwise, use package to specify the parent package of the f...
Disables the feature. Args: feature (str): The feature to uninstall remove_payload (Optional[bool]): Remove the feature's payload. Must supply source when enabling in the future. image (Optional[str]): The path to the root directory of an offline Windows image. If `N...
List features on the system or in a package Args: package (Optional[str]): The full path to the package. Can be either a .cab file or a folder. Should point to the original source of the package, not to where the file is installed. You cannot use this command to get pack...
Install a package using DISM Args: package (str): The package to install. Can be a .cab file, a .msu file, or a folder .. note:: An `.msu` package is supported only when the target image is offline, either mounted or applied. ignore_check (O...
Uninstall a package Args: package (str): The full path to the package. Can be either a .cab file or a folder. Should point to the original source of the package, not to where the file is installed. This can also be the name of a package as listed in ``dism.installed_pack...
Display information about a package Args: package (str): The full path to the package. Can be either a .cab file or a folder. Should point to the original source of the package, not to where the file is installed. You cannot use this command to get package information fo...
Allow for the calling of execution modules via sudo. This module is invoked by the minion if the ``sudo_user`` minion config is present. Example minion config: .. code-block:: yaml sudo_user: saltdev Once this setting is made, any execution module call done by the minion will be run...
Update the repo to a given revision. Using clean passes -C to the hg up def _update_repo(ret, name, target, clean, user, identity, rev, opts, update_head): ''' Update the repo to a given revision. Using clean passes -C to the hg up ''' log.debug('target %s is found, "hg pull && hg up is probably requir...
Check if a ZFS filesystem or volume or snapshot exists. name : string name of dataset type : string also check if dataset is of a certain type, valid choices are: filesystem, snapshot, volume, bookmark, or all. .. versionadded:: 2015.5.0 CLI Example: .. code-block:: bash ...
Create a ZFS File System. name : string name of dataset or volume volume_size : string if specified, a zvol will be created instead of a dataset sparse : boolean create sparse volume create_parent : boolean creates all the non-existing parent datasets. any property speci...
Destroy a ZFS File System. name : string name of dataset, volume, or snapshot force : boolean force an unmount of any file systems using the unmount -f command. recursive : boolean recursively destroy all children. (-r) recursive_all : boolean recursively destroy all dep...
Rename or Relocate a ZFS File System. name : string name of dataset, volume, or snapshot new_name : string new name of dataset, volume, or snapshot force : boolean force unmount any filesystems that need to be unmounted in the process. create_parent : boolean creates all...
Return a list of all datasets or a specified dataset on the system and the values of their used, available, referenced, and mountpoint properties. name : string name of dataset, volume, or snapshot recursive : boolean recursively list children depth : int limit recursion to dept...
List mounted zfs filesystems .. versionadded:: 2018.3.1 CLI Example: .. code-block:: bash salt '*' zfs.list_mount def list_mount(): ''' List mounted zfs filesystems .. versionadded:: 2018.3.1 CLI Example: .. code-block:: bash salt '*' zfs.list_mount ''' ...
Mounts ZFS file systems name : string name of the filesystem, having this set to None will mount all filesystems. (this is the default) overlay : boolean perform an overlay mount. options : string optional comma-separated list of mount options to use temporarily for the dura...
Unmounts ZFS file systems name : string name of the filesystem, you can use None to unmount all mounted filesystems. force : boolean forcefully unmount the file system, even if it is currently in use. .. warning:: Using ``-a`` for the name parameter will probably break your system...
Clears the specified property prop : string name of property name : string name of the filesystem, volume, or snapshot recursive : boolean recursively inherit the given property for all children. revert : boolean revert the property to the received value if one exists; o...
Display the difference between a snapshot of a given filesystem and another snapshot of that filesystem from a later time or the current contents of the filesystem. name_a : string name of snapshot name_b : string (optional) name of snapshot or filesystem show_changetime : boolean ...
Roll back the given dataset to a previous snapshot. name : string name of snapshot recursive : boolean destroy any snapshots and bookmarks more recent than the one specified. recursive_all : boolean destroy any more recent snapshots and bookmarks, as well as any clon...
Creates a clone of the given snapshot. name_a : string name of snapshot name_b : string name of filesystem or volume create_parent : boolean creates all the non-existing parent datasets. any property specified on the command line using the -o option is ignored. propertie...
Promotes a clone file system to no longer be dependent on its "origin" snapshot. .. note:: This makes it possible to destroy the file system that the clone was created from. The clone parent-child dependency relationship is reversed, so that the origin file system becomes a clone of th...
Creates a bookmark of the given snapshot .. note:: Bookmarks mark the point in time when the snapshot was created, and can be used as the incremental source for a zfs send command. This feature must be enabled to be used. See zpool-features(5) for details on ZFS feature flags and ...
Lists all existing user references for the given snapshot or snapshots. snapshot : string name of snapshot recursive : boolean lists the holds that are set on the named descendent snapshots also. .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt '*' zfs.h...
Adds a single reference, named with the tag argument, to the specified snapshot or snapshots. .. note:: Each snapshot has its own tag namespace, and tags must be unique within that space. If a hold exists on a snapshot, attempts to destroy that snapshot by using the zfs destroy comman...
Creates snapshots with the given names. snapshot : string name of snapshot(s) recursive : boolean recursively create snapshots of all descendent datasets. properties : dict additional zfs properties (-o) .. note:: ZFS properties can be specified at the time of creation...
Sets the property or list of properties to the given value(s) for each dataset. dataset : string name of snapshot(s), filesystem(s), or volume(s) properties : string additional zfs properties pairs .. note:: properties are passed as key-value pairs. e.g. compression=o...
Displays properties for the given datasets. dataset : string name of snapshot(s), filesystem(s), or volume(s) properties : string comma-separated list of properties to list, defaults to all recursive : boolean recursively list children depth : int recursively list childr...
Helper function to raise a warning, by default, a ``DeprecationWarning``, until the provided ``version``, after which, a ``RuntimeError`` will be raised to remind the developers to remove the warning because the target version has been reached. :param version: The version info or name after which the w...
Helper function to raise a warning (by default, a ``DeprecationWarning``) when unhandled keyword arguments are passed to function, until the provided ``version_info``, after which, a ``RuntimeError`` will be raised to remind the developers to remove the ``**kwargs`` because the target version has been r...
Compares two version strings using salt.utils.versions.LooseVersion. This is a fallback for providers which don't have a version comparison utility built into them. Return -1 if version1 < version2, 0 if version1 == version2, and 1 if version1 > version2. Return None if there was a problem making the c...
Compares two version numbers. Accepts a custom function to perform the cmp-style version comparison, otherwise uses version_cmp(). def compare(ver1='', oper='==', ver2='', cmp_func=None, ignore_epoch=False): ''' Compares two version numbers. Accepts a custom function to perform the cmp-style version co...
Checks for the version of various required boto libs in one central location. Most boto states and modules rely on a single version of the boto, boto3, or botocore libs. However, some require newer versions of any of these dependencies. This function allows the module to pass in a version to override the de...
.. versionadded:: 2017.11.0 Create target group if not present. name (string) - The name of the target group. protocol (string) - The protocol to use for routing traffic to the targets port (int) - The port on which the targets receive traffic. This port is used unless ...
Delete target group. name (string) - The Amazon Resource Name (ARN) of the resource. returns (bool) - True on success, False on failure. CLI example: .. code-block:: bash check-target: boto_elb2.delete_targets_group: - name: myALB - protocol...
.. versionadded:: 2017.7.0 Add targets to an Application Load Balancer target group. This state will not remove targets. name The ARN of the Application Load Balancer Target Group to add targets to. targets A list of target IDs or a string of a single target that this target group should ...
Show all employees for this company. CLI Example: salt myminion bamboohr.list_employees By default, the return data will be keyed by ID. However, it can be ordered by any other field. Keep in mind that if the field that is chosen contains duplicate values (i.e., location is used, for a compan...
Show all employees for this company. CLI Example: salt myminion bamboohr.show_employee 1138 By default, the fields normally returned from bamboohr.list_employees are returned. These fields are: - canUploadPhoto - department - displayName - firstName - id ...
Update one or more items for this employee. Specifying an empty value will clear it for that employee. CLI Examples: salt myminion bamboohr.update_employee 1138 nickname Curly salt myminion bamboohr.update_employee 1138 nickname '' salt myminion bamboohr.update_employee 1138 items='{"n...
Show all users for this company. CLI Example: salt myminion bamboohr.list_users By default, the return data will be keyed by ID. However, it can be ordered by any other field. Keep in mind that if the field that is chosen contains duplicate values (i.e., location is used, for a company which ...
Show all meta data fields for this company. CLI Example: salt myminion bamboohr.list_meta_fields def list_meta_fields(): ''' Show all meta data fields for this company. CLI Example: salt myminion bamboohr.list_meta_fields ''' ret = {} status, result = _query(action='meta...
Make a web call to BambooHR The password can be any random text, so we chose Salty text. def _query(action=None, command=None, args=None, method='GET', data=None): ''' Make a web call to BambooHR The password can be any random text, so we chose Salty text. ...
Get an sqlite3 connection, and initialize the package database if necessary def init(): ''' Get an sqlite3 connection, and initialize the package database if necessary ''' if not os.path.exists(__opts__['spm_cache_dir']): log.debug('Creating SPM cache directory at %s', __opts__['spm_db']) ...
List info for a package def info(package, conn=None): ''' List info for a package ''' close = False if conn is None: close = True conn = init() fields = ( 'package', 'version', 'release', 'installed', 'os', 'os_family', 'd...
List files for an installed package def list_packages(conn=None): ''' List files for an installed package ''' close = False if conn is None: close = True conn = init() ret = [] data = conn.execute('SELECT package FROM packages') for pkg in data.fetchall(): ret.a...
List files for an installed package def list_files(package, conn=None): ''' List files for an installed package ''' close = False if conn is None: close = True conn = init() data = conn.execute('SELECT package FROM packages WHERE package=?', (package, )) if not data.fetchon...
Register a package in the package database def register_pkg(name, formula_def, conn=None): ''' Register a package in the package database ''' close = False if conn is None: close = True conn = init() conn.execute('INSERT INTO packages VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', ...
Register a file in the package database def register_file(name, member, path, digest='', conn=None): ''' Register a file in the package database ''' close = False if conn is None: close = True conn = init() conn.execute('INSERT INTO files VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?...
Unregister a file from the package database def unregister_file(path, pkg=None, conn=None): # pylint: disable=W0612 ''' Unregister a file from the package database ''' close = False if conn is None: close = True conn = init() conn.execute('DELETE FROM files WHERE path=?', (pat...
This function gets called when the proxy starts up. def init(opts): ''' This function gets called when the proxy starts up. ''' if 'host' not in opts['proxy']: log.critical('No \'host\' key found in pillar for this proxy.') return False if 'username' not in opts['proxy']: lo...
Sends a post command to the device and returns the decoded data. def call(payload, apply_changes=False): ''' Sends a post command to the device and returns the decoded data. ''' session, cookies, csrf_token = logon() response = _post_request(session, payload, cookies, csrf_token) if apply_chang...
Logs into the bluecoat_sslv device and returns the session cookies. def logon(): ''' Logs into the bluecoat_sslv device and returns the session cookies. ''' session = requests.session() payload = {"jsonrpc": "2.0", "id": "ID0", "method": "login", "params...
Closes the session with the device. def logout(session, cookies, csrf_token): ''' Closes the session with the device. ''' payload = {"jsonrpc": "2.0", "id": "ID0", "method": "logout", "params": [] } session.post(DETAILS['url'], ...
Get the grains from the proxied device def grains(): ''' Get the grains from the proxied device ''' if not DETAILS.get('grains_cache', {}): DETAILS['grains_cache'] = GRAINS_CACHE try: DETAILS['grains_cache'] = _get_grain_information() except salt.exceptions.CommandEx...
Returns true if the device is reachable, else false. def ping(): ''' Returns true if the device is reachable, else false. ''' try: session, cookies, csrf_token = logon() logout(session, cookies, csrf_token) except salt.exceptions.CommandExecutionError: return False excep...
.. versionadded:: 2015.5.0 .. versionchanged:: 2017.7.0 The ``expr_form`` argument has been renamed to ``tgt_type``, earlier releases must use ``expr_form``. Execute a single command via the salt-ssh subsystem and return all routines at once A wrapper around the :py:meth:`SSHClient.cmd...
Mint a new token using the config option hash_type and store tdata with 'token' attribute set to the token. This module uses the hash of random 512 bytes as a token. :param opts: Salt master config options :param tdata: Token data to be stored with 'token' attirbute of this dict set to the token. :...
Fetch the token data from the store. :param opts: Salt master config options :param tok: Token value to get :returns: Token data if successful. Empty dict if failed. def get_token(opts, tok): ''' Fetch the token data from the store. :param opts: Salt master config options :param tok: Toke...
Remove token from the store. :param opts: Salt master config options :param tok: Token to remove :returns: Empty dict if successful. None if failed. def rm_token(opts, tok): ''' Remove token from the store. :param opts: Salt master config options :param tok: Token to remove :returns: ...
List all tokens in the store. :param opts: Salt master config options :returns: List of dicts (tokens) def list_tokens(opts): ''' List all tokens in the store. :param opts: Salt master config options :returns: List of dicts (tokens) ''' ret = [] for (dirpath, dirnames, filenames) ...
Equivalent to os.path.islink() def islink(path): ''' Equivalent to os.path.islink() ''' if six.PY3 or not salt.utils.platform.is_windows(): return os.path.islink(path) if not HAS_WIN32FILE: log.error('Cannot check if %s is a link, missing required modules', path) if not _is_re...
Equivalent to os.readlink() def readlink(path): ''' Equivalent to os.readlink() ''' if six.PY3 or not salt.utils.platform.is_windows(): return os.readlink(path) if not HAS_WIN32FILE: log.error('Cannot read %s, missing required modules', path) reparse_data = _get_reparse_data(p...
Returns True if path is a reparse point; False otherwise. def _is_reparse_point(path): ''' Returns True if path is a reparse point; False otherwise. ''' result = win32file.GetFileAttributesW(path) if result == -1: return False return True if result & 0x400 else False
Retrieves the reparse point data structure for the given path. If the path is not a reparse point, None is returned. See http://msdn.microsoft.com/en-us/library/ff552012.aspx for details on the REPARSE_DATA_BUFFER structure returned. def _get_reparse_data(path): ''' Retrieves the reparse point da...
Python clone of /usr/bin/which def which(exe=None): ''' Python clone of /usr/bin/which ''' if not exe: log.error('No executable was passed to be searched by salt.utils.path.which()') return None ## define some utilities (we use closures here because our predecessor used them) ...
Scan over some possible executables and return the first one that is found def which_bin(exes): ''' Scan over some possible executables and return the first one that is found ''' if not isinstance(exes, Iterable): return None for exe in exes: path = which(exe) if not path: ...
This functions tries to solve some issues when joining multiple absolute paths on both *nix and windows platforms. See tests/unit/utils/path_join_test.py for some examples on what's being talked about here. The "use_posixpath" kwarg can be be used to force joining using poxixpath, which is useful ...
Remove illegal path characters for windows def sanitize_win_path(winpath): ''' Remove illegal path characters for windows ''' intab = '<>:|?*' if isinstance(winpath, six.text_type): winpath = winpath.translate(dict((ord(c), '_') for c in intab)) elif isinstance(winpath, six.string_types...
r''' .. versionadded:: 2017.7.3 Checks that the path is safe for modification by Salt. For example, you wouldn't want to have salt delete the contents of ``C:\Windows``. The following directories are considered unsafe: - C:\, D:\, E:\, etc. - \ - C:\Windows Args: path (str): ...
This is a helper than ensures that all paths returned from os.walk are unicode. def os_walk(top, *args, **kwargs): ''' This is a helper than ensures that all paths returned from os.walk are unicode. ''' if six.PY2 and salt.utils.platform.is_windows(): top_query = top else: t...
Used to parse emerge output to provide meaningful output when emerge fails def _process_emerge_err(stdout, stderr): ''' Used to parse emerge output to provide meaningful output when emerge fails ''' ret = {} rexp = re.compile(r'^[<>=][^ ]+/[^ ]+ [^\n]+', re.M) slot_conflicts = re.compile(r'^[^...
.. versionadded:: 0.17.0 Returns a dict containing the following information for each specified package: 1. A key ``found``, which will be a boolean value denoting if a match was found in the package database. 2. If ``found`` is ``False``, then a second key called ``suggestions`` will be...
Utility function to get upgradable packages Sample return data: { 'pkgname': '1.2.3-45', ... } def _get_upgradable(backtrack=3): ''' Utility function to get upgradable packages Sample return data: { 'pkgname': '1.2.3-45', ... } ''' cmd = ['emerge', '--ask', 'n', ...
List all available package upgrades. refresh Whether or not to sync the portage tree before checking for upgrades. backtrack Specifies an integer number of times to backtrack if dependency calculation fails due to a conflict or an unsatisfied dependency (default: ´3´). ...
Returns a list containing the matches for a given package name from the portage tree. Note that the specific version of the package will not be provided for packages that have several versions in the portage tree, but rather the name of the package (i.e. "dev-python/paramiko"). def porttree_matches(name): ...
List the packages currently installed in a dict:: {'<package_name>': '<version>'} CLI Example: .. code-block:: bash salt '*' pkg.list_pkgs def list_pkgs(versions_as_list=False, **kwargs): ''' List the packages currently installed in a dict:: {'<package_name>': '<version>'} ...
Update the portage tree using the first available method from the following list: - emaint sync - eix-sync - emerge-webrsync - emerge --sync To prevent the portage tree from being synced within one day of the previous sync, add the following pillar data for this minion: .. code-block:...
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands which modify installed packages from the ``salt-minion`` daemon's control group. This is done to keep systemd from killing any emerge commands spawned by Sa...
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands which modify installed packages from the ``salt-minion`` daemon's control group. This is done to keep systemd from killing any emerge commands spawned by Sa...
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands which modify installed packages from the ``salt-minion`` daemon's control group. This is done to keep systemd from killing any emerge commands spawned by Sa...
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands which modify installed packages from the ``salt-minion`` daemon's control group. This is done to keep systemd from killing any emerge commands spawned by Sa...
Portage has a function to remove unused dependencies. If a package is provided, it will only removed the package if no other package depends on it. name The name of the package to be cleaned. slot Restrict the remove to a specific slot. Ignored if ``name`` is None. fromrepo ...
Do a cmp-style comparison on two packages. Return -1 if pkg1 < pkg2, 0 if pkg1 == pkg2, and 1 if pkg1 > pkg2. Return None if there was a problem making the comparison. CLI Example: .. code-block:: bash salt '*' pkg.version_cmp '0.2.4-0' '0.2.4.1-0' def version_cmp(pkg1, pkg2, **kwargs): ...
Check if the installed package already has the given requirements. CLI Example: .. code-block:: bash salt '*' pkg.check_extra_requirements 'sys-devel/gcc' '~>4.1.2:4.1::gentoo[nls,fortran]' def check_extra_requirements(pkgname, pkgver): ''' Check if the installed package already has the give...