Mailinglist Archive: yast-commit (502 mails)

< Previous Next >
[yast-commit] r64203 - in /branches/SuSE-Code-11-SP1-Branch/network/src: installation/inst_hostname.ycp modules/Host.ycp
Author: mvidner
Date: Fri Jun 3 11:47:09 2011
New Revision: 64203

URL: http://svn.opensuse.org/viewcvs/yast?rev=64203&view=rev
Log:
Make the hostname resolvable to our static addresses (bnc#664929).

Write to /etc/hosts from the standalone hostname dialog already,
so that static IP configured from Linuxrc is not dependent on the
hostname logic in the ip address UI.

Modified:
branches/SuSE-Code-11-SP1-Branch/network/src/installation/inst_hostname.ycp
branches/SuSE-Code-11-SP1-Branch/network/src/modules/Host.ycp

Modified:
branches/SuSE-Code-11-SP1-Branch/network/src/installation/inst_hostname.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/network/src/installation/inst_hostname.ycp?rev=64203&r1=64202&r2=64203&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/network/src/installation/inst_hostname.ycp
(original)
+++ branches/SuSE-Code-11-SP1-Branch/network/src/installation/inst_hostname.ycp
Fri Jun 3 11:47:09 2011
@@ -14,6 +14,7 @@
import "Arch";
import "DNS";
import "GetInstArgs";
+import "Host";
import "NetworkConfig";
import "String";
import "Wizard";
@@ -57,6 +58,10 @@

if (ret == `next)
{
+ Host::Read();
+ Host::ResolveHostnameToStaticIPs();
+ Host::Write();
+
// do not let Lan override us, #152218
DNS::proposal_valid = true;


Modified: branches/SuSE-Code-11-SP1-Branch/network/src/modules/Host.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/network/src/modules/Host.ycp?rev=64203&r1=64202&r2=64203&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/network/src/modules/Host.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/network/src/modules/Host.ycp Fri Jun 3
11:47:09 2011
@@ -303,6 +303,27 @@
return summary;
}

+list<string> StaticIPs() {
+ NetworkInterfaces::Read ();
+ list<string> devs = NetworkInterfaces::Locate ("BOOTPROTO", "static");
+ devs = filter(string dev, devs, { return dev != "lo"; });
+ list<string> ips = maplist(string dev, devs, {
+ return NetworkInterfaces::GetValue(dev, "IPADDR");
+ });
+ y2milestone("ifcfgs: %1 IPs: %2", devs, ips);
+ return ips;
+}
+
+// if we have a static address,
+// make sure /etc/hosts resolves it to our, bnc#664929
+global void ResolveHostnameToStaticIPs() {
+ list<string> static_ips = StaticIPs();
+ if (size(static_ips) > 0) {// excluding lo
+ string fqhostname = Hostname::MergeFQ( DNS::hostname, DNS::domain);
+ Update(fqhostname, fqhostname, static_ips);
+ }
+}
+
/**
* Function which returns if the settings were modified
* @return boolean settings were modified

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages