mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Adding avail_images() so that --list-images can be used
This commit is contained in:
parent
305ce35a09
commit
26317635c4
@ -602,7 +602,7 @@ def list_networks(kwargs=None, call=None):
|
||||
|
||||
def list_nodes_min(kwargs=None, call=None):
|
||||
'''
|
||||
Return a list of the VMs that are on the provider, with no details
|
||||
Return a list of all VMs and templates that are on the provider, with no details
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -627,7 +627,7 @@ def list_nodes_min(kwargs=None, call=None):
|
||||
|
||||
def list_nodes(kwargs=None, call=None):
|
||||
'''
|
||||
Return a list of the VMs that are on the provider, with basic fields
|
||||
Return a list of all VMs and templates that are on the provider, with basic fields
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -660,6 +660,40 @@ def list_nodes(kwargs=None, call=None):
|
||||
return ret
|
||||
|
||||
|
||||
def avail_images():
|
||||
'''
|
||||
Return a list of all the templates present in this VMware environment with basic
|
||||
details
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt-cloud --list-images my-vmware-config
|
||||
'''
|
||||
|
||||
templates = {}
|
||||
vm_properties = [
|
||||
"name",
|
||||
"config.template",
|
||||
"config.guestFullName",
|
||||
"config.hardware.numCPU",
|
||||
"config.hardware.memoryMB"
|
||||
]
|
||||
|
||||
vm_list = _get_mors_with_properties(vim.VirtualMachine, vm_properties)
|
||||
|
||||
for vm in vm_list:
|
||||
if vm["config.template"]:
|
||||
templates[vm["name"]] = {
|
||||
'name': vm["name"],
|
||||
'guest_fullname': vm["config.guestFullName"],
|
||||
'cpus': vm["config.hardware.numCPU"],
|
||||
'ram': vm["config.hardware.memoryMB"]
|
||||
}
|
||||
return templates
|
||||
|
||||
|
||||
def list_folders(kwargs=None, call=None):
|
||||
'''
|
||||
List all the folders for this VMware environment
|
||||
|
Loading…
Reference in New Issue
Block a user