Code Review
/
doctor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
DevStack support
[doctor.git]
/
doctor_tests
/
image.py
diff --git
a/doctor_tests/image.py
b/doctor_tests/image.py
index
9961b22
..
50841ef
100644
(file)
--- a/
doctor_tests/image.py
+++ b/
doctor_tests/image.py
@@
-7,7
+7,11
@@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
import os
# 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
from oslo_config import cfg
@@
-46,11
+50,14
@@
class Image(object):
def create(self):
self.log.info('image create start......')
def create(self):
self.log.info('image create start......')
-
images = {image.name: image for image in self.glance.images.list()}
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):
if self.conf.image_name not in images:
if not os.path.exists(self.conf.image_filename):
- resp = url
lib.request.url
open(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 = \
with open(self.conf.image_filename, "wb") as file:
file.write(resp.read())
self.image = \