Remove IPv4AddressType validate function in magnum
Since magnum has bumped up WSME to 0.7, and IPv4AddressType validate problem has been fixed in this version, so I think it's the time to remove the IPv4AddressType validate workaround in magnum. Change-Id: I1f982b56a0ac41d4d6c50b2cbf8fa4162a709dc1 Closes-Bug: #1461392
This commit is contained in:
parent
a6edf78c40
commit
f087a6bf60
|
@ -72,7 +72,7 @@ class BayModel(base.APIBase):
|
|||
master_flavor_id = wtypes.StringType(min_length=1, max_length=255)
|
||||
"""The flavor of the master node for this bay model"""
|
||||
|
||||
dns_nameserver = types.IPv4AddressType()
|
||||
dns_nameserver = wtypes.IPv4AddressType()
|
||||
"""The DNS nameserver address"""
|
||||
|
||||
keypair_id = wsme.wsattr(wtypes.StringType(min_length=1, max_length=255),
|
||||
|
|
|
@ -15,9 +15,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import netaddr
|
||||
from oslo_utils import strutils
|
||||
import six
|
||||
import wsme
|
||||
from wsme import types as wtypes
|
||||
|
||||
|
@ -205,18 +203,3 @@ class JsonPatchType(wtypes.Base):
|
|||
if patch.value:
|
||||
ret['value'] = patch.value
|
||||
return ret
|
||||
|
||||
|
||||
class IPv4AddressType(wtypes.UserType):
|
||||
"""A simple IPv4 type."""
|
||||
|
||||
basetype = six.string_types
|
||||
name = "ipv4address"
|
||||
|
||||
@staticmethod
|
||||
def validate(value):
|
||||
try:
|
||||
netaddr.IPAddress(value, version=4, flags=netaddr.INET_PTON)
|
||||
return value
|
||||
except netaddr.AddrFormatError as e:
|
||||
raise ValueError(six.text_type(e))
|
||||
|
|
|
@ -225,15 +225,3 @@ class TestNameType(base.FunctionalTest):
|
|||
def test_invalid_name(self):
|
||||
self.assertRaises(exception.InvalidName, types.NameType.validate, None)
|
||||
self.assertRaises(exception.InvalidName, types.NameType.validate, '')
|
||||
|
||||
|
||||
class TestIPv4AddressType(base.FunctionalTest):
|
||||
|
||||
def test_valid_value(self):
|
||||
v = types.IPv4AddressType()
|
||||
self.assertEqual('192.168.0.1', v.validate('192.168.0.1'))
|
||||
|
||||
def test_invalid_value(self):
|
||||
v = types.IPv4AddressType()
|
||||
self.assertRaises(ValueError, v.validate, "")
|
||||
self.assertRaises(ValueError, v.validate, "1")
|
||||
|
|
|
@ -18,7 +18,6 @@ greenlet>=0.3.2
|
|||
iso8601>=0.1.9
|
||||
jsonpatch>=1.1
|
||||
keystonemiddleware>=1.5.0
|
||||
netaddr>=0.7.12
|
||||
oslo.concurrency>=1.8.0 # Apache-2.0
|
||||
oslo.config>=1.11.0 # Apache-2.0
|
||||
oslo.context>=0.2.0 # Apache-2.0
|
||||
|
|
Loading…
Reference in New Issue