chore: trace monitor info with debug
This commit is contained in:
		
							parent
							
								
									f694a9c510
								
							
						
					
					
						commit
						d19212c026
					
				| @ -10,15 +10,24 @@ use crate::clouds::defs::{ | |||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| pub async fn get_cloud_monitor_info(cloud: &mut Cloud, source: &str) -> Result<String> { | pub async fn get_cloud_monitor_info(cloud: &mut Cloud, source: &str) -> Result<String> { | ||||||
|  | 	let debug = envmnt::get_isize("DEBUG",0); 
 | ||||||
| 	let cloud_home_path = format!("{}/{}",&cloud.env.home,&source);	
 | 	let cloud_home_path = format!("{}/{}",&cloud.env.home,&source);	
 | ||||||
| 	let monitor_path = format!("{}/{}",&cloud_home_path,&cloud.env.monitor_run);	
 | 	let monitor_path = format!("{}/{}",&cloud_home_path,&cloud.env.monitor_run);	
 | ||||||
|  | 	if debug > 1 { | ||||||
|  | 		println!("home_path: {}",&monitor_path); | ||||||
|  | 		println!("monitor_path: {}",&monitor_path); | ||||||
|  | 	} | ||||||
| 	if Path::new(&monitor_path).exists() { | 	if Path::new(&monitor_path).exists() { | ||||||
|     let output = Command::new("bash") |     // let output = Command::new("bash")
 | ||||||
| 			.arg(format!("{}",&monitor_path)) | 		//	.arg(format!("{}",&monitor_path))
 | ||||||
|  |     let output = Command::new(&monitor_path) | ||||||
| 			.arg("-o") | 			.arg("-o") | ||||||
| 			.arg("json") | 			.arg("json") | ||||||
| 			.arg(format!("{}",&source)) | 			.arg(format!("{}",&source)) | ||||||
| 			.output()?; | 			.output()?; | ||||||
|  | 	  if debug > 2 { | ||||||
|  | 			dbg!(&output); | ||||||
|  | 		} | ||||||
| 		if !&output.status.success() { | 		if !&output.status.success() { | ||||||
| 			return Err(anyhow!("Run {} for {} failed: {}",&cloud.env.monitor_run,&source,&output.status)); | 			return Err(anyhow!("Run {} for {} failed: {}",&cloud.env.monitor_run,&source,&output.status)); | ||||||
| 		} 
 | 		} 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user