summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Moser <mail@renemoser.net>2013-09-18 11:47:39 +0200
committerJames Cammarata <jimi@sngx.net>2013-09-19 10:43:11 -0500
commit936f45d1606a98dba0f8d7ba1de825da8362bbe9 (patch)
tree296c78b1468ffb83169fbb9f728d46ecfa942bd5
parentcac9e02aead564aece043d43a8aee4fa3bfe3faa (diff)
downloadansible-936f45d1606a98dba0f8d7ba1de825da8362bbe9.tar.gz
apt_repository: fix update cache after state=changed. Closes GH-4136
-rw-r--r--library/packaging/apt_repository3
1 files changed, 3 insertions, 0 deletions
diff --git a/library/packaging/apt_repository b/library/packaging/apt_repository
index a61a93b586..5ec6bd4902 100644
--- a/library/packaging/apt_repository
+++ b/library/packaging/apt_repository
@@ -69,6 +69,7 @@ import re
import tempfile
try:
+ import apt
import apt_pkg
import aptsources.distro
distro = aptsources.distro.get_distro()
@@ -365,6 +366,8 @@ def main():
if not module.check_mode and changed:
try:
sourceslist.save(module)
+ cache = apt.Cache()
+ cache.update()
except OSError as err:
module.fail_json(msg=unicode(err))