From 1d037da45afb8183dc533a0a5827cf7ff8057eb1 Mon Sep 17 00:00:00 2001 From: Adrian Heine Date: Thu, 11 May 2017 08:25:40 +0200 Subject: [PATCH] +User resources --- src/symbols/mariadb/user.rs | 5 +++++ src/symbols/owner.rs | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/symbols/mariadb/user.rs b/src/symbols/mariadb/user.rs index 277293e..a44c667 100644 --- a/src/symbols/mariadb/user.rs +++ b/src/symbols/mariadb/user.rs @@ -3,6 +3,7 @@ use std::error::Error; use std::fmt; use command_runner::CommandRunner; +use resources::Resource; use symbols::Symbol; pub struct MariaDBUser<'a> { @@ -42,6 +43,10 @@ impl<'a> Symbol for MariaDBUser<'a> { try!(self.run_sql(&format!("GRANT ALL ON {0}.* TO {0} IDENTIFIED VIA unix_socket", self.user_name))); Ok(()) } + + fn get_prerequisites(&self) -> Vec { + vec![ Resource::new("user", self.user_name.to_string()) ] + } } #[cfg(test)] diff --git a/src/symbols/owner.rs b/src/symbols/owner.rs index 4f34561..5424e05 100644 --- a/src/symbols/owner.rs +++ b/src/symbols/owner.rs @@ -6,9 +6,9 @@ use std::os::unix::fs::MetadataExt; use users::get_user_by_name; -use symbols::Symbol; use command_runner::CommandRunner; - +use resources::Resource; +use symbols::Symbol; pub struct Owner<'a, D> where D: AsRef + fmt::Display { path: D, @@ -33,6 +33,10 @@ impl<'a, D> Symbol for Owner<'a, D> where D: AsRef + fmt::Display { try!(self.command_runner.run_with_args("chown", &[self.user_name.borrow(), self.path.as_ref()])); Ok(()) } + + fn get_prerequisites(&self) -> Vec { + vec![ Resource::new("user", self.user_name.to_string()) ] + } } impl<'a, D> fmt::Display for Owner<'a, D> where D: AsRef + fmt::Display {