示例#1
0
    def delete(self, instance_id=None):
        # lookup user's auth info
        user_info = User.get_by_id(long(self.user_id))

        # delete instance
        instance = Instance.get_by_id(long(instance_id))
        slack.slack_message("Instance %s deleted for %s!" %
                            (instance.name, user_info.username))
        instance.key.delete()

        # hangout for a second
        if config.isdev:
            time.sleep(1)

        params = {
            "response": "success",
            "message": "instance %s deleted" % instance.name
        }
        return self.render_template('api/response.json', **params)
示例#2
0
	def delete(self, cloud_id = None, instance_id = None):
		# hangout for a second
		time.sleep(1)

		# look up the instance
		instance = Instance.get_by_id(long(instance_id))

		if instance:
			cloud = instance.cloud
			if long(cloud.id()) == long(cloud_id):
				instance.cloud = None
				instance.put()
			else:
				self.add_message("Clouds don't match.", "error")
		else:
			self.add_message("Instance not found!", "error")

		# use the channel to tell the browser we are done and reload
		channel_token = self.request.get('channel_token')
		channel.send_message(channel_token, 'reload')

		return
示例#3
0
    def delete(self, cloud_id=None, instance_id=None):
        # hangout for a second
        time.sleep(1)

        # look up the instance
        instance = Instance.get_by_id(long(instance_id))

        if instance:
            cloud = instance.cloud
            if long(cloud.id()) == long(cloud_id):
                instance.cloud = None
                instance.put()
            else:
                self.add_message("Clouds don't match.", "error")
        else:
            self.add_message("Instance not found!", "error")

        # use the channel to tell the browser we are done and reload
        channel_token = self.request.get('channel_token')
        channel.send_message(channel_token, 'reload')

        return