mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-05 14:10:34 -04:00
systemd: Code cleanup
This commit is contained in:
parent
d62b515c48
commit
f32e354b64
1 changed files with 11 additions and 12 deletions
|
@ -11,7 +11,7 @@ use std::str::FromStr;
|
||||||
use strum::{Display, EnumString};
|
use strum::{Display, EnumString};
|
||||||
use zbus::proxy::CacheProperties;
|
use zbus::proxy::CacheProperties;
|
||||||
use zbus::zvariant::OwnedObjectPath;
|
use zbus::zvariant::OwnedObjectPath;
|
||||||
use zbus::Connection;
|
use zbus::{self, Connection};
|
||||||
|
|
||||||
#[zbus::proxy(
|
#[zbus::proxy(
|
||||||
interface = "org.freedesktop.systemd1.Unit",
|
interface = "org.freedesktop.systemd1.Unit",
|
||||||
|
@ -19,13 +19,13 @@ use zbus::Connection;
|
||||||
)]
|
)]
|
||||||
trait SystemdUnit {
|
trait SystemdUnit {
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn active_state(&self) -> Result<String>;
|
fn active_state(&self) -> zbus::Result<String>;
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn unit_file_state(&self) -> Result<String>;
|
fn unit_file_state(&self) -> zbus::Result<String>;
|
||||||
|
|
||||||
async fn restart(&self, mode: &str) -> Result<OwnedObjectPath>;
|
async fn restart(&self, mode: &str) -> zbus::Result<OwnedObjectPath>;
|
||||||
async fn start(&self, mode: &str) -> Result<OwnedObjectPath>;
|
async fn start(&self, mode: &str) -> zbus::Result<OwnedObjectPath>;
|
||||||
async fn stop(&self, mode: &str) -> Result<OwnedObjectPath>;
|
async fn stop(&self, mode: &str) -> zbus::Result<OwnedObjectPath>;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus::proxy(
|
#[zbus::proxy(
|
||||||
|
@ -40,28 +40,28 @@ trait SystemdManager {
|
||||||
files: &[&str],
|
files: &[&str],
|
||||||
runtime: bool,
|
runtime: bool,
|
||||||
force: bool,
|
force: bool,
|
||||||
) -> Result<(bool, Vec<(String, String, String)>)>;
|
) -> zbus::Result<(bool, Vec<(String, String, String)>)>;
|
||||||
|
|
||||||
async fn disable_unit_files(
|
async fn disable_unit_files(
|
||||||
&self,
|
&self,
|
||||||
files: &[&str],
|
files: &[&str],
|
||||||
runtime: bool,
|
runtime: bool,
|
||||||
) -> Result<Vec<(String, String, String)>>;
|
) -> zbus::Result<Vec<(String, String, String)>>;
|
||||||
|
|
||||||
async fn mask_unit_files(
|
async fn mask_unit_files(
|
||||||
&self,
|
&self,
|
||||||
files: &[&str],
|
files: &[&str],
|
||||||
runtime: bool,
|
runtime: bool,
|
||||||
force: bool,
|
force: bool,
|
||||||
) -> Result<Vec<(String, String, String)>>;
|
) -> zbus::Result<Vec<(String, String, String)>>;
|
||||||
|
|
||||||
async fn unmask_unit_files(
|
async fn unmask_unit_files(
|
||||||
&self,
|
&self,
|
||||||
files: &[&str],
|
files: &[&str],
|
||||||
runtime: bool,
|
runtime: bool,
|
||||||
) -> Result<Vec<(String, String, String)>>;
|
) -> zbus::Result<Vec<(String, String, String)>>;
|
||||||
|
|
||||||
async fn reload(&self) -> Result<()>;
|
async fn reload(&self) -> zbus::Result<()>;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Display, EnumString, PartialEq, Debug, Copy, Clone)]
|
#[derive(Display, EnumString, PartialEq, Debug, Copy, Clone)]
|
||||||
|
@ -283,7 +283,6 @@ pub mod test {
|
||||||
.interface::<_, MockUnit>(path.to_string_lossy())
|
.interface::<_, MockUnit>(path.to_string_lossy())
|
||||||
.await;
|
.await;
|
||||||
if let Ok(mock_unit) = mock_unit {
|
if let Ok(mock_unit) = mock_unit {
|
||||||
dbg!();
|
|
||||||
mock_unit.get_mut().await.unit_file = String::from("enabled");
|
mock_unit.get_mut().await.unit_file = String::from("enabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue