Skip to content

Commit

Permalink
Fix: apache2_mod_proxy python3 / BeautifulSoup4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
IceEyz authored Oct 31, 2023
1 parent 2a7f9f2 commit d931419
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions plugins/modules/apache2_mod_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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!")
Expand Down

0 comments on commit d931419

Please sign in to comment.