From 5f4a565febd01dc16b0615fdbb927c5e19bf34e4 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 3 Feb 2022 10:10:23 -0500 Subject: [PATCH] Use python2-compatible apiclient load for el7 diskless --- .../profiles/default/scripts/syncfileclient | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/confluent_osdeploy/el7-diskless/profiles/default/scripts/syncfileclient b/confluent_osdeploy/el7-diskless/profiles/default/scripts/syncfileclient index 3fdd1f08..8d37d43a 100644 --- a/confluent_osdeploy/el7-diskless/profiles/default/scripts/syncfileclient +++ b/confluent_osdeploy/el7-diskless/profiles/default/scripts/syncfileclient @@ -6,11 +6,18 @@ import os import shutil import pwd import grp -from importlib.machinery import SourceFileLoader try: - apiclient = SourceFileLoader('apiclient', '/opt/confluent/bin/apiclient').load_module() -except FileNotFoundError: - apiclient = SourceFileLoader('apiclient', '/etc/confluent/apiclient').load_module() + from importlib.machinery import SourceFileLoader + def load_source(mod, path): + return SourceFileLoader(mod, path).load_module() +except ImportError: + from imp import load_source + +try: + apiclient = load_source('apiclient', '/opt/confluent/bin/apiclient') +except IOError: + apiclient = load_source('apiclient', '/etc/confluent/apiclient') + def partitionhostsline(line):