stash
This commit is contained in:
parent
6d2c506439
commit
bb68104097
|
@ -38,9 +38,9 @@
|
||||||
];
|
];
|
||||||
generator.script = ''
|
generator.script = ''
|
||||||
if [[ -n $prompt_value ]]; then
|
if [[ -n $prompt_value ]]; then
|
||||||
echo $prompt_value > $secrets/user-password
|
echo $prompt_value | tr -d '\n' > $secrets/user-password
|
||||||
else
|
else
|
||||||
xkcdpass --numwords 3 --delimiter - --count 1 > $secrets/user-password
|
xkcdpass --numwords 3 --delimiter - --count 1 | tr -d '\n' > $secrets/user-password
|
||||||
fi
|
fi
|
||||||
cat $secrets/user-password | mkpasswd -s -m sha-512 > $secrets/user-password-hash
|
cat $secrets/user-password | mkpasswd -s -m sha-512 > $secrets/user-password-hash
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -93,9 +93,11 @@ def test_generate_secret(
|
||||||
assert is_valid_ssh_key(ssh_secret, ssh_pub)
|
assert is_valid_ssh_key(ssh_secret, ssh_pub)
|
||||||
|
|
||||||
pwd_secret = decrypt_secret(test_flake_with_core.path, "vm1-password")
|
pwd_secret = decrypt_secret(test_flake_with_core.path, "vm1-password")
|
||||||
|
# remove last newline
|
||||||
|
pwd_secret = pwd_secret[:-1]
|
||||||
assert pwd_secret.isprintable()
|
assert pwd_secret.isprintable()
|
||||||
assert pwd_secret.isascii()
|
assert pwd_secret.isascii()
|
||||||
assert not pwd_secret.endswith("\n")
|
|
||||||
|
|
||||||
# test idempotency for vm1 and also generate for vm2
|
# test idempotency for vm1 and also generate for vm2
|
||||||
cli.run(["facts", "generate", "--flake", str(test_flake_with_core.path)])
|
cli.run(["facts", "generate", "--flake", str(test_flake_with_core.path)])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user