Esempio n. 1
0
		def save(self, to):
			to.save_service(self)

		def __str__(self):
			return self.__dict__

	# execute an action
	firebase = Firebase(firebase_uid, self.settings)
	# get user_config
	user_config = Bunch(firebase.get_config())
	api_user = user_config.tutum['api']['user']
	api_key = user_config.tutum['api']['key']

	logms(4)
	if self.POST.has_key('action'):
		service = firebase.get_service(self.POST['service_name'])
		action = self.POST['action']

		if action == "start":
			result, service_new = service.start()
			if result[0] not in [200, 201, 202]:
				raise Exception(result)

			service_new.state = "Running"
			service_new.id = service_new.id
			firebase.save_service(service_new)

			result = service_new.id

		elif action == "stop":
			result, service = service.stop()