Skip to content
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

Don't depend on eth0 for displaying network information #263

Merged

Conversation

agrare
Copy link
Member

@agrare agrare commented Aug 6, 2024

When displaying the current network information iterate over all network interfaces not just eth0

Example output:

Welcome to the ManageIQ Virtual Appliance.

To modify the configuration, use a web browser to access the management page.

Hostname:                workstation
enp193s0f0np0 IPv4 Address: 10.2.4.10/24
enp193s0f0np0 IPv4 Gateway: 10.2.4.1
enp193s0f0np0 IPv6 Address: 
enp193s0f0np0 IPv6 Gateway: 
enp193s0f0np0 MAC Address: b4:96:91:b8:a2:96
lxcbr0 IPv4 Address:     10.0.3.1/24
lxcbr0 IPv4 Gateway:     10.2.4.1
lxcbr0 IPv6 Address:     fc11:4514:1919:810::1/64
lxcbr0 IPv6 Gateway:     
lxcbr0 MAC Address:      00:16:3e:00:00:00
crc IPv4 Address:        192.168.130.1/24
crc IPv4 Gateway:        10.2.4.1
crc IPv6 Address:        
crc IPv6 Gateway:        
crc MAC Address:         52:54:00:fd:be:d0
Primary DNS:             127.0.0.1
Secondary DNS:           
Search Order:            rb.nj.grare.com
Timezone:                America/New_York
ManageIQ Server:         not configured
ManageIQ Database:       not configured
Database/Region:         not configured
Messaging:               configured
Local Messaging Broker:  configured
ManageIQ Version: 

NOTE with longer interface names the spacing is broken

Related: ManageIQ/manageiq-appliance-build#573

When displaying the current network information iterate over all network
interfaces not just eth0
@agrare agrare changed the title [WIP] Iterate over all interfaces when displaying network info don't hard-code eth0 [WIP] Don't depend on eth0 for displaying network information Aug 6, 2024
@agrare
Copy link
Member Author

agrare commented Aug 6, 2024

I thought this would help put some of the changes to LinuxAdmin in context of how they might be used

@@ -10,7 +10,7 @@ def initialize
self.database_name = "vmdb_production"
self.database_user = "root"
self.database_password = nil
self.primary_host = LinuxAdmin::NetworkInterface.new(NETWORK_INTERFACE).address
self.primary_host = network_interfaces.first&.address
Copy link
Member Author

Choose a reason for hiding this comment

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

NOTE this will only work reliably with a single non-loopback interface, but this is just the default presented to the user and they can enter any address that they want plus our appliances only ship by default with a single NIC.

In the future I think a #default? attribute or something like that which checks which dev is used for the default route would let us pick the interface most likely to be the "right one" ™️

Copy link
Member

Choose a reason for hiding this comment

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

I think that's fine. There was no guarantee before that eth0 was the default route.

@agrare agrare changed the title [WIP] Don't depend on eth0 for displaying network information Don't depend on eth0 for displaying network information Aug 13, 2024
@miq-bot
Copy link
Member

miq-bot commented Aug 13, 2024

Checked commits agrare/manageiq-appliance_console@bfc3ed2~...8dc2628 with ruby 3.1.5, rubocop 1.56.3, haml-lint 0.51.0, and yamllint
5 files checked, 0 offenses detected
Everything looks fine. 🍰

@miq-bot miq-bot removed the wip label Aug 13, 2024
@bdunne bdunne closed this Aug 13, 2024
@bdunne bdunne reopened this Aug 13, 2024
@bdunne bdunne merged commit 782e623 into ManageIQ:master Aug 13, 2024
5 of 10 checks passed
@bdunne bdunne self-assigned this Aug 13, 2024
@agrare agrare deleted the drop_eth0_dependency_bin_appliance_console branch August 13, 2024 21:30
bdunne added a commit that referenced this pull request Aug 13, 2024
Changed
- Don't depend on eth0 for displaying network information [#263]
@Fryguy Fryguy added the bug label Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants