nix-community / nixops-gce

NixOps Google Cloud Backend
25 stars 7 forks source link

Moving over to 2.0 and getting type Attribute errors for static ips #19

Closed zaphar closed 3 years ago

zaphar commented 3 years ago

I have a static IP resource I'm attaching to a compute instance. This worked 1.7 but while converting over to 2.0 I got the following error.


  File "/nix/store/a3z0w9l4vzcx2vm7cc0g4yngpb6p4viy-python3.9-nixops-2.0.0/bin/.nixops-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/rgnxp0hjqjj5rwhpniy4cda1xb8n5hxb-python3-3.9.6-env/lib/python3.9/site-packages/nixops/__main__.py", line 710, in main
    args.op(args)
  File "/nix/store/rgnxp0hjqjj5rwhpniy4cda1xb8n5hxb-python3-3.9.6-env/lib/python3.9/site-packages/nixops/script_defs.py", line 617, in op_deploy
    depl.deploy(
  File "/nix/store/rgnxp0hjqjj5rwhpniy4cda1xb8n5hxb-python3-3.9.6-env/lib/python3.9/site-packages/nixops/deployment.py", line 1479, in deploy
    self.run_with_notify("deploy", lambda: self._deploy(**kwargs))
  File "/nix/store/rgnxp0hjqjj5rwhpniy4cda1xb8n5hxb-python3-3.9.6-env/lib/python3.9/site-packages/nixops/deployment.py", line 1468, in run_with_notify
    f()
  File "/nix/store/rgnxp0hjqjj5rwhpniy4cda1xb8n5hxb-python3-3.9.6-env/lib/python3.9/site-packages/nixops/deployment.py", line 1479, in <lambda>
    self.run_with_notify("deploy", lambda: self._deploy(**kwargs))
  File "/nix/store/rgnxp0hjqjj5rwhpniy4cda1xb8n5hxb-python3-3.9.6-env/lib/python3.9/site-packages/nixops/deployment.py", line 1266, in _deploy
    self.evaluate_active(include, exclude, kill_obsolete)
  File "/nix/store/rgnxp0hjqjj5rwhpniy4cda1xb8n5hxb-python3-3.9.6-env/lib/python3.9/site-packages/nixops/deployment.py", line 1207, in evaluate_active
    self.evaluate()
  File "/nix/store/rgnxp0hjqjj5rwhpniy4cda1xb8n5hxb-python3-3.9.6-env/lib/python3.9/site-packages/nixops/deployment.py", line 571, in evaluate
    defn = _create_definition(
  File "/nix/store/rgnxp0hjqjj5rwhpniy4cda1xb8n5hxb-python3-3.9.6-env/lib/python3.9/site-packages/nixops/deployment.py", line 1797, in _create_definition
    return cls(name, nixops.resources.ResourceEval(config))
  File "/nix/store/rgnxp0hjqjj5rwhpniy4cda1xb8n5hxb-python3-3.9.6-env/lib/python3.9/site-packages/nixops_gcp/resources/gce_static_ip.py", line 30, in __init__
    self.config.ip_address = self.config.ipAddress
  File "/nix/store/rgnxp0hjqjj5rwhpniy4cda1xb8n5hxb-python3-3.9.6-env/lib/python3.9/site-packages/nixops/util.py", line 187, in __setattr__
    raise AttributeError(f"{self.__class__.__name__} is immutable")
AttributeError: GceStaticIpOptions is immutable```
zaphar commented 3 years ago

I'm fairly sure this is probably because self.config.ip_address should actually be self.ipAddress but I'm not sure. I can put together a PR for this when I get some time this weekend maybe.