summaryrefslogtreecommitdiffstats
path: root/doctor_tests/image.py
diff options
context:
space:
mode:
authorTomi Juvonen <tomi.juvonen@nokia.com>2019-11-28 12:31:51 +0200
committerTomi Juvonen <tomi.juvonen@nokia.com>2020-01-08 12:22:50 +0200
commitd8eb12f4200c21f569df5bc01d378a846b4c0db0 (patch)
treeacf0a67ef2a9a0e89d63e5863e9dc7bc53190478 /doctor_tests/image.py
parent7822d631bc2fd2e8faf36d2b809e1e5b69f5251c (diff)
DevStack support
Support running Doctor testing is DevStack multi-node controller JIRA: DOCTOR-136 Signed-off-by: Tomi Juvonen <tomi.juvonen@nokia.com> Change-Id: I1569f3f77d889420b3b8f3c2724c10253e509c28
Diffstat (limited to 'doctor_tests/image.py')
-rw-r--r--doctor_tests/image.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/doctor_tests/image.py b/doctor_tests/image.py
index 9961b22d..50841ef6 100644
--- a/doctor_tests/image.py
+++ b/doctor_tests/image.py
@@ -7,7 +7,11 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
import os
-import urllib.request
+try:
+ from urllib.request import urlopen
+except Exception:
+ from urllib2 import urlopen
+
from oslo_config import cfg
@@ -46,11 +50,14 @@ class Image(object):
def create(self):
self.log.info('image create start......')
-
images = {image.name: image for image in self.glance.images.list()}
+ if self.conf.image_name == 'cirros':
+ cirros = [image for image in images if 'cirros' in image]
+ if cirros:
+ self.conf.image_name = cirros[0]
if self.conf.image_name not in images:
if not os.path.exists(self.conf.image_filename):
- resp = urllib.request.urlopen(self.conf.image_download_url)
+ resp = urlopen(self.conf.image_download_url)
with open(self.conf.image_filename, "wb") as file:
file.write(resp.read())
self.image = \