Switch CommandRunner to OsStr

This commit is contained in:
Adrian Heine 2017-09-06 21:33:05 +02:00
parent b8bac1142c
commit 3b45b0f77c
22 changed files with 220 additions and 148 deletions

View file

@ -7,13 +7,13 @@ use command_runner::CommandRunner;
use resources::Resource;
use symbols::{Action, OwnedSymbolAction, Symbol, SymbolAction, SymbolRunner};
pub struct TlsCsr<'a> {
pub struct TlsCsr<'a, C: 'a + CommandRunner> {
domain: Cow<'a, str>,
command_runner: &'a CommandRunner
command_runner: &'a C
}
impl<'a> TlsCsr<'a> {
pub fn new(domain: Cow<'a, str>, command_runner: &'a CommandRunner) -> TlsCsr<'a> {
impl<'a, C: CommandRunner> TlsCsr<'a, C> {
pub fn new(domain: Cow<'a, str>, command_runner: &'a C) -> Self {
TlsCsr {
domain: domain,
command_runner: command_runner
@ -29,13 +29,13 @@ impl<'a> TlsCsr<'a> {
}
}
impl<'a> fmt::Display for TlsCsr<'a> {
impl<'a, C: CommandRunner> fmt::Display for TlsCsr<'a, C> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "TlsCsr {}", self.domain)
}
}
impl<'a> Symbol for TlsCsr<'a> {
impl<'a, C: CommandRunner> Symbol for TlsCsr<'a, C> {
fn target_reached(&self) -> Result<bool, Box<Error>> {
if !Path::new(&self.get_csr_path()).exists() {
return Ok(false);

View file

@ -6,13 +6,13 @@ use std::path::Path;
use command_runner::CommandRunner;
use symbols::{Action, OwnedSymbolAction, Symbol, SymbolAction, SymbolRunner};
pub struct TlsKey<'a> {
pub struct TlsKey<'a, C: 'a + CommandRunner> {
domain: Cow<'a, str>,
command_runner: &'a CommandRunner
command_runner: &'a C
}
impl<'a> TlsKey<'a> {
pub fn new(domain: Cow<'a, str>, command_runner: &'a CommandRunner) -> TlsKey<'a> {
impl<'a, C: CommandRunner> TlsKey<'a, C> {
pub fn new(domain: Cow<'a, str>, command_runner: &'a C) -> Self {
TlsKey {
domain: domain,
command_runner: command_runner
@ -28,13 +28,13 @@ impl<'a> TlsKey<'a> {
}
}
impl<'a> fmt::Display for TlsKey<'a> {
impl<'a, C: CommandRunner> fmt::Display for TlsKey<'a, C> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "TlsKey {}", self.domain)
}
}
impl<'a> Symbol for TlsKey<'a> {
impl<'a, C: CommandRunner> Symbol for TlsKey<'a, C> {
fn target_reached(&self) -> Result<bool, Box<Error>> {
if !Path::new(&self.get_path()).exists() {
return Ok(false);

View file

@ -7,13 +7,13 @@ use command_runner::CommandRunner;
use resources::Resource;
use symbols::{Action, OwnedSymbolAction, Symbol, SymbolAction, SymbolRunner};
pub struct SelfSignedTlsCert<'a> {
pub struct SelfSignedTlsCert<'a, C: 'a + CommandRunner> {
domain: Cow<'a, str>,
command_runner: &'a CommandRunner
command_runner: &'a C
}
impl<'a> SelfSignedTlsCert<'a> {
pub fn new(domain: Cow<'a, str>, command_runner: &'a CommandRunner) -> SelfSignedTlsCert<'a> {
impl<'a, C: CommandRunner> SelfSignedTlsCert<'a, C> {
pub fn new(domain: Cow<'a, str>, command_runner: &'a C) -> Self {
SelfSignedTlsCert {
domain: domain,
command_runner: command_runner
@ -29,7 +29,7 @@ impl<'a> SelfSignedTlsCert<'a> {
}
}
impl<'a> fmt::Display for SelfSignedTlsCert<'a> {
impl<'a, C: CommandRunner> fmt::Display for SelfSignedTlsCert<'a, C> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "SelfSignedTlsCert {}", self.domain)
}
@ -37,7 +37,7 @@ impl<'a> fmt::Display for SelfSignedTlsCert<'a> {
const DAYS_IN_SECONDS: u32 = 24*60*60;
impl<'a> Symbol for SelfSignedTlsCert<'a> {
impl<'a, C: CommandRunner> Symbol for SelfSignedTlsCert<'a, C> {
fn target_reached(&self) -> Result<bool, Box<Error>> {
if !Path::new(&self.get_cert_path()).exists() {
return Ok(false);