Commit Graph

32 Commits

Author SHA1 Message Date
Louis Opter
36a54ead12 clan-cli: improve tests on clan secrets …
When users or groups are updated :

- Check that keys are properly updated on sops secrets;
- Check that no dangling symlinks are left behind in sops secrets.

And when an user is removed from the clan, check that it is removed from
the groups it belonged to.

This doesn't check this works for vars explicitly, since they share the
same logic, see `secret_paths.extend(list_vars_secrets(flake_dir))` in
commit f2856cb773.

Those improvements allow us to validate that #2659 is indeed fixed, and
tell us that we need to make the same kind of fixes for machines and
groups. For groups this is straightforward, and for machines, when one
is deleted, I wanna discuss first whether we want to delete all its
secrets as well.
2025-02-04 03:13:20 +00:00
Jörg Thalheim
1666513e91 Revert "Merge pull request 'Revert "Merge pull request 'clan-cli: secrets: Add support for PGP keys with sops-nix' (#2186) from lopter/clan-core:lo-sops-nix-pgp-support into main"' (#2202) from revert into main"
This reverts commit a5496e8db0, reversing
changes made to 9bb1aef245.
2024-10-04 16:36:35 +00:00
Jörg Thalheim
084ebf9edc Revert "Merge pull request 'clan-cli: secrets: Add support for PGP keys with sops-nix' (#2186) from lopter/clan-core:lo-sops-nix-pgp-support into main"
This reverts commit 5668fd05a0, reversing
changes made to dd17fbdc6d.

Reverting for now as Dave's recent change conflicts with this change.
2024-10-04 17:54:29 +02:00
Louis Opter
81f162d4e6 Update tests for clan secrets 2024-10-04 15:36:30 +00:00
Jörg Thalheim
5d87bc2435 secrets/show: pretty print json 2024-10-04 15:36:30 +00:00
Jörg Thalheim
483d8ce521 add SIM lint 2024-09-02 16:39:30 +02:00
Jörg Thalheim
dca1bd084d add PT 2024-09-02 15:52:17 +02:00
Jörg Thalheim
e150b37fb8 enable ASYNC, DTZ, YTT and EM lints 2024-09-02 14:07:06 +02:00
Jörg Thalheim
609b208d91 fix remaining places not using captured_output 2024-08-15 19:57:08 +02:00
Jörg Thalheim
223b97d665 use capture in more places 2024-08-15 19:20:01 +02:00
DavHau
4898706480 clan-cli: simplify cli helper 2024-07-10 18:14:06 +07:00
DavHau
336e99b2a7 clan-cli tests: remove dynamic inclusion of helpers module
Dynamically extending the python path at runtime is bad for developer experience, as this is not understood by the text editor and therefore jump to definition etc. does not work.

-> Better to remove the dynamic inclusion and force developers to specify the import correctly.
2024-07-05 16:38:22 +07:00
Jörg Thalheim
d002419ae7 drop global argparse flags
They get shadowed by subargparser options.
2024-05-29 10:21:35 +02:00
Jörg Thalheim
00704e9e55 re-encrypt secrets after rotating users/machines keys 2024-03-25 12:34:29 +01:00
Jörg Thalheim
dd98cac94e secret cli: accept a pattern in secrets list 2024-02-22 14:21:53 +01:00
Jörg Thalheim
6f0722c692 modernisation for python 3.11 2023-11-29 13:29:45 +00:00
lassulus
efafe6f0e3 clan-cli secrets: flake_name -> flake_dir 2023-11-05 16:58:48 +01:00
Qubasa
d96ea61243 Secrets tests passing. nix fmt doesn't complain 2023-10-27 19:18:45 +02:00
Qubasa
1631dc631b Improved test logging with frame inspection 2023-10-27 19:18:45 +02:00
Qubasa
7bbadaa60f Fixed cyclic dependencie AND swapped pytest-parallel for pytest-xdist to fix deadlock in tests 2023-10-27 19:18:45 +02:00
Jörg Thalheim
c5b0787034 also test that updating a group works 2023-10-03 16:15:36 +00:00
Jörg Thalheim
87f0b090ef cli: rename clan_flake to test_flake 2023-09-15 12:36:16 +02:00
Jörg Thalheim
02f421546c rename machine_flake back to clan_flake 2023-09-14 17:06:07 +02:00
Jörg Thalheim
2048ffccb0 drop clan_flake fixture 2023-09-14 16:57:48 +02:00
Jörg Thalheim
17af763ad1 add edit flag to secret cli 2023-09-13 10:52:03 +02:00
Jörg Thalheim
c3ccf68007 only list valid secrets/users/machines
Git often leaves empty directories behind
2023-09-07 12:48:34 +02:00
Jörg Thalheim
e6762d8b3f sops: add explicit commands to generate secrets 2023-09-07 11:41:20 +02:00
Jörg Thalheim
949b72bd0b actual implement secret rename function 2023-09-03 11:03:14 +02:00
Jörg Thalheim
af38408a3e secret cli: add get command that returns the key of users/machines 2023-08-30 11:30:57 +02:00
Jörg Thalheim
672e760e2a replace mock_env with monkeypatch 2023-08-26 11:45:09 +02:00
Jörg Thalheim
d600a927ea tests: generalize secret cli parser to work for all cli commands 2023-08-24 18:28:33 +02:00
Jörg Thalheim
d977499ffe rename cli tests to have a common suffix
rename test_import_sops -> test_import_sops
2023-08-09 15:54:27 +02:00