Skip to content

Commit

Permalink
feat(cli): drop "agama config add/set" subcommands (agama-project#1314)
Browse files Browse the repository at this point in the history
## Problem

Agama CLI supports setting specific values directly via the CLI. Check
`agama config --help` to learn more. However, it has a few problems:

* It is not finished yet, especially when it comes to handle
collections.
* How useful is for real use cases (instead of just using config load)?
We have some examples in the documentation, but nothing critical.
* Users could manipulate the configuration by using a tool like `jq`.

## Solution

Just drop the `agama config add/set` subcommands.
  • Loading branch information
imobachgs authored Jun 12, 2024
2 parents 1ae4908 + 0851669 commit c405230
Show file tree
Hide file tree
Showing 28 changed files with 97 additions and 1,390 deletions.
43 changes: 17 additions & 26 deletions autoinstallation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ provide a file, known as a "profile", that includes a description of the system
approach might sound familiar to AutoYaST users. On the other hand, Agama can accept just a plain
shell script, enabling custom pre-installation workflows.

If you are interested in using your AutoYaST profiles, Agama is not there yet. However, there are
plans to partially support them.

By now, let's have a closer look at Agama's approaches.
Although Agama defines its own [profile format](../rust/agama-lib/share/profile.schema.json), it is
able to partially handle AutoYaST profiles. Please, check the [AutoYaST support document](../doc/
autoyast.md) for further information.

## Profile-based installation

Expand Down Expand Up @@ -65,23 +64,24 @@ Please, check [the example profile](../rust/agama-lib/share/examples/profile.jso
information.

> [!NOTE]
> You can inspect the available data by installing the `lshw` package and running the
> following command: `lshw -json`.
> You can inspect the available data by installing the `lshw` package and running the following
> command: `lshw -json`.
### Validating and evaluating a profile

Agama includes a handy command-line interface available in the `agama-cli` package. Among many other
things, it allows for downloading, validating and evaluating profiles. For instance, we could check
the result of the previous profile by running the following command:
Agama includes a handy command-line interface available in the `agama` package. Among many other
things, it allows downloading, validating and evaluating profiles. For instance, we could check the
result of the previous profile by running the following command:

```
$ sudo agama profile evaluate my-profile.jsonnet
```

> [!WARNING] You need to use `sudo` to access the hardware information.
> [!WARNING]
You need to use `sudo` to access the hardware information.

Do you want to check whether your profile is valid? `agama-cli` have you covered. Bear in mind that
you can only validate JSON profiles (a Jsonnet profile must be evaluated first).
Do you want to check whether your profile is valid? `agama` have you covered. Bear in mind that you
can only validate JSON profiles (a Jsonnet profile must be evaluated first).

```
$ agama profile validate my-profile.json
Expand Down Expand Up @@ -109,8 +109,7 @@ Below there is a minimal working example to install Tumbleweed:
```sh
set -ex

/usr/bin/agama config set product.id=Tumbleweed
/usr/bin/agama config set user.userName=joe user.password=doe
/usr/bin/agama profile import ftp://my.server/profile.json
/usr/bin/agama install
```

Expand All @@ -135,8 +134,7 @@ set -ex

/usr/bin/agama download ftp://my.server/tricky_hardware_setup.sh > tricky_hardware_setup.sh
sh tricky_hardware_setup.sh
/usr/bin/agama config set product.id=Tumbleweed
/usr/bin/agama config set user.userName=joe user.password=doe
/usr/bin/agama profile import ftp://my.server/profile.json
/usr/bin/agama install
```

Expand Down Expand Up @@ -167,9 +165,7 @@ Agama and before installing RPMs, such as changing the fstab and mount an extra
```sh
set -ex

/usr/bin/agama config set product.id=Tumbleweed
/usr/bin/agama config set user.userName=joe user.password=doe

/usr/bin/agama profile import http://my.server/profile.json
/usr/bin/agama install --until partitioning # install till the partitioning step

# Place for specific changes to /dev
Expand All @@ -190,10 +186,7 @@ software for internal network, then it must be modified before umount.
set -ex

/usr/bin/agama download ftp://my.server/velociraptor.config

/usr/bin/agama config set product.id=Tumbleweed
/usr/bin/agama config set user.userName=joe user.password=doe

/usr/bin/agama profile import http://my.server/profile.json
/usr/bin/agama install --until deploy # do partitioning, rpm installation and configuration step

# Example of enabling velociraptor
Expand All @@ -216,9 +209,7 @@ some kernel tuning or adding some remote storage that needs to be mounted during
```sh
set -ex

/usr/bin/agama config set product.id=Tumbleweed
/usr/bin/agama config set user.userName=joe user.password=doe

/usr/bin/agama profile import http://my.server/profile.json
/usr/bin/agama install --until deploy # do partitioning, rpm installation and configuration step

# Do custom modification of /mnt including call to dracut
Expand Down
202 changes: 0 additions & 202 deletions doc/cli_guidelines.md

This file was deleted.

5 changes: 5 additions & 0 deletions live/src/agama-live.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Jun 11 21:39:51 UTC 2024 - Imobach Gonzalez Sosa <[email protected]>

- Add the jq package to the image (gh#openSUSE/agama#1314).

-------------------------------------------------------------------
Thu Jun 6 14:30:19 UTC 2024 - Ladislav Slezák <[email protected]>

Expand Down
1 change: 1 addition & 0 deletions live/src/agama-live.kiwi
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
<package name="checkmedia"/>
<package name="spice-vdagent"/>
<package name="libtss2-tcti-device0"/>
<package name="jq"/>
<archive name="root.tar.xz"/>
</packages>
<!-- additional packages for the openSUSE flavors -->
Expand Down
20 changes: 0 additions & 20 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
members = [
"agama-cli",
"agama-server",
"agama-derive",
"agama-lib",
"agama-locale-data",
"agama-settings",
]
resolver = "2"

Expand Down
2 changes: 0 additions & 2 deletions rust/agama-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ edition = "2021"
clap = { version = "4.1.4", features = ["derive", "wrap_help"] }
curl = { version = "0.4.44", features = ["protocol-ftp"] }
agama-lib = { path="../agama-lib" }
agama-settings = { path="../agama-settings" }
serde = { version = "1.0.152" }
serde_json = "1.0.91"
serde_yaml = "0.9.17"
indicatif= "0.17.3"
thiserror = "1.0.39"
convert_case = "0.6.0"
console = "0.15.7"
anyhow = "1.0.71"
log = "0.4"
Expand Down
Loading

0 comments on commit c405230

Please sign in to comment.