From 9fdc2aff5381753c8f9a5bc69717af98ef59ab60 Mon Sep 17 00:00:00 2001 From: Jim Rollenhagen Date: Tue, 22 Mar 2016 14:37:21 +0000 Subject: [PATCH] Fix sphinx docs build When building docs with sphinx, the objects.register_all() code path is not necessarily called, and therefore objects.* is not necessarily imported before it is used. This throws an error while building the sample ChassisCollection response. If objects.Chassis is not available, call register_all() before using it. Change-Id: Ic0041085639f3d5a900ad54c2637c77aa467ba35 Closes-Bug: #1560508 --- ironic/api/controllers/v1/chassis.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ironic/api/controllers/v1/chassis.py b/ironic/api/controllers/v1/chassis.py index 819278faec..df5f9df78d 100644 --- a/ironic/api/controllers/v1/chassis.py +++ b/ironic/api/controllers/v1/chassis.py @@ -143,6 +143,9 @@ class ChassisCollection(collection.Collection): @classmethod def sample(cls): + # FIXME(jroll) hack for docs build, bug #1560508 + if not hasattr(objects, 'Chassis'): + objects.register_all() sample = cls() sample.chassis = [Chassis.sample(expand=False)] return sample