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

api: fix unattended-upgrades for pkg not installed #2810

Merged
merged 2 commits into from
Oct 27, 2023

Conversation

lucasmoura
Copy link
Contributor

@lucasmoura lucasmoura commented Oct 24, 2023

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

  • I have updated or added any unit tests accordingly
  • I have updated or added any integration tests accordingly
  • Changes here need to be documented, and this was done in:

Does this PR require extra reviews?

  • Yes
  • No

@@ -145,6 +155,21 @@ def status() -> UnattendedUpgradesStatusResult:


def _status(cfg: UAConfig) -> UnattendedUpgradesStatusResult:
if not apt.is_installed("unattended-upgrades"):
return UnattendedUpgradesStatusResult(
Copy link
Contributor

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?

Copy link
Contributor Author

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

@lucasmoura lucasmoura force-pushed the fix-unattended-upgrades-endpoint branch from 76e05fc to 76730ef Compare October 25, 2023 14:43
@lucasmoura lucasmoura force-pushed the fix-unattended-upgrades-endpoint branch from 76730ef to a10bffe Compare October 25, 2023 17:02
Comment on lines 1853 to 1856
UNATTENDED_UPGRADES_UNINSTALLED = NamedMessage(
"unattended-upgrades-uninstalled",
"unattended-upgrades packages is not installed",
)
Copy link
Collaborator

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

Suggested change
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"),
)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch

@lucasmoura lucasmoura force-pushed the fix-unattended-upgrades-endpoint branch 2 times, most recently from 7a15fda to 3b51bf0 Compare October 26, 2023 13:04
debian/po/pt_BR.po Outdated Show resolved Hide resolved
uaclient/messages/__init__.py Outdated Show resolved Hide resolved
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
@lucasmoura lucasmoura force-pushed the fix-unattended-upgrades-endpoint branch from 3b51bf0 to 2347f2f Compare October 27, 2023 14:58
@renanrodrigo renanrodrigo merged commit 358487f into release Oct 27, 2023
9 of 10 checks passed
@renanrodrigo renanrodrigo deleted the fix-unattended-upgrades-endpoint branch October 27, 2023 15:00
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.

4 participants