Skip to content

Commit

Permalink
Drop network D-Bus server completely (#1199)
Browse files Browse the repository at this point in the history
Once we have moved the UI and the CLI to a JSON/HTTP API for handling
the network configuration the D-Bus server can be removed completely.
  • Loading branch information
teclator authored May 14, 2024
2 parents 4be7618 + c0c47d8 commit 6738927
Show file tree
Hide file tree
Showing 18 changed files with 22 additions and 1,384 deletions.
3 changes: 1 addition & 2 deletions rust/agama-lib/src/network/client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use super::settings::{BondSettings, MatchSettings, NetworkConnection, WirelessSettings};
use super::types::{Device, DeviceState, DeviceType, SSID};
use super::{settings::NetworkConnection, types::Device};
use crate::error::ServiceError;
use reqwest::{Client, Response};
use serde_json;
Expand Down
4 changes: 1 addition & 3 deletions rust/agama-server/src/agama-dbus-server.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use agama_server::{
l10n::{self, helpers},
network, questions,
questions,
};

use agama_lib::connection_to;
Expand Down Expand Up @@ -41,8 +41,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
log::info!("Started questions interface");
l10n::export_dbus_objects(&connection, &locale).await?;
log::info!("Started locale interface");
network::export_dbus_objects(&connection).await?;
log::info!("Started network interface");

connection
.request_name(SERVICE_NAME)
Expand Down
12 changes: 0 additions & 12 deletions rust/agama-server/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@

mod action;
mod adapter;
pub mod dbus;
pub mod error;
pub mod model;
mod nm;
Expand All @@ -49,17 +48,6 @@ pub mod web;

pub use action::Action;
pub use adapter::{Adapter, NetworkAdapterError};
pub use dbus::NetworkService;
pub use model::NetworkState;
pub use nm::NetworkManagerAdapter;
pub use system::NetworkSystem;
use zbus::Connection;

pub async fn export_dbus_objects(
connection: &Connection,
) -> Result<(), Box<dyn std::error::Error>> {
let adapter = NetworkManagerAdapter::from_system()
.await
.expect("Could not connect to NetworkManager to read the configuration.");
NetworkService::start(connection, adapter).await
}
17 changes: 1 addition & 16 deletions rust/agama-server/src/network/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use crate::network::model::{AccessPoint, Connection, Device};
use agama_lib::network::types::DeviceType;
use tokio::sync::oneshot;
use uuid::Uuid;
use zbus::zvariant::OwnedObjectPath;

use super::{error::NetworkStateError, model::GeneralState, NetworkAdapterError};

Expand All @@ -16,11 +15,7 @@ pub type ControllerConnection = (Connection, Vec<String>);
#[derive(Debug)]
pub enum Action {
/// Add a new connection with the given name and type.
AddConnection(
String,
DeviceType,
Responder<Result<OwnedObjectPath, NetworkStateError>>,
),
AddConnection(String, DeviceType, Responder<Result<(), NetworkStateError>>),
/// Add a new connection
NewConnection(Box<Connection>, Responder<Result<(), NetworkStateError>>),
/// Gets a connection by its id
Expand All @@ -29,12 +24,6 @@ pub enum Action {
GetConnectionByUuid(Uuid, Responder<Option<Connection>>),
/// Gets a connection
GetConnections(Responder<Vec<Connection>>),
/// Gets a connection path
GetConnectionPath(Uuid, Responder<Option<OwnedObjectPath>>),
/// Gets a connection path by id
GetConnectionPathById(String, Responder<Option<OwnedObjectPath>>),
/// Get connections paths
GetConnectionsPaths(Responder<Vec<OwnedObjectPath>>),
/// Gets a controller connection
GetController(
Uuid,
Expand All @@ -52,10 +41,6 @@ pub enum Action {
GetDevice(String, Responder<Option<Device>>),
/// Gets all the existent devices
GetDevices(Responder<Vec<Device>>),
/// Gets a device path
GetDevicePath(String, Responder<Option<OwnedObjectPath>>),
/// Get devices paths
GetDevicesPaths(Responder<Vec<OwnedObjectPath>>),
GetGeneralState(Responder<GeneralState>),
/// Sets a controller's ports. It uses the Uuid of the controller and the IDs or interface names
/// of the ports.
Expand Down
11 changes: 0 additions & 11 deletions rust/agama-server/src/network/dbus.rs

This file was deleted.

14 changes: 0 additions & 14 deletions rust/agama-server/src/network/dbus/interfaces.rs

This file was deleted.

86 changes: 0 additions & 86 deletions rust/agama-server/src/network/dbus/interfaces/common.rs

This file was deleted.

Loading

0 comments on commit 6738927

Please sign in to comment.