Update apt.py

This change references the suggested workaround in #25414
This commit is contained in:
Jon "The Nice Guy" Spriggs 2020-12-30 00:24:35 +00:00 committed by GitHub
parent 42bc03f0f5
commit 1e1b8e7aca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -268,6 +268,21 @@ EXAMPLES = '''
apt: apt:
autoremove: yes autoremove: yes
# A common issue, particularly during early boot or at specific clock times
# is that apt will be locked by another process, perhaps trying to autoupdate
# or just a race condition on a thread. This work-around (which can also be
# applied to any of the above statements) ensures that if there is a lock file
# engaged, which is trapped by the `msg` value, triggers a repeat until the
# lock file is released.
- name: Install packages only when the apt process isn't locked
apt:
name: foo
state: present
register: apt_action
retries: 100
until: apt_action is success or ('Failed to lock apt for exclusive operation' not in apt_action.msg and '/var/lib/dpkg/lock' not in apt_action.msg)
''' '''
RETURN = ''' RETURN = '''