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

policy condition, avoid double initialization #6235

Merged

Conversation

kapilt
Copy link
Collaborator

@kapilt kapilt commented Oct 21, 2020

closes #6217


@kapilt
Copy link
Collaborator Author

kapilt commented Oct 22, 2020

would like to see a cli test here

@kkessels
Copy link
Contributor

I checked out the branch with your changes and ran validate and run with same policy as mentioned in the issue. It seems this has solved the issue 👍

validate:

custodian.commands:INFO Configuration valid: /Users/kevinkessels/Projects/policies/policy.yaml

run:

custodian.commands:DEBUG Loaded file /Users/kevinkessels/Projects/policies/policy.yaml. Contains 1 policies
custodian.policy:INFO Skipping policy:cloudfunction due to execution conditions

@kapilt
Copy link
Collaborator Author

kapilt commented Oct 27, 2020

digging into this more while writing a test, the aws provider ends up creating a new policy instance when doing provider region initialization (auto filtering policies by region), which is why this didn't exhibit previously for the cli tests, other providers default to returning the previous policy instance, hence the double initialization error. leaning to just merging this as is, as we'll need to refactor the cli tests to enable reuse within the other providers test suites.

@kapilt kapilt merged commit 0449ced into cloud-custodian:master Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custodian errors when using example conditional policy with a gcp resource
2 participants