search cancel

Looping through Application Environments

book

Article ID: 229733

calendar_today

Updated On:

Products

CA Release Automation - Release Operations Center (Nolio)

Issue/Introduction

There may be times when you need to take inventory or action on Environments in each Application. 

 

Environment

Release : 6.7

Component : CA Release Automation Administration

 

Cause

Things change. Whether it be server replacement, environment parameters, etc.. 

 

Resolution

Note: The attachment is not officially supported or maintained by Broadcom. It is offered in an attempt to give insight on how to loop through applications/environments. 

 

Overview

The attached .zip file includes a process GetAgentsAssignedToServerType. The purpose of this process is to show how:

  • Get a list of each Application defined in Nolio.
  • Loop over each Application to get a list of Environments in that Application.
  • Loop over each Environment and get the Agents assigned to a specific ServerType.

 

export_NolioHelper.zip

The attached export_NolioHelper.zip contains:

1 Application:

  • NolioHelper

 

1 Server Type:

  • HelperAgentST

 

1 Environment:

  • HelperAgentEnv

 

1 Process:

  • GetAgentsAssignedToServerType:
    This process will loop through each environment, for each application, and write the agents assigned to a "User Input" provided ServerType Name. 

 

To import:

  • Download the export_NolioHelper.zip file attached to this article.
  • Log into the ROC as a superuser
  • Navigate to Designer -> Import/Export
  • Click Import (in the upper right corner).
  • Click the "Choose File" button to find and select the downloaded export_NolioHelper.zip.

 

 

To use:

First, complete the following one time task:

  • Log into the ROC as a superuser
  • Navigate to Environments -> Parameter Configuration
  • Drill into the HelperAgentComp -> Common -> NAC folder and supply a valid value for these parameters:
    • NAC_URL: This should be the url you use to access the ROC Web UI. For example: http(s)://<nac_servername_or_alias>:<port>
    • NAC_User: Specify a valid superuser account
    • NAC_User_Pass: The password for the NAC_User

 

Once you've set the above environment parameters, you may execute the process by following these steps:

  • Log into the ROC as a superuser
  • Navigate to Environments -> Agent Assignment.
  • Select 1 Linux agent that can communicate with the Management Server. 
  • Navigate to Environments -> Process Execution
  • Expand the HelperAgentEnv environment, expand Processes, expand HelperB398 (B398 is the cumulative patch number of Nolio where written/tested), expand AgentAssignments and GetAgentsAssignedToServerType. Then click on that processes Latest tag.
  • Click the "Run Process" button.
  • Select the agents to run the process against. 
  • Click the "Run" button.
  • The process should immediately prompt for the name of the ServerType that you want to check your application environments for. 
  • Once the process has finished, on the agent machine where the process ran you will find:
    • A deployments folder. The deployments folder will contain:
    • A <job Id> folder. Each time you run the process it generates a unique JobId folder. 
    • In each JobId folder you will find:
      • Two files: applicationList.json and applicationList.json.original. The applicationList.json is a file that should contain one line per application. Each line should be formatted as a valid, single, json object.
      • A list of folders. The names of the folders represent the applicationId's. 
      • Under each applicationId folder you will find:
        • Two files: envList.json and envList.json.original. The envList.json is a file that should contain one line per environment. Each line should be formatted as a valid, single, json object.
        • A list of folders. The names of the folders represent the Environment Name. 
        • Each <Environment Name> folder will have at least one file: application_name.
        • IF the ServerType Name you provided is found in this environment then it will contain another file with the list of agents assigned to that ServerType. The file is named: assignedServers.txt

 

IF you run the process, you can check to see if it properly detects all of the instances you would expect. For example, after you run the process you should be able to do something like: grep -R "<your old servername>" . | wc -l

The grep command above would give a representation of how many Environments that servername was found - based on the ServerType you provided. You can compare this number to the number associated with the server in the Agent Assignment page. 

 

You can also use the command: grep -R "<your old servername>" .

This will return all of the environments & server types where this host was assigned. 

 

 

Additional Information

If you need to use the same (or revised) copies of the flows used in the provided process, be sure to add the "Get ServerType Name - User Input - Ask For Parameter Value" action as the first action run in the new process. Otherwise, you will get the following conflict error:

Parameter "targetServerTypeName" is used by step "Application Environment - Get Assigned Servers" but never updated. 

Attachments

1638555930493__export_NolioHelper.zip get_app