From 2c2fdfeb605b2d393336d1b03e18c6122f293b3e Mon Sep 17 00:00:00 2001 From: Adam Coldrick Date: Wed, 1 Apr 2015 13:03:55 +0000 Subject: fixup: Use archive_z2 mode for cache server --- morph-cache-server | 15 ++++++++++++--- 1 file 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 -- cgit v1.2.1