[openstack-dev] [WSME] Complex Type Validation Issue On Deserialization

Brandon Logan brandon.logan at RACKSPACE.COM
Thu Sep 11 06:34:42 UTC 2014


Fixed the issue and it's a boneheaded one as I suspected.

I need to initialize the type ala wtypes.IPv4AddressType() instead of
just wtypes.IPv4AddressType.

Does appear that the validation for the IPv4AddressType has a bug where
is should return the value, but there is no return at all.

Thanks,
Brandon

On Thu, 2014-09-11 at 04:45 +0000, Brandon Logan wrote:
> I'm having an issue where incoming validation of a complex type with a
> an attribute of type IPv4Address is failing validation when it is a
> correct ipv4 address.  Same is happening for UuidType and
> IPv6AddressType.  I am using using Pecan with WSME 0.6.1 and python
> 2.7.6.
> 
> Complex Type:
> class LoadBalancer(wtypes.Base):
>     ip_address = wtypes.wsattr(wtypes.IPv4AddressType)
> 
> Controller Method:
> @pecan.wsexpose(v1types.LoadBalancer, body=v1types.LoadBalancer)
> def post(self, load_balancer):
>    return load_balancer
> 
> 
> When doing a POST to the correct resource with this body:
> 
> {"ip_address": "10.0.0.1"}
> 
> I am getting this error:
> 
> {
> debuginfo: null
> faultcode: "Server"
> faultstring: "Value should be IPv4 format"
> }
> 
> 
> it looks like in the fromjson method when it starts validating the
> actual ip "10.0.0.1" it is sending an instantiation of the
> IPv4AddressType instead of the actual ip address "10.0.0.1" to
> wsme.types.validate_value.  Am I doing something wrong or is this a
> bug?  The stack trace did not yield anymore information, unless you
> want the actual methods called.  I can provide that if needed.
> 
> Thanks,
> Brandon 
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev



More information about the OpenStack-dev mailing list