Skip to content

Streamline syntax of flavor-name tooling - #455

Merged
mbuechse merged 32 commits into
mainfrom
issue/454
Feb 21, 2024
Merged

mbuechse merged 32 commits into
mainfrom
issue/454

Conversation

@mbuechse

@mbuechse mbuechse commented Jan 22, 2024 •

Copy link
Copy Markdown
Contributor

Resolves #454

Following issues are addressed:

  • provide a cli tool with a streamlined and stable syntax
  • get rid of the importlib hack
  • get rid of excessive globals
  • fix a few bugs (and probably introduce new ones)
  • refactor to make more Pythonic (and hopefully more accessible)

@mbuechse

Copy link
Copy Markdown
Contributor Author

Errors found so far (in the original code that's currently in main):

Flavor name input didn't work when CPU brand was given, but generation wasn't.

Flavor name parser accepted _gN-h, didn't accept _gNh (treated h as generation).

@mbuechse mbuechse changed the title Intermediate revision Streamline syntax of flavor-name tooling Jan 26, 2024
@mbuechse
mbuechse requested a review from garloff January 26, 2024 14:19
@mbuechse
mbuechse marked this pull request as ready for review January 26, 2024 14:19
@mbuechse

Copy link
Copy Markdown
Contributor Author

See the README for details about the streamlined command-line syntax.

@mbuechse
mbuechse requested a review from berendt February 12, 2024 12:48
@mbuechse
mbuechse requested a review from martinmo February 20, 2024 09:06

@martinmo martinmo left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some review comments inline. The overall impression is very good and the goals that were set are achieved, in my opinion.

As you pointed out to me via chat there seems to be a regression compared to the code in main, when checking with python3 Tests/iaas/flavor-naming/check-yaml.py Tests/testing. For the record, this is the output difference:

--- main.txt    2024-02-20 16:51:54.066472519 +0100
+++ 455.txt     2024-02-20 16:52:01.326498563 +0100
@@ -1,8 +1,7 @@
 ERROR: flavor 'SCS-1V-4': field 'cpu-type' contradicting name-v2 'SCS-1V-4'; found 'crowded-core', expected 'shared-core'
 ERROR: flavor 'SCS-2V-8': field 'name-v1' contradicting name-v2 'SCS-2V-8'; found 'SCS-2V-8', expected 'SCS-2V:8'
 ERROR: flavor 'SCS-4V-16': field 'ram' contradicting name-v2 'SCS-4V-16'; found 12, expected 16.0
-ERROR: flavor 'SCS-8V-32': field 'disk' contradicting name-v2 'SCS-8V-32'; found 128, expected undefined
 ERROR: flavor 'SCS-1V-2': field 'cpus' contradicting name-v2 'SCS-1V-2'; found 2, expected 1
 ERROR: flavor 'SCS-2V-4-20s': field 'disk0-type' contradicting name-v2 'SCS-2V-4-20s'; found 'network', expected 'ssd'
 ERROR: flavor 'SCS-4V-16-100s': field 'disk' contradicting name-v2 'SCS-4V-16-100s'; found 10, expected 100
-ERROR: file 'scs-0103-v1-flavors-wrong.yaml': found 7 errors
+ERROR: file 'scs-0103-v1-flavors-wrong.yaml': found 6 errors

Comment thread Tests/iaas/flavor-naming/cli.py Resolved
Comment thread Tests/iaas/flavor-naming/README.md Resolved
Comment thread Tests/iaas/flavor-naming/README.md Resolved
@mbuechse

mbuechse commented Feb 20, 2024 •

Copy link
Copy Markdown
Contributor Author

@martinmo Thanks for the flowers! I have tried to incorporate everything. Oh, and I also fixed the regression.

Comment on lines +46 to +48
parser.add_argument('-b', '--bind', metavar='ADDRESS',
help='bind to this address '
'(default: all interfaces)')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One tiny suggestion that I missed to include yesterday (sorry!):

Suggested change
parser.add_argument('-b', '--bind', metavar='ADDRESS',
help='bind to this address '
'(default: all interfaces)')
parser.add_argument('-b', '--bind', metavar='ADDRESS',
default='127.0.0.1',
help='bind to this address '
'(default: %(default)s)')

This will make the string printed above actually usable in the default case:

The form is accessible at http://127.0.0.1:8000/cgi-bin/flavor-form.py

vs.

The form is accessible at http://0.0.0.0:8000/cgi-bin/flavor-form.py

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@martinmo The variant with 0.0.0.0 does indeed work (at least on my machine).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mbuechse ok, I checked again and now it works here, too – don't know what I did wrong the first time 🤷 but nevertheless, I would recommend using a local interface because it is the more secure default.

@martinmo martinmo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now and I confirm the regression is fixed 🚀

Maybe you can also incorporate the above suggestion I forgot to include in my first review.

Signed-off-by: Matthias Büchse <[email protected]>
Signed-off-by: Matthias Büchse <[email protected]>
Signed-off-by: Matthias Büchse <[email protected]>
Signed-off-by: Matthias Büchse <[email protected]>
Signed-off-by: Matthias Büchse <[email protected]>
Signed-off-by: Matthias Büchse <[email protected]>
Signed-off-by: Matthias Büchse <[email protected]>
Signed-off-by: Matthias Büchse <[email protected]>
Signed-off-by: Matthias Büchse <[email protected]>
Signed-off-by: Matthias Büchse <[email protected]>
Signed-off-by: Matthias Büchse <[email protected]>
Signed-off-by: Matthias Büchse <[email protected]>
Signed-off-by: Matthias Büchse <[email protected]>
Signed-off-by: Matthias Büchse <[email protected]>
Signed-off-by: Matthias Büchse <[email protected]>
Signed-off-by: Matthias Büchse <[email protected]>
Signed-off-by: Matthias Büchse <[email protected]>
Signed-off-by: Matthias Büchse <[email protected]>
Signed-off-by: Matthias Büchse <[email protected]>
Signed-off-by: Matthias Büchse <[email protected]>
Signed-off-by: Matthias Büchse <[email protected]>
Signed-off-by: Matthias Büchse <[email protected]>
thanks very much!

Signed-off-by: Matthias Büchse <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streamline command-line syntax of flavor-name-check.py

2 participants