1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-06-03 17:14:08 +02:00

allow exec in db

This commit is contained in:
Robin Appelman 2021-06-14 18:46:00 +02:00
commit b46291b0f0
3 changed files with 89 additions and 18 deletions

View file

@ -1,4 +1,4 @@
use crate::args::HazeArgs;
use crate::args::{ExecService, HazeArgs};
use crate::cloud::Cloud;
use crate::config::HazeConfig;
use crate::exec::container_logs;
@ -111,19 +111,42 @@ async fn main() -> Result<()> {
print!("{}", log);
}
}
HazeArgs::Exec { filter, command } => {
HazeArgs::Exec {
filter,
service,
command,
} => {
let cloud = Cloud::get_by_filter(&mut docker, filter, &config).await?;
cloud
.exec(
&mut docker,
if command.is_empty() {
vec!["bash".to_string()]
} else {
command
},
true,
)
.await?;
match service {
None => {
cloud
.exec(
&mut docker,
if command.is_empty() {
vec!["bash".to_string()]
} else {
command
},
true,
)
.await?;
}
Some(ExecService::Db) => {
cloud
.db
.exec_sh(
&mut docker,
&cloud.id,
if command.is_empty() {
vec!["bash".to_string()]
} else {
command
},
true,
)
.await?;
}
}
}
HazeArgs::Occ {
filter,