Added required dependency to install script. Fixed licensing issue in the file. Merged changes from master to vmware_connector. vm_info now has more status. Add acuireConsole method return link to VMRC console. get_vapp_details_rest() parse entier vapp and vm consturct and return as dictionary
Signed-off-by: bayramov <mbayramov@vmware.com>
diff --git a/vmwarerecli.py b/vmwarerecli.py
index c332cdb..c85b1d5 100755
--- a/vmwarerecli.py
+++ b/vmwarerecli.py
@@ -62,6 +62,7 @@
from xml.etree import ElementTree as ET
+import sys
from pyvcloud import Http
import logging
@@ -420,7 +421,6 @@
# view vapp action
if action == 'vapp' or namespace.action == 'vapp':
- print namespace.vapp_name
if namespace.vapp_name is not None and namespace.uuid:
logger.debug("Requesting vapp {} for vdc {}".format(namespace.vapp_name, namespace.vcdvdc))
vapp_dict = {}
@@ -432,8 +432,12 @@
print("Can't find vapp by given name {}".format(namespace.vapp_name))
return
- vapp_dict = vim.get_vapp(vdc_name=namespace.vcdvdc, vapp_name=vapp_uuid, isuuid=True)
- if vapp_dict is not None:
+ print " namespace {}".format(namespace)
+ if vapp_dict is not None and namespace.osm:
+ vm_info_dict = vim.get_vminstance(vim_vm_uuid=vapp_uuid)
+ print vm_info_dict
+ if vapp_dict is not None and namespace.osm != True:
+ vapp_dict = vim.get_vapp(vdc_name=namespace.vcdvdc, vapp_name=vapp_uuid, isuuid=True)
print_vapp(vapp_dict=vapp_dict)
# view network
@@ -512,13 +516,13 @@
The return true if image uploaded correctly
"""
try:
- catalog_uuid = vim.get_image_id_from_path(path=image_file)
+ catalog_uuid = vim.get_image_id_from_path(path=image_file, progress=True)
if catalog_uuid is not None and validate_uuid4(catalog_uuid):
print("Image uploaded and uuid {}".format(catalog_uuid))
return True
- except:
+ except vimconn.vimconnException as upload_exception:
print("Failed uploaded {} image".format(image_file))
-
+ print("Error Reason: {}".format(upload_exception.message))
return False
@@ -558,6 +562,8 @@
except:
print("Failed uploaded {} image".format(image_name))
+ return False
+
def image_action(vim=None, action=None, namespace=None):
""" Function present set of action to manipulate with image.
@@ -638,6 +644,7 @@
log_level="DEBUG",
config={'admin_username': namespace.vcdamdin, 'admin_password': namespace.vcdadminpassword})
vim.vca = vim.connect()
+
except vimconn.vimconnConnectionException:
print("Failed connect to vcloud director. Please check credential and hostname.")
return
@@ -746,6 +753,7 @@
view_vapp_parser.add_argument('vapp_name', action='store',
help='- view vapp for specific vapp name in vcloud director')
view_vapp_parser.add_argument('-u', '--uuid', default=False, action='store_true', help='view vapp based on uuid')
+ view_vapp_parser.add_argument('-o', '--osm', default=False, action='store_true', help='provide view in OSM format')
# view network
view_network = view_sub_subparsers.add_parser('network')