Make register_app register all metadata
This commit is contained in:
parent
bbdd91cd77
commit
c213b0c0d8
@ -10,7 +10,6 @@ subparsers = parser.add_subparsers()
|
|||||||
parser_register_app = subparsers.add_parser('register-app')
|
parser_register_app = subparsers.add_parser('register-app')
|
||||||
parser_register_app.set_defaults(action='register-app')
|
parser_register_app.set_defaults(action='register-app')
|
||||||
parser_register_app.add_argument('app', help='Application name')
|
parser_register_app.add_argument('app', help='Application name')
|
||||||
parser_register_app.add_argument('host', help='Application subdomain')
|
|
||||||
parser_register_app.add_argument('login', nargs='?', help='Admin login')
|
parser_register_app.add_argument('login', nargs='?', help='Admin login')
|
||||||
parser_register_app.add_argument('password', nargs='?', help='Admin password')
|
parser_register_app.add_argument('password', nargs='?', help='Admin password')
|
||||||
|
|
||||||
@ -44,7 +43,7 @@ vmmgr = VMMgr(conf)
|
|||||||
lxcmgr = LXCMgr(conf)
|
lxcmgr = LXCMgr(conf)
|
||||||
if args.action == 'register-app':
|
if args.action == 'register-app':
|
||||||
# Used by app install scripts
|
# Used by app install scripts
|
||||||
vmmgr.register_app(args.app, args.host, args.login, args.password)
|
vmmgr.register_app(args.app, args.login, args.password)
|
||||||
elif args.action == 'rebuild-issue':
|
elif args.action == 'rebuild-issue':
|
||||||
# Used on VM startup
|
# Used on VM startup
|
||||||
vmmgr.rebuild_issue()
|
vmmgr.rebuild_issue()
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
import shutil
|
import shutil
|
||||||
@ -18,9 +19,11 @@ class VMMgr:
|
|||||||
self.domain = conf['host']['domain']
|
self.domain = conf['host']['domain']
|
||||||
self.port = conf['host']['port']
|
self.port = conf['host']['port']
|
||||||
|
|
||||||
def register_app(self, app, host, login, password):
|
def register_app(self, app, login, password):
|
||||||
# Register newly installed application, its subdomain and credentials
|
# Register newly installed application, its metadata and credentials
|
||||||
self.conf['apps'][app] = {'host': host,
|
with open('/var/lib/lxcpkgs/{app}/meta'.format(app)) as f:
|
||||||
|
meta = json.load(f)
|
||||||
|
self.conf['apps'][app] = {**meta,
|
||||||
'login': login if login else 'N/A',
|
'login': login if login else 'N/A',
|
||||||
'password': password if password else 'N/A',
|
'password': password if password else 'N/A',
|
||||||
'visible': False}
|
'visible': False}
|
||||||
|
Loading…
Reference in New Issue
Block a user