def _delete_app_specific_resources_post_remove(self, app_op, app, hook_info): """Delete application specific resources. :param app_op: AppOperator object :param app: AppOperator.Application object :param hook_info: LifecycleHookInfo object """ lifecycle_utils.delete_local_registry_secrets(app_op, app, hook_info) lifecycle_utils.delete_persistent_volume_claim( app_op, common.HELM_NS_OPENSTACK) lifecycle_utils.delete_configmap( app_op, common.HELM_NS_OPENSTACK, self.APP_OPENSTACK_RESOURCE_CONFIG_MAP) lifecycle_utils.delete_namespace(app_op, common.HELM_NS_OPENSTACK)
def app_lifecycle_actions(self, context, conductor_obj, app_op, app, hook_info): """ Perform lifecycle actions for an operation :param context: request context :param conductor_obj: conductor object :param app_op: AppOperator object :param app: AppOperator.Application object :param hook_info: LifecycleHookInfo object """ # Semantic checks if hook_info.lifecycle_type == constants.APP_LIFECYCLE_TYPE_SEMANTIC_CHECK and \ hook_info.mode == constants.APP_LIFECYCLE_MODE_AUTO and \ hook_info.operation == constants.APP_APPLY_OP and \ hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_PRE: raise exception.LifecycleSemanticCheckException( "Automatic apply is disabled for %s." % app.name) # TODO(dvoicule) remove once each app has its lifecycle operator and takes care of its rbd # this is here to keep the same functionality while decoupling # Rbd if hook_info.lifecycle_type == constants.APP_LIFECYCLE_TYPE_RBD: if hook_info.operation == constants.APP_APPLY_OP and \ hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_PRE: lifecycle_utils.create_rbd_provisioner_secrets( app_op, app, hook_info) elif hook_info.operation == constants.APP_REMOVE_OP and \ hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_POST: lifecycle_utils.delete_rbd_provisioner_secrets( app_op, app, hook_info) # TODO(dvoicule) remove once each app has its lifecycle operator and takes care of its resources # this is here to keep the same functionality while decoupling # Resources if hook_info.lifecycle_type == constants.APP_LIFECYCLE_TYPE_RESOURCE: if hook_info.operation == constants.APP_APPLY_OP and \ hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_PRE: lifecycle_utils.create_local_registry_secrets( app_op, app, hook_info) elif hook_info.operation == constants.APP_REMOVE_OP and \ hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_POST: lifecycle_utils.delete_local_registry_secrets( app_op, app, hook_info)
def app_lifecycle_actions(self, context, conductor_obj, app_op, app, hook_info): """ Perform lifecycle actions for an operation :param context: request context :param conductor_obj: conductor object :param app_op: AppOperator object :param app: AppOperator.Application object :param hook_info: LifecycleHookInfo object """ # Operation if hook_info.lifecycle_type == constants.APP_LIFECYCLE_TYPE_OPERATION: if hook_info.operation == constants.APP_APPLY_OP: if hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_POST: return self.post_apply(context, conductor_obj, hook_info) elif hook_info.operation == constants.APP_REMOVE_OP: if hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_POST: return self.post_remove(context, conductor_obj, hook_info) # Rbd elif hook_info.lifecycle_type == constants.APP_LIFECYCLE_TYPE_RBD: if hook_info.operation == constants.APP_APPLY_OP and \ hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_PRE: return lifecycle_utils.create_rbd_provisioner_secrets( app_op, app, hook_info) elif hook_info.operation == constants.APP_REMOVE_OP and \ hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_POST: return lifecycle_utils.delete_rbd_provisioner_secrets( app_op, app, hook_info) # Resources elif hook_info.lifecycle_type == constants.APP_LIFECYCLE_TYPE_RESOURCE: if hook_info.operation == constants.APP_APPLY_OP and \ hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_PRE: return lifecycle_utils.create_local_registry_secrets( app_op, app, hook_info) elif hook_info.operation == constants.APP_REMOVE_OP and \ hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_POST: return lifecycle_utils.delete_local_registry_secrets( app_op, app, hook_info) # Use the default behaviour for other hooks super(SnmpAppLifecycleOperator, self).app_lifecycle_actions(context, conductor_obj, app_op, app, hook_info)
def app_lifecycle_actions(self, context, conductor_obj, app_op, app, hook_info): """ Perform lifecycle actions for an operation :param context: request context :param conductor_obj: conductor object :param app_op: AppOperator object :param app: AppOperator.Application object :param hook_info: LifecycleHookInfo object """ # Semantic checks if hook_info.lifecycle_type == constants.APP_LIFECYCLE_TYPE_SEMANTIC_CHECK: if hook_info.mode == constants.APP_LIFECYCLE_MODE_AUTO and \ hook_info.operation == constants.APP_APPLY_OP and \ hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_PRE: return self.pre_auto_apply_check(conductor_obj) # Rbd elif hook_info.lifecycle_type == constants.APP_LIFECYCLE_TYPE_RBD: if hook_info.operation == constants.APP_APPLY_OP and \ hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_PRE: return lifecycle_utils.create_rbd_provisioner_secrets(app_op, app, hook_info) elif hook_info.operation == constants.APP_REMOVE_OP and \ hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_POST: return lifecycle_utils.delete_rbd_provisioner_secrets(app_op, app, hook_info) # Resources elif hook_info.lifecycle_type == constants.APP_LIFECYCLE_TYPE_RESOURCE: if hook_info.operation == constants.APP_APPLY_OP and \ hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_PRE: return lifecycle_utils.create_local_registry_secrets(app_op, app, hook_info) elif hook_info.operation == constants.APP_REMOVE_OP and \ hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_POST: return lifecycle_utils.delete_local_registry_secrets(app_op, app, hook_info) # Armada apply retry elif hook_info.lifecycle_type == constants.APP_LIFECYCLE_TYPE_ARMADA_REQUEST: if hook_info.operation == constants.APP_APPLY_OP and \ hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_POST: return self.armada_apply_retry(app_op, app, hook_info) # Use the default behaviour for other hooks super(PlatformAppLifecycleOperator, self).app_lifecycle_actions(context, conductor_obj, app_op, app, hook_info)
def app_lifecycle_actions(self, context, conductor_obj, app_op, app, hook_info): """ Perform lifecycle actions for an operation :param context: request context :param conductor_obj: conductor object :param app_op: AppOperator object :param app: AppOperator.Application object :param hook_info: LifecycleHookInfo object """ # Semantic checks if hook_info.lifecycle_type == constants.APP_LIFECYCLE_TYPE_SEMANTIC_CHECK: if hook_info.mode == constants.APP_LIFECYCLE_MODE_AUTO and \ hook_info.operation == constants.APP_APPLY_OP and \ hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_PRE: raise exception.LifecycleSemanticCheckException( "Automatic apply is disabled for %s." % app.name) elif hook_info.mode == constants.APP_LIFECYCLE_MODE_AUTO and \ hook_info.operation == constants.APP_EVALUATE_REAPPLY_OP: # To reject the reapply evaluation an app can override this # hook and raise exception.LifecycleSemanticCheckException pass # Check if it is a delete operation elif hook_info.operation == constants.APP_DELETE_OP: try: # Store the forbidden operations in a list forbidden = conductor_obj.apps_metadata[ constants.APP_METADATA_APPS][app.name][ constants.APP_METADATA_BEHAVIOR][ constants. APP_METADATA_FORBIDDEN_MANUAL_OPERATIONS] except KeyError: pass else: # Check if deletion is a forbidden operation if constants.APP_DELETE_OP in forbidden: raise exception.LifecycleSemanticCheckOpererationBlocked( op=constants.APP_DELETE_OP.capitalize(), app=app.name) # TODO(dvoicule) remove once each app has its lifecycle operator and takes care of its rbd # this is here to keep the same functionality while decoupling # Rbd elif hook_info.lifecycle_type == constants.APP_LIFECYCLE_TYPE_RBD: if hook_info.operation == constants.APP_APPLY_OP and \ hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_PRE: lifecycle_utils.create_rbd_provisioner_secrets( app_op, app, hook_info) elif hook_info.operation == constants.APP_REMOVE_OP and \ hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_POST: lifecycle_utils.delete_rbd_provisioner_secrets( app_op, app, hook_info) # TODO(dvoicule) remove once each app has its lifecycle operator and takes care of its resources # this is here to keep the same functionality while decoupling # Resources elif hook_info.lifecycle_type == constants.APP_LIFECYCLE_TYPE_RESOURCE: if hook_info.operation == constants.APP_APPLY_OP and \ hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_PRE: lifecycle_utils.create_local_registry_secrets( app_op, app, hook_info) elif hook_info.operation == constants.APP_REMOVE_OP and \ hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_POST: lifecycle_utils.delete_local_registry_secrets( app_op, app, hook_info)