Skip to content

Commit

Permalink
Merge pull request #141 from redBorder/development
Browse files Browse the repository at this point in the history
Fix management interface configuration in case there is only one interface
  • Loading branch information
manegron committed Jun 24, 2024
2 parents e244d15 + f7eba5f commit 096c2af
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.0
2.2.1
13 changes: 11 additions & 2 deletions resources/scripts/rb_setup_wizard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,10 @@ def cancel_wizard()
cancel_wizard if netconf.cancel
general_conf["network"]["interfaces"] = netconf.conf

static_interface = general_conf["network"]["interfaces"].find { |i| i["mode"] == "static" }
dhcp_interfaces = general_conf["network"]["interfaces"].select { |i| i["mode"] == "dhcp" }

if general_conf["network"]["interfaces"].size > 1
static_interface = general_conf["network"]["interfaces"].find { |i| i["mode"] == "static" }
dhcp_interfaces = general_conf["network"]["interfaces"].select { |i| i["mode"] == "dhcp" }
if static_interface.size == 1 && dhcp_interfaces.size >= 1
general_conf["network"]["management_interface"] = static_interface["device"]
else
Expand All @@ -134,6 +135,14 @@ def cancel_wizard()
general_conf["network"]["management_interface"] = management_iface
end
end
else
if general_conf["network"]["interfaces"].size == 1
if !static_interface.nil?
general_conf["network"]["management_interface"] = static_interface["device"]
else
general_conf["network"]["management_interface"] = dhcp_interfaces.first["device"]
end
end
end
# Conf for DNS
text = <<EOF
Expand Down

0 comments on commit 096c2af

Please sign in to comment.