forked from hysds/container-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontainer-met.py
More file actions
executable file
·27 lines (27 loc) · 970 Bytes
/
container-met.py
File metadata and controls
executable file
·27 lines (27 loc) · 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python
from __future__ import print_function
import sys
import json
import os
import osaka.main
import hysds_commons.request_utils
from hysds.celery import app
if __name__ == "__main__":
'''
Main program routing arguments to file
'''
if len(sys.argv) != 6:
print("[ERROR] Metadata dataset.json generation requires a version, and archive file",sys.stderr)
sys.exit(-1)
#Read arguments
ident=sys.argv[1]
version=sys.argv[2]
product=sys.argv[3]
repo=sys.argv[4]
digest=sys.argv[5]
url = os.path.join(repo,os.path.basename(product))
#OSAKA call goes here
osaka.main.put("./"+product,url,params={"encrypt":{"type":"AES256"}})
metadata = {"name":ident,"version":version,"url":url,"resource":"container", "digest":digest}
hysds_commons.request_utils.requests_json_response("POST", os.path.join(app.conf["MOZART_REST_URL"],"container/add"), data=metadata, verify=False)
sys.exit(0)