input-output-hk / nixops-packet

NixOps Packet.net Plugin
GNU Lesser General Public License v3.0
5 stars 5 forks source link

Sometimes provSystem isn't set, and the resulting error is not useful #12

Open grahamc opened 4 years ago

grahamc commented 4 years ago

nixops-packet doesn't seem to fill in public_ipv4 (it should!) and when metadata is None and provSystem is None, public_ipv4 is also None and now I have no way to know what machine is broken :P

[nix-shell:~/projects/grahamc/packet-spot-community]$ nixops deploy -k --exclude flokli netboot-proxy-sjc1 m2-xlarge-x86-upstream-cpr --include t3-small-x86-upstream-cpr c3-small-x86-upstream-cpr s3-xlarge-x86-upstream-cpr --force-reboot
building all machine configurations...
Traceback (most recent call last):
  File "/nix/store/xcb69rh17hhx8hsm99g3c4x4wh1c7ad3-nixops-1.8pre2877_4cfb705/bin/.nixops-wrapped", line 251, in <module>
    args.op(args)
  File "/nix/store/xcb69rh17hhx8hsm99g3c4x4wh1c7ad3-nixops-1.8pre2877_4cfb705/lib/python2.7/site-packages/nixops/script_defs.py", line 427, in op_deploy
    max_concurrent_activate=args.max_concurrent_activate)
  File "/nix/store/xcb69rh17hhx8hsm99g3c4x4wh1c7ad3-nixops-1.8pre2877_4cfb705/lib/python2.7/site-packages/nixops/deployment.py", line 1062, in deploy
    self.run_with_notify('deploy', lambda: self._deploy(**kwargs))
  File "/nix/store/xcb69rh17hhx8hsm99g3c4x4wh1c7ad3-nixops-1.8pre2877_4cfb705/lib/python2.7/site-packages/nixops/deployment.py", line 1051, in run_with_notify
    f()
  File "/nix/store/xcb69rh17hhx8hsm99g3c4x4wh1c7ad3-nixops-1.8pre2877_4cfb705/lib/python2.7/site-packages/nixops/deployment.py", line 1062, in <lambda>
    self.run_with_notify('deploy', lambda: self._deploy(**kwargs))
  File "/nix/store/xcb69rh17hhx8hsm99g3c4x4wh1c7ad3-nixops-1.8pre2877_4cfb705/lib/python2.7/site-packages/nixops/deployment.py", line 1006, in _deploy
    self.configs_path = self.build_configs(dry_run=dry_run, repair=repair, include=include, exclude=exclude)
  File "/nix/store/xcb69rh17hhx8hsm99g3c4x4wh1c7ad3-nixops-1.8pre2877_4cfb705/lib/python2.7/site-packages/nixops/deployment.py", line 628, in build_configs
    p = self.get_physical_spec()
  File "/nix/store/xcb69rh17hhx8hsm99g3c4x4wh1c7ad3-nixops-1.8pre2877_4cfb705/lib/python2.7/site-packages/nixops/deployment.py", line 596, in get_physical_spec
    emit_resource(r) for r in active_resources.itervalues()
  File "/nix/store/xcb69rh17hhx8hsm99g3c4x4wh1c7ad3-nixops-1.8pre2877_4cfb705/lib/python2.7/site-packages/nixops/deployment.py", line 583, in emit_resource
    physical = r.get_physical_spec()
  File "/nix/store/9fn74bs7acm0xqhn99y5a5i703dn9w0m-python2.7-nixops-packet-1.6.1pre2877_4cfb705/lib/python2.7/site-packages/nixopspacket/backends/device.py", line 145, in get_physical_spec
    return self.get_physical_spec_from_plan(public_key)
  File "/nix/store/9fn74bs7acm0xqhn99y5a5i703dn9w0m-python2.7-nixops-packet-1.6.1pre2877_4cfb705/lib/python2.7/site-packages/nixopspacket/backends/device.py", line 131, in get_physical_spec_from_plan
    raise Exception("provSystem not set for {0}, metadata {1}".format(self.public_ipv4,self.metadata))
Exception: provSystem not set for None, metadata None
johnalotoski commented 3 years ago

Metadata is now captured before attempting to capture the provisioning file (https://github.com/input-output-hk/nixops-packet/commit/72602e5a637614f3d20ecb8c9457cc9b9cde579f) which hopefully will help in a situation like this until public_ipv4 proper handling is fixed.