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
Start with types #1233
Start with types #1233
Conversation
Thank you a lot! |
Previously, the nixops-aws plugin was always calling `known_hosts.update(old, new, val)`. As of this commit [1], all arguments to the `update` function must be non-null. While we could modify the `update` function in nixops to have the previous behavior, it makes more sense for us to just call `add` when we mean add, and `remove` when we mean remove. [1] NixOS/nixops#1233
remove(prev_address, public_host_key) | ||
if new_address is not None: | ||
add(new_address, public_host_key) | ||
add(new_address, public_host_key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a heads up, this is a backwards incompatible API change to the function. I think it's a good change, but previously plugins like nixops-aws were calling "update" with None values to mean "remove" or "add". I've fixed nixops-aws by having it call add
or remove
directly, but it may be worth scanning other plugins to see how they're calling update
.
A few commits. The first batch are cleanup-things of lint flags that my editor told me about; the last one is the one that changes business logic.
I added type annotations to nixops/nixops/known_hosts.py.
I haven't tested this at all, as I'm brand new to the repo and to nixos in general. I'm just fairly familiar with working with static type systems. :)
Looking forward to finding what I've broken.