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

reload hooks between uses #227

Merged
merged 3 commits into from Apr 14, 2020
Merged

reload hooks between uses #227

merged 3 commits into from Apr 14, 2020

Conversation

ITProKyle
Copy link
Contributor

Why This Is Needed

Hooks that define a global variable when imported that relies on an environment variable set by Runway (e.g. AWS_DEFAULT_REGION) will retain its original value across uses.

While this is the appropriate functionally from a python standpoint and should be expected, historically this functioned differently do to the use of subprocess.Popen being used to invoke the stacker cli. This created a different process for each region allowing the global values to change.

If merged, this change should be considered for removal in the next major release so that the global variables function as expected.

What Changed

Added

  • added try_reload option to runway.util.load_object_from_string that will use importlib.reload to reimport a module if it has already been imported and is not a builtin module

Fixed

  • global variables in hooks are now reloaded between uses to mimic functionality present in >1.5.0

@ITProKyle ITProKyle added the bug Something isn't working label Apr 14, 2020
@ITProKyle ITProKyle marked this pull request as ready for review April 14, 2020 23:00
@troyready troyready merged commit f4685a7 into onicagroup:master Apr 14, 2020
@ITProKyle ITProKyle deleted the bugfix/reload-hooks branch April 15, 2020 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants