diff --git a/placement/cmd/status.py b/placement/cmd/status.py index 721d17dcb..7ac2ad9e5 100644 --- a/placement/cmd/status.py +++ b/placement/cmd/status.py @@ -30,6 +30,7 @@ class Checks(upgradecheck.UpgradeCommands): and added to _upgrade_checks tuple. """ def __init__(self, config): + self.config = config self.ctxt = context.RequestContext(config=config) @db_api.placement_context_manager.reader @@ -96,6 +97,12 @@ class Checks(upgradecheck.UpgradeCommands): # No missing consumers (or no allocations [fresh install?]) so it's OK. return upgradecheck.Result(upgradecheck.Code.SUCCESS) + def _check_policy_json(self): + """A wrapper passing a proper config object when calling the generic + policy json check. + """ + return common_checks.check_policy_json(self, self.config) + # The format of the check functions is to return an # oslo_upgradecheck.upgradecheck.Result # object with the appropriate @@ -106,8 +113,7 @@ class Checks(upgradecheck.UpgradeCommands): _upgrade_checks = ( ('Missing Root Provider IDs', _check_root_provider_ids), ('Incomplete Consumers', _check_incomplete_consumers), - ("Policy File JSON to YAML Migration", - (common_checks.check_policy_json, {'conf': cfg.CONF})), + ("Policy File JSON to YAML Migration", _check_policy_json), ) diff --git a/placement/tests/functional/cmd/test_status.py b/placement/tests/functional/cmd/test_status.py index a763b6862..a276f08f3 100644 --- a/placement/tests/functional/cmd/test_status.py +++ b/placement/tests/functional/cmd/test_status.py @@ -81,7 +81,4 @@ class UpgradeCheckIncompleteConsumersTestCase( self.assertEqual(upgradecheck.Code.SUCCESS, result.code) def test_all_registered_check_is_runnable(self): - # this is bug story/2008831 - self.assertRaises(cfg.NotInitializedError, self.checks.check) - # after it is fixed we expect that all the checks succeeds - # self.assertEquals(upgradecheck.Code.SUCCESS, self.checks.check()) + self.assertEqual(upgradecheck.Code.SUCCESS, self.checks.check())