Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
lxd: don't re-inject the same snaps #1568
Conversation
kalikiana
added some commits
Sep 22, 2017
kalikiana
self-assigned this
Sep 22, 2017
| @@ -245,6 +250,19 @@ def _inject_snap(self, name): | ||
| cmd.append('--classic') | ||
| self._container_run(cmd) | ||
| + def _same_snap(self, filepath, installed): |
sergiusens
Sep 28, 2017
Collaborator
can you please rename this _is_same_snap, then when used in conditionals it reads better -> if _is_snap_snap
|
When I tried this PR the first time, I got this printed: We should check if the file exists before running md5sum. |
kalikiana
added some commits
Oct 5, 2017
|
I built and installed the snap from your branch. The first time I run the container build, this is printed: Installing /run/core_2898.snap The second time, this is printed: Making snapcraft_x2.snap user-accessible So it seems to me that core is installed only once, but snapcraft is installed also the second time. |
|
@elopio that should be fine, a locally built snap would be |
kalikiana
requested a review
from
elopio
Oct 11, 2017
|
I think I understand what's happening here. I confirmed this behaviour checking that if I have snapcraft x3 in the host, I require 4 container builds to skip the installation. It is unfortunate because if I have snapcraft x100 in my host, I will need 100 reinstalls of the same snap in the container. But if I am right on my diagnostic here, then this sounds like a low priority bug, not a blocker for this PR, because people shouldn't be running a snapcraft that doesn't come from the store. |
elopio
approved these changes
Oct 11, 2017
+1 because I confirmed this doesn't reinstall snaps from the store.
Isn't this code just comparing hashes? I don't see any revision checking here. This PR looks good, but I can't explain the behavior @elopio is seeing. |
sergiusens
added this to the 2.35 milestone
Oct 12, 2017
| + try: | ||
| + checksum_container = check_output([ | ||
| + 'lxc', 'exec', self._container_name, '--', 'sh', '-c', | ||
| + 'test -f {0} && md5sum {0}'.format(installed)] |
|
@kalikiana can you explain more how a filename change would change the sum for a blob like the squashfs? |
|
@sergiusens The problem is that x revisions are arbitrary, so installing the same snap on two systems may lead to different filenames - different filenames won't ever be compared with my code... |
kalikiana
added some commits
Oct 13, 2017
| + # Find the current version in use in the container | ||
| + rev = check_output([ | ||
| + 'lxc', 'exec', self._container_name, '--', | ||
| + 'ls', '-l', '/snap/{}/current'.format(name)] |
kalikiana commentedSep 22, 2017
./runtests.sh static?./runtests.sh unit?Fixes: bug 1716923