コード例 #1
0
ファイル: volcano.py プロジェクト: Cloudxtreme/Volcano-1
	def get_choose(self):
		
		while True:
#			'''execute commands'''
			resultes = dict(OK=[],NO=[])
			self.print_choose()
			opt = raw_input("Please input choice : ").strip()
			if opt == "1":
				cmd2exec = self.get_execute2cmds()
				if not cmd2exec:
#					print "Error..."
					continue
				for hosts in self.hosts_list:
					hosts['cmd2exec'] = cmd2exec
					if ExecCMD.exec_cmd(hosts):
						resultes["OK"].append(hosts['ip'])
					else:
						resultes["NO"].append(hosts['ip'])
#			'''transfer file'''
			elif opt == "2":
				(local_file_path,remote_file_path) = self.get_file2transfer()
				for hosts in self.hosts_list:
					hosts['file2put'] = local_file_path
					hosts['file2save'] = remote_file_path
					if PutFile.put_file(hosts):
						resultes["OK"].append(hosts['ip'])
					else:
						resultes["NO"].append(hosts['ip'])
#			'''transfer dictory'''
			elif opt == "3":
				(local_dir_path,remote_dir_path) = self.get_dir2transfer()
				for hosts in self.hosts_list:
					hosts['dir2put'] = local_dir_path
					hosts['dir2save'] = remote_dir_path
					if PutDIR.put_dir(hosts):
						resultes["OK"].append(hosts['ip'])
					else:
						resultes["NO"].append(hosts['ip'])
			elif opt == "4":
				pass
			else :
				continue
			self.print_results(resultes)
コード例 #2
0
ファイル: volcano.py プロジェクト: Cloudxtreme/Volcano-1
def put_dir_test(hosts):
	hosts['dir2put'] = "/home/firefoxbug/server/OpenCDN2/node/Tengine/conf"
	hosts['dir2save'] = "/usr/local/nginx"
	PutDIR.put_dir(hosts)