Skip to content

Commit

Permalink
Merge pull request #316 from mchf/bnc930448-openqa
Browse files Browse the repository at this point in the history
Fixed openQA issue
  • Loading branch information
mchf committed Jun 18, 2015
2 parents eb427a2 + 6f52fd0 commit 7ad2fe4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
7 changes: 7 additions & 0 deletions package/yast2-network.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Jun 18 08:56:20 UTC 2015 - mfilka@suse.com

- bnc#930448
- display proper startmode description in Overview dialogue
- 3.1.120

-------------------------------------------------------------------
Mon Jun 15 10:46:18 UTC 2015 - igonzalezsosa@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-network.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-network
Version: 3.1.119
Version: 3.1.120
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
32 changes: 29 additions & 3 deletions src/modules/LanItems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ def main
end

# Returns configuration of item (see LanItems::Items) with given id.
#
# @param itemId [Integer] a key for {#Items}
def GetLanItem(itemId)
Ops.get_map(@Items, itemId, {})
end
Expand All @@ -312,6 +314,8 @@ def getCurrentItem

# Returns true if the item (see LanItems::Items) has
# netconfig configuration.
#
# @param itemId [Integer] a key for {#Items}
def IsItemConfigured(itemId)
ret = !GetLanItem(itemId)["ifcfg"].to_s.empty?
log.info("IsItemConfigured: item=#{itemId} configured=#{ret}")
Expand All @@ -329,6 +333,8 @@ def IsCurrentConfigured
#
# First it looks into the item's netconfig and if it doesn't exist
# it uses device name from hwinfo if available.
#
# @param item_id [Integer] a key for {#Items}
def GetDeviceName(item_id)
lan_item = GetLanItem(item_id)

Expand Down Expand Up @@ -363,6 +369,8 @@ def GetCurrentName
end

# Returns device type for particular lan item
#
# @param itemId [Integer] a key for {#Items}
def GetDeviceType(itemId)
NetworkInterfaces.GetType(GetDeviceName(itemId))
end
Expand All @@ -373,6 +381,8 @@ def GetCurrentType
end

# Returns ifcfg configuration for particular item
#
# @param itemId [Integer] a key for {#Items}
def GetDeviceMap(itemId)
return nil if !IsItemConfigured(itemId)

Expand All @@ -394,6 +404,8 @@ def GetCurrentMap
#
# It updates NetworkInterfaces according given map. Map is expected
# to be a hash where both key even value are strings
#
# @param item_id [Integer] a key for {#Items}
def SetDeviceMap(item_id, devmap)
devname = GetDeviceName(item_id)
return false if devname.nil? || devname.empty?
Expand All @@ -404,6 +416,8 @@ def SetDeviceMap(item_id, devmap)
# Sets one option in items sysconfig device map
#
# Currently no checks on sysconfig option validity are performed
#
# @param item_id [Integer] a key for {#Items}
def SetItemSysconfigOpt(item_id, opt, value)
devmap = GetDeviceMap(item_id)
return false if devmap.nil?
Expand All @@ -413,6 +427,8 @@ def SetItemSysconfigOpt(item_id, opt, value)
end

# Returns udev rule known for particular item
#
# @param itemId [Integer] a key for {#Items}
def GetItemUdevRule(itemId)
Ops.get_list(GetLanItem(itemId), ["udev", "net"], [])
end
Expand Down Expand Up @@ -536,6 +552,8 @@ def ReplaceItemUdev(replace_key, new_key, new_val)
# Updating config name means that old configuration is deleted from
# the system.
#
# @param itemId [Integer] a key for {#Items}
#
# Returns new name
def SetItemName(itemId, name)
lan_items = LanItems.Items
Expand Down Expand Up @@ -579,6 +597,8 @@ def rename(name)
end

# Returns new name for current item
#
# @param item_id [Integer] a key for {#Items}
def renamed_to(item_id)
@Items[item_id]["renamed_to"]
end
Expand All @@ -588,6 +608,8 @@ def current_renamed_to
end

# Tells if current item was renamed
#
# @param item_id [Integer] a key for {#Items}
def renamed?(item_id)
return false if !LanItems.Items[item_id].key?("renamed_to")
renamed_to(item_id) != GetDeviceName(item_id)
Expand Down Expand Up @@ -1229,7 +1251,10 @@ def BuildBondIndex
deep_copy(index)
end

def startmode_overview
# Creates item's startmode human description
#
# @param item_id [Integer] a key for {#Items}
def startmode_overview(item_id)
startmode_descrs = {
# summary description of STARTMODE=auto
"auto" => _(
Expand Down Expand Up @@ -1257,7 +1282,8 @@ def startmode_overview
)
}

startmode_descr = startmode_descrs[NetworkInterfaces.Current["STARTMODE"].to_s] || _("Started manually")
ifcfg = GetDeviceMap(item_id) || {}
startmode_descr = startmode_descrs[ifcfg["STARTMODE"].to_s] || _("Started manually")

[startmode_descr]
end
Expand Down Expand Up @@ -1323,7 +1349,7 @@ def BuildLanOverview
)

bullets << _("Device Name: %s") % ifcfg_name
bullets += startmode_overview
bullets += startmode_overview(key)
bullets += ip_overview(ip) if ifcfg_conf["STARTMODE"] != "managed"

if LanItems.type == "wlan" &&
Expand Down

0 comments on commit 7ad2fe4

Please sign in to comment.