undercloud_enable_novajoin variable is not being respected as a bool

Bug #1897414 reported by wes hayutin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
Critical
wes hayutin

Bug Description

To properly debug what is going on, I created the following playbook.

#######################

---
- name: foo
  hosts: localhost
  tasks:
    - name: print
      debug:
        msg: "{{ undercloud_enable_novajoin }}"
    - name: print type
      debug:
        msg: "{{ undercloud_enable_novajoin | type_debug }}"
#######################

I have the following two yaml variable files.

1. Original vars - novajoin.yaml
#######################

undercloud_enable_novajoin: >-
  {% if release in ['queens', 'rocky', 'stein', 'train'] -%}
  true
  {%- else -%}
  false
  {%- endif -%}
#######################

2. Updated vars - novajoin_bool.yaml
#######################

undercloud_enable_novajoin: >-
  {% if release in ['queens', 'rocky', 'stein', 'train'] -%}
  True
  {%- else -%}
  False
  {%- endif -%}
#######################

***************** RESULTS for #1 *****************

[root@localhost tmp]# ansible-playbook -e release=master -e @novajoin.yaml test.yml
[WARNING]: Ansible is being run in a world writable directory (/var/tmp), ignoring it as an ansible.cfg source. For more information see
https://docs.ansible.com/ansible/devel/reference_appendices/config.html#cfg-in-world-writable-dir
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [foo] ************************************************************************************************************************************************************************************

TASK [Gathering Facts] ************************************************************************************************************************************************************************
ok: [localhost]

TASK [print] **********************************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": "false"
}

TASK [print type] *****************************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": "str"
}

PLAY RECAP ************************************************************************************************************************************************************************************
localhost : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

***************** RESULTS for #2 *****************

[root@localhost tmp]# ansible-playbook -e release=master -e @novajoin_bool.yaml test.yml
[WARNING]: Ansible is being run in a world writable directory (/var/tmp), ignoring it as an ansible.cfg source. For more information see
https://docs.ansible.com/ansible/devel/reference_appendices/config.html#cfg-in-world-writable-dir
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [foo] ************************************************************************************************************************************************************************************

TASK [Gathering Facts] ************************************************************************************************************************************************************************
ok: [localhost]

TASK [print] **********************************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": false
}

TASK [print type] *****************************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": "bool"
}

PLAY RECAP ************************************************************************************************************************************************************************************
localhost : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

[root@localhost tmp]#

It seems that yaml + jinja2 does not respect the lowercase "false/true" as boolean where ansible does when you directly set the variable foo: true.

When using jinja in a variables file, one MUST use the CamelCase for true/false as True/False.

Tags: ci
Changed in tripleo:
assignee: nobody → wes hayutin (weshayutin)
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-quickstart (master)

Reviewed: https://review.opendev.org/754408
Committed: https://git.openstack.org/cgit/openstack/tripleo-quickstart/commit/?id=cf9d8268c2ae33dda084fe764086973cdf20f8d1
Submitter: Zuul
Branch: master

commit cf9d8268c2ae33dda084fe764086973cdf20f8d1
Author: Ade Lee <email address hidden>
Date: Fri Sep 25 10:29:59 2020 -0400

    making sure undercloud_enable_novajoin set correctly

    Closes-Bug: #1897414
    Change-Id: I69a2614f0b686463fbbc71f13457dd65fe7a0015

Changed in tripleo:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.