Skip to content
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

nixos/rspamd: Allow worker type to be proxy again #51012

Merged
merged 1 commit into from Nov 25, 2018

Conversation

griff
Copy link
Contributor

@griff griff commented Nov 25, 2018

Motivation for this change

When reworking the rspamd workers I disallowed proxy as a type and
instead used rspamd_proxy which is the correct name for that worker
type. That change breaks peoples existing config and so I have made this
commit which allows proxy as a worker type again but makes it behave
as rspamd_proxy and prints a warning if you use it.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Eventually I'd like to implement a warning and assertion system into the module system directly, so it should be easier to issue warnings from submodules.

@griff
Copy link
Contributor Author

griff commented Nov 25, 2018

@infinisil if you need help building that I am willing.

@@ -144,9 +158,10 @@ let
${concatStringsSep "\n" (mapAttrsToList (name: value: let
includeName = if name == "rspamd_proxy" then "proxy" else name;
tryOverride = if value.extraConfig == "" then "true" else "false";
type = if value.type == "proxy" then "rspamd_proxy" else value.type;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using apply in the option declaration instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohhh nice, would be a lot easier. Would need a builtins.trace in it though and couldn't use the NixOS warnings options, but that's fine by me.

Copy link
Contributor Author

@griff griff Nov 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mostly didn't use apply in order to use config.warnings which seems the standard way of handling warnings.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll argue that having so much code just for this is not worth it just for being more conventional. And actually I think that other modules are also not using config.warnings for submodules for the same reason.

When reworking the rspamd workers I disallowed `proxy` as a type and
instead used `rspamd_proxy` which is the correct name for that worker
type. That change breaks peoples existing config and so I have made this
commit which allows `proxy` as a worker type again but makes it behave
as `rspamd_proxy` and prints a warning if you use it.
@griff
Copy link
Contributor Author

griff commented Nov 25, 2018

Commit has now been rewritten to use apply instead of config.warnings

@infinisil infinisil merged commit b5f4f22 into NixOS:master Nov 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants