Package: 0.1+bzr1139+dfsg-0+1153+116~ppa0~quantal1
matsubara@tancho [..-branches/trunk]$ juju bootstrap
2012-10-03 19:05:47,321 INFO Bootstrapping environment 'maas' (origin: lp:juju type: maas)...
2012-10-03 19:05:48,852 ERROR Invalid 'cpu_count' constraint '1.0': invalid literal for int() with base 10: '1.0'
= maas.log =
ERROR 2012-10-03 22:05:48,470 maas.maasserver ################################ Exception: Invalid 'cpu_count' constraint '1.0': invalid literal for int() with base 10: '1.0' ################################
ERROR 2012-10-03 22:05:48,470 maas.maasserver Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.7/dist-packages/django/views/decorators/vary.py", line 19, in inner_func
response = func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/piston/resource.py", line 167, in __call__
result = self.error_handler(e, request, meth, em_format)
File "/usr/lib/python2.7/dist-packages/piston/resource.py", line 165, in __call__
result = meth(request, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/maasserver/api.py", line 287, in dispatch
return function(self, request, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/maasserver/api.py", line 784, in acquire
request.user, constraints=extract_constraints(request.data))
File "/usr/lib/python2.7/dist-packages/maasserver/models/node.py", line 256, in get_available_node_for_acquisition
available_nodes = constrain_nodes(available_nodes, constraints)
File "/usr/lib/python2.7/dist-packages/maasserver/models/node_constraint_filter.py", line 76, in constrain_nodes
nodes = filter(nodes, constraint_name, value)
File "/usr/lib/python2.7/dist-packages/maasserver/models/node_constraint_filter.py", line 36, in constrain_int_greater_or_equal
raise InvalidConstraint(key, str_value, e)
InvalidConstraint: Invalid 'cpu_count' constraint '1.0': invalid literal for int() with base 10: '1.0'
There seems to be 2 bits to the bug, IMO
1) raising InvalidConstraint is meant to generate an HTTP 400 (BAD REQUEST) [We inherit from MAASAPiBadRequest, and I'm pretty sure there was a test for this case). So we want to understand why we are getting a traceback rather than a cleaner message.
2) How to deal with a float input. The field is 'cpu_count', so requesting 4.5 cpu's doesn't make a lot of sense. I'm wondering who generated the float, and who should be validating it. Was it float(str_ value)) )
a) Diogo just testing something out, and we should be having juju's code validating the inputs are more sane before issuing the request
b) Diogo wrote 1, but the juju code turned the int into a float and passed it along (at one point 'cpu' was going to be a float describing something like ECU)
c) Should we just accept float input, and do something like int(round(