def test_print_config(self):

        path = os.path.abspath(__file__)
        dir_path = os.path.dirname(path)
        lm = LogManager('./test-logs')
        ptm = PhysicalTopologyManager(root_dir=dir_path + '/../..', log_manager=lm)

        ptm.configure(dir_path + '/test-config.json')

        ptm.print_config()
Exemplo n.º 2
0
    root_dir = LinuxCLI().cmd('pwd').strip()

    log_manager = LogManager(root_dir=log_dir)
    if command == 'startup':
        log_manager.rollover_logs_fresh(file_filter='ptm*.log')

    ptm = PhysicalTopologyManager(root_dir=root_dir, log_manager=log_manager)
    ptm.configure_logging(debug=debug)
    ptm.configure(ptm_config_file)

    if command == 'startup':
        ptm.startup()
    elif command == 'shutdown':
        ptm.shutdown()
    elif command == 'print':
        ptm.print_config()
    else:
        usage(ArgMismatchException('Command option not recognized: ' + command))
   
except ExitCleanException:
    exit(1)
except ArgMismatchException as a:
    print 'Argument mismatch: ' + str(a)
    traceback.print_tb(sys.exc_traceback)
    exit(2)
except ObjectNotFoundException as e:
    print 'Object not found: ' + str(e)
    traceback.print_tb(sys.exc_traceback)
    exit(2)
except SubprocessFailedException as e:
    print 'Subprocess failed to execute: ' + str(e)