Commit Graph

1928 Commits

Author SHA1 Message Date
Louis Opter
cd248b69db clan-cli: machines delete: delete the machine's vars and secrets
When a machine is deleted with `clan machines delete`, remove its
vars and legacy secrets, and update any secrets that reference the
machine's key.

This command is a superset of `clan secrets machine delete`, and I am
wondering if we could remove the `clan secrets machine` subcommand,
unless there is an use case for having a machine defined without its
key, and any secrets/vars?

Note:

- This deletes the `ListSecretsOptions` dataclass, as it did not seem to
  bring any value, especially since `list_secrets` was receiving its
  individual members instead of the whole dataclass. We can always bring
  it back if complexity grows to demand it.
2025-03-19 10:53:38 +00:00
Louis Opter
f7bec766bc clan-cli: add delete and delete_store to StoreBase
- `delete` lets you delete a specific var under a specific generator;
- `delete_store` deletes an entire store.

The `delete` method could be useful to "garbage-collect" unused vars as
a machine's configuration changes.

The `delete_store` method can be used to delete all the vars for a
machine when the machine is deleted. The current behavior is to leave
everything behind.

Important point:

- `delete_store` needs to be idempotent because public and
  "private"/"secret" vars for a machine can share the same physical
  store (directory), and deleting either type of store (public or
  private) will delete both.
2025-03-19 10:53:38 +00:00
Louis Opter
77b53a366e clan-cli: add an integration test for clan machines delete
This tests the changes made to that command to clean-up vars and secrets
when a machine is deleted.
2025-03-19 10:53:38 +00:00
Louis Opter
37869839cf clan-cli: tests/age_keys.py add notes, move function to check sops recipients
This supports the new integration test for `clan machines delete`.
2025-03-19 10:53:38 +00:00
Jörg Thalheim
b84230ff90 deduplicate CLAN_CORE/CLAN_CORE_PATH environment variables 2025-03-19 10:30:52 +00:00
Qubasa
63a0e5f35d clan-cli: Fix templates not downloading template, Make templates use Flake cache, Fix flake cache exception on conditional attribute, add more tests 2025-03-19 10:30:52 +00:00
Jörg Thalheim
527154070c use pathlib.iterdir() everywhere 2025-03-18 15:34:06 +01:00
Jörg Thalheim
d9c3cc8c68 cli: increase timeout for pytest 2025-03-18 14:04:43 +01:00
Jörg Thalheim
f24d27c895 try to reproduce CI error with newer nix version 2025-03-11 12:23:59 +00:00
Jörg Thalheim
10c89fe9f9 fix only the first generator of each machine beeing re-encrypted 2025-03-11 12:09:00 +01:00
Jörg Thalheim
903831acaf don't log cache miss by default
This is expected and happens regular, so there is no value in logging
this.
2025-03-11 12:03:55 +01:00
Jörg Thalheim
86e8b26409 add test for parsing ssh options 2025-03-11 11:27:04 +01:00
DavHau
af66b63286 clan-cli/tests: limit jobs to 16
This reduces overload on the CI, as it already runs multiple test instances in parallel (with-core, without-core, etc), and otherwise would spawn 96 workers for each of those.
2025-03-10 13:20:18 +00:00
Michael Hoang
d79d1811d6 install: let nixos-anywhere determine where to build automatically
This fixes installing machines that don't have `system` defined i.e.
when running `clan machines install` with `--update-hardware-config`.
2025-03-10 12:30:03 +09:00
DavHau
db2e2e974c vars+facts: use bwrap only if supported 2025-03-09 13:52:15 +07:00
Qubasa
5c4fc7b852 clan-cli: Make Lix compatible again 2025-03-07 14:06:35 +01:00
Qubasa
4c138c6377 clan-cli: Revert generating facts in clan facts list, for consistency 2025-03-03 01:40:40 +01:00
Qubasa
0602b9d01c clan-cli: Fix wrong clan vars generate regression added by 4ff5acfe29 2025-03-02 19:53:17 +01:00
Qubasa
75dc906183 clan-cli: Fix get_all_facts forgetting to generate facts before getting them 2025-03-02 15:07:57 +01:00
Michael Hoang
f0e5b14846 vars/sops: fix clan vars fix missing machine name in error message 2025-03-02 08:22:23 +07:00
Qubasa
a0aaa5fc69 clan-cli: Remove can_build_locally and replace with nixos-anywhere --build-on auto 2025-03-01 17:52:41 +01:00
Qubasa
eb9b4bdb6b clan-cli: Make host upload function support uploading single files too 2025-03-01 17:10:42 +01:00
lassulus
df61afe0d2 clan-cli: try to fix CI bug again 2025-02-28 04:58:42 +00:00
lassulus
669a28c4e5 clan-cli: set ssh port for nix copy 2025-02-28 04:58:42 +00:00
lassulus
0104c41921 clan-cli: another try to fix the CI bug 2025-02-27 08:24:28 +01:00
lassulus
e3ce93a6ff clan-cli: check if paths exist in cache check 2025-02-27 02:53:41 +01:00
Qubasa
ba2865e940 clan-cli: Fix flake.py missing cache eviction if there is a garbage collected path 2025-02-27 01:01:50 +01:00
r17x
e9ffd923d5 fix(clan-cli): fix cross system 2025-02-26 14:27:00 +07:00
Pablo Ovelleiro Corral
8aab746bd0 Apply suggestion 2025-02-25 08:51:51 +01:00
Pablo Ovelleiro Corral
d9e0741329 Fix exists() check for age files 2025-02-25 08:51:51 +01:00
Louis Opter
51a7a86817 clan-cli: add unit tests for test_parse_deployment_address
Follow-up to #2899, more thorough than #2909.
2025-02-25 05:31:49 +00:00
Qubasa
d7c4a5d59d clan-cli: Remove allow_uknown_placeholders flag. With upcoming nixos-anywhere patch this is not needed anymore. 2025-02-23 21:50:21 +01:00
Qubasa
ad3786ad76 clan-cli: Add an optional reference to an AsyncFuture to track origin of task. 2025-02-23 21:44:00 +01:00
lassulus
300aaa48e7 clan-cli: use new flake caching for machines 2025-02-23 15:58:03 +01:00
lassulus
35eaaea68e try to fix profiles CI bug 2025-02-22 03:39:42 +00:00
lassulus
aa98c33d40 machines install: fix installation via tor 2025-02-22 03:39:42 +00:00
lassulus
90bd9217e3 vars fs: fix 2025-02-22 03:39:42 +00:00
lassulus
d171d99923 clan-cli deploy_info: fix find_reachable_host returning unreachable hosts 2025-02-22 03:39:42 +00:00
Denis Rosca
7a28d9274d Add support for XDG_* style directories on macos
Closes #2864
2025-02-22 03:34:56 +00:00
Jörg Thalheim
eb38ea14ce fix regex for detecting git+file inputs 2025-02-20 10:00:04 +07:00
Louis Opter
c689c23d0c clan-cli: "fix" ssh option parsing
Calling it fix in double quotes since that's still quite hand-crafted,
but at least you can now specify options with `@` inside them (e.g.
`ProxyJump`) and have it work properly.

