Housekeeper: getter bugs

Handle a non-initiaized housekeeper
Correct get-count method name

Change-Id: I6f3b46d3da9a3cc0d1c10794d78e29d459295c66
This commit is contained in:
Kobi Samoray 2019-07-01 10:26:57 +03:00
parent a64de7044f
commit dae9b9e6a8

View File

@ -429,11 +429,11 @@ class NsxPluginBase(db_base_plugin_v2.NeutronDbPluginV2,
def get_housekeeper(self, context, name, fields=None):
# run the job in readonly mode and get the results
self.housekeeper.run(context, name, readonly=True)
return self.housekeeper.get(name)
return self.housekeeper.get(name) if self.housekeeper else None
def get_housekeepers(self, context, filters=None, fields=None, sorts=None,
limit=None, marker=None, page_reverse=False):
return self.housekeeper.list()
return self.housekeeper.list() if self.housekeeper else []
def update_housekeeper(self, context, name, housekeeper):
# run the job in non-readonly mode and get the results
@ -444,8 +444,8 @@ class NsxPluginBase(db_base_plugin_v2.NeutronDbPluginV2,
self.housekeeper.run(context, name, readonly=False)
return self.housekeeper.get(name)
def get_housekeeper_count(self, context, filters=None):
return len(self.housekeeper.list())
def get_housekeepers_count(self, context, filters=None):
return len(self.housekeeper.list()) if self.housekeeper else 0
# Register the callback