Custom script, config context or multiline log output #10426
-
Hi, I am currently trying to make a custom script for our netbox installation, for when we deploy new switches. To this i would like to make it so we get default config with values we will enter with StringVar. I would like to either get this config put in the switch config context, if this is not possible we can also live with getting the config via the self.log_success message. I have gotten the script to output the config in the self.log_success, but i cannot figure out a way to line break the output. Anyone who knows how i can get this to work? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Don't use log_xxx; your script can simply return a string, and this can contain newlines. See the example, which returns a CSV file. Config contexts aren't really intended for whole config files. They are JSON data intended to store parameters, which could be used to build a configuration. In theory, I suppose you could store
Maybe you'd be better off with a custom field, although I don't know if there's a maximum length for those. |
Beta Was this translation helpful? Give feedback.
Don't use log_xxx; your script can simply return a string, and this can contain newlines.
See the example, which returns a CSV file.
Config contexts aren't really intended for whole config files. They are JSON data intended to store parameters, which could be used to build a configuration. In theory, I suppose you could store
Maybe you'd be better off with a custom field, although I don't know if there's a maximum length for those.