def handle_delete(self): if self.resource_id is None: return api = API(self._url(), self._auth(), self.properties["verify"]) api.application_delete(self.resource_id) return self.resource_id
def handle_create(self): api = API(self._url(), self._auth(), self.properties["verify"]) d = dict([(x, self.properties[x]) for x in ["cartridges", "scale", "gear_size", "initial_git_url"]]) d["name"] = self.physical_resource_name() if self.properties["environment_variables"]: envvars = [ {"name": x, "value": self.properties["environment_variables"][x]} for x in self.properties["environment_variables"] ] d["environment_variables"] = envvars id = api.application_create(self.properties["domain"], **d) if self.properties["artifact_url"]: try: artifact_url = self.properties["artifact_url"] api.application_deploy(id, artifact_url=artifact_url) except: with excutils.save_and_reraise_exception(): api.application_delete(id) self.resource_id_set(id) return self.resource_id