parameters: (args, dcftree)
return_statement: return vm_list
docstring: Check if VMs are specified by UUID or folder + VM names and
      return list of VMs to work with
docstring_summary: Check if VMs are specified by UUID or folder + VM names and
      return list of VMs to work with
docstring_tokens: Check if VMs are specified by UUID or folder + VM names and return list of VMs to work with
function: def get_vm_list(args, dcftree):
      """
      Check if VMs are specified by UUID or folder + VM names and
      return list of VMs to work with
      """
      vm_list = []
      if args.vmname:
          for vmname in args.vmname:
              folder_u = get_unicode(args.folder)
              vmname_u = get_unicode(vmname)
              vm_path = folder_u + "/" + vmname_u
              if args.folder.endswith("/"):
                  vm_path = folder_u + vmname_u
  
              if args.datacenter not in dcftree:
                  print("ERROR: Could not find datacenter %s" % (args.datacenter))
                  sys.exit(1)
  
              if vm_path not in dcftree[args.datacenter]:
                  print("ERROR: Could not find VM %s in folder %s" % (vmname_u, folder_u))
                  sys.exit(1)
  
              vm_list.append(dcftree[args.datacenter][vm_path])
  
      elif args.vm_uuid:
          vms_by_uuid = get_vms_by_uuid(dcftree)
          for vm_uuid in args.vm_uuid:
              if vm_uuid not in vms_by_uuid:
                  print("ERROR: Could not find VM with instance UUID %s" % (vm_uuid))
                  sys.exit(1)
  
              vm_list.append(vms_by_uuid[vm_uuid])
  
      else:
          print("ERROR: No VMs given, neither by folder + name nor by UUID")
          sys.exit(1)
  
      return vm_list
function_tokens: def get_vm_list ( args , dcftree ) : vm_list = [ ] if args . vmname : for vmname in args . vmname : folder_u = get_unicode ( args . folder ) vmname_u = get_unicode ( vmname ) vm_path = folder_u + "/" + vmname_u if args . folder . endswith ( "/" ) : vm_path = folder_u + vmname_u if args . datacenter not in dcftree : print ( "ERROR: Could not find datacenter %s" % ( args . datacenter ) ) sys . exit ( 1 ) if vm_path not in dcftree [ args . datacenter ] : print ( "ERROR: Could not find VM %s in folder %s" % ( vmname_u , folder_u ) ) sys . exit ( 1 ) vm_list . append ( dcftree [ args . datacenter ] [ vm_path ] ) elif args . vm_uuid : vms_by_uuid = get_vms_by_uuid ( dcftree ) for vm_uuid in args . vm_uuid : if vm_uuid not in vms_by_uuid : print ( "ERROR: Could not find VM with instance UUID %s" % ( vm_uuid ) ) sys . exit ( 1 ) vm_list . append ( vms_by_uuid [ vm_uuid ] ) else : print ( "ERROR: No VMs given, neither by folder + name nor by UUID" ) sys . exit ( 1 ) return vm_list