Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion crates/docbuilder/src/clap_model/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ impl CommandModel {
.filter(|v| v.name != "help")
.collect(),

subcommands: cmd.get_subcommands().map(CommandModel::from).collect(),
subcommands: cmd
.get_subcommands()
.filter(|sc| !sc.is_hide_set())
.map(CommandModel::from)
.collect(),
}
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/osutils/src/dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ pub enum Dependency {
Eject,
Findmnt,
Iptables,
Journalctl,
Losetup,
Lsblk,
Lsof,
Expand Down
22 changes: 18 additions & 4 deletions crates/osutils/src/findmnt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ use std::{
};

use anyhow::Context;
use serde::Deserialize;
use serde::{Deserialize, Serialize};

use sysdefs::filesystems::KernelFilesystemType;
use trident_api::{config::MountOptions, constants::ROOT_MOUNT_POINT_PATH};
Expand All @@ -81,10 +81,11 @@ pub const PROPAGATION_UNBINDABLE: &str = "unbindable";
/// String with a comma-separated list of columns to be used with `findmnt
/// --json -o` to output the columns that can be deserialized into a
/// `MountpointMetadata` structure.
pub const FINDMNT_COLUMNS: &str = "id,target,source,fsroot,fstype,options,propagation";
pub const FINDMNT_COLUMNS: &str =
"id,target,source,fsroot,fstype,options,propagation,size,used,avail,use%";

/// Represents the output of `findmnt --json` as a Rust structure.
#[derive(Debug, Deserialize)]
#[derive(Debug, Serialize, Deserialize)]
pub struct FindMnt {
pub filesystems: Vec<MountpointMetadata>,
}
Expand All @@ -93,7 +94,7 @@ pub struct FindMnt {
/// in `FINDMNT_COLUMNS`. The `children` field contains all mounts under this
/// filesystem and it is added automatically by `findmnt` when the `--json` flag
/// is used.
#[derive(Debug, Deserialize, PartialEq, Eq)]
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "lowercase")]
pub struct MountpointMetadata {
/// Mount ID.
Expand Down Expand Up @@ -121,6 +122,19 @@ pub struct MountpointMetadata {
/// Propagation type.
pub propagation: String,

/// Filesystem size in bytes.
pub size: Option<String>,

/// Used space in bytes.
pub used: Option<String>,

/// Available space in bytes.
pub avail: Option<String>,

/// Filesystem use percentage.
#[serde(rename = "use%")]
pub use_percent: Option<String>,

/// Mounts under this filesystem.
#[serde(default)]
pub children: Vec<MountpointMetadata>,
Expand Down
26 changes: 13 additions & 13 deletions crates/osutils/src/pcrlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{
use anyhow::{bail, Context, Error, Result};
use enumflags2::BitFlags;
use log::{debug, error, trace, warn};
use serde::Deserialize;
use serde::{Deserialize, Serialize};
use tempfile::NamedTempFile;

use sysdefs::tpm2::Pcr;
Expand Down Expand Up @@ -225,24 +225,24 @@ fn validate_log(required_pcrs: BitFlags<Pcr>) -> Result<(), Error> {
}

/// Represents a single log entry from the 'systemd-pcrlock log' output.
#[derive(Debug, Deserialize, Clone)]
struct LogEntry {
pcr: Pcr,
pcrname: Option<String>,
event: Option<String>,
sha256: Option<Sha256Hash>,
component: Option<String>,
description: Option<String>,
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct LogEntry {
pub pcr: Pcr,
pub pcrname: Option<String>,
pub event: Option<String>,
pub sha256: Option<Sha256Hash>,
pub component: Option<String>,
pub description: Option<String>,
}

/// Represents the output of the 'systemd-pcrlock log' command.
#[derive(Debug, Deserialize, Clone)]
struct LogOutput {
log: Vec<LogEntry>,
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct LogOutput {
pub log: Vec<LogEntry>,
}

/// Parses the output of the 'systemd-pcrlock log' command as a LogOutput object.
fn log_parsed() -> Result<LogOutput, Error> {
pub fn log_parsed() -> Result<LogOutput, Error> {
let output = Dependency::SystemdPcrlock
.cmd()
.arg("log")
Expand Down
4 changes: 2 additions & 2 deletions crates/sysdefs/src/filesystems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use serde::{de::value::Error, forward_to_deserialize_any, Deserialize, Deseriali
use strum_macros::{EnumIs, EnumIter, EnumTryAs, IntoStaticStr};

/// Superset of all filesystem types recognized by the kernel.
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, EnumIs, EnumTryAs)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, EnumIs, EnumTryAs)]
#[serde(untagged)]
pub enum KernelFilesystemType {
Real(RealFilesystemType),
Expand Down Expand Up @@ -105,7 +105,7 @@ impl RealFilesystemType {
///
/// Essentially, things you might see in `/proc/filesystems` WITH the `nodev`
/// attribute.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, IntoStaticStr, EnumIter)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, IntoStaticStr, EnumIter)]
#[serde(rename_all = "lowercase")]
#[strum(serialize_all = "lowercase")]
pub enum NodevFilesystemType {
Expand Down
20 changes: 20 additions & 0 deletions crates/trident/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,25 @@ pub enum Commands {
outfile: Option<PathBuf>,
},

/// Generate diagnostic information and create a support bundle.
///
/// This command collects diagnostic information including logs, and
/// system information. The output is packaged as a compressed tarball
Comment on lines +170 to +171

Copilot AI Dec 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment has inconsistent spacing. There's an extra space before "system information" on line 147. It should be "including logs, and system information" or better yet, "including logs and system information" (removing the comma).

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^
I think the tabs can be removed

/// that can be shared for troubleshooting.
Diagnose {
/// Path where the support bundle will be saved
#[clap(short, long)]
output: PathBuf,
Comment thread
nbojanic marked this conversation as resolved.

/// Whether to include full system journal and dmesg output
#[clap(long)]
journal: bool,
Comment thread
bfjelds marked this conversation as resolved.

/// Whether to include SELinux audit log
#[clap(long)]
selinux: bool,
},

/// Validate the provided Host Configuration
///
/// When no options are provided, the default Trident Configuration is
Expand Down Expand Up @@ -256,6 +275,7 @@ impl Commands {
Commands::RebuildRaid { .. } => "rebuild-raid",
Commands::StartNetwork { .. } => "start-network",
Commands::Get { .. } => "get",
Commands::Diagnose { .. } => "diagnose",
Commands::Validate { .. } => "validate",
#[cfg(feature = "pytest-generator")]
Commands::Pytest => "pytest",
Expand Down
Loading
Loading