Code stringlengths 103 85.9k | Summary listlengths 0 94 |
|---|---|
Please provide a description of the function:def set_static_all(interface, address, netmask, gateway, nameservers=None):
'''
Configure specified adapter to use ipv4 manual settings
Change adapter mode to TCP/IP. If previous adapter mode was EtherCAT, the target will need reboot.
:param str interface: ... | [] |
Please provide a description of the function:def get_interface(iface):
'''
Returns details about given interface.
CLI Example:
.. code-block:: bash
salt '*' ip.get_interface eth0
'''
_interfaces = get_interfaces_details()
for _interface in _interfaces['interfaces']:
if _in... | [] |
Please provide a description of the function:def build_interface(iface, iface_type, enabled, **settings):
'''
Build an interface script for a network interface.
CLI Example:
.. code-block:: bash
salt '*' ip.build_interface eth0 eth <settings>
'''
if __grains__['lsb_distrib_id'] == 'ni... | [] |
Please provide a description of the function:def build_network_settings(**settings):
'''
Build the global network script.
CLI Example:
.. code-block:: bash
salt '*' ip.build_network_settings <settings>
'''
if __grains__['lsb_distrib_id'] == 'nilrt':
raise salt.exceptions.Comma... | [] |
Please provide a description of the function:def get_network_settings():
'''
Return the contents of the global network script.
CLI Example:
.. code-block:: bash
salt '*' ip.get_network_settings
'''
if __grains__['lsb_distrib_id'] == 'nilrt':
raise salt.exceptions.CommandExecut... | [] |
Please provide a description of the function:def apply_network_settings(**settings):
'''
Apply global network configuration.
CLI Example:
.. code-block:: bash
salt '*' ip.apply_network_settings
'''
if __grains__['lsb_distrib_id'] == 'nilrt':
raise salt.exceptions.CommandExecut... | [] |
Please provide a description of the function:def get_event(
node, sock_dir=None, transport='zeromq',
opts=None, listen=True, io_loop=None, keep_loop=False, raise_errors=False):
'''
Return an event object suitable for the named transport
:param IOLoop io_loop: Pass in an io_loop if you want ... | [] |
Please provide a description of the function:def get_master_event(opts, sock_dir, listen=True, io_loop=None, raise_errors=False, keep_loop=False):
'''
Return an event object suitable for the named transport
'''
# TODO: AIO core is separate from transport
if opts['transport'] in ('zeromq', 'tcp', 'de... | [] |
Please provide a description of the function:def fire_args(opts, jid, tag_data, prefix=''):
'''
Fire an event containing the arguments passed to an orchestration job
'''
try:
tag_suffix = [jid, 'args']
except NameError:
pass
else:
tag = tagify(tag_suffix, prefix)
... | [] |
Please provide a description of the function:def tagify(suffix='', prefix='', base=SALT):
'''
convenience function to build a namespaced event tag string
from joining with the TABPART character the base, prefix and suffix
If string prefix is a valid key in TAGS Then use the value of key prefix
Else... | [] |
Please provide a description of the function:def update_stats(stats, start_time, data):
'''
Calculate the master stats and return the updated stat info
'''
end_time = time.time()
cmd = data['cmd']
# the jid is used as the create time
try:
jid = data['jid']
except KeyError:
... | [] |
Please provide a description of the function:def __load_uri(self, sock_dir, node):
'''
Return the string URI for the location of the pull and pub sockets to
use for firing and listening to events
'''
if node == 'master':
if self.opts['ipc_mode'] == 'tcp':
... | [] |
Please provide a description of the function:def subscribe(self, tag=None, match_type=None):
'''
Subscribe to events matching the passed tag.
If you do not subscribe to a tag, events will be discarded by calls to
get_event that request a different tag. In contexts where many different
... | [] |
Please provide a description of the function:def unsubscribe(self, tag, match_type=None):
'''
Un-subscribe to events matching the passed tag.
'''
if tag is None:
return
match_func = self._get_match_func(match_type)
self.pending_tags.remove([tag, match_func])
... | [] |
Please provide a description of the function:def connect_pub(self, timeout=None):
'''
Establish the publish connection
'''
if self.cpub:
return True
if self._run_io_loop_sync:
with salt.utils.asynchronous.current_ioloop(self.io_loop):
if s... | [] |
Please provide a description of the function:def close_pub(self):
'''
Close the publish connection (if established)
'''
if not self.cpub:
return
self.subscriber.close()
self.subscriber = None
self.pending_events = []
self.cpub = False | [] |
Please provide a description of the function:def connect_pull(self, timeout=1):
'''
Establish a connection with the event pull socket
Default timeout is 1 s
'''
if self.cpush:
return True
if self._run_io_loop_sync:
with salt.utils.asynchronous.cur... | [] |
Please provide a description of the function:def _check_pending(self, tag, match_func=None):
if match_func is None:
match_func = self._get_match_func()
old_events = self.pending_events
self.pending_events = []
ret = None
for evt in old_events:
if ... | [
"Check the pending_events list for events that match the tag\n\n :param tag: The tag to search for\n :type tag: str\n :param tags_regex: List of re expressions to search for also\n :type tags_regex: list[re.compile()]\n :return:\n "
] |
Please provide a description of the function:def _match_tag_regex(self, event_tag, search_tag):
'''
Check if the event_tag matches the search check.
Uses regular expression search to check.
Return True (matches) or False (no match)
'''
return self.cache_regex.get(search_t... | [] |
Please provide a description of the function:def get_event(self,
wait=5,
tag='',
full=False,
match_type=None,
no_block=False,
auto_reconnect=False):
'''
Get a single publication.
If no pub... | [] |
Please provide a description of the function:def get_event_noblock(self):
'''
Get the raw event without blocking or any other niceties
'''
assert self._run_io_loop_sync
if not self.cpub:
if not self.connect_pub():
return None
raw = self.subscr... | [] |
Please provide a description of the function:def iter_events(self, tag='', full=False, match_type=None, auto_reconnect=False):
'''
Creates a generator that continuously listens for events
'''
while True:
data = self.get_event(tag=tag, full=full, match_type=match_type,
... | [] |
Please provide a description of the function:def fire_event(self, data, tag, timeout=1000):
'''
Send a single event into the publisher with payload dict "data" and
event identifier "tag"
The default is 1000 ms
'''
if not six.text_type(tag): # no empty tags allowed
... | [] |
Please provide a description of the function:def fire_master(self, data, tag, timeout=1000):
''''
Send a single event to the master, with the payload "data" and the
event identifier "tag".
Default timeout is 1000ms
'''
msg = {
'tag': tag,
'data': ... | [] |
Please provide a description of the function:def _fire_ret_load_specific_fun(self, load, fun_index=0):
'''
Helper function for fire_ret_load
'''
if isinstance(load['fun'], list):
# Multi-function job
fun = load['fun'][fun_index]
# 'retcode' was already... | [] |
Please provide a description of the function:def fire_ret_load(self, load):
'''
Fire events based on information in the return load
'''
if load.get('retcode') and load.get('fun'):
if isinstance(load['fun'], list):
# Multi-function job
if isinst... | [] |
Please provide a description of the function:def set_event_handler(self, event_handler):
'''
Invoke the event_handler callback each time an event arrives.
'''
assert not self._run_io_loop_sync
if not self.cpub:
self.connect_pub()
self.subscriber.callbacks.ad... | [] |
Please provide a description of the function:def run(self):
'''
Bind the pub and pull sockets for events
'''
salt.utils.process.appendproctitle(self.__class__.__name__)
self.io_loop = tornado.ioloop.IOLoop()
with salt.utils.asynchronous.current_ioloop(self.io_loop):
... | [] |
Please provide a description of the function:def handle_publish(self, package, _):
'''
Get something from epull, publish it out epub, and return the package (or None)
'''
try:
self.publisher.publish(package)
return package
# Add an extra fallback in case a... | [] |
Please provide a description of the function:def run(self):
'''
Spin up the multiprocess event returner
'''
salt.utils.process.appendproctitle(self.__class__.__name__)
self.event = get_event('master', opts=self.opts, listen=True)
events = self.event.iter_events(full=True)... | [] |
Please provide a description of the function:def _filter(self, event):
'''
Take an event and run it through configured filters.
Returns True if event should be stored, else False
'''
tag = event['tag']
if self.opts['event_return_whitelist']:
ret = False
... | [] |
Please provide a description of the function:def fire_master(self, data, tag, preload=None):
'''
Fire an event off on the master server
CLI Example:
.. code-block:: bash
salt '*' event.fire_master 'stuff to be in the event' 'tag'
'''
load = {}
if pr... | [] |
Please provide a description of the function:def fire_running(self, running):
'''
Pass in a state "running" dict, this is the return dict from a state
call. The dict will be processed and fire events.
By default yellows and reds fire events on the master and minion, but
this can... | [] |
Please provide a description of the function:def load(self, **descr):
'''
Load data by keys.
:param data:
:return:
'''
for obj, data in descr.items():
setattr(self._data, obj, data)
return self | [] |
Please provide a description of the function:def export(self, name):
'''
Export to the Kiwi config.xml as text.
:return:
'''
self.name = name
root = self._create_doc()
self._set_description(root)
self._set_preferences(root)
self._set_repositories... | [] |
Please provide a description of the function:def _get_package_manager(self):
'''
Get package manager.
:return:
'''
ret = None
if self.__grains__.get('os_family') in ('Kali', 'Debian'):
ret = 'apt-get'
elif self.__grains__.get('os_family', '') == 'Suse... | [] |
Please provide a description of the function:def _set_preferences(self, node):
'''
Set preferences.
:return:
'''
pref = etree.SubElement(node, 'preferences')
pacman = etree.SubElement(pref, 'packagemanager')
pacman.text = self._get_package_manager()
p_ver... | [] |
Please provide a description of the function:def _get_user_groups(self, user):
'''
Get user groups.
:param user:
:return:
'''
return [g.gr_name for g in grp.getgrall()
if user in g.gr_mem] + [grp.getgrgid(pwd.getpwnam(user).pw_gid).gr_name] | [] |
Please provide a description of the function:def _set_users(self, node):
'''
Create existing local users.
<users group="root">
<user password="$1$wYJUgpM5$RXMMeASDc035eX.NbYWFl0" home="/root" name="root"/>
</users>
:param node:
:return:
'''
# G... | [] |
Please provide a description of the function:def _set_repositories(self, node):
'''
Create repositories.
:param node:
:return:
'''
priority = 99
for repo_id, repo_data in self._data.software.get('repositories', {}).items():
if type(repo_data) == list... | [] |
Please provide a description of the function:def _set_packages(self, node):
'''
Set packages and collections.
:param node:
:return:
'''
pkgs = etree.SubElement(node, 'packages')
for pkg_name, pkg_version in sorted(self._data.software.get('packages', {}).items()):... | [] |
Please provide a description of the function:def _set_description(self, node):
'''
Create a system description.
:return:
'''
hostname = socket.getfqdn() or platform.node()
descr = etree.SubElement(node, 'description')
author = etree.SubElement(descr, 'author')
... | [] |
Please provide a description of the function:def _create_doc(self):
'''
Create document.
:return:
'''
root = etree.Element('image')
root.set('schemaversion', '6.3')
root.set('name', self.name)
return root | [] |
Please provide a description of the function:def set_(key, value, profile=None):
'''
Set a key/value pair in the vault service
'''
if '?' in key:
__utils__['versions.warn_until'](
'Neon',
(
'Using ? to seperate between the path and key for vault has been d... | [] |
Please provide a description of the function:def hold(name, seconds):
'''
Wait for a given period of time, then fire a result of True, requiring
this state allows for an action to be blocked for evaluation based on
time
USAGE:
.. code-block:: yaml
hold_on_a_moment:
timer.hol... | [] |
Please provide a description of the function:def _connect(user=None, password=None, host=None, port=None, database='admin', authdb=None):
'''
Returns a tuple of (user, host, port) with config, pillar, or default
values assigned to missing values.
'''
if not user:
user = __salt__['config.opti... | [] |
Please provide a description of the function:def _to_dict(objects):
'''
Potentially interprets a string as JSON for usage with mongo
'''
try:
if isinstance(objects, six.string_types):
objects = salt.utils.json.loads(objects)
except ValueError as err:
log.error("Could not ... | [] |
Please provide a description of the function:def db_list(user=None, password=None, host=None, port=None, authdb=None):
'''
List all MongoDB databases
CLI Example:
.. code-block:: bash
salt '*' mongodb.db_list <user> <password> <host> <port>
'''
conn = _connect(user, password, host, po... | [] |
Please provide a description of the function:def db_exists(name, user=None, password=None, host=None, port=None, authdb=None):
'''
Checks if a database exists in MongoDB
CLI Example:
.. code-block:: bash
salt '*' mongodb.db_exists <name> <user> <password> <host> <port>
'''
dbs = db_li... | [] |
Please provide a description of the function:def db_remove(name, user=None, password=None, host=None, port=None, authdb=None):
'''
Remove a MongoDB database
CLI Example:
.. code-block:: bash
salt '*' mongodb.db_remove <name> <user> <password> <host> <port>
'''
conn = _connect(user, pa... | [] |
Please provide a description of the function:def version(user=None, password=None, host=None, port=None, database='admin', authdb=None):
'''
Get MongoDB instance version
CLI Example:
.. code-block:: bash
salt '*' mongodb.version <user> <password> <host> <port> <database>
'''
conn = _c... | [] |
Please provide a description of the function:def user_list(user=None, password=None, host=None, port=None, database='admin', authdb=None):
'''
List users of a MongoDB database
CLI Example:
.. code-block:: bash
salt '*' mongodb.user_list <user> <password> <host> <port> <database>
'''
c... | [] |
Please provide a description of the function:def user_exists(name, user=None, password=None, host=None, port=None,
database='admin', authdb=None):
'''
Checks if a user exists in MongoDB
CLI Example:
.. code-block:: bash
salt '*' mongodb.user_exists <name> <user> <password> <ho... | [] |
Please provide a description of the function:def user_create(name, passwd, user=None, password=None, host=None, port=None,
database='admin', authdb=None, roles=None):
'''
Create a MongoDB user
CLI Example:
.. code-block:: bash
salt '*' mongodb.user_create <user_name> <user_pas... | [] |
Please provide a description of the function:def user_remove(name, user=None, password=None, host=None, port=None,
database='admin', authdb=None):
'''
Remove a MongoDB user
CLI Example:
.. code-block:: bash
salt '*' mongodb.user_remove <name> <user> <password> <host> <port> <d... | [] |
Please provide a description of the function:def user_roles_exists(name, roles, database, user=None, password=None, host=None,
port=None, authdb=None):
'''
Checks if a user of a MongoDB database has specified roles
CLI Examples:
.. code-block:: bash
salt '*' mongodb.user... | [] |
Please provide a description of the function:def user_grant_roles(name, roles, database, user=None, password=None, host=None,
port=None, authdb=None):
'''
Grant one or many roles to a MongoDB user
CLI Examples:
.. code-block:: bash
salt '*' mongodb.user_grant_roles johndo... | [] |
Please provide a description of the function:def insert(objects, collection, user=None, password=None,
host=None, port=None, database='admin', authdb=None):
'''
Insert an object or list of objects into a collection
CLI Example:
.. code-block:: bash
salt '*' mongodb.insert '[{"foo":... | [] |
Please provide a description of the function:def update_one(objects, collection, user=None, password=None, host=None, port=None, database='admin', authdb=None):
'''
Update an object into a collection
http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.update_one
... | [] |
Please provide a description of the function:def find(collection, query=None, user=None, password=None,
host=None, port=None, database='admin', authdb=None):
'''
Find an object or list of objects in a collection
CLI Example:
.. code-block:: bash
salt '*' mongodb.find mycollection '[{... | [] |
Please provide a description of the function:def present(name=None, data=None, ensure_data=True, **api_opts):
'''
This will ensure that a host with the provided name exists.
This will try to ensure that the state of the host matches the given data
If the host is not found then one will be created.
... | [] |
Please provide a description of the function:def init(opts):
'''
Perform any needed setup.
'''
if CONFIG_BASE_URL in opts['proxy']:
CONFIG[CONFIG_BASE_URL] = opts['proxy'][CONFIG_BASE_URL]
else:
log.error('missing proxy property %s', CONFIG_BASE_URL)
log.debug('CONFIG: %s', CONFI... | [] |
Please provide a description of the function:def ping():
'''
Is the marathon api responding?
'''
try:
response = salt.utils.http.query(
"{0}/ping".format(CONFIG[CONFIG_BASE_URL]),
decode_type='plain',
decode=True,
)
log.debug(
'mara... | [] |
Please provide a description of the function:def _auth(profile=None, api_version=2, **connection_args):
'''
Set up glance credentials, returns
`glanceclient.client.Client`. Optional parameter
"api_version" defaults to 2.
Only intended to be used within glance-enabled modules
'''
__utils__['... | [] |
Please provide a description of the function:def _add_image(collection, image):
'''
Add image to given dictionary
'''
image_prep = {
'id': image.id,
'name': image.name,
'created_at': image.created_at,
'file': image.file,
'min_disk': image.min_d... | [] |
Please provide a description of the function:def image_create(name,
location=None,
profile=None,
visibility=None,
container_format='bare',
disk_format='raw',
protected=None,):
'''
Create an image (glance image-... | [] |
Please provide a description of the function:def image_delete(id=None, name=None, profile=None): # pylint: disable=C0103
'''
Delete an image (glance image-delete)
CLI Examples:
.. code-block:: bash
salt '*' glance.image_delete c2eb2eb0-53e1-4a80-b990-8ec887eae7df
salt '*' glance.imag... | [] |
Please provide a description of the function:def image_show(id=None, name=None, profile=None): # pylint: disable=C0103
'''
Return details about a specific image (glance image-show)
CLI Example:
.. code-block:: bash
salt '*' glance.image_show
'''
g_client = _auth(profile)
ret = {}... | [] |
Please provide a description of the function:def image_list(id=None, profile=None, name=None): # pylint: disable=C0103
'''
Return a list of available images (glance image-list)
CLI Example:
.. code-block:: bash
salt '*' glance.image_list
'''
g_client = _auth(profile)
ret = []
... | [] |
Please provide a description of the function:def image_update(id=None, name=None, profile=None, **kwargs): # pylint: disable=C0103
'''
Update properties of given image.
Known to work for:
- min_ram (in MB)
- protected (bool)
- visibility ('public' or 'private')
CLI Example:
.. code-bl... | [] |
Please provide a description of the function:def schema_get(name, profile=None):
'''
Known valid names of schemas are:
- image
- images
- member
- members
CLI Example:
.. code-block:: bash
salt '*' glance.schema_get name=f16-jeos
'''
g_client = _auth(profile)
... | [] |
Please provide a description of the function:def _item_list(profile=None):
'''
Template for writing list functions
Return a list of available items (glance items-list)
CLI Example:
.. code-block:: bash
salt '*' glance.item_list
'''
g_client = _auth(profile)
ret = []
for it... | [] |
Please provide a description of the function:def until(name,
m_args=None,
m_kwargs=None,
condition=None,
period=0,
timeout=604800):
'''
Loop over an execution module until a condition is met.
name
The name of the execution module
m_args
... | [] |
Please provide a description of the function:def _authenticate():
'''
Retrieve CSRF and API tickets for the Proxmox API
'''
global url, port, ticket, csrf, verify_ssl
url = config.get_cloud_config_value(
'url', get_configured_provider(), __opts__, search_global=False
)
port = config.... | [] |
Please provide a description of the function:def query(conn_type, option, post_data=None):
'''
Execute the HTTP request to the API
'''
if ticket is None or csrf is None or url is None:
log.debug('Not authenticated yet, doing that now..')
_authenticate()
full_url = 'https://{0}:{1}/a... | [] |
Please provide a description of the function:def _get_vm_by_name(name, allDetails=False):
'''
Since Proxmox works based op id's rather than names as identifiers this
requires some filtering to retrieve the required information.
'''
vms = get_resources_vms(includeConfig=allDetails)
if name in vms... | [] |
Please provide a description of the function:def _get_vm_by_id(vmid, allDetails=False):
'''
Retrieve a VM based on the ID.
'''
for vm_name, vm_details in six.iteritems(get_resources_vms(includeConfig=allDetails)):
if six.text_type(vm_details['vmid']) == six.text_type(vmid):
return vm... | [] |
Please provide a description of the function:def _check_ip_available(ip_addr):
'''
Proxmox VMs refuse to start when the IP is already being used.
This function can be used to prevent VMs being created with duplicate
IP's or to generate a warning.
'''
for vm_name, vm_details in six.iteritems(get_... | [] |
Please provide a description of the function:def _parse_proxmox_upid(node, vm_=None):
'''
Upon requesting a task that runs for a longer period of time a UPID is given.
This includes information about the job and can be used to lookup information in the log.
'''
ret = {}
upid = node
# Parse ... | [] |
Please provide a description of the function:def _lookup_proxmox_task(upid):
'''
Retrieve the (latest) logs and retrieve the status for a UPID.
This can be used to verify whether a task has completed.
'''
log.debug('Getting creation status for upid: %s', upid)
tasks = query('get', 'cluster/tasks... | [] |
Please provide a description of the function:def get_resources_nodes(call=None, resFilter=None):
'''
Retrieve all hypervisors (nodes) available on this environment
CLI Example:
.. code-block:: bash
salt-cloud -f get_resources_nodes my-proxmox-config
'''
log.debug('Getting resource: nod... | [] |
Please provide a description of the function:def get_resources_vms(call=None, resFilter=None, includeConfig=True):
'''
Retrieve all VMs available on this environment
CLI Example:
.. code-block:: bash
salt-cloud -f get_resources_vms my-proxmox-config
'''
timeoutTime = time.time() + 60... | [] |
Please provide a description of the function:def script(vm_):
'''
Return the script deployment object
'''
script_name = config.get_cloud_config_value('script', vm_, __opts__)
if not script_name:
script_name = 'bootstrap-salt'
return salt.utils.cloud.os_script(
script_name,
... | [] |
Please provide a description of the function:def avail_locations(call=None):
'''
Return a list of the hypervisors (nodes) which this Proxmox PVE machine manages
CLI Example:
.. code-block:: bash
salt-cloud --list-locations my-proxmox-config
'''
if call == 'action':
raise SaltC... | [] |
Please provide a description of the function:def avail_images(call=None, location='local'):
'''
Return a list of the images that are on the provider
CLI Example:
.. code-block:: bash
salt-cloud --list-images my-proxmox-config
'''
if call == 'action':
raise SaltCloudSystemExit(... | [] |
Please provide a description of the function:def list_nodes(call=None):
'''
Return a list of the VMs that are managed by the provider
CLI Example:
.. code-block:: bash
salt-cloud -Q my-proxmox-config
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nod... | [] |
Please provide a description of the function:def _stringlist_to_dictionary(input_string):
'''
Convert a stringlist (comma separated settings) to a dictionary
The result of the string setting1=value1,setting2=value2 will be a python dictionary:
{'setting1':'value1','setting2':'value2'}
'''
li =... | [] |
Please provide a description of the function:def _dictionary_to_stringlist(input_dict):
'''
Convert a dictionary to a stringlist (comma separated settings)
The result of the dictionary {'setting1':'value1','setting2':'value2'} will be:
setting1=value1,setting2=value2
'''
string_value = ""
... | [] |
Please provide a description of the function:def create(vm_):
'''
Create a single VM from a data dict
CLI Example:
.. code-block:: bash
salt-cloud -p proxmox-ubuntu vmhostname
'''
try:
# Check for required profile parameters before sending any API calls.
if vm_['profil... | [] |
Please provide a description of the function:def _import_api():
'''
Download https://<url>/pve-docs/api-viewer/apidoc.js
Extract content of pveapi var (json formated)
Load this json content into global variable "api"
'''
global api
full_url = 'https://{0}:{1}/pve-docs/api-viewer/apidoc.js'.f... | [] |
Please provide a description of the function:def _get_properties(path="", method="GET", forced_params=None):
'''
Return the parameter list from api for defined path and HTTP method
'''
if api is None:
_import_api()
sub = api
path_levels = [level for level in path.split('/') if level != ... | [] |
Please provide a description of the function:def create_node(vm_, newid):
'''
Build and submit the requestdata to create a new node
'''
newnode = {}
if 'technology' not in vm_:
vm_['technology'] = 'openvz' # default virt tech if none is given
if vm_['technology'] not in ['qemu', 'open... | [] |
Please provide a description of the function:def get_vmconfig(vmid, node=None, node_type='openvz'):
'''
Get VM configuration
'''
if node is None:
# We need to figure out which node this VM is on.
for host_name, host_details in six.iteritems(avail_locations()):
for item in que... | [] |
Please provide a description of the function:def wait_for_state(vmid, state, timeout=300):
'''
Wait until a specific state has been reached on a node
'''
start_time = time.time()
node = get_vm_status(vmid=vmid)
if not node:
log.error('wait_for_state: No VM retrieved based on given criter... | [] |
Please provide a description of the function:def wait_for_task(upid, timeout=300):
'''
Wait until a the task has been finished successfully
'''
start_time = time.time()
info = _lookup_proxmox_task(upid)
if not info:
log.error('wait_for_task: No task information '
'retri... | [] |
Please provide a description of the function:def destroy(name, call=None):
'''
Destroy a node.
CLI Example:
.. code-block:: bash
salt-cloud --destroy mymachine
'''
if call == 'function':
raise SaltCloudSystemExit(
'The destroy action must be called with -d, --destr... | [] |
Please provide a description of the function:def set_vm_status(status, name=None, vmid=None):
'''
Convenience function for setting VM status
'''
log.debug('Set status to %s for %s (%s)', status, name, vmid)
if vmid is not None:
log.debug('set_vm_status: via ID - VMID %s (%s): %s',
... | [] |
Please provide a description of the function:def get_vm_status(vmid=None, name=None):
'''
Get the status for a VM, either via the ID or the hostname
'''
if vmid is not None:
log.debug('get_vm_status: VMID %s', vmid)
vmobj = _get_vm_by_id(vmid)
elif name is not None:
log.debug... | [] |
Please provide a description of the function:def start(name, vmid=None, call=None):
'''
Start a node.
CLI Example:
.. code-block:: bash
salt-cloud -a start mymachine
'''
if call != 'action':
raise SaltCloudSystemExit(
'The start action must be called with -a or --a... | [] |
Please provide a description of the function:def stop(name, vmid=None, call=None):
'''
Stop a node ("pulling the plug").
CLI Example:
.. code-block:: bash
salt-cloud -a stop mymachine
'''
if call != 'action':
raise SaltCloudSystemExit(
'The stop action must be call... | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.