def delete_instance(self, instance_name):
        url = "%s/%s/%s/%s/%s/%s" % (self.paasmanager_url, "envInst/org/FIWARE",
                                     "vdc", self.vdc, "environmentInstance", instance_name)
        headers = {'X-Auth-Token': self.token, 'Tenant-Id': self.vdc,
                   'Content-Type': "application/xml", 'Accept': "application/json"}
        world.response = http.delete(url, headers)

        """Remove it from the world too"""
        try:
            world.instances.remove(instance_name)
        except:
            pass

        if world.response.status == 200:
            """Wait for the associated task to finish and store its data"""
            world.task_data = http.wait_for_task(json.loads(world.response.read()), headers)
    def delete_blueprint_instance(self, environment_instance):
        url = "%s/%s/%s/%s/%s" % (
            self.paasmanager_url, "envInst/org/FIWARE/vdc", self.vdc, "environmentInstance", environment_instance)

        headers = {'X-Auth-Token': self.token, 'Tenant-Id': self.vdc, 'Content-Type': "application/xml",
                   'Accept': "application/json"}

        response = http.delete(url, headers)

        ## Si la respuesta es la adecuada, creo el diccionario de los datos en JSON.
        if response.status != 200 and response.status != 204:
            data = response.read()
            print 'error to delete the environment ' + str(response.status) + " " + data
            sys.exit(1)
        else:
            http.processTask(headers, json.loads(response.read()))
Esempio n. 3
0
    def delete_instance(self, instance_name):
        url = "%s/%s/%s/%s/%s/%s" % (self.paasmanager_url,
                                     "envInst/org/FIWARE", "vdc", self.vdc,
                                     "environmentInstance", instance_name)
        headers = {
            'X-Auth-Token': self.token,
            'Tenant-Id': self.vdc,
            'Content-Type': "application/xml",
            'Accept': "application/json"
        }
        world.response = http.delete(url, headers)
        """Remove it from the world too"""
        try:
            world.instances.remove(instance_name)
        except:
            pass

        if world.response.status == 200:
            """Wait for the associated task to finish and store its data"""
            world.task_data = http.wait_for_task(
                json.loads(world.response.read()), headers)
    def delete_blueprint_instance(self, environment_instance):
        url = "%s/%s/%s/%s/%s" % (self.paasmanager_url,
                                  "envInst/org/FIWARE/vdc", self.vdc,
                                  "environmentInstance", environment_instance)

        headers = {
            'X-Auth-Token': self.token,
            'Tenant-Id': self.vdc,
            'Content-Type': "application/xml",
            'Accept': "application/json"
        }

        response = http.delete(url, headers)

        ## Si la respuesta es la adecuada, creo el diccionario de los datos en JSON.
        if response.status != 200 and response.status != 204:
            data = response.read()
            print 'error to delete the environment ' + str(
                response.status) + " " + data
            sys.exit(1)
        else:
            http.processTask(headers, json.loads(response.read()))