aboutsummaryrefslogtreecommitdiffstats
path: root/docker/docker-puppet.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-06-29 05:09:41 +0000
committerGerrit Code Review <review@openstack.org>2017-06-29 05:09:41 +0000
commit4221b013d36244759079d26ed834fb24e481f0b3 (patch)
tree091548edcc243c19d5810905016486c7ef0e92d3 /docker/docker-puppet.py
parent74b990bede3b1c09e690d225dd7bccae0bfd2f70 (diff)
parentd2e0dcdb200fb95a88ee1da26b96828b21fcecc1 (diff)
Merge "Default docker-puppet.py logging to INFO"
Diffstat (limited to 'docker/docker-puppet.py')
-rwxr-xr-xdocker/docker-puppet.py30
1 files changed, 19 insertions, 11 deletions
diff --git a/docker/docker-puppet.py b/docker/docker-puppet.py
index 13211676..430aa88b 100755
--- a/docker/docker-puppet.py
+++ b/docker/docker-puppet.py
@@ -29,9 +29,13 @@ import tempfile
import multiprocessing
log = logging.getLogger()
-log.setLevel(logging.DEBUG)
ch = logging.StreamHandler(sys.stdout)
-ch.setLevel(logging.DEBUG)
+if os.environ.get('DEBUG', False):
+ log.setLevel(logging.DEBUG)
+ ch.setLevel(logging.DEBUG)
+else:
+ log.setLevel(logging.INFO)
+ ch.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s %(levelname)s: %(message)s')
ch.setFormatter(formatter)
log.addHandler(ch)
@@ -145,11 +149,11 @@ for service in (json_data or []):
if not manifest or not config_image:
continue
- log.debug('config_volume %s' % config_volume)
- log.debug('puppet_tags %s' % puppet_tags)
- log.debug('manifest %s' % manifest)
- log.debug('config_image %s' % config_image)
- log.debug('volumes %s' % volumes)
+ log.info('config_volume %s' % config_volume)
+ log.info('puppet_tags %s' % puppet_tags)
+ log.info('manifest %s' % manifest)
+ log.info('config_image %s' % config_image)
+ log.info('volumes %s' % volumes)
# We key off of config volume for all configs.
if config_volume in configs:
# Append puppet tags and manifest.
@@ -272,13 +276,17 @@ def mp_puppet_config((config_volume, puppet_tags, manifest, config_image, volume
subproc = subprocess.Popen(dcmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, env=env)
cmd_stdout, cmd_stderr = subproc.communicate()
- if cmd_stdout:
- log.debug(cmd_stdout)
- if cmd_stderr:
- log.debug(cmd_stderr)
if subproc.returncode != 0:
log.error('Failed running docker-puppet.py for %s' % config_volume)
+ if cmd_stdout:
+ log.error(cmd_stdout)
+ if cmd_stderr:
+ log.error(cmd_stderr)
else:
+ if cmd_stdout:
+ log.debug(cmd_stdout)
+ if cmd_stderr:
+ log.debug(cmd_stderr)
# only delete successful runs, for debugging
rm_container('docker-puppet-%s' % config_volume)
return subproc.returncode