-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modified 'aci_rest' and 'aci_config_snapshot' modules to display the correct URL output string #487
Conversation
…to display the correct URL output string
…string when check mode is used
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #487 +/- ##
==========================================
- Coverage 96.62% 96.52% -0.11%
==========================================
Files 183 183
Lines 8475 8478 +3
Branches 1265 1266 +1
==========================================
- Hits 8189 8183 -6
- Misses 214 222 +8
- Partials 72 73 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
plugins/module_utils/aci.py
Outdated
@@ -85,7 +85,7 @@ | |||
HAS_XMLJSON_COBRA = False | |||
|
|||
try: | |||
from ansible.module_utils.six.moves.urllib.parse import urlparse | |||
from ansible.module_utils.six.moves.urllib.parse import urlparse, urlunparse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this function in aci.py or should we place in the aci_rest which is the only place where it is used?
plugins/modules/aci_rest.py
Outdated
@@ -434,6 +438,9 @@ def main(): | |||
aci.result["totalCount"] = aci.totalCount | |||
|
|||
else: | |||
# NOTE A case when aci_rest is used with check mode and the apic host is used directly from the inventory | |||
if aci.connection is not None and aci.params.get("host") is None: | |||
aci.url = replace_apic_host(aci.url, re.sub(r"[[\]]", "", aci.connection.get_option("host")).split(",")[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this is the only location where this is used because it is an exception we could also decide to only set here by leveraging the url parse/unparse function here
aci.url = replace_apic_host(aci.url, re.sub(r"[[\]]", "", aci.connection.get_option("host")).split(",")[0]) | |
aci.url = urlunparse(urlparse(aci.url)._replace(netloc=re.sub(r"[[\]]", "", aci.connection.get_option("host")).split(",")[0])) |
… implemented the logic in 'aci_rest'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.