From 7f93a5a0f57ccbc07a9430b92bb9585beab1a1a7 Mon Sep 17 00:00:00 2001 From: Erwan Miran Date: Thu, 31 Jan 2019 23:57:22 +0100 Subject: [PATCH] Fix deprecation warnings (#4130) * use not deprecated ansible_play_hosts variable * Using tests as filters is deprecated * Fix deprecation warning about pkg list --- roles/container-engine/docker/tasks/pre-upgrade.yml | 4 ++-- roles/kubernetes/preinstall/tasks/0070-system-packages.yml | 3 +-- tests/testcases/040_check-network-adv.yml | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/roles/container-engine/docker/tasks/pre-upgrade.yml b/roles/container-engine/docker/tasks/pre-upgrade.yml index 07d5f3f59..cf949c4d1 100644 --- a/roles/container-engine/docker/tasks/pre-upgrade.yml +++ b/roles/container-engine/docker/tasks/pre-upgrade.yml @@ -9,7 +9,7 @@ - docker.io when: - ansible_os_family == 'Debian' - - (docker_versioned_pkg[docker_version | string] | search('docker-ce')) + - (docker_versioned_pkg[docker_version | string] is search('docker-ce')) - name: Ensure old versions of Docker are not installed. | RedHat package: @@ -28,5 +28,5 @@ - docker-engine-selinux.noarch when: - ansible_os_family == 'RedHat' - - (docker_versioned_pkg[docker_version | string] | search('docker-ce')) + - (docker_versioned_pkg[docker_version | string] is search('docker-ce')) - not is_atomic diff --git a/roles/kubernetes/preinstall/tasks/0070-system-packages.yml b/roles/kubernetes/preinstall/tasks/0070-system-packages.yml index 62e963613..c8ab5d1c2 100644 --- a/roles/kubernetes/preinstall/tasks/0070-system-packages.yml +++ b/roles/kubernetes/preinstall/tasks/0070-system-packages.yml @@ -88,13 +88,12 @@ - name: Install packages requirements action: module: "{{ ansible_pkg_mgr }}" - name: "{{ item }}" + name: "{{ required_pkgs | default([]) | union(common_required_pkgs|default([])) }}" state: latest register: pkgs_task_result until: pkgs_task_result is succeeded retries: 4 delay: "{{ retry_stagger | random + 3 }}" - with_items: "{{required_pkgs | default([]) | union(common_required_pkgs|default([]))}}" when: not (ansible_os_family in ["CoreOS", "Container Linux by CoreOS", "ClearLinux"] or is_atomic) tags: - bootstrap-os diff --git a/tests/testcases/040_check-network-adv.yml b/tests/testcases/040_check-network-adv.yml index 1dec33d09..503bea325 100644 --- a/tests/testcases/040_check-network-adv.yml +++ b/tests/testcases/040_check-network-adv.yml @@ -37,7 +37,7 @@ run_once: true delegate_to: "{{groups['kube-master'][0]}}" register: nca_pod - until: nca_pod.stdout_lines|length >= groups['k8s-cluster']|intersect(play_hosts)|length * 2 + until: nca_pod.stdout_lines|length >= groups['k8s-cluster']|intersect(ansible_play_hosts)|length * 2 retries: 3 delay: 10 failed_when: false @@ -64,7 +64,7 @@ delay: "{{ agent_report_interval }}" until: agents.content|length > 0 and agents.content[0] == '{' and - agents.content|from_json|length >= groups['k8s-cluster']|intersect(play_hosts)|length * 2 + agents.content|from_json|length >= groups['k8s-cluster']|intersect(ansible_play_hosts)|length * 2 failed_when: false no_log: true