Merge "Be explicit when passing vars into deploy steps"

This commit is contained in:
Zuul 2019-01-15 18:16:40 +00:00 committed by Gerrit Code Review
commit 52a70658ab
3 changed files with 77 additions and 14 deletions

View File

@ -329,8 +329,8 @@
set_fact:
host_puppet_config_debug: "--debug --verbose"
when:
- enable_puppet | default(true) | bool
- enable_debug | default(false) | bool
- enable_puppet | bool
- enable_debug | bool
tags:
- host_config
@ -382,7 +382,7 @@
- container_config
- name: Run puppet host configuration for step {{ step }}
when: enable_puppet|default(true)|bool
when: enable_puppet|bool
command: >-
puppet apply {{ host_puppet_config_debug | default('') }}
--modulepath=/etc/puppet/modules:/opt/stack/puppet-modules:/usr/share/openstack-puppet/modules
@ -404,7 +404,7 @@
debug:
var: outputs.stdout_lines | default([]) | union(outputs.stderr_lines | default([]))
when:
- enable_puppet | default(true) | bool
- enable_puppet | bool
- outputs.rc is defined
failed_when: outputs.rc not in [0, 2]
tags:
@ -419,9 +419,9 @@
shell: "{{ python_cmd }} /var/lib/docker-puppet/docker-puppet.py"
environment:
NET_HOST: 'true'
DEBUG: '{{ docker_puppet_debug | default(false) }}'
PROCESS_COUNT: '{{ docker_puppet_process_count | default(3) }}'
CONTAINER_CLI: "{{ container_cli | default('docker') }}"
DEBUG: '{{ docker_puppet_debug | bool }}'
PROCESS_COUNT: '{{ docker_puppet_process_count }}'
CONTAINER_CLI: "{{ container_cli }}"
CONFIG: '/var/lib/docker-puppet/{{ ansible_check_mode | ternary("check-mode/", "") }}docker-puppet.json'
CONFIG_VOLUME_PREFIX: '/var/lib/config-data{{ ansible_check_mode | ternary("/check-mode", "") }}'
CHECK_MODE: '{{ ansible_check_mode | ternary(1, 0) }}'
@ -481,7 +481,7 @@
- name: Start containers for step {{ step }}
command: >-
paunch --debug apply
--default-runtime "{{ container_cli | default('docker') }}"
--default-runtime "{{ container_cli }}"
--file /var/lib/tripleo-config/hashed-docker-container-startup-config-step_{{ step }}.json
--config-id tripleo_step{{ step }} --managed-by tripleo-{{ tripleo_role_name }}
changed_when: false
@ -518,9 +518,9 @@
NET_HOST: "true"
NO_ARCHIVE: "true"
STEP: "{{ step }}"
CONTAINER_CLI: "{{ container_cli | default('docker') }}"
DEBUG: "{{ docker_puppet_debug|default(false) }}"
MOUNT_HOST_PUPPET: '{{docker_puppet_mount_host_puppet | default(true)}}'
CONTAINER_CLI: "{{ container_cli }}"
DEBUG: "{{ docker_puppet_debug }}"
MOUNT_HOST_PUPPET: '{{docker_puppet_mount_host_puppet}}'
when:
- deploy_server_id == bootstrap_server_id
- docker_puppet_tasks_json.stat.exists

View File

