Skip to content

Commit

Permalink
migrate from ansible.netcommon to ansible.utils (#882)
Browse files Browse the repository at this point in the history
migrate from ansible.netcommon to ansible.utils

SUMMARY

This is a maintenance task to migrate from ansible.netcommon to ansible.utils. I was trying to fix an issue in that module, but I was told the functions have moved to ansible.utils. See ansible-collections/ansible.netcommon#362 (comment)

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

Existing integration tests that use the ansible.netcommon module. No module uses netcommon, only integration tests.
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis <None>
Reviewed-by: Markus Bergholz <[email protected]>
  • Loading branch information
sebastien-rosset authored Jan 28, 2022
1 parent 99c64a6 commit 5e5f754
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mock
pytest-xdist
# We should avoid these two modules with py3
pytest-mock
# Needed for ansible.netcommon.ipaddr in tests
# Needed for ansible.utils.ipaddr in tests
netaddr
# Sometimes needed where we don't have features we need in modules
awscli
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ boto
boto3
botocore

# netaddr is needed for ansible.netcommon.ipv6
# netaddr is needed for ansible.utils.ipv6
netaddr
virtualenv
# Sometimes needed where we don't have features we need in modules
Expand Down
30 changes: 15 additions & 15 deletions tests/integration/targets/ec2_eip/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
that:
- eip is defined
- eip is changed
- eip.public_ip is defined and ( eip.public_ip | ansible.netcommon.ipaddr )
- eip.public_ip is defined and ( eip.public_ip | ansible.utils.ipaddr )
- eip.allocation_id is defined and eip.allocation_id.startswith("eipalloc-")
- ( eip_info_start.addresses | length ) + 1 == ( eip_info.addresses | length )

Expand Down Expand Up @@ -160,7 +160,7 @@
that:
- eip is defined
- eip is changed
- eip.public_ip is defined and ( eip.public_ip | ansible.netcommon.ipaddr )
- eip.public_ip is defined and ( eip.public_ip | ansible.utils.ipaddr )
- eip.allocation_id is defined and eip.allocation_id.startswith("eipalloc-")
- ( eip_info_start.addresses | length ) + 1 == ( eip_info.addresses | length )

Expand All @@ -175,7 +175,7 @@
that:
- reallocate_eip is defined
- reallocate_eip is not changed
- reallocate_eip.public_ip is defined and ( reallocate_eip.public_ip | ansible.netcommon.ipaddr )
- reallocate_eip.public_ip is defined and ( reallocate_eip.public_ip | ansible.utils.ipaddr )
- reallocate_eip.allocation_id is defined and reallocate_eip.allocation_id.startswith("eipalloc-")
- ( eip_info_start.addresses | length ) + 1 == ( eip_info.addresses | length )

Expand All @@ -202,7 +202,7 @@
that:
- eip is defined
- eip is changed
- eip.public_ip is defined and ( eip.public_ip | ansible.netcommon.ipaddr )
- eip.public_ip is defined and ( eip.public_ip | ansible.utils.ipaddr )
- eip.allocation_id is defined and eip.allocation_id.startswith("eipalloc-")
- ( eip_info_start.addresses | length ) + 1 == ( eip_info.addresses | length )

Expand All @@ -217,7 +217,7 @@
that:
- reallocate_eip is defined
- reallocate_eip is not changed
- reallocate_eip.public_ip is defined and ( reallocate_eip.public_ip | ansible.netcommon.ipaddr )
- reallocate_eip.public_ip is defined and ( reallocate_eip.public_ip | ansible.utils.ipaddr )
- reallocate_eip.allocation_id is defined and reallocate_eip.allocation_id.startswith("eipalloc-")
- ( eip_info_start.addresses | length ) + 1 == ( eip_info.addresses | length )

Expand All @@ -244,7 +244,7 @@
that:
- eip is defined
- eip is changed
- eip.public_ip is defined and ( eip.public_ip | ansible.netcommon.ipaddr )
- eip.public_ip is defined and ( eip.public_ip | ansible.utils.ipaddr )
- eip.allocation_id is defined and eip.allocation_id.startswith("eipalloc-")
- ( eip_info_start.addresses | length ) + 1 == ( eip_info.addresses | length )

Expand All @@ -260,7 +260,7 @@
that:
- no_tagged_eip is defined
- no_tagged_eip is changed
- no_tagged_eip.public_ip is defined and ( no_tagged_eip.public_ip | ansible.netcommon.ipaddr )
- no_tagged_eip.public_ip is defined and ( no_tagged_eip.public_ip | ansible.utils.ipaddr )
- no_tagged_eip.allocation_id is defined and no_tagged_eip.allocation_id.startswith("eipalloc-")
- ( eip_info_start.addresses | length ) + 2 == ( eip_info.addresses | length )

Expand All @@ -283,7 +283,7 @@
that:
- reallocate_eip is defined
- reallocate_eip is not changed
- reallocate_eip.public_ip is defined and ( reallocate_eip.public_ip | ansible.netcommon.ipaddr )
- reallocate_eip.public_ip is defined and ( reallocate_eip.public_ip | ansible.utils.ipaddr )
- reallocate_eip.allocation_id is defined and reallocate_eip.allocation_id.startswith("eipalloc-")
- ( eip_info_start.addresses | length ) + 2 == ( eip_info.addresses | length )

Expand All @@ -300,7 +300,7 @@
that:
- backend_eip is defined
- backend_eip is changed
- backend_eip.public_ip is defined and ( backend_eip.public_ip | ansible.netcommon.ipaddr )
- backend_eip.public_ip is defined and ( backend_eip.public_ip | ansible.utils.ipaddr )
- backend_eip.allocation_id is defined and backend_eip.allocation_id.startswith("eipalloc-")
- ( eip_info_start.addresses | length ) + 3 == ( eip_info.addresses | length )

Expand Down Expand Up @@ -378,7 +378,7 @@
that:
- eip is defined
- eip is changed
- eip.public_ip is defined and ( eip.public_ip | ansible.netcommon.ipaddr )
- eip.public_ip is defined and ( eip.public_ip | ansible.utils.ipaddr )
- eip.allocation_id is defined and eip.allocation_id.startswith("eipalloc-")
- ( eip_info_start.addresses | length ) + 1 == ( eip_info.addresses | length )

Expand Down Expand Up @@ -413,7 +413,7 @@
- eip_info.addresses[0].public_ip == eip.public_ip
- eip_info.addresses[0].association_id is defined and eip_info.addresses[0].association_id.startswith("eipassoc-")
- eip_info.addresses[0].network_interface_id == eni_create_a.interface.id
- eip_info.addresses[0].private_ip_address is defined and ( eip_info.addresses[0].private_ip_address | ansible.netcommon.ipaddr )
- eip_info.addresses[0].private_ip_address is defined and ( eip_info.addresses[0].private_ip_address | ansible.utils.ipaddr )
- eip_info.addresses[0].network_interface_owner_id == caller_info.account

- name: Re-Attach EIP to ENI A (no change)
Expand All @@ -437,7 +437,7 @@
- eip_info.addresses[0].public_ip == eip.public_ip
- eip_info.addresses[0].association_id is defined and eip_info.addresses[0].association_id.startswith("eipassoc-")
- eip_info.addresses[0].network_interface_id == eni_create_a.interface.id
- eip_info.addresses[0].private_ip_address is defined and ( eip_info.addresses[0].private_ip_address | ansible.netcommon.ipaddr )
- eip_info.addresses[0].private_ip_address is defined and ( eip_info.addresses[0].private_ip_address | ansible.utils.ipaddr )

- name: Attach EIP to ENI B (should fail, already associated)
ec2_eip:
Expand All @@ -459,7 +459,7 @@
- eip_info.addresses[0].public_ip == eip.public_ip
- eip_info.addresses[0].association_id is defined and eip_info.addresses[0].association_id.startswith("eipassoc-")
- eip_info.addresses[0].network_interface_id == eni_create_a.interface.id
- eip_info.addresses[0].private_ip_address is defined and ( eip_info.addresses[0].private_ip_address | ansible.netcommon.ipaddr )
- eip_info.addresses[0].private_ip_address is defined and ( eip_info.addresses[0].private_ip_address | ansible.utils.ipaddr )

- name: Attach EIP to ENI B
ec2_eip:
Expand All @@ -483,7 +483,7 @@
- eip_info.addresses[0].public_ip == eip.public_ip
- eip_info.addresses[0].association_id is defined and eip_info.addresses[0].association_id.startswith("eipassoc-")
- eip_info.addresses[0].network_interface_id == eni_create_b.interface.id
- eip_info.addresses[0].private_ip_address is defined and ( eip_info.addresses[0].private_ip_address | ansible.netcommon.ipaddr )
- eip_info.addresses[0].private_ip_address is defined and ( eip_info.addresses[0].private_ip_address | ansible.utils.ipaddr )

- name: Detach EIP from ENI B, without enabling release on disassociation
ec2_eip:
Expand Down Expand Up @@ -667,7 +667,7 @@
that:
- eip is defined
- eip is changed
- eip.public_ip is defined and ( eip.public_ip | ansible.netcommon.ipaddr )
- eip.public_ip is defined and ( eip.public_ip | ansible.utils.ipaddr )
- eip.allocation_id is defined and eip.allocation_id.startswith("eipalloc-")
- ( eip_info_start.addresses | length ) + 1 == ( eip_info.addresses | length )

Expand Down

0 comments on commit 5e5f754

Please sign in to comment.