Skip to content

Commit

Permalink
Add table lookup debugging.
Browse files Browse the repository at this point in the history
Signed-off-by: Kurt Garloff <[email protected]>
  • Loading branch information
garloff committed Dec 8, 2023
1 parent 16825a8 commit bf34da7
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions Tests/iaas/flavor-naming/flavor-form.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,16 @@ def generate_name(form):
if fdesc[1] == ':' and not int(val):
val = '1'
setattr(FLAVOR_SPEC[idx], keypair[1], int(val))
# TODO: Handle boolean and tables
elif fdesc[0] == '?':
setattr(FLAVOR_SPEC[idx], keypair[1], bool(val))
elif hasattr(FLAVOR_SPEC[idx], f"tbl_{keypair[1]}"):
tbl = getattr(FLAVOR_SPEC[idx], f"tbl_{keypair[1]}")
if not val and fdesc[0] == '.':
setattr(FLAVOR_SPEC[idx], keypair[1], val)
# print(f'tbl_{keypair[1]}: {tbl}: Search for {val}', file=sys.stderr)
if not val in tbl and (val or fdesc[0] != '.'):
ERROR = f'Invalid key {val} for tbl_{keypair[1]}'
return None
setattr(FLAVOR_SPEC[idx], keypair[1], val)
else:
if val == "NN":
val = ""
setattr(FLAVOR_SPEC[idx], keypair[1], val)
# Eliminate empty features
for spec in FLAVOR_SPEC:
Expand Down

0 comments on commit bf34da7

Please sign in to comment.