Commit Graph

1515 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
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
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
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
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
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
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
52fd912b45 clan-cli: Fix clan flakes create inside an already existing git repo 2025-02-17 13:23:31 +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
Pablo Ovelleiro Corral
e621aa1a34 Fix locking 2025-02-16 17:08:54 +00:00
Pablo Ovelleiro Corral
d63b4ffbd8 Fix output when rebuilding 2025-02-16 17:08:54 +00:00
Michael Hoang
4e2ae0f9f6 cli: add morph command 2025-02-16 21:31:28 +07:00
Michael Hoang
0d9963c1a6 cli: make some functions only create commits optionally 2025-02-16 21:14:09 +07:00
lassulus
451d865109 cli: nix_add_to_gcroots: don't run in sandboxed tests 2025-02-15 09:59:41 +00:00
lassulus
14f49512ed clan-cli flake caching: fix selectors not merging 2025-02-15 09:59:41 +00:00
lassulus
0767eadb81 clan-cli: hash the flake_hash to remove unwanted character from path 2025-02-15 09:59:41 +00:00
Johannes Kirschbauer
2c0567ca27 Cli: delete machines bugfix. Dont modify the inventory in other places 2025-02-15 09:03:54 +07:00
Johannes Kirschbauer
d8e27b9abf Inventory: init delete api 2025-02-15 09:03:46 +07:00
Qubasa
96134616f9 clan-cli: Make copy_from_nixstore work with single files 2025-02-14 13:28:01 +07:00
Qubasa
ca946408f4 clan-cli: Fix garbled clan vms run output. docs: Improve debugging guide 2025-02-13 16:17:55 +07:00
Qubasa
39657ddb2f clan-cli: Remove flake-registry set to none in get_clan_nix_attrset 2025-02-13 15:47:28 +07:00
Qubasa
64231e45f2 clan-cli: Fix symlink issue with copy_from_nixstore, add test for it. Also add more comprehensive clan template tests 2025-02-13 15:34:21 +07:00