Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[APICTL-4.1.0] No error message occurs when using apictl to import an API with incorrectly formatted params.yaml #2389

Closed
SameeraSI opened this issue Jan 17, 2024 · 0 comments · Fixed by wso2/product-apim-tooling#1055

Comments

@SameeraSI
Copy link

SameeraSI commented Jan 17, 2024

Description

When using APICTL to modify an existing API with an exported zip file of that API along with a params.yaml, the APICTL indicates a success message. However, the structure of the params.yaml file used differs from the structure outlined in the documentation [1].

The code below is used within the params.yaml file:

environments:
  - name: dev
    endpoints:
      production:
          url: https://www.abc.com:8096/test/test
      sandbox:
          url: https://www.abc.com:8096/test/test
      sessionManagement: transport
      sessionTimeOut: 120000
    deploymentEnvironments:
      - displayOnDevportal: true
        deploymentEnvironment: Default
        deploymentVhost: test.com

If the above mentioned code is used in the params.yaml file to update an API with the API zip file, the endpoints will be modified to localhost.
296201603-80e83d0b-8207-4c1c-864b-2b5369a38107

However, APICTL indicates a success message instead of giving an error.
296201412-d0188a6a-3111-4b9f-a960-63d886d40568

The corrected params.yaml code should be as follows,

environments:
 - name: dev
   configs:
     endpoints:
       production:
           url: https://www.abc.com:8096/test/test
       sandbox:
           url: https://www.abc.com:8096/test/test
       sessionManagement: transport
       sessionTimeOut: 120000
     deploymentEnvironments:
       - displayOnDevportal: true
         deploymentEnvironment: Default
         deploymentVhost: test.com

In tested params.yaml code, the ”configs:” line is missing.

This needs to be fixed since it should throw an error on the APICTL tool while updating an API with an invalid params.file

[1] https://apim.docs.wso2.com/en/latest/install-and-setup/setup/api-controller/advanced-topics/configuring-environment-specific-parameters/#defining-the-parameters-file-for-an-api

Steps to Reproduce

Deployed the PizzaShack API from the Publisher Portal and the endpoints of the PizzaShack API were as follows,
296200356-1e5f392b-a434-4399-be93-7b7b32fe3850-1
Then exported PizzaShack API with APICTL.

Then we created a params.yaml file using the below code,

environments:
  - name: dev
    endpoints:
      production:
          url: https://www.abc.com:8096/test/test
      sandbox:
          url: https://www.abc.com:8096/test/test
      sessionManagement: transport
      sessionTimeOut: 120000
    deploymentEnvironments:
      - displayOnDevportal: true
        deploymentEnvironment: Default
        deploymentVhost: test.com

In the next step, we used the above params.yaml file and the previously expoted API zip file to update the PizzaShack API using the following command in APICTL,
apictl import api -f PizzaShackAPI_1.0.0.zip -e dev -k --params params.yaml --preserve-provider=false --rotate-revision --update=true --verbose

The APICTL showed “Response : API imported successfully. Successfully imported API”. A screenshot is below,
296201412-d0188a6a-3111-4b9f-a960-63d886d40568-2

Because of above step the API endpoints were changed as follows to localhost instead of defined value in the params.file,
296201603-80e83d0b-8207-4c1c-864b-2b5369a38107

Additionally the correct params.yaml template should be as follows,

environments:
 - name: dev
   configs:
     endpoints:
       production:
           url: https://www.abc.com:8096/test/test
       sandbox:
           url: https://www.abc.com:8096/test/test
       sessionManagement: transport
       sessionTimeOut: 120000
     deploymentEnvironments:
       - displayOnDevportal: true
         deploymentEnvironment: Default
         deploymentVhost: test.com

Then we updated the same PizzaShack API using corrected params.yaml file along with API zip using APICTL. The api APICTL showed as “Response : API imported successfully.Successfully imported API.” as below,
296202091-e458371e-dd08-40a5-a965-362b8753f2d4

Also the API endpoints were updated correctly,
Screenshot 2024-01-17 at 13 55 46

Affected Component

APICTL

Version

4.1.0

Environment Details (with versions)

No response

Relevant Log Output

No response

Related Issues

No response

Suggested Labels

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant