Exemple #1
0
	def action(self,name,action):
		for k in self.server_list.keys():
			p = re.compile("%s:.*" %(name))
			match = p.findall(k)
			if match != [] :
				id=re.findall("\d",match[0],flags=0)[-1]

		url = self.super_url[id]
		sup_action = Server(url)
		if action == 'start':
			sup_action.start(name)
		elif action == 'stop':
			sup_action.stop(name)
Exemple #2
0
	def action(self,name,action):
		#通过name找到id,正则过滤出key里面的id
		for k in self.server_list.keys():
			p = re.compile("%s:.*" %(name))
			match = p.findall(k)
			if match != [] :
				id=re.findall("\d",match[0],flags=0)[-1]
		#通过id可以得到url
		url = self.super_url[id]
		# print url
		# print id
		# print name
		# print action
		sup_action = Server(url,id)
		if action == 'start':
			sup_action.start(name)
		elif action == 'stop':
			sup_action.stop(name)
		elif action == 'restart':
			sup_action.restart(name)