aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xkolla/cmd/build.py23
-rw-r--r--requirements.txt1
-rw-r--r--tests/test_build.py3
3 files changed, 14 insertions, 13 deletions
diff --git a/kolla/cmd/build.py b/kolla/cmd/build.py
index 4a8f4cd10..7fb0f8145 100755
--- a/kolla/cmd/build.py
+++ b/kolla/cmd/build.py
@@ -15,13 +15,11 @@
# TODO(jpeeler): Add clean up handler for SIGINT
import argparse
-import ConfigParser
import datetime
import json
import logging
import os
import platform
-import Queue
import re
import requests
import shutil
@@ -36,6 +34,7 @@ import docker
import git
import jinja2
from requests.exceptions import ConnectionError
+import six
logging.basicConfig()
LOG = logging.getLogger(__name__)
@@ -168,7 +167,7 @@ class WorkerThread(Thread):
rm=True,
pull=pull,
forcerm=self.forcerm):
- stream = json.loads(response)
+ stream = json.loads(response.decode('utf-8'))
if 'stream' in stream:
image['logs'] = image['logs'] + stream['stream']
@@ -348,7 +347,7 @@ class KollaWorker(object):
self.include_footer = config['include_footer']
self.regex = config['regex']
self.profile = config['profile']
- self.source_location = ConfigParser.SafeConfigParser()
+ self.source_location = six.moves.configparser.SafeConfigParser()
self.source_location.read(find_config_file('kolla-build.conf'))
self.image_statuses_bad = dict()
self.image_statuses_good = dict()
@@ -423,10 +422,10 @@ class KollaWorker(object):
filter_ += self.source_location.get('profiles',
profile
).split(',')
- except ConfigParser.NoSectionError:
+ except six.moves.configparser.NoSectionError:
LOG.error('No [profiles] section found in {}'.format(
find_config_file('kolla-build.conf')))
- except ConfigParser.NoOptionError:
+ except six.moves.configparser.NoOptionError:
LOG.error('No profile named "{}" found in {}'.format(
self.profile,
find_config_file('kolla-build.conf')))
@@ -472,7 +471,7 @@ class KollaWorker(object):
if self.image_statuses_bad:
LOG.info("Images that failed to build")
LOG.info("===========================")
- for name, status in self.image_statuses_bad.iteritems():
+ for name, status in six.iteritems(self.image_statuses_bad):
LOG.error('{}\r\t\t\t Failed with status: {}'.format(
name, status))
@@ -529,7 +528,7 @@ class KollaWorker(object):
self.source_location.get(image['name'],
'reference')
- except ConfigParser.NoSectionError:
+ except six.moves.configparser.NoSectionError:
LOG.debug('{}:No source location found'.format(
image['name']))
pass
@@ -543,7 +542,7 @@ class KollaWorker(object):
for image in self.images:
sort_images[image['fullname']] = image
- for parent_name, parent in sort_images.iteritems():
+ for parent_name, parent in six.iteritems(sort_images):
for image in sort_images.values():
if image['parent_name'] == parent_name:
parent['children'].append(image)
@@ -559,7 +558,7 @@ class KollaWorker(object):
self.find_parents()
self.filter_images()
- queue = Queue.Queue()
+ queue = six.moves.queue.Queue()
for image in self.images:
if image['parent'] is None:
@@ -587,7 +586,7 @@ def push_image(image):
def main():
- build_config = ConfigParser.SafeConfigParser()
+ build_config = six.moves.configparser.SafeConfigParser()
build_config.read(find_config_file('kolla-build.conf'))
config = merge_args_and_config(build_config)
if config['debug']:
@@ -608,7 +607,7 @@ def main():
queue = kolla.build_queue()
- for x in xrange(config['threads']):
+ for x in six.moves.xrange(config['threads']):
worker = WorkerThread(queue, config)
worker.setDaemon(True)
worker.start()
diff --git a/requirements.txt b/requirements.txt
index faa1f2e34..3722741ee 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -6,3 +6,4 @@ docker-py>=1.4.0 # Apache-2.0
Jinja2>=2.6 # BSD License (3 clause)
gitdb>=0.6.4 # BSD License (3 clause)
GitPython>=1.0.1 # BSD License (3 clause)
+six>=1.9.0
diff --git a/tests/test_build.py b/tests/test_build.py
index cd4ee54b8..e0827eec3 100644
--- a/tests/test_build.py
+++ b/tests/test_build.py
@@ -16,6 +16,7 @@ from os import path
from oslo_log import fixture as log_fixture
from oslo_log import log as logging
from oslotest import base
+import six
import sys
sys.path.append(path.abspath(path.join(path.dirname(__file__), '../tools')))
@@ -44,7 +45,7 @@ class BuildTest(base.BaseTestCase):
"ironic-discoverd"]
failures = 0
- for image, result in bad_results.iteritems():
+ for image, result in six.iteritems(bad_results):
if image in excluded_images:
if result is 'error':
continue