Michal, please, check the diffs and proposed changes below. Does it make sense to you? Did you have any plans for unification?

On 05/19/2013 11:19 PM, Cristian Rodríguez wrote:
---
  src/clients/save_network.ycp     | 2 +-
  src/lan/help.ycp                 | 2 +-
  src/modules/DNS.ycp              | 8 ++++----
  testsuite/tests/Network_YaPI.out | 4 ++--
  4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/clients/save_network.ycp b/src/clients/save_network.ycp
index 429051d..5a5a0a4 100644
--- a/src/clients/save_network.ycp
+++ b/src/clients/save_network.ycp
@@ -376,7 +376,7 @@ void CreateOtherNetworkFiles(){
      // create hostname
      if (size(InstallInf["hostname"]:"")>0){
          y2milestone("Write HOSTNAME: %1", InstallInf["hostname"]:"");
-        SCR::Write(.target.string, "/etc/HOSTNAME", InstallInf["hostname"]:"");
+        SCR::Write(.target.string, "/etc/hostname", InstallInf["hostname"]:"");
      }

Hostname.ycp in yast2.rpm seems like a better place

      if(InstallInf["bootproto"]:"dhcp"=="static")
diff --git a/src/lan/help.ycp b/src/lan/help.ycp
index 762b6a1..35e1e1d 100644
--- a/src/lan/help.ycp
+++ b/src/lan/help.ycp
@@ -255,7 +255,7 @@ DHCP servers update name server zones (forward and reverse 
records)
  according to this hostname (dynamic DNS).</p>
  Some DHCP servers require the <b>Hostname to Send</b> option field to
  contain a specific string in the DHCP messages from clients. Leave <b>AUTO</b>
-to send the current hostname (for example, the one defined in 
<tt>/etc/HOSTNAME</tt>).
+to send the current hostname (for example, the one defined in 
<tt>/etc/hostname</tt>).
  If you do not want to send a hostname, leave the field empty.</p>
  "),

diff --git a/src/modules/DNS.ycp b/src/modules/DNS.ycp
index b4a90c3..6d7499b 100644
--- a/src/modules/DNS.ycp
+++ b/src/modules/DNS.ycp
@@ -216,12 +216,12 @@ global void ReadHostname() {
      // the usual location
      if (fqhostname == "")
      {
-       if (SCR::Read (.target.size, "/etc/HOSTNAME") > 0)
+       if (SCR::Read (.target.size, "/etc/hostname") > 0)
        {
-           fqhostname = (string) SCR::Read (.target.string, "/etc/HOSTNAME");
+           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);
+           y2milestone("Got %1 from /etc/hostname", fqhostname);
        }
      }

This also looks like we should unify that with Hostname.ycp in yast2.rpm. There's already code that does the reading and parsing.

@@ -347,7 +347,7 @@ global define boolean Write() {
        SCR::Execute(.target.bash, "/bin/hostname " + hostname);

        /* write hostname */
-       SCR::Write(.target.string, "/etc/HOSTNAME", fqhostname + "\n");
+       SCR::Write(.target.string, "/etc/hostname", fqhostname + "\n");
        sleep(sl);

This should be moved to Hostname.ycp, I'd say.

        /* Progress step 2/3 */
diff --git a/testsuite/tests/Network_YaPI.out b/testsuite/tests/Network_YaPI.out
index 6dae320..563b7b4 100644
--- a/testsuite/tests/Network_YaPI.out
+++ b/testsuite/tests/Network_YaPI.out
@@ -5,8 +5,8 @@ Read    .sysconfig.network.dhcp.WRITE_HOSTNAME_TO_HOSTS "no"
  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.size "/etc/hostname" 27
+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

And the check then also belongs to Hostname.ycp

--

Lukas Ocilka, Cloud & Systems Management Department
SUSE LINUX s.r.o., Praha
--
To unsubscribe, e-mail: [email protected]
To contact the owner, e-mail: [email protected]

Reply via email to