From 3f35bff1e19e9ff20bec6d5bbebcd5bb2b10fb49 Mon Sep 17 00:00:00 2001 From: Martin Kopec Date: Mon, 13 Jul 2020 11:26:02 +0000 Subject: [PATCH] Deprecate scenario.img_dir option The option is deprecated for more than 4 years already and it will be removed soon, see the change in Tempest [1] Starting Tempest 25.0.0 release, CONF.scenario.img_file need a full path for the image. CONF.scenario.img_dir was deprecated and will be removed in the next release. Till Tempest 25.0.0, old behavior is maintained and keep working but starting Tempest 26.0.0, you need to specify the full path in CONF.scenario.img_file config option. This patch does analogically the same change as was done in Tempest, in order to give users of the plugin some time for removing img_dir. [1] https://review.opendev.org/#/c/710996 Related-Bug: #1393881 Change-Id: I610d267eab287e3df8dd428621c4d3abace6dd0c --- .../tests/scenario/barbican_manager.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/barbican_tempest_plugin/tests/scenario/barbican_manager.py b/barbican_tempest_plugin/tests/scenario/barbican_manager.py index 69cd2b9..a39bb0f 100644 --- a/barbican_tempest_plugin/tests/scenario/barbican_manager.py +++ b/barbican_tempest_plugin/tests/scenario/barbican_manager.py @@ -53,8 +53,21 @@ class BarbicanScenarioTest(mgr.ScenarioTest): super(BarbicanScenarioTest, self).setUp() self.useFixture(api_microversion_fixture.APIMicroversionFixture( self.request_microversion)) - self.img_file = os.path.join(CONF.scenario.img_dir, - CONF.scenario.img_file) + self.img_file = CONF.scenario.img_file + if not os.path.exists(self.img_file): + # TODO(kopecmartin): replace LOG.warning for rasing + # InvalidConfiguration exception after tempest 25.0.0 is + # released - there will be one release which accepts both + # behaviors in order to avoid many failures across CIs and etc. + LOG.warning( + 'Starting Tempest 25.0.0 release, CONF.scenario.img_file need ' + 'a full path for the image. CONF.scenario.img_dir was ' + 'deprecated and will be removed in the next release. Till ' + 'Tempest 25.0.0, old behavior is maintained and keep working ' + 'but starting Tempest 26.0.0, you need to specify the full ' + 'path in CONF.scenario.img_file config option.') + self.img_file = os.path.join(CONF.scenario.img_dir, self.img_file) + self.private_key = rsa.generate_private_key(public_exponent=3, key_size=1024, backend=default_backend())