WIP Impl Action

This commit is contained in:
Adrian Heine 2017-07-28 22:46:40 +02:00
parent 23fed5b6ca
commit b8bac1142c
28 changed files with 363 additions and 58 deletions

View file

@ -4,7 +4,7 @@ use std::fmt;
use std::path::Path;
use command_runner::CommandRunner;
use symbols::Symbol;
use symbols::{Action, OwnedSymbolAction, Symbol, SymbolAction, SymbolRunner};
pub struct TlsKey<'a> {
domain: Cow<'a, str>,
@ -47,6 +47,14 @@ impl<'a> Symbol for TlsKey<'a> {
fn execute(&self) -> Result<(), Box<Error>> {
self.command_runner.run_successfully("openssl", &["genrsa", "-out", &self.get_path(), &self.get_bytes().to_string()])
}
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))
}
}
#[cfg(test)]