def bootstrapChef(self,vm): y=Vmops() y.connect() chefnode=y.findVM(vm) chefnode.login_in_guest("root","Tubuai123!") chefserver=y.findVM("Chef Server") chefserver.login_in_guest("root","Tubuai123!") createhostnamecentosfile(vm) # remove the chef client properties from the server pid=chefnode.start_process("/bin/rm",args=["-f","-r","/etc/chef"]) if pid >0: print("Chef Node with name "+ vm + " Initialized") pid=chefserver.start_process("knife bootstrap "+ ip + "-x root -P Tubuai123! -y" ) if pid >0: print("Chef Server bootstraped Chef Node"+vm)
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()