Moreover this fixes the syntax for GET-like variables in the networking
clanCore module. Only the fixed syntax is supported since that's what
was tested, and actually parsed in the code.
2025-02-18 21:37:38 +00:00
Qubasa
2d0bcfe6f6 clan-cli: Fix clan create throwing a warning if --flake is not defined 2025-02-18 17:40:27 +07:00
Qubasa
e3651d0ae0 clan-clI: Improve error message of clan update-hardware-config on non found nixos-facter 2025-02-18 17:40:27 +07:00
Pablo Ovelleiro Corral
f28a38bbb3 Make store-backend configurable 2025-02-18 06:34:50 +01:00
Qubasa
0a41c85871 clan-cli: Re-add test_copy_from_nixstore_symlink test but mark it impure 2025-02-17 14:21:50 +07:00
Qubasa
bc66f8b7de clan-cli: Remove set -x from pytest script 2025-02-17 14:10:22 +07:00
Qubasa
52fd912b45 clan-cli: Fix clan flakes create inside an already existing git repo 2025-02-17 13:23:31 +07:00
Qubasa
892bd25a3a clan-cli: Add CLAN_TEST_STORE env var to clan-pytest-without-core 2025-02-17 13:19:45 +07:00
Michael Hoang
16848ba723 machines: hide morph 2025-02-17 00:22:14 +07:00
Pablo Ovelleiro Corral
0d001e21b9 Create directory 2025-02-16 17:08:54 +00:00