diff --git a/proxmox-sys/src/lib.rs b/proxmox-sys/src/lib.rs index 56921ef5..9469c660 100644 --- a/proxmox-sys/src/lib.rs +++ b/proxmox-sys/src/lib.rs @@ -13,3 +13,19 @@ pub mod systemd; mod worker_task_context; pub use worker_task_context::*; + +/// Returns the hosts node name (UTS node name) +pub fn nodename() -> &'static str { + lazy_static::lazy_static! { + static ref NODENAME: String = { + nix::sys::utsname::uname() + .nodename() + .split('.') + .next() + .unwrap() + .to_owned() + }; + } + + &NODENAME +} diff --git a/proxmox/src/tools/mod.rs b/proxmox/src/tools/mod.rs index 3d836fb8..502acf86 100644 --- a/proxmox/src/tools/mod.rs +++ b/proxmox/src/tools/mod.rs @@ -129,19 +129,3 @@ fn test_hex() { hex_to_bin_exact("abca01239fa", &mut out).expect_err("parsed invalid hex string"); hex_to_bin_exact("abca0x239f", &mut out).expect_err("parsed invalid hex string"); } - -/// Returns the hosts node name (UTS node name) -pub fn nodename() -> &'static str { - lazy_static! { - static ref NODENAME: String = { - nix::sys::utsname::uname() - .nodename() - .split('.') - .next() - .unwrap() - .to_owned() - }; - } - - &NODENAME -}