text stringlengths 81 112k |
|---|
Return the epoch of the mtime for this cache file
def updated(bank, key, cachedir):
'''
Return the epoch of the mtime for this cache file
'''
key_file = os.path.join(cachedir, os.path.normpath(bank), '{0}.p'.format(key))
if not os.path.isfile(key_file):
log.warning('Cache file "%s" does not... |
Remove the key from the cache bank with all the key content.
def flush(bank, key=None, cachedir=None):
'''
Remove the key from the cache bank with all the key content.
'''
if cachedir is None:
cachedir = __cachedir()
try:
if key is None:
target = os.path.join(cachedir, ... |
Return an iterable object containing all entries stored in the specified bank.
def list_(bank, cachedir):
'''
Return an iterable object containing all entries stored in the specified bank.
'''
base = os.path.join(cachedir, os.path.normpath(bank))
if not os.path.isdir(base):
return []
tr... |
Checks if the specified bank contains the specified key.
def contains(bank, key, cachedir):
'''
Checks if the specified bank contains the specified key.
'''
if key is None:
base = os.path.join(cachedir, os.path.normpath(bank))
return os.path.isdir(base)
else:
keyfile = os.pa... |
Check that the key is found in the registry. This refers to keys and not
value/data pairs. To check value/data pairs, use ``value_exists``
Args:
hive (str): The hive to connect to
key (str): The key to check
use_32bit_registry (bool): Look in the 32bit portion of the registry
Re... |
Check that the value/data pair is found in the registry.
.. version-added:: 2018.3.4
Args:
hive (str): The hive to connect to
key (str): The key to check in
vname (str): The name of the value/data pair you're checking
use_32bit_registry (bool): Look in the 32bit portion of ... |
Refresh the windows environment.
.. note::
This will only effect new processes and windows. Services will not see
the change until the system restarts.
Returns:
bool: True if successful, otherwise False
Usage:
.. code-block:: python
import salt.utils.win_reg
... |
Enumerates the subkeys in a registry key or hive.
Args:
hive (str):
The name of the hive. Can be one of the following:
- HKEY_LOCAL_MACHINE or HKLM
- HKEY_CURRENT_USER or HKCU
- HKEY_USERS or HKU
- HKEY_CLASSES_ROOT or HKCR
... |
Enumerates the values in a registry key or hive.
Args:
hive (str):
The name of the hive. Can be one of the following:
- HKEY_LOCAL_MACHINE or HKLM
- HKEY_CURRENT_USER or HKCU
- HKEY_USER or HKU
- HKEY_CLASSES_ROOT or HKCR
... |
r'''
Reads a registry value entry or the default value for a key. To read the
default value, don't pass ``vname``
Args:
hive (str): The name of the hive. Can be one of the following:
- HKEY_LOCAL_MACHINE or HKLM
- HKEY_CURRENT_USER or HKCU
- HKEY_USER or HKU
... |
Sets a value in the registry. If ``vname`` is passed, it will be the value
for that value name, otherwise it will be the default value for the
specified key
Args:
hive (str):
The name of the hive. Can be one of the following
- HKEY_LOCAL_MACHINE or HKLM
... |
Cast the ``vdata` value to the appropriate data type for the registry type
specified in ``vtype``
Args:
vdata (str, int, list, bytes): The data to cast
vtype (str):
The type of data to be written to the registry. Must be one of the
following:
- REG_BIN... |
.. versionadded:: 2015.5.4
Delete a registry key to include all subkeys and value/data pairs.
Args:
hive (str):
The name of the hive. Can be one of the following
- HKEY_LOCAL_MACHINE or HKLM
- HKEY_CURRENT_USER or HKCU
- HKEY_USER or HKU
... |
Delete a registry value entry or the default value for a key.
Args:
hive (str):
The name of the hive. Can be one of the following
- HKEY_LOCAL_MACHINE or HKLM
- HKEY_CURRENT_USER or HKCU
- HKEY_USER or HKU
- HKEY_CLASSES_ROOT or ... |
List all queued and running jobs or only those with
an optional 'tag'.
CLI Example:
.. code-block:: bash
salt '*' at.atq
salt '*' at.atq [tag]
salt '*' at.atq [job number]
def atq(tag=None):
'''
List all queued and running jobs or only those with
an optional 'tag'.
... |
Remove jobs from the queue.
CLI Example:
.. code-block:: bash
salt '*' at.atrm <jobid> <jobid> .. <jobid>
salt '*' at.atrm all
salt '*' at.atrm all [tag]
def atrm(*args):
'''
Remove jobs from the queue.
CLI Example:
.. code-block:: bash
salt '*' at.atrm <jo... |
Add a job to the queue.
The 'timespec' follows the format documented in the
at(1) manpage.
CLI Example:
.. code-block:: bash
salt '*' at.at <timespec> <cmd> [tag=<tag>] [runas=<user>]
salt '*' at.at 12:05am '/sbin/reboot' tag=reboot
salt '*' at.at '3:05am +3 days' 'bin/myscri... |
Print the at(1) script that will run for the passed job
id. This is mostly for debugging so the output will
just be text.
CLI Example:
.. code-block:: bash
salt '*' at.atc <jobid>
def atc(jobid):
'''
Print the at(1) script that will run for the passed job
id. This is mostly for d... |
Return the properly formatted ssh value for the authorized encryption key
type. ecdsa defaults to 256 bits, must give full ecdsa enc schema string
if using higher enc. If the type is not found, raise CommandExecutionError.
def _refine_enc(enc):
'''
Return the properly formatted ssh value for the author... |
Properly format user input.
def _format_auth_line(key, enc, comment, options):
'''
Properly format user input.
'''
line = ''
if options:
line += '{0} '.format(','.join(options))
line += '{0} {1} {2}\n'.format(enc, key, comment)
return line |
Expand the AuthorizedKeysFile expression. Defined in man sshd_config(5)
def _expand_authorized_keys_path(path, user, home):
'''
Expand the AuthorizedKeysFile expression. Defined in man sshd_config(5)
'''
converted_path = ''
had_escape = False
for char in path:
if had_escape:
... |
Get absolute path to a user's ssh_config.
def _get_config_file(user, config):
'''
Get absolute path to a user's ssh_config.
'''
uinfo = __salt__['user.info'](user)
if not uinfo:
raise CommandExecutionError('User \'{0}\' does not exist'.format(user))
home = uinfo['home']
config = _ex... |
Replace an existing key
def _replace_auth_key(
user,
key,
enc='ssh-rsa',
comment='',
options=None,
config='.ssh/authorized_keys'):
'''
Replace an existing key
'''
auth_line = _format_auth_line(key, enc, comment, options or [])
lines = []
full = ... |
Return a dict containing validated keys in the passed file
def _validate_keys(key_file, fingerprint_hash_type):
'''
Return a dict containing validated keys in the passed file
'''
ret = {}
linere = re.compile(r'^(.*?)\s?((?:ssh\-|ecds)[\w-]+\s.+)$')
try:
with salt.utils.files.fopen(key_... |
Return a public key fingerprint based on its base64-encoded representation
The fingerprint string is formatted according to RFC 4716 (ch.4), that is,
in the form "xx:xx:...:xx"
If the key is invalid (incorrect base64 string), return None
public_key
The public key to return the fingerprint for... |
Return the minion's host keys
CLI Example:
.. code-block:: bash
salt '*' ssh.host_keys
salt '*' ssh.host_keys keydir=/etc/ssh
salt '*' ssh.host_keys keydir=/etc/ssh private=False
salt '*' ssh.host_keys keydir=/etc/ssh certs=False
def host_keys(keydir=None, private=True, certs... |
Return the authorized keys for users
CLI Example:
.. code-block:: bash
salt '*' ssh.auth_keys
salt '*' ssh.auth_keys root
salt '*' ssh.auth_keys user=root
salt '*' ssh.auth_keys user="[user1, user2]"
def auth_keys(user=None,
config='.ssh/authorized_keys',
... |
Check a keyfile from a source destination against the local keys and
return the keys to change
CLI Example:
.. code-block:: bash
salt '*' ssh.check_key_file root salt://ssh/keyfile
def check_key_file(user,
source,
config='.ssh/authorized_keys',
... |
Check to see if a key needs updating, returns "update", "add" or "exists"
CLI Example:
.. code-block:: bash
salt '*' ssh.check_key <user> <key> <enc> <comment> <options>
def check_key(user,
key,
enc,
comment,
options,
config='.ssh... |
Remove an authorized key from the specified user's authorized key file,
using a file as source
CLI Example:
.. code-block:: bash
salt '*' ssh.rm_auth_key_from_file <user> salt://ssh_keys/<user>.id_rsa.pub
def rm_auth_key_from_file(user,
source,
... |
Remove an authorized key from the specified user's authorized key file
CLI Example:
.. code-block:: bash
salt '*' ssh.rm_auth_key <user> <key>
def rm_auth_key(user,
key,
config='.ssh/authorized_keys',
fingerprint_hash_type=None):
'''
Remove an ... |
Add a key to the authorized_keys file, using a file as the source.
CLI Example:
.. code-block:: bash
salt '*' ssh.set_auth_key_from_file <user> salt://ssh_keys/<user>.id_rsa.pub
def set_auth_key_from_file(user,
source,
config='.ssh/authorized_key... |
Add a key to the authorized_keys file. The "key" parameter must only be the
string of text that is the encoded key. If the key begins with "ssh-rsa"
or ends with user@host, remove those from the key before passing it to this
function.
CLI Example:
.. code-block:: bash
salt '*' ssh.set_aut... |
Helper function which parses ssh-keygen -F function output and yield line
number of known_hosts entries with encryption key type matching enc,
one by one.
def _get_matched_host_line_numbers(lines, enc):
'''
Helper function which parses ssh-keygen -F function output and yield line
number of known_ho... |
Helper function which parses ssh-keygen -F and ssh-keyscan function output
and yield dict with keys information, one by one.
def _parse_openssh_output(lines, fingerprint_hash_type=None):
'''
Helper function which parses ssh-keygen -F and ssh-keyscan function output
and yield dict with keys information,... |
.. versionadded:: 2018.3.0
Return information about known host entries from the configfile, if any.
If there are no entries for a matching hostname, return None.
CLI Example:
.. code-block:: bash
salt '*' ssh.get_known_host_entries <user> <hostname>
def get_known_host_entries(user,
... |
.. versionadded:: 2018.3.0
Retrieve information about host public keys from remote server
hostname
The name of the remote host (e.g. "github.com")
enc
Defines what type of key is being used, can be ed25519, ecdsa ssh-rsa
or ssh-dss
port
Optional parameter, denoting th... |
Check the record in known_hosts file, either by its value or by fingerprint
(it's enough to set up either key or fingerprint, you don't need to set up
both).
If provided key or fingerprint doesn't match with stored value, return
"update", if no value is found for a given host, return "add", otherwise
... |
Remove all keys belonging to hostname from a known_hosts file.
CLI Example:
.. code-block:: bash
salt '*' ssh.rm_known_host <user> <hostname>
def rm_known_host(user=None, hostname=None, config=None, port=None):
'''
Remove all keys belonging to hostname from a known_hosts file.
CLI Examp... |
Download SSH public key from remote host "hostname", optionally validate
its fingerprint against "fingerprint" variable and save the record in the
known_hosts file.
If such a record does already exists in there, do nothing.
user
The user who owns the ssh authorized keys file to modify
hos... |
Look up the value for an option.
def _option(value):
'''
Look up the value for an option.
'''
if value in __opts__:
return __opts__[value]
master_opts = __pillar__.get('master', {})
if value in master_opts:
return master_opts[value]
if value in __pillar__:
return __p... |
Return a boto connection for the service.
.. code-block:: python
conn = __utils__['boto.get_connection']('ec2', profile='custom_profile')
def get_connection(service, module=None, region=None, key=None, keyid=None,
profile=None):
'''
Return a boto connection for the service.
... |
Retrieve the region for a particular AWS service based on configured region and/or profile.
def get_region(service, region, profile):
"""
Retrieve the region for a particular AWS service based on configured region and/or profile.
"""
_, region, _, _ = _get_profile(service, region, None, None, profile)
... |
Assign _get_conn and _cache_id functions to the named module.
.. code-block:: python
_utils__['boto.assign_partials'](__name__, 'ec2')
def assign_funcs(modname, service, module=None,
get_conn_funcname='_get_conn', cache_id_funcname='_cache_id',
exactly_one_funcname='_exact... |
Retrieve full set of values from a boto3 API call that may truncate
its results, yielding each page as it is obtained.
def paged_call(function, *args, **kwargs):
"""Retrieve full set of values from a boto3 API call that may truncate
its results, yielding each page as it is obtained.
"""
marker_flag... |
Normalize the directory to make comparison possible
def _normalize_dir(string_):
'''
Normalize the directory to make comparison possible
'''
return os.path.normpath(salt.utils.stringutils.to_unicode(string_)) |
Returns a list of items in the SYSTEM path
CLI Example:
.. code-block:: bash
salt '*' win_path.get_path
def get_path():
'''
Returns a list of items in the SYSTEM path
CLI Example:
.. code-block:: bash
salt '*' win_path.get_path
'''
ret = salt.utils.stringutils.to_u... |
Check if the directory is configured in the SYSTEM path
Case-insensitive and ignores trailing backslash
Returns:
boolean True if path exists, False if not
CLI Example:
.. code-block:: bash
salt '*' win_path.exists 'c:\\python27'
salt '*' win_path.exists 'c:\\python27\\'
... |
Add the directory to the SYSTEM path in the index location. Returns
``True`` if successful, otherwise ``False``.
path
Directory to add to path
index
Optionally specify an index at which to insert the directory
rehash : True
If the registry was updated, and this value is set to... |
r'''
Remove the directory from the SYSTEM path
Returns:
boolean True if successful, False if unsuccessful
rehash : True
If the registry was updated, and this value is set to ``True``, sends a
WM_SETTINGCHANGE broadcast to refresh the environment variables. Set
this to ``Fal... |
Display the output as table.
Args:
* nested_indent: integer, specify the left alignment.
* has_header: boolean specifying if header should be displayed. Default: True.
* row_delimiter: character to separate rows. Default: ``_``.
* delim: character to separate columns. Default: ``" ... |
Build the unicode string to be displayed.
def ustring(self,
indent,
color,
msg,
prefix='',
suffix='',
endc=None):
'''Build the unicode string to be displayed.'''
if endc is None:
endc = self.ENDC... |
When the text inside the column is longer then the width, will split by space and continue on the next line.
def wrap_onspace(self, text):
'''
When the text inside the column is longer then the width, will split by space and continue on the next line.'''
def _truncate(line, word):
... |
Prepare rows content to be displayed.
def prepare_rows(self,
rows,
indent,
has_header):
'''Prepare rows content to be displayed.'''
out = []
def row_wrapper(row):
new_rows = [
self.wrapfunc(item).split... |
Prepares row content and displays.
def display_rows(self,
rows,
labels,
indent):
'''Prepares row content and displays.'''
out = []
if not rows:
return out
first_row_type = type(rows[0])
# all rows mus... |
Display table(s).
def display(self,
ret,
indent,
out,
rows_key=None,
labels_key=None):
'''Display table(s).'''
rows = []
labels = None
if isinstance(ret, dict):
if not rows_key or (rows_key an... |
internal shared function for *_absent
name : string
name of dataset
dataset_type : string [filesystem, volume, snapshot, or bookmark]
type of dataset to remove
force : boolean
try harder to destroy the dataset
recursive : boolean
also destroy all the child datasets
r... |
ensure filesystem is absent on the system
name : string
name of filesystem
force : boolean
try harder to destroy the dataset (zfs destroy -f)
recursive : boolean
also destroy all the child datasets (zfs destroy -r)
.. warning::
If a volume with ``name`` exists, this st... |
ensure snapshot is absent on the system
name : string
name of snapshot
force : boolean
try harder to destroy the dataset (zfs destroy -f)
recursive : boolean
also destroy all the child datasets (zfs destroy -r)
recursive_all : boolean
recursively destroy all dependents, ... |
ensure hold is absent on the system
name : string
name of hold
snapshot : string
name of snapshot
recursive : boolean
recursively releases a hold with the given tag on the snapshots of all descendent file systems.
def hold_absent(name, snapshot, recursive=False):
'''
ensure... |
internal handler for filesystem_present/volume_present
dataset_type : string
volume or filesystem
name : string
name of volume
volume_size : string
size of volume
sparse : boolean
create sparse volume
create_parent : boolean
creates all the non-existing paren... |
ensure filesystem exists and has properties set
name : string
name of filesystem
create_parent : boolean
creates all the non-existing parent datasets.
any property specified on the command line using the -o option is ignored.
cloned_from : string
name of snapshot to clone
... |
ensure volume exists and has properties set
name : string
name of volume
volume_size : string
size of volume
sparse : boolean
create sparse volume
create_parent : boolean
creates all the non-existing parent datasets.
any property specified on the command line usi... |
ensure bookmark exists
name : string
name of bookmark
snapshot : string
name of snapshot
def bookmark_present(name, snapshot):
'''
ensure bookmark exists
name : string
name of bookmark
snapshot : string
name of snapshot
'''
ret = {'name': name,
... |
ensure snapshot exists and has properties set
name : string
name of snapshot
recursive : boolean
recursively create snapshots of all descendent datasets
properties : dict
additional zfs properties (-o)
.. note:
Properties are only set at creation time
def snapshot_pres... |
ensure a dataset is not a clone
name : string
name of fileset or volume
.. warning::
only one dataset can be the origin,
if you promote a clone the original will now point to the promoted dataset
def promoted(name):
'''
ensure a dataset is not a clone
name : string
... |
Update snapshots dict with current snapshots
dataset: string
name of filesystem or volume
prefix : string
prefix for the snapshots
e.g. 'test' will result in snapshots being named 'test-yyyymmdd_hhmm'
snapshots : OrderedDict
preseeded OrderedDict with configuration
def _sch... |
Update snapshots dict with info for a new snapshot
dataset: string
name of filesystem or volume
prefix : string
prefix for the snapshots
e.g. 'test' will result in snapshots being named 'test-yyyymmdd_hhmm'
snapshots : OrderedDict
preseeded OrderedDict with configuration
de... |
maintain a set of snapshots based on a schedule
name : string
name of filesystem or volume
prefix : string
prefix for the snapshots
e.g. 'test' will result in snapshots being named 'test-yyyymmdd_hhmm'
recursive : boolean
create snapshots for all children also
schedule :... |
return a state error dictionary, with 'sid' as a field if it could be returned
if user is None, sid will also be None
def _getUserSid(user):
'''
return a state error dictionary, with 'sid' as a field if it could be returned
if user is None, sid will also be None
'''
ret = {}
sid_pattern = ... |
Gets the DACL of a path
def _get_dacl(path, objectType):
'''
Gets the DACL of a path
'''
try:
dacl = win32security.GetNamedSecurityInfo(
path, objectType, win32security.DACL_SECURITY_INFORMATION
).GetSecurityDescriptorDacl()
except Exception:
dacl = None
... |
Get the ACL of an object. Will filter by user if one is provided.
Args:
path: The path to the object
objectType: The type of object (FILE, DIRECTORY, REGISTRY)
user: A user name to filter by
Returns (dict): A dictionary containing the ACL
CLI Example:
.. code-block:: bash
... |
r'''
add an ace to an object
path: path to the object (i.e. c:\\temp\\file, HKEY_LOCAL_MACHINE\\SOFTWARE\\KEY, etc)
user: user to add
permission: permissions for the user
acetype: either allow/deny for each user/permission (ALLOW, DENY)
propagation: how the ACE applies to children for Regist... |
r'''
remove an ace to an object
path: path to the object (i.e. c:\\temp\\file, HKEY_LOCAL_MACHINE\\SOFTWARE\\KEY, etc)
user: user to remove
permission: permissions for the user
acetypes: either allow/deny for each user/permission (ALLOW, DENY)
propagation: how the ACE applies to children for... |
helper function to convert an ace to a textual representation
def _ace_to_text(ace, objectType):
'''
helper function to convert an ace to a textual representation
'''
dc = daclConstants()
objectType = dc.getObjectTypeBit(objectType)
try:
userSid = win32security.LookupAccountSid('', ace[... |
helper function to set the inheritance
Args:
path (str): The path to the object
objectType (str): The type of object
inheritance (bool): True enables inheritance, False disables
copy (bool): Copy inherited ACEs to the DACL before disabling
inheritance
clear (bool... |
enable/disable inheritance on an object
Args:
path: The path to the object
objectType: The type of object (FILE, DIRECTORY, REGISTRY)
clear: True will remove non-Inherited ACEs from the ACL
Returns (dict): A dictionary containing the results
CLI Example:
.. code-block:: bash
... |
Disable inheritance on an object
Args:
path: The path to the object
objectType: The type of object (FILE, DIRECTORY, REGISTRY)
copy: True will copy the Inherited ACEs to the DACL before disabling inheritance
Returns (dict): A dictionary containing the results
CLI Example:
.. ... |
Check a specified path to verify if inheritance is enabled
Args:
path: path of the registry key or file system object to check
objectType: The type of object (FILE, DIRECTORY, REGISTRY)
user: if provided, will consider only the ACEs for that user
Returns (bool): 'Inheritance' of True/F... |
Checks a path to verify the ACE (access control entry) specified exists
Args:
path: path to the file/reg key
objectType: The type of object (FILE, DIRECTORY, REGISTRY)
user: user that the ACL is for
permission: permission to test for (READ, FULLCONTROL, etc)
acetype: the... |
returns the bit value of the string object type
def getObjectTypeBit(self, t):
'''
returns the bit value of the string object type
'''
if isinstance(t, string_types):
t = t.upper()
try:
return self.objectType[t]
except KeyError:
... |
returns the necessary string value for an HKEY for the win32security module
def getSecurityHkey(self, s):
'''
returns the necessary string value for an HKEY for the win32security module
'''
try:
return self.hkeys_security[s]
except KeyError:
raise Command... |
returns a permission bit of the string permission value for the specified object type
def getPermissionBit(self, t, m):
'''
returns a permission bit of the string permission value for the specified object type
'''
try:
if isinstance(m, string_types):
return s... |
returns the permission textual representation of a specified permission bit/object type
def getPermissionText(self, t, m):
'''
returns the permission textual representation of a specified permission bit/object type
'''
try:
return self.rights[t][m]['TEXT']
except Key... |
returns the acetype bit of a text value
def getAceTypeBit(self, t):
'''
returns the acetype bit of a text value
'''
try:
return self.validAceTypes[t]['BITS']
except KeyError:
raise CommandExecutionError((
'No ACE type "{0}". It should be ... |
returns the textual representation of a acetype bit
def getAceTypeText(self, t):
'''
returns the textual representation of a acetype bit
'''
try:
return self.validAceTypes[t]['TEXT']
except KeyError:
raise CommandExecutionError((
'No ACE t... |
returns the propagation bit of a text value
def getPropagationBit(self, t, p):
'''
returns the propagation bit of a text value
'''
try:
return self.validPropagations[t][p]['BITS']
except KeyError:
raise CommandExecutionError((
'No propagat... |
processes a path/object type combo and returns:
registry types with the correct HKEY text representation
files/directories with environment variables expanded
def processPath(self, path, objectType):
'''
processes a path/object type combo and returns:
registry types ... |
Ensure a subnet exists and is up-to-date
name
Name of the subnet
network_name_or_id
The unique name or ID of the attached network.
If a non-unique name is supplied, an exception is raised.
allocation_pools
A list of dictionaries of the start and end addresses
for t... |
Ensure a subnet does not exists
name
Name of the subnet
def absent(name, auth=None):
'''
Ensure a subnet does not exists
name
Name of the subnet
'''
ret = {'name': name,
'changes': {},
'result': True,
'comment': ''}
__salt__['neutronng.se... |
Determine what the most resource free host is based on the given data
def _determine_host(data, omit=''):
'''
Determine what the most resource free host is based on the given data
'''
# This is just checking for the host with the most free ram, this needs
# to be much more complicated.
host = '... |
Scan the query data for the named VM
def _find_vm(name, data, quiet=False):
'''
Scan the query data for the named VM
'''
for hv_ in data:
# Check if data is a dict, and not '"virt.full_info" is not available.'
if not isinstance(data[hv_], dict):
continue
if name in d... |
Query the virtual machines. When called without options all hosts
are detected and a full query is returned. A single host can be
passed in to specify an individual host to query.
def query(host=None, quiet=False):
'''
Query the virtual machines. When called without options all hosts
are detected a... |
List the virtual machines on each host, this is a simplified query,
showing only the virtual machine names belonging to each host.
A single host can be passed in to specify an individual host
to list.
def list(host=None, quiet=False, hyper=None): # pylint: disable=redefined-builtin
'''
List the vi... |
Return information about the host connected to this master
def host_info(host=None):
'''
Return information about the host connected to this master
'''
data = query(host, quiet=True)
for id_ in data:
if 'vm_info' in data[id_]:
data[id_].pop('vm_info')
__jid_event__.fire_even... |
This routine is used to create a new virtual machine. This routines takes
a number of options to determine what the newly created virtual machine
will look like.
name
The mandatory name of the new virtual machine. The name option is
also the minion id, all minions must have an id.
cpu
... |
Return the information on the named VM
def vm_info(name, quiet=False):
'''
Return the information on the named VM
'''
data = query(quiet=True)
return _find_vm(name, data, quiet) |
Force power down and restart an existing VM
def reset(name):
'''
Force power down and restart an existing VM
'''
ret = {}
client = salt.client.get_local_client(__opts__['conf_file'])
data = vm_info(name, quiet=True)
if not data:
__jid_event__.fire_event({'message': 'Failed to find V... |
Destroy the named VM
def purge(name, delete_key=True):
'''
Destroy the named VM
'''
ret = {}
client = salt.client.get_local_client(__opts__['conf_file'])
data = vm_info(name, quiet=True)
if not data:
__jid_event__.fire_event({'error': 'Failed to find VM {0} to purge'.format(name)}, ... |
Migrate a VM from one host to another. This routine will just start
the migration and display information on how to look up the progress.
def migrate(name, target=''):
'''
Migrate a VM from one host to another. This routine will just start
the migration and display information on how to look up the pro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.