From a85d9930c592191bcf432736094b950cc0852579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Moser?= Date: Wed, 1 Jun 2016 22:43:34 +0200 Subject: [PATCH] apt: fix KeyError for deb=file (#3816) Fix KeyError: 'prepared' while installing dependencies using deb=.deb This error shows up when --diff was not passed by and the deb files has dependencies not yet installed. Closes #3752. --- lib/ansible/modules/packaging/os/apt.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/packaging/os/apt.py b/lib/ansible/modules/packaging/os/apt.py index 1c388b413cd..aaed23831a1 100644 --- a/lib/ansible/modules/packaging/os/apt.py +++ b/lib/ansible/modules/packaging/os/apt.py @@ -535,7 +535,8 @@ def install_deb(m, debs, cache, force, install_recommends, allow_unauthenticated stdout = out if "diff" in retvals: diff = retvals["diff"] - diff["prepared"] += '\n\n' + out + if 'prepared' in diff: + diff['prepared'] += '\n\n' + out else: diff = out if "stderr" in retvals: