cargo fmt

This commit is contained in:
Jean-Gabriel Gill-Couture 2025-10-02 16:46:43 -04:00
parent f75765408d
commit 58e609767b
8 changed files with 58 additions and 61 deletions

View File

@ -3,10 +3,7 @@ use std::time::Duration;
use derive_new::new;
use k8s_openapi::{
ClusterResourceScope, NamespaceResourceScope,
api::{
apps::v1::Deployment,
core::v1::Pod,
},
api::{apps::v1::Deployment, core::v1::Pod},
};
use kube::{
Client, Config, Error, Resource,
@ -172,10 +169,11 @@ impl K8sClient {
if let Some(p) = pod
&& let Some(status) = p.status
&& let Some(phase) = status.phase
&& phase.to_lowercase() == "running" {
return Ok(());
}
&& let Some(phase) = status.phase
&& phase.to_lowercase() == "running"
{
return Ok(());
}
if elapsed >= timeout_secs {
return Err(Error::Discovery(DiscoveryError::MissingResource(format!(

View File

@ -183,15 +183,12 @@ pub(crate) fn get_health_check_for_backend(
match uppercase {
"TCP" => {
if let Some(checkport) = haproxy_health_check.checkport.content.as_ref()
&& !checkport.is_empty() {
return Some(HealthCheck::TCP(Some(checkport.parse().unwrap_or_else(
|_| {
panic!(
"HAProxy check port should be a valid port number, got {checkport}"
)
},
))));
}
&& !checkport.is_empty()
{
return Some(HealthCheck::TCP(Some(checkport.parse().unwrap_or_else(
|_| panic!("HAProxy check port should be a valid port number, got {checkport}"),
))));
}
Some(HealthCheck::TCP(None))
}
"HTTP" => {

View File

@ -10,10 +10,7 @@ use crate::{
inventory::Inventory,
modules::helm::chart::{HelmChartScore, HelmRepository},
score::Score,
topology::{
HelmCommand, K8sclient, Topology, ingress::Ingress,
k8s::K8sClient,
},
topology::{HelmCommand, K8sclient, Topology, ingress::Ingress, k8s::K8sClient},
};
use harmony_types::id::Id;

View File

@ -194,10 +194,10 @@ impl RustWebapp {
Some(body_full(tar_data.into())),
);
while let Some(mut msg) = image_build_stream.next().await {
while let Some(msg) = image_build_stream.next().await {
trace!("Got bollard msg {msg:?}");
match msg {
Ok(mut msg) => {
Ok(msg) => {
if let Some(progress) = msg.progress_detail {
info!(
"Build progress {}/{}",
@ -511,25 +511,23 @@ ingress:
fs::write(chart_dir.join("values.yaml"), values_yaml)?;
// Create templates/_helpers.tpl
let helpers_tpl = format!(
r#"
{{{{/*
let helpers_tpl = r#"
{{/*
Expand the name of the chart.
*/}}}}
{{{{- define "chart.name" -}}}}
{{{{- default .Chart.Name $.Values.nameOverride | trunc 63 | trimSuffix "-" }}}}
{{{{- end }}}}
*/}}
{{- define "chart.name" -}}
{{- default .Chart.Name $.Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{{{/*
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}}}
{{{{- define "chart.fullname" -}}}}
{{{{- $name := default .Chart.Name $.Values.nameOverride }}}}
{{{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}}}
{{{{- end }}}}
"#
);
*/}}
{{- define "chart.fullname" -}}
{{- $name := default .Chart.Name $.Values.nameOverride }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
"#.to_string();
fs::write(templates_dir.join("_helpers.tpl"), helpers_tpl)?;
// Create templates/service.yaml

View File

@ -107,9 +107,10 @@ impl HelmCommandExecutor {
pub fn run_command(mut self, mut args: Vec<String>) -> Result<Output, std::io::Error> {
if let Some(d) = self.debug
&& d {
args.push("--debug".to_string());
}
&& d
{
args.push("--debug".to_string());
}
let path = if let Some(p) = self.path {
p
@ -233,24 +234,28 @@ impl HelmChart {
}
if let Some(crd) = self.include_crds
&& crd {
args.push("--include-crds".to_string());
}
&& crd
{
args.push("--include-crds".to_string());
}
if let Some(st) = self.skip_tests
&& st {
args.push("--skip-tests".to_string());
}
&& st
{
args.push("--skip-tests".to_string());
}
if let Some(sh) = self.skip_hooks
&& sh {
args.push("--no-hooks".to_string());
}
&& sh
{
args.push("--no-hooks".to_string());
}
if let Some(d) = self.debug
&& d {
args.push("--debug".to_string());
}
&& d
{
args.push("--debug".to_string());
}
args
}

View File

@ -1,4 +1,3 @@
use kube::CustomResource;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

View File

@ -104,7 +104,9 @@ impl OKDSetup02BootstrapInterpret {
InterpretError::new(format!("Failed to create okd installation directory : {e}"))
})?;
if !exit_status.success() {
return Err(InterpretError::new("Failed to create okd installation directory".to_string()));
return Err(InterpretError::new(
"Failed to create okd installation directory".to_string(),
));
} else {
info!(
"Created OKD installation directory {}",

View File

@ -183,12 +183,13 @@ impl CephRemoveOsdInterpret {
if let Some(deployment) = dep
&& let Some(status) = deployment.status
&& status.replicas.unwrap_or(1) == 0 && status.ready_replicas.unwrap_or(1) == 0
{
return Ok(Outcome::success(
"Deployment successfully scaled down.".to_string(),
));
}
&& status.replicas.unwrap_or(1) == 0
&& status.ready_replicas.unwrap_or(1) == 0
{
return Ok(Outcome::success(
"Deployment successfully scaled down.".to_string(),
));
}
if start.elapsed() > timeout {
return Err(InterpretError::new(format!(