-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fixing sentinel command response #3191
base: master
Are you sure you want to change the base?
Conversation
@dvora-h Can you please take a look. |
@vladvildanov Can you please take a look ? |
@mahigupta Thanks for your input! I'll also include @gerzse into this |
Hello, |
@mahigupta Looks fine 👌 Working on fixing CI, docker-compose was removed from default commands in Ubuntu 22.04 LTS runner |
@vladvildanov @gerzse Ci fixed now to go ahead with this PR ? |
@@ -230,15 +231,24 @@ async def execute_command(self, *args, **kwargs): | |||
if "once" in kwargs.keys(): | |||
kwargs.pop("once") | |||
|
|||
# Check if command suppose to return boolean response. | |||
bool_resp = bool(kwargs.get("bool_resp", False)) |
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.
I think we can just go with bool_resp = bool(kwargs.pop("bool_resp", False))
, so we can avoid additional if condition.
] | ||
responses = await asyncio.gather(*tasks) | ||
|
||
if bool_resp: |
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.
I think we need to change the behaviour here to be backward compatible. The default behaviour should be still "return True", if you want to return the actual responses you have to explicitly specify this.
So instead we would likely to have something like return_responses=True
flag and we will return actual response if it will be explicitly set.
@@ -257,12 +258,22 @@ def execute_command(self, *args, **kwargs): | |||
if "once" in kwargs.keys(): | |||
kwargs.pop("once") | |||
|
|||
# Check if command suppose to return boolean response. | |||
bool_resp = bool(kwargs.get("bool_resp", False)) |
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.
See above
for sentinel in self.sentinels: | ||
responses.append(sentinel.execute_command(*args, **kwargs)) | ||
|
||
if bool_resp: |
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.
See above
Pull Request check-list
Description of change
For #3139
execute_command
function to parse sentinel command response correctly and don't return by default True