Commit 9c2e3947 authored by Heinz N. Gies's avatar Heinz N. Gies

Set routes on startup

parent 2d00afa5
......@@ -71,6 +71,27 @@ impl<'a> Jail<'a> {
let CreateArgs { args, ifs } = self.create_args(config)?;
debug!("Start jail"; "vm" => self.idx.uuid.hyphenated().to_string(), "args" => args.clone().join(" "));
let mut config = self.jail_root();
config.push("config");
if ! self.config.routes.is_empty() {
let mut routes = config.clone();
routes.push("routes");
debug!("preparing routes file";
"vm" => self.idx.uuid.hyphenated().to_string(),
"file" => routes.to_str());
let mut routes_file = File::create(routes)?;
for (dest, gw) in self.config.routes.iter() {
routes_file.write_all(dest.as_bytes())?;
routes_file.write_all(b"\t")?;
routes_file.write_all(gw.as_bytes())?;
routes_file.write_all(b"\n")?;
}
}
let id = start_jail(&self.idx.uuid, args)?;
let id_str = id.to_string();
let mut jprefix = String::from("j");
......@@ -115,20 +136,6 @@ impl<'a> Jail<'a> {
resolver_file.write_all(b"\n")?;
}
}
if ! self.config.routes.is_empty() {
let mut routes = config.clone();
routes.push("routes");
debug!("preparing routes file";
"vm" => self.idx.uuid.hyphenated().to_string(),
"file" => routes.to_str());
let mut routes_file = File::create(routes)?;
for (dest, gw) in self.config.routes.iter() {
routes_file.write_all(dest.as_bytes())?;
routes_file.write_all(b"\t")?;
routes_file.write_all(gw.as_bytes())?;
routes_file.write_all(b"\n")?;
}
}
match self.config.customer_metadata.get("root_authorized_keys") {
None => (),
Some(keys) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment