-
-
Notifications
You must be signed in to change notification settings - Fork 648
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
Fix filename inheritence #3429
base: main
Are you sure you want to change the base?
Fix filename inheritence #3429
Conversation
The check for parent in profile item setter is wrong: profile always has a parent (distro). It has to be checked whether the parent is (not) of type profile anymore (is_subobject). In this case we know we are at the end of inheritance hierarchy and we have to set filename=""
Unfortunately I cannot add |
CC @tpw56j |
parent = self.parent | ||
if filename == enums.VALUE_INHERITED and parent is None: | ||
if filename == enums.VALUE_INHERITED and not self.is_subobject: |
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.
The semantics of the Item.parent
property has changed, now this property never contains a pointer to an object of another type. Therefore, this change in reality does not change anything.
if not filename: | ||
if parent: | ||
filename = enums.VALUE_INHERITED | ||
else: | ||
filename = "" |
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.
And this code breaks the inheritance of profile.filename
.
@watologo1 Perhaps the problem is in the template used for dhcp or something else? |
Sorry, I was wrong - the inheritance logic for
It seems to me that the problems arose because the line of inheritance of
|
Not sure I get this right... I agree that the fact that inheritance stops at profile is not perfect. It would be fine to add it to distro as well, in fact it may be helpful, typically every distro should be booted via the same grub binary (which may get overridden for a whole specific distro until a grub bug got fixed or similar as an example scenario). But I expect enhancing inheritance does not buy much, as handling the update case would make things even worse? Maybe you still have a clever idea, ortherwise I try to come up with something the next days. Thanks a lot for your review! |
I wanted to say that the value of a property of an object when set in a setter should not depend on the values of other properties of the same object. Otherwise, we will get logical inconsistency and unpredictable behavior. Example: when the cobbler starts, the json file is read, the corresponding object is created, and the values of its properties are set in the To eliminate logical contradictions, the
In this case, inheriting the |
@watologo1 Any update on this PR? |
Description
The check for parent in profile item setter is wrong: profile always has a parent (distro).
It has to be checked whether the parent is (not) of type profile anymore (is_subobject). In this case we know we are at the end of inheritance hierarchy and we have to set filename=""
Behaviour changes
Old: filename might end up in <> string, even the end of inheritance hierarchy was reached. This e.g. could end up in bad dhcpd.conf generation inside a host declaration:
filename <>
New: Make sure a system or profile item always returns the defined filename value or an empty string, but not "<>"
Category