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

cmd/snap-bootstrap: no error when not input devices are found #8490

Merged
merged 2 commits into from Apr 14, 2020

Conversation

bboozzoo
Copy link
Collaborator

@bboozzoo bboozzoo commented Apr 14, 2020

Do not error out when no matching input devices are present. Also, tweak the snapd.recovery-chooser-trigger.service to start only when there are input devices at /dev/input/event*.

Related: https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1870212

cc @xnox

…dev/input

Make the recovery chooser trigger service depend on /dev/input being non-empty.
This will make systemd skip the service when there are no input devices.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
@bboozzoo bboozzoo added the UC20 label Apr 14, 2020
@bboozzoo bboozzoo force-pushed the bboozzoo/uc20-no-err-when-no-input branch from d402a9b to b7a1b1d Compare April 14, 2020 07:55
There is no way to trigger the recovery when there are no matching input devices
available in the system. This is not an error, so the exit status should still
be 0.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
@bboozzoo bboozzoo force-pushed the bboozzoo/uc20-no-err-when-no-input branch from b7a1b1d to 706cac6 Compare April 14, 2020 07:55
Copy link
Contributor

@mvo5 mvo5 left a comment

Choose a reason for hiding this comment

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

Thank you!

Copy link
Contributor

@stolowski stolowski left a comment

Choose a reason for hiding this comment

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

LGTM, with one nitpick.

logger.Noticef("trigger not detected")
return nil
case triggerwatch.ErrNoMatchingInputDevices:
logger.Noticef("no matching input devices")
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps you could log err string (also above) instead of explicit message?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The logger is already set up to log to stderr or whichever other place that is correct in this context.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, maybe I wasn't clear, what I meant is:

logger.Noticef("%s", err)

@mvo5 mvo5 merged commit 0ed5ef1 into snapcore:master Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants