-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate GX conformant credentials for VM Images #75
Generate GX conformant credentials for VM Images #75
Conversation
Signed-off-by: Anja Strunk <anja.strunk@cloudandheat.com>
Signed-off-by: Anja Strunk <anja.strunk@cloudandheat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed your PR and left some suggestions inline. However, I did not yet try the tool with an OpenStack cloud and plan to do this later.
As a general remark: there are a lot of commented out code lines which I think should be removed. You can always restore old code from the Git history, if necessary.
Some of the new dependencies in requirements.txt
are not up-to-date anymore.
One more remark: I noticed that the original issues #66 and #67 contain a lot of useful information which could be part of the docs (e.g., design/implementation decisions and information about the mapping from SCS to GX). They were helpful for me to understand the context of this PR and in my opinion it would be a pity if they are hidden in the (soon to be closed) GitHub issues. |
Co-authored-by: Martin Morgenstern <martinmo@users.noreply.github.com> Signed-off-by: anjastrunk <119566837+anjastrunk@users.noreply.github.com>
Co-authored-by: Martin Morgenstern <martinmo@users.noreply.github.com> Signed-off-by: anjastrunk <119566837+anjastrunk@users.noreply.github.com>
Co-authored-by: Martin Morgenstern <martinmo@users.noreply.github.com> Signed-off-by: anjastrunk <119566837+anjastrunk@users.noreply.github.com>
Co-authored-by: Martin Morgenstern <martinmo@users.noreply.github.com> Signed-off-by: anjastrunk <119566837+anjastrunk@users.noreply.github.com>
Signed-off-by: Anja Strunk <anja.strunk@cloudandheat.com>
Signed-off-by: Anja Strunk <anja.strunk@cloudandheat.com>
You are right. I will link both issues in documentation later on. |
@martinmo Please review my changes and approve PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is some impressive reorganization.
I have mostly minor remarks, but it would be good to address them nonetheless.
Signed-off-by: Anja Strunk <anja.strunk@cloudandheat.com>
@anjastrunk was the merge of the other PR #67 into this PR intentional (fe1b9a7)? |
No, it was not. |
fe1b9a7
to
af60bf1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed again and only found some minor things 👍
Some of the earlier suggestions have been marked as resolved but the suggestions have not been applied (these are separate steps in the GitHub UI).
In the "Docker" section of the README.md
there are some examples which I don't agree with, but the section has not been changed with this PR, so I'll create a separate issue for that.
Signed-off-by: Anja Strunk <anja.strunk@cloudandheat.com>
Signed-off-by: Anja Strunk <anja.strunk@cloudandheat.com>
Signed-off-by: Anja Strunk <anja.strunk@cloudandheat.com>
Signed-off-by: Anja Strunk <anja.strunk@cloudandheat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor things. Most notable: I don't know how the EnumDefinitionImpl constructor works -- does it accept objects of the enum class in question, or does it only accept str? In the latter case, in a few instances .text
should be added.
In some instances, I was wondering whether a value could be None
or the empty string etc. It would be good to convey this information to the reader by making the code as explicit as possible; see my individual remarks.
if os_image.disk_format: | ||
return VMDiskType( | ||
DISK_LOOKUP.get(os_image.disk_format.lower(), VMDiskType.RAW.text) | ||
) | ||
else: | ||
return VMDiskType("RAW") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even better (again, provided that disk_format can be None)
if os_image.disk_format: | |
return VMDiskType( | |
DISK_LOOKUP.get(os_image.disk_format.lower(), VMDiskType.RAW.text) | |
) | |
else: | |
return VMDiskType("RAW") | |
if os_image.disk_format is None: | |
return VMDiskType(VMDiskType.RAW.text) | |
return VMDiskType( | |
DISK_LOOKUP.get(os_image.disk_format.lower(), VMDiskType.RAW.text) | |
) |
if os_image.properties and "patchlevel" in os_image.properties: | ||
return os_image.properties["patchlevel"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if os_image.properties and "patchlevel" in os_image.properties: | |
return os_image.properties["patchlevel"] | |
return os_image.properties and os_image.properties.get("patchlevel", False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good hint, thanks.
if os_image.properties and "internal_version" in os_image.properties: | ||
return os_image.properties["internal_version"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if os_image.properties and "internal_version" in os_image.properties: | |
return os_image.properties["internal_version"] | |
return os_image.properties and os_image.properties.get("internal_version", False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good hint, thanks.
def _get_hypervisor_type(os_image: OS_Image) -> HypervisorType: | ||
if os_image.hypervisor_type: | ||
return HypervisorType( | ||
HYPER_LOOKUP.get(os_image.hypervisor_type.lower(), HypervisorType.other) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need HypervisorType.other.text
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HypervisorType.other.text
and HypervisorType.other
are similar in this context.
@anjastrunk And one addendum to my review: it seems that your formatter (black?) is set to some very narrow line width, maybe 80 characters. That is hard to read. Maybe you can set it to 110 characters or so. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @mbuechse has suspected, every place where the constructor of an EnumDefinitionImpl
subclass is used is currently broken.
For instance, VMDiskType("RAW")
should be replaced with VMDiskType.RAW
and so on. If this is not possible because the string is not known until runtime, you can use getattr(…)
: getattr(VMDiskType, type_str, VMDiskType.RAW)
.
Co-authored-by: Matthias Büchse <github@mbue.de> Signed-off-by: anjastrunk <119566837+anjastrunk@users.noreply.github.com>
…iant_new' of github.com:SovereignCloudStack/gx-self-description-generator into 67-make-generation-of-vm-image-credentuial-gaia-x-compliant_new
This is not correct. Constructor of every @martinmo Your assumption is wrong: classDiagram
EnumDefinitionImpl <|-- VMDiskType
EnumDefinitionImpl --> PermissibleValue:code
class PermissibleValue{
text: str
}
Calling
|
Co-authored-by: Matthias Büchse <github@mbue.de> Signed-off-by: anjastrunk <119566837+anjastrunk@users.noreply.github.com>
Signed-off-by: Anja Strunk <anja.strunk@cloudandheat.com>
…iant_new' of github.com:SovereignCloudStack/gx-self-description-generator into 67-make-generation-of-vm-image-credentuial-gaia-x-compliant_new
Co-authored-by: Matthias Büchse <github@mbue.de> Signed-off-by: anjastrunk <119566837+anjastrunk@users.noreply.github.com>
You're right, thanks for the clarification, @anjastrunk! I am sorry and take back my comment. For me it was confusing that the enum member is not of the enum type (like it is with Python stdlib enums) and that
but
|
Confusing indeed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but can you please check the mandatory attributes section README.md
again. There is still a typo in the attributes, somehow the suggestion was again not applied:
copyrigthowner
(t and h switched and missing space), should becopyright owner
as in the YAML.resourcePolicy
(P should be lower case and missing space), should beresource policy
as in the YAML.
(Or maybe my understanding here is wrong: I think the section talks about the keys in the YAML file.)
Signed-off-by: Anja Strunk <anja.strunk@cloudandheat.com>
Indeed. I changed it. |
Signed-off-by: Anja Strunk <anja.strunk@cloudandheat.com>
…iant_new' of github.com:SovereignCloudStack/gx-self-description-generator into 67-make-generation-of-vm-image-credentuial-gaia-x-compliant_new
…aia-x-compliant_new
Signed-off-by: Anja Strunk <anja.strunk@cloudandheat.com>
Signed-off-by: Anja Strunk <anja.strunk@cloudandheat.com>
Duplicate #69 to sign commits.
closes #67, #66