Skip to content

Commit

Permalink
Merge branch 'arch_23573/make_sources_compatible_with_windows_pr'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins CI committed Oct 15, 2023
2 parents b552d37 + d305124 commit 24a92bf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
6 changes: 4 additions & 2 deletions policies/minifusion/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ quick-xml = { version = "0.30.0", features = ["serialize"] }
sysinfo = "0.29.4"
serde = { version = "1", features = ["derive"] }
hostname = "0.3"
uname-rs = "0.1"
anyhow = "1"
clap = { version = "4.3.11", features = ["derive"] }
chrono = "0.4"
regex = "1"

[target.'cfg(unix)'.dependencies]
uname-rs = "0.1"

[dev-dependencies]
pretty_assertions = "1"
pretty_assertions = "1"
8 changes: 8 additions & 0 deletions policies/minifusion/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use os_release::OsRelease;
use quick_xml::se::Serializer;
use serde::Serialize;
use sysinfo::{CpuExt, ProcessExt, System, SystemExt, UserExt};
#[cfg(unix)]
use uname_rs::Uname;

pub const AGENT_CERT_PATH: &str = "/opt/rudder/etc/ssl/agent.cert";
Expand Down Expand Up @@ -133,6 +134,7 @@ pub struct User {

impl Inventory {
pub fn new() -> Result<Self> {
#[cfg(unix)]
let uts = Uname::new()?;
let hostname = hostname::get()?
.into_string()
Expand Down Expand Up @@ -197,12 +199,15 @@ impl Inventory {
operating_system: OperatingSystem {
arch,
boot_time: "".to_string(),
#[cfg(unix)]
dns_domain: uts.domainname,
// FIXME not fqdn
fqdn: hostname.clone(),
full_name: os_release.pretty_name,
host_id: "".to_string(),
#[cfg(unix)]
kernel_name: uts.sysname.to_lowercase(),
#[cfg(unix)]
kernel_version: uts.release,
name: os_release.name,
version: os_release.version,
Expand Down Expand Up @@ -233,6 +238,7 @@ pub struct OperatingSystem {
// <BOOT_TIME>2023-06-29 15:04:23</BOOT_TIME>
boot_time: String,
// <DNS_DOMAIN>rudder.local</DNS_DOMAIN>
#[cfg(unix)]
dns_domain: String,
// <FQDN>server.rudder.local</FQDN>
fqdn: String,
Expand All @@ -242,8 +248,10 @@ pub struct OperatingSystem {
#[serde(rename = "HOSTID")]
host_id: String,
// <KERNEL_NAME>linux</KERNEL_NAME>
#[cfg(unix)]
kernel_name: String,
// <KERNEL_VERSION>4.18.0-365.el8.x86_64</KERNEL_VERSION>
#[cfg(unix)]
kernel_version: String,
// <NAME>CentOS</NAME>
name: String,
Expand Down
1 change: 1 addition & 0 deletions policies/rudderc/tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const TEST_LIB: &str = "tests/lib/common";
const TEST_METHODS: &str = "tests/lib/common/30_generic_methods";

/// Compile and tests all files in `cases/test`. This tests the testing feature itself.
#[cfg(unix)]
#[test_resources("tests/cases/test/*/*.yml")]
fn test(filename: &str) {
let technique_dir = Path::new(filename).parent().unwrap();
Expand Down

0 comments on commit 24a92bf

Please sign in to comment.