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
This commit is contained in:
Memo García 2016-01-08 14:34:38 +00:00
parent 940f9c962f
commit b3161b0f39

View File

@ -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: