From d9314192d02ee690761fcb27d5a9855816199ae9 Mon Sep 17 00:00:00 2001 From: IceEyz Date: Tue, 31 Oct 2023 11:58:56 +0100 Subject: [PATCH] Fix: apache2_mod_proxy python3 / BeautifulSoup4 support Fixes #4167 --- plugins/modules/apache2_mod_proxy.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/modules/apache2_mod_proxy.py b/plugins/modules/apache2_mod_proxy.py index 8f561e8ae06..efc6945c01e 100644 --- a/plugins/modules/apache2_mod_proxy.py +++ b/plugins/modules/apache2_mod_proxy.py @@ -212,7 +212,7 @@ BEAUTIFUL_SOUP_IMP_ERR = None try: - from BeautifulSoup import BeautifulSoup + from bs4 import BeautifulSoup except ImportError: BEAUTIFUL_SOUP_IMP_ERR = traceback.format_exc() HAS_BEAUTIFULSOUP = False @@ -272,11 +272,11 @@ def get_member_attributes(self): except TypeError as exc: self.module.fail_json(msg="Cannot parse balancer_member_page HTML! " + str(exc)) else: - subsoup = soup.findAll('table')[1].findAll('tr') - keys = subsoup[0].findAll('th') + subsoup = soup.find_all('table')[1].find_all('tr') + keys = subsoup[0].find_all('th') for valuesset in subsoup[1::1]: if re.search(pattern=self.host, string=str(valuesset)): - values = valuesset.findAll('td') + values = valuesset.find_all('td') return dict((keys[x].string, values[x].string) for x in range(0, len(keys))) def get_member_status(self): @@ -345,7 +345,7 @@ def get_balancer_members(self): except TypeError: self.module.fail_json(msg="Cannot parse balancer page HTML! " + str(self.page)) else: - for element in soup.findAll('a')[1::1]: + for element in soup.find_all('a')[1::1]: balancer_member_suffix = str(element.get('href')) if not balancer_member_suffix: self.module.fail_json(msg="Argument 'balancer_member_suffix' is empty!")