Qubasa
74f853bd7c
clan-cli: Add a clan machines generations command
...
improvements
stash
2025-09-18 15:18:33 +02:00
Qubasa
4aff2a9d40
vars: add machine name to errors
2025-09-16 21:13:54 +02:00
DavHau
37a49a14f4
vars: fix re-generate behavior for dependencies of shared vars ( #5001 )
...
fixes https://git.clan.lol/clan/clan-core/issues/3791
This fixes multiple issues we had when re-generating shared vars.
Problem 1: shared vars are re-generated for each individual machine instead of just once (see #3791 )
Problem 2: When a shared var was re-generated for one machine, dependent vars on other machines did not get re-generated, leading to broken state
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/5001
2025-09-02 14:54:24 +00:00
Jörg Thalheim
8620761bbd
vars: fix var name in error message
2025-08-31 15:23:24 +02:00
Jörg Thalheim
17e9231657
vars: improve error message when storing trying to store a var in a read-only flake
2025-08-31 14:14:56 +02:00
DavHau
f77456a123
vars: simplify graph implementation, remove obsolete closure functions
...
- full_closure is obsolete since it is the same as calling requested_closure with the full list of generators.
- minimal_closure is obsolete as well. Since the recent addition of dependents to the closure via 3d2127ce1e it is essentially the same as the all_missing_closure
2025-08-27 12:50:59 +07:00
DavHau
3d2127ce1e
vars: always generate dependents
...
Even for the minimal closure case (when a specific generator was picked), we should still force regeneration of all dependents, as otherwise we risk keeping outdated dependents from previous generations
2025-08-27 11:47:46 +07:00
DavHau
6e4c3a638d
vars: move graph tests to separate file
2025-08-27 11:47:46 +07:00
Jörg Thalheim
4cb17d42e1
PLR2004: fix
2025-08-26 16:21:15 +02:00
Jörg Thalheim
d5b09f18ed
RET504: fix
2025-08-26 15:55:23 +02:00
Jörg Thalheim
db5571d623
SIM108: fix
2025-08-26 15:23:36 +02:00
Jörg Thalheim
b2a54f5b0d
PLC0415: fix
2025-08-26 14:46:42 +02:00
DavHau
501d020562
vars: retrieve generators for multiple machines
...
This is necessary ground work for fixing regeneration behavior spanning over multiple machines
2025-08-26 18:55:54 +07:00
Jörg Thalheim
7330285150
prompt/multiline: strip final newline just like hidden prompt
2025-08-26 13:35:12 +02:00
Jörg Thalheim
5bfa0d7a9d
prompt: catch EOF errors
2025-08-26 13:26:49 +02:00
adeci
8ea2dd9b72
add feature: ask for vars input confirmation, and fail after 3 attempts. fixes accidental misinputs when typing passwords!
2025-08-26 13:26:49 +02:00
Mic92
8134ffd787
Merge pull request 'ruff-4-perf-fixes' ( #4935 ) from ruff-4-perf-fixes into main
...
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4935
2025-08-25 13:12:14 +00:00
Jörg Thalheim
c65bb0b1ce
PERF401: fix
2025-08-25 15:06:32 +02:00
Jörg Thalheim
d9e6e0c540
D417: fix
2025-08-25 14:56:48 +02:00
Mic92
05665b1c7e
Merge pull request 'ruff-3-arg-fixes' ( #4934 ) from ruff-3-arg-fixes into main
...
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4934
2025-08-25 12:54:04 +00:00
Jörg Thalheim
4986fe30c3
ARG002/ARG005: fix
2025-08-25 14:36:36 +02:00
Jörg Thalheim
6a2dfb8176
S101: fix
2025-08-25 14:11:25 +02:00
Jörg Thalheim
dc5485d9f1
ruff: replace asserts outside of tests with Exceptions
2025-08-25 13:06:04 +02:00
DavHau
c308fd63a7
vars: delete old var when changing share
...
When changing a password from non-shared to shared, we want to remove the old one
2025-08-25 10:37:46 +00:00
Jörg Thalheim
0ec2c32ff8
ruff: apply automatic unsafe fixes
2025-08-25 11:34:41 +02:00
Jörg Thalheim
ea2d6aab65
ruff: apply automatic fixes
2025-08-25 11:34:41 +02:00
Mic92
5a5ec468c7
Merge pull request 'clan-cli: use automatic networking for vars upload and machines update' ( #4792 ) from networking_4 into main
...
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4792
2025-08-20 12:42:56 +00:00
DavHau
527b4b2e40
vars: ensure shared generators don't depend on machine specific generators
...
A dependency relation like this would not make sense as it would not be clear which machines generator the shared generator would depend on
2025-08-20 15:39:17 +07:00
DavHau
de0b1b2d70
vars: fix regenerating a specific generator
...
This was broken after re-designing the API -> added a test
2025-08-20 14:49:27 +07:00
DavHau
7b61a668e9
vars: refactor: use Machine objects instead of base_dir strings
...
Replace base_dir string parameters with Machine objects throughout the vars
module for better type safety and consistency.
2025-08-20 11:59:18 +07:00
lassulus
448c22c280
clan-cli: use automatic networking for vars upload and machines update
...
This uses the networking module to find the best_host, as we already do
with ssh and install. So if we don't supply a --target-host and a
networking module is configured, the remote should be autodetected.
Since vars upload doesn't have a --target-host argument, we always try
to use get_best_remote
2025-08-19 23:40:57 +02:00
DavHau
815c6c9438
vars: move generation functions to clan_lib
2025-08-19 18:05:53 +07:00
DavHau
9ce563aa08
vars: log var updates under specific machine
...
This makes it easier in the logs to identify which machine a var update belongs to
2025-08-19 11:03:36 +00:00
DavHau
ab274ce932
vars: refactor - remove generate_vars() in favor of run_generators()
...
The motivation is to have one shared entry point for the CLI as well as API/GUI
2025-08-19 16:26:53 +07:00
DavHau
aadc8a1d63
vars: refactor - remove _generate_vars_for_machine function
...
This became unnecessary by now
2025-08-19 07:41:31 +00:00
DavHau
aaca8f4763
vars: refactor - move generator specific code to Generator class
...
Several functions in generate.py were specific to generator instances. Let's move them into the Generator class
2025-08-19 07:41:31 +00:00
DavHau
ee87f20471
vars: refactor - remove create_machine_vars_interactive in favor of run_generators
...
The motivation is to create one powerful entrypoint shared by the GUI as well as the CLI in order to not having to maintain too much separate code paths.
As a next step, generate_vars can probably also be removed.
2025-08-19 13:26:38 +07:00
Johannes Kirschbauer
4312e3fc2f
vars: move generator class and bound methods into seperate module
2025-08-14 11:05:42 +02:00
Johannes Kirschbauer
e28f280036
vars: remove unused conditional import
2025-08-13 19:24:53 +02:00
DavHau
72d3ad09a4
vars: refactor - pass Machine objects to run_generators
2025-08-13 12:45:47 +00:00
DavHau
a535450ec0
vars: refactor - unify get_generators and _get_closure
2025-08-13 12:45:47 +00:00
Mic92
d3b423328f
Merge pull request 'Add wireguard service module' ( #3354 ) from init-wireguard-service into main
...
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3354
2025-08-13 10:55:48 +00:00
Jörg Thalheim
1177e84dcc
vars/generate: print the files that were found when files are missing
...
this helps fixing typos in the generator scripts
2025-08-13 12:29:52 +02:00
DavHau
24194011ac
vars: refactor - remove unnecessary return values
...
The boolean return value signaling if anything was ran or not isn't that useful. We are not doing anything with it.
2025-08-13 12:54:05 +07:00
lassulus
c14a5fcc69
refactor: move ssh/upload.py from cli to lib
...
Move the upload module to clan_lib to better organize SSH-related
utilities. Updated all imports across the codebase.
2025-08-13 12:04:14 +07:00
DavHau
5684ddf104
vars: health check also for API not just cli
2025-08-12 11:28:02 +00:00
DavHau
1abdd45821
vars: add doc comments for fix() and health_check()
2025-08-12 09:13:54 +00:00
DavHau
e28b8dc944
vars: refactor - health checks on multiple generators
2025-08-12 13:12:49 +07:00
DavHau
ee8e44d255
vars/generators: refactor - identify generators by name + machine
...
This brings us one step closer towards re-generating over multiple machines reliably
2025-08-11 21:02:55 +07:00
DavHau
073027f7c6
vars/generate: refactor - mark private as private
2025-08-11 11:46:25 +07:00