Hello community, here is the log from the commit of package yast2-network for openSUSE:Factory checked in at 2014-06-18 10:59:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-network (Old) and /work/SRC/openSUSE:Factory/.yast2-network.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-network" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-network/yast2-network.changes 2014-06-02 07:00:49.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-network.new/yast2-network.changes 2014-06-18 10:59:44.000000000 +0200 @@ -1,0 +2,27 @@ +Sat Jun 14 20:20:57 UTC 2014 - [email protected] + +- bnc#880167 + - fixed internal error when renaming device +- bnc#877690 + - turned more labels into title style. +- 3.1.64 + +------------------------------------------------------------------- +Wed Jun 11 10:06:12 UTC 2014 - [email protected] + +- bnc#878719 + - handle inactive network service state + - allow disabling network service completely +- fixed disabling of unconfigureable items when e.g. NetworkManager + is used as network service +- 3.1.63 + +------------------------------------------------------------------- +Tue Jun 3 20:37:11 UTC 2014 - [email protected] + +- bnc#858908 + - write hostname into cross platform /etc/hostname instead of + SUSE specific /etc/HOSTNAME +- 3.1.62 + +------------------------------------------------------------------- Old: ---- yast2-network-3.1.61.tar.bz2 New: ---- yast2-network-3.1.64.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-network.spec ++++++ --- /var/tmp/diff_new_pack.rCvEEz/_old 2014-06-18 10:59:45.000000000 +0200 +++ /var/tmp/diff_new_pack.rCvEEz/_new 2014-06-18 10:59:45.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 3.1.61 +Version: 3.1.64 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-network-3.1.61.tar.bz2 -> yast2-network-3.1.64.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.61/package/yast2-network.changes new/yast2-network-3.1.64/package/yast2-network.changes --- old/yast2-network-3.1.61/package/yast2-network.changes 2014-05-30 16:53:46.000000000 +0200 +++ new/yast2-network-3.1.64/package/yast2-network.changes 2014-06-16 14:58:49.000000000 +0200 @@ -1,4 +1,31 @@ ------------------------------------------------------------------- +Sat Jun 14 20:20:57 UTC 2014 - [email protected] + +- bnc#880167 + - fixed internal error when renaming device +- bnc#877690 + - turned more labels into title style. +- 3.1.64 + +------------------------------------------------------------------- +Wed Jun 11 10:06:12 UTC 2014 - [email protected] + +- bnc#878719 + - handle inactive network service state + - allow disabling network service completely +- fixed disabling of unconfigureable items when e.g. NetworkManager + is used as network service +- 3.1.63 + +------------------------------------------------------------------- +Tue Jun 3 20:37:11 UTC 2014 - [email protected] + +- bnc#858908 + - write hostname into cross platform /etc/hostname instead of + SUSE specific /etc/HOSTNAME +- 3.1.62 + +------------------------------------------------------------------- Fri May 30 14:41:29 UTC 2014 - [email protected] - bnc#880754 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.61/package/yast2-network.spec new/yast2-network-3.1.64/package/yast2-network.spec --- old/yast2-network-3.1.61/package/yast2-network.spec 2014-05-30 16:53:46.000000000 +0200 +++ new/yast2-network-3.1.64/package/yast2-network.spec 2014-06-16 14:58:49.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 3.1.61 +Version: 3.1.64 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.61/src/clients/save_network.rb new/yast2-network-3.1.64/src/clients/save_network.rb --- old/yast2-network-3.1.61/src/clients/save_network.rb 2014-05-30 16:53:46.000000000 +0200 +++ new/yast2-network-3.1.64/src/clients/save_network.rb 2014-06-16 14:58:49.000000000 +0200 @@ -39,13 +39,9 @@ textdomain "network" - Yast.import "Hostname" - Yast.import "IP" - Yast.import "NetworkInterfaces" + Yast.import "DNS" Yast.import "FileUtils" - Yast.import "Netmask" Yast.import "NetworkStorage" - Yast.import "Proxy" Yast.import "Installation" Yast.import "String" Yast.import "Mode" @@ -103,7 +99,7 @@ { dir: SYSCONFIG, file: "ifcfg-*" }, { dir: SYSCONFIG, file: "ifroute-*" }, { dir: SYSCONFIG, file: "routes" }, - { dir: ETC, file: "HOSTNAME" } + { dir: ETC, file: DNSClass::HOSTNAME_FILE } ] # just copy files @@ -266,6 +262,8 @@ LanUdevAuto.Write if Mode.autoinst + DNS.create_hostname_link + SCR.Execute(path(".target.bash"), "chkconfig network on") # if portmap running - start it after reboot diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.61/src/include/network/lan/complex.rb new/yast2-network-3.1.64/src/include/network/lan/complex.rb --- old/yast2-network-3.1.61/src/include/network/lan/complex.rb 2014-05-30 16:53:46.000000000 +0200 +++ new/yast2-network-3.1.64/src/include/network/lan/complex.rb 2014-06-16 14:58:49.000000000 +0200 @@ -1,4 +1,4 @@ -# encoding: utf-8 +#, :gw6dev encoding: utf-8 #*************************************************************************** # @@ -360,7 +360,7 @@ UI.ChangeWidget(Id(:_hw_items), :Items, term_items) if !@shown - disableItemsIfNM([:_hw_items, :_hw_sum] + overview_buttons.keys, true) + disable_unconfigureable_items([:_hw_items, :_hw_sum] + overview_buttons.keys, true) @shown = true else enableDisableButtons @@ -372,8 +372,7 @@ end def handleOverview(key, event) - event = deep_copy(event) - if !disableItemsIfNM([:_hw_items, :_hw_sum] + overview_buttons.keys, false) + if !disable_unconfigureable_items([:_hw_items, :_hw_sum] + overview_buttons.keys, false) enableDisableButtons end UI.ChangeWidget(:_hw_sum, :Value, LanItems.GetItemDescription) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.61/src/include/network/lan/dhcp.rb new/yast2-network-3.1.64/src/include/network/lan/dhcp.rb --- old/yast2-network-3.1.61/src/include/network/lan/dhcp.rb 2014-05-30 16:53:46.000000000 +0200 +++ new/yast2-network-3.1.64/src/include/network/lan/dhcp.rb 2014-06-16 14:58:49.000000000 +0200 @@ -116,7 +116,7 @@ Ops.get_boolean(NetworkConfig.DHCP, "DHCLIENT_SET_DEFAULT_ROUTE", true) ) - disableItemsIfNM( + disable_unconfigureable_items( [:broadcast, :clientid, :hostname, :no_defaultroute], false ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.61/src/include/network/lan/hardware.rb new/yast2-network-3.1.64/src/include/network/lan/hardware.rb --- old/yast2-network-3.1.61/src/include/network/lan/hardware.rb 2014-05-30 16:53:46.000000000 +0200 +++ new/yast2-network-3.1.64/src/include/network/lan/hardware.rb 2014-06-16 14:58:49.000000000 +0200 @@ -46,7 +46,6 @@ Yast.import "LanItems" Yast.include include_target, "network/summary.rb" Yast.include include_target, "network/routines.rb" - # map NetworkCards Yast.include include_target, "network/lan/cards.rb" @hardware = nil @@ -160,7 +159,6 @@ def initHardware @hardware = {} - # hardware["modul"] = NetworkModules::Alias; // FIXME: MOD Lan::Module["module"]:""; Ops.set(@hardware, "hotplug", LanItems.hotplug) Builtins.y2milestone("hotplug=%1", LanItems.hotplug) Ops.set( @@ -272,6 +270,9 @@ initHardware + hotplug_type = @hardware["hotplug"] || "" + hw_type = @hardware["type"] || "" + _CheckBoxes = HBox( HSpacing(1.5), # CheckBox label @@ -279,15 +280,16 @@ Id(:pcmcia), Opt(:notify), _("&PCMCIA"), - Ops.get_string(@hardware, "hotplug", "") == "pcmcia" + hotplug_type == "pcmcia" ), HSpacing(1.5), + # CheckBox label CheckBox( Id(:usb), Opt(:notify), _("&USB"), - Ops.get_string(@hardware, "hotplug", "") == "usb" + hotplug_type == "usb" ), HSpacing(1.5) ) @@ -301,7 +303,7 @@ Id(:pci), Opt(:notify), _("P&CI"), - Ops.get_string(@hardware, "hotplug", "") == "pci" + hotplug_type == "pci" ), HSpacing(1.5) ) @@ -323,14 +325,14 @@ Id(:modul), Opt(:editable), _("&Module Name"), - Ops.get_list(@hardware, "modules_from_hwinfo", []) + @hardware["modules_from_hwinfo"] || [] ), - HSpacing(0.2), + HSpacing(0.5), InputField( Id(:options), Opt(:hstretch), Label.Options, - Ops.get_string(@hardware, "options", "") + @hardware["options"] || "" ) ), VSpacing(0.4), @@ -349,7 +351,7 @@ Id(:num), Opt(:editable, :hstretch), _("&Configuration Name"), - [Ops.get_string(@hardware, "device", "")] + [@hardware["device"] || ""] ) ) @@ -364,8 +366,8 @@ # ComboBox label _("&Device Type"), BuildTypesList( - Ops.get_list(@hardware, "device_types", []), - Ops.get_string(@hardware, "type", "") + @hardware["device_types"] || [], + hw_type ) ), HSpacing(1.5), @@ -377,7 +379,7 @@ _UdevWidget = # TODO: Ud ... Rules Frame( - _("Udev rules"), + _("Udev Rules"), HBox( InputField(Id(:device_name), Opt(:hstretch), _("Device Name"), ""), PushButton(Id(:change_udev), _("Change")) @@ -391,12 +393,12 @@ end _BlinkCard = Frame( - _("Show visible port identification"), + _("Show Visible Port Identification"), HBox( #translators: how many seconds will card be blinking IntField( Id(:blink_time), - Builtins.sformat("%1:", _("Seconds")), + "%s:" % _("Seconds"), 0, 100, 5 @@ -406,13 +408,13 @@ ) _EthtoolWidget = Frame( - _("Ethtool options"), + _("Ethtool Options"), HBox( InputField( Id(:ethtool_opts), Opt(:hstretch), _("Options"), - Ops.get_string(@hardware, "ethtool_options", "") + @hardware["ethtool_options"] || "" ) ) ) @@ -429,53 +431,47 @@ UI.ChangeWidget( :modul, :Value, - Ops.get_string(@hardware, "default_device", "") + @hardware["default_device"] || "" ) UI.ChangeWidget( Id(:modul), :Enabled, - Ops.get_boolean(@hardware, "no_hotplug_dummy", false) + !!@hardware["no_hotplug_dummy"] ) - # UI::ChangeWidget(`id(`options), `Enabled, hardware["no_hotplug_dummy"]:false); ChangeWidgetIfExists( Id(:list), :Enabled, - Ops.get_boolean(@hardware, "no_hotplug_dummy", false) + !!@hardware["no_hotplug_dummy"] ) ChangeWidgetIfExists( Id(:hwcfg), :Enabled, - Ops.get_boolean(@hardware, "no_hotplug", false) + !!@hardware["no_hotplug"] ) ChangeWidgetIfExists( Id(:usb), :Enabled, - (Ops.get_string(@hardware, "hotplug", "") == "usb" || - Ops.get_string(@hardware, "hotplug", "") == "") && - Ops.get_string(@hardware, "type", "") != "dummy" + (hotplug_type == "usb" || hotplug_type == "") && + hw_type != "dummy" ) ChangeWidgetIfExists( Id(:pcmcia), :Enabled, - (Ops.get_string(@hardware, "hotplug", "") == "pcmcia" || - Ops.get_string(@hardware, "hotplug", "") == "") && - Ops.get_string(@hardware, "type", "") != "dummy" + (hotplug_type == "pcmcia" || hotplug_type == "") && + hw_type != "dummy" ) + device_name = LanItems.current_udev_name + ChangeWidgetIfExists(Id(:device_name), :Enabled, false) - ChangeWidgetIfExists( - Id(:device_name), - :Value, - LanItems.GetItemUdev("NAME") - ) + ChangeWidgetIfExists(Id(:device_name), :Value, device_name) ChangeWidgetIfExists(Id(:dev), :Enabled, false) if !isNewDevice ChangeWidgetIfExists( Id(:num), :ValidChars, NetworkInterfaces.ValidCharsIfcfg - ) - # ChangeWidgetIfExists(`id(`hwcfg), `ValidChars, NetworkModules::ValidCharsHwcfg ()); + ) nil end @@ -527,7 +523,6 @@ while true ret = UI.UserInput - # abort? if ret == :abort || ret == :cancel if ReallyAbort() break @@ -579,9 +574,6 @@ selected = 0 if selected == nil card = Ops.get(hwlist, selected, {}) LanItems.description = Ops.get_string(card, "name", "") - - # NetworkModules::Alias /* FIXME: MOD Lan::Module["module"] */ = card["module"]:""; - # NetworkModules::Options /* FIXME: MOD Lan::Module["options"] */ = card["options"]:""; end deep_copy(ret) @@ -604,7 +596,6 @@ ret = Ops.get_symbol(event, "WidgetID") end SelectionDialog() if ret == :list - # if (ret == `abort) LanItems::Rollback(); if ret == :pcmcia || ret == :usb || ret == :dev if UI.WidgetExists(Id(:pcmcia)) || UI.WidgetExists(Id(:usb)) if UI.QueryWidget(Id(:pcmcia), :Value) == true @@ -1163,9 +1154,6 @@ UI.SetFocus(Id(:chan_mode)) end - # FIXME: no spaces - # UI::ChangeWidget(`id(`key), `ValidChars, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_:;"); - ret = nil while true if drvtype == "qeth" @@ -1290,13 +1278,11 @@ Wizard.OpenNextBackDialog Wizard.SetContents(caption, contents, initHelp, false, true) Wizard.SetAbortButton(:cancel, Label.CancelButton) - # Wizard::DisableBackButton(); ret = CWM.Run( - w, #`abort:ReallyAbort + w, {} ) Wizard.CloseDialog - # Wizard::RestoreAbortButton(); deep_copy(ret) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.61/src/include/network/routines.rb new/yast2-network-3.1.64/src/include/network/routines.rb --- old/yast2-network-3.1.61/src/include/network/routines.rb 2014-05-30 16:53:46.000000000 +0200 +++ new/yast2-network-3.1.64/src/include/network/routines.rb 2014-06-16 14:58:49.000000000 +0200 @@ -1086,31 +1086,36 @@ end - # Check if we're running in "normal" stage with NM + def unconfigureable_service? + return true if Mode.normal && NetworkService.is_network_manager + return true if NetworkService.is_disabled + + return false + end + + # Disables all widgets which cannot be configured with current network service + # # see bnc#433084 # if listed any items, disable them, if show_popup, show warning popup + # + # returns true if items were disabled + def disable_unconfigureable_items(items, show_popup) + return false if !unconfigureable_service? - def disableItemsIfNM(items, show_popup) - items = deep_copy(items) - disable = true - if Mode.normal && NetworkService.is_network_manager - Builtins.foreach(items) { |w| UI.ChangeWidget(Id(w), :Enabled, false) } - if show_popup - Popup.Warning( - _( - "Network is currently controlled by NetworkManager and its settings \n" + - "cannot be edited by YaST.\n" + - "\n" + - "To edit the settings, use the NetworkManager connection editor or\n" + - "switch the network setup method to Traditional with ifup.\n" - ) + items.each { |i| UI.ChangeWidget(Id(i), :Enabled, false) } + + if show_popup + Popup.Warning( + _( + "Network is currently handled by an unsupported network service\n" + + "or completely disabled. YaST is unable to configure some options." ) - UI.FakeUserInput({ "ID" => "global" }) - end - else - disable = false + ) + UI.FakeUserInput({ "ID" => "global" }) end - disable + + return true end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.61/src/include/network/services/dns.rb new/yast2-network-3.1.64/src/include/network/services/dns.rb --- old/yast2-network-3.1.61/src/include/network/services/dns.rb 2014-05-30 16:53:46.000000000 +0200 +++ new/yast2-network-3.1.64/src/include/network/services/dns.rb 2014-06-16 14:58:49.000000000 +0200 @@ -573,7 +573,7 @@ UI.ChangeWidget(Id("PLAIN_POLICY"), :Enabled, false) end #then disable if needed - disableItemsIfNM(["PLAIN_POLICY"], false) + disable_unconfigureable_items(["PLAIN_POLICY"], false) nil end @@ -612,7 +612,7 @@ UI.ChangeWidget(Id("MODIFY_RESOLV"), :Value, default) #then disable if needed - disableItemsIfNM(["MODIFY_RESOLV"], false) + disable_unconfigureable_items(["MODIFY_RESOLV"], false) nil end @@ -652,7 +652,7 @@ ) ) { |key2| InitHnWidget(key2) } #disable those if NM is in charge - disableItemsIfNM( + disable_unconfigureable_items( ["NAMESERVER_1", "NAMESERVER_2", "NAMESERVER_3", "SEARCHLIST_S"], false ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.61/src/include/network/services/routing.rb new/yast2-network-3.1.64/src/include/network/services/routing.rb --- old/yast2-network-3.1.61/src/include/network/services/routing.rb 2014-05-30 16:53:46.000000000 +0200 +++ new/yast2-network-3.1.64/src/include/network/services/routing.rb 2014-06-16 14:58:49.000000000 +0200 @@ -329,7 +329,10 @@ UI.ChangeWidget(Id(:table), :Enabled, enabled) UI.ChangeWidget(Id(:forward_v4), :Enabled, enabled) UI.ChangeWidget(Id(:forward_v6), :Enabled, enabled) - disableItemsIfNM([:gw, :table, :add, :edit, :delete], false) + disable_unconfigureable_items( + [:gw, :gw6, :gw6dev, :table, :add, :edit, :delete], + false + ) if !Lan.ipv6 UI.ChangeWidget(Id(:gw6), :Enabled, false) UI.ChangeWidget(Id(:gw6dev), :Enabled, false) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.61/src/include/network/widgets.rb new/yast2-network-3.1.64/src/include/network/widgets.rb --- old/yast2-network-3.1.61/src/include/network/widgets.rb 2014-05-30 16:53:46.000000000 +0200 +++ new/yast2-network-3.1.64/src/include/network/widgets.rb 2014-06-16 14:58:49.000000000 +0200 @@ -292,12 +292,14 @@ # @param [String] key id of the widget def ManagedInit(key) items = [] + any_service_active = false + if NetworkService.is_backend_available(:network_manager) items << Item( Id("managed"), # the user can control the network with the NetworkManager program _("NetworkManager Service"), - NetworkService.is_network_manager + any_service_active = NetworkService.is_network_manager ) end if NetworkService.is_backend_available(:netconfig) @@ -305,7 +307,7 @@ Id("ifup"), # ifup is a program name _("Traditional ifup"), - NetworkService.is_netconfig + any_service_active = NetworkService.is_netconfig ) end if NetworkService.is_backend_available(:wicked) @@ -313,10 +315,17 @@ Id("wicked"), # wicked is network configuration backend like netconfig _("Wicked Service"), - NetworkService.is_wicked + any_service_active = NetworkService.is_wicked ) end + items << Item( + Id("disabled"), + # used when no network service is active or to disable network service + _("Network Services Disabled"), + !any_service_active + ) + UI.ChangeWidget(Id(:managed), :Items, items) nil @@ -335,6 +344,8 @@ NetworkService.use_network_manager when "wicked" NetworkService.use_wicked + else + NetworkService.disable end if NetworkService.Modified diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.61/src/lib/network/edit_nic_name.rb new/yast2-network-3.1.64/src/lib/network/edit_nic_name.rb --- old/yast2-network-3.1.61/src/lib/network/edit_nic_name.rb 2014-05-30 16:53:46.000000000 +0200 +++ new/yast2-network-3.1.64/src/lib/network/edit_nic_name.rb 2014-06-16 14:58:49.000000000 +0200 @@ -30,8 +30,7 @@ current_item = LanItems.getCurrentItem - @old_name = LanItems.GetItemUdev("NAME") - + @old_name = LanItems.current_udev_name @old_key = MAC_UDEV_ATTR unless LanItems.GetItemUdev( MAC_UDEV_ATTR).empty? @old_key = BUSID_UDEV_ATTR unless LanItems.GetItemUdev( BUSID_UDEV_ATTR).empty? @@ -51,6 +50,7 @@ open ret = nil + new_name = @old_name while ![:cancel, :abort, :ok].include? ret ret = UI.UserInput @@ -58,15 +58,13 @@ when :ok new_name = UI.QueryWidget(:dev_name, :Value) - if new_name != @old_name - if CheckUdevNicName(new_name) - LanItems.SetCurrentName( new_name) - else - UI.SetFocus(:dev_name) - ret = nil + if CheckUdevNicName(new_name) + LanItems.rename(new_name) + else + UI.SetFocus(:dev_name) + ret = nil - next - end + next end if UI.QueryWidget(:udev_type, :CurrentButton) == :mac @@ -84,7 +82,7 @@ close - LanItems.GetCurrentName + new_name end private @@ -94,13 +92,13 @@ VBox( Left( HBox( - Label(_("Device name:")), + Label(_("Device Name:")), InputField(Id(:dev_name), Opt(:hstretch), "", @old_name) ) ), VSpacing(0.5), Frame( - _("Base udev rule on"), + _("Base Udev Rule On"), RadioButtonGroup( Id(:udev_type), VBox( @@ -150,7 +148,8 @@ # # @return [boolean] false if name is invalid def CheckUdevNicName(name) - if UsedNicName(name) + # check if the name is assigned to another device already + if UsedNicName(name) && name != LanItems.GetCurrentName Popup.Error(_("Configuration name already exists.")) return false end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.61/src/lib/network/install_inf_convertor.rb new/yast2-network-3.1.64/src/lib/network/install_inf_convertor.rb --- old/yast2-network-3.1.61/src/lib/network/install_inf_convertor.rb 2014-05-30 16:53:46.000000000 +0200 +++ new/yast2-network-3.1.64/src/lib/network/install_inf_convertor.rb 2014-06-16 14:58:49.000000000 +0200 @@ -23,6 +23,7 @@ def initialize Yast.import "Hostname" + Yast.import "DNS" Yast.import "IP" Yast.import "NetworkInterfaces" Yast.import "FileUtils" @@ -186,7 +187,7 @@ return false if hostname.empty? log.info("Write HOSTNAME: #{hostname}") - SCR.Write(path(".target.string"), "/etc/HOSTNAME", hostname) + SCR.Write(path(".target.string"), DNSClass::HOSTNAME_PATH, hostname) end def write_dns diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.61/src/modules/DNS.rb new/yast2-network-3.1.64/src/modules/DNS.rb --- old/yast2-network-3.1.61/src/modules/DNS.rb 2014-05-30 16:53:46.000000000 +0200 +++ new/yast2-network-3.1.64/src/modules/DNS.rb 2014-06-16 14:58:49.000000000 +0200 @@ -33,6 +33,12 @@ module Yast class DNSClass < Module + + include Logger + + HOSTNAME_FILE = "hostname" + HOSTNAME_PATH = "/etc/" + HOSTNAME_FILE + def main Yast.import "UI" textdomain "network" @@ -45,6 +51,7 @@ Yast.import "Progress" Yast.import "Service" Yast.import "String" + Yast.import "FileUtils" Yast.include self, "network/routines.rb" Yast.include self, "network/runtime.rb" @@ -225,51 +232,17 @@ fqhostname = "" # In installation (standard, or AutoYaST one), prefer /etc/install.inf # (because HOSTNAME comes with netcfg.rpm already, #144687) - if (Mode.installation || Mode.autoinst) && - Ops.greater_than( - SCR.Read(path(".target.size"), "/etc/install.inf"), - 0 - ) - install_inf_hostname = Convert.to_string( - SCR.Read(path(".etc.install_inf.Hostname")) - ) - Builtins.y2milestone("Got %1 from install.inf", install_inf_hostname) - - if Ops.greater_than(Builtins.size(install_inf_hostname), 0) - #if the name is actually IP, try to resolve it (bnc#556613, bnc#435649) - if IP.Check(install_inf_hostname) - fqhostname = ResolveIP(install_inf_hostname) - Builtins.y2milestone( - "Got %1 after resolving IP from install.inf", - fqhostname - ) - else - fqhostname = install_inf_hostname - end - end + if (Mode.installation || Mode.autoinst) && FileUtils.Exists("/etc/install.inf") + fqhostname = read_hostname_from_install_inf end - # We have non-empty hostname by now => we must set DNS modified flag - # in order to get the setting actually written (bnc#588938) - @modified = true if Ops.greater_than(Builtins.size(fqhostname), 0) - - - # /etc/HOSTNAME - # the usual location - if fqhostname == "" - if Ops.greater_than(SCR.Read(path(".target.size"), "/etc/HOSTNAME"), 0) - fqhostname = Convert.to_string( - SCR.Read(path(".target.string"), "/etc/HOSTNAME") - ) - #avoid passing nil argument when we get non-\n-terminated string (#445531) - fqhostname = String.FirstChunk(fqhostname, "\n") - Builtins.y2milestone("Got %1 from /etc/HOSTNAME", fqhostname) - end + if fqhostname.empty? + fqhostname = read_hostname_from_etc end split = Hostname.SplitFQ(fqhostname) - @hostname = Ops.get(split, 0, "") - @domain = Ops.get(split, 1, "") + @hostname = split[0] || "" + @domain = split[1] || "" # last resort if @hostname == "" @@ -420,9 +393,12 @@ # write hostname SCR.Write( path(".target.string"), - "/etc/HOSTNAME", + HOSTNAME_PATH, Ops.add(fqhostname, "\n") ) + + create_hostname_link + Builtins.sleep(sl) # Progress step 2/3 @@ -671,6 +647,61 @@ false end + # Creates symlink /etc/HOSTNAME -> /etc/hostname to gurantee backward compatibility + # after changes in bnc#858908 + def create_hostname_link + link_name = "/etc/HOSTNAME" + return if FileUtils.IsLink(link_name) + + log.info "Creating #{link_name} symlink" + + SCR.Execute(path(".target.bash"), "rm #{link_name}") if FileUtils.Exists(link_name) + SCR.Execute(path(".target.bash"), "ln -s #{DNSClass::HOSTNAME_PATH} #{link_name}") + + nil + end + + private + def read_hostname_from_install_inf + install_inf_hostname = SCR.Read(path(".etc.install_inf.Hostname")) || "" + log.info("Got #{install_inf_hostname} from install.inf") + + return "" if install_inf_hostname.empty? + + #if the name is actually IP, try to resolve it (bnc#556613, bnc#435649) + if IP.Check(install_inf_hostname) + fqhostname = ResolveIP(install_inf_hostname) + log.info("Got #{fqhostname} after resolving IP from install.inf") + else + fqhostname = install_inf_hostname + end + + # We have non-empty hostname by now => we must set DNS modified flag + # in order to get the setting actually written (bnc#588938) + @modified = true if !fqhostname.empty? + + return fqhostname + end + + def read_hostname_from_etc + if FileUtils.Exists(HOSTNAME_PATH) + hostname_path = HOSTNAME_PATH + elsif FileUtils.Exists("/etc/HOSTNAME") + # backward compatibility due to changes done in bnc#858908 + hostname_path = "/etc/HOSTNAME" + else + return "" + end + + fqhostname = SCR.Read(path(".target.string"), hostname_path) || "" + + #avoid passing nil argument when we get non-\n-terminated string (#445531) + fqhostname = String.FirstChunk(fqhostname, "\n") + log.info("Read #{fqhostname} from '/etc/'") + + return fqhostname + end + publish :variable => :proposal_valid, :type => "boolean" publish :variable => :hostname, :type => "string" publish :variable => :domain, :type => "string" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.61/src/modules/Lan.rb new/yast2-network-3.1.64/src/modules/Lan.rb --- old/yast2-network-3.1.61/src/modules/Lan.rb 2014-05-30 16:53:46.000000000 +0200 +++ new/yast2-network-3.1.64/src/modules/Lan.rb 2014-06-16 14:58:49.000000000 +0200 @@ -555,17 +555,7 @@ return false if Abort() # Progress step 3 - multiple devices may be present, really plural ProgressNextStage(_("Writing device configuration...")) - if !Mode.autoinst && LanUdevAuto.AllowUdevModify - LanItems.WriteUdevRules - # wait so that ifcfgs written in NetworkInterfaces are newer - # (1-second-wise) than netcontrol status files, - # and rcnetwork reload actually works (bnc#749365) - SCR.Execute(path(".target.bash"), "udevadm settle") - Builtins.sleep(1000) - end - # hack: no "netcard" filter as biosdevname names it diferently (bnc#712232) - NetworkInterfaces.Write("") - # WriteDevices(); + LanItems.write Builtins.sleep(sl) return false if Abort() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.61/src/modules/LanItems.rb new/yast2-network-3.1.64/src/modules/LanItems.rb --- old/yast2-network-3.1.61/src/modules/LanItems.rb 2014-05-30 16:53:46.000000000 +0200 +++ new/yast2-network-3.1.64/src/modules/LanItems.rb 2014-06-16 14:58:49.000000000 +0200 @@ -333,6 +333,15 @@ ) end + # Returns name which is going to be used in the udev rule + def current_udev_name + if LanItems.current_renamed? + LanItems.current_renamed_to + else + LanItems.GetItemUdev("NAME") + end + end + # transforms given list of item ids onto device names # # item id is index into internal @Items structure @@ -549,6 +558,34 @@ SetItemName( @current, name) end + # Sets new device name for current item + def rename(name) + if(GetCurrentName() != name) + @Items[@current]["renamed_to"] = name + else + @Items[@current].delete("renamed_to") + end + end + + # Returns new name for current item + def renamed_to(item_id) + @Items[item_id]["renamed_to"] + end + + def current_renamed_to + renamed_to(@current) + end + + # Tells if current item was renamed + def renamed?(item_id) + return false if !@Items[item_id].has_key?("renamed_to") + renamed_to(item_id) != GetDeviceName(item_id) + end + + def current_renamed? + renamed?(@current) + end + # Writes udev rules for all items. # # Currently only interesting change is renaming interface. @@ -660,9 +697,28 @@ WriteUdevItemsRules() WriteUdevDriverRules() + # wait so that ifcfgs written in NetworkInterfaces are newer + # (1-second-wise) than netcontrol status files, + # and rcnetwork reload actually works (bnc#749365) + SCR.Execute(path(".target.bash"), "udevadm settle") + sleep(1) + nil end + def write + renamed_items = @Items.keys.select { |item_id| renamed?(item_id) } + renamed_items.each do |item_id| + NetworkInterfaces.Change2(renamed_to(item_id), GetDeviceMap(item_id), false) + SetItemName(item_id, renamed_to(item_id)) + end + + LanItems.WriteUdevRules if !Mode.autoinst && LanUdevAuto.AllowUdevModify + + # FIXME: hack: no "netcard" filter as biosdevname names it diferently (bnc#712232) + NetworkInterfaces.Write("") + end + # Function which returns if the settings were modified # @return [Boolean] settings were modified def GetModified @@ -1324,6 +1380,10 @@ bullets << bond_master_desc end + if renamed?(key) + note = ("%s -> %s") % [GetDeviceName(key), renamed_to(key)] + end + overview << Summary.Device(descr, status) else descr = CheckEmptyName(@type, descr) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.61/test/edit_nic_name_test.rb new/yast2-network-3.1.64/test/edit_nic_name_test.rb --- old/yast2-network-3.1.61/test/edit_nic_name_test.rb 2014-05-30 16:53:46.000000000 +0200 +++ new/yast2-network-3.1.64/test/edit_nic_name_test.rb 2014-06-16 14:58:49.000000000 +0200 @@ -25,6 +25,8 @@ # mock devices configuration LanItems.stub( :ReadHardware) { [ { "dev_name" => CURRENT_NAME } ] } LanItems.stub( :getNetworkInterfaces) { [ CURRENT_NAME ] } + LanItems.stub( :GetItemUdev) { "" } + LanItems.stub( :GetItemUdev).with("NAME") { CURRENT_NAME } # LanItems initialization Yast.import "LanItems" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.61/testsuite/tests/Network_YaPI.out new/yast2-network-3.1.64/testsuite/tests/Network_YaPI.out --- old/yast2-network-3.1.61/testsuite/tests/Network_YaPI.out 2014-05-30 16:53:46.000000000 +0200 +++ new/yast2-network-3.1.64/testsuite/tests/Network_YaPI.out 2014-06-16 14:58:49.000000000 +0200 @@ -6,8 +6,8 @@ Read .sysconfig.network.config.NETCONFIG_DNS_POLICY nil Read .sysconfig.network.config.NETCONFIG_DNS_STATIC_SERVERS "208.67.222.222 208.67.220.220" Read .sysconfig.network.config.NETCONFIG_DNS_STATIC_SEARCHLIST "suse.cz suse.de" -Read .target.size "/etc/HOSTNAME" 27 -Read .target.string "/etc/HOSTNAME" "laptop.suse.cz" +Read .target.stat "/etc/hostname" $["exists":true] +Read .target.string "/etc/hostname" "laptop.suse.cz" Read .target.size "/etc/sysconfig/network/routes" 27 Read .routes [$["destination":"default", "gateway":"10.20.30.40"]] Execute .target.bash "rpm -q --whatprovides SuSEfirewall2" 0 -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
