-
Notifications
You must be signed in to change notification settings - Fork 0
/
systems-enable.py
executable file
·35 lines (27 loc) · 1.17 KB
/
systems-enable.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python
import argparse
import json
import vdjpy
if __name__ == '__main__':
# arguments
parser = argparse.ArgumentParser(description = 'Toggle the availability of the system on. System admin privileges are required to enable a system.')
parser.add_argument('-s', '--systemID', dest = 'systemID', nargs = '?', help = 'system ID')
parser.add_argument('-v', '--verbose', dest = 'verbose', action = 'store_true', help = 'verbose output')
parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
args = parser.parse_args()
# make agave object and kwargs
my_agave = vdjpy.make_vdj_agave(args.accesstoken)
kwargs = {}
kwargs['body'] = {'action': 'ENABLE'}
# -s
if args.systemID is None:
args.systemID = vdjpy.prompt_user('system ID')
kwargs['systemId'] = args.systemID
# enable app
enable = my_agave.systems.manage(**kwargs)
# if -v
if args.verbose is True:
print json.dumps(enable, default = vdjpy.json_serial, sort_keys = True, indent = 4, separators = (',', ': '))
# if no -v
else:
print 'Successfully enabled system', args.systemID