From 09b0871f17099d7d99170d1a3d0f6dac9d197ef1 Mon Sep 17 00:00:00 2001
From: Patrik Lundin <patrik@sigterm.se>
Date: Thu, 30 Jun 2016 17:30:28 +0200
Subject: [PATCH] Add a break and extra debug log for clarity.

---
 lib/ansible/modules/extras/packaging/os/openbsd_pkg.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/ansible/modules/extras/packaging/os/openbsd_pkg.py b/lib/ansible/modules/extras/packaging/os/openbsd_pkg.py
index 305b7c0645..2e31d16b42 100644
--- a/lib/ansible/modules/extras/packaging/os/openbsd_pkg.py
+++ b/lib/ansible/modules/extras/packaging/os/openbsd_pkg.py
@@ -229,10 +229,12 @@ def package_latest(name, installed_state, pkg_spec, module):
             module.debug("package_latest(): checking for pre-upgrade package name: %s" % installed_name)
             match = re.search("\W%s->.+: ok\W" % installed_name, stdout)
             if match:
+                module.debug("package_latest(): package name match: %s" % installed_name)
                 if module.check_mode:
                     module.exit_json(changed=True)
 
                 changed = True
+                break
 
         # FIXME: This part is problematic. Based on the issues mentioned (and
         # handled) in package_present() it is not safe to blindly trust stderr