From 49d5558b1e6e33b6d10f9d292aaf50b46b5173ea Mon Sep 17 00:00:00 2001 From: Peter Stachowski Date: Thu, 12 Jan 2017 18:01:15 -0800 Subject: [PATCH] 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 --- .../disply_module_bools_properly-571cca9a87f28339.yaml | 5 +++++ trove/module/views.py | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/disply_module_bools_properly-571cca9a87f28339.yaml diff --git a/releasenotes/notes/disply_module_bools_properly-571cca9a87f28339.yaml b/releasenotes/notes/disply_module_bools_properly-571cca9a87f28339.yaml new file mode 100644 index 0000000000..24adce0d7e --- /dev/null +++ b/releasenotes/notes/disply_module_bools_properly-571cca9a87f28339.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Module list/show now returns boolean values as True/False instead of + 1/0. Bug 1656398 diff --git a/trove/module/views.py b/trove/module/views.py index fb5d090def..5a747caf92 100644 --- a/trove/module/views.py +++ b/trove/module/views.py @@ -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: