From d4a424e51e4cce0e3a5a4618f696800ebe655d25 Mon Sep 17 00:00:00 2001 From: Steve Milner Date: Mon, 20 Feb 2017 10:35:45 -0500 Subject: Replace has_key in new modules The dict.has_key has been removed in Python 3. However, both Python 2 and 3 support: if needle in dict --- roles/lib_openshift/src/class/oc_secret.py | 2 +- roles/lib_openshift/src/lib/secret.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'roles/lib_openshift/src') diff --git a/roles/lib_openshift/src/class/oc_secret.py b/roles/lib_openshift/src/class/oc_secret.py index 5eac27572..deb36a9fa 100644 --- a/roles/lib_openshift/src/class/oc_secret.py +++ b/roles/lib_openshift/src/class/oc_secret.py @@ -29,7 +29,7 @@ class OCSecret(OpenShiftCLI): if results['returncode'] == 0 and results['results'][0]: results['exists'] = True if self.decode: - if results['results'][0].has_key('data'): + if 'data' in results['results'][0]: for sname, value in results['results'][0]['data'].items(): results['decoded'][sname] = base64.b64decode(value) diff --git a/roles/lib_openshift/src/lib/secret.py b/roles/lib_openshift/src/lib/secret.py index 39bf3c33a..1ba78ddd5 100644 --- a/roles/lib_openshift/src/lib/secret.py +++ b/roles/lib_openshift/src/lib/secret.py @@ -91,7 +91,7 @@ class Secret(Yedit): def update_secret(self, key, value): ''' update a secret''' # pylint: disable=no-member - if self.secrets.has_key(key): + if key in self.secrets: self.secrets[key] = value else: self.add_secret(key, value) -- cgit v1.2.3