From 1558b869ffc5c4f67299a9964ea7b8be7546bcc5 Mon Sep 17 00:00:00 2001 From: Fabio Verboso Date: Fri, 14 Sep 2018 15:49:43 +0200 Subject: [PATCH] Allow Iotronic-Api to run in python2.7 Change-Id: I3532c072faabb66cecb0b2834e3ab97b7f52539d --- iotronic/conductor/endpoints.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/iotronic/conductor/endpoints.py b/iotronic/conductor/endpoints.py index fa2a865..e019b6a 100644 --- a/iotronic/conductor/endpoints.py +++ b/iotronic/conductor/endpoints.py @@ -13,7 +13,14 @@ # License for the specific language governing permissions and limitations # under the License. -import _pickle as cpickle + +try: + # allow iotronic api to run also with python3 + import _pickle as cpickle +except Exception: + # allow iotronic api to run also with python2.7 + import pickle as cpickle + from iotronic.common import exception from iotronic.common import neutron from iotronic.common import states