1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

apt: remove deprecated installed/removed aliases (#55338)

* apt: remove deprecated installed/removed aliases

Fixes #55311
This commit is contained in:
Martin Krizek 2019-04-16 17:42:53 +02:00 committed by Sloane Hertel
parent 9495ddbc21
commit 4ec8599c38
6 changed files with 7 additions and 14 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- apt - Remove deprecated ``installed`` and ``removed`` aliases (https://github.com/ansible/ansible/issues/55311)

View file

@ -1003,7 +1003,7 @@ def get_cache(module):
def main(): def main():
module = AnsibleModule( module = AnsibleModule(
argument_spec=dict( 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']), update_cache=dict(type='bool', aliases=['update-cache']),
cache_valid_time=dict(type='int', default=0), cache_valid_time=dict(type='int', default=0),
purge=dict(type='bool', default=False), purge=dict(type='bool', default=False),
@ -1068,14 +1068,6 @@ def main():
autoremove = p['autoremove'] autoremove = p['autoremove']
autoclean = p['autoclean'] 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 # Get the cache object
cache = get_cache(module) cache = get_cache(module)

View file

@ -46,7 +46,7 @@
- name: Fail to install foo=1.0.1 since foo is not installed and only_upgrade is set - name: Fail to install foo=1.0.1 since foo is not installed and only_upgrade is set
apt: apt:
name: foo=1.0.1 name: foo=1.0.1
state: installed state: present
only_upgrade: yes only_upgrade: yes
allow_unauthenticated: yes allow_unauthenticated: yes
ignore_errors: yes ignore_errors: yes
@ -64,7 +64,7 @@
- name: Upgrade foo to 1.0.1 - name: Upgrade foo to 1.0.1
apt: apt:
name: foo=1.0.1 name: foo=1.0.1
state: installed state: present
only_upgrade: yes only_upgrade: yes
allow_unauthenticated: yes allow_unauthenticated: yes
register: apt_result register: apt_result

View file

@ -55,7 +55,7 @@
- name: Install 7zip package if we are on Ubuntu - name: Install 7zip package if we are on Ubuntu
apt: apt:
name: p7zip-full name: p7zip-full
state: installed state: present
update_cache: yes update_cache: yes
become: yes become: yes
when: ansible_distribution in ['Ubuntu'] when: ansible_distribution in ['Ubuntu']

View file

@ -23,7 +23,7 @@
- name: Install openvswitch-switch package if we are on Ubuntu - name: Install openvswitch-switch package if we are on Ubuntu
apt: apt:
name: openvswitch-switch name: openvswitch-switch
state: installed state: present
update_cache: yes update_cache: yes
become: yes become: yes
when: ansible_distribution == 'Ubuntu' when: ansible_distribution == 'Ubuntu'

View file

@ -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/apk.py E326
lib/ansible/modules/packaging/os/apt.py E322 lib/ansible/modules/packaging/os/apt.py E322
lib/ansible/modules/packaging/os/apt.py E324 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.py E336
lib/ansible/modules/packaging/os/apt_key.py E322 lib/ansible/modules/packaging/os/apt_key.py E322
lib/ansible/modules/packaging/os/apt_repository.py E322 lib/ansible/modules/packaging/os/apt_repository.py E322