Skip to content
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

Fix returned data for already present floating IP #162

Merged
merged 2 commits into from
Sep 15, 2021
Merged

Fix returned data for already present floating IP #162

merged 2 commits into from
Sep 15, 2021

Conversation

onurguzel
Copy link
Contributor

SUMMARY

Floating IP module is idempotent when a Droplet ID is provided. However, the returned data structure is different between the run when the IP is created and the run it is already present. This pull-request fixes the returned data for the state that the floating IP is present. Please see the output below.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

community.digitalocean.digital_ocean_floating_ip

ADDITIONAL INFORMATION

The test:

  - name: Create floating IP address
    community.digitalocean.digital_ocean_floating_ip:
      state: present
      droplet_id: "123456"
    register: floating_ip
  - debug:
      var: floating_ip

Output when floating IP is created:

TASK [Create floating IP address] **********************************************
changed: [localhost]

TASK [debug] *******************************************************************
ok: [localhost] => {
    "floating_ip": {
        "changed": true,
        "data": {
            "floating_ip": {
                "droplet": null,
                "ip": "12.34.56.78",
                "locked": true,
                "region": {
                    ... (omitted)
                }
            },
            "links": {}
        },
        "failed": false
    }
}

Output when floating IP is existing (before the PR):

TASK [Create floating IP address] **********************************************
ok: [localhost]

TASK [debug] *******************************************************************
ok: [localhost] => {
    "floating_ip": {
        "changed": false,
        "data": {
            "floating_ip": "12.34.56.78"
        },
        "failed": false
    }
}

Output when floating IP is existing (after the PR):

TASK [Create floating IP address] **********************************************
ok: [localhost]

TASK [debug] *******************************************************************
ok: [localhost] => {
    "floating_ip": {
        "changed": false,
        "data": {
            "floating_ip": {
                "droplet": {
                    ... (omitted)
                },
                "ip": "12.34.56.78",
                "locked": false,
                "region": {
                    ... (omitted)
                }
            }
        },
        "failed": false
    }
}

@mamercad
Copy link
Collaborator

Ah, thank you, please add a changelog fragment.

@mamercad mamercad self-requested a review September 13, 2021 01:20
Copy link
Collaborator

@mamercad mamercad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a changelog fragment.

@onurguzel
Copy link
Contributor Author

Thank you for your quick response. I have added the fragment.

Would you be kind enough to include this fix in 1.10.0 version?

@codecov
Copy link

codecov bot commented Sep 13, 2021

Codecov Report

Merging #162 (56900d4) into main (ae96d74) will increase coverage by 7.60%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #162      +/-   ##
==========================================
+ Coverage   64.73%   72.34%   +7.60%     
==========================================
  Files          38        1      -37     
  Lines        2853       94    -2759     
  Branches      573       17     -556     
==========================================
- Hits         1847       68    -1779     
+ Misses        675       24     -651     
+ Partials      331        2     -329     
Impacted Files Coverage Δ
plugins/modules/digital_ocean_snapshot_info.py
...ns/modules/digital_ocean_monitoring_alerts_info.py
plugins/modules/digital_ocean_domain.py
plugins/modules/digital_ocean_kubernetes_info.py
plugins/modules/digital_ocean_certificate.py
plugins/modules/digital_ocean_certificate_info.py
plugins/modules/digital_ocean_load_balancer.py
plugins/modules/digital_ocean_monitoring_alerts.py
plugins/modules/digital_ocean_domain_record.py
plugins/modules/digital_ocean_account_info.py
... and 26 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ae96d74...56900d4. Read the comment docs.

Copy link
Collaborator

@mamercad mamercad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mamercad mamercad merged commit 41b83d3 into ansible-collections:main Sep 15, 2021
@onurguzel onurguzel deleted the fix-floating-ip-idempotency branch September 15, 2021 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants