Commit Graph

596 Commits

Author SHA1 Message Date
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
DavHau
64d29cd28c vars: improve check command and add tests 2024-09-01 16:45:09 +02:00
DavHau
b627eafc80 vars: fix listing vars + add test 2024-09-01 16:10:25 +02:00
DavHau
04010bba90 vars: implement listing all vars 2024-09-01 16:03:37 +02:00
DavHau
62ccd0ed4b vars: introduce deploy=true/false for generated files 2024-09-01 14:32:46 +02:00
Jörg Thalheim
969eb2f16e fix users in VM again 2024-08-24 19:19:24 +02:00
DavHau
238fae500d vars: add deploy test for shared generators 2024-08-23 17:36:33 +02:00
DavHau
f0a3eaca96 Reapply + Fix "vars: fix - upload machines own secrets only"
This reverts commit cb860f9a03.
2024-08-23 15:42:46 +02:00
clan-bot
68c25d6aeb Merge pull request 'Clan-app: install machine' (#1954) from hsjobeki/clan-core:hsjobeki-main into main 2024-08-22 08:21:10 +00:00
Johannes Kirschbauer
b7d0314826 API: serde fix nullable fields should be allowed to be none 2024-08-21 17:53:25 +02:00
Qubasa
19fe0432d9 clan-cli: Fix some type errors in tests 2024-08-21 15:48:43 +02:00
Qubasa
f74df54edd clan-vm-manager: Fix regression 2024-08-21 15:48:43 +02:00
Mic92
3710175785 Merge branch 'main' into rework-installation 2024-08-21 13:28:29 +00:00
Jörg Thalheim
a72498fe2c capture_output: only start capturing when we enter the with statement 2024-08-21 15:16:46 +02:00