Deprecate scenario.img_dir option
Starting Tempest 25.0.0 release, CONF.scenario.img_file needs a full path for the image. CONF.scenario.img_dir was deprecated and is removed in 27.0.0 release [2]. 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 [2] https://review.opendev.org/c/openstack/tempest/+/754927 Related-Bug: #1393881 Change-Id: I81313bd2b87f1c0603221ac3e04050f85215c846
This commit is contained in:
parent
168e151c67
commit
b2e548518a
|
@ -14,6 +14,7 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import os
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
|
|
||||||
from tempest.common import image as common_image
|
from tempest.common import image as common_image
|
||||||
|
@ -197,7 +198,22 @@ class ScenarioTest(tempest.test.BaseTestCase):
|
||||||
image = body['image'] if 'image' in body else body
|
image = body['image'] if 'image' in body else body
|
||||||
# self.addCleanup(self.image_client.delete_image, image['id'])
|
# self.addCleanup(self.image_client.delete_image, image['id'])
|
||||||
self.assertEqual("queued", image['status'])
|
self.assertEqual("queued", image['status'])
|
||||||
img_path = CONF.scenario.img_dir + "/" + CONF.scenario.img_file
|
|
||||||
|
img_path = CONF.scenario.img_file
|
||||||
|
if not os.path.exists(img_path):
|
||||||
|
# TODO(kopecmartin): replace LOG.warning for raising
|
||||||
|
# InvalidConfiguration exception when this plugin is meant to be
|
||||||
|
# used with only Tempest 27.0.0 and higher
|
||||||
|
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 is removed in 27.0.0 release. Till Tempest '
|
||||||
|
'27.0.0 (excluding), old behavior is maintained and kept '
|
||||||
|
'working but starting Tempest 27.0.0, only full path '
|
||||||
|
'CONF.scenario.img_file config option is accepted by the '
|
||||||
|
'Tempest.')
|
||||||
|
img_path = os.path.join(CONF.scenario.img_dir, img_path)
|
||||||
|
|
||||||
with open(img_path, 'rb') as image_file:
|
with open(img_path, 'rb') as image_file:
|
||||||
if CONF.image_feature_enabled.api_v1:
|
if CONF.image_feature_enabled.api_v1:
|
||||||
self.image_client.update_image(image['id'], data=image_file)
|
self.image_client.update_image(image['id'], data=image_file)
|
||||||
|
|
Loading…
Reference in New Issue