From e55c73be0ec5ce3d919c60a4edc7cdbb68ac3d56 Mon Sep 17 00:00:00 2001 From: ericxiett Date: Wed, 8 Feb 2017 09:25:58 +0800 Subject: [PATCH] Fix that remove 'strategy' attribute does not work. The 'strategy_id' attribute is the one that not exposes to API. But the 'PATCH' API always update this attribute. So this change does not work when choose 'remove' op. This patch sets value for 'strategy_id' attribute. Change-Id: I1597fb5d4985bb8271ad3cea7ea5f0adb7de65f4 Closes-Bug: #1662395 --- watcher/api/controllers/v1/audit_template.py | 1 + 1 file changed, 1 insertion(+) diff --git a/watcher/api/controllers/v1/audit_template.py b/watcher/api/controllers/v1/audit_template.py index 87365b449..b03d4a535 100644 --- a/watcher/api/controllers/v1/audit_template.py +++ b/watcher/api/controllers/v1/audit_template.py @@ -333,6 +333,7 @@ class AuditTemplate(base.APIBase): self.fields.append('goal_id') self.fields.append('strategy_id') + setattr(self, 'strategy_id', kwargs.get('strategy_id', wtypes.Unset)) # goal_uuid & strategy_uuid are not part of # objects.AuditTemplate.fields because they're API-only attributes.