Skip to content

Commit

Permalink
fix: metal vrf info, code review apply
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonin Rykalsky committed Dec 11, 2023
1 parent 8d9b81c commit 48a833e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
7 changes: 1 addition & 6 deletions plugins/modules/metal_vrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,6 @@

# End of generated documentation

# This is a template for a new module. It is not meant to be used as is.
# It is meant to be copied and modified to create a new module.
# Replace all occurrences of "metal_resource" with the name of the new
# module, for example "metal_vlan".


from ansible.module_utils._text import to_native
from ansible_specdoc.objects import (
Expand Down Expand Up @@ -217,7 +212,7 @@
SPECDOC_META = getSpecDocMeta(
short_description='Use this resource to manage a VRF.',
description=(
'Create a VRF in your desired metro and project with any IP ranges that you want the VRF to route and forward.'
'Create a VRF in a metro, with IP ranges that you want the VRF to route and forward.'
),
examples=specdoc_examples,
options=module_spec,
Expand Down
8 changes: 2 additions & 6 deletions plugins/modules/metal_vrf_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,9 @@
)

module_spec = dict(
name=SpecField(
type=FieldType.string,
description=['Filter VRF on substring in name attribute.'],
),
project_id=SpecField(
type=FieldType.string,
description=['Project ID where the VRF will be deployed.'],
description=['Project ID where to look up VRFs.'],
required=True
),
vrf_id=SpecField(
Expand All @@ -88,7 +84,7 @@
)

specdoc_examples = ['''
- name: Gather VRF information for a specific project
- name: Gather information about VRFs in a project
hosts: localhost
tasks:
- equinix.cloud.metal_vrf_info:
Expand Down
7 changes: 7 additions & 0 deletions tests/integration/targets/metal_vrf/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@
equinix.cloud.metal_vrf_info:
vrf_id: "{{ test_vrf.id }}"
project_id: "{{ test_project.id }}"
register: vrf_list

- name: assert vrf_list contains only this vrf
assert:
that:
- "vrf_list.resources|length == 1"
- "vrf_list.resources[0].id == '{{ test_vrf.id }}'"

- name: delete test VRF
equinix.cloud.metal_vrf:
Expand Down

0 comments on commit 48a833e

Please sign in to comment.