Exemplo n.º 1
0
	def read_local_conf(self):
		conf_file = "./conf/volcano.conf"
		tmp_conf_file = "./conf/volcano.conf.tmp"
		
		if not os.path.exists(conf_file):
			ReportLog.sys_info("%s does not exists !"%(conf_file))
		cmd = "sed \'/^$/D\' %s | grep -v \"^[[:blank:]]*#\" > %s"%(conf_file,tmp_conf_file)
		os.system(cmd)	
		fd = open(tmp_conf_file)
		self.hosts_list = []
		while True:
			hosts = {}
			line = fd.readline()
			if not line :
				break
			hosts['ip'] = line.split()[0]
			hosts['passwd'] = line.split()[1]
			hosts['port'] = 22
			hosts['username'] = "******"
#			put_dir_test(hosts)
			exec_cmd_test(hosts)
			self.hosts_list.append(hosts)
		fd.close()
		os.system("rm -f %s"%tmp_conf_file)
		return self.hosts_list
Exemplo n.º 2
0
	def get_dir2transfer(self):
		remote_dir_path=''
		local_dir_path=''
		local_dir_path = raw_input("Please input local path : ")
		if not os.path.isdir(local_dir_path):
			ReportLog.sys_info("%s does not exists !"%(local_dir_path))
			sys.exit(1)
		remote_dir_path = raw_input("Please input remote path : ")
		return (local_dir_path,remote_dir_path)