Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
snap: auto-import assertions from block devices #2044
Conversation
mvo5
added some commits
Sep 30, 2016
mvo5
closed this
Sep 30, 2016
mvo5
reopened this
Sep 30, 2016
| + "github.com/snapcore/snapd/osutil" | ||
| +) | ||
| + | ||
| +const autoImportsName = "auto-imports.asserts" |
| + } | ||
| + mountPoint := l[4] | ||
| + mountSrc := l[9] | ||
| + // FIXME: premature optimization? |
| + | ||
| +type cmdAutoImport struct{} | ||
| + | ||
| +var shortAutoImportHelp = i18n.G("Auto import assertions") |
| + | ||
| +var shortAutoImportHelp = i18n.G("Auto import assertions") | ||
| + | ||
| +var longAutoImportHelp = i18n.G("This command imports all assertions from block devices that are called 'auto-imports.assertions'") |
niemeyer
Sep 30, 2016
•
Contributor
"The auto-import command imports assertions found in the auto-import.assert file in mounted devices."
| + return ErrExtraArgs | ||
| + } | ||
| + | ||
| + // SUCKS: racy because the mount is not done when the script is |
niemeyer
Sep 30, 2016
Contributor
Can we do something a bit nicer here, such as trying to stat things more than once depending on the resulting error, to account for such delays?
mvo5
Oct 2, 2016
Collaborator
This gets fixed in #2047 which builds on top of this, the race goes away once we start mounting stuff ourself instread of waiting for it.
mvo5
closed this
Oct 3, 2016
|
I've just tested this (by merging this PR into current master and installing that into my ubuntu-core branch) and it doesn't seem to pick up block devices that are present at boot. I did this to make a disk image to attach in qemu: $ genisoimage -volid cidata -joliet -rock -o assertions.disk auto-import.assert Then if I invoke kvm like so: $ kvm -m 512 -redir :8022::22 -serial stdio my_output.img -drive file=assertions.disk and go through console-conf, ssh in and run snap known system-user there is no output. Running it by hand works: $ sudo snap auto-import --mount /dev/sdb And also if I boot the image without the disk attached and then use qemu monitor to attach the drive, the assertion is processed. Looking into the logs, I find this:
(and a host of amusing errors like this:
but that's another sort of problem I guess) So I guess something about the mount namespace is not set up quite appropriately when the snap.autoimport.service runs? |
|
Ah I may have been testing the wrong version of the code (gh was doing a bad job of telling me which PRs were closed). It still fails with master though, like this this time:
which seems reasonably impossible, I'll file a bug rather than commenting on closed PRs I guess... |
mvo5 commentedSep 30, 2016
This branch adds a new
snap auto-importcommand that is run on boot and also on each adding of a block device.