diff options
author | Christian Breunig <christian@breunig.cc> | 2023-04-01 18:56:02 +0200 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2023-04-01 18:56:02 +0200 |
commit | b53c25a7bcd0a825cadf0e6c754297004ed3f0e4 (patch) | |
tree | ca65b1f633b18fbcf8d1a18b9358fcf5321b38ab | |
parent | 0ea3e1420c373027bdf57ea9e794b81dd6b6ad4f (diff) | |
download | vyos-1x-b53c25a7bcd0a825cadf0e6c754297004ed3f0e4.tar.gz vyos-1x-b53c25a7bcd0a825cadf0e6c754297004ed3f0e4.zip |
container: T4959: bugfix credential validation on registries
Commit fe82d86d ("container: T4959: add registry authentication option") looked
up the wrong config dict level when validating that both username and password
need to be specified when registries are in use.
-rwxr-xr-x | src/conf_mode/container.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/conf_mode/container.py b/src/conf_mode/container.py index 5cfbfc30c..3827f4c70 100755 --- a/src/conf_mode/container.py +++ b/src/conf_mode/container.py @@ -258,9 +258,11 @@ def verify(container): if 'network' in container_config and network in container_config['network']: raise ConfigError(f'Can not remove network "{network}", used by container "{container}"!') - if 'registry' in container and 'authentication' in container['registry']: - for registry, registry_config in container['registry']['authentication'].items(): - if not {'username', 'password'} <= set(registry_config): + if 'registry' in container: + for registry, registry_config in container['registry'].items(): + if 'authentication' not in registry_config: + continue + if not {'username', 'password'} <= set(registry_config['authentication']): raise ConfigError('If registry username or or password is defined, so must be the other!') return None |