Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script create_vm.py error when Cluster have site. #70

Open
joaolucasmacedo opened this issue Sep 20, 2022 · 1 comment
Open

Script create_vm.py error when Cluster have site. #70

joaolucasmacedo opened this issue Sep 20, 2022 · 1 comment

Comments

@joaolucasmacedo
Copy link

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.

@celeroncool
Copy link

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"),
        )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants