summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--morphlib/ostreeartifactcache.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/morphlib/ostreeartifactcache.py b/morphlib/ostreeartifactcache.py
index a7602144..2854a1cc 100644
--- a/morphlib/ostreeartifactcache.py
+++ b/morphlib/ostreeartifactcache.py
@@ -28,6 +28,7 @@ from gi.repository import GLib
import morphlib
from morphlib.artifactcachereference import ArtifactCacheReference
+
class OSTreeArtifactCache(object):
"""Class to provide the artifact cache API using an OSTree repo."""
@@ -97,9 +98,16 @@ class OSTreeArtifactCache(object):
shutil.copy(location, filename)
def copy_from_remote(self, artifact, remote):
- """Get 'artifact' from remote artifact cache and store it locally."""
+ """Get 'artifact' from remote artifact cache and store it locally.
+
+ This takes an Artifact object and a RemoteArtifactCache. Note that
+ `remote` here is not the same as a `remote` for and OSTree repo.
+
+ """
if remote.method == 'tarball':
with self._get_file_from_remote(artifact, remote) as location:
+ if artifact.basename().split('.', 2)[1] == 'stratum':
+ self.put_non_ostree_artifact(artifact, location)
try:
tempdir = tempfile.mkdtemp(dir=self.cachedir)
try:
@@ -109,9 +117,10 @@ class OSTreeArtifactCache(object):
finally:
shutil.rmtree(tempdir)
except tarfile.ReadError:
- # Reading the artifact as a tarball failed, so it must be a
- # single file (for example a stratum artifact).
- self.put_non_ostree_artifact(artifact, location)
+ # Reading the tarball failed, and we expected a
+ # tarball artifact. Something must have gone
+ # wrong.
+ raise
elif remote.method == 'ostree':
self.status(msg='Pulling artifact for %(name)s from remote.',