chore: Fix all warnings in the project, ignore unused variables mostly

This commit is contained in:
Jean-Gabriel Gill-Couture 2025-04-24 10:22:53 -04:00
parent 9345e63a32
commit dccc9c04f5
12 changed files with 23 additions and 34 deletions

View File

@ -4,13 +4,13 @@ use harmony_macros::yaml;
use k8s_openapi::{
api::{
apps::v1::{Deployment, DeploymentSpec},
core::v1::{Container, Node, Pod, PodSpec, PodTemplateSpec},
core::v1::{Container, PodSpec, PodTemplateSpec},
},
apimachinery::pkg::apis::meta::v1::LabelSelector,
};
use kube::{
Api, Client, Config, ResourceExt,
api::{ListParams, ObjectMeta, PostParams},
Api, Client, ResourceExt,
api::{ObjectMeta, PostParams},
};
#[tokio::main]
@ -42,8 +42,7 @@ async fn main() {
// println!("found node {} status {:?}", n.name_any(), n.status.unwrap())
// }
let nginxdeployment = nginx_deployment_2();
let nginxdeployment = nginx_deployment_serde();
assert_eq!(nginx_deployment(), nginx_macro());
assert_eq!(nginx_deployment_2(), nginx_macro());
assert_eq!(nginx_deployment_serde(), nginx_macro());
let nginxdeployment = nginx_macro();
@ -149,6 +148,7 @@ fn nginx_deployment_2() -> Deployment {
deployment
}
fn nginx_deployment() -> Deployment {
let deployment = Deployment {
metadata: ObjectMeta {

View File

@ -1,10 +1,7 @@
use harmony::{
inventory::Inventory,
maestro::Maestro,
modules::{
dummy::{ErrorScore, PanicScore, SuccessScore},
k8s::deployment::K8sDeploymentScore,
},
modules::dummy::{ErrorScore, PanicScore, SuccessScore},
topology::HAClusterTopology,
};

View File

@ -7,7 +7,6 @@ use harmony::{
dns::DnsScore,
dummy::{ErrorScore, PanicScore, SuccessScore},
load_balancer::LoadBalancerScore,
okd::load_balancer::OKDLoadBalancerScore,
},
topology::{
BackendServer, HAClusterTopology, HealthCheck, HttpMethod, HttpStatusCode,

View File

@ -7,7 +7,6 @@ use super::{
data::{Id, Version},
executors::ExecutorError,
inventory::Inventory,
topology::Topology,
};
pub enum InterpretName {

View File

@ -82,7 +82,7 @@ where
};
let formatted_val = self.format_value_as_string(v, indent + 1);
let mut lines = formatted_val.lines().map(|line| line.trim_start());
let lines = formatted_val.lines().map(|line| line.trim_start());
let wrapped_lines: Vec<_> = lines
.flat_map(|line| self.wrap_or_truncate(line.trim_start(), 48))

View File

@ -1,5 +1,3 @@
use std::io;
use async_trait::async_trait;
use inquire::Confirm;
use log::{info, warn};
@ -16,15 +14,13 @@ use crate::{
use super::{Topology, k8s::K8sClient};
struct K8sState {
client: K8sClient,
source: K8sSource,
_client: K8sClient,
_source: K8sSource,
message: String,
}
enum K8sSource {
RemoteCluster,
LocalK3d,
// TODO: Add variants for cloud providers like AwsEks, Gke, Aks
}
pub struct K8sAnywhereTopology {
@ -62,14 +58,14 @@ impl K8sAnywhereTopology {
if k8s_anywhere_config.use_system_kubeconfig {
match self.try_load_system_kubeconfig().await {
Some(client) => todo!(),
Some(_client) => todo!(),
None => todo!(),
}
}
if let Some(kubeconfig) = k8s_anywhere_config.kubeconfig {
match self.try_load_kubeconfig(&kubeconfig).await {
Some(client) => todo!(),
Some(_client) => todo!(),
None => todo!(),
}
}
@ -93,8 +89,8 @@ impl K8sAnywhereTopology {
info!("Starting K8sAnywhere installation");
match self.try_install_k3d().await {
Ok(client) => Ok(Some(K8sState {
client,
source: K8sSource::LocalK3d,
_client: client,
_source: K8sSource::LocalK3d,
message: "Successfully installed K3D cluster and acquired client".to_string(),
})),
Err(_) => todo!(),

View File

@ -8,9 +8,7 @@ use helm_wrapper_rs;
use helm_wrapper_rs::blocking::{DefaultHelmExecutor, HelmExecutor};
use non_blank_string_rs::NonBlankString;
use serde::Serialize;
use serde::de::DeserializeOwned;
use std::collections::HashMap;
use std::path::PathBuf;
#[derive(Debug, Clone, Serialize)]
pub struct HelmChartScore {

View File

@ -38,14 +38,14 @@ impl<T: Topology> Score<T> for K3DInstallationScore {
}
#[derive(Debug)]
struct K3dInstallationInterpret {}
pub struct K3dInstallationInterpret {}
#[async_trait]
impl<T: Topology> Interpret<T> for K3dInstallationInterpret {
async fn execute(
&self,
inventory: &Inventory,
topology: &T,
_inventory: &Inventory,
_topology: &T,
) -> Result<Outcome, InterpretError> {
todo!()
}

View File

@ -13,7 +13,7 @@ use crate::{
};
impl std::fmt::Display for OKDLoadBalancerScore {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
todo!()
}
}

View File

@ -2,15 +2,15 @@ use crate::data::Version;
#[derive(Debug, Clone)]
pub struct OKDUpgradeScore {
current_version: Version,
target_version: Version,
_current_version: Version,
_target_version: Version,
}
impl OKDUpgradeScore {
pub fn new() -> Self {
Self {
current_version: Version::from("4.17.0-okd-scos.0").unwrap(),
target_version: Version::from("").unwrap(),
_current_version: Version::from("4.17.0-okd-scos.0").unwrap(),
_target_version: Version::from("").unwrap(),
}
}
}

View File

@ -27,7 +27,7 @@ pub struct OPNsenseShellCommandScore {
}
impl Serialize for OPNsenseShellCommandScore {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
fn serialize<S>(&self, _serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{

View File

@ -17,7 +17,7 @@ pub struct OPNSenseLaunchUpgrade {
}
impl Serialize for OPNSenseLaunchUpgrade {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
fn serialize<S>(&self, _serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{