Skip to content

Commit 3e15568

Browse files
John ZakrzewskiJohn Zakrzewski
authored andcommitted
fix: running linter
Signed-off-by: John Zakrzewski <[email protected]>
1 parent 59690bc commit 3e15568

File tree

3 files changed

+50
-45
lines changed

3 files changed

+50
-45
lines changed

control-plane/csi-driver/src/bin/controller/client.rs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,14 @@ impl RestApiClient {
126126
let ca_certificate_path = cfg.ca_certificate_path();
127127
let cert = match ca_certificate_path {
128128
Some(path) => {
129-
let cert = std::fs::read(path)
130-
.map_err(|error| {
129+
let cert = std::fs::read(path).map_err(|error| {
131130
anyhow::anyhow!(
132131
"Failed to create openapi configuration, Error: '{:?}'",
133132
error
134133
)
135134
})?;
136135
Some(cert)
137-
},
136+
}
138137
None => None,
139138
};
140139
let tower = match (url.scheme(), cert) {
@@ -153,25 +152,23 @@ impl RestApiClient {
153152
error
154153
)
155154
})?
156-
},
155+
}
157156
("https", None) => {
158157
anyhow::bail!("HTTPS endpoint requires a CA certificate path");
159-
},
158+
}
160159
(_, Some(_path)) => {
161160
anyhow::bail!("CA certificate path is only supported for HTTPS endpoints");
162-
},
163-
_ => {
164-
clients::tower::Configuration::builder()
165-
.with_timeout(Some(cfg.io_timeout()))
166-
.with_concurrency_limit(Some(concurrency_limit))
167-
.build_url(url)
168-
.map_err(|error| {
169-
anyhow::anyhow!(
170-
"Failed to create openapi configuration, Error: '{:?}'",
171-
error
172-
)
173-
})?
174161
}
162+
_ => clients::tower::Configuration::builder()
163+
.with_timeout(Some(cfg.io_timeout()))
164+
.with_concurrency_limit(Some(concurrency_limit))
165+
.build_url(url)
166+
.map_err(|error| {
167+
anyhow::anyhow!(
168+
"Failed to create openapi configuration, Error: '{:?}'",
169+
error
170+
)
171+
})?,
175172
};
176173

177174
REST_CLIENT.get_or_init(|| Self {

control-plane/csi-driver/src/bin/controller/config.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
use anyhow::Context;
22
use clap::ArgMatches;
33
use once_cell::sync::OnceCell;
4-
use std::{collections::HashMap, path::{PathBuf, Path}, time::Duration};
4+
use std::{
5+
collections::HashMap,
6+
path::{Path, PathBuf},
7+
time::Duration,
8+
};
59

610
static CONFIG: OnceCell<CsiControllerConfig> = OnceCell::new();
711

@@ -98,8 +102,8 @@ impl CsiControllerConfig {
98102
self.force_unstage_volume
99103
}
100104

101-
/// Path to the CA certificate file.
102-
pub(crate) fn ca_certificate_path(&self) -> Option<&Path> {
105+
/// Path to the CA certificate file.
106+
pub(crate) fn ca_certificate_path(&self) -> Option<&Path> {
103107
self.ca_certificate_path.as_deref()
104108
}
105109
}

k8s/operators/src/pool/main.rs

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use kube::{
3131
use mayastorpool::client::{check_crd, delete, list};
3232
use openapi::clients::{self, tower::Url};
3333
use std::{collections::HashMap, sync::Arc, time::Duration};
34-
use tracing::{error, info, trace, warn, debug};
34+
use tracing::{debug, error, info, trace, warn};
3535
use utils::tracing_telemetry::{FmtLayer, FmtStyle};
3636

3737
const PAGINATION_LIMIT: u32 = 100;
@@ -129,46 +129,50 @@ async fn pool_controller(args: ArgMatches) -> anyhow::Result<()> {
129129
.expect("timeout value is invalid")
130130
.into();
131131

132-
let ca_certificate_path:Option<&str> = args.get_one::<String>("tls-client-ca-path").map(|x| x.as_str());
132+
let ca_certificate_path: Option<&str> = args
133+
.get_one::<String>("tls-client-ca-path")
134+
.map(|x| x.as_str());
133135
// take in cert path and make pem file
134136
let cert = match ca_certificate_path {
135137
Some(path) => {
136138
let cert = std::fs::read(path).expect("Failed to read certificate file");
137139
Some(cert)
138-
},
140+
}
139141
None => None,
140142
};
141143
let cfg = match (url.scheme(), cert) {
142144
("https", Some(cert)) => {
143145
debug!("Attempting TLS connection to {}", url);
144146

145-
clients::tower::Configuration::new(url, timeout, None, Some(cert.as_slice()), true, None)
146-
.map_err(
147-
|error| {
148-
anyhow::anyhow!(
149-
"Failed to create openapi configuration, Error: '{:?}'",
150-
error
151-
)
152-
},
153-
)?
154-
},
147+
clients::tower::Configuration::new(
148+
url,
149+
timeout,
150+
None,
151+
Some(cert.as_slice()),
152+
true,
153+
None,
154+
)
155+
.map_err(|error| {
156+
anyhow::anyhow!(
157+
"Failed to create openapi configuration, Error: '{:?}'",
158+
error
159+
)
160+
})?
161+
}
155162
("https", None) => {
156163
anyhow::bail!("HTTPS endpoint requires a CA certificate path");
157-
},
164+
}
158165
(_, Some(_path)) => {
159166
anyhow::bail!("CA certificate path is only supported for HTTPS endpoints");
160-
},
161-
_ => {
162-
clients::tower::Configuration::new(url, timeout, None, None, true, None)
163-
.map_err(
164-
|error| {
165-
anyhow::anyhow!(
166-
"Failed to create openapi configuration, Error: '{:?}'",
167-
error
168-
)
169-
},
170-
)?
171167
}
168+
_ => clients::tower::Configuration::new(url, timeout, None, None, true, None).map_err(
169+
|error| {
170+
anyhow::anyhow!(
171+
"Failed to create openapi configuration, Error: '{:?}'",
172+
error
173+
)
174+
},
175+
)?,
172176
};
173177
let interval = args
174178
.get_one::<String>("interval")

0 commit comments

Comments
 (0)