diff --git a/src/rust/lqos_support_tool/src/support_info/distro_name.rs b/src/rust/lqos_support_tool/src/support_info/distro_name.rs new file mode 100644 index 00000000..c277db09 --- /dev/null +++ b/src/rust/lqos_support_tool/src/support_info/distro_name.rs @@ -0,0 +1,38 @@ +use std::process::Command; +use crate::console::success; +use crate::support_info::SupportInfo; + +#[derive(Debug, Default)] +pub struct DistroName { + output: String, +} + +impl SupportInfo for DistroName { + fn get_string(&self) -> String { + self.output.to_string() + } + + fn get_name(&self) -> String { + "LSB Distro Info".to_string() + } + + fn get_filename(&self) -> Option { + None + } + + fn gather(&mut self) -> anyhow::Result<()> { + let output = Command::new("/bin/lsb_release") + .arg("-a") + .output()?; + let out_str = String::from_utf8_lossy(output.stdout.as_slice()); + self.output = out_str.to_string(); + success("Gathered distro info"); + Ok(()) + } +} + +impl DistroName { + pub fn boxed() -> Box { + Box::new(Self::default()) + } +} \ No newline at end of file diff --git a/src/rust/lqos_support_tool/src/support_info/kernel_info.rs b/src/rust/lqos_support_tool/src/support_info/kernel_info.rs new file mode 100644 index 00000000..3bae10c7 --- /dev/null +++ b/src/rust/lqos_support_tool/src/support_info/kernel_info.rs @@ -0,0 +1,38 @@ +use std::process::Command; +use crate::console::success; +use crate::support_info::SupportInfo; + +#[derive(Debug, Default)] +pub struct KernelInfo { + output: String, +} + +impl SupportInfo for KernelInfo { + fn get_string(&self) -> String { + self.output.to_string() + } + + fn get_name(&self) -> String { + "Uname Kernel Info".to_string() + } + + fn get_filename(&self) -> Option { + None + } + + fn gather(&mut self) -> anyhow::Result<()> { + let output = Command::new("/bin/uname") + .arg("-a") + .output()?; + let out_str = String::from_utf8_lossy(output.stdout.as_slice()); + self.output = out_str.to_string(); + success("Gathered kernel info"); + Ok(()) + } +} + +impl KernelInfo { + pub fn boxed() -> Box { + Box::new(Self::default()) + } +} \ No newline at end of file