Skip to content

Adapt agama config to return error code when no validates (SLE-16)#3310

Merged
teclator merged 3 commits intoSLE-16from
agama_config_return_codes_SLE-16
Mar 23, 2026
Merged

Adapt agama config to return error code when no validates (SLE-16)#3310
teclator merged 3 commits intoSLE-16from
agama_config_return_codes_SLE-16

Conversation

@teclator
Copy link
Copy Markdown
Contributor

@teclator teclator commented Mar 20, 2026

Same than #3304 but for SLE-16

In contrary to SLE-16.1, in SLE-16 the agama config load returns 1 in both cases when there is no product but continues otherwise.

Tests

  • Tested manually

agama config validate

agama:~ # agama_not_fix/agama config validate profile.json || echo $?
✗ The profile is not valid. Please, check the following errors:

        * Additional properties are not allowed ('ID' was unexpected). /product
        * "id" is a required property. /product

agama:~ # agama_fix/agama config validate profile.json || echo $?
✗ The profile is not valid. Please, check the following errors:

        * Additional properties are not allowed ('ID' was unexpected). /product
        * "id" is a required property. /product

The profile is not valid
1

agama config load

agama:~ # agama_not_fix/agama config load profile.json || echo $?
✗ The profile is not valid. Please, check the following errors:

        * Additional properties are not allowed ('ID' was unexpected). /product
        * "id" is a required property. /product

Cannot proceed with profile without specified product
1
agama:~ # agama_fix/agama config load profile.json || echo $?
✗ The profile is not valid. Please, check the following errors:

        * Additional properties are not allowed ('ID' was unexpected). /product
        * "id" is a required property. /product

The profile is not valid
1
agama:~ # agama_not_fix/agama config load profile.json || echo $?
✗ The profile is not valid. Please, check the following errors:

        * Additional properties are not allowed ('test' was unexpected). 

[1/2] Analyze disks
[2/2] Configure software

agama:~ # nmcli c
NAME                UUID                                  TYPE      DEVICE 
Wired connection 1  91b9fecf-4020-35ec-97f8-d8e2cdcff413  ethernet  enp1s0 
Wired connection 2  12b49824-ddaa-3f0f-a73f-ec0f1ccd12ae  ethernet  enp2s0 
Wired connection 3  b33b1b08-3513-3155-b8b4-16ceba7ee8bd  ethernet  enp3s0 
lo                  567dce11-cedd-4227-b2a5-d249da7d82d1  loopback  lo 

agama:~ # cat profile.json | jq ".network .connections"
[
  {
    "id": "Wired connection 3",
    "status": "removed"
  }
]
agama:~ # agama_fix/agama config load profile.json || echo $?
✗ The profile is not valid. Please, check the following errors:

        * Additional properties are not allowed ('test' was unexpected). 

The profile is not valid
1
agama:~ # agama_not_fix/agama config load profile.json || echo $?
✗ The profile is not valid. Please, check the following errors:

        * Additional properties are not allowed ('test' was unexpected). 

agama:~ # nmcli c
NAME                UUID                                  TYPE      DEVICE 
Wired connection 1  91b9fecf-4020-35ec-97f8-d8e2cdcff413  ethernet  enp1s0 
Wired connection 2  12b49824-ddaa-3f0f-a73f-ec0f1ccd12ae  ethernet  enp2s0 
lo                  567dce11-cedd-4227-b2a5-d249da7d82d1  loopback  lo     
º

agama config generate

agama:~ # agama_not_fix/agama config generate profile.jsonnet || echo $?
{
   "hostname": {
      "static": "Agama"
   },
   "product": {
      "ID": "Tumbleweed"
   },
   "scripts": {
      "post": [
         {
            "chroot": true,
            "content": "#!/usr/bin/env bash\necho 'PermitRootLogin yes' > /etc/ssh/sshd_config.d/root.conf\nsystemctl enable sshd\n",
            "name": "enable root login"
         }
      ]
   }
}
✗ The profile is not valid. Please, check the following errors:

        * Additional properties are not allowed ('ID' was unexpected). /product
        * "id" is a required property. /product

agama:~ # agama_fix/agama config generate profile.jsonnet || echo $?
{
   "hostname": {
      "static": "Agama"
   },
   "product": {
      "ID": "Tumbleweed"
   },
   "scripts": {
      "post": [
         {
            "chroot": true,
            "content": "#!/usr/bin/env bash\necho 'PermitRootLogin yes' > /etc/ssh/sshd_config.d/root.conf\nsystemctl enable sshd\n",
            "name": "enable root login"
         }
      ]
   }
}
✗ The profile is not valid. Please, check the following errors:

        * Additional properties are not allowed ('ID' was unexpected). /product
        * "id" is a required property. /product

The profile is not valid
1

Also tested with edit

agama:~/agama_fix # agama config edit 
✗ The profile is not valid. Please, check the following errors:

	* Additional properties are not allowed ('test' was unexpected). 

agama:~/agama_fix # echo $?
0
agama:~/agama_fix # ./agama config edit 
✗ The profile is not valid. Please, check the following errors:

	* Additional properties are not allowed ('test' was unexpected). 

The profile is not valid
agama:~/agama_fix # echo $?
1

@teclator teclator marked this pull request as ready for review March 20, 2026 12:58
@teclator teclator merged commit e2f0eaa into SLE-16 Mar 23, 2026
13 of 14 checks passed
@teclator teclator deleted the agama_config_return_codes_SLE-16 branch March 23, 2026 12:13
@imobachgs imobachgs mentioned this pull request Apr 14, 2026
imobachgs added a commit that referenced this pull request Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants