diff --git a/changelogs/fragments/fix_pagination.yaml b/changelogs/fragments/fix_pagination.yaml new file mode 100644 index 0000000..5138204 --- /dev/null +++ b/changelogs/fragments/fix_pagination.yaml @@ -0,0 +1,4 @@ +--- +bugfixes: + - Strip scheme and hostname from AAP url builder, which previously lead to malformed urls in the ansible.platform.gateway_api lookup plugin +... diff --git a/plugins/module_utils/aap_module.py b/plugins/module_utils/aap_module.py index df3c82c..26665e8 100644 --- a/plugins/module_utils/aap_module.py +++ b/plugins/module_utils/aap_module.py @@ -232,6 +232,9 @@ def warn(self, warning): super(AAPModule, self).warn(warning) def build_url(self, endpoint, query_params=None): + # Remove the host_url part if it is already present + if endpoint.startswith(("https://", "http://")): + endpoint = "/{0}".format('/'.join(endpoint.split('/')[3:])) # Make sure we start with /api/vX if not endpoint.startswith("/"): endpoint = "/{0}".format(endpoint)