Browse Source

+User resources

master
Adrian Heine 8 years ago
parent
commit
1d037da45a
  1. 5
      src/symbols/mariadb/user.rs
  2. 8
      src/symbols/owner.rs

5
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<Resource> {
vec![ Resource::new("user", self.user_name.to_string()) ]
}
}
#[cfg(test)]

8
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<str> + fmt::Display {
path: D,
@ -33,6 +33,10 @@ impl<'a, D> Symbol for Owner<'a, D> where D: AsRef<str> + fmt::Display {
try!(self.command_runner.run_with_args("chown", &[self.user_name.borrow(), self.path.as_ref()]));
Ok(())
}
fn get_prerequisites(&self) -> Vec<Resource> {
vec![ Resource::new("user", self.user_name.to_string()) ]
}
}
impl<'a, D> fmt::Display for Owner<'a, D> where D: AsRef<str> + fmt::Display {

Loading…
Cancel
Save