FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Kubuntu User

 
 
LinkBack Thread Tools
 
Old 06-30-2010, 07:53 AM
Radek Vykydal
 
Default Fix prototype of getIPAddresses (#605659)

Return only ipv4 addresses (by default) or ipv6 addresses, never
both.
---
isys/isys.py | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/isys/isys.py b/isys/isys.py
index 55c7165..449ba5c 100755
--- a/isys/isys.py
+++ b/isys/isys.py
@@ -511,10 +511,9 @@ def isWireless(dev):
return False

# Get IP addresses for a network device.
-# Returns list of ipv4 and ipv6 addresses.
-# With version=4 returns only ipv4 addresses,
-# with version=6 returns only ipv6 addresses.
-def getIPAddresses(dev, version=None):
+# Returns list of ipv4 or ipv6 addresses, depending
+# on version parameter. ipv4 is default.
+def getIPAddresses(dev, version=4):
if dev == ' or dev is None:
return None

@@ -526,7 +525,7 @@ def getIPAddresses(dev, version=None):

addresses = []

- if not version == 6:
+ if version == 4:
ip4_config_path = device_props_iface.Get(NM_DEVICE_IFACE, 'Ip4Config')
if ip4_config_path != '/':
ip4_config_obj = bus.get_object(NM_SERVICE, ip4_config_path)
@@ -542,8 +541,7 @@ def getIPAddresses(dev, version=None):
except ValueError as e:
log.debug("Exception caught trying to convert IP address %s: %s" %
(addr, e))
-
- if not version == 4:
+ elif version == 6:
ip6_config_path = device_props_iface.Get(NM_DEVICE_IFACE, 'Ip6Config')
if ip6_config_path != '/':
ip6_config_obj = bus.get_object(NM_SERVICE, ip6_config_path)
@@ -560,6 +558,8 @@ def getIPAddresses(dev, version=None):
except ValueError as e:
log.debug("Exception caught trying to convert IP address %s: %s" %
(addr, e))
+ else:
+ raise ValueError, "invalid IP version %d" % version

return addresses

--
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 06-30-2010, 09:14 AM
Hans de Goede
 
Default Fix prototype of getIPAddresses (#605659)

Ack.

On 06/30/2010 09:53 AM, Radek Vykydal wrote:

Return only ipv4 addresses (by default) or ipv6 addresses, never
both.
---
isys/isys.py | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/isys/isys.py b/isys/isys.py
index 55c7165..449ba5c 100755
--- a/isys/isys.py
+++ b/isys/isys.py
@@ -511,10 +511,9 @@ def isWireless(dev):
return False

# Get IP addresses for a network device.
-# Returns list of ipv4 and ipv6 addresses.
-# With version=4 returns only ipv4 addresses,
-# with version=6 returns only ipv6 addresses.
-def getIPAddresses(dev, version=None):
+# Returns list of ipv4 or ipv6 addresses, depending
+# on version parameter. ipv4 is default.
+def getIPAddresses(dev, version=4):
if dev == ' or dev is None:
return None

@@ -526,7 +525,7 @@ def getIPAddresses(dev, version=None):

addresses = []

- if not version == 6:
+ if version == 4:
ip4_config_path = device_props_iface.Get(NM_DEVICE_IFACE, 'Ip4Config')
if ip4_config_path != '/':
ip4_config_obj = bus.get_object(NM_SERVICE, ip4_config_path)
@@ -542,8 +541,7 @@ def getIPAddresses(dev, version=None):
except ValueError as e:
log.debug("Exception caught trying to convert IP address %s: %s" %
(addr, e))
-
- if not version == 4:
+ elif version == 6:
ip6_config_path = device_props_iface.Get(NM_DEVICE_IFACE, 'Ip6Config')
if ip6_config_path != '/':
ip6_config_obj = bus.get_object(NM_SERVICE, ip6_config_path)
@@ -560,6 +558,8 @@ def getIPAddresses(dev, version=None):
except ValueError as e:
log.debug("Exception caught trying to convert IP address %s: %s" %
(addr, e))
+ else:
+ raise ValueError, "invalid IP version %d" % version

return addresses



_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 06-30-2010, 01:18 PM
Chris Lumens
 
Default Fix prototype of getIPAddresses (#605659)

> Return only ipv4 addresses (by default) or ipv6 addresses, never
> both.

Yes, thank you.

Make sure you commit everything to master that's appropriate, too.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 05:50 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org