Skip to content

Commit

Permalink
Added Error message for dynamic inventory if wrong credentials are pa…
Browse files Browse the repository at this point in the history
…ssed

Issue: #421
  • Loading branch information
abhinavbansal29 committed Oct 7, 2024
1 parent 854442f commit ed40537
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions plugins/module_utils/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
from urllib.parse import parse_qsl, urlencode, urlparse, urlunparse
except ImportError:
from urlparse import urlparse # python2
from ansible.utils.display import Display

display = Display()


class Entity(object):
Expand Down Expand Up @@ -174,6 +177,11 @@ def list(
no_response=no_response,
timeout=timeout,
)
if resp and resp.get("state") == "ERROR" and resp.get("code") == 401:
display.error(
"Failed fetching URL: {0}, error={1}".format(url, resp["message_list"])
)
exit(1)
if resp:
custom_filters = self.module.params.get("custom_filter")

Expand Down

0 comments on commit ed40537

Please sign in to comment.