Пример #1
0
def run_command_check(options, **kwargs):
    """
    Subcommand "crossbar check".
    """
    from crossbar.common.checkconfig import check_config_file, color_json
    configfile = os.path.join(options.cbdir, options.config)

    print("\nChecking node configuration file '{}':\n".format(configfile))

    if False:
        with open(configfile, 'rb') as f:
            print(color_json(f.read().decode('utf8')))

    try:
        config = check_config_file(configfile)
    except Exception as e:
        print("\nError: {}\n".format(e))
        sys.exit(1)
    else:
        print("Ok, node configuration looks good!\n")

        import json
        config_content = json.dumps(
            config,
            skipkeys=False,
            sort_keys=False,
            ensure_ascii=False,
            separators=(',', ': '),
            indent=4,
        )
        print(color_json(config_content))
        sys.exit(0)
Пример #2
0
def run_command_check(options, **kwargs):
    """
    Subcommand "crossbar check".
    """
    from crossbar.common.checkconfig import check_config_file, color_json
    configfile = os.path.join(options.cbdir, options.config)

    print("\nChecking node configuration file '{}':\n".format(configfile))

    if False:
        with open(configfile, 'rb') as f:
            print(color_json(f.read().decode('utf8')))

    try:
        config = check_config_file(configfile)
    except Exception as e:
        print("\nError: {}\n".format(e))
        sys.exit(1)
    else:
        print("Ok, node configuration looks good!\n")

        import json
        config_content = json.dumps(config, skipkeys=False, sort_keys=False, ensure_ascii=False, separators=(',', ': '), indent=3)
        print(color_json(config_content))
        sys.exit(0)
Пример #3
0
def run_command_check(options, **kwargs):
    """
    Subcommand "crossbar check".
    """
    from crossbar.controller.node import default_native_workers

    configfile = os.path.join(options.cbdir, options.config)

    verbose = False

    try:
        print("Checking local node configuration file: {}".format(configfile))
        config = check_config_file(configfile, default_native_workers())
    except Exception as e:
        print("Error: {}".format(e))
        sys.exit(1)
    else:
        print("Ok, node configuration looks good!")

        if verbose:
            config_content = json.dumps(
                config,
                skipkeys=False,
                sort_keys=False,
                ensure_ascii=False,
                separators=(',', ': '),
                indent=4,
            )
            print(color_json(config_content))

        sys.exit(0)
Пример #4
0
def _run_command_check(options, reactor, personality):
    """
    Subcommand "crossbar check".
    """
    configfile = os.path.join(options.cbdir, options.config)

    verbose = False

    try:
        print("Checking local node configuration file: {}".format(configfile))
        config = personality.check_config_file(personality, configfile)
    except Exception as e:
        print("Error: {}".format(e))
        sys.exit(1)
    else:
        print("Ok, node configuration looks good!")

        if verbose:
            config_content = json.dumps(
                config,
                skipkeys=False,
                sort_keys=False,
                ensure_ascii=False,
                separators=(',', ': '),
                indent=4,
            )
            print(color_json(config_content))

        sys.exit(0)
Пример #5
0
def run_command_check(options, **kwargs):
    """
    Subcommand "crossbar check".
    """
    from crossbar.common.checkconfig import check_config_file, color_json
    configfile = os.path.join(options.cbdir, options.config)

    verbose = False

    try:
        print("Checking local node configuration file: {}".format(configfile))
        config = check_config_file(configfile)
    except Exception as e:
        print("Error: {}".format(e))
        sys.exit(1)
    else:
        print("Ok, node configuration looks good!")

        if verbose:
            import json
            config_content = json.dumps(
                config,
                skipkeys=False,
                sort_keys=False,
                ensure_ascii=False,
                separators=(',', ': '),
                indent=4,
            )
            print(color_json(config_content))

        sys.exit(0)