summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmorph-cache-server27
1 files changed, 26 insertions, 1 deletions
diff --git a/morph-cache-server b/morph-cache-server
index dbf6785..ad102bf 100755
--- a/morph-cache-server
+++ b/morph-cache-server
@@ -303,7 +303,32 @@ class MorphCacheServer(cliapp.Application):
else:
response.status = 404
logging.debug('artifact %s does not exist' % basename)
-
+
+ @app.get('/postartifacts')
+ def artifact():
+ return '''
+ <form action="/postartifacts" method="post">
+ artifacts: <input name="artifacts" type="text" />
+ </form>
+ '''
+
+ @app.post('/postartifacts')
+ def do_artifacts():
+ artifacts = request.forms.get('artifacts').split(',')
+ results = {}
+
+ logging.debug('Received a POST request for /postartifacts')
+
+ for artifact in artifacts:
+ logging.debug('Checking whether artifact %s is in the cache'
+ % artifact)
+ basename = self._unescape_parameter(artifact)
+ filename = os.path.join(self.settings['artifact-dir'], basename)
+
+ results[artifact] = os.path.exists(filename)
+
+ return results
+
root = Bottle()
root.mount(app, '/1.0')