mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
programs.rclone: fix injecting secret when value begins with "-"
This commit is contained in:
parent
4896177e2c
commit
e44549074a
3 changed files with 12 additions and 8 deletions
|
|
@ -259,7 +259,7 @@ in
|
||||||
|
|
||||||
if ! ${lib.getExe cfg.package} config update \
|
if ! ${lib.getExe cfg.package} config update \
|
||||||
${remote.name} config_refresh_token=false \
|
${remote.name} config_refresh_token=false \
|
||||||
${secret} "$(cat "${secretFile}")" \
|
${secret}="$(cat "${secretFile}")" \
|
||||||
--non-interactive; then
|
--non-interactive; then
|
||||||
echo "Failed to inject secret \"${secretFile}\""
|
echo "Failed to inject secret \"${secretFile}\""
|
||||||
cleanup
|
cleanup
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ in
|
||||||
imports = [
|
imports = [
|
||||||
./no-secrets.nix
|
./no-secrets.nix
|
||||||
./with-secrets-in-store.nix
|
./with-secrets-in-store.nix
|
||||||
./secrets-with-whitespace.nix
|
./secrets-arbitrary-characters.nix
|
||||||
./no-type.nix
|
./no-type.nix
|
||||||
./mount.nix
|
./mount.nix
|
||||||
./shell.nix
|
./shell.nix
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
let
|
let
|
||||||
module = pkgs.writeText "secrets-with-whitespace-module" ''
|
module = pkgs.writeText "secrets-arbitrary-characters-module" ''
|
||||||
{
|
{
|
||||||
programs.rclone.remotes = {
|
programs.rclone.remotes = {
|
||||||
alices-cool-remote-v3 = {
|
alices-cool-remote-v3 = {
|
||||||
|
|
@ -8,25 +8,29 @@ let
|
||||||
type = "memory";
|
type = "memory";
|
||||||
description = "alices speeedy remote";
|
description = "alices speeedy remote";
|
||||||
};
|
};
|
||||||
secrets.spaces-secret = "${pkgs.writeText "secret" ''
|
secrets = {
|
||||||
This is a secret with spaces, it has single spaces, and lots of spaces :3
|
spaces-secret = "${pkgs.writeText "secret" ''
|
||||||
''}";
|
This is a secret with spaces, it has single spaces, and lots of spaces :3
|
||||||
|
''}";
|
||||||
|
symbols-secret = "${pkgs.writeText "secret" "-x'$$*>\"+:&#{!@'"}";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
expected = pkgs.writeText "secrets-with-whitespace-expected" ''
|
expected = pkgs.writeText "secrets-arbitrary-characters-expected" ''
|
||||||
[alices-cool-remote-v3]
|
[alices-cool-remote-v3]
|
||||||
description = alices speeedy remote
|
description = alices speeedy remote
|
||||||
type = memory
|
type = memory
|
||||||
spaces-secret = This is a secret with spaces, it has single spaces, and lots of spaces :3
|
spaces-secret = This is a secret with spaces, it has single spaces, and lots of spaces :3
|
||||||
|
symbols-secret = -x'$$*>"+:&#{!@'
|
||||||
|
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
script = ''
|
script = ''
|
||||||
with subtest("Secrets with spaces"):
|
with subtest("Secrets with arbitrary characters"):
|
||||||
succeed_as_alice("install -m644 ${module} /home/alice/.config/home-manager/test-remote.nix")
|
succeed_as_alice("install -m644 ${module} /home/alice/.config/home-manager/test-remote.nix")
|
||||||
|
|
||||||
actual = succeed_as_alice("home-manager switch")
|
actual = succeed_as_alice("home-manager switch")
|
||||||
Loading…
Add table
Add a link
Reference in a new issue