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
This commit is contained in:
parent
9ac589295f
commit
d2e0dcdb20
|
@ -17,6 +17,7 @@
|
||||||
shell: python /var/lib/docker-puppet/docker-puppet.py
|
shell: python /var/lib/docker-puppet/docker-puppet.py
|
||||||
environment:
|
environment:
|
||||||
NET_HOST: 'true'
|
NET_HOST: 'true'
|
||||||
|
DEBUG: '{{docker_puppet_debug}}'
|
||||||
when: step == "1"
|
when: step == "1"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
check_mode: no
|
check_mode: no
|
||||||
|
|
|
@ -29,9 +29,13 @@ import tempfile
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
|
|
||||||
log = logging.getLogger()
|
log = logging.getLogger()
|
||||||
log.setLevel(logging.DEBUG)
|
|
||||||
ch = logging.StreamHandler(sys.stdout)
|
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')
|
formatter = logging.Formatter('%(asctime)s %(levelname)s: %(message)s')
|
||||||
ch.setFormatter(formatter)
|
ch.setFormatter(formatter)
|
||||||
log.addHandler(ch)
|
log.addHandler(ch)
|
||||||
|
@ -145,11 +149,11 @@ for service in (json_data or []):
|
||||||
if not manifest or not config_image:
|
if not manifest or not config_image:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
log.debug('config_volume %s' % config_volume)
|
log.info('config_volume %s' % config_volume)
|
||||||
log.debug('puppet_tags %s' % puppet_tags)
|
log.info('puppet_tags %s' % puppet_tags)
|
||||||
log.debug('manifest %s' % manifest)
|
log.info('manifest %s' % manifest)
|
||||||
log.debug('config_image %s' % config_image)
|
log.info('config_image %s' % config_image)
|
||||||
log.debug('volumes %s' % volumes)
|
log.info('volumes %s' % volumes)
|
||||||
# We key off of config volume for all configs.
|
# We key off of config volume for all configs.
|
||||||
if config_volume in configs:
|
if config_volume in configs:
|
||||||
# Append puppet tags and manifest.
|
# 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,
|
subproc = subprocess.Popen(dcmd, stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE, env=env)
|
stderr=subprocess.PIPE, env=env)
|
||||||
cmd_stdout, cmd_stderr = subproc.communicate()
|
cmd_stdout, cmd_stderr = subproc.communicate()
|
||||||
if cmd_stdout:
|
|
||||||
log.debug(cmd_stdout)
|
|
||||||
if cmd_stderr:
|
|
||||||
log.debug(cmd_stderr)
|
|
||||||
if subproc.returncode != 0:
|
if subproc.returncode != 0:
|
||||||
log.error('Failed running docker-puppet.py for %s' % config_volume)
|
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:
|
else:
|
||||||
|
if cmd_stdout:
|
||||||
|
log.debug(cmd_stdout)
|
||||||
|
if cmd_stderr:
|
||||||
|
log.debug(cmd_stderr)
|
||||||
# only delete successful runs, for debugging
|
# only delete successful runs, for debugging
|
||||||
rm_container('docker-puppet-%s' % config_volume)
|
rm_container('docker-puppet-%s' % config_volume)
|
||||||
return subproc.returncode
|
return subproc.returncode
|
||||||
|
|
|
@ -38,6 +38,10 @@ parameters:
|
||||||
description: Mapping of service endpoint -> protocol. Typically set
|
description: Mapping of service endpoint -> protocol. Typically set
|
||||||
via parameter_defaults in the resource registry.
|
via parameter_defaults in the resource registry.
|
||||||
type: json
|
type: json
|
||||||
|
DockerPuppetDebug:
|
||||||
|
type: string
|
||||||
|
default: ''
|
||||||
|
description: Set to True to enable debug logging with docker-puppet.py
|
||||||
ctlplane_service_ips:
|
ctlplane_service_ips:
|
||||||
type: json
|
type: json
|
||||||
|
|
||||||
|
@ -84,6 +88,7 @@ resources:
|
||||||
- name: role_name
|
- name: role_name
|
||||||
- name: update_identifier
|
- name: update_identifier
|
||||||
- name: bootstrap_server_id
|
- name: bootstrap_server_id
|
||||||
|
- name: docker_puppet_debug
|
||||||
config: {get_file: deploy-steps-playbook.yaml}
|
config: {get_file: deploy-steps-playbook.yaml}
|
||||||
|
|
||||||
{%- for step in range(1, deploy_steps_max) %}
|
{%- for step in range(1, deploy_steps_max) %}
|
||||||
|
@ -286,6 +291,7 @@ resources:
|
||||||
role_name: {{role.name}}
|
role_name: {{role.name}}
|
||||||
update_identifier: {get_param: DeployIdentifier}
|
update_identifier: {get_param: DeployIdentifier}
|
||||||
bootstrap_server_id: {get_param: [servers, {{primary_role_name}}, '0']}
|
bootstrap_server_id: {get_param: [servers, {{primary_role_name}}, '0']}
|
||||||
|
docker_puppet_debug: {get_param: DockerPuppetDebug}
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
# END CONFIG STEPS
|
# END CONFIG STEPS
|
||||||
|
|
Loading…
Reference in New Issue