Cannot add chassis with port

Bug #1572060 reported by Gavin Panella
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
High
Unassigned
2.0
Won't Fix
High
Unassigned

Bug Description

The machines?op=add_chassis call in the Web API allows a port to be
specified:

  :param port: The port to use when accessing the chassis.
  :type port: integer

This port is not converted from a str to an int before being passed to
Node.add_chassis() and then to a remote AddChassis call. However,
AddChassis is defined like so:

  class AddChassis(amp.Command):
      arguments = [
          ...
          (b"port", amp.Integer(optional=True)),
      ...

i.e. port must be an int or None.

Tags: qa-missing

Related branches

Revision history for this message
Gavin Panella (allenap) wrote :

The following diff would fix the problem, but test coverage is obviously
needed too:

--- src/maasserver/api/machines.py 2016-04-14 15:25:36 +0000
+++ src/maasserver/api/machines.py 2016-04-19 10:32:03 +0000
@@ -1374,7 +1374,8 @@
                     "text/plain; charset=%s" % settings.DEFAULT_CHARSET))

         # Only available with vmware or msftocs
- port = get_optional_param(request.POST, 'port')
+ port = get_optional_param(
+ request.POST, 'port', validator=validators.Int(min=1, max=65535))
         if port is not None and chassis_type not in ('msftocs', 'vmware'):
             return HttpResponseBadRequest(
                 "port is unavailable with the %s chassis type" %

Changed in maas:
importance: Undecided → High
status: New → Triaged
Changed in maas:
milestone: 2.1.0 → 2.1.1
Changed in maas:
milestone: 2.1.1 → 2.1.2
Changed in maas:
milestone: 2.1.2 → 2.1.3
Changed in maas:
status: Triaged → Fix Committed
no longer affects: maas/trunk
Changed in maas:
status: Fix Committed → Fix Released
milestone: 2.1.3 → none
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.