diff options
Diffstat (limited to 'morphlib/ostreeartifactcache.py')
-rw-r--r-- | morphlib/ostreeartifactcache.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/morphlib/ostreeartifactcache.py b/morphlib/ostreeartifactcache.py index fdb7cb5d..ea659c8f 100644 --- a/morphlib/ostreeartifactcache.py +++ b/morphlib/ostreeartifactcache.py @@ -30,9 +30,9 @@ from morphlib.artifactcachereference import ArtifactCacheReference class OSTreeArtifactCache(object): """Class to provide the artifact cache API using an OSTree repo.""" - def __init__(self, cachedir): + def __init__(self, cachedir, mode): repo_dir = os.path.join(cachedir, 'repo') - self.repo = morphlib.ostree.OSTreeRepo(repo_dir) + self.repo = morphlib.ostree.OSTreeRepo(repo_dir, mode=mode) self.cachedir = cachedir def _get_file_from_remote(self, artifact, remote, metadata_name=None): @@ -126,7 +126,7 @@ class OSTreeArtifactCache(object): raise cliapp.AppException('Failed to pull %s from remote ' 'cache.' % ref) - def get(self, artifact, directory=None): + def get(self, artifact, directory=None, status=lambda a: a): """Checkout an artifact from the repo and return its location.""" cache_key, kind, name = artifact.basename().split('.', 2) if kind == 'stratum': @@ -176,7 +176,8 @@ class OSTreeArtifactCache(object): cachekey, kind, name = artifact.basename().split('.', 2) logging.debug('OSTreeArtifactCache: got %s, %s, %s' % (cachekey, kind, name)) - if self._get_artifact_cache_name(artifact) in self.repo.list_refs(): + sha = self.repo.resolve_rev(self._get_artifact_cache_name(artifact)) + if sha: self.repo.touch_ref(self._get_artifact_cache_name(artifact)) return True if kind == 'stratum' and \ |