-
Notifications
You must be signed in to change notification settings - Fork 990
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
Fixes #36508 - Fix virtual nic configuration in preseed #9735
Conversation
Issues: #36508 |
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
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 think this is mostly correct, but I still think in theforeman/community-templates#688 (comment) a valid point is raised.
We have on line 48 some code that looks up the real interface name (based on the mac address). Is that not something we should still do? Or at least take into account?
The reason we have that is to rely less on the actual identifier and more on the mac address to identify an interface. With the udev stable interface names they may be different from what users expect, or they may not care as much. Whether this assertion still holds is another, but I fear we may end up with a mismatch if we only partially implement it.
I can also see the logic should be something like:
<% if interface.virtual? -%>
real=`ip -o link | awk '/<%= interface.attached_to.mac -%>/ {print $2;}' | sed s/:$//`
<% else -%>
real=`ip -o link | awk '/<%= interface.mac -%>/ {print $2;}' | sed s/:$//`
<% end -%>
Now this probably won't work because attached_to isn't a foreign key, but I hope it shows the concept.
And if anything else, I'd prefer this to be written at least more minimal to show the flow:
<% if interface.virtual? -%>
real="<%= interface.attached_to -%>"
<% else -%>
real=`ip -o link | awk '/<%= interface.mac -%>/ {print $2;}' | sed s/:$//`
<% end -%>
2d991a1
to
3f5c654
Compare
Co-authored-by: Markus Bucher <[email protected]>
3f5c654
to
aed3277
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.
Untested, but looks good when I read the docs.
@@ -45,10 +45,11 @@ EOF | |||
<% interface_subnet6 = interface.subnet6 -%> | |||
<% interface_dhcp6 = interface_subnet6.nil? ? true : interface_subnet6.dhcp_boot_mode? -%> | |||
<% next if !interface.managed? || (interface_subnet.nil? && interface_subnet6.nil?) || interface.primary -%> | |||
real=`ip -o link | awk '/<%= interface.mac -%>/ {print $2;}' | sed s/:$//` | |||
<% virtual = interface.virtual? -%> |
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.
@ekohl I think I should have removed <% virtual = interface.virtual? -%>
as well, not sure why it is still there. Shall I create a fixup?
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.
Oh yes, it could be removed now. Good catch.
Based on theforeman/community-templates#688
cc @m-bucher