Replies: 1 comment
-
I did that for autogenerating switchport descriptions from various fields and it works just how you describe in general. Did you make progress so far? This should help you get started with a custom script. getting the event rule to trigger and invoke the custom script correctly is a bit tricky. make sure you create logs for the 'data' object that the trigger is putting into your 'run' method. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
so we're thinking internally that an event rule is most likely the best path forward for what we're trying to accomplish.
basically, we have a standing rule for our netbox deployment that any data going into netbox needs to be inputted as lowercase. hostnames, serial numbers, everything.
Some users are better at following this than others. To enforce consistency, we'd like to have NetBox auto-format any inputs automatically so then it doesn't really matter how the user inputs the text, NetBox will fix it behind the scenes.
We're thinking that an event rule triggered on object create and object update will work for this. Where we're stuck is that event rules seem to support action types of webhook, script, or notification. Of those 3 actions, I think script would likely be the one we want.
So now we're trying to figure out how to create a custom script that just reads any fields inputs for a particular object and reformats the text in those fields to lowercase. All examples of scripts that I can find seem to include a lot of GUI elements and such which we're not targeting.
Basically, we just want a workflow where a user goes to create a virtual machine for example, and when they type the VM's hostname they could theoretically type it as VM-TesT-12-A-PrOd .. and when they click create, the event rule and script will just take that and auto-format it into vm-test-12-a-prod.
Can anyone point to any examples we can draw from that has nuggets of this workflow that we can start to try and build ourselves?
Beta Was this translation helpful? Give feedback.
All reactions