Using the Custom Data Remap Script to Remap Custom Versions in Code Insight 6x

Using the Custom Data Remap Script to Remap Custom Versions in Code Insight 6x

This article describes how to use the Custom Data Remap script to remap custom component versions to Data Library (PDL) component versions. The following topics describe this process:

 

 

About the Custom Data Remap Script

The Custom Remap script maps your custom component versions to Code Insight Data Library (PDL) component versions. This remapping enables you to benefit from future Electronic Updates in obtaining the latest information about security vulnerabilities associated with the component versions in the PDL.

The input to the Custom Remap script is a .csv file, in which you specify the ID for each custom version and the ID for the matching PDL component version. The script iterates over the supplied list of version records, processing each pair of IDs for a remapping.

 

 

What to Expect After the Remap

If the custom component version is referenced by an existing request, group/inventory, policy, or third-party notice, all references are updated to point to the new PDL component version after the remap.

The record for the custom component version is deprecated but not deleted from Code Insight database. The term “deprecated” is appended to the name of the custom component version, as shown:

customVersion_deprecated

The remap history is captured in the following database tables:

  • PDL_ENTITY_REMAP_HISTORY provides a history of the remapped entities. Each entry includes the ID of the remap record, the entity type (for example, “component” or “component-version”), the IDs for the custom and PDL entities, and the remap time stamp.
  • PDL_REMAP_HISTORY_ITEMS provides a history of the referenced entities that were affected by the remap. Each entry includes the ID of the associated remap record in the PDL_ENTITY_REMAP_HISTORY table, the type of the referenced data (for example, request, group, or policy), and the ID of the affected reference instance.

 

 

Preparing to Run the Custom Remap Script

Perform the following tasks before running the Custom Remap script:

 

 

Task 1: Obtain the Component Version IDs

Be sure that you have run the most recent Electronic Update so that the PDL has been updated with the latest component versions. From the updated PDL, locate any new component versions in the PDL that match custom component versions. For each match, retrieve the following:

  • The ID of the custom component version that you want to remap to the PDL component version. Code Insight generated this ID as negative integer.
  • The ID of the PDL component version to which you are remapping the custom component version. Code Insight generates this ID as a positive integer.

 

 

Task 2: Obtain the Custom Remap Script and csv File

The remap process requires two files:

  • customRemap.groovy—The Custom Remap script.
  • remapDataFile.csv—The input for the Custom Remap script.

To obtain these files, follow these steps:

  1. Request both files from the Customer Community Portal or from SCA Support.
  2. Copy the files to the scriptRunner/scripts directory of your Code Insight installation:

    <FNCI_ROOT_DIR>/scriptRunner/scripts/customRemap.groovy
    <FNCI_ROOT_DIR>/scriptRunner/scripts /remapDataFile.csv

 

 

Task 3: Set Up the csv File

You must provide the necessary component version ID pairs to perform the remappings.

To provide the component version ID pairs, do the following:

  1. Open the remapDataFile.csv file that you placed in <FNCI_ROOT_DIR>/scriptRunner/scripts.
  2. In a given row, define a remapping: In column A (Custom_Version_ID), enter the ID for the custom component version; in column B (Version_ID), enter the ID for PDL component version.
  3. Repeat the previous step for each remap pair.
  4. Save the file.

 

 

Executing the Custom Remap Script

The Custom Remap script will function properly only when executed through the Code Insight ScriptRunner framework. For information on using ScriptRunner, see “Using Scriptrunner” in the Installation and System Administration Guide.

If this is your first time running ScriptRunner, you will be prompted to enter a JWT token for authorization verification. For more information on generating a JWT token that you can then copy and paste at the prompt, see “Generating a JSON Web Token (JWT)” in the Installation and System Administration Guide.

To execute the customRemap script, do the following:

  1. Ensure that you have completed the preliminary steps in Preparing to Run the Custom Remap Script.
  2. Run the customRemap.groovy script using a command in the following syntax (assuming that you are running the command from /scriptRunner/bin).

    ./scriptRunner.sh –u {authorized user} –c {core_server_URL} ../scripts/customRemap.groovy ../scripts/remapDataFile.csv
    The command requires the following information:

    {authorized_user}—For the -u flag, the user ID authorized to run this command.
    {core_server_URL}—For the -c flag, the URL of the core server. Be sure to include a trailing “/” at the end of the URL as shown in the example below (palamida/).

    The following is an example command:

    ./scriptRunner.sh –u foo –c http://111.122.133.144:8888/palamida/ ../scripts/customRemap.groovy ../scripts/remapDataFile.csv
  3. If prompted, paste the JWT in the designated field.
Tags (1)
Was this article helpful? Yes No
No ratings
Version history
Revision #:
12 of 12
Last update:
‎Jun 17, 2020 08:43 AM
Updated by:
 
Contributors