Commit d916863d authored by Jameson Rollins's avatar Jameson Rollins

cli: don't load system when printing daemon CAS channels

The system doesn't need to be loaded to provide this info.

Also allow printing channels even when system is not specified.
parent 06660545
......@@ -131,28 +131,35 @@ def main():
system = None
if args.system:
system = cli.init_system(args, load=True)
system = cli.init_system(args)
##############################################
if args.cmd == 'print':
if not system:
sys.exit("Must specify system to print.")
cli.print_system(system)
sys.exit()
if args.cmd == 'channels':
if not system:
sys.exit("Must specify system to print channels.")
ifo = '<IFO>'
name = '<NODE>'
if system is not None:
if system.ifo:
ifo = system.ifo
name = system.name
from db import guarddb
for chan in sorted(guarddb):
channel = const.CAS_PREFIX_FMT.format(IFO=system.ifo, SYSTEM=system.name) + chan
channel = const.CAS_PREFIX_FMT.format(IFO=ifo, SYSTEM=name) + chan
flag = ''
if guarddb[chan].get('archive'):
flag = '*'
print('{} {}'.format(channel, flag))
sys.exit()
if system is not None:
system.load()
if args.cmd == 'print':
if system is None:
sys.exit("Must specify system to print.")
cli.print_system(system)
sys.exit()
if args.interactive or not args.system:
import IPython
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment