Skip to content

Ignore hotplug socket when collecting logs (SC-345)#985

Merged
blackboxsw merged 2 commits into
canonical:mainfrom
TheRealFalcon:fix-collect-logs
Aug 19, 2021
Merged

Ignore hotplug socket when collecting logs (SC-345)#985
blackboxsw merged 2 commits into
canonical:mainfrom
TheRealFalcon:fix-collect-logs

Conversation

@TheRealFalcon
Copy link
Copy Markdown
Contributor

@TheRealFalcon TheRealFalcon commented Aug 17, 2021

Proposed Commit Message

Ignore hotplug socket when collecting logs

Update "cloud-init collect-logs" to ignore
/run/cloud-init/hook-hotplug-cmd as this will raise the error
"/run/cloud-init/hook-hotplug-cmd` is a named pipe" if included.

Also updated logs.py to continue writing the tarball if it fails
collecting a file rather than let the exception bubble up.

LP: #1940235

Additional Context

https://bugs.launchpad.net/cloud-init/+bug/1940235

Test Steps

Start an impish image (or packages/bddeb, upload to your instance, install deb and reboot).
Run cloud-init collect-logs
On main, fails as mentioned in the bug. On this branch, shows Wrote /root/cloud-init.tar.gz having hook-hotplug-cmd excluded from the tarball. From now on, if any other error is encountered, we should see something along the lines of:

Failed collecting file(s) due to error:
[('/run/cloud-init/hook-hotplug-cmd', '/tmp/tmpbsl70bx1/cloud-init-logs-2021-08-17/run/cloud-init/hook-hotplug-cmd', '`/run/cloud-init/hook-hotplug-cmd` is a named pipe')]
Wrote /root/cloud-init.tar.gz

with the error file(s) being excluded from the tarball.

We should really add integration tests for cloud-init collect-logs. I'd like to add it to this PR if there's time.

Checklist:

  • My code follows the process laid out in the documentation
  • I have updated or added any unit tests accordingly
  • I have updated or added any documentation accordingly

Update "cloud-init collect-logs" to ignore
/run/cloud-init/hook-hotplug-cmd as this will raise the error
"/run/cloud-init/hook-hotplug-cmd` is a named pipe" if included.

Also updated logs.py to continue writing the tarball if it fails
collecting a file rather than let the exception bubble up.

LP: #1940235
@TheRealFalcon TheRealFalcon changed the title Ignore hotplug socket when collecting logs Ignore hotplug socket when collecting logs (SC-345) Aug 17, 2021
Copy link
Copy Markdown
Contributor

@paride paride left a comment

Choose a reason for hiding this comment

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

Not an authoritative review but this lgtm!

Copy link
Copy Markdown
Collaborator

@blackboxsw blackboxsw left a comment

Choose a reason for hiding this comment

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

This works for me. We'll get a noise error if other files are root read-only in /run/cloud-init (which only cloud-init should be writing anyway).

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