Commit d4e98747 authored by Jameson Rollins's avatar Jameson Rollins

improve print_system to help debugging

print available system info before attempting to load the module.
parent f43556b3
......@@ -147,14 +147,13 @@ def main():
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()
elif system is not None:
system.load()
if args.interactive or not args.system:
import IPython
......
......@@ -78,24 +78,22 @@ def print_system(system):
print('ifo: {}'.format(system.ifo))
print('name: {}'.format(system.name))
print('module:')
print(' {}'.format(system.path))
try:
system.load()
except GuardSystemLoadError as e:
print('module:')
print(' {}'.format(system.path))
raise SystemExit("System load error: {}".format(e))
print('CA prefix: {}'.format((system.ca_prefix or '')))
if system.ca_monitor:
print('CA monitor: {}'.format(system.ca_monitor))
print('CA monitor notify: {}'.format(system.ca_monitor_notify))
print('module:')
print(' {}'.format(system.path))
if system.usercode:
print('usercode:')
for code in system.usercode:
print(' {}'.format(code))
print('CA prefix: {}'.format((system.ca_prefix or '')))
if system.ca_monitor:
print('CA monitor: {}'.format(system.ca_monitor))
print('CA monitor notify: {}'.format(system.ca_monitor_notify))
print('nominal state: {}'.format((system.nominal or 'NONE')))
print('initial request: {}'.format((system.request or 'NONE')))
print('states (*=requestable):')
......
......@@ -87,7 +87,7 @@ p.add_argument('cmd', metavar='<command>', nargs='?', help="command")
def print_system(args):
"""Print general system information."""
system = cli.init_system(args, load=True)
system = cli.init_system(args, load=False)
cli.print_system(system)
p = gen_subparser("print", print_system)
......
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