From 8f02819db02459ed144e131db3808dee0a7356db Mon Sep 17 00:00:00 2001 From: Amin Vakil Date: Tue, 29 Sep 2020 19:05:59 +0330 Subject: [PATCH] Replace deprectated include with {import,include}_tasks in apt{,_repository,_key} integration tests (#71964) * Replace deprectated include with import_tasks * Fix --- test/integration/targets/apt/tasks/main.yml | 10 +++++----- test/integration/targets/apt/tasks/repo.yml | 18 +++++++++++++++--- .../integration/targets/apt_key/tasks/main.yml | 4 ++-- .../targets/apt_repository/tasks/apt.yml | 12 ++++++------ .../targets/apt_repository/tasks/main.yml | 6 +++--- .../targets/apt_repository/tasks/mode.yaml | 14 +++++++------- 6 files changed, 38 insertions(+), 26 deletions(-) diff --git a/test/integration/targets/apt/tasks/main.yml b/test/integration/targets/apt/tasks/main.yml index 1ecd8a63d7c..13d3e4f41fa 100644 --- a/test/integration/targets/apt/tasks/main.yml +++ b/test/integration/targets/apt/tasks/main.yml @@ -16,18 +16,18 @@ # along with Ansible. If not, see . - block: - - include: 'apt.yml' + - import_tasks: 'apt.yml' - - include: 'url-with-deps.yml' + - import_tasks: 'url-with-deps.yml' - - include: 'apt-multiarch.yml' + - import_tasks: 'apt-multiarch.yml' when: - ansible_userspace_architecture != apt_foreign_arch - - include: 'apt-builddep.yml' + - import_tasks: 'apt-builddep.yml' - block: - - include: 'repo.yml' + - import_tasks: 'repo.yml' always: - file: path: /etc/apt/sources.list.d/file_tmp_repo.list diff --git a/test/integration/targets/apt/tasks/repo.yml b/test/integration/targets/apt/tasks/repo.yml index f568be9ffce..e1863f38b6e 100644 --- a/test/integration/targets/apt/tasks/repo.yml +++ b/test/integration/targets/apt/tasks/repo.yml @@ -213,7 +213,11 @@ - name: Upgrades block: - - include: "upgrade.yml aptitude_present={{ True | bool }} upgrade_type=dist force_apt_get={{ False | bool }}" + - import_tasks: "upgrade.yml" + vars: + aptitude_present: "{{ True | bool }}" + upgrade_type: "dist" + force_apt_get: "{{ False | bool }}" - name: Check if aptitude is installed command: dpkg-query --show --showformat='${db:Status-Abbrev}' aptitude @@ -226,7 +230,11 @@ when: - aptitude_status.stdout.find('ii') != -1 - - include: "upgrade.yml aptitude_present={{ False | bool }} upgrade_type={{ item.upgrade_type }} force_apt_get={{ item.force_apt_get }}" + - include_tasks: "upgrade.yml" + vars: + aptitude_present: "{{ False | bool }}" + upgrade_type: "{{ item.upgrade_type }}" + force_apt_get: "{{ item.force_apt_get }}" with_items: - { upgrade_type: safe, force_apt_get: False } - { upgrade_type: full, force_apt_get: False } @@ -238,7 +246,11 @@ pkg: aptitude state: present - - include: "upgrade.yml aptitude_present={{ True | bool }} upgrade_type={{ item.upgrade_type }} force_apt_get={{ item.force_apt_get }}" + - include_tasks: "upgrade.yml" + vars: + aptitude_present: "{{ True | bool }}" + upgrade_type: "{{ item.upgrade_type }}" + force_apt_get: "{{ item.force_apt_get }}" with_items: - { upgrade_type: safe, force_apt_get: False } - { upgrade_type: full, force_apt_get: False } diff --git a/test/integration/targets/apt_key/tasks/main.yml b/test/integration/targets/apt_key/tasks/main.yml index 2a6e19e486d..acafd3edda3 100644 --- a/test/integration/targets/apt_key/tasks/main.yml +++ b/test/integration/targets/apt_key/tasks/main.yml @@ -24,8 +24,8 @@ - name: create our testing sub-directory file: path="{{ output_dir_test }}" state=directory -- include: 'apt_key.yml' +- import_tasks: 'apt_key.yml' when: ansible_distribution in ('Ubuntu', 'Debian') -- include: 'file.yml' +- import_tasks: 'file.yml' when: ansible_distribution in ('Ubuntu', 'Debian') diff --git a/test/integration/targets/apt_repository/tasks/apt.yml b/test/integration/targets/apt_repository/tasks/apt.yml index 941335f2c6b..eca103ca6d9 100644 --- a/test/integration/targets/apt_repository/tasks/apt.yml +++ b/test/integration/targets/apt_repository/tasks/apt.yml @@ -35,7 +35,7 @@ # # TEST: apt_repository: repo= # -- include: 'cleanup.yml' +- import_tasks: 'cleanup.yml' - name: 'record apt cache mtime' stat: path='/var/cache/apt/pkgcache.bin' @@ -67,7 +67,7 @@ # # TEST: apt_repository: repo= update_cache=no # -- include: 'cleanup.yml' +- import_tasks: 'cleanup.yml' - name: 'record apt cache mtime' stat: path='/var/cache/apt/pkgcache.bin' @@ -98,7 +98,7 @@ # # TEST: apt_repository: repo= update_cache=yes # -- include: 'cleanup.yml' +- import_tasks: 'cleanup.yml' - name: 'record apt cache mtime' stat: path='/var/cache/apt/pkgcache.bin' @@ -129,7 +129,7 @@ # # TEST: apt_repository: repo= # -- include: 'cleanup.yml' +- import_tasks: 'cleanup.yml' - name: 'record apt cache mtime' stat: path='/var/cache/apt/pkgcache.bin' @@ -164,7 +164,7 @@ # # TEST: apt_repository: repo= filename= # -- include: 'cleanup.yml' +- import_tasks: 'cleanup.yml' - name: 'record apt cache mtime' stat: path='/var/cache/apt/pkgcache.bin' @@ -230,4 +230,4 @@ # # TEARDOWN # -- include: 'cleanup.yml' +- import_tasks: 'cleanup.yml' diff --git a/test/integration/targets/apt_repository/tasks/main.yml b/test/integration/targets/apt_repository/tasks/main.yml index 4101011260a..5d72f6f1114 100644 --- a/test/integration/targets/apt_repository/tasks/main.yml +++ b/test/integration/targets/apt_repository/tasks/main.yml @@ -16,10 +16,10 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . -- include: 'apt.yml' +- import_tasks: 'apt.yml' when: ansible_distribution in ('Ubuntu') -- include: mode.yaml +- import_tasks: mode.yaml when: ansible_distribution in ('Ubuntu') tags: - - test_apt_repository_mode \ No newline at end of file + - test_apt_repository_mode diff --git a/test/integration/targets/apt_repository/tasks/mode.yaml b/test/integration/targets/apt_repository/tasks/mode.yaml index d9895368a3f..f363fd8fa93 100644 --- a/test/integration/targets/apt_repository/tasks/mode.yaml +++ b/test/integration/targets/apt_repository/tasks/mode.yaml @@ -8,7 +8,7 @@ test_repo_spec: "deb http://apt.postgresql.org/pub/repos/apt/ {{ ansible_distribution_release }}-pgdg main" test_repo_path: /etc/apt/sources.list.d/apt_postgresql_org_pub_repos_apt.list -- include: mode_cleanup.yaml +- import_tasks: mode_cleanup.yaml - name: Add GPG key to verify signatures apt_key: @@ -31,7 +31,7 @@ debug: var: mode_given_yaml_literal_0600 -- include: mode_cleanup.yaml +- import_tasks: mode_cleanup.yaml - name: Assert mode_given_yaml_literal_0600 is correct assert: @@ -52,7 +52,7 @@ debug: var: no_mode_stat -- include: mode_cleanup.yaml +- import_tasks: mode_cleanup.yaml - name: Assert no_mode_stat is correct assert: @@ -74,7 +74,7 @@ debug: var: mode_given_string_stat -- include: mode_cleanup.yaml +- import_tasks: mode_cleanup.yaml - name: Mode specified as string 600 apt_repository: @@ -92,7 +92,7 @@ debug: var: mode_given_string_600_stat -- include: mode_cleanup.yaml +- import_tasks: mode_cleanup.yaml - name: Assert mode is correct assert: @@ -114,7 +114,7 @@ debug: var: mode_given_yaml_literal_600 -- include: mode_cleanup.yaml +- import_tasks: mode_cleanup.yaml # a literal 600 as the mode will fail currently, in the sense that it # doesn't guess and consider 600 and 0600 to be the same, and will instead @@ -127,4 +127,4 @@ # See https://github.com/ansible/ansible/issues/16370 - name: Assert mode_given_yaml_literal_600 is correct assert: - that: "mode_given_yaml_literal_600.stat.mode == '1130'" \ No newline at end of file + that: "mode_given_yaml_literal_600.stat.mode == '1130'"