From 91d98bb1a6664ba96d1cdcefa6f1bebe3ec8b4c2 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Thu, 17 Nov 2016 14:04:22 -0800 Subject: [PATCH] Older versions of rhn-client-tools don't understand containment tests. --- lib/ansible/modules/packaging/os/rhn_register.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/packaging/os/rhn_register.py b/lib/ansible/modules/packaging/os/rhn_register.py index 8e9ae4a9f18..ac08fc21c5a 100644 --- a/lib/ansible/modules/packaging/os/rhn_register.py +++ b/lib/ansible/modules/packaging/os/rhn_register.py @@ -161,9 +161,10 @@ class Rhn(RegistrationBase): # configuration. Yeah, I know this should be subclassed ... but, oh # well def get_option_default(self, key, default=''): - # ignore pep8 W601 errors for this line - # setting this to use 'in' does not work in the rhn library - if key in self: + # the class in rhn-client-tools that this comes from didn't + # implement __contains__(). That's why we check if the key is + # present in the dictionary that is the actual storage + if key in self.dict: return self[key] else: return default