aerogearcatalog / unifiedpush-apb

Apache License 2.0
6 stars 21 forks source link

use annotations for error handling on bind #53

Closed pb82 closed 6 years ago

pb82 commented 6 years ago

Use annotations to implement the error handling in the bind role. @cfoskin Sorry for not thinking about this earlier. Using the annotations is a lot simpler than parsing the JSON (as in https://github.com/aerogearcatalog/unifiedpush-apb/pusll/50).

How it works

Before the binding starts we check if the secret already has an annotation for the platform. The annotation is set after a variant has been created via UPS REST call and should be as valid as the config object for checking if a variant for a platform already exists.

Verification steps:

  1. Deploy the apb using this branch
  2. Create an android variant: it should work
  3. Create an iOS variant: it should work
  4. Create another android variant: it should fail
  5. Delete the failed binding: it should work
  6. Create another iOS variant: it should fail
  7. Delete the failed binding: it should work

@aliok If you need to update the name of the annotations you also need to update them in the bind role now (or we use an ansible variable).

aliok commented 6 years ago

@pb82 let me verify this one

aliok commented 6 years ago

Verified, all good.