Skip to content

Commit

Permalink
sanity & QA
Browse files Browse the repository at this point in the history
  • Loading branch information
lgetwan committed Aug 24, 2023
1 parent ba76d1a commit e440cef
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
1 change: 0 additions & 1 deletion plugins/lookup/folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
import json

from ansible.plugins.lookup import LookupBase

from ansible_collections.checkmk.general.plugins.module_utils.lookup_api import (
CheckMKLookupAPI,
)
Expand Down
1 change: 0 additions & 1 deletion plugins/lookup/folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
import json

from ansible.plugins.lookup import LookupBase

from ansible_collections.checkmk.general.plugins.module_utils.lookup_api import (
CheckMKLookupAPI,
)
Expand Down
1 change: 0 additions & 1 deletion plugins/lookup/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
from ansible.module_utils.common.text.converters import to_native, to_text
from ansible.module_utils.urls import ConnectionError, SSLValidationError, open_url
from ansible.plugins.lookup import LookupBase

from ansible_collections.checkmk.general.plugins.module_utils.lookup_api import (
CheckMKLookupAPI,
)
Expand Down
10 changes: 5 additions & 5 deletions plugins/module_utils/lookup_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from urllib.error import HTTPError, URLError
from urllib.parse import urlencode

from ansible.errors import AnsibleError # type: ignore[import]
#from ansible.errors import AnsibleError # type: ignore[import]
from ansible.module_utils.common.text.converters import to_native, to_text
from ansible.module_utils.urls import ConnectionError, SSLValidationError, open_url

Expand Down Expand Up @@ -45,15 +45,15 @@ def get(self, endpoint="", parameters=None):
response = to_text(raw_response.read())

except HTTPError as e:
raise AnsibleError("Received HTTP error for %s : %s" % (url, to_native(e)))
raise Exception("Received HTTP error for %s : %s" % (url, to_native(e)))
except URLError as e:
raise AnsibleError("Failed lookup url for %s : %s" % (url, to_native(e)))
raise Exception("Failed lookup url for %s : %s" % (url, to_native(e)))
except SSLValidationError as e:
raise AnsibleError(
raise Exception(
"Error validating the server's certificate for %s: %s"
% (url, to_native(e))
)
except ConnectionError as e:
raise AnsibleError("Error connecting to %s: %s" % (url, to_native(e)))
raise Exception("Error connecting to %s: %s" % (url, to_native(e)))

return response

0 comments on commit e440cef

Please sign in to comment.