summaryrefslogtreecommitdiff
path: root/morph-cache-server
diff options
context:
space:
mode:
Diffstat (limited to 'morph-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