-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: add metal_port module #205
base: main
Are you sure you want to change the base?
Conversation
82f32c8
to
487d53a
Compare
487d53a
to
165ce4e
Compare
14037c5
to
38c0e98
Compare
38c0e98
to
86ea422
Compare
86ea422
to
2610f55
Compare
2610f55
to
db18fd8
Compare
plugins/modules/metal_port.py
Outdated
if len(vlan_assignments) > 0: | ||
port = _create_and_wait_for_batch(module, port, vlan_assignments, 1800) | ||
|
||
# 8: update native VLAN ID |
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.
Any reason native
is not assigned/unassigned/reassigned in batch via the native
flag?
https://deploy.equinix.com/developers/api/metal/#tag/Ports/operation/createPortVlanAssignmentBatch
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.
Handling native
in the batch increases the complexity of the code to construct the batch, with minimal benefit (one less API request).
633f583
to
1d4ed87
Compare
667c31f
to
0306b19
Compare
maybe it would be nice to translate the examples that are defined in https://registry.terraform.io/providers/equinix/equinix/latest/docs/guides/network_types#metal-port to add them in these ansible docs since it is not very obvious the different combinations needed to achieve each mode |
|
||
|
||
specdoc_examples = [ | ||
''' |
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.
Is this formatting what black or other linters would product? (with '''
not in the same column)
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.
This is how the module template is formatted (and as a result, every other module in this collection). We may want to change this and (add a linter and/or formatter) but that's a bigger scope than just one module.
- [Return Values](#return-values) | ||
|
||
## Examples | ||
|
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.
I agree with what @ocobles pointed out, that we could benefit from the test cases as examples with some contextual text, similar to https://registry.terraform.io/providers/equinix/equinix/latest/docs/guides/network_types#metal-port
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.
The example string specified in the code is dumped into a fenced code block, so we don't have a lot of flexibility on how that's rendered at the moment. I added more example tasks with descriptive names to the example string. We could add more text in YAML comments inside the example block, but IMO that's not a great experience.
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.
We have one richer Markdown example for the collection, although I don't see anything that links to or references it: https://github.com/equinix/ansible-collection-equinix/tree/main/examples/device_assign_ip
Something like that would be good for metal_port, but I'd prefer to add that in a separate PR so we can take some time to think about how and where to reference it.
So many tests! 🚀 |
cd6dd3e
to
5cb3f4a
Compare
37af4ea
to
98e1ce1
Compare
98e1ce1
to
8174d32
Compare
Closes #61.
This introduces a
metal_port
module so that Ansible collection users can modify the network port configuration of their Metal devices. Themetal_port
Ansible module is based heavily on themetal_port
Terraform resource.Device ports cannot be created or deleted, and updating a device port involves conditionally making multiple different API requests, so the
metal_port
module does not fit the assumptions made by themetal
utility package of this collection. In light of that, themetal_port
module has been written in the style of theamazon.aws
collection. In that style, each Ansible module uses an API client directly rather than offloading to a shared package that encapsulates all API requests.