summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2006-10-04 18:17:07 +0000
committerDavid Cantrell <dcantrell@redhat.com>2006-10-04 18:17:07 +0000
commit641c267cc2f3b6ea40aa323629cb328c54714cea (patch)
tree204cf3ab3ae05291af8da0a03cc59e455b5fde0b
parent41fd58e49db24b94324218f1763c5674cbead34a (diff)
downloadanaconda-641c267cc2f3b6ea40aa323629cb328c54714cea.tar.gz
anaconda-641c267cc2f3b6ea40aa323629cb328c54714cea.tar.xz
anaconda-641c267cc2f3b6ea40aa323629cb328c54714cea.zip
* network.py (sanityCheckIPString): Test IP more accurately to
determine address family. Clean up error messages to make things more clear. Have a catch-all else case that returns the given IP address in an invalid message in the form of an IPError exception. * iw/network_gui.py (NetworkWindow.handleIPError): Display the field description in the title bar rather than the field name. Call __str__() on the msg parameter since msg could be an IPError exception or a string. * iw/network_gui.py (NetworkWindow): Set the IPv6 address entry field to just the address portion of the value that's written out to the ifcfg-ethX file (remove the /prefix part). Make sure we set the ipv6prefix in the entrys hash and write out a new ipv6addr with the new prefix in case the user changed it.
-rw-r--r--ChangeLog17
-rw-r--r--iw/network_gui.py28
-rw-r--r--network.py10
3 files changed, 44 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index dffcd7418..25a3ae31b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,23 @@
don't work quite right and it's better to be able to view just
the release notes than nothing at all.
+ * network.py (sanityCheckIPString): Test IP more accurately to
+ determine address family. Clean up error messages to make things
+ more clear. Have a catch-all else case that returns the given
+ IP address in an invalid message in the form of an IPError
+ exception.
+
+ * iw/network_gui.py (NetworkWindow.handleIPError): Display the
+ field description in the title bar rather than the field name.
+ Call __str__() on the msg parameter since msg could be an IPError
+ exception or a string.
+
+ * iw/network_gui.py (NetworkWindow): Set the IPv6 address entry
+ field to just the address portion of the value that's written
+ out to the ifcfg-ethX file (remove the /prefix part). Make sure
+ we set the ipv6prefix in the entrys hash and write out a new
+ ipv6addr with the new prefix in case the user changed it.
+
2006-10-04 Jeremy Katz <katzj@redhat.com>
* lang-table: Add Assamese (#207424)
diff --git a/iw/network_gui.py b/iw/network_gui.py
index ac5aa45ed..965ad71d4 100644
--- a/iw/network_gui.py
+++ b/iw/network_gui.py
@@ -176,10 +176,16 @@ class NetworkWindow(InstallWindow):
newfield = field
self.intf.messageWindow(_("Error With Data"),
- _("A value is required for the field \"%s\".") % (newfield,))
+ _("A value is required for the field %s.") % (newfield,))
def handleIPError(self, field, msg):
- self.intf.messageWindow(_("Error With %s Data") % (field,), msg)
+ try:
+ newfield = descr[field]
+ except:
+ newfield = field
+
+ self.intf.messageWindow(_("Error With %s Data") % (newfield,),
+ _("%s") % msg.__str__())
def handleBroadCastError(self):
self.intf.messageWindow(_("Error With Data"),
@@ -362,7 +368,15 @@ class NetworkWindow(InstallWindow):
v6list.append(gtk.Entry())
v6list[1].set_width_chars(41)
- v6list[1].set_text(self.devices[dev].get('ipv6addr'))
+
+ ipv6addr = self.devices[dev].get('ipv6addr')
+ brk = ipv6addr.find('/')
+ if brk != -1:
+ ipv6addr = ipv6addr[0:brk]
+ brk += 1
+ ipv6prefix = ipv6addr[brk:]
+
+ v6list[1].set_text(ipv6addr)
entrys['ipv6addr'] = v6list[1]
ipTable.attach(v6list[1], 1, 2, 2, 3, xpadding=0, ypadding=0)
@@ -541,14 +555,14 @@ class NetworkWindow(InstallWindow):
continue
for t in entrys.keys():
- if t == 'ipv6prefix':
- continue
-
if tmpvals.has_key(t):
if t == 'ipv6addr':
if entrys['ipv6prefix'] is not None:
+ a = tmpvals[t]
+ if a.find('/') != -1:
+ a = a[0:a.find('/')]
p = entrys['ipv6prefix'].get_text()
- q = "%s/%s" % (tmpvals[t], p,)
+ q = "%s/%s" % (a, p,)
else:
q = "%s" % (tmpvals[t],)
diff --git a/network.py b/network.py
index cadc0f389..2de8d556f 100644
--- a/network.py
+++ b/network.py
@@ -86,14 +86,16 @@ def anyUsingDHCP(devices):
# sanity check an IP string.
def sanityCheckIPString(ip_string):
if ip_string.strip() == "":
- raise IPMissing, _("IP Address is missing.")
+ raise IPMissing, _("IP address is missing.")
- if ip_string.find(':') == -1:
+ if ip_string.find(':') == -1 and ip_string.find('.') > 1:
family = socket.AF_INET
- errstr = _("IP Addresses must contain four numbers between 0 and 255, separated by periods.")
- else:
+ errstr = _("IPv4 addresses must contain four numbers between 0 and 255, separated by periods.")
+ elif ip_string.find(':') > 1 and ip_string.find('.') == -1:
family = socket.AF_INET6
errstr = _("'%s' is not a valid IPv6 address.") % ip_string
+ else:
+ raise IPError, _("'%s' is an invalid IP address.") % ip_string
try:
socket.inet_pton(family, ip_string)