agama/rust
Knut Alejandro Anderssen González 76007c61ef
fix(rust) Do not return Err when a connection activation fails during writing but log the error (#2629)
## Problem

Currently the add_or_update_connection client method not only
add_or_update a connection in NetworkManager but it also tries to
activate or deactivate it based on the status property. The problem is
that the activation could fail in some situations like:

  - The interface bind to the connection is not present.
- The interface bind to the connection is already applying other
connection.
  - In case of Wireless, wireless could be disabled by hardware.
  
.... and other cases.

When this happen it returns with an error and the write operation does a
rollback to the checkpoint created before starting with the write.

-
https://trello.com/c/c7HAWvBz/5020-1245548-modifying-a-network-connection-binding-settings-does-not-apply-the-changes-to-the-active-connection

## Solution

- When the activation or deactivation of a connection return an error it
will be just logged in order to finish with the write of the
connections.
- Before activating a connection, if it is bind to an specific interface
which is applying a different connection then the device will be
disconnected in order to be able to activate the latest one. Example,
the default connection created by dracut which could be applied to
multiple-connections.

## Testing

- Tested manually
```bash
suse@vikingo:~$ cat test.json 
{
  "network": {
    "connections": [
      {
        "id": "br0",
        "interface": "br0",
        "status": "up",
        "persistent": true,
        "bridge": {
          "ports": ["eth0"],
          "stp": false
        }
      }
    ]
  }
}

suse@vikingo:~$ agama config load < test.json 
✓ The profile is valid.

# Logs from agama-web-server
2025-07-30T13:04:07.370000Z  INFO agama_network::nm::adapter: agama-network/src/nm/adapter.rs:152: No change detected for connection Sarambeque (cb47c266-d391-409d-97a2-12cbb311aca6)                             
2025-07-30T13:04:07.370012Z  INFO agama_network::nm::adapter: agama-network/src/nm/adapter.rs:152: No change detected for connection default (bd03462f-6398-4b8b-83b7-3d9196e85030)                                
2025-07-30T13:04:07.370020Z  INFO agama_network::nm::adapter: agama-network/src/nm/adapter.rs:172: Updating connection br0 (9464a892-baf8-4446-b4a5-12bd476a132e)                                                  
2025-07-30T13:04:07.391704Z  INFO agama_network::nm::client: agama-network/src/nm/client.rs:354: Activating connection br0                                                                                         
2025-07-30T13:04:07.398749Z  INFO agama_network::nm::adapter: agama-network/src/nm/adapter.rs:172: Updating connection eth0 (13d5f018-6304-472c-9c55-3a56597ce693)                                                 
2025-07-30T13:04:07.429485Z  INFO agama_network::nm::client: agama-network/src/nm/client.rs:339: Disconnecting default because the connection is eth0                                                              
2025-07-30T13:04:07.458868Z  INFO agama_network::nm::client: agama-network/src/nm/client.rs:354: Activating connection eth0    
```
2025-08-04 12:22:34 +01:00
..
.cargo chore(rust): set up xtask 2024-09-30 14:51:05 +01:00
agama-autoinstall fix(rust): print download error earlier 2025-07-28 09:13:17 +01:00
agama-cli use a std call directly 2025-08-01 12:09:25 +02:00
agama-lib fix(rust) Do not return Err when a connection activation fails during writing but log the error (#2629) 2025-08-04 12:22:34 +01:00
agama-locale-data fix(i18n): Configure the console font (#2468) 2025-06-13 14:51:45 +02:00
agama-network Changes based on code review 2025-08-04 10:27:42 +01:00
agama-server feat: embed questions configuration in the profile (#2612) 2025-07-31 15:10:17 +01:00
agama-utils chore(rust): do not set a max_queue in build_properties_changed_stream 2025-05-22 13:25:31 +01:00
etc/agama.d fix(rust): add the agama.libsonnet file to the spec 2024-05-27 06:50:12 +01:00
package Added changelog 2025-08-04 10:33:16 +01:00
share feat(rust): add the agama-autoinstall package 2025-07-03 22:16:44 +01:00
xtask cargo xtask markdown: advertise itself in the output 2025-04-16 14:49:57 +02:00
.gitignore Split and refactor the Rust CI tests 2025-05-28 13:40:39 +02:00
Cargo.lock Use percent_encoding 2025-07-24 13:37:10 +01:00
Cargo.toml refactor(rust): rename agama-auto to agama-autoinstall 2025-07-03 22:16:44 +01:00
install.sh fix(rust): improve install.sh quoting 2025-07-08 08:23:51 +01:00
LICENSE Add the CLI to the repository 2023-03-30 14:01:33 +01:00
README.md docs: Fix broken links after moving content to web site 2024-12-02 16:07:05 -05:00
rustfmt.toml Add some basic rustfmt configuration 2023-12-26 08:54:17 +00:00
WEB-SERVER.md Use port 80 by default 2024-05-16 07:48:25 +01:00

Agama Server

According to Agama's architecture this project implements the following components:

  • The Agama server, excluding Agama YaST which lives in the service directory.
  • The Agama D-Bus service.
  • The Command Line Interface.

Code organization

We have set up Cargo workspace with three packages:

Other resources