@ -69,8 +69,8 @@ parameters:
description: Whether to run the puppet (baremetal) deployment tasks.
type: boolean
DockerPuppetDebug:
type: string
default: ''
type: boolean
default: false
description: Set to True to enable debug logging with docker-puppet.py
DockerPuppetProcessCount:
type: number
@ -646,6 +646,13 @@ outputs:
DEPLOY_SOURCE_HOST: {get_param: deployment_source_hosts}
DEPLOY_TARGET_HOST: {get_param: deployment_target_hosts}
CONTAINER_CLI: {get_param: ContainerCli}
DEPLOY_IDENTIFIER: {get_param: DeployIdentifier}
BOOTSTRAP_SERVER_ID: {get_attr: [BootstrapServerId, value]}
ENABLE_DEBUG: {get_param: ConfigDebug}
ENABLE_PUPPET: {get_param: EnablePuppet}
DOCKER_PUPPET_DEBUG: {get_param: DockerPuppetDebug}
DOCKER_PUPPET_PROCESS_COUNT: {get_param: DockerPuppetProcessCount}
DOCKER_PUPPET_MOUNT_HOST_PUPPET: {get_param: DockerPuppetMountHostPuppet}
template: |
- hosts: DEPLOY_SOURCE_HOST
name: Gather facts from undercloud
@ -665,7 +672,14 @@ outputs:
gather_facts: no
any_errors_fatal: yes
vars:
bootstrap_server_id: BOOTSTRAP_SERVER_ID
deploy_identifier: DEPLOY_IDENTIFIER
enable_debug: ENABLE_DEBUG
enable_puppet: ENABLE_PUPPET
container_cli: CONTAINER_CLI
docker_puppet_debug: DOCKER_PUPPET_DEBUG
docker_puppet_process_count: DOCKER_PUPPET_PROCESS_COUNT
docker_puppet_mount_host_puppet: DOCKER_PUPPET_MOUNT_HOST_PUPPET
tasks:
- include_tasks: update_steps_tasks.yaml
with_sequence: start=0 end={{update_steps_max-1}}
@ -788,6 +802,13 @@ outputs:
DEPLOY_SOURCE_HOST: {get_param: deployment_source_hosts}
DEPLOY_TARGET_HOST: {get_param: deployment_target_hosts}
CONTAINER_CLI: {get_param: ContainerCli}
DEPLOY_IDENTIFIER: {get_param: DeployIdentifier}
BOOTSTRAP_SERVER_ID: {get_attr: [BootstrapServerId, value]}
ENABLE_DEBUG: {get_param: ConfigDebug}
ENABLE_PUPPET: {get_param: EnablePuppet}
DOCKER_PUPPET_DEBUG: {get_param: DockerPuppetDebug}
DOCKER_PUPPET_PROCESS_COUNT: {get_param: DockerPuppetProcessCount}
DOCKER_PUPPET_MOUNT_HOST_PUPPET: {get_param: DockerPuppetMountHostPuppet}
template: |
- hosts: DEPLOY_TARGET_HOST
any_errors_fatal: yes
@ -795,7 +816,14 @@ outputs:
- include_tasks: upgrade_steps_tasks.yaml
with_sequence: start=0 end={{upgrade_steps_max-1}}
vars:
bootstrap_server_id: BOOTSTRAP_SERVER_ID
deploy_identifier: DEPLOY_IDENTIFIER
enable_debug: ENABLE_DEBUG
enable_puppet: ENABLE_PUPPET
container_cli: CONTAINER_CLI
docker_puppet_debug: DOCKER_PUPPET_DEBUG
docker_puppet_process_count: DOCKER_PUPPET_PROCESS_COUNT
docker_puppet_mount_host_puppet: DOCKER_PUPPET_MOUNT_HOST_PUPPET
loop_control:
loop_var: step
post_upgrade_steps_tasks: |
@ -809,6 +837,13 @@ outputs:
DEPLOY_SOURCE_HOST: {get_param: deployment_source_hosts}
DEPLOY_TARGET_HOST: {get_param: deployment_target_hosts}
CONTAINER_CLI: {get_param: ContainerCli}
DEPLOY_IDENTIFIER: {get_param: DeployIdentifier}
BOOTSTRAP_SERVER_ID: {get_attr: [BootstrapServerId, value]}
ENABLE_DEBUG: {get_param: ConfigDebug}
ENABLE_PUPPET: {get_param: EnablePuppet}
DOCKER_PUPPET_DEBUG: {get_param: DockerPuppetDebug}
DOCKER_PUPPET_PROCESS_COUNT: {get_param: DockerPuppetProcessCount}
DOCKER_PUPPET_MOUNT_HOST_PUPPET: {get_param: DockerPuppetMountHostPuppet}
template: |
- hosts: DEPLOY_TARGET_HOST
any_errors_fatal: yes
@ -816,7 +851,14 @@ outputs:
- include_tasks: post_upgrade_steps_tasks.yaml
with_sequence: start=0 end={{post_upgrade_steps_max-1}}
vars:
bootstrap_server_id: BOOTSTRAP_SERVER_ID
deploy_identifier: DEPLOY_IDENTIFIER
enable_debug: ENABLE_DEBUG
enable_puppet: ENABLE_PUPPET
container_cli: CONTAINER_CLI
docker_puppet_debug: DOCKER_PUPPET_DEBUG
docker_puppet_process_count: DOCKER_PUPPET_PROCESS_COUNT
docker_puppet_mount_host_puppet: DOCKER_PUPPET_MOUNT_HOST_PUPPET
loop_control:
loop_var: step
external_upgrade_steps_tasks: {get_attr: [ExternalUpgradeTasks, value]}
@ -825,6 +867,13 @@ outputs:
params:
DEPLOY_SOURCE_HOST: {get_param: deployment_source_hosts}
DEPLOY_TARGET_HOST: {get_param: deployment_target_hosts}
DEPLOY_IDENTIFIER: {get_param: DeployIdentifier}
BOOTSTRAP_SERVER_ID: {get_attr: [BootstrapServerId, value]}
ENABLE_DEBUG: {get_param: ConfigDebug}
ENABLE_PUPPET: {get_param: EnablePuppet}
DOCKER_PUPPET_DEBUG: {get_param: DockerPuppetDebug}
DOCKER_PUPPET_PROCESS_COUNT: {get_param: DockerPuppetProcessCount}
DOCKER_PUPPET_MOUNT_HOST_PUPPET: {get_param: DockerPuppetMountHostPuppet}
CONTAINER_CLI: {get_param: ContainerCli}
template: |
- hosts: DEPLOY_SOURCE_HOST
@ -854,7 +903,14 @@ outputs:
any_errors_fatal: yes
become: false
vars:
bootstrap_server_id: BOOTSTRAP_SERVER_ID
deploy_identifier: DEPLOY_IDENTIFIER
enable_debug: ENABLE_DEBUG
enable_puppet: ENABLE_PUPPET
container_cli: CONTAINER_CLI
docker_puppet_debug: DOCKER_PUPPET_DEBUG
docker_puppet_process_count: DOCKER_PUPPET_PROCESS_COUNT
docker_puppet_mount_host_puppet: DOCKER_PUPPET_MOUNT_HOST_PUPPET
tasks:
- include: external_upgrade_steps_tasks.yaml
with_sequence: start=0 end={{external_upgrade_steps_max-1}}
@ -872,7 +928,14 @@ outputs:
any_errors_fatal: yes
become: false
vars:
bootstrap_server_id: BOOTSTRAP_SERVER_ID
deploy_identifier: DEPLOY_IDENTIFIER
enable_debug: ENABLE_DEBUG
enable_puppet: ENABLE_PUPPET
container_cli: CONTAINER_CLI
docker_puppet_debug: DOCKER_PUPPET_DEBUG
docker_puppet_process_count: DOCKER_PUPPET_PROCESS_COUNT
docker_puppet_mount_host_puppet: DOCKER_PUPPET_MOUNT_HOST_PUPPET
tasks:
- include: external_deploy_steps_tasks.yaml
with_sequence: start=1 end={{deploy_steps_max-1}}

View File

@ -41,7 +41,7 @@ def get_logger():
if logger is None:
logger = logging.getLogger()
ch = logging.StreamHandler(sys.stdout)
if os.environ.get('DEBUG', False):
if os.environ.get('DEBUG') in ['True', 'true'] :
logger.setLevel(logging.DEBUG)
ch.setLevel(logging.DEBUG)
else: