1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-06-03 09:04:12 +02:00

proper healthy check for s3

This commit is contained in:
Robin Appelman 2021-04-08 15:48:22 +02:00
commit 8c191859b2
2 changed files with 15 additions and 3 deletions

View file

@ -86,7 +86,7 @@ pub async fn exec_tty<S1: AsRef<str>, S2: Into<String>>(
}
pub async fn exec<S1: AsRef<str>, S2: Into<String>>(
docker: &mut Docker,
docker: &Docker,
container: S1,
user: &str,
cmd: Vec<S2>,

View file

@ -1,3 +1,4 @@
use crate::exec::exec;
use crate::image::pull_image;
use bollard::container::{Config, CreateContainerOptions, NetworkingConfig};
use bollard::models::{EndpointSettings, HostConfig};
@ -123,8 +124,19 @@ impl ObjectStore {
Ok(id)
}
async fn is_healthy(&self, _docker: &Docker, _cloud_id: &str) -> Result<bool> {
Ok(true)
async fn is_healthy(&self, docker: &Docker, cloud_id: &str) -> Result<bool> {
let mut output = Vec::new();
exec(
docker,
format!("{}-object", cloud_id),
"root",
vec!["curl", "localhost:4569/"],
vec![],
Some(&mut output),
)
.await?;
let output = String::from_utf8(output)?;
Ok(output.contains("ListAllMyBucketsResult"))
}
fn container_name(&self, cloud_id: &str) -> String {