[node-patches] Change in ovirt-node[master]: ui: Display IPv6 address accroding to RFC 2732

fabiand at fedoraproject.org fabiand at fedoraproject.org
Fri Jul 5 15:13:06 UTC 2013


Fabian Deutsch has uploaded a new change for review.

Change subject: ui: Display IPv6 address accroding to RFC 2732
......................................................................

ui: Display IPv6 address accroding to RFC 2732

Previously the IPv6 addresses were shown as they were. To point out that
they are IPv6 addresses they are now shown according to RFC 2732 in [].
This patch covers the basic IPAddress class and the status page.

Change-Id: Iaf43850e3bc18ef771892f2ca03dc9905b99e8bb
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=981279
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M src/ovirt/node/setup/core/status_page.py
M src/ovirt/node/utils/network.py
2 files changed, 12 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/19/16519/1

diff --git a/src/ovirt/node/setup/core/status_page.py b/src/ovirt/node/setup/core/status_page.py
index 0bfea62..3541d9a 100644
--- a/src/ovirt/node/setup/core/status_page.py
+++ b/src/ovirt/node/setup/core/status_page.py
@@ -21,6 +21,7 @@
 from ovirt.node import ui, plugins, utils
 from ovirt.node.config import defaults
 from ovirt.node.utils import security, virt, system
+from ovirt.node.utils.network import IPAddress
 import os
 import textwrap
 
@@ -70,7 +71,7 @@
         This is an ordered list of (path, widget) tuples.
         """
         # Function to expand all "keywords" to the same length
-        aligned = lambda l: l.ljust(14)
+        aligned = lambda l: l.ljust(13)
 
         # Network related widgets, appearing in one row
         network_widgets = [ui.KeywordLabel("networking",
@@ -189,12 +190,13 @@
         destinations = []
 
         if syslog["server"]:
-            destinations.append("Rsyslog: %s:%s" % (syslog["server"],
-                                                    syslog["port"] or "514"))
+            destinations.append("Rsyslog: %s:%s" %
+                                (IPAddress(syslog["server"]),
+                                 syslog["port"] or "514"))
 
         if netconsole["server"]:
             destinations.append("Netconsole: %s:%s" %
-                                (netconsole["server"],
+                                (IPAddress(netconsole["server"]),
                                  netconsole["port"] or "6666"))
 
         return ", ".join(destinations) if destinations else "Local Only"
diff --git a/src/ovirt/node/utils/network.py b/src/ovirt/node/utils/network.py
index 3b573bd..76612d4 100644
--- a/src/ovirt/node/utils/network.py
+++ b/src/ovirt/node/utils/network.py
@@ -18,7 +18,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA  02110-1301, USA.  A copy of the GNU General Public License is
 # also available at http://www.gnu.org/copyleft/gpl.html.
-from ovirt.node import base, utils, config
+from ovirt.node import base, utils, config, valid
 from ovirt.node.config.network import NicConfig
 from ovirt.node.utils.fs import File
 import glob
@@ -684,12 +684,15 @@
 
 
 class IPAddress(base.Base):
-    def __init__(self, address, netmask):
+    def __init__(self, address, netmask=None):
         self.address = address
         self.netmask = netmask
 
     def __str__(self):
-        return str(self.address)
+        txt = str(self.address)
+        if valid.IPv6Address().validate(txt):
+            txt = "[%s]" % txt
+        return txt
 
     def items(self):
         return (self.address, self.netmask)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaf43850e3bc18ef771892f2ca03dc9905b99e8bb
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>



More information about the node-patches mailing list