]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
fs2bs: use match filter in selectattr()
authorGuillaume Abrioux <gabrioux@redhat.com>
Tue, 25 May 2021 19:40:45 +0000 (21:40 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 26 May 2021 07:38:33 +0000 (09:38 +0200)
0990ae41099d8b9d678f546fc8790033f421711f changed the filter in
selectattr() from 'match' to 'equalto' but due to an incompatibility with
the Jinja2 version for python 2.7 on el7 we must stick to using 'match'
filter.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit d6745e9cd9c2b5f0e20280e4ae0fe1b125287b0c)

infrastructure-playbooks/filestore-to-bluestore.yml

index 2651c867ea49e323140f892e1cfa1838bd7a8aa0..81a27692d63e046bfd2bce43d9a1f560e36d3748 100644 (file)
@@ -49,7 +49,7 @@
       set_fact:
         osd_ids: "{{ osd_ids | default([]) | union(item) }}"
       with_items:
-        - "{{ ((osd_tree.stdout | default('{}') | trim | from_json).nodes | selectattr('name', 'equalto', inventory_hostname) | map(attribute='children') | list) }}"
+        - "{{ ((osd_tree.stdout | default('{}') | trim | from_json).nodes | selectattr('name', 'match', '^' + inventory_hostname + '$') | map(attribute='children') | list) }}"
 
     - name: get osd metadata
       command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} osd metadata osd.{{ item }} -f json"
           set_fact:
             osd_ids: "{{ osd_ids | default([]) + [item] }}"
           with_items:
-            - "{{ ((osd_tree.stdout | default('{}') | from_json).nodes | selectattr('name', 'equalto', inventory_hostname) | map(attribute='children') | list) }}"
+            - "{{ ((osd_tree.stdout | default('{}') | from_json).nodes | selectattr('name', 'match', '^' + inventory_hostname + '$') | map(attribute='children') | list) }}"
 
         - name: purge osd(s) from the cluster
           command: >