Skip to content

Commit 2ee2133

Browse files
Apply cargo fmt for CI
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 9a8bdb7 commit 2ee2133

File tree

3 files changed

+54
-19
lines changed

3 files changed

+54
-19
lines changed

src/inspections/runner.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,14 @@ impl InspectionRunner {
261261
.and_then(|nodes| nodes.first())
262262
.and_then(|n| n.timestamp_local.as_ref())
263263
.and_then(|s| {
264-
chrono::DateTime::parse_from_str(s, "%Y-%m-%dT%H:%M:%S%z").ok().map(|dt| {
265-
(
266-
dt.format("%Y-%m-%d %H:%M:%S %:z").to_string(),
267-
dt.format("%Y-%m-%d-%H%M%S").to_string(),
268-
)
269-
})
264+
chrono::DateTime::parse_from_str(s, "%Y-%m-%dT%H:%M:%S%z")
265+
.ok()
266+
.map(|dt| {
267+
(
268+
dt.format("%Y-%m-%d %H:%M:%S %:z").to_string(),
269+
dt.format("%Y-%m-%d-%H%M%S").to_string(),
270+
)
271+
})
270272
})
271273
.map(|(h, f)| (Some(h), Some(f)))
272274
.unwrap_or((None, None));

src/node_inspection/collector.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ async fn poll_for_logs(
8787

8888
println!(
8989
" {} ({}, {}/{} pods have logs)",
90-
"Waiting for node inspector logs..."
91-
.bright_yellow(),
90+
"Waiting for node inspector logs...".bright_yellow(),
9291
format_duration(elapsed_secs),
9392
ready_count,
9493
total
@@ -128,7 +127,10 @@ pub async fn ensure_node_inspector_ready(
128127
let pods = match pods_api.list(&list_params).await {
129128
Ok(l) => l,
130129
Err(e) => {
131-
debug!("Node inspector DaemonSet pods list failed in {}: {}", namespace, e);
130+
debug!(
131+
"Node inspector DaemonSet pods list failed in {}: {}",
132+
namespace, e
133+
);
132134
return NodeInspectorStatus::NotDeployed;
133135
}
134136
};
@@ -210,7 +212,10 @@ pub async fn ensure_node_inspector_ready(
210212
.await
211213
.is_err()
212214
{
213-
debug!("Failed to patch DaemonSet {} in {}", DAEMONSET_NAME, namespace);
215+
debug!(
216+
"Failed to patch DaemonSet {} in {}",
217+
DAEMONSET_NAME, namespace
218+
);
214219
return NodeInspectorStatus::NotDeployed;
215220
}
216221

src/reporting/generator.rs

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -794,8 +794,12 @@ impl ReportGenerator {
794794

795795
// (0) Node General Information: Node | OS Version | IP Address | Kernel Version | Uptime | Collection time
796796
out.push_str("### Node General Information\n\n");
797-
out.push_str("| Node | OS Version | IP Address | Kernel Version | Uptime | Collection time |\n");
798-
out.push_str("|------|-------------|------------|----------------|--------|------------------|\n");
797+
out.push_str(
798+
"| Node | OS Version | IP Address | Kernel Version | Uptime | Collection time |\n",
799+
);
800+
out.push_str(
801+
"|------|-------------|------------|----------------|--------|------------------|\n",
802+
);
799803
for n in nodes {
800804
let (api_os, api_kernel) = node_api_os_kernel
801805
.get(&n.node_name)
@@ -811,7 +815,11 @@ impl ReportGenerator {
811815
.or(n.kernel_version.as_deref())
812816
.unwrap_or("-");
813817
let uptime = n.uptime.as_deref().unwrap_or("-");
814-
let timestamp = if n.timestamp.is_empty() { "-" } else { n.timestamp.as_str() };
818+
let timestamp = if n.timestamp.is_empty() {
819+
"-"
820+
} else {
821+
n.timestamp.as_str()
822+
};
815823
out.push_str(&format!(
816824
"| {} | {} | {} | {} | {} | {} |\n",
817825
n.node_name, os_ver, ip, kernel, uptime, timestamp
@@ -999,7 +1007,9 @@ impl ReportGenerator {
9991007
None => "None",
10001008
}
10011009
}
1002-
out.push_str("| Node/Service | Kubelet | Container runtime | NTP synced | Journald | Crontab |\n");
1010+
out.push_str(
1011+
"| Node/Service | Kubelet | Container runtime | NTP synced | Journald | Crontab |\n",
1012+
);
10031013
out.push_str("|------|--------|-------------------|------------|----------|----------|\n");
10041014
for n in nodes {
10051015
let kubelet = service_cell(n.services.kubelet_running);
@@ -1017,8 +1027,12 @@ impl ReportGenerator {
10171027
// (3) Node security and kernel modules: Node | SELinux | Firewalld | IPVS | br_netfilter | overlay | nf_conntrack
10181028
out.push_str("### Node security and kernel modules\n\n");
10191029
out.push_str("SELinux, firewalld, IPVS, br_netfilter, overlay, and nf_conntrack status; helps troubleshoot network and security policy.\n\n");
1020-
out.push_str("| Node | SELinux | Firewalld | IPVS | br_netfilter | overlay | nf_conntrack |\n");
1021-
out.push_str("|------|---------|------------|------|--------------|---------|---------------|\n");
1030+
out.push_str(
1031+
"| Node | SELinux | Firewalld | IPVS | br_netfilter | overlay | nf_conntrack |\n",
1032+
);
1033+
out.push_str(
1034+
"|------|---------|------------|------|--------------|---------|---------------|\n",
1035+
);
10221036
fn yes_no(v: Option<bool>) -> &'static str {
10231037
match v {
10241038
Some(true) => "Yes",
@@ -1117,7 +1131,13 @@ impl ReportGenerator {
11171131
};
11181132
out.push_str(&format!(
11191133
"| {} | {} | {} | {} | {} | {} | {} |\n",
1120-
n.node_name, host_path_display(&c.path), expired, c.expiration_date, c.days_remaining, level, issue_code
1134+
n.node_name,
1135+
host_path_display(&c.path),
1136+
expired,
1137+
c.expiration_date,
1138+
c.days_remaining,
1139+
level,
1140+
issue_code
11211141
));
11221142
}
11231143
}
@@ -1433,7 +1453,11 @@ impl ReportGenerator {
14331453
content.push_str("| Secret (namespace/name) | Expired | Expiry (UTC) | Days to Expiry | Level | Issue Code |\n");
14341454
content.push_str("|--------------------------|---------|--------------|----------------|-------|------------|\n");
14351455
for row in expiries {
1436-
let expired = if row.days_until_expiry < 0 { "Yes" } else { "No" };
1456+
let expired = if row.days_until_expiry < 0 {
1457+
"Yes"
1458+
} else {
1459+
"No"
1460+
};
14371461
let (level, code_link) = if row.days_until_expiry < 0 {
14381462
(
14391463
"Critical",
@@ -1770,7 +1794,11 @@ impl ReportGenerator {
17701794
content.push_str("| Secret (namespace/name) | Expired | Expiry (UTC) | Days to Expiry | Level | Issue Code |\n");
17711795
content.push_str("|--------------------------|---------|--------------|----------------|-------|------------|\n");
17721796
for row in expiries {
1773-
let expired = if row.days_until_expiry < 0 { "Yes" } else { "No" };
1797+
let expired = if row.days_until_expiry < 0 {
1798+
"Yes"
1799+
} else {
1800+
"No"
1801+
};
17741802
let (level, code_link) = if row.days_until_expiry < 0 {
17751803
(
17761804
"Critical",

0 commit comments

Comments
 (0)