From 4ec8599c3801e4737fddcca9b1d034885404a9c1 Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Tue, 16 Apr 2019 17:42:53 +0200 Subject: [PATCH] apt: remove deprecated installed/removed aliases (#55338) * apt: remove deprecated installed/removed aliases Fixes #55311 --- .../55311-apt-remove-installed-removed-aliases.yaml | 2 ++ lib/ansible/modules/packaging/os/apt.py | 10 +--------- test/integration/targets/apt/tasks/repo.yml | 4 ++-- test/integration/targets/iso_extract/tasks/7zip.yml | 2 +- .../targets/prepare_ovs_tests/tasks/main.yml | 2 +- test/sanity/validate-modules/ignore.txt | 1 - 6 files changed, 7 insertions(+), 14 deletions(-) create mode 100644 changelogs/fragments/55311-apt-remove-installed-removed-aliases.yaml diff --git a/changelogs/fragments/55311-apt-remove-installed-removed-aliases.yaml b/changelogs/fragments/55311-apt-remove-installed-removed-aliases.yaml new file mode 100644 index 00000000000..197e7e8642e --- /dev/null +++ b/changelogs/fragments/55311-apt-remove-installed-removed-aliases.yaml @@ -0,0 +1,2 @@ +minor_changes: + - apt - Remove deprecated ``installed`` and ``removed`` aliases (https://github.com/ansible/ansible/issues/55311) diff --git a/lib/ansible/modules/packaging/os/apt.py b/lib/ansible/modules/packaging/os/apt.py index a188245d135..3f488fcb2a8 100644 --- a/lib/ansible/modules/packaging/os/apt.py +++ b/lib/ansible/modules/packaging/os/apt.py @@ -1003,7 +1003,7 @@ def get_cache(module): def main(): module = AnsibleModule( argument_spec=dict( - state=dict(type='str', default='present', choices=['absent', 'build-dep', 'installed', 'latest', 'present', 'removed', 'present', 'fixed']), + state=dict(type='str', default='present', choices=['absent', 'build-dep', 'fixed', 'latest', 'present']), update_cache=dict(type='bool', aliases=['update-cache']), cache_valid_time=dict(type='int', default=0), purge=dict(type='bool', default=False), @@ -1068,14 +1068,6 @@ def main(): autoremove = p['autoremove'] autoclean = p['autoclean'] - # Deal with deprecated aliases - if p['state'] == 'installed': - module.deprecate("State 'installed' is deprecated. Using state 'present' instead.", version="2.9") - p['state'] = 'present' - if p['state'] == 'removed': - module.deprecate("State 'removed' is deprecated. Using state 'absent' instead.", version="2.9") - p['state'] = 'absent' - # Get the cache object cache = get_cache(module) diff --git a/test/integration/targets/apt/tasks/repo.yml b/test/integration/targets/apt/tasks/repo.yml index 0288a07c7cb..f568be9ffce 100644 --- a/test/integration/targets/apt/tasks/repo.yml +++ b/test/integration/targets/apt/tasks/repo.yml @@ -46,7 +46,7 @@ - name: Fail to install foo=1.0.1 since foo is not installed and only_upgrade is set apt: name: foo=1.0.1 - state: installed + state: present only_upgrade: yes allow_unauthenticated: yes ignore_errors: yes @@ -64,7 +64,7 @@ - name: Upgrade foo to 1.0.1 apt: name: foo=1.0.1 - state: installed + state: present only_upgrade: yes allow_unauthenticated: yes register: apt_result diff --git a/test/integration/targets/iso_extract/tasks/7zip.yml b/test/integration/targets/iso_extract/tasks/7zip.yml index 266088e639a..4642f6e05a1 100644 --- a/test/integration/targets/iso_extract/tasks/7zip.yml +++ b/test/integration/targets/iso_extract/tasks/7zip.yml @@ -55,7 +55,7 @@ - name: Install 7zip package if we are on Ubuntu apt: name: p7zip-full - state: installed + state: present update_cache: yes become: yes when: ansible_distribution in ['Ubuntu'] diff --git a/test/integration/targets/prepare_ovs_tests/tasks/main.yml b/test/integration/targets/prepare_ovs_tests/tasks/main.yml index e29042e050c..23e22f537b4 100644 --- a/test/integration/targets/prepare_ovs_tests/tasks/main.yml +++ b/test/integration/targets/prepare_ovs_tests/tasks/main.yml @@ -23,7 +23,7 @@ - name: Install openvswitch-switch package if we are on Ubuntu apt: name: openvswitch-switch - state: installed + state: present update_cache: yes become: yes when: ansible_distribution == 'Ubuntu' diff --git a/test/sanity/validate-modules/ignore.txt b/test/sanity/validate-modules/ignore.txt index 4db0dc83f35..56a35ad1eea 100644 --- a/test/sanity/validate-modules/ignore.txt +++ b/test/sanity/validate-modules/ignore.txt @@ -652,7 +652,6 @@ lib/ansible/modules/packaging/language/pip.py E324 lib/ansible/modules/packaging/os/apk.py E326 lib/ansible/modules/packaging/os/apt.py E322 lib/ansible/modules/packaging/os/apt.py E324 -lib/ansible/modules/packaging/os/apt.py E326 lib/ansible/modules/packaging/os/apt.py E336 lib/ansible/modules/packaging/os/apt_key.py E322 lib/ansible/modules/packaging/os/apt_repository.py E322