'autoBlock' not found in expected location on the Nexus response:
| Nexus Version | 3.25.0-03 | | nexus3-cli | 4.1.0 |
Steps to reproduce:
- Create a pypi proxy repo in Nexus3, enable "auto-blocking", remember the name of the repo (YOUR_REMEMBERED_REPO_NAME)
- Use the CLI to extract information about this repo with the CLI, by calling
NEXUS_CLIENT.repositories.get_by_name("<YOUR_REMEMBERED_REPO_NAME>")
Error:
try:
args, kwargs = _repository_args_kwargs(configuration)
except KeyError as e:
from pprint import pformat
> raise exception.NexusClientAPIError(
f'{e} not found in expected location on the Nexus response:\n'
f'{pformat(configuration, indent=2)}')
E nexuscli.exception.NexusClientAPIError: 'autoBlock' not found in expected location on the Nexus response:
E { 'attributes': { 'httpclient': { 'autoBlock': True,
E 'blocked': False,
E 'connection': { 'enableCircularRedirects': False,
E 'enableCookies': False}},
Solution:
It seems, the new location of the property "autoBlock" is in ['attributes']['httpclient']['autoBlock'] and not in ['attributes']['httpclient']['connection']['autoBlock'] in the Nexus3 JSON result.
nexuscli\api\repository\collection.py:84
def _fixed_add_proxy_kwargs(kwargs, attributes) -> None:
kwargs['auto_block'] = attributes['httpclient']['autoBlock']
kwargs['content_max_age'] = int(attributes['proxy']['contentMaxAge'])
kwargs['metadata_max_age'] = int(attributes['proxy']['metadataMaxAge'])
kwargs['remote_url'] = attributes['proxy']['remoteUrl']
kwargs['negative_cache_enabled'] = attributes['negativeCache']['enabled']
kwargs['negative_cache_ttl'] = int(
attributes['negativeCache']['timeToLive'])
Edited by Benjamin Linnik