Merged
Conversation
In commit d43dc68, @Mic92 split the rootpw option to allow specifying it in a file kept outside the Nix store, as an alternative to specifying the password directly in the config. Prior to that, rootpw's type was `str`, but in order to allow both alternatives, it had to become `nullOr str` with a default of `null`. So I can see why this assertion, that either rootpw or rootpwFile are specified, makes sense to add here. However, these options aren't used if the configDir option is set, so as written this assertion breaks valid configurations, including the configuration used by nixos/tests/ldap.nix. So this patch fixes the assertion so that it doesn't fire if configDir is set.
10 tasks
abbradar
approved these changes
Jul 15, 2019
Member
abbradar
left a comment
There was a problem hiding this comment.
Seems a simple fix; I'll merge this in several days provided noone else who actually uses OpenLDAP jumps in.
| { | ||
| assertion = cfg.rootpwFile != null || cfg.rootpw != null; | ||
| message = "Either services.openldap.rootpw or services.openldap.rootpwFile must be set"; | ||
| assertion = cfg.configDir != null || cfg.rootpwFile != null || cfg.rootpw != null; |
Member
There was a problem hiding this comment.
Can be written as cfg.configDir == null -> cfg.rootpwFile != null || cfg.rootpw != null for more clarity, but that's completely not important.
Contributor
Author
There was a problem hiding this comment.
Thanks for reviewing! I think that was how I wrote it originally and I found it more confusing that way. Maybe it's just confusing no matter how it's written. 😓
Member
|
BTW what was the test that you mentioned failed before this PR? |
Contributor
Author
|
The LDAP tests failed during nix-instantiate when I ran: nix-build nixos/release.nix -A tests.ldap.x86_64-linuxThe configuration there trips the assertion as it's currently written. |
Member
|
@GrahamcOfBorg test ldap |
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation for this change
In commit d43dc68, @Mic92 split the rootpw option to allow specifying it in a file kept outside the Nix store, as an alternative to specifying the password directly in the config.
Prior to that, rootpw's type was
str, but in order to allow both alternatives, it had to becomenullOr strwith a default ofnull. So I can see why this assertion, that either rootpw or rootpwFile are specified, makes sense to add here.However, these options aren't used if the configDir option is set, so as written this assertion breaks valid configurations, including the configuration used by nixos/tests/ldap.nix.
So this patch fixes the assertion so that it doesn't fire if configDir is set.
Things done
sandboxinnix.confon non-NixOS)nix-shell -p nix-review --run "nix-review wip"./result/bin/)nix path-info -Sbefore and after)