NixOS / nixops

NixOps is a tool for deploying to NixOS machines in a network or cloud.
https://nixos.org/nixops
GNU Lesser General Public License v3.0
1.83k stars 363 forks source link

nixops info: throws Traceback when "state file contains multiple deployments" #1095

Open davidak opened 5 years ago

davidak commented 5 years ago

Please only display the error message, this looks broken.

[davidak@ethmoid:~/code/nixops]$ nixops create ./load-balancer.nix ./load-balancer-vbox.nix -d load-balancer
created deployment ‘1d068130-3522-11e9-89f9-024246453e35’
1d068130-3522-11e9-89f9-024246453e35

[davidak@ethmoid:~/code/nixops]$ nixops info
Traceback (most recent call last):
  File "/nix/store/ny77qvx9by0fh2fmm1lyayaki0fymsbr-nixops-1.6.1/bin/..nixops-wrapped-wrapped", line 990, in <module>
    args.op()
  File "/nix/store/ny77qvx9by0fh2fmm1lyayaki0fymsbr-nixops-1.6.1/bin/..nixops-wrapped-wrapped", line 207, in op_info
    depl = open_deployment()
  File "/nix/store/ny77qvx9by0fh2fmm1lyayaki0fymsbr-nixops-1.6.1/bin/..nixops-wrapped-wrapped", line 72, in open_deployment
    depl = sf.open_deployment(uuid=args.deployment)
  File "/nix/store/ny77qvx9by0fh2fmm1lyayaki0fymsbr-nixops-1.6.1/lib/python2.7/site-packages/nixops/statefile.py", line 151, in open_deployment
    deployment = self._find_deployment(uuid=uuid)
  File "/nix/store/ny77qvx9by0fh2fmm1lyayaki0fymsbr-nixops-1.6.1/lib/python2.7/site-packages/nixops/statefile.py", line 146, in _find_deployment
    raise Exception("state file contains multiple deployments, so you should specify which one to use using ‘-d’, or set the environment variable NIXOPS_DEPLOYMENT")
Exception: state file contains multiple deployments, so you should specify which one to use using ‘-d’, or set the environment variable NIXOPS_DEPLOYMENT

[davidak@ethmoid:~/code/nixops]$ nixops info -d load-balancer
Network name: load-balancer
Network UUID: 1d068130-3522-11e9-89f9-024246453e35
Network description: Load balancing network
Nix expressions: /home/davidak/code/nixops/load-balancer.nix /home/davidak/code/nixops/load-balancer-vbox.nix

+----------+---------+------------+-------------+------------+
| Name     |  Status | Type       | Resource Id | IP address |
+----------+---------+------------+-------------+------------+
| backend1 | Missing | virtualbox |             |            |
| backend2 | Missing | virtualbox |             |            |
| proxy    | Missing | virtualbox |             |            |
+----------+---------+------------+-------------+------------+

nix (Nix) 2.1.3 NixOS 18.09.2203.9bd45dddf81 (Jellyfish) NixOps 1.6.1

AmineChikhaoui commented 5 years ago

If I'm not wrong this was introduced in a02090774a4f6d59656eb35eb670cd17e7fac833. and I do agree on the addition of such behavior as some issues are really hard to reproduce so getting a stacktrace from the first time would be very helpful to get to the root cause and fix it. Unfortunately, there will be some extra noise in cases like the one you described.