def delete(self, id): """Delete existing plan.""" db_obj = objects.registry.Plan.get_by_uuid(self.context, id) # Delete the trust. keystone_utils.delete_delegation_token(self.context, db_obj.trust_id) self._delete_params(db_obj.id) deploy_api.API(context=self.context).destroy_app(app_id=db_obj.id)
def delete(self, id): """Delete an existing app.""" try: objects.registry.App.get_by_uuid(self.context, id) except exception.ResourceNotFound as ex: raise ex deploy_api.API(context=self.context).destroy_app(id)
def _do_deploy(self, ctxt, assembly_id, ports, du_image_loc, du_image_name): app = get_app_by_assem_id(ctxt, assembly_id) LOG.debug("Deploying app %s %s" % (app.name, app.id)) deployer_api.API(context=ctxt).deploy(assembly_id=assembly_id, image_loc=du_image_loc, image_name=du_image_name, ports=ports)
def delete(self, id): """Delete a resource.""" db_obj = objects.registry.Assembly.get_by_uuid(self.context, id) conductor_api.API(context=self.context).update_assembly( db_obj.id, {'status': ASSEMBLY_STATES.DELETING}) deploy_api.API(context=self.context).destroy_assembly( assem_id=db_obj.id)
def _do_deploy(self, ctxt, assembly_id, ports, du_image_loc, du_image_name): deployer_api.API(context=ctxt).deploy(assembly_id=assembly_id, image_loc=du_image_loc, image_name=du_image_name, ports=ports)
def _do_scale(self, ctxt, assembly_id): deployer_api.API(context=ctxt).scale(assembly_id=assembly_id)
def _do_scale(self, ctxt, assembly_id): app = get_app_by_assem_id(ctxt, assembly_id) LOG.debug("Scaling app %s %s" % (app.name, app.id)) deployer_api.API(context=ctxt).scale(assembly_id=assembly_id)
def build(self, ctxt, build_id, source_uri, name, base_image_id, source_format, image_format, assembly_id, test_cmd): # TODO(datsun180b): This is only temporary, until Mistral becomes our # workflow engine. if self._run_unittest(ctxt, assembly_id, source_uri, test_cmd) != 0: return update_assembly_status(ctxt, assembly_id, ASSEMBLY_STATES.BUILDING) solum.TLS.trace.clear() solum.TLS.trace.import_context(ctxt) build_cmd = self._get_build_command(ctxt, source_uri, name, base_image_id, source_format, image_format) solum.TLS.trace.support_info(build_cmd=' '.join(build_cmd), assembly_id=assembly_id) try: user_env = self._get_environment(ctxt) except exception.SolumException as env_ex: LOG.exception(env_ex) job_update_notification(ctxt, build_id, IMAGE_STATES.ERROR, description=str(env_ex), assembly_id=assembly_id) return log_env = user_env.copy() if 'OS_AUTH_TOKEN' in log_env: del log_env['OS_AUTH_TOKEN'] solum.TLS.trace.support_info(environment=log_env) job_update_notification(ctxt, build_id, IMAGE_STATES.BUILDING, description='Starting the image build', assembly_id=assembly_id) # TODO(datsun180b): Associate log with assembly properly logpath = "%s/%s.log" % (user_env['SOLUM_TASK_DIR'], user_env['BUILD_ID']) LOG.debug("Build logs stored at %s" % logpath) try: out = subprocess.Popen(build_cmd, env=user_env, stdout=subprocess.PIPE).communicate()[0] except OSError as subex: LOG.exception(subex) job_update_notification(ctxt, build_id, IMAGE_STATES.ERROR, description=subex, assembly_id=assembly_id) return # we expect one line in the output that looks like: # created_image_id=<the glance_id> created_image_id = None for line in out.split('\n'): if 'created_image_id' in line: solum.TLS.trace.support_info(build_out_line=line) created_image_id = line.split('=')[-1].strip() if not uuidutils.is_uuid_like(created_image_id): job_update_notification(ctxt, build_id, IMAGE_STATES.ERROR, description='image not created', assembly_id=assembly_id) return job_update_notification(ctxt, build_id, IMAGE_STATES.COMPLETE, description='built successfully', created_image_id=created_image_id, assembly_id=assembly_id) if created_image_id is not None: deployer_api.API(context=ctxt).deploy(assembly_id=assembly_id, image_id=created_image_id)