-
-
Notifications
You must be signed in to change notification settings - Fork 782
Add support to force recreation of packs virtualenvs #5167
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
Add support to force recreation of packs virtualenvs #5167
Conversation
st2common/bin/st2ctl
Outdated
| echo " --register-policies Register all policies." | ||
| echo " --register-configs Register all configuration files." | ||
| echo " --register-setup-virtualenvs Create Python virtual environments for all the registered packs." | ||
| echo " --register-setup-virtualenvs-force-recreation (Delete and re-)create Python virtual environments for all the registered packs." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about the shorter version, how this would sound instead?
- --register-setup-virtualenvs-force-recreation
+ --register-setup-recreate-virtualenvsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it especially because it's more readable. Done & pushed.
I'll have to go to sleep now and will proceed with the testing tomorrow as well as looking into failing tests (if any).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OOH! The bike shed needs another coat of paint ![]()
Let's shorten that even farther:
- --register-setup-virtualenvs-force-recreation
+ --register-recreate-virtualenvsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm resisting the recommendation to drop "register", even though re/creating virtualenvs doesn't actually "register" anything. Alas, keeping "register" keeps the args consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I like --register-recreate-virtualenvs since it's the shortest :D
IIRC, register prefix was added at some point in the past due to some oslo config limitations or similar, but I forget the details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there seems to be a limitation that requires the --register-xxx prefix. I can dig deeper into if needed but will focus on the failing tests and actual issues for now.
|
Can we rename options to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for PR.
The tests are failing, because I think of a missing code change to register the new BoolOpt on the cfg, I've highlighted where I think it needs to go.
I also failed to run the command on upgrade using the artifact from this PR, which I thnk is same problem.
Also we probably should add a new test into ./st2common/tests/integration/test_register_content_script.py for the new parameter, similar to some of the ones already there for the current setup virtualenv.
st2common/bin/st2ctl
Outdated
|
|
||
| function register_content() { | ||
| ALLOWED_REGISTER_FLAGS='--register-all --register-actions --register-aliases --register-runners --register-policies --register-rules --register-sensors --register-triggers --register-configs --register-setup-virtualenvs --register-fail-on-failure --register-no-fail-on-failure --verbose' | ||
| ALLOWED_REGISTER_FLAGS='--register-all --register-actions --register-aliases --register-runners --register-policies --register-rules --register-sensors --register-triggers --register-configs --register-setup-virtualenvs --register-setup-recreate-virtualenvs --register-fail-on-failure --register-no-fail-on-failure --verbose' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the new option need to get added to the sudo flags?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it does need to run using sudo.
|
The context is that a new flag is a nice to have addition that just mimicks the following construction, required for 3.4 upgrade only: @m4dcoder I think at this point refactoring existing params is undesired as a last-minute release enhancement and would be an overkill breaking change. |
@armab we don't change any defaults so I don't see how this is could be a breaking change. Do I miss something? |
|
@winem I think @armab was referring to @m4dcoder's request to rename the options:
Renaming the options would be a breaking change. Merely adding a new option as this PR does, is not a breaking change, IMO. |
|
Yeah, I agree with @cognifloyd. In the future, I maybe be OK with renaming it (if we can work around oslo.config limitations), but for this last minute change I'm for |
|
Try pinning That package just had a release like 4 hours ago: And they might have broken something we were relying on, or fixed a bug that we were relying on. |
|
Oh saw that you just pinned it. So let's see if that fixes the issue. @cognifloyd thanks for clarifying it. Now it makes sense. |
|
Signed off my review comments, I've not had chance to try on an upgrade to check command works - but didn't want my comments to be a blocker for merging. But if it's been tested on an upgrade, then I'm happy. |
|
Travis needs payment. I'll be out for an hour and fix it after that. |
|
@amanda11 your input was actually very helpful and is always appreciated. And I added an integration test. :) |
|
Paid off Travis-CI, adding a commit to kick CI again. |
|
🎉 |
This PR adds support for
--register-setup-virtualenvs-force-recreationto st2ctl. Use-case is, like we have it now with the upgrade to st2 v3.4, an upgrade of the Python version inside the virtual environments for example.I'll run some tests now but wanted to provide the PR already so that others who ran into this issue can give it a try, too.