Add register-prop to allow custom VMMgr app property definition
This commit is contained in:
parent
a61009d342
commit
2ae06a4e47
@ -13,6 +13,10 @@ def unregister_app(app):
|
|||||||
# Used by package uninstall.sh script
|
# Used by package uninstall.sh script
|
||||||
vmmgr.unregister_app(app)
|
vmmgr.unregister_app(app)
|
||||||
|
|
||||||
|
def register_prop(app, key, value):
|
||||||
|
# Used by package install.sh script
|
||||||
|
config.set_app(app, key, value)
|
||||||
|
|
||||||
def rebuild_issue():
|
def rebuild_issue():
|
||||||
# Used by inittab on VM startup
|
# Used by inittab on VM startup
|
||||||
vmmgr.rebuild_issue()
|
vmmgr.rebuild_issue()
|
||||||
@ -38,6 +42,12 @@ parser_unregister_app = subparsers.add_parser('unregister-app')
|
|||||||
parser_unregister_app.set_defaults(action=unregister_app)
|
parser_unregister_app.set_defaults(action=unregister_app)
|
||||||
parser_unregister_app.add_argument('app', help='Application name')
|
parser_unregister_app.add_argument('app', help='Application name')
|
||||||
|
|
||||||
|
parser_register_prop = subparsers.add_parser('register-prop')
|
||||||
|
parser_register_prop.set_defaults(action=register_prop)
|
||||||
|
parser_register_prop.add_argument('app', help='Application name')
|
||||||
|
parser_register_prop.add_argument('key', help='Property name')
|
||||||
|
parser_register_prop.add_argument('value', help='Property value')
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
@ -49,6 +59,8 @@ if args.action is register_app:
|
|||||||
register_app(args.app, args.host, args.login, args.password)
|
register_app(args.app, args.host, args.login, args.password)
|
||||||
elif args.action is unregister_app:
|
elif args.action is unregister_app:
|
||||||
unregister_app(args.app)
|
unregister_app(args.app)
|
||||||
|
elif args.action is register_prop:
|
||||||
|
register_prop(args.app, args.key, args.value)
|
||||||
elif args.action is rebuild_issue:
|
elif args.action is rebuild_issue:
|
||||||
rebuild_issue()
|
rebuild_issue()
|
||||||
elif args.action is init:
|
elif args.action is init:
|
||||||
|
@ -35,16 +35,16 @@ def get_host():
|
|||||||
return data['host']
|
return data['host']
|
||||||
|
|
||||||
@locked(paths.CONF_LOCK)
|
@locked(paths.CONF_LOCK)
|
||||||
def register_app(name, definition):
|
def register_app(app, definition):
|
||||||
load()
|
load()
|
||||||
data['apps'][name] = definition
|
data['apps'][app] = definition
|
||||||
save()
|
save()
|
||||||
|
|
||||||
@locked(paths.CONF_LOCK)
|
@locked(paths.CONF_LOCK)
|
||||||
def unregister_app(name):
|
def unregister_app(app):
|
||||||
load()
|
load()
|
||||||
try:
|
try:
|
||||||
del data['apps'][name]
|
del data['apps'][app]
|
||||||
save()
|
save()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
@ -56,10 +56,10 @@ def set_host(key, value):
|
|||||||
save()
|
save()
|
||||||
|
|
||||||
@locked(paths.CONF_LOCK)
|
@locked(paths.CONF_LOCK)
|
||||||
def set_app(name, key, value):
|
def set_app(app, key, value):
|
||||||
load()
|
load()
|
||||||
try:
|
try:
|
||||||
data['apps'][name][key] = value
|
data['apps'][app][key] = value
|
||||||
save()
|
save()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user