Skip to content

Commit

Permalink
Refactor to reduce degree of nesting (#431)
Browse files Browse the repository at this point in the history
* Refactor to reduce degree of nesting
* Improve comment (which would otherwise be misleading)

Signed-off-by: Matthias Büchse <matthias.buechse@cloudandheat.com>
Signed-off-by: Kurt Garloff <kurt@garloff.de>
Co-authored-by: Kurt Garloff <kurt@garloff.de>
  • Loading branch information
mbuechse and garloff authored Dec 22, 2023
1 parent b97f9d4 commit e56929a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Tests/iaas/image-metadata/image-md-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,14 @@ def validate_imageMD(imgnm):
f'{img.properties["image_build_date"]}', file=sys.stderr)
errors += 1
# - image_source should be a URL
if "image_source" in img.properties:
if not is_url(img.properties["image_source"]):
if img.properties["image_source"] == "private":
if verbose:
print(f'Info: Image {imgnm} has image_source set to private', file=sys.stderr)
else:
print(f'Error: Image "{imgnm}": image_source should be a URL or "private"', file=sys.stderr)
errors += 1
if "image_source" not in img.properties:
pass # we have already noted this as error, no need to do it again
elif img.properties["image_source"] == "private":
if verbose:
print(f'Info: Image {imgnm} has image_source set to private', file=sys.stderr)
elif not is_url(img.properties["image_source"]):
print(f'Error: Image "{imgnm}": image_source should be a URL or "private"', file=sys.stderr)
errors += 1
# - uuid_validity has a distinct set of options (none, last-X, DATE, notice, forever)
# - hotfix hours (if set!) should be numeric
# (5a) Sanity: Are we actually in violation of update_frequency?
Expand Down

0 comments on commit e56929a

Please sign in to comment.