mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
apt: fix build-dep idempotency (#38999)
This commit is contained in:
parent
4fc5e89e83
commit
62d2df74b0
2 changed files with 29 additions and 1 deletions
|
@ -578,7 +578,12 @@ def install(m, pkgspec, cache, upgrade=False, default_release=None,
|
||||||
else:
|
else:
|
||||||
diff = {}
|
diff = {}
|
||||||
status = True
|
status = True
|
||||||
data = dict(changed=True, stdout=out, stderr=err, diff=diff)
|
|
||||||
|
changed = True
|
||||||
|
if build_dep:
|
||||||
|
changed = APT_GET_ZERO not in out
|
||||||
|
|
||||||
|
data = dict(changed=changed, stdout=out, stderr=err, diff=diff)
|
||||||
if rc:
|
if rc:
|
||||||
status = False
|
status = False
|
||||||
data = dict(msg="'%s' failed: %s" % (cmd, err), stdout=out, stderr=err, rc=rc)
|
data = dict(msg="'%s' failed: %s" % (cmd, err), stdout=out, stderr=err, rc=rc)
|
||||||
|
|
|
@ -213,3 +213,26 @@
|
||||||
with_items:
|
with_items:
|
||||||
- libcaca-dev
|
- libcaca-dev
|
||||||
- libslang2-dev
|
- libslang2-dev
|
||||||
|
|
||||||
|
# https://github.com/ansible/ansible/issues/38995
|
||||||
|
- name: build-dep for a package
|
||||||
|
apt:
|
||||||
|
name: tree
|
||||||
|
state: build-dep
|
||||||
|
register: apt_result
|
||||||
|
|
||||||
|
- name: Check the result
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- apt_result is changed
|
||||||
|
|
||||||
|
- name: build-dep for a package (idempotency)
|
||||||
|
apt:
|
||||||
|
name: tree
|
||||||
|
state: build-dep
|
||||||
|
register: apt_result
|
||||||
|
|
||||||
|
- name: Check the result
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- apt_result is not changed
|
||||||
|
|
Loading…
Add table
Reference in a new issue