-
Notifications
You must be signed in to change notification settings - Fork 75
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
api: fix unattended-upgrades for pkg not installed #2810
Conversation
@@ -145,6 +155,21 @@ def status() -> UnattendedUpgradesStatusResult: | |||
|
|||
|
|||
def _status(cfg: UAConfig) -> UnattendedUpgradesStatusResult: | |||
if not apt.is_installed("unattended-upgrades"): | |||
return UnattendedUpgradesStatusResult( |
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.
Not sure how viable it is or maybe it is the expected behaviour, will this have the return code != 0 after it is run on the cli?
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.
No, it won't @CalvoM and I guess we don't want it to return non-zero, because it is not an error per se
76e05fc
to
76730ef
Compare
76730ef
to
a10bffe
Compare
uaclient/messages/__init__.py
Outdated
UNATTENDED_UPGRADES_UNINSTALLED = NamedMessage( | ||
"unattended-upgrades-uninstalled", | ||
"unattended-upgrades packages is not installed", | ||
) |
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.
Sorry I missed this initially
UNATTENDED_UPGRADES_UNINSTALLED = NamedMessage( | |
"unattended-upgrades-uninstalled", | |
"unattended-upgrades packages is not installed", | |
) | |
UNATTENDED_UPGRADES_UNINSTALLED = NamedMessage( | |
"unattended-upgrades-uninstalled", | |
t.gettext("unattended-upgrades packages is not installed"), | |
) |
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.
Good catch
7a15fda
to
3b51bf0
Compare
When unattended-upgrades is uninstalled in the machine, we display an error on the api endpoint that doesn't directly tell the user that the package is not installed. We are updating the logic to properly tell the user that the package is not installed. Fixes: #2807
3b51bf0
to
2347f2f
Compare
Why is this needed?
When unattended-upgrades is uninstalled in the machine, we display an error on the api endpoint that doesn't directly tell the user that the package is not installed. We are updating the logic to properly tell the user that the package is not installed.
Fixes: #2807
Test Steps
Run the modified integration test
Checklist
Does this PR require extra reviews?