saltext.noderings.utils.compute

Virtual machine helpers shared by the execution module, the state module and the Salt Cloud driver.

exception saltext.noderings.utils.compute.NodeRingsUsageError[source]

The caller asked for something that cannot work (bad name, ambiguous match).

exception saltext.noderings.utils.compute.TimeoutError_[source]

A wait ran out of time (named to avoid shadowing the builtin).

saltext.noderings.utils.compute.choose_offer(client, plan_code, country, city, billing_type='usage', provider_id=None, require_capabilities=None, require_ipv6=False, sort='price')[source]

Return (plan_id, region_id, offer) for the best matching offer.

saltext.noderings.utils.compute.find_vm(client, name_or_id)[source]

Return the VM with this ID or unique hostname, or None.

saltext.noderings.utils.compute.order_vm(client, hostname, plan_id, region_id, distro=None, ssh_key_ids=None, password=None, tags=None, ruleset_id=None, wait=True, timeout=900, sleep=<built-in function sleep>)[source]

Order a VM and return it. Safe against lost responses: an ambiguous failure is retried with the same idempotency key, and free plans (which ignore the key) are tagged with a nonce so the VM is found instead of ordered twice.

saltext.noderings.utils.compute.reinstall(client, vm_id, hostname, distro, ssh_key_ids=None, password=None, wait=True, timeout=900, sleep=<built-in function sleep>)[source]

Reinstall the operating system. This erases the disk; the IP addresses stay.

saltext.noderings.utils.compute.resolve_ruleset(client, ruleset)[source]

A firewall ruleset name or ID -> ID.

saltext.noderings.utils.compute.resolve_ssh_keys(client, keys)[source]

SSH key names or IDs -> IDs.

saltext.noderings.utils.compute.set_power(client, vm_id, want, wait=True, timeout=900, sleep=<built-in function sleep>)[source]

Start (want="running"), stop ("stopped") or restart ("restarted") a VM.

saltext.noderings.utils.compute.vm_view(vm)[source]

The VM as Salt returns it: snake_case keys plus a few friendly fields.

saltext.noderings.utils.compute.wait_settled(client, vm_id, timeout=900, sleep=<built-in function sleep>)[source]

Wait while the VM is in a transitional power state (created, reinstalling).