Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

App-Handling failed on API Re-Creation when org is removed #73

Closed
hakila opened this issue Jun 2, 2019 · 13 comments
Closed

App-Handling failed on API Re-Creation when org is removed #73

hakila opened this issue Jun 2, 2019 · 13 comments
Assignees
Labels
bug Something isn't working done The issue is merged into the development branch and with that part of the next release. next release Planned for the next release

Comments

@hakila
Copy link
Contributor

hakila commented Jun 2, 2019

I have api TEST Minimum Stay (Category 06) Rules already defined and published. It has orgs ATP_ATP_Org, X91_91_Org,ATP_CUS_Org and Apps ATP_ATP_Apps, X91_91_App,ATP_CUS_App. But i could not get the image due to bug in 1.5.1.
Now I tried the same API to upload image with 1.5.2 release. In the the cofig file , I have everything same except the orgs and apps. ATP_ATP_Org, X91_91_Org .ATP_ATP_Apps, X91_91_App . If you notice, I dont have ATP_CUS_Org, ATP_CUS_App. I expected the api that was existed before is updated with latest orgs (ATP_ATP_Org, X91_91_Org) and apps (ATP_ATP_Apps, X91_91_App) and with image uploaded.
It seems it created new api with same name and path but failed with attached error.
If you see the attached log
2938 INFO APIChangeState| Changed property: applications[Desired: '[[ATP_ATP_Apps], [X91_91_App]]' vs Actual: '[[X91_91_App], [ATP_CUS_App], [ATP_ATP_Apps]]']
Desired state is correct. But when applying
6101 INFO APIManagerAdapter| Creating API-Access for the following apps: '[[X91_91_App], [ATP_CUS_App], [ATP_ATP_Apps]]'

Seems there is inconsistency here. As it failed with exception, I assume it could not deleted the old api leaving two apis at the end. Correct me if I am wrong.
1.5.2 img test issue.txt
1.5.2 img test issue.txt
1.5.2 img test issue.txt

@hakila
Copy link
Contributor Author

hakila commented Jun 2, 2019

issue73

Attaching the api manager ui image showing two apis after running 1.5.2-1 script.

@hakila
Copy link
Contributor Author

hakila commented Jun 3, 2019

Also tested same api with no changes in orgs and apps in the existed api . It worked fine and at the end I am left with one api . But if there are changes in orgs and apps , then it is throwing exceptions leaving two apis at the end. This is leading to inconsistent behaviour. Is it possible to fix this asap?

@hakila
Copy link
Contributor Author

hakila commented Jun 3, 2019

This is somewhat similar to #56. #56 is failing with 404. This scenario is failing with 400. Is something got broken while fixing #56?

@cwiechmann cwiechmann self-assigned this Jun 3, 2019
@cwiechmann
Copy link

cwiechmann commented Jun 3, 2019

@hakila, I assume you are running the tool with default-settings for clientAppsMode & clientOrgsMode, both default to "add". Can you confirm this❓

@cwiechmann
Copy link

...., then it is throwing exceptions leaving two apis at the end. This is leading to inconsistent behaviour. Is it possible to fix this asap?

In general, there is actually no such thing like a controlled roll-back when something goes wrong. For instance in your case, the permission couldn't be set for that API, hence you see the "work in progress" state. Normally the following should happen:
Create new API --> Configured this new API --> Delete old API
But in your case:
Create new API --> Configured this new API --> Failure
The old API wasn't deleted and that's why you see two APIs at the same time.

@hakila
Copy link
Contributor Author

hakila commented Jun 3, 2019

scripts/run-swagger-import.sh -a samples/petstore.json -c samples/minimal-config.json -f true I am invoking like this. I am not sure of default-settings for clientAppsMode & clientOrgsMode? How they can be set?
https://github.com/Axway-API-Management-Plus/apimanager-swagger-promote/wiki/1.-General-Information does not give those details.

@hakila
Copy link
Contributor Author

hakila commented Jun 3, 2019

Just saw the help for the script. Yes , clientAppsMode & clientOrgsMode, both default to "add"

@cwiechmann
Copy link

Okay, in that case I will create an Integration-Test covering your scenario. Let's see if I'm able to reproduce the issue.

@cwiechmann
Copy link

cwiechmann commented Jun 3, 2019

The following must happen in the Test-Case:

  1. Create a published API and grant access to 4 orgs and subscribe with 4 Apps
    2.1. Simulate a change, which requires a Re-Create of this API (Swagger-File change)
    2.2. Additionally remove permission to one org and remove one Client-App
    Everything running with default clientAppsMode: add & clientOrgsMode: add

Expected behavior: Existing API is re-created and only the smaller set of Orgs & Apps are handled.

@cwiechmann
Copy link

I have created a new Test-Case: UpdateOrgsAndAppsDuringReCreationTestIT.java and with that successfully replicated the problem.

@cwiechmann cwiechmann added bug Something isn't working next release Planned for the next release labels Jun 3, 2019
@cwiechmann cwiechmann changed the title Tested #58 with new release 1.5.2-1. Seeing exceptions App-Handling failed on API Re-Creation when org is removed Jun 3, 2019
@hakila
Copy link
Contributor Author

hakila commented Jun 3, 2019

Glad you were able to reproduce. Also can you give some info on
-clientAppsMode <ignore|replace|add> Controls how configured Client-Applications are treated. Defaults to add!
-clientOrgsMode <ignore|replace|add> Controls how configured Client-Organizations are treated. Defaults to add!

I assume add option is to add new orgs and do not do anything with existing. But in this case, it does not behave like add rather it worked like replace. Please give some information on this.

@cwiechmann
Copy link

Created a dedicated branch actually failing due to that issue:
https://github.com/Axway-API-Management-Plus/apimanager-swagger-promote/tree/bugfix-issue-58
Needs a fix!

cwiechmann pushed a commit that referenced this issue Jun 13, 2019
@cwiechmann cwiechmann added the done The issue is merged into the development branch and with that part of the next release. label Jun 13, 2019
@cwiechmann
Copy link

Released with version 1.5.3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working done The issue is merged into the development branch and with that part of the next release. next release Planned for the next release
Projects
None yet
Development

No branches or pull requests

2 participants