-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
guests/linux: Place ethernet devices at start of device list #7848
guests/linux: Place ethernet devices at start of device list #7848
Conversation
# Valid ethernet device prefix values. | ||
# eth - classic prefix | ||
# en - predictable interface names prefix | ||
ETHERNET_PREFIX = ["eth", "en"] |
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.
We should freeze this.
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 possibly name it something more descriptive like POSSIBLE_ETHERNET_PREFIXES
result = cap.network_interfaces(machine) | ||
expect(result).to eq(["enp0s3", "enp0s5", "enp0s8", "bridge0", "docker0"]) | ||
end | ||
|
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.
Extra newline here
@@logger.debug("Unsorted list: #{ifaces.inspect}") | ||
# Break out integers from strings and sort the arrays to provide | ||
# a natural sort for the interface names | ||
ifaces = ifaces.map do |iface| | ||
unless eth_prefix |
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 know it's Ruby, but neither @mitchellh or I are a fan of the "unless" and much prefer if !
or if .nil?
since it mentally maps better to the Golang folks who might look at this code in some future.
@sethvargo updated |
Hi team, DEBUG network_interfaces: Unsorted list: ["enp0s3", "enp0s8", "docker0"] The outcome is that the private network configuration is applied to docker0 instead of enp0s8. Regards. |
@lhernanz Hi and thanks for the update! There have been a few other cases pointed out as well that need some adjustment. I'll be pushing out a new PR with expanded specs and an update shortly. Cheers! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Always provide sorted ethernet devices at the start of the network devices list.
Fixes #7844