Application import fails

book

Article ID: 210692

calendar_today

Updated On:

Products

CA Release Automation - Release Operations Center (Nolio)

Issue/Introduction

Scenario: application export-import from 6.6.0.10228 environment to 6.6.0.10228.

Export is done successfully. 

Import fails on following error message in nolio_export.log:

2020-10-23 12:58:38,493 [http-nio-8443-exec-6] ERROR (com.nolio.platform.server.dataservices.services.exportimport.model.importdata.ApplicationDataImporter:180) - Runtime exception caught while importing application
com.nolio.platform.server.dataservices.except.InputInvalidException: artifact definition with this name already exists. name:*************

Cause

The issue is related to the fact that there are 2 artifact definitions with the same name in the provided file. This is an issue in the data. It is prohibited by design to have artifact definitions with the same name, artifact type and application.

Environment

Release : 6.6,6.7

Component : CA RELEASE AUTOMATION CORE

Resolution

Identifying Artifact Definition Duplication:

The below query should work for MySQL, SQL and Oracle in case of syntax conflict please modify below script depending on target DB type.

select
  app.app_name as application_name,
  ad.name as art_definition,
  at.name as artifact_type_name,
  count(ad.name) as total_occurrence
from artifact_definition as ad
  join applications as app
    on app.id = ad.applicationId
  join artifact_type as at
    on at.id = ad.artifactType_id
group by
  app.app_name,
  at.name,
  ad.name
having count(ad.name) > 1

Removing Duplicated Record

Steps to Execute:

1: Copy the script(attached to this article for your respective DB type) and it will create a store-procedure sp_remove_artifact_definition

2: Execute the above created SP i.e. sp_remove_artifact_definition with artifact_definition_id's you want to remove by providing p_aritifact_definition_id highlighted below.

    • MYSQL:

call sp_remove_artifact_definition(-1);  

                  Note: Debug version of MySQL query is also attached to document, in case if you are getting error, you can use this script to create SP and run the same which will be capturing debug messages.

    • Oracle: 

begin
  sp_remove_artifact_definition(l_artifact_definition_id);
end;

    • SQL:

exec sp_remove_artifact_definition @p_artifact_definition_id=-1

3: After removal of corrupt data, please re-import the application export.

Attachments

Debug_MySQL_1616751516784.sql get_app
MySQL_1615956288623.sql get_app
Oracle_1615956262983.sql get_app
MsSQL_1615956248148.sql get_app