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

* Replace deprectated include with import_tasks

* Fix
pull/72013/head
Amin Vakil 5 years ago committed by GitHub
parent 91a153434a
commit 8f02819db0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -16,18 +16,18 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
- block: - 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: when:
- ansible_userspace_architecture != apt_foreign_arch - ansible_userspace_architecture != apt_foreign_arch
- include: 'apt-builddep.yml' - import_tasks: 'apt-builddep.yml'
- block: - block:
- include: 'repo.yml' - import_tasks: 'repo.yml'
always: always:
- file: - file:
path: /etc/apt/sources.list.d/file_tmp_repo.list path: /etc/apt/sources.list.d/file_tmp_repo.list

@ -213,7 +213,11 @@
- name: Upgrades - name: Upgrades
block: 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 - name: Check if aptitude is installed
command: dpkg-query --show --showformat='${db:Status-Abbrev}' aptitude command: dpkg-query --show --showformat='${db:Status-Abbrev}' aptitude
@ -226,7 +230,11 @@
when: when:
- aptitude_status.stdout.find('ii') != -1 - 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: with_items:
- { upgrade_type: safe, force_apt_get: False } - { upgrade_type: safe, force_apt_get: False }
- { upgrade_type: full, force_apt_get: False } - { upgrade_type: full, force_apt_get: False }
@ -238,7 +246,11 @@
pkg: aptitude pkg: aptitude
state: present 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: with_items:
- { upgrade_type: safe, force_apt_get: False } - { upgrade_type: safe, force_apt_get: False }
- { upgrade_type: full, force_apt_get: False } - { upgrade_type: full, force_apt_get: False }

@ -24,8 +24,8 @@
- name: create our testing sub-directory - name: create our testing sub-directory
file: path="{{ output_dir_test }}" state=directory file: path="{{ output_dir_test }}" state=directory
- include: 'apt_key.yml' - import_tasks: 'apt_key.yml'
when: ansible_distribution in ('Ubuntu', 'Debian') when: ansible_distribution in ('Ubuntu', 'Debian')
- include: 'file.yml' - import_tasks: 'file.yml'
when: ansible_distribution in ('Ubuntu', 'Debian') when: ansible_distribution in ('Ubuntu', 'Debian')

@ -35,7 +35,7 @@
# #
# TEST: apt_repository: repo=<name> # TEST: apt_repository: repo=<name>
# #
- include: 'cleanup.yml' - import_tasks: 'cleanup.yml'
- name: 'record apt cache mtime' - name: 'record apt cache mtime'
stat: path='/var/cache/apt/pkgcache.bin' stat: path='/var/cache/apt/pkgcache.bin'
@ -67,7 +67,7 @@
# #
# TEST: apt_repository: repo=<name> update_cache=no # TEST: apt_repository: repo=<name> update_cache=no
# #
- include: 'cleanup.yml' - import_tasks: 'cleanup.yml'
- name: 'record apt cache mtime' - name: 'record apt cache mtime'
stat: path='/var/cache/apt/pkgcache.bin' stat: path='/var/cache/apt/pkgcache.bin'
@ -98,7 +98,7 @@
# #
# TEST: apt_repository: repo=<name> update_cache=yes # TEST: apt_repository: repo=<name> update_cache=yes
# #
- include: 'cleanup.yml' - import_tasks: 'cleanup.yml'
- name: 'record apt cache mtime' - name: 'record apt cache mtime'
stat: path='/var/cache/apt/pkgcache.bin' stat: path='/var/cache/apt/pkgcache.bin'
@ -129,7 +129,7 @@
# #
# TEST: apt_repository: repo=<spec> # TEST: apt_repository: repo=<spec>
# #
- include: 'cleanup.yml' - import_tasks: 'cleanup.yml'
- name: 'record apt cache mtime' - name: 'record apt cache mtime'
stat: path='/var/cache/apt/pkgcache.bin' stat: path='/var/cache/apt/pkgcache.bin'
@ -164,7 +164,7 @@
# #
# TEST: apt_repository: repo=<spec> filename=<filename> # TEST: apt_repository: repo=<spec> filename=<filename>
# #
- include: 'cleanup.yml' - import_tasks: 'cleanup.yml'
- name: 'record apt cache mtime' - name: 'record apt cache mtime'
stat: path='/var/cache/apt/pkgcache.bin' stat: path='/var/cache/apt/pkgcache.bin'
@ -230,4 +230,4 @@
# #
# TEARDOWN # TEARDOWN
# #
- include: 'cleanup.yml' - import_tasks: 'cleanup.yml'

@ -16,10 +16,10 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
- include: 'apt.yml' - import_tasks: 'apt.yml'
when: ansible_distribution in ('Ubuntu') when: ansible_distribution in ('Ubuntu')
- include: mode.yaml - import_tasks: mode.yaml
when: ansible_distribution in ('Ubuntu') when: ansible_distribution in ('Ubuntu')
tags: tags:
- test_apt_repository_mode - test_apt_repository_mode

@ -8,7 +8,7 @@
test_repo_spec: "deb http://apt.postgresql.org/pub/repos/apt/ {{ ansible_distribution_release }}-pgdg main" 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 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 - name: Add GPG key to verify signatures
apt_key: apt_key:
@ -31,7 +31,7 @@
debug: debug:
var: mode_given_yaml_literal_0600 var: mode_given_yaml_literal_0600
- include: mode_cleanup.yaml - import_tasks: mode_cleanup.yaml
- name: Assert mode_given_yaml_literal_0600 is correct - name: Assert mode_given_yaml_literal_0600 is correct
assert: assert:
@ -52,7 +52,7 @@
debug: debug:
var: no_mode_stat var: no_mode_stat
- include: mode_cleanup.yaml - import_tasks: mode_cleanup.yaml
- name: Assert no_mode_stat is correct - name: Assert no_mode_stat is correct
assert: assert:
@ -74,7 +74,7 @@
debug: debug:
var: mode_given_string_stat var: mode_given_string_stat
- include: mode_cleanup.yaml - import_tasks: mode_cleanup.yaml
- name: Mode specified as string 600 - name: Mode specified as string 600
apt_repository: apt_repository:
@ -92,7 +92,7 @@
debug: debug:
var: mode_given_string_600_stat var: mode_given_string_600_stat
- include: mode_cleanup.yaml - import_tasks: mode_cleanup.yaml
- name: Assert mode is correct - name: Assert mode is correct
assert: assert:
@ -114,7 +114,7 @@
debug: debug:
var: mode_given_yaml_literal_600 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 # 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 # 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 # See https://github.com/ansible/ansible/issues/16370
- name: Assert mode_given_yaml_literal_600 is correct - name: Assert mode_given_yaml_literal_600 is correct
assert: assert:
that: "mode_given_yaml_literal_600.stat.mode == '1130'" that: "mode_given_yaml_literal_600.stat.mode == '1130'"

Loading…
Cancel
Save