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: u.pro.services.enable.v1 (SC-1619) #2904

Closed
wants to merge 4 commits into from
Closed

Conversation

orndorffgrant
Copy link
Collaborator

@orndorffgrant orndorffgrant commented Jan 3, 2024

Why is this needed?

This adds an API for enabling services, which will be useful for other software wanting to enable pro services in a dependable way.

Test Steps

New behave tests should pass

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

Copy link

github-actions bot commented Jan 3, 2024

Jira: SC-1619

GitHub Issues: No GitHub issues are fixed by this PR. (No commits have Fixes: #### references)

Launchpad Bugs: No Launchpad bugs are fixed by this PR. (No commits have LP: #### references)

Documentation: The changes in this PR do require documentation changes, but those were not addressed yet.

👍 this comment to confirm that this is correct.

Copy link

github-actions bot commented Jan 3, 2024

🌎 This PR changes translatable messages. 🌏

Please select which scenarios apply. For further explanation, please read our policy on message changes.

  • New messages are being added.
    • We will ask translators to take a look and add translations if they have time, but it will not block this PR.
  • Existing messages are being changed.
    • ⚠️ Please add a comment with justification of why messages are being altered.
    • If the changes are trivial (e.g. a typo fix), then translations must be preserved.
    • If the changes are substantial, then we will ask translators to take a look and update translations if they have time, but it will not block this PR.
  • Existing messages are being deleted.
    • No special action needed.

@orndorffgrant orndorffgrant force-pushed the api-enable branch 3 times, most recently from 421cfa9 to b5f5e7c Compare January 4, 2024 13:51
@orndorffgrant orndorffgrant marked this pull request as ready for review January 4, 2024 13:57
@orndorffgrant orndorffgrant changed the title wip: api enable api: u.pro.services.enable.v1 (SC-1619) Jan 4, 2024
uaclient/entitlements/base.py Show resolved Hide resolved
features/api_enable.feature Show resolved Hide resolved
uaclient/api/u/pro/services/enable/v1.py Show resolved Hide resolved
@orndorffgrant orndorffgrant force-pushed the api-enable branch 4 times, most recently from d922a95 to 3fdd0cc Compare January 5, 2024 19:31
Copy link
Member

@renanrodrigo renanrodrigo left a comment

Choose a reason for hiding this comment

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

small nits here and there, but overall lgtm

@@ -889,6 +889,7 @@ msgid "an error while reaching {url}"
msgstr "um error ao acessar {url}"

#: ../../uaclient/messages/__init__.py:414
#: ../../uaclient/messages/__init__.py:1918
Copy link
Member

Choose a reason for hiding this comment

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

This is a duplicate message - should we reuse it?

#: ../../uaclient/messages/__init__.py:2558
#, fuzzy
msgid "The operation is not supported"
msgstr "A atualização ainda não está instalada"
Copy link
Member

Choose a reason for hiding this comment

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

"A operação não é suportada"

"reboot_required": false
}
"""
When I run shell command `pro api u.pro.status.enabled_services.v1 | jq .data.attributes.enabled_services ` with sudo
Copy link
Member

Choose a reason for hiding this comment

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

We recently landed a PR which brings simpler steps, like verify that esm-infra is enabled - we could use that here.


Scenario Outline: u.pro.services.enable.v1 container services
Given a `<release>` `<machine_type>` machine with ubuntu-advantage-tools installed
When I run `apt-get update` with sudo
Copy link
Member

Choose a reason for hiding this comment

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

We recently landed a pr which implements When I apt update - we could use it here; same for similar calls

"""
Examples:
| release | machine_type |
| jammy | lxd-vm |
Copy link
Member

Choose a reason for hiding this comment

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

cursed missing newline

) -> EnableResult:
event.set_event_mode(event_logger.EventLoggerMode.JSON)

if not _is_attached(cfg).is_attached:
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also handle the situation where a user is running as non-root ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added!

@orndorffgrant
Copy link
Collaborator Author

@renanrodrigo @lucasmoura updated!

@orndorffgrant orndorffgrant removed the next label Jan 9, 2024
@orndorffgrant orndorffgrant changed the base branch from main to next-v32 January 11, 2024 18:56
@orndorffgrant
Copy link
Collaborator Author

I'm forging ahead with #2908 and will likely refactor some of this, break into new PRs, etc. So I'll close this since it is just cluttering up our PR list

@orndorffgrant orndorffgrant deleted the api-enable branch May 17, 2024 09:30
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.

3 participants