Skip to content

Commit 23f2001

Browse files
Bugfix: Normalize descriptions to remove any extra whitespaces (#249)
1 parent 142bafe commit 23f2001

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

plugins/module_utils/netbox_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,8 @@ def _normalize_data(self, data):
766766
if " " in v:
767767
data[k] = v.replace(" ", "_")
768768
data[k] = self._normalize_to_integer(k, data.get(k))
769+
if k == "description":
770+
data[k] = v.strip()
769771

770772
return data
771773

tests/integration/targets/latest/tasks/netbox_circuit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
tenant: Test Tenant
5959
install_date: "2018-12-25"
6060
commit_rate: 10000
61-
description: Test circuit
61+
description: "Test circuit "
6262
comments: "FAST CIRCUIT"
6363
state: present
6464
register: test_three

tests/unit/module_utils/test_data/normalize_data/data.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,5 +318,13 @@
318318
"vlan_group": "test-vlan-group"
319319
}
320320
}
321+
},
322+
{
323+
"before": {
324+
"description": "White space "
325+
},
326+
"after": {
327+
"description": "White space"
328+
}
321329
}
322330
]

0 commit comments

Comments
 (0)