You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- name: "Create Site"connection: localhosts: localhostcollections:
- netbox_community.ansible_modulesgather_facts: Falsetasks:
- name: Create site within Netbox with only required informationnetbox_site:
netbox_url: "{{ url }}"netbox_token: "{{ token }}"data:
name: test-1.one.two.orgtenant: VPCstate: present
EXPECTED 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 """ifvalueisNone:
returnvalueelifisinstance(value, int):
returnvalueif" "invalue:
value=value.replace(" ", "_")
if"."invalue:
value=value.replace(".", "_")
value=value.lower()
The text was updated successfully, but these errors were encountered:
Thanks for reporting this. After doing some research, it appears I've been converting the names incorrectly as to how Netbox converts things to slug. It converts spaces and . to hyphens and removes any characters that wouldn't pass the validator.
@Shm013 I don't see the to_slug function. Could you point me to it?
I was pointed to JS that appears to take care of the slugify function.
I believe I'm going to move forward with implementing that into the _to_slug unless there are any objections, but my reasoning for doing this is to minimalize the data manipulation in these models and adhere as close as possible to Netbox.
ISSUE TYPE
SUMMARY
Cant use "." symbols in site name
STEPS TO REPRODUCE
EXPECTED RESULTS
expected slug is test_1_one_two_org
ACTUAL RESULTS
Got an error
To fix this bug:
The text was updated successfully, but these errors were encountered: