Axway-API-Management-Plus / apim-cli

Axway API-Management CLI - Manage your platform from the command line or with your CI/CD pipeline
Apache License 2.0
41 stars 17 forks source link

Custom Properties not exported correctly (empty or with wrong value) #473

Open Rennaud opened 3 months ago

Rennaud commented 3 months ago

APIM-CLI version

1.14.4

API-Management version

7.7.20220228

Bug description

We have an application with Custom Properties and values : image

The export shows : "customProperties" : { "codeAramis" : "", "domaine" : "", "roles" : "", "idAramis" : "2246" },

codeAramis, domaine and roles should not be empty and idAramis is empty!!

We dit try with the version 1.14.1 and it works fine : "customProperties" : { "codeAramis" : "KERBEROS", "idAramis" : "", "domaine" : "KERBEROS", "roles" : "LC4" },

Steps to reproduce

Creates custom properties on applications and create an application with values in it.

Relevant log output

No response

rathnapandi commented 3 months ago

Hi @Rennaud, I can't reproduce the issue.

image

app.config value

// custom properties
        customProperty1: {
           label: 'Custom Property #1',
           permissions: {
              admin: { read: true, write: true, visible:true },
              oadmin: { read: true, write: true, visible:true },
              user: { read: true, write: false, visible:true }
            }
         },
         customProperty2: {
            label: 'Custom Property #2',
            type: 'select',
            permissions: {
               admin: { read: true, write: true, visible:true },
               oadmin: { read: true, write: true, visible:true },
               user: { read: true, write: false, visible:true }
            },
            options: [
               { value: '1', label: 'Value 1' },
               { value: '2', label: 'Value 2' },
               { value: '3', label: 'Value 3' }
             ]
          },
         customProperty3: {
            label: 'Custom Property #3',
            type: 'switch',
            permissions: {
               admin: { read: true, write: true, visible:true },
               oadmin: { read: true, write: true, visible:true },
               user: { read: true, write: false, visible:true }
          },
          options: [
              { value: true, label: 'ON' },
              { value: false, label: 'OFF' }
           ]
       }

Application export output:

{
  "name" : "test",
  "organization" : "API Development",
  "state" : "approved",
  "enabled" : true,
  "credentials" : [ ],
  "apis" : [ {
    "apiName" : "Health",
    "apiVersion" : "1.0"
  } ],
  "customProperties" : {
    "customProperty1" : "",
    "customProperty2" : "2",
    "customProperty3" : "true"
  },
  "permissions" : [ ],
  "appScopes" : [ ]
}

Logs

scripts git:(develop) ✗ ./apim.sh  app  get -n "test"  -u apiadmin -p changeme -h  localhost -o json
2024-03-21 08:21:04,572 [APIManagerCLI] INFO : API-Manager CLI: 1.14.4-SNAPSHOT
2024-03-21 08:21:04,573 [APIManagerCLI] INFO : Module: Application - E X P O R T / U T I L S  (1.14.4-SNAPSHOT)
2024-03-21 08:21:04,577 [EnvironmentProperties] DEBUG: Trying to load environment properties from file: env.properties ... not found.
2024-03-21 08:21:05,072 [APIMHttpClient] DEBUG: API Manager CLI http client timeout : 30000
2024-03-21 08:21:05,091 [RestAPICall] DEBUG: Http verb:POST and URI: https://sl3rdecd101260.pcloud.axway.int:8075/api/portal/v1.4/login
2024-03-21 08:21:05,385 [RestAPICall] DEBUG: Http verb:GET and URI: https://sl3rdecd101260.pcloud.axway.int:8075/api/portal/v1.4/currentuser
2024-03-21 08:21:05,462 [RestAPICall] DEBUG: Http verb:GET and URI: https://sl3rdecd101260.pcloud.axway.int:8075/api/portal/v1.4/config
2024-03-21 08:21:05,631 [APIManagerAdapter] INFO : Successfully connected to API-Manager (7.7.20240228) on: https://sl3rdecd101260.pcloud.axway.int:8075
2024-03-21 08:21:05,632 [APIManagerCustomPropertiesAdapter] DEBUG: Read configured custom properties from API-Manager
2024-03-21 08:21:05,632 [RestAPICall] DEBUG: Http verb:GET and URI: https://sl3rdecd101260.pcloud.axway.int:8075/api/portal/v1.4/config/customproperties
2024-03-21 08:21:05,801 [APIMgrAppsAdapter] DEBUG: Sending request to find existing applications: https://sl3rdecd101260.pcloud.axway.int:8075/api/portal/v1.4/applications?field=name&op=eq&value=test
2024-03-21 08:21:05,801 [RestAPICall] DEBUG: Http verb:GET and URI: https://sl3rdecd101260.pcloud.axway.int:8075/api/portal/v1.4/applications?field=name&op=eq&value=test
2024-03-21 08:21:05,955 [APIManagerOrganizationAdapter] DEBUG: Load organizations from API-Manager using filter: OrgFilter [name=null, id=2060aa6b-3df6-4203-a19f-173d218ab2c3]
2024-03-21 08:21:05,955 [APIManagerOrganizationAdapter] DEBUG: Load organization with URI: https://sl3rdecd101260.pcloud.axway.int:8075/api/portal/v1.4/organizations/2060aa6b-3df6-4203-a19f-173d218ab2c3
2024-03-21 08:21:05,955 [RestAPICall] DEBUG: Http verb:GET and URI: https://sl3rdecd101260.pcloud.axway.int:8075/api/portal/v1.4/organizations/2060aa6b-3df6-4203-a19f-173d218ab2c3
2024-03-21 08:21:06,089 [APIManagerOrganizationAdapter] DEBUG: Organization id to be cached : /2060aa6b-3df6-4203-a19f-173d218ab2c3
2024-03-21 08:21:06,097 [APIMgrAppsAdapter] DEBUG: Found: 1 applications
2024-03-21 08:21:06,099 [APIManagerQuotaAdapter] DEBUG: Found quota with ID: 08f96e86-1472-41a5-b89b-f2c88198df30 in cache: {"id":"00000000-0000-0000-0000-000000000001","type":"APPLICATION","name":"Application Default","description":"Maximum message rates per application. Applied to each application unless an Application-Specific quota is configured","restrictions":[],"system":true}
2024-03-21 08:21:06,105 [RestAPICall] DEBUG: Http verb:GET and URI: https://sl3rdecd101260.pcloud.axway.int:8075/api/portal/v1.4/applications/08f96e86-1472-41a5-b89b-f2c88198df30/oauthresource
2024-03-21 08:21:06,254 [RestAPICall] DEBUG: Http verb:GET and URI: https://sl3rdecd101260.pcloud.axway.int:8075/api/portal/v1.4/applications/08f96e86-1472-41a5-b89b-f2c88198df30/permissions
2024-03-21 08:21:06,393 [RestAPICall] DEBUG: Http verb:GET and URI: https://sl3rdecd101260.pcloud.axway.int:8075/api/portal/v1.4/proxies/367124b4-66b3-4c4a-a1c1-42da78858b96
2024-03-21 08:21:06,566 [APIManagerAPIAdapter] DEBUG: Found: 1 exposed API(s): 
2024-03-21 08:21:06,567 [ApplicationExportApp] INFO : Found 1 application(s).
2024-03-21 08:21:06,567 [JsonApplicationExporter] INFO : Going to export applications into folder: /Users/rnatarajan/IdeaProjects/apim-cli-dev/distribution/target/axway-apimcli-1.14.4-SNAPSHOT/apim-cli-1.14.4-SNAPSHOT/scripts/test
2024-03-21 08:21:06,578 [JsonApplicationExporter] INFO : Successfully exported application to folder: /Users/rnatarajan/IdeaProjects/apim-cli-dev/distribution/target/axway-apimcli-1.14.4-SNAPSHOT/apim-cli-1.14.4-SNAPSHOT/scripts/test
2024-03-21 08:21:06,578 [ApplicationExportApp] DEBUG: Successfully exported 1 application(s).
2024-03-21 08:21:06,578 [APIManagerAdapter] DEBUG: Closing cache ...
2024-03-21 08:21:06,687 [RestAPICall] DEBUG: Http verb:DELETE and URI: https://sl3rdecd101260.pcloud.axway.int:8075/api/portal/v1.4/login

Can you please test it again?

Rennaud commented 3 months ago

Hi @rathnapandi ,

