Fix the ipaddress validate issue
Right now the jenkins jobs all failed with ipv4address validate. We make ipaddress check logic use netaddr If wsme have better IPv4AddressType changes or magnum api types usage was not right, we can change latter. Right now, we should make magnum work. For netaddr it has been include in global-requirements For wsme IPv4AddressType, check ttps://github.com/stackforge/wsme/blob/master/wsme/types.py Closes-Bug: #1455405 Co-Authored-By: Davanum Srinivas <davanum@gmail.com> Change-Id: I67e6c9e0377103bf5b0cd4d120c146ef2366f440
This commit is contained in:
parent
ed5b34a1a9
commit
426a9e9b67
@ -72,7 +72,7 @@ class BayModel(base.APIBase):
|
|||||||
master_flavor_id = wtypes.StringType(min_length=1, max_length=255)
|
master_flavor_id = wtypes.StringType(min_length=1, max_length=255)
|
||||||
"""The flavor of the master node for this bay model"""
|
"""The flavor of the master node for this bay model"""
|
||||||
|
|
||||||
dns_nameserver = wtypes.IPv4AddressType()
|
dns_nameserver = types.IPv4AddressType()
|
||||||
"""The DNS nameserver address"""
|
"""The DNS nameserver address"""
|
||||||
|
|
||||||
keypair_id = wsme.wsattr(wtypes.StringType(min_length=1, max_length=255),
|
keypair_id = wsme.wsattr(wtypes.StringType(min_length=1, max_length=255),
|
||||||
|
@ -15,7 +15,9 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import netaddr
|
||||||
from oslo_utils import strutils
|
from oslo_utils import strutils
|
||||||
|
import six
|
||||||
import wsme
|
import wsme
|
||||||
from wsme import types as wtypes
|
from wsme import types as wtypes
|
||||||
|
|
||||||
@ -203,3 +205,17 @@ class JsonPatchType(wtypes.Base):
|
|||||||
if patch.value:
|
if patch.value:
|
||||||
ret['value'] = patch.value
|
ret['value'] = patch.value
|
||||||
return ret
|
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)
|
||||||
|
except netaddr.AddrFormatError as e:
|
||||||
|
raise ValueError(six.text_type(e))
|
||||||
|
@ -27,3 +27,4 @@ taskflow>=0.7.1
|
|||||||
WSME>=0.6
|
WSME>=0.6
|
||||||
docker-py>=1.1.0 # Apache-2.0
|
docker-py>=1.1.0 # Apache-2.0
|
||||||
jsonpatch>=1.1
|
jsonpatch>=1.1
|
||||||
|
netaddr>=0.7.12
|
||||||
|
Loading…
Reference in New Issue
Block a user