Commit 815fe79b authored by Alexandre Pere's avatar Alexandre Pere

Fixes absolute path bug

parent 8b2221f9
...@@ -23,4 +23,5 @@ tracing = "0.1.10" ...@@ -23,4 +23,5 @@ tracing = "0.1.10"
tracing-attributes = "0.1.5" tracing-attributes = "0.1.5"
tracing-futures = {version = "0.1.0", features=["futures-preview"]} tracing-futures = {version = "0.1.0", features=["futures-preview"]}
openssl-probe = "0.1.2" openssl-probe = "0.1.2"
path_abs = "0.5.0"
liborchestra = { path = "../liborchestra"} liborchestra = { path = "../liborchestra"}
...@@ -32,6 +32,7 @@ use rand::{self, Rng}; ...@@ -32,6 +32,7 @@ use rand::{self, Rng};
use std::io::Write; use std::io::Write;
use tracing::{self, error, debug, info, warn}; use tracing::{self, error, debug, info, warn};
use liborchestra::commons::format_env; use liborchestra::commons::format_env;
use path_abs::PathAbs;
//--------------------------------------------------------------------------------------- SUBCOMMAND //--------------------------------------------------------------------------------------- SUBCOMMAND
...@@ -430,7 +431,7 @@ async fn perform_on_node(store: EnvironmentStore, ...@@ -430,7 +431,7 @@ async fn perform_on_node(store: EnvironmentStore,
let mut store = store; let mut store = store;
push_env(&mut store, "RUNAWAY_ARGUMENTS", arguments); push_env(&mut store, "RUNAWAY_ARGUMENTS", arguments);
// We generate an uuid // We generate an uuid
let id = uuid::Uuid::new_v4().hyphenated().to_string(); let id = uuid::Uuid::new_v4().hyphenated().to_string();
push_env(&mut store, "RUNAWAY_UUID", id.clone()); push_env(&mut store, "RUNAWAY_UUID", id.clone());
...@@ -518,7 +519,9 @@ async fn perform_on_node(store: EnvironmentStore, ...@@ -518,7 +519,9 @@ async fn perform_on_node(store: EnvironmentStore,
local_output_folder = remote_folder.clone(); local_output_folder = remote_folder.clone();
} else { } else {
let local_output_string = substitute_environment(&execution_context.envs, output_folder_pattern.as_str()); let local_output_string = substitute_environment(&execution_context.envs, output_folder_pattern.as_str());
local_output_folder = to_exit!(PathBuf::from(local_output_string).canonicalize(), Exit::OutputFolder)?; let abs_local_output_folder = to_exit!(PathAbs::new(local_output_string), Exit::OutputFolder)?;
let abs_local_output_folder: &PathBuf = abs_local_output_folder.as_ref();
local_output_folder = abs_local_output_folder.to_owned();
} }
debug!("Local output folder set to: {}", local_output_folder.to_str().unwrap()); debug!("Local output folder set to: {}", local_output_folder.to_str().unwrap());
if !local_output_folder.exists(){ if !local_output_folder.exists(){
...@@ -606,13 +609,12 @@ fn unpacks_fetch_post_proc(matches: &clap::ArgMatches<'_>, ...@@ -606,13 +609,12 @@ fn unpacks_fetch_post_proc(matches: &clap::ArgMatches<'_>,
// We execute the post processing // We execute the post processing
debug!("Executing post script"); debug!("Executing post script");
let command_string = if matches.is_present("post-script"){ let command_string = if matches.is_present("post-script"){
let path_str = PathBuf::from(matches.value_of("post-script").unwrap()) let path = PathBuf::from(matches.value_of("post-script").unwrap());
.canonicalize() let path = to_exit!(path.canonicalize(), Exit::PostScriptPath)?;
.unwrap() let path = path.to_str()
.to_str()
.unwrap() .unwrap()
.to_owned(); .to_owned();
format!("bash {}", path_str) format!("bash {}", path)
} else { } else {
matches.value_of("post-command").unwrap().to_owned() matches.value_of("post-command").unwrap().to_owned()
}; };
......
...@@ -32,6 +32,7 @@ use std::convert::TryInto; ...@@ -32,6 +32,7 @@ use std::convert::TryInto;
use rand::{self, Rng}; use rand::{self, Rng};
use std::io::Write; use std::io::Write;
use tracing::{self, info, error, debug}; use tracing::{self, info, error, debug};
use path_abs::PathAbs;
//--------------------------------------------------------------------------------------- SUBCOMMAND //--------------------------------------------------------------------------------------- SUBCOMMAND
...@@ -459,7 +460,9 @@ async fn perform_on_node(store: EnvironmentStore, ...@@ -459,7 +460,9 @@ async fn perform_on_node(store: EnvironmentStore,
local_output_folder = remote_folder.clone(); local_output_folder = remote_folder.clone();
} else { } else {
let local_output_string = substitute_environment(&execution_context.envs, output_folder_pattern); let local_output_string = substitute_environment(&execution_context.envs, output_folder_pattern);
local_output_folder = to_exit!(PathBuf::from(local_output_string).canonicalize(), Exit::OutputFolder)?; let abs_local_output_folder = to_exit!(PathAbs::new(local_output_string), Exit::OutputFolder)?;
let abs_local_output_folder: &PathBuf = abs_local_output_folder.as_ref();
local_output_folder = abs_local_output_folder.to_owned();
} }
debug!("Local output folder set to: {}", local_output_folder.to_str().unwrap()); debug!("Local output folder set to: {}", local_output_folder.to_str().unwrap());
......
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