]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
update: add default values when setting fact
authorGuillaume Abrioux <gabrioux@redhat.com>
Tue, 29 Oct 2019 17:01:50 +0000 (18:01 +0100)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Tue, 29 Oct 2019 20:00:21 +0000 (16:00 -0400)
This commit adds a default value in the `with_dict` because when using
python 2.7, if a task using a `with_dict` has a condition, it is
evaluated anyway whereas in python 3 it isn't.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1766499
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit e9823f319ba8deb2f653c51868eda4566ebff609)

infrastructure-playbooks/rolling_update.yml

index d29707d8eb9c24a98d0b0d66d5f7878f1a702453..5c0c610449ce9f5d4ce2bca86d97add5d8554256 100644 (file)
             - name: set_fact mds_active_name
               set_fact:
                 mds_active_name: "{{ (_mds_active_name.stdout | from_json)['filesystems'][0]['mdsmap']['info'][item.key]['name'] }}"
-              with_dict: "{{ (_mds_active_name.stdout | from_json).filesystems[0]['mdsmap']['info'] }}"
+              with_dict: "{{ (_mds_active_name.stdout | default('{}') | from_json).filesystems[0]['mdsmap']['info'] | default({}) }}"
 
             - name: set_fact mds_active_host
               set_fact: