Merge "Make the logging more safe"
This commit is contained in:
commit
1a3e284c2b
@ -172,7 +172,8 @@ def set_permissions(data):
|
|||||||
os.chown(file_, uid, gid)
|
os.chown(file_, uid, gid)
|
||||||
os.chmod(file_, perm)
|
os.chmod(file_, perm)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
LOG.error("Error while setting permissions for %s: %r", file_, e)
|
LOG.error("Error while setting permissions for %s: %r",
|
||||||
|
file_, repr(e))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
dest = data.get('dest')
|
dest = data.get('dest')
|
||||||
|
@ -138,10 +138,10 @@ class WorkerThread(Thread):
|
|||||||
if image['status'] in ['built', 'unmatched',
|
if image['status'] in ['built', 'unmatched',
|
||||||
'parent_error']:
|
'parent_error']:
|
||||||
break
|
break
|
||||||
except ConnectionError as e:
|
except ConnectionError:
|
||||||
LOG.error(e)
|
LOG.exception('Make sure Docker is running and that you'
|
||||||
LOG.error('Make sure Docker is running and that you have '
|
' have the correct privileges to run Docker'
|
||||||
'the correct privileges to run Docker (root)')
|
' (root)')
|
||||||
image['status'] = "connection_error"
|
image['status'] = "connection_error"
|
||||||
break
|
break
|
||||||
self.end_task(image)
|
self.end_task(image)
|
||||||
|
@ -35,7 +35,7 @@ class BuildTest(base.BaseTestCase):
|
|||||||
|
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
with patch.object(sys, 'argv', self.build_args):
|
with patch.object(sys, 'argv', self.build_args):
|
||||||
LOG.info("Running with args %s" % self.build_args)
|
LOG.info("Running with args %s", self.build_args)
|
||||||
bad_results, good_results, unmatched_results = build.main()
|
bad_results, good_results, unmatched_results = build.main()
|
||||||
|
|
||||||
# these are images that are known to not build properly
|
# these are images that are known to not build properly
|
||||||
@ -53,15 +53,15 @@ class BuildTest(base.BaseTestCase):
|
|||||||
failures = failures + 1
|
failures = failures + 1
|
||||||
LOG.warning(">>> Expected image '%s' to fail, please update"
|
LOG.warning(">>> Expected image '%s' to fail, please update"
|
||||||
" the excluded_images in source file above if the"
|
" the excluded_images in source file above if the"
|
||||||
" image build has been fixed." % image)
|
" image build has been fixed.", image)
|
||||||
else:
|
else:
|
||||||
if result is not 'error':
|
if result is not 'error':
|
||||||
continue
|
continue
|
||||||
failures = failures + 1
|
failures = failures + 1
|
||||||
LOG.critical(">>> Expected image '%s' to succeed!" % image)
|
LOG.critical(">>> Expected image '%s' to succeed!", image)
|
||||||
|
|
||||||
for image in unmatched_results.keys():
|
for image in unmatched_results.keys():
|
||||||
LOG.warning(">>> Image '%s' was not matched" % image)
|
LOG.warning(">>> Image '%s' was not matched", image)
|
||||||
|
|
||||||
self.assertEqual(failures, 0, "%d failure(s) occurred" % failures)
|
self.assertEqual(failures, 0, "%d failure(s) occurred" % failures)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user