Skip to content

Commit 5d36aec

Browse files
Fix passing in integer for endpoint choices (#48)
1 parent d0ece6b commit 5d36aec

File tree

5 files changed

+16
-4
lines changed

5 files changed

+16
-4
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ env:
99
global:
1010
- COLLECTION_NAMESPACE: fragmentedpacket
1111
- COLLECTION_NAME: netbox_modules
12-
- COLLECTION_VERSION: 0.1.1
12+
- COLLECTION_VERSION: 0.1.2
1313

1414
matrix:
1515
include:

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
# Changelog
22

3+
## v0.1.2
4+
5+
### Bug Fixes
6+
- [#47](https://github.com/FragmentedPacket/netbox_modules/issues/47) - Allow endpoint choices to be an integer of the choice rather than attempting to dynamically determine the choice ID
7+
38
## v0.1.1
49

510
### Bug Fixes
611

7-
- [#40](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html#id7) - Fixed issue with netbox_vm_interface where it would fail if different virtual machine had the same interface name
8-
- [#40](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html#id7) - Updated netbox_ip_address to find interfaces on virtual machines correctly
12+
- [#40](https://github.com/FragmentedPacket/netbox_modules/issues/40) - Fixed issue with netbox_vm_interface where it would fail if different virtual machine had the same interface name
13+
- [#40](https://github.com/FragmentedPacket/netbox_modules/issues/40) - Updated netbox_ip_address to find interfaces on virtual machines correctly
914

1015
## v0.1.0
1116

galaxy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace: fragmentedpacket
99
name: netbox_modules
1010

1111
# The version of the collection. Must be compatible with semantic versioning
12-
version: 0.1.1
12+
version: 0.1.2
1313

1414
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
1515
readme: README.md

plugins/module_utils/netbox_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,8 @@ def _change_choices_id(self, endpoint, data):
544544
for choice in required_choices:
545545
for key, value in choice.items():
546546
if data.get(key):
547+
if isinstance(data[key], int):
548+
break
547549
try:
548550
data[key] = value[data[key].lower()]
549551
except KeyError:

tests/integration/integration-tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3094,6 +3094,7 @@
30943094
cluster: "Test Cluster"
30953095
vcpus: 8
30963096
memory: 8
3097+
status: 0
30973098
virtual_machine_role: "Test VM Role"
30983099
tags:
30993100
- Schnozzberry
@@ -3106,12 +3107,14 @@
31063107
- test_three is changed
31073108
- test_three['diff']['after']['vcpus'] == 8
31083109
- test_three['diff']['after']['memory'] == 8
3110+
- test_three['diff']['after']['status'] == 0
31093111
- test_three['diff']['after']['role'] == 2
31103112
- test_three['diff']['after']['tags'][0] == "Schnozzberry"
31113113
- test_three['virtual_machine']['name'] == "Test VM One"
31123114
- test_three['virtual_machine']['cluster'] == 1
31133115
- test_three['virtual_machine']['vcpus'] == 8
31143116
- test_three['virtual_machine']['memory'] == 8
3117+
- test_three['virtual_machine']['status'] == 0
31153118
- test_three['virtual_machine']['role'] == 2
31163119
- test_three['virtual_machine']['tags'][0] == "Schnozzberry"
31173120
- test_three['msg'] == "virtual_machine Test VM One updated"
@@ -3133,6 +3136,8 @@
31333136
- test_four['virtual_machine']['cluster'] == 1
31343137
- test_four['virtual_machine']['vcpus'] == 8
31353138
- test_four['virtual_machine']['memory'] == 8
3139+
- test_four['virtual_machine']['status'] == 0
3140+
- test_four['virtual_machine']['role'] == 2
31363141
- test_four['virtual_machine']['tags'][0] == "Schnozzberry"
31373142
- test_four['msg'] == "virtual_machine Test VM One deleted"
31383143

0 commit comments

Comments
 (0)