Commit Graph

2571 Commits

Author SHA1 Message Date
Johannes Kirschbauer
512f7294e6 lib/convert_inventory_to_machines: add classmethod for common conversion of Machine and InventoryMachine 2025-07-04 10:18:14 +02:00
Johannes Kirschbauer
2e38b314ad lib/get_host: improve abstraction, turn missconfiguration into a warning
Motivation: A warning should encourage consistent usage of inventory.machines setting targetHost inside the machine should be considered a custom override

Changing the warning strings to avoid the term 'nix'/'json' both inventory and nixos machines are nix features
2025-07-04 10:02:06 +02:00
Johannes Kirschbauer
41cafe828f Clan_lib: add filtering by tag to list API 2025-07-04 09:48:21 +02:00
Johannes Kirschbauer
b0c24edd48 cli: move some references to duplicate list machines 2025-07-04 09:32:43 +02:00
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
DavHau
67a37a9d2c reverting b1f71fe4fb 2025-07-04 10:35:30 +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
9932f170ca machines/update: queue update only for machines_to_update 2025-07-02 19:05:37 +02:00
Johannes Kirschbauer
b1f71fe4fb clan.deployment: unify deprecated option 2025-07-02 18:37:29 +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
Luis Hebendanz
412602161c Merge pull request 'clan-app: Init machine based API logging' (#4133) from Qubasa/clan-core:improve_ui_logs into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4133
2025-07-02 11:30:22 +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
721941031e clan-cli: api.py add python header 2025-07-02 17:59:24 +07:00
Qubasa
9cf6cecdae clan-app: Add logging middleware 2025-07-02 17:59:05 +07:00
Johannes Kirschbauer
e6b163cb7a pytest: improve logging a bit 2025-07-02 12:35:02 +02:00
Qubasa
26680bc784 clan-app: simplified task function, moved them to a separate file 2025-07-02 16:18:37 +07:00
Johannes Kirschbauer
12730428bb test: enable unsafe teardown of tempDir
aarch64 libc or kernel might be stricter in keeping files locked while they're open.
This causes failed teardown of the tmpdir
2025-07-02 09:27:05 +02: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
Jörg Thalheim
41862ef3d3 vars: make debug logging less verbose 2025-07-01 15:04:03 +02:00
hsjobeki
bacff5c49f Merge pull request 'clan_lib/tests: add big fat warning comment to save peoples time' (#4168) from test-1+ into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4168
2025-07-01 11:19:13 +00:00
Johannes Kirschbauer
9e8bf61156 clan_lib/tests: add big fat warning comment to save peoples time 2025-07-01 12:30:17 +02:00
Johannes Kirschbauer
667cee0f6e buildClan: replace all usages by lib.clan 2025-07-01 11:56:31 +02:00
Johannes Kirschbauer
4f496a84f9 clanLib: remove select 2025-06-30 16:14:01 +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
Qubasa
863aa9029c Revert "Cleanup templates"
This reverts commit 77d8f76eb8.
2025-06-28 22:42:39 +07:00
Qubasa
2b5f20c4f4 Revert "templates/minimal: consistent input names"
This reverts commit 8ab9556a12.
2025-06-28 22:42:20 +07:00
Qubasa
1be70856d5 Revert "tests/create_clan: bring back read,write checks"
This reverts commit f6cad7c4a4.
2025-06-28 22:42:11 +07:00
Qubasa
9f1482e539 Revert "templates: fix tests"
This reverts commit df598275f9.
2025-06-28 22:41:31 +07:00
Qubasa
ab872711c8 Revert "templates: remove .clan-flake"
This reverts commit 14eb541256.
2025-06-28 22:40:55 +07:00
Mic92
15eec31684 Merge pull request 'drop more dependencies from pytest' (#4131) from speed-up-vars-check into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4131
2025-06-28 07:42:01 +00:00
Jörg Thalheim
4704fff151 drop more dependencies from pytest 2025-06-28 09:27:34 +02:00
Mic92
a73f91c162 Merge pull request 'don't keep appending --impure to nix_options when running tests' (#4128) from speed-up-flake-select into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4128
2025-06-28 07:26:16 +00:00
Jörg Thalheim
aba15d517f consolidate clan-lib/clan-cli pytest into one test derivation
Than we can re-use test pytest worker better and it's less complex.
2025-06-28 09:11:14 +02:00
Jörg Thalheim
784828f966 drop virtviwer from testRuntimeDependencies 2025-06-28 09:11:14 +02:00
Jörg Thalheim
581dfeffeb fix unlocked flake.lock in tests 2025-06-28 08:50:41 +02:00
Johannes Kirschbauer
181d44e83c machines/create: fix handle defaults 2025-06-27 20:28:11 +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
hsjobeki
b88e55364a Merge pull request 'Update clan templates' (#4099) from update-templates-services into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4099
2025-06-27 17:25:22 +00:00
Johannes Kirschbauer
14eb541256 templates: remove .clan-flake 2025-06-27 19:14:21 +02:00