Replace deprectated include with {import,include}_tasks in apt{,_repository,_key} integration tests (#71964)

* Replace deprectated include with import_tasks

* Fix
This commit is contained in:
Amin Vakil 2020-09-29 19:05:59 +03:30 committed by GitHub
parent 91a153434a
commit 8f02819db0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 26 deletions

View file

@ -16,18 +16,18 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
- 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

View file

@ -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 }

View file

@ -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')

View file

@ -35,7 +35,7 @@
#
# TEST: apt_repository: repo=<name>
#
- 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=<name> 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=<name> 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=<spec>
#
- 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=<spec> filename=<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'

View file

@ -16,10 +16,10 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
- 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
- test_apt_repository_mode

View file

@ -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'"
that: "mode_given_yaml_literal_600.stat.mode == '1130'"