summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Coldrick <adam.coldrick@codethink.co.uk>2015-04-01 13:03:55 +0000
committerAdam Coldrick <adam.coldrick@codethink.co.uk>2015-04-10 13:52:26 +0000
commit2c2fdfeb605b2d393336d1b03e18c6122f293b3e (patch)
treeaeb46aa504d4bd60b22c444ab8eea400ef69d2d0
parent826e49e2791d4c45e4902396a4a59836290dc175 (diff)
downloadmorph-2c2fdfeb605b2d393336d1b03e18c6122f293b3e.tar.gz
fixup: Use archive_z2 mode for cache server
-rwxr-xr-xmorph-cache-server15
1 files changed, 12 insertions, 3 deletions
diff --git a/morph-cache-server b/morph-cache-server
index 6c7665aa..938ecb1f 100755
--- a/morph-cache-server
+++ b/morph-cache-server
@@ -38,6 +38,7 @@ defaults = {
'artifact-dir': '/var/cache/morph-cache-server/artifacts',
'port': 8080,
'ostree-port': 12324,
+ 'ostree-repo-mode': 'archive_z2',
}
@@ -68,6 +69,11 @@ class MorphCacheServer(cliapp.Application):
'path to the artifact cache directory',
metavar='PATH',
default=defaults['artifact-dir'])
+ self.settings.string(['ostree-repo-mode'],
+ 'mode of the ostree artifact cache - either '
+ 'archive_z2 or bare, for servers and users '
+ 'respectively.',
+ default=defaults['ostree-repo-mode'])
self.settings.boolean(['direct-mode'],
'cache directories are directly managed')
self.settings.boolean(['enable-writes'],
@@ -78,7 +84,8 @@ class MorphCacheServer(cliapp.Application):
def _fetch_artifacts(self, server, cacheid, artifacts):
ret = {}
- cache = OSTreeArtifactCache(self.settings['artifact-dir'])
+ cache = OSTreeArtifactCache(self.settings['artifact-dir'],
+ mode=self.settings['ostree-repo-mode'])
remote = RemoteArtifactCache('http://%s/' % server)
try:
for artifact in artifacts:
@@ -274,7 +281,8 @@ class MorphCacheServer(cliapp.Application):
@app.get('/artifacts')
def artifact():
basename = self._unescape_parameter(request.query.filename)
- cache = OSTreeArtifactCache(self.settings['artifact-dir'])
+ cache = OSTreeArtifactCache(self.settings['artifact-dir'],
+ mode=self.settings['ostree-repo-mode'])
try:
cachekey, kind, name = basename.split('.', 2)
a = ArtifactCacheReference(basename)
@@ -320,7 +328,8 @@ class MorphCacheServer(cliapp.Application):
logging.debug('Received a POST request for /artifacts')
- cache = OSTreeArtifactCache(self.settings['artifact-dir'])
+ cache = OSTreeArtifactCache(self.settings['artifact-dir'],
+ mode=self.settings['ostree-repo-mode'])
for basename in artifacts:
if basename.startswith('/'):
response.status = 500