From 75c91308657a5b091f1e37e1efbd2bae0a421a4a Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Fri, 5 Oct 2018 15:53:40 -0700 Subject: [PATCH] Avoid using tests as filter Fixes the deprecation warning: [DEPRECATION WARNING]: Using tests as filters is deprecated. Instead of using `result|search` use `result is search`. Signed-off-by: Noah Watkins (cherry picked from commit 306e308f133c9b9757d6cae5f88d2c39903cae2f) --- infrastructure-playbooks/rolling_update.yml | 4 +-- ...inerized-to-containerized-ceph-daemons.yml | 32 +++++++++---------- .../ceph-common/tasks/checks/check_system.yml | 4 +-- roles/ceph-common/tasks/release-rhcs.yml | 10 +++--- roles/ceph-defaults/tasks/facts.yml | 6 ++-- roles/ceph-docker-common/tasks/release.yml | 10 +++--- roles/ceph-mds/templates/ceph-mds.service.j2 | 2 +- roles/ceph-mgr/templates/ceph-mgr.service.j2 | 2 +- roles/ceph-mon/tasks/docker/copy_configs.yml | 2 +- roles/ceph-mon/templates/ceph-mon.service.j2 | 2 +- roles/ceph-osd/templates/ceph-osd-run.sh.j2 | 2 +- .../templates/ceph-rbd-mirror.service.j2 | 2 +- .../templates/ceph-radosgw.service.j2 | 2 +- 13 files changed, 40 insertions(+), 40 deletions(-) diff --git a/infrastructure-playbooks/rolling_update.yml b/infrastructure-playbooks/rolling_update.yml index 4abce2aed..f089b2038 100644 --- a/infrastructure-playbooks/rolling_update.yml +++ b/infrastructure-playbooks/rolling_update.yml @@ -398,7 +398,7 @@ delegate_to: "{{ groups[mon_group_name][0] }}" when: - (ceph_versions.get('stdout', '{}')|from_json).get('osd', {}) | length == 1 - - ceph_versions_osd | string | search("ceph version 10") + - ceph_versions_osd | string is search("ceph version 10") - not jewel_minor_update - name: get num_pgs - non container @@ -467,7 +467,7 @@ delegate_to: "{{ groups[mon_group_name][0] }}" when: - (ceph_versions.get('stdout', '{}')|from_json).get('osd', {}) | length == 1 - - ceph_versions_osd | string | search("ceph version 12") + - ceph_versions_osd | string is search("ceph version 12") - not jewel_minor_update diff --git a/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml b/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml index d11ef0693..c8e041a54 100644 --- a/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml +++ b/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml @@ -76,17 +76,17 @@ - name: set_fact ceph_uid for ubuntu set_fact: ceph_uid: 64045 - when: ceph_docker_image_tag | search("ubuntu") + when: ceph_docker_image_tag is search("ubuntu") - name: set_fact ceph_uid for red hat set_fact: ceph_uid: 167 - when: ceph_docker_image_tag | match("latest") or ceph_docker_image_tag | search("centos") or ceph_docker_image_tag | search("fedora") + when: ceph_docker_image_tag is match("latest") or ceph_docker_image_tag is search("centos") or ceph_docker_image_tag is search("fedora") - name: set_fact ceph_uid for rhel set_fact: ceph_uid: 167 - when: ceph_docker_image | search("rhceph") + when: ceph_docker_image is search("rhceph") - name: set proper ownership on ceph directories file: @@ -158,11 +158,11 @@ - set_fact: ceph_uid: 64045 - when: ceph_docker_image_tag | match("latest") or ceph_docker_image_tag | search("ubuntu") + when: ceph_docker_image_tag is match("latest") or ceph_docker_image_tag is search("ubuntu") - set_fact: ceph_uid: 167 - when: ceph_docker_image_tag | search("centos") or ceph_docker_image | search("rhceph") or ceph_docker_image_tag | search("fedora") + when: ceph_docker_image_tag is search("centos") or ceph_docker_image is search("rhceph") or ceph_docker_image_tag is search("fedora") - name: set proper ownership on ceph directories file: @@ -229,17 +229,17 @@ - set_fact: ceph_uid: 64045 - when: ceph_docker_image_tag | match("latest") or ceph_docker_image_tag | search("ubuntu") + when: ceph_docker_image_tag is match("latest") or ceph_docker_image_tag is search("ubuntu") - name: set_fact ceph_uid for red hat set_fact: ceph_uid: 167 - when: ceph_docker_image_tag | match("latest") or ceph_docker_image_tag | search("centos") or ceph_docker_image_tag | search("fedora") + when: ceph_docker_image_tag is match("latest") or ceph_docker_image_tag is search("centos") or ceph_docker_image_tag is search("fedora") - name: set_fact ceph_uid for rhel set_fact: ceph_uid: 167 - when: ceph_docker_image | search("rhceph") + when: ceph_docker_image is search("rhceph") - name: set proper ownership on ceph directories file: @@ -333,11 +333,11 @@ - set_fact: ceph_uid: 64045 - when: ceph_docker_image_tag | match("latest") or ceph_docker_image_tag | search("ubuntu") + when: ceph_docker_image_tag is match("latest") or ceph_docker_image_tag is search("ubuntu") - set_fact: ceph_uid: 167 - when: ceph_docker_image_tag | search("centos") or ceph_docker_image | search("rhceph") or ceph_docker_image_tag | search("fedora") + when: ceph_docker_image_tag is search("centos") or ceph_docker_image is search("rhceph") or ceph_docker_image_tag is search("fedora") - name: set proper ownership on ceph directories file: @@ -375,11 +375,11 @@ - set_fact: ceph_uid: 64045 - when: ceph_docker_image_tag | match("latest") or ceph_docker_image_tag | search("ubuntu") + when: ceph_docker_image_tag is match("latest") or ceph_docker_image_tag is search("ubuntu") - set_fact: ceph_uid: 167 - when: ceph_docker_image_tag | search("centos") or ceph_docker_image | search("rhceph") or ceph_docker_image_tag | search("fedora") + when: ceph_docker_image_tag is search("centos") or ceph_docker_image is search("rhceph") or ceph_docker_image_tag is search("fedora") - name: set proper ownership on ceph directories file: @@ -417,11 +417,11 @@ - set_fact: ceph_uid: 64045 - when: ceph_docker_image_tag | match("latest") or ceph_docker_image_tag | search("ubuntu") + when: ceph_docker_image_tag is match("latest") or ceph_docker_image_tag is search("ubuntu") - set_fact: ceph_uid: 167 - when: ceph_docker_image_tag | search("centos") or ceph_docker_image | search("rhceph") or ceph_docker_image_tag | search("fedora") + when: ceph_docker_image_tag is search("centos") or ceph_docker_image is search("rhceph") or ceph_docker_image_tag is search("fedora") - name: set proper ownership on ceph directories file: @@ -463,11 +463,11 @@ - set_fact: ceph_uid: 64045 - when: ceph_docker_image_tag | match("latest") or ceph_docker_image_tag | search("ubuntu") + when: ceph_docker_image_tag is match("latest") or ceph_docker_image_tag is search("ubuntu") - set_fact: ceph_uid: 167 - when: ceph_docker_image_tag | search("centos") or ceph_docker_image | search("rhceph") or ceph_docker_image_tag | search("fedora") + when: ceph_docker_image_tag is search("centos") or ceph_docker_image is search("rhceph") or ceph_docker_image_tag is search("fedora") - name: set proper ownership on ceph directories file: diff --git a/roles/ceph-common/tasks/checks/check_system.yml b/roles/ceph-common/tasks/checks/check_system.yml index dc39509d8..296bf779c 100644 --- a/roles/ceph-common/tasks/checks/check_system.yml +++ b/roles/ceph-common/tasks/checks/check_system.yml @@ -23,7 +23,7 @@ when: - ansible_distribution == 'Red Hat Enterprise Linux' - ceph_repository == 'rhcs' - - ansible_distribution_version | version_compare('7.3', '<') + - ansible_distribution_version is version_compare('7.3', '<') - name: determine if node is registered with subscription-manager command: subscription-manager identity @@ -57,7 +57,7 @@ msg: "Distribution not supported: {{ ansible_distribution }}" when: - ansible_distribution == 'openSUSE Leap' - - ansible_distribution_version | version_compare('42.3', '<') + - ansible_distribution_version is version_compare('42.3', '<') - name: fail on unsupported ansible version fail: diff --git a/roles/ceph-common/tasks/release-rhcs.yml b/roles/ceph-common/tasks/release-rhcs.yml index 973eb91d9..d0ac6d3a4 100644 --- a/roles/ceph-common/tasks/release-rhcs.yml +++ b/roles/ceph-common/tasks/release-rhcs.yml @@ -3,28 +3,28 @@ set_fact: ceph_release: jewel when: - - ceph_version.split('.')[0] | version_compare('10', '==') + - ceph_version.split('.')[0] is version_compare('10', '==') - name: set_fact ceph_release kraken set_fact: ceph_release: kraken when: - - ceph_version.split('.')[0] | version_compare('11', '==') + - ceph_version.split('.')[0] is version_compare('11', '==') - name: set_fact ceph_release luminous set_fact: ceph_release: luminous when: - - ceph_version.split('.')[0] | version_compare('12', '==') + - ceph_version.split('.')[0] is version_compare('12', '==') - name: set_fact ceph_release mimic set_fact: ceph_release: mimic when: - - ceph_version.split('.')[0] | version_compare('13', '==') + - ceph_version.split('.')[0] is version_compare('13', '==') - name: set_fact ceph_release nautilus set_fact: ceph_release: nautilus when: - - ceph_version.split('.')[0] | version_compare('14', '==') + - ceph_version.split('.')[0] is version_compare('14', '==') diff --git a/roles/ceph-defaults/tasks/facts.yml b/roles/ceph-defaults/tasks/facts.yml index 68919e99c..0992e8db2 100644 --- a/roles/ceph-defaults/tasks/facts.yml +++ b/roles/ceph-defaults/tasks/facts.yml @@ -206,21 +206,21 @@ ceph_uid: 64045 when: - containerized_deployment - - ceph_docker_image_tag | search("ubuntu") + - ceph_docker_image_tag is search("ubuntu") - name: set_fact ceph_uid for red hat based system - container set_fact: ceph_uid: 167 when: - containerized_deployment - - ceph_docker_image_tag | search("latest") or ceph_docker_image_tag | search("centos") or ceph_docker_image_tag | search("fedora") + - ceph_docker_image_tag is search("latest") or ceph_docker_image_tag is search("centos") or ceph_docker_image_tag is search("fedora") - name: set_fact ceph_uid for red hat set_fact: ceph_uid: 167 when: - containerized_deployment - - ceph_docker_image | search("rhceph") + - ceph_docker_image is search("rhceph") - name: set_fact rgw_hostname set_fact: diff --git a/roles/ceph-docker-common/tasks/release.yml b/roles/ceph-docker-common/tasks/release.yml index 973eb91d9..d0ac6d3a4 100644 --- a/roles/ceph-docker-common/tasks/release.yml +++ b/roles/ceph-docker-common/tasks/release.yml @@ -3,28 +3,28 @@ set_fact: ceph_release: jewel when: - - ceph_version.split('.')[0] | version_compare('10', '==') + - ceph_version.split('.')[0] is version_compare('10', '==') - name: set_fact ceph_release kraken set_fact: ceph_release: kraken when: - - ceph_version.split('.')[0] | version_compare('11', '==') + - ceph_version.split('.')[0] is version_compare('11', '==') - name: set_fact ceph_release luminous set_fact: ceph_release: luminous when: - - ceph_version.split('.')[0] | version_compare('12', '==') + - ceph_version.split('.')[0] is version_compare('12', '==') - name: set_fact ceph_release mimic set_fact: ceph_release: mimic when: - - ceph_version.split('.')[0] | version_compare('13', '==') + - ceph_version.split('.')[0] is version_compare('13', '==') - name: set_fact ceph_release nautilus set_fact: ceph_release: nautilus when: - - ceph_version.split('.')[0] | version_compare('14', '==') + - ceph_version.split('.')[0] is version_compare('14', '==') diff --git a/roles/ceph-mds/templates/ceph-mds.service.j2 b/roles/ceph-mds/templates/ceph-mds.service.j2 index 1f6f01164..9e3dcfb5b 100644 --- a/roles/ceph-mds/templates/ceph-mds.service.j2 +++ b/roles/ceph-mds/templates/ceph-mds.service.j2 @@ -8,7 +8,7 @@ ExecStartPre=-/usr/bin/docker stop ceph-mds-{{ ansible_hostname }} ExecStartPre=-/usr/bin/docker rm ceph-mds-{{ ansible_hostname }} ExecStart=/usr/bin/docker run --rm --net=host \ --memory={{ ceph_mds_docker_memory_limit }} \ - {% if ceph_docker_version.split('.')[0] | version_compare('13', '>=') -%} + {% if ceph_docker_version.split('.')[0] is version_compare('13', '>=') -%} --cpus={{ ceph_mds_docker_cpu_limit }} \ {% else -%} --cpu-quota={{ ceph_mds_docker_cpu_limit * 100000 }} \ diff --git a/roles/ceph-mgr/templates/ceph-mgr.service.j2 b/roles/ceph-mgr/templates/ceph-mgr.service.j2 index 5c4ef56b6..766290e25 100644 --- a/roles/ceph-mgr/templates/ceph-mgr.service.j2 +++ b/roles/ceph-mgr/templates/ceph-mgr.service.j2 @@ -8,7 +8,7 @@ ExecStartPre=-/usr/bin/docker stop ceph-mgr-{{ ansible_hostname }} ExecStartPre=-/usr/bin/docker rm ceph-mgr-{{ ansible_hostname }} ExecStart=/usr/bin/docker run --rm --net=host \ --memory={{ ceph_mgr_docker_memory_limit }} \ - {% if ceph_docker_version.split('.')[0] | version_compare('13', '>=') -%} + {% if ceph_docker_version.split('.')[0] is version_compare('13', '>=') -%} --cpus={{ ceph_mgr_docker_cpu_limit }} \ {% else -%} --cpu-quota={{ ceph_mgr_docker_cpu_limit * 100000 }} \ diff --git a/roles/ceph-mon/tasks/docker/copy_configs.yml b/roles/ceph-mon/tasks/docker/copy_configs.yml index b08054414..b7407a2b3 100644 --- a/roles/ceph-mon/tasks/docker/copy_configs.yml +++ b/roles/ceph-mon/tasks/docker/copy_configs.yml @@ -43,4 +43,4 @@ - "{{ statconfig.results }}" when: - item.1.stat.exists == true - - item.0 | search("keyring") + - item.0 is search("keyring") diff --git a/roles/ceph-mon/templates/ceph-mon.service.j2 b/roles/ceph-mon/templates/ceph-mon.service.j2 index 157ab7ca0..cb7645a49 100644 --- a/roles/ceph-mon/templates/ceph-mon.service.j2 +++ b/roles/ceph-mon/templates/ceph-mon.service.j2 @@ -8,7 +8,7 @@ ExecStartPre=-/usr/bin/docker rm ceph-mon-%i ExecStartPre=$(command -v mkdir) -p /etc/ceph /var/lib/ceph/mon ExecStart=/usr/bin/docker run --rm --name ceph-mon-%i \ --memory={{ ceph_mon_docker_memory_limit }} \ -{% if ceph_docker_version.split('.')[0] | version_compare('13', '>=') -%} +{% if ceph_docker_version.split('.')[0] is version_compare('13', '>=') -%} --cpus={{ ceph_mon_docker_cpu_limit }} \ {% else -%} --cpu-quota={{ ceph_mon_docker_cpu_limit * 100000 }} \ diff --git a/roles/ceph-osd/templates/ceph-osd-run.sh.j2 b/roles/ceph-osd/templates/ceph-osd-run.sh.j2 index f91166b31..fc8f0a30b 100644 --- a/roles/ceph-osd/templates/ceph-osd-run.sh.j2 +++ b/roles/ceph-osd/templates/ceph-osd-run.sh.j2 @@ -61,7 +61,7 @@ expose_partitions "$1" --privileged=true \ --pid=host \ --memory={{ ceph_osd_docker_memory_limit }} \ - {% if ceph_docker_version.split('.')[0] | version_compare('13', '>=') -%} + {% if ceph_docker_version.split('.')[0] is version_compare('13', '>=') -%} --cpus={{ ceph_osd_docker_cpu_limit }} \ {% else -%} --cpu-quota={{ ceph_osd_docker_cpu_limit * 100000 }} \ diff --git a/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 b/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 index 4f966b230..cd853f775 100644 --- a/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 +++ b/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 @@ -8,7 +8,7 @@ ExecStartPre=-/usr/bin/docker stop ceph-rbd-mirror-{{ ansible_hostname }} ExecStartPre=-/usr/bin/docker rm ceph-rbd-mirror-{{ ansible_hostname }} ExecStart=/usr/bin/docker run --rm --net=host \ --memory={{ ceph_rbd_mirror_docker_memory_limit }} \ - {% if ceph_docker_version.split('.')[0] | version_compare('13', '>=') -%} + {% if ceph_docker_version.split('.')[0] is version_compare('13', '>=') -%} --cpus={{ ceph_rbd_mirror_docker_cpu_limit }} \ {% else -%} --cpu-quota={{ ceph_rbd_mirror_docker_cpu_limit * 100000 }} \ diff --git a/roles/ceph-rgw/templates/ceph-radosgw.service.j2 b/roles/ceph-rgw/templates/ceph-radosgw.service.j2 index 410e7dffb..98b6344d3 100644 --- a/roles/ceph-rgw/templates/ceph-radosgw.service.j2 +++ b/roles/ceph-rgw/templates/ceph-radosgw.service.j2 @@ -8,7 +8,7 @@ ExecStartPre=-/usr/bin/docker stop ceph-rgw-{{ ansible_hostname }} ExecStartPre=-/usr/bin/docker rm ceph-rgw-{{ ansible_hostname }} ExecStart=/usr/bin/docker run --rm --net=host \ --memory={{ ceph_rgw_docker_memory_limit }} \ - {% if ceph_docker_version.split('.')[0] | version_compare('13', '>=') -%} + {% if ceph_docker_version.split('.')[0] is version_compare('13', '>=') -%} --cpus={{ ceph_rgw_docker_cpu_limit }} \ {% else -%} --cpu-quota={{ ceph_rgw_docker_cpu_limit * 100000 }} \