validate_upgrade_tasks_duplicate_whens detects false positive.

Bug #1910418 reported by Sofer Athlan-Guyot
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Triaged
Medium
Sofer Athlan-Guyot

Bug Description

Hi,

if you setup some output tasks in a template like this:

  upgrade_tasks:
    - block:
        - debug: "bar"
          when: 1 == 1
      when: 0 == 0

then we get:

ERROR: found duplicate when statements in ./puppet/services/test.yaml upgrade_task: when: 1 == 1 when: 0 == 0

that's because the check in validate_upgrade_tasks_duplicate_whens in ./tool/yaml_validate.py doesn't support this kind of block syntax and take the second when statement as belonging to the task in the block.

there are other flaws in that function, like it start at upgrade_tasks and include everything till the end of the file, even if that's not upgrade_tasks definition anymore.

Revision history for this message
Sofer Athlan-Guyot (sofer-athlan-guyot) wrote :

Fun facts.

if you have this

  upgrade_tasks:
    - block:
        - name: funny
          when: 1 == 1
          shell: "bar --like foo"
      when: 0 == 0

then it works because " -" is seen as the beginning of a new task and reset counters.

Revision history for this message
Sofer Athlan-Guyot (sofer-athlan-guyot) wrote :
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.