Commit Graph

306 Commits

Author SHA1 Message Date
a-kenji
6438e77519 pkgs/cli: Fix target_host for machines install
Use the correct `target_host`, if a user is defined.

Before the change:

```console
$ clan machines install
$ Install jon to 49.13.232.197? [y/N]
```

After the change:

```console
$ clan machines install
$ Install jon to root@49.13.232.197? [y/N]
```

Because root is the configured user for `target_host`, this is the
correct behavior.
2024-12-17 22:29:54 +01:00
Michael Hoang
7e16a1a268 clan_cli: always use --target-host if specified for machines install 2024-12-18 00:13:17 +11:00
Michael Hoang
a7f8613878 clan_cli: fix target_host when running clan machines install 2024-12-18 00:08:10 +11:00
Michael Hoang
60c2ca726a clan-cli: don't list non-Clan NixOS configurations 2024-12-17 15:11:38 +11:00
lassulus
9cc3bdbc9f vars: eval finalScript lazy 2024-12-14 13:38:51 +01:00
Qubasa
6b784f8623 clan-cli: Rework 'clan ssh' command, improve Tor support. 2024-12-13 00:11:18 +01:00
Qubasa
b9091beff9 clan-cli: Replace log.info to machine.info if applicable 2024-12-12 15:36:17 +01:00
clan-bot
0e65ec27a1 Merge pull request 'fix: Calculate a seperate delete delta for removed data' (#2587) from hsjobeki/clan-core:fix/writeable into main 2024-12-10 20:26:45 +00:00
Johannes Kirschbauer
959ab140a6 Inventory: init delete patial data 2024-12-10 21:19:04 +01:00
Johannes Kirschbauer
096ddea270 Inventory: fix persistence 2024-12-10 16:41:40 +01:00
Johannes Kirschbauer
e9a45fa712 API: fix create machine should set machine description and other data 2024-12-10 15:17:41 +01:00
lassulus
998ff92b51 vars: remove intermediate classes 2024-12-10 14:04:31 +01:00
Qubasa
d388900a8e clan-cli: Fix missing error propagation in deploy 2024-12-10 00:03:33 +01:00
Qubasa
65a5789c5b clan-cli: Replace HostGroup and MachineGroup with generic AsyncRuntime class. Propagate cmd prefix over thread local. Close threads on CTRL+C 2024-12-09 18:07:23 +01:00
Johannes Kirschbauer
69b7f6be5b inventory.{cli,api}: use only dictionaries 2024-12-06 18:51:20 +01:00
Qubasa
daf8033c25 clan-cli: made run_no_stdout runOpts compatible and make time table thread safe 2024-12-06 12:18:28 +01:00
Jörg Thalheim
e2ed57f8dd extract nix_test_store helper for sandbox builds 2024-12-05 11:38:58 +01:00
Johannes Kirschbauer
7b529855cd api: create machine touch only the created machine 2024-12-04 17:44:56 +01:00
Jörg Thalheim
6247723c50 commit file instead of just git adding it 2024-12-04 12:14:32 +01:00
Jörg Thalheim
3452ca54e6 skip writing the empty inventory json 2024-12-04 12:14:32 +01:00
Jörg Thalheim
0b3816b6ec clan/update: make build-host overridable in cli 2024-12-03 17:40:12 +01:00
Jörg Thalheim
760126d8d5 remove deprecated deploymentHost 2024-12-03 17:30:02 +01:00
Jörg Thalheim
bbb2aca5cb rename run_no_output to run_no_stdout
we want stderr for some nix commands.
2024-12-03 17:15:28 +01:00
Qubasa
570bceff4e clan-cli: Fix ignored debug flag in clan vms run, refactor Host.run to use RunOpts 2024-12-03 16:01:51 +01:00
Johannes Kirschbauer
1768e44d51 api/machines: include disk and hw_config into machine details 2024-12-03 14:01:11 +01:00
DavHau
fbbfcc0aa5 vars: generate docs for cli and module 2024-11-29 17:23:31 +07:00
clan-bot
894e31f983 Merge pull request 'remove secretsUploadDirectory from common module' (#2509) from lassulus/clan-core:no-secrets-upload-dir into main 2024-11-28 15:46:51 +00:00
lassulus
8337a3ec41 vars: remove secretsUploadDirectory from common module 2024-11-28 16:38:06 +01:00
Qubasa
1f98df96e3 clan-cli: cmd.run now has its options extracted to a dataclass 2024-11-28 15:26:37 +01:00
Johannes Kirschbauer
3b7559e066 CLI: use new template path 2024-11-28 11:44:44 +01:00
Qubasa
80045a9af1 clan-cli: Add -L option to nixos-rebuild switch to still have build output, simplify logging code 2024-11-28 10:42:43 +01:00
Qubasa
a1a367c57c clan-cli: Refactor colors to a subset of colors that work in light and dark mode 2024-11-27 12:42:10 +01:00
lassulus
e978f91209 cli machines update: remove dead code 2024-11-27 10:33:28 +01:00
Johannes Kirschbauer
fa7e9a9670 Cli: improve targetHost error message 2024-11-27 10:06:04 +01:00
DavHau
44e6fe803f vars: make all python tests work in nix sandbox
- generate a flake.lock file for each template by copying the clan-core flake.lock and modifying it

- call nix build with --store for tests inside the sandbox
2024-11-27 14:32:02 +07:00
Louis Opter
f4e621af88 clan-cli: secrets.sops: improve age keys detection
This change allows you to e.g. directly pass `$(age-keygen)` on the
command line.
2024-11-27 06:27:53 +00:00
Louis Opter
775be88a9c clan-cli: filter any sops recipients set in the environment for encryption
This forces sops to use our config file, otherwise if any of the
environment variables set to specify recipients is present then
`--config` will be ignored (see [env_check]).

That's simple enough, still I ended up refactoring how we call sops for
correctness, and to align with its behavior. The code now distinguishes
between public and private keys explicitly. `secrets.decrypt_secret`
does not try to lookup for public and private keys anymore.

With this changeset, some people might have to adjust their environment
as public age and PGP keys will be discovered like sops would do. In
particular if multiple public keys are discovered, then the user will
have to specify which one to use for the clan.

This also makes the following changes:

- try to use `/dev/shm` when swapping a secret (it's what [pass] does
  fwiw);
- alias immediate values for readability;
- remove some float comparison that could never succeed, and use sops'
  exit status instead;
- remove unused function `maybe_get_sops_key`.

[env_check]: 8c567aa8a7/cmd/sops/main.go (L2229)
[pass]: http://passwordstore.org/
2024-11-27 06:27:53 +00:00
Jörg Thalheim
c9e80f38ca vars: make interface more type-safe 2024-11-26 17:08:26 +01:00
a-kenji
22af137e17 pkgs/cli: Add --password flag to machines install
Add `--password` flag to `clan machines install`,
which allows installing through the `nixos-image` installer
manually without extra configuration.
2024-11-26 15:01:43 +01:00
Qubasa
4e6051acdc docs: Fix nix flake check problem with diskId 2024-11-25 18:39:16 +01:00
Qubasa
979e5e839d clan-cli: Refactor ssh part 2, Refactor custom_logger 2024-11-22 22:08:50 +01:00
Qubasa
a4f3d9d1fc clan-cli: Refactor ssh folder part 1 2024-11-21 13:02:22 +01:00
a-kenji
5a9d58ec59 pkgs/cli: Fix generation of hardware configuration for machines install
Correctly use the `value` of the `enum`, which is expected by
`nixos-anywhere`.
2024-11-20 16:15:45 +01:00
a-kenji
1c9ca82055 pkgs/cli: Fix tag creation for clan machines create 2024-11-20 15:12:05 +01:00
Qubasa
26730cd662 clan-cli: upload.py -> Replace rsync with native ssh command 2024-11-15 22:03:47 +07:00
lassulus
ddc7afd67d clan_cli vars: actually upload 2024-11-13 13:23:42 +01:00
lassulus
ebfc8ecfd0 cli machines update: run deploy directly if deploying single machine 2024-11-13 13:23:42 +01:00
a-kenji
c3fe5df5e9 pkgs/cli: Document clan machines list --tags 2024-11-12 14:59:23 +01:00
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