WIP Impl Action
This commit is contained in:
parent
23fed5b6ca
commit
b8bac1142c
28 changed files with 363 additions and 58 deletions
|
|
@ -1,8 +1,7 @@
|
|||
use std::error::Error;
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
use std::fs::{self, Metadata};
|
||||
use std::fs;
|
||||
use std::process::Output;
|
||||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
|
|
@ -10,7 +9,7 @@ use std::ops::Deref;
|
|||
|
||||
use command_runner::{CommandRunner, SetuidCommandRunner};
|
||||
use resources::Resource;
|
||||
use symbols::Symbol;
|
||||
use symbols::{Action, OwnedSymbolAction, Symbol, SymbolAction, SymbolRunner};
|
||||
use symbols::file::File as FileSymbol;
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
@ -152,6 +151,14 @@ impl<'a, C, R> Symbol for NodeJsSystemdUserService<'a, C, R> where C: Deref<Targ
|
|||
r.extend(self.file.get_prerequisites().into_iter());
|
||||
r
|
||||
}
|
||||
|
||||
fn as_action<'b>(&'b self, runner: &'b SymbolRunner) -> Box<Action + 'b> {
|
||||
Box::new(SymbolAction::new(runner, self))
|
||||
}
|
||||
|
||||
fn into_action<'b>(self: Box<Self>, runner: &'b SymbolRunner) -> Box<Action + 'b> where Self: 'b {
|
||||
Box::new(OwnedSymbolAction::new(runner, *self))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, C, R> fmt::Display for NodeJsSystemdUserService<'a, C, R> where C: Deref<Target=str>, R: CommandRunner {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::error::Error;
|
|||
use std::fmt;
|
||||
|
||||
use command_runner::CommandRunner;
|
||||
use symbols::Symbol;
|
||||
use symbols::{Action, OwnedSymbolAction, Symbol, SymbolAction, SymbolRunner};
|
||||
|
||||
pub struct ReloadService<'a> {
|
||||
service: &'a str,
|
||||
|
|
@ -26,6 +26,14 @@ impl<'a> Symbol for ReloadService<'a> {
|
|||
fn execute(&self) -> Result<(), Box<Error>> {
|
||||
self.command_runner.run_successfully("systemctl", &["reload-or-restart", self.service])
|
||||
}
|
||||
|
||||
fn as_action<'b>(&'b self, runner: &'b SymbolRunner) -> Box<Action + 'b> {
|
||||
Box::new(SymbolAction::new(runner, self))
|
||||
}
|
||||
|
||||
fn into_action<'b>(self: Box<Self>, runner: &'b SymbolRunner) -> Box<Action + 'b> where Self: 'b {
|
||||
Box::new(OwnedSymbolAction::new(runner, *self))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> fmt::Display for ReloadService<'a> {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use std::fmt;
|
|||
use std::path::PathBuf;
|
||||
|
||||
use command_runner::CommandRunner;
|
||||
use symbols::Symbol;
|
||||
use symbols::{Action, OwnedSymbolAction, Symbol, SymbolAction, SymbolRunner};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum SystemdUserSessionError<E: Error> {
|
||||
|
|
@ -58,6 +58,14 @@ impl<'a> Symbol for SystemdUserSession<'a> {
|
|||
fn execute(&self) -> Result<(), Box<Error>> {
|
||||
self.command_runner.run_successfully("loginctl", &["enable-linger", self.user_name.borrow()])
|
||||
}
|
||||
|
||||
fn as_action<'b>(&'b self, runner: &'b SymbolRunner) -> Box<Action + 'b> {
|
||||
Box::new(SymbolAction::new(runner, self))
|
||||
}
|
||||
|
||||
fn into_action<'b>(self: Box<Self>, runner: &'b SymbolRunner) -> Box<Action + 'b> where Self: 'b {
|
||||
Box::new(OwnedSymbolAction::new(runner, *self))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> fmt::Display for SystemdUserSession<'a> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue