customizations icon indicating copy to clipboard operation
customizations copied to clipboard

Script create_vm.py error when Cluster have site.

Open joaolucasmacedo opened this issue 3 years ago • 1 comments

Looks like when a selected cluster have a site the script returns an error.

I'm running Netbox 3.3.2 with Python 3.10.

Maybe it is something related to the newer Netbox version.

joaolucasmacedo avatar Sep 20 '22 21:09 joaolucasmacedo

I have fixed this by adding the following two lines to the end of class and def run:

class NewVM(Script):
    class Meta:
        name = "New VM"
        description = "Create a new VM"

    vm_name = StringVar(label="VM name")
....
    site = ObjectVar(model=Site, required=True)`
   def run(self, data, commit):
        vm = VirtualMachine(
            name=data["vm_name"],
....
            site=data.get("site"),
        )

celeroncool avatar Jul 09 '24 09:07 celeroncool

I don't seem to be having this issue on Netbox 4.3.7. Is it happening for you with newer versions?

fuzzbawl avatar Sep 24 '25 23:09 fuzzbawl