Skip to content

Commit

Permalink
use raise_from()
Browse files Browse the repository at this point in the history
  • Loading branch information
russoz committed Jan 23, 2025
1 parent cda5f28 commit 6124e55
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions plugins/modules/apache2_mod_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@
from ansible_collections.community.general.plugins.module_utils import deps
from ansible_collections.community.general.plugins.module_utils.module_helper import ModuleHelper, ModuleHelperException

from ansible.module_utils.six import raise_from
from ansible.module_utils.urls import fetch_url

with deps.declare("BeautifulSoup"):
Expand Down Expand Up @@ -263,7 +264,7 @@ def get_member_attributes(self):
try:
soup = BeautifulSoup(response)
except TypeError as exc:
raise ModuleHelperException("Cannot parse balancer_member_page HTML! {0}".format(exc))
raise_from(ModuleHelperException("Cannot parse balancer_member_page HTML! {0}".format(exc)), exc)

subsoup = soup.findAll('table')[1].findAll('tr')
keys = subsoup[0].findAll('th')
Expand Down Expand Up @@ -342,8 +343,8 @@ def get_balancer_members(self):
""" Returns members of the balancer as a generator object for later iteration."""
try:
soup = BeautifulSoup(self.page)
except TypeError:
raise ModuleHelperException("Cannot parse balancer page HTML! {0}".format(self.page))
except TypeError as e:
raise_from(ModuleHelperException("Cannot parse balancer page HTML! {0}".format(self.page)), e)

for element in soup.findAll('a')[1::1]:
balancer_member_suffix = element.get('href')
Expand Down

0 comments on commit 6124e55

Please sign in to comment.