Skip to content

Commit

Permalink
fixes and some logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Apr 17, 2019
1 parent eab9535 commit 0a7405a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
10 changes: 8 additions & 2 deletions src/include/network/lan/address.rb
Expand Up @@ -1157,8 +1157,6 @@ def AddressDialog
end
end

Yast::LanItems.bond_option = @settings["BONDOPTION"]
Yast::LanItems.bond_slaves = @settings["SLAVES"]

# When virtual interfaces are added the list of routing devices needs
# to be updated to offer them
Expand All @@ -1170,6 +1168,12 @@ def AddressDialog
LanItems.vlan_id = Builtins.tostring(
Ops.get_integer(@settings, "VLAN_ID", 0)
)
elsif LanItems.type == "bond"
new_slaves = @settings.fetch("SLAVES", []).select {|s| !LanItems.bond_slaves.include? s }
LanItems.bond_slaves = @settings["SLAVES"]
LanItems.bond_option = @settings["BONDOPTION"]
Lan.autoconf_slaves = (Lan.autoconf_slaves + new_slaves).uniq.sort
log.info "bond settings #{LanItems.bond_slaves}"
elsif Builtins.contains(["tun", "tap"], LanItems.type)
LanItems.tunnel_set_owner = Ops.get_string(
@settings,
Expand Down Expand Up @@ -1228,6 +1232,8 @@ def initialize_address_settings

# #65524
@settings["BOOTPROTO"] = "static" if LanItems.operation == :add && @force_static_ip

log.info "settings after init #{@settings.inspect}"
end

# Performs hostname update
Expand Down
28 changes: 7 additions & 21 deletions src/lib/y2network/widgets/bond_slave.rb
Expand Up @@ -90,21 +90,7 @@ def init

# Default function to store the value of slave devices box.
def store
configured_slaves = @settings["SLAVES"] || []

selected_slaves = selected_items

@settings["SLAVES"] = selected_slaves

# create list of "unconfigured" slaves
new_slaves = @settings["SLAVES"].select do |slave|
!configured_slaves.include? slave
end

# TODO: should not be here?
Yast::Lan.autoconf_slaves = (Yast::Lan.autoconf_slaves + new_slaves).uniq.sort

nil
@settings["SLAVES"] = selected_items
end

# Validates created bonding. Currently just prevent the user to create a
Expand All @@ -119,15 +105,15 @@ def validate

def value
# TODO: it is multiselection, so does it make sense?
Yast::UI.QueryWidget(:slave_bonds_items, :CurrentItem)
Yast::UI.QueryWidget(:bond_slaves_items, :CurrentItem)
end

def selected_items
Yast::UI.QueryWidget(:bond_slaves_items, :SelectedItems) || []
end

def ui_items
Yast::UI.QueryWidget(:slave_bonds_items, :Items) || []
Yast::UI.QueryWidget(:bond_slaves_items, :Items) || []
end

def value_index
Expand All @@ -136,11 +122,11 @@ def value_index

def enable_slave_buttons
if value_index
Yast::UI.ChangeWidget(:slave_bonds_up, :Enabled, value_index > 0)
Yast::UI.ChangeWidget(:slave_bonds_down, :Enabled, value_index < ui_items.size - 1)
Yast::UI.ChangeWidget(:bond_slaves_up, :Enabled, value_index > 0)
Yast::UI.ChangeWidget(:bond_slaves_down, :Enabled, value_index < ui_items.size - 1)
else
Yast::UI.ChangeWidget(:slave_bonds_up, :Enabled, false)
Yast::UI.ChangeWidget(:slave_bonds_down, :Enabled, false)
Yast::UI.ChangeWidget(:bond_slaves_up, :Enabled, false)
Yast::UI.ChangeWidget(:bond_slaves_down, :Enabled, false)
end
end

Expand Down

0 comments on commit 0a7405a

Please sign in to comment.