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.87k stars 364 forks source link

modify statedict: enable storing dict via json.dump #1410

Closed lukebfox closed 4 years ago

lukebfox commented 4 years ago

attr_property has the ability to set state for attributes created with the "json" type with values of the list or dict type. https://github.com/NixOS/nixops/blob/a287225018ced729d7fcf0858ed4fab2d7131c56/nixops/util.py#L487-L488 The diff engine uses the newer StateDict, which has it's own setter for state. https://github.com/NixOS/nixops/blob/78a88155f1d9e935a2f73e61db4e77093a4a4b54/nixops/state.py#L31-L37 The nixops-aws VPC resources which motivated the diff engine never had a dict case, so I guess it was left out, but it's important to keep this functionality for other resources which want to use the diff engine in the future (I am working on some).