3 # ============LICENSE_START=======================================================
4 # ONAP : ccsdk distribution web
5 # ================================================================================
6 # Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
8 # ================================================================================
9 # Licensed under the Apache License, Version 2.0 (the "License");
10 # you may not use this file except in compliance with the License.
11 # You may obtain a copy of the License at
13 # http://www.apache.org/licenses/LICENSE-2.0
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
20 # ============LICENSE_END=========================================================
23 # opm = ODLUX package manager
24 # install odlux application inside of the container
25 # $1 install|uninstall
27 # $3 zip file to add(extract)
38 # $2 zip file (optional)
39 def run_install(name, index=0, file=None):
41 error("no name given")
42 add_application(name, index, file)
46 # install application from url
50 def run_install_from_url(url, name=None, index=0):
53 print("installing from url...")
54 localFile = getRandomTempFile()
55 download(url,localFile)
56 if (name is None) or (index==0):
57 infos = autoDetectInfosFromJar(localFile)
62 index = infos['index']
63 add_application(name,index,localFile)
65 # uninstall application
67 def run_uninstall(name):
69 error("no name given")
70 apps = load_applications()
71 apps = [app for app in apps if app['name']!=name]
72 write_applications(apps)
76 apps = load_applications()
77 print('installed apps')
79 print('{} {}'.format(app['index'],app['name']))
82 print("ODLUX package manager")
83 print("=====================")
85 print(" opm.py install --name myApplication --index 23 --file app.zip")
86 print(" opm.py install --url https://link-to-my-odlux-application.jar")
88 print(" opm.py uninstall --name myApplication")
91 print('ERROR: {}'.format(msg))
104 name=args.pop(0) if len(args)>0 else error("no name given")
106 index=int(args.pop(0)) if len(args)>0 else error("no index given")
108 file=args.pop(0) if len(args)>0 else error("no file given")
110 url=args.pop(0) if len(args)>0 else error("no file given")
112 print("command={} name={} index={} file={} url={}".format(cmd,name,index, file, url))
116 run_install_from_url(url, name, index)
118 run_install(name,index,file)
119 elif cmd=='uninstall':