Don't register package as application automatically.
This commit is contained in:
parent
3a5258ff1f
commit
fa23e4828f
@ -8,11 +8,11 @@ from vmmgr import VMMgr
|
|||||||
parser = argparse.ArgumentParser(description='VM application manager')
|
parser = argparse.ArgumentParser(description='VM application manager')
|
||||||
subparsers = parser.add_subparsers()
|
subparsers = parser.add_subparsers()
|
||||||
|
|
||||||
parser_update_login = subparsers.add_parser('update-login')
|
parser_register_app = subparsers.add_parser('register-app')
|
||||||
parser_update_login.set_defaults(action='update-login')
|
parser_register_app.set_defaults(action='register-app')
|
||||||
parser_update_login.add_argument('app', help='Application name')
|
parser_register_app.add_argument('app', help='Application name')
|
||||||
parser_update_login.add_argument('login', help='Administrative login')
|
parser_register_app.add_argument('login', help='Administrative login')
|
||||||
parser_update_login.add_argument('password', help='Administrative password')
|
parser_register_app.add_argument('password', help='Administrative password')
|
||||||
|
|
||||||
parser_rebuild_issue = subparsers.add_parser('rebuild-issue')
|
parser_rebuild_issue = subparsers.add_parser('rebuild-issue')
|
||||||
parser_rebuild_issue.set_defaults(action='rebuild-issue')
|
parser_rebuild_issue.set_defaults(action='rebuild-issue')
|
||||||
@ -39,9 +39,9 @@ parser_unregister_proxy.add_argument('app', help='Application name')
|
|||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
mgr = VMMgr()
|
mgr = VMMgr()
|
||||||
if args.action == 'update-login':
|
if args.action == 'register-app':
|
||||||
# Used by app install scripts
|
# Used by app install scripts
|
||||||
mgr.update_login(args.app, args.login, args.password)
|
mgr.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
|
||||||
mgr.rebuild_issue()
|
mgr.rebuild_issue()
|
||||||
|
@ -127,14 +127,17 @@ class VMMgr:
|
|||||||
self.domain = self.conf['host']['domain']
|
self.domain = self.conf['host']['domain']
|
||||||
self.port = self.conf['host']['port']
|
self.port = self.conf['host']['port']
|
||||||
|
|
||||||
def update_login(self, app, login, password):
|
def register_app(self, app, login, password):
|
||||||
# Update login and password for an app in the configuration
|
# Register a newly installed application and update login and password
|
||||||
if app not in self.conf['apps']:
|
if app not in self.conf['packages']:
|
||||||
raise validator.InvalidValueException('app', app)
|
raise validator.InvalidValueException('app', app)
|
||||||
if login is not None:
|
self.conf['apps'][app] = {
|
||||||
self.conf['apps'][app]['login'] = login
|
'title': metadata['title'],
|
||||||
if password is not None:
|
'host': metadata['host'],
|
||||||
self.conf['apps'][app]['password'] = password
|
'login': login if login else 'N/A',
|
||||||
|
'password': password if password else 'N/A',
|
||||||
|
'visible': False
|
||||||
|
}
|
||||||
self.conf.save()
|
self.conf.save()
|
||||||
|
|
||||||
def show_tiles(self, app):
|
def show_tiles(self, app):
|
||||||
|
@ -163,21 +163,9 @@ class AppMgr:
|
|||||||
|
|
||||||
def register_package(self, name):
|
def register_package(self, name):
|
||||||
# Registers a package in local configuration
|
# Registers a package in local configuration
|
||||||
metadata = self.online_packages[name]
|
metadata = self.online_packages[name].copy()
|
||||||
self.conf['packages'][name] = {
|
del metadata['sha512']
|
||||||
'deps': metadata['deps'],
|
self.conf['packages'][name] = metadata
|
||||||
'lxcpath': metadata['lxcpath'],
|
|
||||||
'version': metadata['version']
|
|
||||||
}
|
|
||||||
# If host definition is present, register the package as application
|
|
||||||
if 'host' in metadata:
|
|
||||||
self.conf['apps'][name] = {
|
|
||||||
'title': metadata['title'],
|
|
||||||
'host': metadata['host'],
|
|
||||||
'login': 'N/A',
|
|
||||||
'password': 'N/A',
|
|
||||||
'visible': False
|
|
||||||
}
|
|
||||||
self.conf.save()
|
self.conf.save()
|
||||||
|
|
||||||
def unregister_package(self, name):
|
def unregister_package(self, name):
|
||||||
|
Loading…
Reference in New Issue
Block a user