Fix _lookup() method for node API routing

While not currently broken, calling /v1/nodes emits an error:

    RuntimeWarning: Got exception calling lookup(): _lookup() takes
    at least 3 arguments (2 given) (('_lookup() takes at least 3
    arguments (2 given)',))

Pecan will continue routing normally in this case, but it looks cscary
in logs. Fix _lookup() to not require so many arguments that it blows up
in this case.

Change-Id: I2b634d41aeb438a6f6ccbde33aeaa41678a6b67a
This commit is contained in:
Jim Rollenhagen 2016-10-06 06:59:08 -04:00
parent 6587a48dd0
commit 33c62a1e36

View File

@ -1063,14 +1063,15 @@ class NodesController(rest.RestController):
}
@pecan.expose()
def _lookup(self, ident, subres, *remainder):
def _lookup(self, ident, *remainder):
try:
ident = types.uuid_or_name.validate(ident)
except exception.InvalidUuidOrName as e:
pecan.abort(http_client.BAD_REQUEST, e.args[0])
subcontroller = self._subcontroller_map.get(subres)
if subcontroller:
return subcontroller(node_ident=ident), remainder
if remainder:
subcontroller = self._subcontroller_map.get(remainder[0])
if subcontroller:
return subcontroller(node_ident=ident), remainder[1:]
def _get_nodes_collection(self, chassis_uuid, instance_uuid, associated,
maintenance, provision_state, marker, limit,