Author: kmachalkova
Date: Fri Apr 16 15:15:42 2010
New Revision: 61734
URL: http://svn.opensuse.org/viewcvs/yast?rev=61734&view=rev
Log: (empty)
Modified:
trunk/network/package/yast2-network.changes
trunk/network/src/lan/address.ycp
trunk/network/src/modules/DNS.ycp
trunk/network/src/modules/Host.ycp
trunk/network/testsuite/tests/Network_YaPI.out
Modified: trunk/network/package/yast2-network.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/package/yast2-network.changes?rev=61734&r1=61733&r2=61734&view=diff
==============================================================================
--- trunk/network/package/yast2-network.changes (original)
+++ trunk/network/package/yast2-network.changes Fri Apr 16 15:15:42 2010
@@ -1,4 +1,16 @@
-------------------------------------------------------------------
+Fri Apr 16 13:02:10 UTC 2010 - kmachalkova@novell.com
+
+- Rollup patch with several Code11 bugfixes:
+ - Include in cloned data (bnc#576495)
+ - Don't check for presence of static IPs when deciding whether to
+ append 127.0.0.2 line to /etc/hosts
+ - Pre-fill hostname field with global hostname in static IP dialog
+ - Warn if no hostname is specified for static IP (all bnc#583786)
+ - In [auto]installation, prefer hostname from install.inf. Convert
+ to FQDN if it is an IP address (bnc#556613, bnc#502715)
+
+-------------------------------------------------------------------
Tue Apr 13 13:18:57 CEST 2010 - mzugec@suse.cz
- allow vlan on top of bonding device (bnc#591835)
Modified: trunk/network/src/lan/address.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/address.ycp?rev=61734&r1=61733&r2=61734&view=diff
==============================================================================
--- trunk/network/src/lan/address.ycp (original)
+++ trunk/network/src/lan/address.ycp Fri Apr 16 15:15:42 2010
@@ -14,6 +14,7 @@
import "Arch";
import "CWM";
import "CWMTab";
+import "DNS";
import "Host";
import "Hostname";
import "IP";
@@ -252,12 +253,19 @@
symbol handleBootProto (string key, map event) {
- if (event["EventReason"]:""=="ValueChanged"){
- symbol current = (symbol)UI::QueryWidget(`id(`bootproto), `CurrentButton);
- enableDisableBootProto(current);
-// if (current == `none) settings["STARTMODE"] = "off";
- }
- return nil;
+ if (event["EventReason"]:""=="ValueChanged"){
+ symbol current = (symbol)UI::QueryWidget(`id(`bootproto), `CurrentButton);
+ enableDisableBootProto(current);
+
+ if (current == `static) {
+ string one_ip = (string) UI::QueryWidget(`id(`ipaddr), `Value);
+ if ( size(one_ip) == 0) {
+ y2milestone("Presetting global hostname");
+ UI::ChangeWidget(`id(`hostname), `Value, Hostname::MergeFQ(DNS::hostname, DNS::domain));
+ }
+ }
+ }
+ return nil;
}
@@ -458,12 +466,25 @@
return false;
}
- string h = (string) UI::QueryWidget(`hostname, `Value );
- if ( h != "" && !Hostname::CheckFQ(h)) {
- Popup::Error(_("No valid hostname."));
- UI::SetFocus(`hostname);
- return false;
+ string hname = (string) UI::QueryWidget(`hostname, `Value );
+ if ( size(hname) > 0 ) {
+ if( !Hostname::CheckFQ(hname) ) {
+ Popup::Error(_("Invalid hostname."));
+ UI::SetFocus(`hostname);
+ return false;
+ }
+ } else {
+ // There'll be no 127.0.0.2 -> remind user to define some hostname
+ if( !Host::NeedDummyIP() &&
+ !Popup::YesNo( _("No hostname has been specified. It is recommended to associate
+some hostname with static IP, otherwise the machine name will
+not be resolvable without active network connection.\n
+Really leave the hostname blank?")) ) {
+ UI::SetFocus(`hostname);
+ return false;
+ }
}
+
// validate duplication
if (NetHwDetection::DuplicateIP (ipa))
{
Modified: trunk/network/src/modules/DNS.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/modules/DNS.ycp?rev=61734&r1=61733&r2=61734&view=diff
==============================================================================
--- trunk/network/src/modules/DNS.ycp (original)
+++ trunk/network/src/modules/DNS.ycp Fri Apr 16 15:15:42 2010
@@ -52,8 +52,6 @@
// fully qualified
string oldhostname = "";
-/* install.inf from linuxrc */
-map install_inf = $[];
/**
* Data was modified?
*/
@@ -109,6 +107,24 @@
return ret;
}
+//Copied from former Detection.ycp
+/**
+ * Resolve IP to hostname
+ * @param ip given IP address
+ * @return resolved host
+ */
+string ResolveIP(string ip) {
+ string command = "/usr/bin/getent hosts \"%1\" | sed \"s/^[0-9.: \t]\\+//g\"";
+ map getent = (map) SCR::Execute(.target.bash_output, sformat(command, ip));
+ string hnent = getent["stdout"]:"";
+ y2debug("%1", hnent);
+ hnent = String::FirstChunk (hnent, " \t\n");
+ if(hnent == nil) hnent = "";
+ y2debug("'%1'", hnent);
+ return String::CutBlanks(hnent);
+}
+
+
global boolean DefaultWriteHostname() {
// FaTe#303875: Introduce a switch regarding 127.0.0.2 entry in /etc/hosts
boolean whth = ProductFeatures::GetBooleanFeature ("globals", "write_hostname_to_hosts");
@@ -118,13 +134,23 @@
global void ReadHostname() {
- // prefer /etc/install.inf
+ string fqhostname = "";
+ // In installation (standard, or AutoYaST one), prefer /etc/install.inf
// (because HOSTNAME comes with netcfg.rpm already, #144687)
- string fqhostname = install_inf["Hostname"]:""; // Machinename never existed??
- // if the name is actually an IP only, we discard it too
- if (IP::Check (fqhostname))
- {
- fqhostname = "";
+ if( (Mode::installation() || Mode::autoinst()) &&
+ SCR::Read(.target.size, "/etc/install.inf") > 0) {
+ string install_inf_hostname = (string) SCR::Read(.etc.install_inf.Hostname);
+ y2milestone("Got %1 from install.inf", install_inf_hostname);
+
+ if ( 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 );
+ y2milestone("Got %1 after resolving IP from install.inf", fqhostname);
+ }
+ else
+ fqhostname = install_inf_hostname;
+ }
}
// We have non-empty hostname by now => we must set DNS modified flag
@@ -142,6 +168,7 @@
fqhostname = (string) SCR::Read (.target.string, "/etc/HOSTNAME");
//avoid passing nil argument when we get non-\n-terminated string (#445531)
fqhostname = String::FirstChunk( fqhostname, "\n" );
+ y2milestone("Got %1 from /etc/HOSTNAME", fqhostname);
}
}
@@ -189,17 +216,9 @@
string tmp2 = (string) SCR::Read(.sysconfig.network.dhcp.WRITE_HOSTNAME_TO_HOSTS);
write_hostname = ( tmp2 == "yes");
- if(SCR::Read(.target.size, "/etc/install.inf") > 0)
- install_inf = (map) SCR::Read(.etc.install_inf);
- // bogus?!
- y2milestone ("install.inf: %1", install_inf);
-
resolv_conf_policy = (string)SCR::Read(.sysconfig.network.config.NETCONFIG_DNS_POLICY);
list<string> resolvlist = splitstring((string)SCR::Read(.sysconfig.network.config.NETCONFIG_DNS_STATIC_SERVERS), " ");
- if(resolvlist == nil) {
- ReadNameserver (install_inf["Nameserver"]:"");
- }
- else
+ if( size(resolvlist) > 0)
nameservers = resolvlist;
searchlist = splitstring((string)SCR::Read(.sysconfig.network.config.NETCONFIG_DNS_STATIC_SEARCHLIST), " ");
@@ -318,6 +337,7 @@
dhcp_hostname = settings["dhcp_hostname"]:false;
//if not defined, set to 'auto'
resolv_conf_policy = settings["resolv_conf_policy"]:"auto";
+
// user-defined value has higher priority - FaTE#305281
if ( haskey(settings, "write_hostname") )
write_hostname = settings["write_hostname"]:false;
@@ -340,7 +360,9 @@
nameservers = (list<string>) eval(settings["nameservers"]:[]);
searchlist = (list<string>) eval(settings["searchlist"]:[]);
modified = true;
- initialized = true;
+ // empty settings means that we're probably resetting the config
+ // thus, setup is not initialized anymore
+ initialized = ( settings != $[] );
y2milestone("DNS Import:");
y2milestone("nameservers=%1", nameservers);
@@ -369,6 +391,8 @@
expdns["dhcp_hostname"] = dhcp_hostname;
//TODO: test if it really works with empty string
expdns["resolv_conf_policy"] = resolv_conf_policy;
+ //bnc#576495, FaTE#305281 - clone write_hostname, too
+ expdns["write_hostname"] = write_hostname;
return expdns;
}
Modified: trunk/network/src/modules/Host.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/modules/Host.ycp?rev=61734&r1=61733&r2=61734&view=diff
==============================================================================
--- trunk/network/src/modules/Host.ycp (original)
+++ trunk/network/src/modules/Host.ycp Fri Apr 16 15:15:42 2010
@@ -50,44 +50,29 @@
boolean initialized = false;
-boolean AnyStaticIP() {
- NetworkInterfaces::Read ();
- list<string> devs =
- NetworkInterfaces::Locate ("BOOTPROTO", "static");
- list<string> ips = maplist(string dev, devs, {
- return NetworkInterfaces::GetValue(dev, "IPADDR");
- });
-
- y2milestone("%1 %2", devs, ips);
- return ( size(ips) > 0 );
-}
-
-boolean NeedDummyIP() {
- boolean ret = ( DNS::write_hostname && !AnyStaticIP() );
- if (ret)
- y2milestone("No (static) IP address found, dummy 127.0.0.2 will be added");
- return ret;
+global boolean NeedDummyIP() {
+ return DNS::write_hostname;
}
global void EnsureHostnameResolvable() {
string local_ip = "127.0.0.2";
if ( NeedDummyIP() ) {
+ y2milestone("Dummy 127.0.0.2 IP will be added");
//Add 127.0.0.2 entry to /etc/hosts,if product default says so
//or user requests it otherwise some desktop apps may hang,
//being unable to resolve hostname (bnc#304632)
string fqhostname = Hostname::MergeFQ( DNS::hostname, DNS::domain);
hosts[ local_ip ] = [ fqhostname + " " + DNS::hostname ];
- modified = true;
}
else {
- // do not add it if product default says no or if there are some
- // static IPs (bnc#469752)
+ // Do not add it if product default says no
+ // and remove 127.0.02 entry if it exists
if( haskey( hosts, local_ip) ) {
hosts[ local_ip] = [];
- modified = true;
}
}
+ modified = true;
}
/**
Modified: trunk/network/testsuite/tests/Network_YaPI.out
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/testsuite/tests/Network_YaPI.out?rev=61734&r1=61733&r2=61734&view=diff
==============================================================================
--- trunk/network/testsuite/tests/Network_YaPI.out (original)
+++ trunk/network/testsuite/tests/Network_YaPI.out Fri Apr 16 15:15:42 2010
@@ -2,8 +2,6 @@
Log Failed to set temporary directory: nil
Read .sysconfig.network.dhcp.DHCLIENT_SET_HOSTNAME "no"
Read .sysconfig.network.dhcp.WRITE_HOSTNAME_TO_HOSTS "no"
-Read .target.size "/etc/install.inf" 27
-Read .etc.install_inf nil
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"
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org