agama/rust/agama-server
Imobach González Sosa 777852293d
feat: embed questions configuration in the profile (#2612)
## Problem

* Bug [bsc#1246997](https://bugzilla.suse.com/show_bug.cgi?id=1246997)

To answer questions in advance when using the unattended mode, it is
required to use a pre-script. If you just want Agama to use the default
values, it is kind of straight-forward:

```jsonnet
  scripts: {
    pre: [
      {
        name: 'disable-questions',
	content: |||
          #!/usr/bin/bash
          agama questions mode non-interactive
	|||
      }
    ]
  }
```

However, if you want to answer an specific question (e.g., providing a
password for an existing encrypted file system) it is kind of tricky.
You might need to create a file like this:

```json
  {
    "answers": [
      {
        "password": "my-password",
        "class": "storage.luks_activation"
      },
    ]
  }
```

And the load it using a pre-script:

```jsonnet
  scripts: {
    pre: [
      {
        name: 'disable-questions',
	content: |||
          #!/usr/bin/bash
          agama download http://my-server.lan/answers.json answers.json
          agama questions answers answers.json
	|||
      }
    ]
  }
```

## Solution

Allow embedding the answers in the profile.

```json
  "questions": {
    "policy": "auto",
    "answers": [
      { "class": "storage.luks_activation", "password": "nots3cr3t" }
    ]
```

* `policy`: ask the user (`user`) or choose the default option (`auto`).
* `answers`: list of answers to the given question.

## Testing

- *Added a new unit test*
- *Tested manually*
2025-07-31 15:10:17 +01:00
..
share chore(rust): use a better jwt_secret example 2024-05-24 00:12:36 +01:00
src feat(rust): replace questions "interactive" with a "policy" 2025-07-31 14:25:53 +01:00
tests allow minimal installed system without libzypp (#2512) 2025-06-26 14:00:41 +02:00
Cargo.toml chore(rust): do not complain about 'cfg(ci)' 2025-07-30 23:26:37 +01:00