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

Error trying to deploy: type object 'libvirt' has no attribute 'open' #23

Open
onny opened this issue Apr 25, 2021 · 5 comments
Open

Error trying to deploy: type object 'libvirt' has no attribute 'open' #23

onny opened this issue Apr 25, 2021 · 5 comments

Comments

@onny
Copy link
Contributor

onny commented Apr 25, 2021

Hey,
I followed the example mentioned on the Readme.md but somehow the Python script seems to fail:

$ nixops deploy -d example-libvirtd
Traceback (most recent call last):
  File "/nix/store/6rdrwjdaba0xhzil64acz3hfdmlxw5m4-nixops-1.7/bin/..nixops-wrapped-wrapped", line 991, in <module>
    args.op()
  File "/nix/store/6rdrwjdaba0xhzil64acz3hfdmlxw5m4-nixops-1.7/bin/..nixops-wrapped-wrapped", line 412, in op_deploy
    max_concurrent_activate=args.max_concurrent_activate)
  File "/nix/store/6rdrwjdaba0xhzil64acz3hfdmlxw5m4-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 1063, in deploy
    self.run_with_notify('deploy', lambda: self._deploy(**kwargs))
  File "/nix/store/6rdrwjdaba0xhzil64acz3hfdmlxw5m4-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 1052, in run_with_notify
    f()
  File "/nix/store/6rdrwjdaba0xhzil64acz3hfdmlxw5m4-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 1063, in <lambda>
    self.run_with_notify('deploy', lambda: self._deploy(**kwargs))
  File "/nix/store/6rdrwjdaba0xhzil64acz3hfdmlxw5m4-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 996, in _deploy
    nixops.parallel.run_tasks(nr_workers=-1, tasks=self.active_resources.itervalues(), worker_fun=worker)
  File "/nix/store/6rdrwjdaba0xhzil64acz3hfdmlxw5m4-nixops-1.7/lib/python2.7/site-packages/nixops/parallel.py", line 44, in thread_fun
    result_queue.put((worker_fun(t), None, t.name))
  File "/nix/store/6rdrwjdaba0xhzil64acz3hfdmlxw5m4-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 969, in worker
    r.create(self.definitions[r.name], check=check, allow_reboot=allow_reboot, allow_recreate=allow_recreate)
  File "/nix/store/6rdrwjdaba0xhzil64acz3hfdmlxw5m4-nixops-1.7/lib/python2.7/site-packages/nixops/backends/libvirtd.py", line 129, in create
    self.connect()
  File "/nix/store/6rdrwjdaba0xhzil64acz3hfdmlxw5m4-nixops-1.7/lib/python2.7/site-packages/nixops/backends/libvirtd.py", line 75, in connect
    self.conn = libvirt.open('qemu:///system')
AttributeError: type object 'libvirt' has no attribute 'open'

Best regards
Jonas

@onny
Copy link
Contributor Author

onny commented Apr 25, 2021

Maybe this issue can be solved by migrating to Python 3, see #24 . The Python 2 libvirt package is marked as insecure :(

@onny
Copy link
Contributor Author

onny commented Apr 26, 2021

Upgraded to nixopsUnstable and now it seems to work. Closing this for now.

@onny onny closed this as completed Apr 26, 2021
@onny
Copy link
Contributor Author

onny commented Apr 27, 2021

I guess I'll leave this open as long NixOps 2.0 haven't reached the stable release channel

@onny onny reopened this Apr 27, 2021
@jlamur
Copy link

jlamur commented Apr 2, 2022

With the package nixopsUnstable (aka NixOps 2.0) deployments will fail with the error:

AttributeError: 'Deployment' object has no attribute '_eval_flags'

This has been reported here before: #29

That means it's impossible to use nixops-libvirtd with either NixOps v1 or v2. Unless there is something that I missed here, this package is broken and unsuable on recent versions of nixpkgs.

@deepfire
Copy link
Contributor

@jlamur, that particular issue is fixed by #33

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

3 participants