-
Notifications
You must be signed in to change notification settings - Fork 253
Closed
Labels
Milestone
Description
ISSUE TYPE
- Bug Report
- Feature Idea
SUMMARY
Cant use "." symbols in site name
STEPS TO REPRODUCE
- name: "Create Site"
connection: local
hosts: localhost
collections:
- netbox_community.ansible_modules
gather_facts: False
tasks:
- name: Create site within Netbox with only required information
netbox_site:
netbox_url: "{{ url }}"
netbox_token: "{{ token }}"
data:
name: test-1.one.two.org
tenant: VPC
state: presentEXPECTED RESULTS
expected slug is test_1_one_two_org
ACTUAL RESULTS
Got an error
But have message:
`"msg": "{\"slug\":[\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or hyphens.\"]}",`
To fix this bug:
def _to_slug(self, value):
"""
:returns slug (str): Slugified value
:params value (str): Value that needs to be changed to slug format
"""
if value is None:
return value
elif isinstance(value, int):
return value
if " " in value:
value = value.replace(" ", "_")
if "." in value:
value = value.replace(".", "_")
value = value.lower()Shm013, postdespodency, ArtMingulov and dshatokhin