I found maybe how to reproduce : Test Case 1 : export with parameter '-n ' ==> OK : we can see the custom properties properly Test Case 2 : export all the 208 applications ==> KO : wrong custom properties values and more strange we lost the custom properties values we are searching for. Maybe it mixing up when we have too much appplication

Here some logs :

Test Case 1 `$ ./apim.sh app get -o json -h apimanager-int.serv.cdc.fr -port 443 --username apiadmin --password XXXXXXX -t "C:\Users\caxwayac-e\Documents\export_apimcli\api-manager\INT\applications" -deleteTarget -n "LC4*"

2024-03-26 09:25:24,246 [APIManagerCLI] INFO : API-Manager CLI: 1.14.4 2024-03-26 09:25:24,246 [APIManagerCLI] INFO : Module: Application - E X P O R T / U T I L S (1.14.4) 2024-03-26 09:25:26,901 [APIManagerAdapter] INFO : Successfully connected to API-Manager (7.7.20220228) on: https://apimanager-int.serv.cdc.fr:443 2024-03-26 09:25:29,376 [ApplicationExportApp] INFO : Found 1 application(s). 2024-03-26 09:25:29,376 [JsonApplicationExporter] INFO : Going to export applications into folder: C:\Users\caxwayac-e\Documents\export_apimcli\api-manager\INT\applications\support-interne\LC4_CBILAN 2024-03-26 09:25:29,436 [JsonApplicationExporter] INFO : Successfully exported application to folder: C:\Users\caxwayac-e\Documents\export_apimcli\api-manager\INT\applications\support-interne\LC4_CBILAN

$ grep -i "KERBEROS" "C:\Users\caxwayac-e\Documents\export_apimcli\api-manager\INT\applications" -R | grep codeAramis C:\Users\caxwayac-e\Documents\export_apimcli\api-manager\INT\applications/support-interne/LC4_CBILAN/application-config.json: "codeAramis" : "KERBEROS", "customProperties" : { "codeAramis" : "KERBEROS", "idAramis" : "", "domaine" : "KERBEROS", "roles" : "LC4" },`

Test Case 2 ` ./apim.sh app get -o json -h apimanager-int.serv.cdc.fr -port 443 --username apiadmin --password XXXXXXX -t "C:\Users\caxwayac-e\Documents\export_apimcli\api-manager\INT\applications" -deleteTarget

2024-03-26 09:25:42,125 [APIManagerCLI] INFO : API-Manager CLI: 1.14.4 2024-03-26 09:25:42,125 [APIManagerCLI] INFO : Module: Application - E X P O R T / U T I L S (1.14.4) 2024-03-26 09:25:44,615 [APIManagerAdapter] INFO : Successfully connected to API-Manager (7.7.20220228) on: https://apimanager-int.serv.cdc.fr:443 Loading details of 208 applications [*****-] 90% 2024-03-26 09:26:53,880 [ApplicationExportApp] INFO : Found 208 application(s). 2024-03-26 09:26:53,881 [JsonApplicationExporter] INFO : Going to export applications into folder: C:\Users\caxwayac-e\Documents\export_apimcli\api-manager\INT\applications\support-interne\CDC-Net ... ... .... ... 2024-03-26 09:26:54,989 [JsonApplicationExporter] INFO : Going to export applications into folder: C:\Users\caxwayac-e\Documents\export_apimcli\api-manager\INT\applications\support-interne\TEST-UNITAIRE 2024-03-26 09:26:54,991 [JsonApplicationExporter] INFO : Successfully exported application to folder: C:\Users\caxwayac-e\Documents\export_apimcli\api-manager\INT\applications\support-interne\TEST-UNITAIRE

caxwayac-e@DWVD006145 MINGW64 ~/Documents/apim-cli-1.13.5/scripts $ grep -i "KERBEROS" "C:\Users\caxwayac-e\Documents\export_apimcli\api-manager\INT\applications" -R | grep codeAramis
"customProperties" : { "codeAramis" : "", "domaine" : "", "roles" : "", "idAramis" : "2246" },`

Rennaud commented 3 weeks ago

Hello,

I also reproduce it in an API Manager with : 7 APIs, 5 remote hosts, 5 organizations, 14 users and 20 applications. I got the error when I don't apply any filter on the name of the application (export of the 20 Applications). I got the error when I filter on the name of the application that export more than 1 application I didn't got the error when I filter on one application that export only one application