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

many: add support for user daemons in "snapctl services" #13806

Conversation

Meulengracht
Copy link
Member

Introduce matching functionality for "snapctl services" as in "snap services" by this PR #13381.

"Snapctl services" is one of the few commands that can run without being root user, which means we cannot make any assumptions around the user running the command, introducing the same decision logic around how to deal with the caller.

@Meulengracht Meulengracht added this to the 2.63 milestone Apr 9, 2024
@github-actions github-actions bot added the Needs Documentation -auto- Label automatically added which indicates the change needs documentation label Apr 9, 2024
…ng the same --user/--global switches as "snap services"
@Meulengracht Meulengracht force-pushed the feature/user-services-snapctl-status branch from 0586d29 to 056d30c Compare April 11, 2024 12:48
@Meulengracht Meulengracht marked this pull request as ready for review April 11, 2024 13:43
Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

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

thanks

Copy link
Collaborator

@ernestl ernestl left a comment

Choose a reason for hiding this comment

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

Looks good thanks, very minor comments

overlord/hookstate/ctlcmd/services.go Outdated Show resolved Hide resolved
if isGlobal {
return servicestate.NewStatusDecorator(progress.Null)
} else {
return servicestate.NewStatusDecoratorForUid(progress.Null, ctx, uid)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This route is not covered in testing.

Copy link
Member Author

Choose a reason for hiding this comment

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

This function is mocked intentionally - if we use NewStatusDecoratorForUid then it will start to contact the snapd user client session which is unfortunate to start spinning up in all tests that use this. Instead the mock verifies that newStatusDecorator is invoked with the expected arguments, and fakes the responses from from the status decorator.

The NewStatusDecoratorForUid functionality, along with the user-session agent is tested independently.

Copy link
Contributor

@bboozzoo bboozzoo left a comment

Choose a reason for hiding this comment

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

LGTM assuming comments from @ernestl are addressed

@Meulengracht Meulengracht merged commit b6241cc into canonical:master Apr 12, 2024
38 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Documentation -auto- Label automatically added which indicates the change needs documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants