Unable to Delete Agent - You cannot delete a server that is being used by Release Center artifacts.
search cancel

Unable to Delete Agent - You cannot delete a server that is being used by Release Center artifacts.

book

Article ID: 203709

calendar_today

Updated On:

Products

CA Release Automation - Release Operations Center (Nolio) CA Release Automation - DataManagement Server (Nolio)

Issue/Introduction

We have encountered a problem when we attempt to delete or remove an old agents which no longer exist.  We are seeing an error message "You cannot delete a server that is being used by Release Center artifacts."

Environment

Release : 6.6, 6.7, 6.8

Component : CA RELEASE AUTOMATION RELEASE OPERATIONS CENTER

Cause

There are two possible causes for this error:

1. The agent in question currently belongs to an agent group.

2. A problem with the database is preventing the removal. (This is an environment-specific problem in which somehow the data within the database was improperly altered/corrupted/etc.)

Resolution

The Agent belonging to an Agent Group is the most likely cause of this and the following steps will allow remove for the majority of clients that encounter this issue.

  1. Login to ROC.
  2. Identify the agent group(s) that the agent belongs to.
    • Via Administration -> Agent Groups
    • Go through each group (on the left) and search for the server in question. 
    • Select the next Group "Type" from the group "Type" drop down that has "Default" selected by default.
    • Go through each group (on the left) and search for the server in question. 
  3. Remove the agent from the agent group(s).



If this steps above do not reveal or help address all associations then it is likely that the agent was directly assigned as the retrieval agent - or there is corruption in the database preventing the agent from being deleted or removed. The following information addresses how to clear an agent in this state directly from the database. 

Note: Before proceeding, be absolutely certain that the agent does not belong to any agent groups using the steps above.

Please work with your database user/administrator to perform the following steps. 
As with any changes directly in the database, ensure there is a backup prior to any modifications as there is a potential to damage the data in the tables leading to other problems or failures. 

To void using database update statements to fix the problem, see the steps outlined in the "Additional Information" section for how to identify the artifacts - so they can be found through the UI and altered there instead. 

 

To solve using DB select/update:

  1. Run the sql query:
    select * from rc_artifact_getters where server_id = (select id from servers where server_name = '<the servername you want to remove>')

  2. Confirm that the number of rows returned by the query from step 1 matches the number of artifacts that the UI error says the server is associated with. If so, you may proceed with the next step.

  3. Run the sql query:
    Update rc_artifact_getters
      set server_id = 0
    where server_id = '<server_id returned by step 1>'

 

Once completed, you should be able to remove the agent in question. 

 

 

Additional Information

If you want to avoid running the 'update' statement, you can try using the following queries to identify where the artifact can be found so that you can navigate to it via the UI and change the artifact retrieval agent/group of that artifact:

  1. Run this query to identify artifact_getter's id's that use the server_id used by the server you want to delete:
    select id, server_id from rc_artifact_getters where server_id = (select id from servers where server_name = '<the servername you want to remove>')

  2. Run this query to identify the artifact id's that use the artifact_getter id's identified in step 1:
    select * from rc_artifacts where artifact_getter IN ('<first id returned in step 1>', '<second id returned from step 1>', 'etc')

  3. Run this query to get the artifact definition name - so you know it when looking in the UI:
    select * from artifact_definition where id = '<artifactDefinition value returned by step2>'

  4. Run this query to get the artifact type name - so you know it when looking in the UI:
    select * from artifact_type where id = '<artifactType_id value returned by step 3>'

  5. Run this query to get the application name - so you know it when looking in the UI:
    select * from applications where id = '<applicationId value returned by step 3>'