From d2e3b35c02e37a119029ad10075aa5d5f8911fb4 Mon Sep 17 00:00:00 2001 From: Lance Bragstad Date: Tue, 21 Apr 2020 18:59:36 +0000 Subject: [PATCH] Conditionally decode hosts TripleO was using python2 up to stable/train. This means we can .decode() strings, which we did with hosts for hostnames. With python3, we no longer need to do this and tripleo master is using python3. Instead, we need to detect this case and handle it appropriately. Change-Id: Icc211f5b685ec9df06cd25d6af3b28a5db4df590 --- tripleo_ipa/ansible_plugins/modules/cleanup_ipa_services.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tripleo_ipa/ansible_plugins/modules/cleanup_ipa_services.py b/tripleo_ipa/ansible_plugins/modules/cleanup_ipa_services.py index 9f17301..e54d348 100644 --- a/tripleo_ipa/ansible_plugins/modules/cleanup_ipa_services.py +++ b/tripleo_ipa/ansible_plugins/modules/cleanup_ipa_services.py @@ -346,7 +346,10 @@ def cleanup_ipa_services(keytab, hosts): hosts_to_delete = set() for host in hosts: - hostname = host.decode('UTF-8') + if six.PY3: + hostname = host + else: + hostname = host.decode('UTF-8') if ipa.find_host(hostname): hosts_to_delete.add(hostname)