Remove RA agents associated with release center artifacts
search cancel

Remove RA agents associated with release center artifacts

book

Article ID: 255293

calendar_today

Updated On:

Products

CA Release Automation - Release Operations Center (Nolio)

Issue/Introduction

We want to remove the current CARA agents, which are no more in system but still shows as offline in agent lists. While trying to delete such agents it result in error:

RCNotificationException: You cannot delete a server that is being used by Release Center artifacts. Artifacts using this server are: <br> - <ARTIFACT NAME>, application: <APPLICATION NAME>
at com.nolio.releasecenter.services.notifications.RCNotificationListenerImpl.checkServerClusterArtifactUsageBeforeDelete(RCNotificationListenerImpl.java:145)

The agent we are trying to remove is associated with 56,000 releases as "Release center artifact" and removing this link via UI is impossible task.

Is there a way to force the removal of an agent even if it is associated with a release center artifact?

Environment

Release : 6.7

Component: CA RELEASE AUTOMATION ADMINISTRATION

Cause

The end user is not able to remove the agent as it is linked to artifact version as an artifact retrieval agent. It's due to bad design consideration of artifacts by choosing artifact retrieval agent over artifact retrieval groups.

Resolution

Recommendation

The recommendation approach while considering artifact design is below

1: Create an artifact retrieval agents groups and assign agents to the respective groups.

2: Associate the groups with artifact version instead of agents.

3: The above result in loose coupling with artifact version and associated agents, any agent part of the group will be responsible for artifact download and distribution to targets.

4: Due to loose coupling, an administration can remove/replace an agent from group and hence will not result in above error caused due to tight coupling of agent to artifact version.

Workaround

The ideal solution is to use ROC and delink the agents from artifact version listed in error message and remove agent.

However, in current setup it is not possible to perform de-linking agents and artifact version via ROC UI and hence the 2 step workaround i.e. delinking agents via DB query and removing agent via ROC UI. Follow steps below to achieve same.

 

Workaround Prerequisite 

Create backup of tables servers, rc_artifact_getters, rc_artifact_getters_aud before executing any DB query, as it will act as checkpoint for restoration in case of unforeseen failure. In absence of the backup tables and no restoration checkpoint can result in DB data corruption.

Workaround step 1 (Swap AGENT_TO_BE_REMOVED with REPLACING_AGENT)

1: Identify the id of agent i.e. AGENT_TO_BE_REMOVED from RA.

  select id from servers where server_name like '%AGENT_TO_BE_REMOVED%'

2: Identify the id of agent i.e. REPLACING_AGENT which will be replacing the agent getting removed.

  select id from servers where server_name like '%REPLACING_AGENT%'

3: Update the artifact getters

update rc_artifact_getters set server_id=<REPLACING_AGENT_ID> where server_id =<AGENT_TO_BE_REMOVED_ID>;

         4: Update the Auditing table as it is required to maintain consistency of data in DB

update rc_artifact_getters_aud set server_id=<REPLACING_AGENT_ID> where server_id =<AGENT_TO_BE_REMOVED_ID>;

Workaround step 2 (Remove AGENT_TO_BE_REMOVED via ROC UI)

1: Login to ROC UI

2: Navigate to path Administration -> Agent Management -> Select the agent i.e. AGENT_TO_BE_REMOVED

                  3: Remove agent by clicking recycle bin icon 

Additional Information

Restoration

In case of any failure while executing DB query, please restore the respective DB tables from backup created as part of Workaround Prerequisite.