From 7b66bdc1c437cca6512edece9e8659bf805ffba0 Mon Sep 17 00:00:00 2001 From: Evan Date: Wed, 10 Aug 2016 17:45:54 -0400 Subject: [PATCH] pip: Fix uninitialized variable during check_mode (#4379) During check_mode (`--check`), the variable change could be used uninitialized, yielding this error: `UnboundLocalError: local variable 'changed' referenced before assignment` This changeset simply initializes it to False. --- lib/ansible/modules/packaging/language/pip.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ansible/modules/packaging/language/pip.py b/lib/ansible/modules/packaging/language/pip.py index d7f832f0924..466c7ea8875 100755 --- a/lib/ansible/modules/packaging/language/pip.py +++ b/lib/ansible/modules/packaging/language/pip.py @@ -410,6 +410,7 @@ def main(): out += out_pip err += err_pip + changed = False if name: for pkg in name: is_present = _is_present(pkg, version, out.split())