Exemplo n.º 1
0
 def showmain(self):
    self.MainMenu()
    while  1:
     ok=raw_input()
     if (len(ok)>1):
         continue
     if ok in (''):
         continue
     if ok =='x':
        self.MainMenu()
     elif ok.isdigit() and int(ok) == 6:
        break;
     elif  ok.isdigit() and int(ok) == 1:
        x=basicOps()
        x.connect()
        print("Printing ")
        self.ask_for_Machine("Chef Node Template")
     elif  ok.isdigit() and int(ok) == 2:
         x=basicOps()
         x.connect()
         self.ask_for_Machine("Windows Template name")
     elif  ok.isdigit() and int(ok) == 3:
         x=basicOps()
         x.connect()
         self.ask_for_Machine("Ubuntu 12.04 64bit med")
     elif  ok.isdigit() and int(ok) == 4:
         x=basicOps()
         x.connect()
         self.ask_for_Machine("Windows Template name")
     elif  ok.isdigit() and int(ok) == 5:
         x=basicOps()
         x.connect()
         self.ask_for_Machine("Windows Template name",receipe=True)
Exemplo n.º 2
0
 def ask_for_Machine(self, templateName,showSummary=False,receipe=False):
     os.system("clear")

     print("Enter Machine Name")
     while True:
      name=raw_input()
      if name in (''):
        continue
      if name=='x':
          self.MainMenu()
      elif (len(name)>2):
         machineName=name
         if(receipe==True):
            self.showRecipes()
            while True:
               name=raw_input()
               if name=='x':
                 break;
               if((receipe==True)and(name.isdigit())and(int(name)==1)):
                 #search machine or show message if m1achine is not there
                 print("Generating Recipe 1")
               elif((receipe==True)and(name.isdigit())and(int(name)==2)):
                 #search machine or show message if machine is not there
                 print("Generating Recipe 2")
               elif(receipe==True)and name.isdigit():
                 #search machine or show message if machine is not there
                 continue
            self.showmain()
         elif (receipe==False):
            print("Creating Machine:"+machineName+":")
            x=basicOps()
            y=Vmops()
            x.connect()
            y.connect()
            print(templateName)
            print(machineName)
            x.clone(templateName,machineName)
            bootstrapChef(machineName)
            self.showFooter()
Exemplo n.º 3
0
     except VimFault, e:
         print("Failed to reconfigure %s: " % e)
         sys.exit()
     except ObjectNotFoundError:
         print("ERROR: No VM found with name %s" % vm_name)

# def getResourcePool(self):
     #pools=self.client.find_entity_view("ResourcePool",filter={"name": "Customs-Dev-vDC"})
     #print(pools)


source_vm_name = "Chef Node Template"
dest_vm_name = "Chef Node Clone"

#x=Vmops()
y=basicOps()


#y.connectVIServer("69.33.0.216","vpxuser","Tubuai123!")
#x.connect()
#y.stopVm(source_vm_name)
#x.changevmMemory(source_vm_name,2096)
#x.cloneMachine(source_vm_name,dest_vm_name)
#y.connect()
#y.clone(source_vm_name,"Development Cluster","Customs-Prod-vDC",cloneName="Chef Node Clone 2")
#y.stopVm(source_vm_name)
#x.getResourcePoole
#x.stopGuest(source_vm_name)
#x.rebootGuest(source_vm_name)
#y.getResourceList(cluster="Development Cluster",resourcePool="Customs-Prod-vDC")
#x=Utility()