Skip to content

Commit b3d63b2

Browse files
committed
Cleanup: Use Property.check() directly.
Also (from last commit): Allow 32MiB min_ram images, as this is the default min for Cirros. Signed-off-by: Kurt Garloff <[email protected]>
1 parent 648300f commit b3d63b2

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

Tests/iaas/image-metadata/image-md-check.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def check(self, props, warn):
111111
# Property empty => WARN (or ERROR if no allowed value list)
112112
if (verbose or not self.values) and warn:
113113
errstr = "WARNING" if ok else "ERROR"
114-
print(f'{errstr}: Image "{warn}": empty value for property "{self.name}" not recommended',
114+
print(f'{errstr}: Image "{warn}": empty value for property "{self.name}" not good',
115115
file=sys.stderr)
116116
return (ok, not ok)
117117
# Property does not exist but is mandatory => ERROR
@@ -130,11 +130,6 @@ def is_ok(self, props, warn = ""):
130130
ok, nowarn = self.check(props, warn)
131131
return ok
132132

133-
def is_nowarn(self, props, warn = ""):
134-
"Return True if nothing to warn about is found"
135-
ok, nowarn = self.check(props, warn)
136-
return nowarn
137-
138133

139134
# From the image metadata specification
140135
# https://github.com/SovereignCloudStack/Docs/blob/main/Design-Docs/Image-Properties-Spec.md
@@ -226,9 +221,10 @@ def validate_imageMD(img, outd_list):
226221
# (4) image_build_date, image_original_user, image_source (opt image_description)
227222
# (5) maintained_until, provided_until, uuid_validity, replace_frequency
228223
for prop in (*os_props, *arch_props, *hw_props):
229-
if not prop.is_ok(img, imgnm):
224+
ok, nowarn = prop.check(img, imgnm)
225+
if not ok:
230226
errors += 1
231-
elif not prop.is_nowarn(img, ""):
227+
elif not nowarn:
232228
warnings += 1
233229
# We do not count missing optional fields in these
234230
for prop in (*build_props, *maint_props):

0 commit comments

Comments
 (0)