[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH 11/22] Do not mess value change with line formatting (#520146)



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ack.

On Tue, 27 Apr 2010, Radek Vykydal wrote:

Format the line only at single place, and when modifying value
of parameter to be written-out, change also its value in the
NetworkDevice object accordingly.
---
network.py |   10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/network.py b/network.py
index a7c474e..24f029d 100644
--- a/network.py
+++ b/network.py
@@ -286,12 +286,14 @@ class NetworkDevice(IfcfgFile):
            keys.remove("KEY")
        if iutil.isS390() and ("HWADDR" in keys):
            keys.remove("HWADDR")
+        # make sure we include autoneg in the ethtool line
+        if 'ETHTOOL_OPTS' in keys:
+            eopts = self.get('ETHTOOL_OPTS')
+            if "autoneg" not in eopts:
+                self.set(('ETHTOOL_OPTS', "autoneg off %s" % eopts))

        for key in keys:
-            # make sure we include autoneg in the ethtool line
-            if key == 'ETHTOOL_OPTS' and self.info[key].find("autoneg")== -1:
-                s = s + key + """="autoneg off %s"\n""" % (self.info[key])
-            elif self.info[key] is not None:
+            if self.info[key] is not None:
                s = s + key + '="' + self.info[key] + '"\n'

        return s


- -- David Cantrell <dcantrell redhat com>
Red Hat / Honolulu, HI

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkvfjrMACgkQ5hsjjIy1VkmzXACfdRsYA5lrgrhsPV4qhC8/Xzhn
iDMAnjGvDVdkIr4UH0KyS7JFhLMCatEZ
=jcDO
-----END PGP SIGNATURE-----


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]