summaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2017-06-26 09:53:31 -0400
committerDan Prince <dprince@redhat.com>2017-06-28 10:26:32 -0400
commitd2e0dcdb200fb95a88ee1da26b96828b21fcecc1 (patch)
tree1e29847efa5e934aaa66beb4747a89c1176e0a1e /docker
parent9ac589295f199133df8192d67cfe10f011ef08dd (diff)
Default docker-puppet.py logging to INFO
If you want debug logging you can set the new DockerPuppetDebug heat parameter to 'True'. Change-Id: Iae7bb67379351ea15d61c331867d7005f07ba98e Closes-bug: 1700570
Diffstat (limited to 'docker')
-rw-r--r--docker/deploy-steps-playbook.yaml1
-rwxr-xr-xdocker/docker-puppet.py30
-rw-r--r--docker/docker-steps.j26
3 files changed, 26 insertions, 11 deletions
diff --git a/docker/deploy-steps-playbook.yaml b/docker/deploy-steps-playbook.yaml
index b3cb500f..87587a4b 100644
--- a/docker/deploy-steps-playbook.yaml
+++ b/docker/deploy-steps-playbook.yaml
@@ -17,6 +17,7 @@
shell: python /var/lib/docker-puppet/docker-puppet.py
environment:
NET_HOST: 'true'
+ DEBUG: '{{docker_puppet_debug}}'
when: step == "1"
changed_when: false
check_mode: no
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
diff --git a/docker/docker-steps.j2 b/docker/docker-steps.j2
index 83772028..73a3cb78 100644
--- a/docker/docker-steps.j2
+++ b/docker/docker-steps.j2
@@ -38,6 +38,10 @@ parameters:
description: Mapping of service endpoint -> protocol. Typically set
via parameter_defaults in the resource registry.
type: json
+ DockerPuppetDebug:
+ type: string
+ default: ''
+ description: Set to True to enable debug logging with docker-puppet.py
ctlplane_service_ips:
type: json
@@ -84,6 +88,7 @@ resources:
- name: role_name
- name: update_identifier
- name: bootstrap_server_id
+ - name: docker_puppet_debug
config: {get_file: deploy-steps-playbook.yaml}
{%- for step in range(1, deploy_steps_max) %}
@@ -286,6 +291,7 @@ resources:
role_name: {{role.name}}
update_identifier: {get_param: DeployIdentifier}
bootstrap_server_id: {get_param: [servers, {{primary_role_name}}, '0']}
+ docker_puppet_debug: {get_param: DockerPuppetDebug}
{% endfor %}
# END CONFIG STEPS