31 lines
984 B
Python
Executable File
31 lines
984 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import argparse
|
|
import json
|
|
|
|
def main(args):
|
|
jsonfile = '/srv/portal/js/apps.json'
|
|
|
|
data = {}
|
|
with open(jsonfile, 'r') as f:
|
|
data = json.load(f)
|
|
if not args.app in data:
|
|
data[args.app] = {}
|
|
if args.url:
|
|
data[args.app]['url'] = args.url
|
|
if args.login:
|
|
data[args.app]['login'] = args.login
|
|
if args.password:
|
|
data[args.app]['password'] = args.password
|
|
with open(jsonfile, 'w') as f:
|
|
json.dump(data, f)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
parser = argparse.ArgumentParser(description='Spotter Cluster portal application manager')
|
|
parser.add_argument('app', help='Application ID.')
|
|
parser.add_argument('url', default=None, help='URL to the application. Use "{host}" as a host placeholder.')
|
|
parser.add_argument('login', default=None, help='Administrative login.')
|
|
parser.add_argument('password', default=None, help='Administrative password.')
|
|
main(parser.parse_args())
|