Commit Graph

609 Commits

Author SHA1 Message Date
Jörg Thalheim
c33b2b200a vms/run: don't use deprecated clanCore option 2024-10-08 17:51:55 +00:00
Jörg Thalheim
b1b05485dd introduce better vm management abstraction and use it in tests 2024-10-08 17:51:55 +00:00
Jörg Thalheim
0a568be528 pass in flakeid to vm_state_dir 2024-10-08 17:51:55 +00:00
Qubasa
99c5bd2b50 clan-cli: Add --host-key-check to machine update 2024-10-05 23:33:44 +02: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
9c25b4d61c error if we cannot load a dataclass from file 2024-10-04 15:36:30 +00:00
DavHau
11c37ebeba vars/keygen: fix + cleanup tests
- generate keys in ./sops instead of ./sops/vars for now
- don't initialize all flakes with sops keys, only generate when needed
- use the new 'clan vars keygen' in tests
2024-10-04 17:25:17 +02:00
DavHau
2a9ced1e26 vars: add 'clan vars keygen' 2024-10-04 16:13:49 +02:00
Jörg Thalheim
ca8f36201b test superflous test_vm_qmp
we already have other tests covering this and VMs + NixOS are slow
2024-10-01 20:57:07 +02:00
Jörg Thalheim
27b1aeb827 add temp_dir fixture 2024-10-01 20:54:19 +02:00
Jörg Thalheim
8b205c78bf fix resource leaks in qmp tests 2024-10-01 20:54:19 +02:00
Jörg Thalheim
f9a42831e4 start to name temporary directories in more places 2024-10-01 18:57:59 +02:00
Qubasa
a27880a65e clan-cli: Move clan machines import to clan machines create 2024-09-23 17:11:48 +02:00
DavHau
e49d1f0127 vars/sops: improve shared secrets, switching backend
When a second machine checks for a shared secret, now the exists() call returns negative and only when updating the secrets for that machine, the machine is added to the sops receivers.

Also throw proper errors when the user switches backends without cleaning the files first.
2024-09-20 15:06:54 +02:00
DavHau
0a8b7f38a8 vars: implement migration
Migrating generated files from the facts subsystem to the vars subsystem is now possible.

HowTo:
1. declare `clan.core.vars.generators.<generator>.migrateFact = my_service` where `my_service` refers to a service from `clan.core.facts.services`
2. run `clan vers generate your_machine` or `clan machines update your_machine`

Vars will only be migrated for a generator if:
1. The facts service specified via `migrateFact` does exist
2. None of the vars to generate exist yet
3. All public var names exist in the public facts store
4. All secret var names exist in the secret fact store

If the migration is deemed possible, the generator script will not be executed. Instead the files from the public or secret facts store are read and stored into the corresponding vars store
2024-09-19 17:57:03 +02:00
DavHau
01c833f2bc vars/generate: improve output when vars are updated
fixes #2076

- print old and new value if possible
- also inform the user if something hasn't changed
2024-09-18 16:57:01 +02:00
DavHau
6fc27d402b vars: allow setting a default for values 2024-09-17 21:11:38 +02:00
DavHau
bd79e6aef6 vars: generate proper commit messages
fixes #2126
2024-09-17 20:22:18 +02:00
DavHau
51bf3187d7 vars/tests: fix nix eval triggering git concurrent access
Prevents this error: Another git process seems to be running in this repository
2024-09-16 18:58:22 +02:00
Qubasa
e9bfb129a1 clan-cli: Init clan machines import 2024-09-16 18:15:55 +02:00
Johannes Kirschbauer
dc57c3d948 CLI: api.register type preservation 2024-09-16 12:52:28 +00:00
Johannes Kirschbauer
813172119e API: rename set_inventory 2024-09-13 16:11:10 +02:00
DavHau
81cb28b6c0 vars/sops/shared: add machines key on demand 2024-09-12 20:17:05 +02:00
clan-bot
65a1a1a3b8 Merge pull request 'API: remove all python dataclasses for clanModules (services)' (#2080) from hsjobeki/clan-core:hsjobeki-main into main 2024-09-12 16:37:51 +00:00
DavHau
eafcb0f870 vars/list: display '<not set>' also for secrets 2024-09-12 17:24:29 +02:00
Johannes Kirschbauer
e3d85fc2b8 API: type all services with dict[str,Any] in python to reduce complexity. 2024-09-12 16:19:51 +02:00
a-kenji
6dd1a7395f vars: use correct paths for value accesses
Use correct paths for value accesses of vars under:

- `per-machine`
- `shared`
2024-09-11 19:02:43 +02:00
DavHau
0893b04458 vars/password-store: use standard paths; fix share flag 2024-09-09 21:20:03 +02:00
DavHau
803f43dfd1 vars: improve generator pipeline
Compute the whole closure of to-be-executed generators upfront before executing anything

Properly compute closures for the 4 different scenarios:

1. full_closure: run all generators for a selected machine in topological order
2. all_missing_closure: run just the missing generators including their dependents
3. requested_closure: run only a selected list of generators including their missing dependencies and their dependents
4. minimal_closure: Run just enough to ensure that the list of selected generators are in a consistent state. Don't execute anything if nothing is missing.
2024-09-06 21:32:17 +02:00
Qubasa
2568002611 clan-cli: Make run_vm_in_thread fail fast. Fix generate_flake to support machine_id 2024-09-06 18:53:02 +02:00
Qubasa
4171d5ea4e clanCore: init machine_id.nix with clan.core.machine.{id,diskId} 2024-09-06 18:05:40 +02:00
DavHau
5cd9960ed4 vars: improve generator execution pipeline
- ensure all dependents are re-generated as well
- refactor: separate out computation of generator update closure
2024-09-06 14:30:49 +02:00
DavHau
a57525d5c6 vars: add api endpoint set_prompts 2024-09-04 18:06:11 +02:00
DavHau
ed1738c0cd vars: add get_prompts api endpoint
vars: add test for api endpoint get_prompts
2024-09-04 17:36:50 +02:00
DavHau
dc4fcb7329 vars: new option prompts.<name>.createFile 2024-09-04 15:48:10 +02:00
Jörg Thalheim
5ac3ac63c2 get rid of ValueError 2024-09-03 18:14:31 +02:00
Jörg Thalheim
29909e49d3 apply TRY lint 2024-09-03 18:13:46 +02:00
Johannes Kirschbauer
caad48682d serde/fix: round trip string sanitizing 2024-09-03 18:03:13 +02:00
Jörg Thalheim
1fa0e72bea use pathlib everywhere 2024-09-02 18:26:13 +02:00
Jörg Thalheim
483d8ce521 add SIM lint 2024-09-02 16:39:30 +02:00
Jörg Thalheim
cb16cda3fa add RET, Q, RSE lint 2024-09-02 15:58:49 +02:00
Jörg Thalheim
dca1bd084d add PT 2024-09-02 15:52:17 +02:00
Jörg Thalheim
8fbc76ecac add FA, ICN, ISC, LOG, PIE and PYI linting 2024-09-02 15:41:56 +02:00
Jörg Thalheim
e150b37fb8 enable ASYNC, DTZ, YTT and EM lints 2024-09-02 14:07:06 +02:00
Jörg Thalheim
22d6e5e153 enable comprehensions linting rules 2024-09-02 13:35:52 +02:00
Jörg Thalheim
109d1faf9e enable bug-bear linting rules 2024-09-02 13:26:07 +02:00
Jörg Thalheim
b24cbb18b7 fix all typing error in tests 2024-09-02 12:23:13 +02:00