[node-patches] Change in ovirt-node[master]: Unbreak netconsole

rbarry at redhat.com rbarry at redhat.com
Tue Jul 15 16:55:38 UTC 2014


Ryan Barry has uploaded a new change for review.

Change subject: Unbreak netconsole
......................................................................

Unbreak netconsole

Check whether or not port is actually defined so we don't hit
an exception (None != undefined). Don't try to use self. from
nested classes or closures

Change-Id: I546bd4da86f6aa5a3ea8f6c3877582519d6ceb88
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1119566
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirt/node/config/defaults.py
1 file changed, 6 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/18/30118/1

diff --git a/src/ovirt/node/config/defaults.py b/src/ovirt/node/config/defaults.py
index 01c21c3..7cb10b9 100644
--- a/src/ovirt/node/config/defaults.py
+++ b/src/ovirt/node/config/defaults.py
@@ -1312,13 +1312,13 @@
         valid.Port()(port)
 
     def transaction(self):
-        def _clear_config(self):
+        def _clear_config():
             self.logger.info("Disabling netconsole")
             f = File("/etc/sysconfig/netconsole")
             f.sed("/SYSLOGADDR/d")
             f.sed("/SYSLOGPORT/d")
 
-        def configure_netconsole(self, server, port):
+        def configure_netconsole(server, port):
             aug = utils.AugeasWrapper()
             if server and port:
                 aug.set("/files/etc/sysconfig/netconsole/SYSLOGADDR",
@@ -1328,11 +1328,11 @@
                 try:
                     system.service("netconsole", "restart")
                 except:
-                    self._clear_config()
+                    _clear_config()
                     raise RuntimeError("Failed to restart netconsole "
                                        "service. Is the host resolvable?")
             else:
-                self._clear_config()
+                _clear_config()
             fs.Config().persist("/etc/sysconfig/netconsole")
             self.logger.info("Netconsole Configuration Updated")
 
@@ -1341,13 +1341,13 @@
 
         class CreateNetconsoleConfig(utils.Transaction.Element):
             if server:
-                port = port if port else "6666"
+                port = port if 'port' in vars() else "6666"
                 title = "Setting netconsole server and port"
             else:
                 title = "Disabling netconsole"
 
             def commit(self):
-                self.configure_netconsole(server, port)
+                configure_netconsole(server, port)
 
         tx = utils.Transaction("Configuring netconsole")
         tx.append(CreateNetconsoleConfig())


-- 
To view, visit http://gerrit.ovirt.org/30118
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I546bd4da86f6aa5a3ea8f6c3877582519d6ceb88
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>



More information about the node-patches mailing list