From b4110e3e80cfa48e22bddc591b1d3dd253047783 Mon Sep 17 00:00:00 2001 From: tengqm Date: Fri, 23 Jan 2015 16:02:42 +0800 Subject: [PATCH] Added customization of create() method The create method will return a response. This patch avoids hiding that response from the create() return values. --- senlinclient/common/sdk.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/senlinclient/common/sdk.py b/senlinclient/common/sdk.py index 9265b42f..d5bb2a71 100644 --- a/senlinclient/common/sdk.py +++ b/senlinclient/common/sdk.py @@ -104,3 +104,14 @@ class Resource(base.Resource): for data in resp: value = cls.existing(**data) yield value + + def create(self, session): + ''' + Overriden version of the create method. + We want to know more about the object being created, so the response + should not be just thrown away + ''' + resp = self.create_by_id(session, self._attrs, self.id, path_args=self) + self._attrs[self.id_attribute] = resp[self.id_attribute] + self._reset_dirty() + return self, resp