Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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)