How to use the anchorecli.clients.apiexternal.get_registry function in anchorecli

To help you get started, we’ve selected a few anchorecli examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github anchore / anchore-cli / anchorecli / cli / registry.py View on Github external
def get(registry):
    """
    REGISTRY: Full hostname/port of registry. Eg. myrepo.example.com:5000
    """
    ecode = 0

    try:
        ret = anchorecli.clients.apiexternal.get_registry(config, registry=registry)
        ecode = anchorecli.cli.utils.get_ecode(ret)
        if ret['success']:
            print(anchorecli.cli.utils.format_output(config, 'registry_get', {}, ret['payload']))
        else:
            raise Exception( json.dumps(ret['error'], indent=4))

    except Exception as err:
        print(anchorecli.cli.utils.format_error_output(config, 'registry_get', {}, err))
        if not ecode:
            ecode = 2
    anchorecli.cli.utils.doexit(ecode)
github anchore / anchore-cli / anchorecli / cli / registry.py View on Github external
def registrylist():
    ecode = 0

    try:
        ret = anchorecli.clients.apiexternal.get_registry(config)
        ecode = anchorecli.cli.utils.get_ecode(ret)
        if ret['success']:
            print(anchorecli.cli.utils.format_output(config, 'registry_list', {}, ret['payload']))
        else:
            raise Exception( json.dumps(ret['error'], indent=4))

    except Exception as err:
        print(anchorecli.cli.utils.format_error_output(config, 'registry_list', {}, err))
        if not ecode:
            ecode = 2
    anchorecli.cli.utils.doexit(ecode)