From b3161b0f39eb9ced18148458c151ddc2e201b231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Memo=20Garc=C3=ADa?= Date: Fri, 8 Jan 2016 14:34:38 +0000 Subject: [PATCH] Add default namespace to apiclient When a client is created from other method rather than command line arguments, it skips the commandline arguments and by doing this a Namespace is not created, this commit fix that by creating a default Namespace when the value of self.opts is None Resolves bug: 1532205 Change-Id: I7a01715c675756e0ce66111939b71a2761b0657a --- client.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client.py b/client.py index a05c3b6..b7b5364 100644 --- a/client.py +++ b/client.py @@ -30,6 +30,7 @@ from jobs import JobManager from actions import ActionManager from sessions import SessionManager from oslo_config import cfg +from freezer.utils import Namespace CONF = cfg.CONF @@ -195,6 +196,10 @@ class Client(object): verify=True): self.opts = opts + # this creates a namespace for self.opts when the client is + # created from other method rather than command line arguments. + if self.opts is None: + self.opts = Namespace({}) if token: self.opts.os_token = token if username: