Commit Graph

258 Commits

Author SHA1 Message Date
a-kenji
392d8437cb pkgs/clan: machines list --tags add dynamic completer 2024-11-12 14:59:23 +01:00
a-kenji
8596deaeb7 pkgs/cli: Add tagging support to machines list
Add the `--tags` flag to `clan machines list`
This now supports the machine tagging system from the inventory.

Multiple tags are the intersection of the tags of a specific machine.

Example two machines with overlapping tags:
```
server: ["intel"]
laptop: ["intel", "graphical"]
```

- `clan machines list --tags intel` will output:

```
server
laptop
```

- `clan machines list --tags intel graphical` will output:

```
laptop
```

- `clan machines list --tags graphical` will output:

```
laptop
```
2024-11-12 14:58:55 +01:00
Jörg Thalheim
5bc8670020 simplify reading hostPlaform.system from nixos 2024-11-11 16:17:54 +01:00
Qubasa
9da872a267 clan-cli: Simplify hostPlatform and just use 'system' 2024-11-11 14:08:12 +00:00
Qubasa
9fc4e4c7d4 clan-cli: Fix nixos-anywhere for systems that can not be build locally 2024-11-11 14:08:12 +00:00
a-kenji
5d6ac539bc pkgs/cli: Complete --tags flag 2024-11-11 13:48:00 +01:00
a-kenji
7a17edc0d6 pkgs/cli: Complete --target-host flag 2024-11-10 19:12:54 +01:00
a-kenji
23d0e2f115 pkgs/cli: Query target-host for machines install from configuration
Query `target-host` for `clan machines install` from the nixos
configuration (deployment.json), if possible.

Remove `TARGET_HOST` option and introduce `--target-host` command
line flag.

This brings the installation subcommand in line with the update
subcommand - improving consistency and usability.

Closes: #2309
2024-11-10 18:18:51 +01:00
clan-bot
f76a5cacc5 Merge pull request 'pkgs/cli: Group dynamic completer with the correct parser for clarity' (#2354) from kenji/clan-core:kenji-group-completer into main 2024-11-10 14:56:18 +00:00
a-kenji
3e1bbd53d2 pkgs/cli: Group dynamic completer with the correct parser for clarity 2024-11-10 15:48:41 +01:00
a-kenji
4b67d9fa71 pkgs/cli: Improve error message on clan machines update 2024-11-10 15:47:21 +01:00
a-kenji
96f66a3810 pkgs/cli: Apply naming standards to help strings in clan machines update 2024-11-10 15:37:41 +01:00
clan-bot
e8f6786d95 Merge pull request 'pkgs/cli: Fix help string of clan machines create' (#2350) from kenji/clan-core:kenji-fix-naming-create into main 2024-11-10 13:21:53 +00:00
a-kenji
aa1ca9ba59 pkgs/cli: Fix help string of clan machines create 2024-11-10 14:15:34 +01:00
a-kenji
0c7f18da12 pkgs/cli: Add --target-host to clan machines create
Add the `--target-host` flag to `clan machines create`.
This allows setting the `deploy.targetHost` for the newly created
machine via the inventory.

Closes: #2339
2024-11-10 14:13:39 +01:00
a-kenji
182ea02c46 pkgs/cli: Improve tense of message in machines create
Change the log message tense from present to continuous for improved clarity.
The message "Add file" has been changed to "Adding file" to provide a clear
indication that the file addition is an ongoing process, not a
command (for the user).
2024-11-10 01:14:40 +01:00
a-kenji
c7ad5e1928 pkgs/cli: Remove superfluous comment string 2024-11-10 00:35:41 +01:00
a-kenji
e0cebd005a pkgs/cli: Fix dynamic completions for update-hardware-config and it's flags
Fix dynamic completions for `update-hardware-config` and it's flags.

Now `update-hardware-config` correctly suggests machines as well as for
example `--backend` suggests correctly their respective flags.
2024-11-08 14:23:11 +01:00
Jörg Thalheim
2b05f90239 expose an option to generate hardware configuration during installation 2024-11-05 14:33:22 +01:00
Jörg Thalheim
86d8992046 generate-hardware-config: remove backup file after we are done 2024-11-04 15:05:08 +01:00
Jörg Thalheim
2f3369cca5 add build-on-remote flag 2024-11-04 13:27:50 +01:00
DavHau
08fb34aa01 cli: set needs_user_terminal for all ssh commands 2024-10-23 19:40:50 +07:00
Qubasa
5c603ba525 clan-cli: Fix breakage if machines update 2024-10-08 03:38:46 +02:00
Qubasa
b05fd96c0c clan-cli: Fix bug where --host-key-check is not applied to build-host 2024-10-08 03:03:13 +02:00
Qubasa
2838e468a6 clan-cli: Fix bug where --host-key-check is not applied everywhere 2024-10-08 00:25:15 +00:00
Qubasa
99c5bd2b50 clan-cli: Add --host-key-check to machine update 2024-10-05 23:33:44 +02:00
Qubasa
5967bb347c clan-cli: Fix bug where --target_host is getting ignored 2024-10-05 18:51:44 +02:00
Jörg Thalheim
4826582547 add more custom prefixes for temporary directories 2024-10-01 20:54:19 +02:00
clan-bot
a57f409224 Merge pull request 'generate: don't set type=bool in argparse.BooleanOptionalAction' (#2190) from fix-warning into main 2024-10-01 17:04:49 +00:00
Jörg Thalheim
f9a42831e4 start to name temporary directories in more places 2024-10-01 18:57:59 +02:00
Louis Opter
3f2bb2b958 Update outdated help messages and fix a typo 2024-09-29 15:52:58 +00:00
Jörg Thalheim
62af2bab55 fix broken eval check when nixpkgs.pkgs nixos option is used 2024-09-29 16:59:02 +02:00
Jörg Thalheim
9cf2bd4f6e make default hardware report commit message nicer 2024-09-29 16:59:02 +02:00
Jörg Thalheim
bf7246104d allow to overwrite hardware configuration
now that we call it "update" hardware configurration and we are heading
towards facter anyway, we don't need all the force overide logic. Just
allow this to be overwritten by default.
2024-09-29 16:59:02 +02:00
Jörg Thalheim
b4652539a5 wrap hardware generate arguments into an object 2024-09-29 16:59:02 +02:00
Jörg Thalheim
7816a3e639 don't expose polymorphic api 2024-09-29 16:21:53 +02:00
Jörg Thalheim
372a5f3907 remove unused location from ClanError 2024-09-29 16:21:53 +02:00
Jörg Thalheim
07e031f256 expose nixos-facter in cli 2024-09-29 16:21:53 +02:00
Jörg Thalheim
d0ed48284b use packaged nixos-facter in generate_hardware_info 2024-09-24 11:38:33 +02:00
Qubasa
a27880a65e clan-cli: Move clan machines import to clan machines create 2024-09-23 17:11:48 +02:00
Jörg Thalheim
8a8b473236 rename hw-generate to update-hardware-config 2024-09-20 13:42:18 +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
4ce3cf16bb vars: generate vars for clan install
fixes #2087
2024-09-17 20:41:39 +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
3089296328 clan-cli: fix cyclic import problem 2024-09-06 15:38:12 +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
Jörg Thalheim
29909e49d3 apply TRY lint 2024-09-03 18:13:46 +02:00
Johannes Kirschbauer
e4f077f2e2 Fix cyclic imports: __init__.py are automatically imported 2024-09-03 17:24:31 +02:00