Display boolean module values

The boolean values in module-list/show were returned
as 0/1 however the OpenStack standard is to return
true/false so these values have been modified.

Change-Id: Ib986e4adff0c06e96ea6533f9756928a0a055bfd
Closes-Bug: 1656398
This commit is contained in:
Peter Stachowski 2017-01-12 18:01:15 -08:00
parent 6a917bab58
commit 49d5558b1e
2 changed files with 10 additions and 5 deletions

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Module list/show now returns boolean values as True/False instead of
1/0. Bug 1656398

View File

@ -32,12 +32,12 @@ class ModuleView(object):
tenant_id=self.module.tenant_id,
datastore_id=self.module.datastore_id,
datastore_version_id=self.module.datastore_version_id,
auto_apply=self.module.auto_apply,
priority_apply=self.module.priority_apply,
auto_apply=bool(self.module.auto_apply),
priority_apply=bool(self.module.priority_apply),
apply_order=self.module.apply_order,
is_admin=self.module.is_admin,
is_admin=bool(self.module.is_admin),
md5=self.module.md5,
visible=self.module.visible,
visible=bool(self.module.visible),
created=self.module.created,
updated=self.module.updated)
# add extra data to make results more legible
@ -96,7 +96,7 @@ class DetailedModuleView(ModuleView):
def data(self, include_contents=False):
return_value = super(DetailedModuleView, self).data()
module_dict = return_value["module"]
module_dict["live_update"] = self.module.live_update
module_dict["live_update"] = bool(self.module.live_update)
if hasattr(self.module, 'instance_count'):
module_dict["instance_count"] = self.module.instance_count
if include_contents: