raise exception when no prefixLen is set

This commit is contained in:
backb1
2014-11-19 08:58:17 -08:00
committed by Bob Lantz
parent 6721f0655e
commit b7898befef
+2
View File
@@ -70,6 +70,8 @@ class Intf( object ):
self.ip, self.prefixLen = ipstr.split( '/' )
return self.ifconfig( ipstr, 'up' )
else:
if prefixLen is None:
raise Exception( 'No prefix length set for IP address %s' % ( ipstr, ) )
self.ip, self.prefixLen = ipstr, prefixLen
return self.ifconfig( '%s/%s' % ( ipstr, prefixLen ) )