INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
name The name of the package to be deleted. | def remove(name=None, pkgs=None, **kwargs):
'''
name
The name of the package to be deleted.
Multiple Package Options:
pkgs
A list of packages to delete. Must be passed as a python list. The
``name`` parameter will be ignored if this option is passed.
.. versionadded:: 0.1... |
List the files that belong to a package. | def file_list(package, **kwargs):
'''
List the files that belong to a package.
CLI Examples:
.. code-block:: bash
salt '*' pkg.file_list nginx
'''
ret = file_dict(package)
files = []
for pkg_files in six.itervalues(ret['files']):
files.extend(pkg_files)
ret['files'... |
.. versionchanged: 2016. 3. 0 | def file_dict(*packages, **kwargs):
'''
.. versionchanged: 2016.3.0
List the files that belong to a package.
CLI Examples:
.. code-block:: bash
salt '*' pkg.file_dict nginx
salt '*' pkg.file_dict nginx varnish
'''
errors = []
files = {}
for package in packages:
... |
Verify that a device is mounted | def mounted(name,
device,
fstype,
mkmnt=False,
opts='defaults',
dump=0,
pass_num=0,
config='/etc/fstab',
persist=True,
mount=True,
user=None,
match_on='auto',
device_name_regex... |
Activates a swap device | def swap(name, persist=True, config='/etc/fstab'):
'''
Activates a swap device
.. code-block:: yaml
/root/swapfile:
mount.swap
.. note::
``swap`` does not currently support LABEL
'''
ret = {'name': name,
'changes': {},
'result': True,
... |
.. versionadded:: 0. 17. 0 | def unmounted(name,
device=None,
config='/etc/fstab',
persist=False,
user=None,
**kwargs):
'''
.. versionadded:: 0.17.0
Verify that a device is not mounted
name
The path to the location where the device is to be unmounted fr... |
The mounted watcher called to invoke the watch command. | def mod_watch(name, user=None, **kwargs):
'''
The mounted watcher, called to invoke the watch command.
.. note::
This state exists to support special handling of the ``watch``
:ref:`requisite <requisites>`. It should not be called directly.
Parameters for this function should be se... |
Convert a device name UUID or LABEL to a device name UUID or LABEL. | def _convert_to(maybe_device, convert_to):
'''
Convert a device name, UUID or LABEL to a device name, UUID or
LABEL.
Return the fs_spec required for fstab.
'''
# Fast path. If we already have the information required, we can
# save one blkid call
if not convert_to or \
(convert... |
Makes sure that a fstab mount point is pressent. | def fstab_present(name, fs_file, fs_vfstype, fs_mntops='defaults',
fs_freq=0, fs_passno=0, mount_by=None,
config='/etc/fstab', mount=True, match_on='auto'):
'''
Makes sure that a fstab mount point is pressent.
name
The name of block device. Can be any valid fs_sp... |
Makes sure that a fstab mount point is absent. | def fstab_absent(name, fs_file, mount_by=None, config='/etc/fstab'):
'''
Makes sure that a fstab mount point is absent.
name
The name of block device. Can be any valid fs_spec value.
fs_file
Mount point (target) for the filesystem.
mount_by
Select the final value for fs_sp... |
Determine the value of the SNMP sysContact sysLocation and sysServices settings. | def get_agent_settings():
'''
Determine the value of the SNMP sysContact, sysLocation, and sysServices
settings.
Returns:
dict: A dictionary of the agent settings.
CLI Example:
.. code-block:: bash
salt '*' win_snmp.get_agent_settings
'''
ret = dict()
sorted_types... |
Manage the SNMP sysContact sysLocation and sysServices settings. | def set_agent_settings(contact=None, location=None, services=None):
'''
Manage the SNMP sysContact, sysLocation, and sysServices settings.
Args:
contact (str, optional): The SNMP contact.
location (str, optional): The SNMP location.
services (list, optional): A list of selected se... |
Manage the sending of authentication traps. | def set_auth_traps_enabled(status=True):
'''
Manage the sending of authentication traps.
Args:
status (bool): True to enable traps. False to disable.
Returns:
bool: True if successful, otherwise False
CLI Example:
.. code-block:: bash
salt '*' win_snmp.set_auth_traps... |
Get the current accepted SNMP community names and their permissions. | def get_community_names():
'''
Get the current accepted SNMP community names and their permissions.
If community names are being managed by Group Policy, those values will be
returned instead like this:
.. code-block:: bash
TestCommunity:
Managed by GPO
Community names ma... |
Manage the SNMP accepted community names and their permissions. | def set_community_names(communities):
'''
Manage the SNMP accepted community names and their permissions.
.. note::
Settings managed by Group Policy will always take precedence over those
set using the SNMP interface. Therefore if this function finds Group
Policy settings it will ra... |
Shallow copy and merge dicts together giving precedence to last in. | def _merge_dicts(*args):
'''
Shallow copy and merge dicts together, giving precedence to last in.
'''
ret = dict()
for arg in args:
ret.update(arg)
return ret |
Convert setting values that has been improperly converted to a dict back to a string. | def _normalize_server_settings(**settings):
'''
Convert setting values that has been improperly converted to a dict back to a string.
'''
ret = dict()
settings = salt.utils.args.clean_kwargs(**settings)
for setting in settings:
if isinstance(settings[setting], dict):
value_f... |
Ensure the value is set for the specified setting. | def server_setting(name, settings=None, server=_DEFAULT_SERVER):
'''
Ensure the value is set for the specified setting.
.. note::
The setting names are case-sensitive.
:param str settings: A dictionary of the setting names and their values.
:param str server: The SMTP server name.
Ex... |
Manage the active log format for the SMTP server. | def active_log_format(name, log_format, server=_DEFAULT_SERVER):
'''
Manage the active log format for the SMTP server.
:param str log_format: The log format name.
:param str server: The SMTP server name.
Example of usage:
.. code-block:: yaml
smtp-log-format:
win_smtp_ser... |
Manage IP list for SMTP connections. | def connection_ip_list(name, addresses=None, grant_by_default=False, server=_DEFAULT_SERVER):
'''
Manage IP list for SMTP connections.
:param str addresses: A dictionary of IP + subnet pairs.
:param bool grant_by_default: Whether the addresses should be a blacklist or whitelist.
:param str server: ... |
Manage IP list for SMTP relay connections. | def relay_ip_list(name, addresses=None, server=_DEFAULT_SERVER):
'''
Manage IP list for SMTP relay connections.
Due to the unusual way that Windows stores the relay IPs, it is advisable to retrieve
the existing list you wish to set from a pre-configured server.
For example, setting '127.0.0.1' as ... |
run commands from __proxy__: mod: salt. proxy. onyx<salt. proxy. onyx > | def cmd(command, *args, **kwargs):
'''
run commands from __proxy__
:mod:`salt.proxy.onyx<salt.proxy.onyx>`
command
function from `salt.proxy.onyx` to run
args
positional args to pass to `command` function
kwargs
key word arguments to pass to `command` function
.. ... |
Wrapper to assist with paginated responses from Digicert s REST API. | def _paginate(url, topkey, *args, **kwargs):
'''
Wrapper to assist with paginated responses from Digicert's REST API.
'''
ret = salt.utils.http.query(url, **kwargs)
if 'errors' in ret['dict']:
return ret['dict']
lim = int(ret['dict']['page']['limit'])
total = int(ret['dict']['page'... |
List domains that CertCentral knows about. You can filter by container_id ( also known as Division ) by passing a container_id. | def list_domains(container_id=None):
'''
List domains that CertCentral knows about. You can filter by
container_id (also known as "Division") by passing a container_id.
CLI Example:
.. code-block:: bash
salt-run digicert.list_domains
'''
if container_id:
url = '{0}/domain?... |
List certificate requests made to CertCentral. You can filter by status: pending approved rejected | def list_requests(status=None):
'''
List certificate requests made to CertCentral. You can filter by
status: ``pending``, ``approved``, ``rejected``
CLI Example:
.. code-block:: bash
salt-run digicert.list_requests pending
'''
if status:
url = '{0}/request?status={1}'.form... |
Retrieve a certificate by order_id or certificate_id and write it to stdout or a filename. | def get_certificate(order_id=None, certificate_id=None, minion_id=None, cert_format='pem_all', filename=None):
'''
Retrieve a certificate by order_id or certificate_id and write it to stdout or a filename.
A list of permissible cert_formats is here:
https://www.digicert.com/services/v2/documentatio... |
List organizations that CertCentral knows about. You can filter by container_id ( also known as Division ) by passing a container_id. This function returns validation information by default ; pass include_validation = False to turn it off. | def list_organizations(container_id=None, include_validation=True):
'''
List organizations that CertCentral knows about. You can filter by
container_id (also known as "Division") by passing a container_id.
This function returns validation information by default; pass
``include_validation=False`` to ... |
Order a certificate. Requires that an Organization has been created inside Digicert s CertCentral. | def order_certificate(minion_id, common_name, organization_id, validity_years,
cert_key_passphrase=None, signature_hash=None, key_len=2048,
dns_names=None, organization_units=None, server_platform=None,
custom_expiration_date=None, comments=None, disable... |
Generate and return a private_key. If a dns_name is passed in the private_key will be cached under that name. | def gen_key(minion_id, dns_name=None, password=None, key_len=2048):
'''
Generate and return a private_key. If a ``dns_name`` is passed in, the
private_key will be cached under that name.
CLI Example:
.. code-block:: bash
salt-run digicert.gen_key <minion_id> [dns_name] [password]
'''
... |
Return the details for an organization | def get_org_details(organization_id):
'''
Return the details for an organization
CLI Example:
.. code-block:: bash
salt-run digicert.get_org_details 34
Returns a dictionary with the org details, or with 'error' and 'status' keys.
'''
qdata = salt.utils.http.query(
'{0}/o... |
Maintain a relationship between a minion and a dns name | def _id_map(minion_id, dns_name):
'''
Maintain a relationship between a minion and a dns name
'''
bank = 'digicert/minions'
cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR)
dns_names = cache.fetch(bank, minion_id)
if not isinstance(dns_names, list):
dns_names = []
if dns_na... |
Show certificate requests for this API key | def show_csrs():
'''
Show certificate requests for this API key
CLI Example:
.. code-block:: bash
salt-run digicert.show_csrs
'''
data = salt.utils.http.query(
'{0}/certificaterequests'.format(_base_url()),
status=True,
decode=True,
decode_type='json',
... |
Show a private RSA key | def show_rsa(minion_id, dns_name):
'''
Show a private RSA key
CLI Example:
.. code-block:: bash
salt-run digicert.show_rsa myminion domain.example.com
'''
cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR)
bank = 'digicert/domains'
data = cache.fetch(
bank, dns_nam... |
Return a list of accepted denied unaccepted and rejected keys. This is the same output as salt - key - L | def list_():
'''
Return a list of accepted, denied, unaccepted and rejected keys.
This is the same output as `salt-key -L`
CLI Example:
.. code-block:: bash
salt 'master' minion.list
'''
pki_dir = __salt__['config.get']('pki_dir', '')
# We have to replace the minion/master di... |
Return the minion keys directory paths. | def _check_minions_directories(pki_dir):
'''
Return the minion keys directory paths.
This function is a copy of salt.key.Key._check_minions_directories.
'''
minions_accepted = os.path.join(pki_dir, salt.key.Key.ACC)
minions_pre = os.path.join(pki_dir, salt.key.Key.PEND)
minions_rejected = o... |
Kill the salt minion. | def kill(timeout=15):
'''
Kill the salt minion.
timeout
int seconds to wait for the minion to die.
If you have a monitor that restarts ``salt-minion`` when it dies then this is
a great way to restart after a minion upgrade.
CLI example::
>$ salt minion[12] minion.kill
... |
Kill and restart the salt minion. | def restart():
'''
Kill and restart the salt minion.
The configuration key ``minion_restart_command`` is an argv list for the
command to restart the minion. If ``minion_restart_command`` is not
specified or empty then the ``argv`` of the current process will be used.
if the configuration valu... |
Runs: py: func: state. apply <salt. modules. state. apply > with given options to set up test data. Intended to be used for optional test setup or teardown | def state_apply(state_name, **kwargs):
'''
Runs :py:func:`state.apply <salt.modules.state.apply>` with given options to set up test data.
Intended to be used for optional test setup or teardown
Reference the :py:func:`state.apply <salt.modules.state.apply>` module documentation for arguments and usage ... |
generate test results output list | def _generate_out_list(results):
'''
generate test results output list
'''
passed = 0
failed = 0
skipped = 0
missing_tests = 0
total_time = 0.0
for state in results:
if not results[state].items():
missing_tests = missing_tests + 1
else:
for dum... |
Determine if a function is valid for a module | def _is_valid_function(module_name, function):
'''
Determine if a function is valid for a module
'''
try:
functions = __salt__['sys.list_functions'](module_name)
except salt.exceptions.SaltException:
functions = ["unable to look up functions"]
return "{0}.{1}".format(module_name,... |
Equivalent to a salt cli: salt web state. show_top | def _get_top_states(saltenv='base'):
'''
Equivalent to a salt cli: salt web state.show_top
'''
alt_states = []
try:
returned = __salt__['state.show_top']()
for i in returned[saltenv]:
alt_states.append(i)
except Exception:
raise
# log.info("top states: %s"... |
Generic call of salt Caller command | def _call_salt_command(self,
fun,
args,
kwargs,
assertion_section=None):
'''
Generic call of salt Caller command
'''
value = False
try:
if args and kwargs:
... |
Determine the type of variable returned Cast the expected to the type of variable returned | def _cast_expected_to_returned_type(expected, returned):
'''
Determine the type of variable returned
Cast the expected to the type of variable returned
'''
ret_type = type(returned)
new_expected = expected
if expected == "False" and ret_type == bool:
e... |
Test if two objects are equal | def __assert_equal(expected, returned, assert_print_result=True):
'''
Test if two objects are equal
'''
result = "Pass"
try:
if assert_print_result:
assert (expected == returned), "{0} is not equal to {1}".format(expected, returned)
else:
... |
Test if an boolean is True | def __assert_true(returned):
'''
Test if an boolean is True
'''
result = "Pass"
try:
assert (returned is True), "{0} not True".format(returned)
except AssertionError as err:
result = "Fail: " + six.text_type(err)
return result |
Test if an boolean is False | def __assert_false(returned):
'''
Test if an boolean is False
'''
result = "Pass"
if isinstance(returned, str):
try:
returned = bool(returned)
except ValueError:
raise
try:
assert (returned is False), "{0... |
Test if a value is less than the returned value | def __assert_less(expected, returned):
'''
Test if a value is less than the returned value
'''
result = "Pass"
try:
assert (expected < returned), "{0} not False".format(returned)
except AssertionError as err:
result = "Fail: " + six.text_type(err)
... |
Test if a returned value is empty | def __assert_empty(returned):
'''
Test if a returned value is empty
'''
result = "Pass"
try:
assert (not returned), "{0} is not empty".format(returned)
except AssertionError as err:
result = "Fail: " + six.text_type(err)
return result |
Test if a returned value is not empty | def __assert_not_empty(returned):
'''
Test if a returned value is not empty
'''
result = "Pass"
try:
assert (returned), "value is empty"
except AssertionError as err:
result = "Fail: " + six.text_type(err)
return result |
For the state file system return a list of paths to search for states | def get_state_search_path_list(saltenv='base'):
'''
For the state file system, return a list of paths to search for states
'''
# state cache should be updated before running this method
search_list = []
cachedir = __opts__.get('cachedir', None)
log.info("Searching... |
Mount VirtualBox Guest Additions CD to the temp directory. | def additions_mount():
'''
Mount VirtualBox Guest Additions CD to the temp directory.
To connect VirtualBox Guest Additions via VirtualBox graphical interface
press 'Host+D' ('Host' is usually 'Right Ctrl').
CLI Example:
.. code-block:: bash
salt '*' vbox_guest.additions_mount
:... |
Unmount VirtualBox Guest Additions CD from the temp directory. | def additions_umount(mount_point):
'''
Unmount VirtualBox Guest Additions CD from the temp directory.
CLI Example:
.. code-block:: bash
salt '*' vbox_guest.additions_umount
:param mount_point: directory VirtualBox Guest Additions is mounted to
:return: True or an string with error
... |
Install VirtualBox Guest Additions. Uses the CD connected by VirtualBox. | def additions_install(**kwargs):
'''
Install VirtualBox Guest Additions. Uses the CD, connected by VirtualBox.
To connect VirtualBox Guest Additions via VirtualBox graphical interface
press 'Host+D' ('Host' is usually 'Right Ctrl').
See https://www.virtualbox.org/manual/ch04.html#idp52733088 for m... |
Remove VirtualBox Guest Additions. | def _additions_remove_use_cd(**kwargs):
'''
Remove VirtualBox Guest Additions.
It uses the CD, connected by VirtualBox.
'''
with _additions_mounted() as mount_point:
kernel = __grains__.get('kernel', '')
if kernel == 'Linux':
return _additions_remove_linux_use_cd(mount_... |
Remove VirtualBox Guest Additions. | def additions_remove(**kwargs):
'''
Remove VirtualBox Guest Additions.
Firstly it tries to uninstall itself by executing
'/opt/VBoxGuestAdditions-VERSION/uninstall.run uninstall'.
It uses the CD, connected by VirtualBox if it failes.
CLI Example:
.. code-block:: bash
salt '*' vbo... |
Check VirtualBox Guest Additions version. | def additions_version():
'''
Check VirtualBox Guest Additions version.
CLI Example:
.. code-block:: bash
salt '*' vbox_guest.additions_version
:return: version of VirtualBox Guest Additions or False if they are not installed
'''
try:
d = _additions_dir()
except Enviro... |
Grant access to auto - mounted shared folders to the users. | def grant_access_to_shared_folders_to(name, users=None):
'''
Grant access to auto-mounted shared folders to the users.
User is specified by it's name. To grant access for several users use argument `users`.
Access will be denied to the users not listed in `users` argument.
See https://www.virtualb... |
Get a size of a disk. | def _get_disk_size(self, device):
'''
Get a size of a disk.
'''
out = __salt__['cmd.run_all']("df {0}".format(device))
if out['retcode']:
msg = "Disk size info error: {0}".format(out['stderr'])
log.error(msg)
raise SIException(msg)
dev... |
Get available file systems and their types. | def _get_fs(self):
'''
Get available file systems and their types.
'''
data = dict()
for dev, dev_data in salt.utils.fsutils._blkid().items():
dev = self._get_disk_size(dev)
device = dev.pop('device')
dev['type'] = dev_data['type']
... |
Get available CPU information. | def _get_cpu(self):
'''
Get available CPU information.
'''
# CPU data in grains is OK-ish, but lscpu is still better in this case
out = __salt__['cmd.run_all']("lscpu")
salt.utils.fsutils._verify_run(out)
data = dict()
for descr, value in [elm.split(":", 1... |
Get memory. | def _get_mem(self):
'''
Get memory.
'''
out = __salt__['cmd.run_all']("vmstat -s")
if out['retcode']:
raise SIException("Memory info error: {0}".format(out['stderr']))
ret = dict()
for line in out['stdout'].split(os.linesep):
line = line.s... |
Get network configuration. | def _get_network(self):
'''
Get network configuration.
'''
data = dict()
data['interfaces'] = salt.utils.network.interfaces()
data['subnets'] = salt.utils.network.subnets()
return data |
Get operating system summary | def _get_os(self):
'''
Get operating system summary
'''
return {
'name': self._grain('os'),
'family': self._grain('os_family'),
'arch': self._grain('osarch'),
'release': self._grain('osrelease'),
} |
Return configuration files. | def _configuration(self, *args, **kwargs):
'''
Return configuration files.
'''
data = dict()
self.db.open()
for pkg in self.db.get(Package):
configs = list()
for pkg_cfg in self.db.get(PackageCfgFile, eq={'pkgid': pkg.id}):
configs... |
Return all known local accounts to the system. | def _get_local_users(self, disabled=None):
'''
Return all known local accounts to the system.
'''
users = dict()
path = '/etc/passwd'
with salt.utils.files.fopen(path, 'r') as fp_:
for line in fp_:
line = line.strip()
if ':' not... |
Return all known local groups to the system. | def _get_local_groups(self):
'''
Return all known local groups to the system.
'''
groups = dict()
path = '/etc/group'
with salt.utils.files.fopen(path, 'r') as fp_:
for line in fp_:
line = line.strip()
if ':' not in line:
... |
Return all known accounts excluding local accounts. | def _get_external_accounts(self, locals):
'''
Return all known accounts, excluding local accounts.
'''
users = dict()
out = __salt__['cmd.run_all']("passwd -S -a")
if out['retcode']:
# System does not supports all accounts descriptions, just skipping.
... |
Local users and groups. | def _identity(self, *args, **kwargs):
'''
Local users and groups.
accounts
Can be either 'local', 'remote' or 'all' (equal to "local,remote").
Remote accounts cannot be resolved on all systems, but only
those, which supports 'passwd -S -a'.
disabled
... |
This basically calls grains items and picks out only necessary information in a certain structure. | def _system(self, *args, **kwargs):
'''
This basically calls grains items and picks out only
necessary information in a certain structure.
:param args:
:param kwargs:
:return:
'''
sysinfo = SysInfo(__grains__.get("kernel"))
data = dict()
... |
Return installed software. | def _software(self, *args, **kwargs):
'''
Return installed software.
'''
data = dict()
if 'exclude' in kwargs:
excludes = kwargs['exclude'].split(",")
else:
excludes = list()
os_family = __grains__.get("os_family").lower()
# Get l... |
Resolve local users and groups. | def _id_resolv(self, iid, named=True, uid=True):
'''
Resolve local users and groups.
:param iid:
:param named:
:param uid:
:return:
'''
if not self.local_identity:
self.local_identity['users'] = self._get_local_users()
self.local_... |
Find all unmanaged files. Returns maximum 1000 values. | def _payload(self, *args, **kwargs):
'''
Find all unmanaged files. Returns maximum 1000 values.
Parameters:
* **filter**: Include only results which path starts from the filter string.
* **time**: Display time in Unix ticks or format according to the configured TZ (default)
... |
Return all the summary of the particular system. | def _all(self, *args, **kwargs):
'''
Return all the summary of the particular system.
'''
data = dict()
data['software'] = self._software(**kwargs)
data['system'] = self._system(**kwargs)
data['services'] = self._services(**kwargs)
try:
data['c... |
Create vm from file | def _create_update_from_file(mode='create', uuid=None, path=None):
'''
Create vm from file
'''
ret = {}
if not os.path.isfile(path) or path is None:
ret['Error'] = 'File ({0}) does not exists!'.format(path)
return ret
# vmadm validate create|update [-f <filename>]
cmd = 'vmad... |
Create vm from configuration | def _create_update_from_cfg(mode='create', uuid=None, vmcfg=None):
'''
Create vm from configuration
'''
ret = {}
# write json file
vmadm_json_file = __salt__['temp.file'](prefix='vmadm-')
with salt.utils.files.fopen(vmadm_json_file, 'w') as vmadm_json:
salt.utils.json.dump(vmcfg, vm... |
Start a vm | def start(vm, options=None, key='uuid'):
'''
Start a vm
vm : string
vm to be started
options : string
optional additional options
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.start 186da9a... |
Stop a vm | def stop(vm, force=False, key='uuid'):
'''
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-4... |
Return a list of VMs | def list_vms(search=None, sort=None, order='uuid,type,ram,state,alias', keyed=True):
'''
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... |
Return a list of VMs using lookup | def lookup(search=None, order=None, one=False):
'''
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:
... |
Send non - maskable interrupt to vm or capture a screenshot | def sysrq(vm, action='nmi', key='uuid'):
'''
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:
.. co... |
Delete a vm | def delete(vm, key='uuid'):
'''
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... |
Output the JSON object describing a VM | def get(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 '*'... |
Lookup info on running kvm | def info(vm, info_type='all', key='uuid'):
'''
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
C... |
Create snapshot of a vm | def create_snapshot(vm, name, key='uuid'):
'''
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 [-_.:%]... |
Reprovision a vm | def reprovision(vm, image, key='uuid'):
'''
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 18... |
Create a new vm | def create(from_file=None, **kwargs):
'''
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... |
Update a new vm | def update(vm, from_file=None, key='uuid', **kwargs):
'''
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
kwar... |
Send a vm to a directory | def send(vm, target, key='uuid'):
'''
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-4f... |
Receive a vm from a directory | def receive(uuid, source):
'''
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
'''
ret = {}
if... |
Install a capability | def add_capability(capability,
source=None,
limit_access=False,
image=None,
restart=False):
'''
Install a capability
Args:
capability (str): The capability to install
source (Optional[str]): The optional source of t... |
Uninstall a capability | def remove_capability(capability, image=None, restart=False):
'''
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
... |
List all capabilities on the system | def get_capabilities(image=None):
'''
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:
NotImplemen... |
List the capabilities installed on the system | def installed_capabilities(image=None):
'''
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:
... |
Install a feature using DISM | def add_feature(feature,
package=None,
source=None,
limit_access=False,
enable_parent=False,
image=None,
restart=False):
'''
Install a feature using DISM
Args:
feature (str): The feature to install
... |
Disables the feature. | def remove_feature(feature, remove_payload=False, image=None, restart=False):
'''
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 (Opt... |
List features on the system or in a package | def get_features(package=None, image=None):
'''
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 instal... |
Install a package using DISM | def add_package(package,
ignore_check=False,
prevent_pending=False,
image=None,
restart=False):
'''
Install a package using DISM
Args:
package (str):
The package to install. Can be a .cab file, a .msu file, or a folder
... |
Uninstall a package | def remove_package(package, image=None, restart=False):
'''
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 ... |
Display information about a package | def package_info(package, image=None):
'''
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 thi... |
Allow for the calling of execution modules via sudo. | def execute(opts, data, func, args, kwargs):
'''
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.