Make tripleoclient compatible with cliff-3.4.0
cliff with 3.4.0[1] release moved to stevedore for loading entry points, with this logging get's setup too early before config options are loaded. Move Config register and logging setup to app's main function. Also after moving logging.setup to app's main function a time.time call is removed so adjust test for it. [1] https://github.com/openstack/cliff/commit/6ac510 Suggested-By: Doug Hellmann <doug@doughellmann.com> Closes-Bug: #1890389 Change-Id: Ia9a2146a0ad3156c80f8cdffe33280380319e3d6
This commit is contained in:
parent
cb2187b433
commit
a8831c6000
@ -1507,7 +1507,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
# assuming heat deploy consumed a 3m out of total 451m timeout
|
# assuming heat deploy consumed a 3m out of total 451m timeout
|
||||||
with mock.patch('time.time', side_effect=[0, 1585820346, 1585820526]):
|
with mock.patch('time.time', side_effect=[1585820346, 1585820526]):
|
||||||
self.cmd.take_action(parsed_args)
|
self.cmd.take_action(parsed_args)
|
||||||
self.assertIn(
|
self.assertIn(
|
||||||
[mock.call(mock.ANY, mock.ANY, 'overcloud', mock.ANY,
|
[mock.call(mock.ANY, mock.ANY, 'overcloud', mock.ANY,
|
||||||
|
@ -25,8 +25,6 @@ from tripleoclient import utils as oooutils
|
|||||||
from tripleoclient.workflows import deployment
|
from tripleoclient.workflows import deployment
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
logging.register_options(CONF)
|
|
||||||
logging.setup(CONF, '')
|
|
||||||
|
|
||||||
|
|
||||||
class Authorize(command.Command):
|
class Authorize(command.Command):
|
||||||
@ -75,6 +73,8 @@ class Authorize(command.Command):
|
|||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
|
logging.register_options(CONF)
|
||||||
|
logging.setup(CONF, '')
|
||||||
|
|
||||||
self.log.debug("take_action({})".format(parsed_args))
|
self.log.debug("take_action({})".format(parsed_args))
|
||||||
clients = self.app.client_manager
|
clients = self.app.client_manager
|
||||||
|
@ -28,8 +28,6 @@ from tripleoclient.workflows import deployment
|
|||||||
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
logging.register_options(CONF)
|
|
||||||
logging.setup(CONF, '')
|
|
||||||
|
|
||||||
|
|
||||||
class ExternalUpdateRun(command.Command):
|
class ExternalUpdateRun(command.Command):
|
||||||
@ -112,6 +110,8 @@ class ExternalUpdateRun(command.Command):
|
|||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
|
logging.register_options(CONF)
|
||||||
|
logging.setup(CONF, '')
|
||||||
self.log.debug("take_action(%s)" % parsed_args)
|
self.log.debug("take_action(%s)" % parsed_args)
|
||||||
oooutils.ensure_run_as_normal_user()
|
oooutils.ensure_run_as_normal_user()
|
||||||
|
|
||||||
|
@ -27,8 +27,6 @@ from tripleoclient.workflows import deployment
|
|||||||
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
logging.register_options(CONF)
|
|
||||||
logging.setup(CONF, '')
|
|
||||||
|
|
||||||
|
|
||||||
class ExternalUpgradeRun(command.Command):
|
class ExternalUpgradeRun(command.Command):
|
||||||
@ -112,6 +110,8 @@ class ExternalUpgradeRun(command.Command):
|
|||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
|
logging.register_options(CONF)
|
||||||
|
logging.setup(CONF, '')
|
||||||
self.log.debug("take_action(%s)" % parsed_args)
|
self.log.debug("take_action(%s)" % parsed_args)
|
||||||
oooutils.ensure_run_as_normal_user()
|
oooutils.ensure_run_as_normal_user()
|
||||||
|
|
||||||
|
@ -29,8 +29,6 @@ from tripleoclient.workflows import package_update
|
|||||||
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
logging.register_options(CONF)
|
|
||||||
logging.setup(CONF, '')
|
|
||||||
|
|
||||||
|
|
||||||
class UpdatePrepare(DeployOvercloud):
|
class UpdatePrepare(DeployOvercloud):
|
||||||
@ -54,6 +52,8 @@ class UpdatePrepare(DeployOvercloud):
|
|||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
|
logging.register_options(CONF)
|
||||||
|
logging.setup(CONF, '')
|
||||||
self.log.debug("take_action(%s)" % parsed_args)
|
self.log.debug("take_action(%s)" % parsed_args)
|
||||||
oooutils.ensure_run_as_normal_user()
|
oooutils.ensure_run_as_normal_user()
|
||||||
|
|
||||||
@ -172,6 +172,8 @@ class UpdateRun(command.Command):
|
|||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
|
logging.register_options(CONF)
|
||||||
|
logging.setup(CONF, '')
|
||||||
self.log.debug("take_action(%s)" % parsed_args)
|
self.log.debug("take_action(%s)" % parsed_args)
|
||||||
oooutils.ensure_run_as_normal_user()
|
oooutils.ensure_run_as_normal_user()
|
||||||
|
|
||||||
@ -237,6 +239,8 @@ class UpdateConverge(DeployOvercloud):
|
|||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
|
logging.register_options(CONF)
|
||||||
|
logging.setup(CONF, '')
|
||||||
self.log.debug("take_action(%s)" % parsed_args)
|
self.log.debug("take_action(%s)" % parsed_args)
|
||||||
oooutils.ensure_run_as_normal_user()
|
oooutils.ensure_run_as_normal_user()
|
||||||
|
|
||||||
|
@ -28,8 +28,6 @@ from tripleoclient.workflows import deployment
|
|||||||
from tripleoclient.workflows import parameters
|
from tripleoclient.workflows import parameters
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
logging.register_options(CONF)
|
|
||||||
logging.setup(CONF, '')
|
|
||||||
|
|
||||||
|
|
||||||
class UpgradePrepare(DeployOvercloud):
|
class UpgradePrepare(DeployOvercloud):
|
||||||
@ -59,6 +57,8 @@ class UpgradePrepare(DeployOvercloud):
|
|||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
|
logging.register_options(CONF)
|
||||||
|
logging.setup(CONF, '')
|
||||||
self.log.debug("take_action(%s)" % parsed_args)
|
self.log.debug("take_action(%s)" % parsed_args)
|
||||||
oooutils.ensure_run_as_normal_user()
|
oooutils.ensure_run_as_normal_user()
|
||||||
|
|
||||||
@ -207,6 +207,8 @@ class UpgradeRun(command.Command):
|
|||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
|
logging.register_options(CONF)
|
||||||
|
logging.setup(CONF, '')
|
||||||
self.log.debug("take_action(%s)" % parsed_args)
|
self.log.debug("take_action(%s)" % parsed_args)
|
||||||
oooutils.ensure_run_as_normal_user()
|
oooutils.ensure_run_as_normal_user()
|
||||||
|
|
||||||
|
@ -21,8 +21,6 @@ from tripleoclient import utils
|
|||||||
from tripleoclient.v1.tripleo_deploy import Deploy
|
from tripleoclient.v1.tripleo_deploy import Deploy
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
logging.register_options(CONF)
|
|
||||||
logging.setup(CONF, '')
|
|
||||||
|
|
||||||
|
|
||||||
class Upgrade(Deploy):
|
class Upgrade(Deploy):
|
||||||
@ -31,6 +29,8 @@ class Upgrade(Deploy):
|
|||||||
log = logging.getLogger(__name__ + ".Upgrade")
|
log = logging.getLogger(__name__ + ".Upgrade")
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
|
logging.register_options(CONF)
|
||||||
|
logging.setup(CONF, '')
|
||||||
self.log.debug("take_action(%s)" % parsed_args)
|
self.log.debug("take_action(%s)" % parsed_args)
|
||||||
if (not parsed_args.yes
|
if (not parsed_args.yes
|
||||||
and not utils.prompt_user_for_confirmation(
|
and not utils.prompt_user_for_confirmation(
|
||||||
|
Loading…
Reference in New Issue
Block a user