diff options
author | Adam Coldrick <adam.coldrick@codethink.co.uk> | 2015-04-09 16:27:42 +0000 |
---|---|---|
committer | Adam Coldrick <adam.coldrick@codethink.co.uk> | 2015-04-10 13:52:27 +0000 |
commit | 9964c35e2a0355bbbe9d39119de309783d9b383e (patch) | |
tree | 50d806fdf7b3228fea21b65ec721ac4cb99aaf35 | |
parent | c5d8549f4b27e35c47388796b13f76cea7b38c06 (diff) | |
download | morph-9964c35e2a0355bbbe9d39119de309783d9b383e.tar.gz |
fixup: Some fixes for ostreeartifactcache
-rw-r--r-- | morphlib/ostreeartifactcache.py | 17 |
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.', |