Ignore None md5 checksum field
Current checking on md5 checksum field is a bit strict after we have alternate hashing algorithm support from glance, this patch ignores None value md5 checksum if it exists. This dosn't provide any use to end users but maybe provide convenience on internal logic. Change-Id: I89d7ea8ac3464a430141e80be57b743673c3a173
This commit is contained in:
parent
add4d03349
commit
629a19f24b
ironic_python_agent
@ -400,7 +400,8 @@ def _validate_image_info(ext, image_info=None, **kwargs):
|
||||
raise errors.InvalidCommandParamsError(
|
||||
'Image \'urls\' must be a list with at least one element.')
|
||||
|
||||
if 'checksum' in image_info:
|
||||
checksum = image_info.get('checksum')
|
||||
if checksum is not None:
|
||||
if (not isinstance(image_info['checksum'], str)
|
||||
or not image_info['checksum']):
|
||||
raise errors.InvalidCommandParamsError(
|
||||
|
@ -80,6 +80,13 @@ class TestStandbyExtension(base.IronicAgentTest):
|
||||
image_info['os_hash_value'] = 'fake-checksum'
|
||||
standby._validate_image_info(None, image_info)
|
||||
|
||||
def test_validate_image_info_success_ignore_none_md5(self):
|
||||
image_info = _build_fake_image_info()
|
||||
image_info['checksum'] = None
|
||||
image_info['os_hash_algo'] = 'sha512'
|
||||
image_info['os_hash_value'] = 'fake-checksum'
|
||||
standby._validate_image_info(None, image_info)
|
||||
|
||||
def test_validate_image_info_missing_field(self):
|
||||
for field in ['id', 'urls', 'checksum']:
|
||||
invalid_info = _build_fake_image_info()
|
||||
|
Loading…
x
Reference in New Issue
Block a user