Commit Graph

322 Commits

Author SHA1 Message Date
Qubasa
e982daf9d9 clan_lib: Move load_in_all_api_functions to clan_lib 2025-07-04 14:22:40 +07:00
Qubasa
d4a67eb1a6 clan_lib: Heavily simplified log_manager and test suite to concentrate on actually used features 2025-07-04 14:05:31 +07:00
Qubasa
43e6351a21 clan_lib: Add better docstrings to log_manager 2025-07-04 13:35:34 +07:00
Qubasa
a4964c4c93 clan_lib: expose log_manager with API.register properly 2025-07-04 13:19:09 +07:00
Qubasa
83e4dcf8f7 clan-cli: Print function name to raise for unsupported types by API.register 2025-07-04 13:17:01 +07:00
lassulus
c760561dbd refactor: remove _serialized field and implement efficient vars selection
- Remove _serialized field from vars interface to prevent serialization
  errors with throwing passBackend field
- Implement direct selection of generator fields using multi-select syntax
- Refactor vars_generators() to use new Generator.from_flake() method that
  selects only safe fields (avoiding non-serializable values)
- Remove unused legacy methods: Generator.from_json(), Var.from_json(),
  Prompt.from_json()
- Update precaching to match new selection approach

This fixes the serialization errors that were preventing vars from working
with the new password-store implementation by avoiding the problematic
_serialized field entirely.
2025-07-03 18:53:36 +02:00
lassulus
30bc8cb5d3 flake: prevent outPath in multiselect to avoid serialization issues
When using multiselect with outPath like {outPath,?meta}, nix evaluation
collapses the attrset to just the outPath string, breaking further selection.
Add validation during selector parsing to catch this and provide a clear error.
2025-07-03 18:53:36 +02:00
Qubasa
85670d1dda clan-app: Implement dynamic groups and array based filtering of logs and groups 2025-07-03 17:49:34 +07:00
lassulus
a055b4d1eb refactor: remove deployment.json and use direct selectors
- Remove deployment.json file generation from outputs.nix
- Add throw for deprecated deployment.file usage with upgrade instructions
- Remove vars data from deployment.data
- Update Machine class to use direct select() calls instead of deployment property
- Update all deployment property accesses to use direct selectors
- Add precaching for frequently accessed values in update.py:
  - Module paths for facts and vars
  - Deployment settings (requireExplicitUpdate, nixosMobileWorkaround)
  - Services and generators data
  - Secret upload locations
- This removes unnecessary JSON serialization and makes the code more composable
2025-07-02 20:56:23 +02:00
Johannes Kirschbauer
dfb53deeca cli: fix listing maschines by their name 2025-07-02 18:18:48 +02:00
Mic92
fb3685d721 Merge pull request 'vars: make debug logging less verbose' (#4171) from merge-when-green-joerg into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4171
2025-07-02 11:48:59 +00:00
Jörg Thalheim
d434731c22 clan_lib/test_create: fix test when running outside of the sandbox... 2025-07-02 13:04:46 +02:00
Qubasa
9cf6cecdae clan-app: Add logging middleware 2025-07-02 17:59:05 +07:00
Qubasa
26680bc784 clan-app: simplified task function, moved them to a separate file 2025-07-02 16:18:37 +07:00
Johannes Kirschbauer
8f6f06bef3 Revert "Merge pull request 'Make state-version generation an clan option' (#4056) from state-version-option into main"
This reverts commit 8a7b6d13b5, reversing
changes made to 7a4eeb5b16.
2025-07-01 18:15:11 +02:00
Johannes Kirschbauer
9e8bf61156 clan_lib/tests: add big fat warning comment to save peoples time 2025-07-01 12:30:17 +02:00
pinpox
4709e8e2f6 Remove state-version module from tests 2025-06-30 12:58:05 +02:00
lassulus
cc923d5638 refactor: replace eval_nix/build_nix with machine.select()
- Remove nix(), eval_nix(), and build_nix() methods from Machine class
- Add select() method that handles machine-specific attribute prefixes
- Update all usages to use machine.select() directly
- Handle Path conversion and tmp_store logic at call sites
- This simplifies the Machine API and prepares for deployment.json removal
2025-06-29 17:00:27 +02:00
Jörg Thalheim
8fc67d00e3 select: drop unused --impure flag 2025-06-27 19:30:45 +02:00
Jörg Thalheim
6e8581189e select: use nix_options copy 2025-06-27 19:30:45 +02:00
Jörg Thalheim
ad69b0a567 select: drop unused nixpkgs fallback 2025-06-27 19:30:45 +02:00
Jörg Thalheim
1e6ceac2bd don't keep appending --impure to nix_options when running tests 2025-06-27 18:54:13 +02:00
Jörg Thalheim
6ae6f48586 select: disable remote building and substitution
this should make things faster since the derivation itself is trivial.
2025-06-27 13:37:16 +02:00
a-kenji
5a81adfc68 pkgs/clan: Add machine validator with suggestion logic
Add machine validator with suggestion logic to:
- `clan machines update`
- `clan machines delete`
- `clan machines update-hardware-config`
2025-06-27 12:32:36 +02:00
Johannes Kirschbauer
66ee74e193 schema: update clan option source 2025-06-26 13:24:34 +02:00
Qubasa
43df077dda clan-app: Add a 'group' to log_manager. Move log_manager to own subdirectory 2025-06-24 21:42:18 +02:00
Qubasa
cb2097c1e5 clan-cli: Remove unecessary nix_options args from functions 2025-06-24 19:07:41 +02:00
Qubasa
cd1d49b603 clan-lib: Move nix_options from Machine class to Flake class 2025-06-24 19:03:20 +02:00
Luis Hebendanz
20080f8857 Merge pull request 'Move update.py to clan_lib/machines part 4' (#4073) from Qubasa/clan-core:move_to_clan_lib6 into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4073
2025-06-24 14:52:10 +00:00
Luis Hebendanz
2ec23b96cf Merge pull request 'Move delete.py to clan_lib/machines part 3' (#4069) from Qubasa/clan-core:move_to_clan_lib5 into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4069
2025-06-24 14:51:19 +00:00
Luis Hebendanz
d477018e72 Merge pull request 'Move list.py to clan_lib/machines part 2' (#4068) from Qubasa/clan-core:move_to_clan_lib4 into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4068
2025-06-24 14:51:06 +00:00
pinpox
7fc8776742 Merge branch 'main' into machine-id-option 2025-06-24 11:12:24 +00:00
Qubasa
6e4dc03b1d clan-cli: Move update.py to clan_lib/machines 2025-06-24 12:17:21 +02:00
Qubasa
2bfc33bc31 clan-cli: Move delete.py to clan_lib/machines 2025-06-24 12:16:38 +02:00
Qubasa
21b0c00c05 clan-cli: Move list.py to clan_lib/machines 2025-06-24 12:16:38 +02:00
Qubasa
d65bdb30eb clan-cli: Move morph.py to clan_lib/machines 2025-06-24 12:16:38 +02:00
DavHau
7745e9eec6 inventory interface: add description for module.name 2025-06-24 10:09:05 +00:00
Qubasa
ded7f0eb39 clan-cli: Move list.py to clan_lib/machines 2025-06-24 11:57:02 +02:00
pinpox
b0575e79e1 Merge branch 'main' into machine-id-option 2025-06-24 09:41:42 +00:00
Qubasa
f09656bbf6 clan-cli: Move delete.py to clan_lib/machines 2025-06-24 11:37:21 +02:00
Qubasa
0451f917ed clan-cli: Move list.py to clan_lib/machines 2025-06-24 11:32:42 +02:00
Qubasa
20822c932d clan-cli: Move morph.py to clan_lib/machines 2025-06-24 11:24:38 +02:00
Qubasa
168e1d8c96 clan-cli: Move hardware.py to clan_lib/machines 2025-06-24 11:07:37 +02:00
pinpox
d88ac429cb Make machine ID a option 2025-06-24 10:42:03 +02:00
hsjobeki
29199e96da Merge pull request 'Feat(inventory): simplify instance module spec, by applying a default' (#4054) from hsjobeki/module-default into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4054
2025-06-23 14:21:55 +00:00
Johannes Kirschbauer
1ceec8ba8a Chore(classes): update classes 2025-06-23 16:11:12 +02:00
Qubasa
071151f300 clan-lib: Rename parse_deployment_address to parse_ssh_uri 2025-06-23 15:32:35 +02:00
Qubasa
255f2da358 clan-lib: Remove override args from parse_deployment_address, instead use the Remote.override method where necessary 2025-06-23 15:28:22 +02:00
Qubasa
054ea67fb7 clan-cli: Simplify HostKeyCheck to a Literal instead of an Enum 2025-06-23 15:08:44 +02:00
Qubasa
65bb9021de clan-cli: Move clan_cli/ssh/host_key.py to clan_lib/ssh 2025-06-23 15:07:18 +02:00