juju bootstrap returned ERROR Invalid 'cpu_count' constraint '1.0'

Bug #1061286 reported by Diogo Matsubara
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
Critical
Martin Packman
pyjuju
Fix Released
Medium
Martin Packman
juju (Ubuntu)
Fix Released
High
Dave Walker

Bug Description

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'

Related branches

Changed in maas:
status: New → Triaged
assignee: nobody → John A Meinel (jameinel)
Revision history for this message
John A Meinel (jameinel) wrote :

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
 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(float(str_value)))

Revision history for this message
John A Meinel (jameinel) wrote :

It looks like (1) is just because the traceback goes into the log.
(2a) seems to be that juju sends a default of 1.0 if you don't specify anything. But we should probably support floats.

Martin Packman (gz)
Changed in juju:
assignee: nobody → Martin Packman (gz)
importance: Undecided → Medium
milestone: none → 0.6
status: New → Triaged
Martin Packman (gz)
Changed in maas:
assignee: John A Meinel (jameinel) → Martin Packman (gz)
status: Triaged → In Progress
Martin Packman (gz)
Changed in juju:
status: Triaged → In Progress
Changed in maas:
status: In Progress → Fix Committed
Martin Packman (gz)
Changed in juju:
status: In Progress → Fix Committed
Changed in maas:
status: Fix Committed → Fix Released
Dave Walker (davewalker)
Changed in juju (Ubuntu):
assignee: nobody → Dave Walker (davewalker)
status: New → In Progress
importance: Undecided → High
Changed in juju:
status: Fix Committed → Fix Released
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Fixed in 0.6

Changed in juju (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.