mirror of
https://github.com/NixOS/nix.git
synced 2025-02-16 17:02:28 +00:00
Merge pull request #10427 from lf-/jade/fix-nix-doctor
"but doctor, I AM the untrusted store": nix doctor had wrong trustedness
This commit is contained in:
commit
c749c115ab
@ -145,10 +145,14 @@ struct CmdConfigCheck : StoreCommand
|
||||
|
||||
void checkTrustedUser(ref<Store> store)
|
||||
{
|
||||
std::string_view trusted = store->isTrustedClient()
|
||||
? "trusted"
|
||||
: "not trusted";
|
||||
checkInfo(fmt("You are %s by store uri: %s", trusted, store->getUri()));
|
||||
if (auto trustedMay = store->isTrustedClient()) {
|
||||
std::string_view trusted = trustedMay.value()
|
||||
? "trusted"
|
||||
: "not trusted";
|
||||
checkInfo(fmt("You are %s by store uri: %s", trusted, store->getUri()));
|
||||
} else {
|
||||
checkInfo(fmt("Store uri: %s doesn't have a notion of trusted user", store->getUri()));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
source common.sh
|
||||
|
||||
store_uri="ssh://localhost?remote-store=$TEST_ROOT/other-store"
|
||||
|
||||
# Check that store info trusted doesn't yet work with ssh://
|
||||
nix --store ssh://localhost?remote-store=$TEST_ROOT/other-store store info --json | jq -e 'has("trusted") | not'
|
||||
nix --store "$store_uri" store info --json | jq -e 'has("trusted") | not'
|
||||
|
||||
# Suppress grumpiness about multiple nixes on PATH
|
||||
(nix --store "$store_uri" doctor || true) 2>&1 | grep "doesn't have a notion of trusted user"
|
||||
|
@ -13,6 +13,8 @@ startDaemon
|
||||
if isDaemonNewer "2.15pre0"; then
|
||||
# Ensure that ping works trusted with new daemon
|
||||
nix store info --json | jq -e '.trusted'
|
||||
# Suppress grumpiness about multiple nixes on PATH
|
||||
(nix doctor || true) 2>&1 | grep 'You are trusted by'
|
||||
else
|
||||
# And the the field is absent with the old daemon
|
||||
nix store info --json | jq -e 'has("trusted") | not'
|
||||
|
Loading…
Reference in New Issue
Block a user