From e84362db3cbc4e97e7c904f7f0bd0eeabda31608 Mon Sep 17 00:00:00 2001 From: Arthur Chaloin Date: Tue, 9 Jan 2024 19:04:32 +0000 Subject: [PATCH] fix(proxmoxve): remove redundant afterburn prefix in attributes --- src/providers/proxmoxve/cloudconfig.rs | 14 ++++---------- src/providers/proxmoxve/tests.rs | 14 ++++---------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/src/providers/proxmoxve/cloudconfig.rs b/src/providers/proxmoxve/cloudconfig.rs index cf4a3fc1..3535e264 100644 --- a/src/providers/proxmoxve/cloudconfig.rs +++ b/src/providers/proxmoxve/cloudconfig.rs @@ -95,28 +95,22 @@ impl MetadataProvider for ProxmoxVECloudConfig { let mut out = HashMap::new(); out.insert( - "AFTERBURN_PROXMOXVE_HOSTNAME".to_owned(), + "PROXMOXVE_HOSTNAME".to_owned(), self.hostname()?.unwrap_or_default(), ); out.insert( - "AFTERBURN_PROXMOXVE_INSTANCE_ID".to_owned(), + "PROXMOXVE_INSTANCE_ID".to_owned(), self.meta_data.instance_id.clone(), ); if let Some(first_interface) = self.networks()?.first() { first_interface.ip_addresses.iter().for_each(|ip| match ip { IpNetwork::V4(network) => { - out.insert( - "AFTERBURN_PROXMOXVE_IPV4".to_owned(), - network.ip().to_string(), - ); + out.insert("PROXMOXVE_IPV4".to_owned(), network.ip().to_string()); } IpNetwork::V6(network) => { - out.insert( - "AFTERBURN_PROXMOXVE_IPV6".to_owned(), - network.ip().to_string(), - ); + out.insert("PROXMOXVE_IPV6".to_owned(), network.ip().to_string()); } }); } diff --git a/src/providers/proxmoxve/tests.rs b/src/providers/proxmoxve/tests.rs index 8a885e8c..060ee8d7 100644 --- a/src/providers/proxmoxve/tests.rs +++ b/src/providers/proxmoxve/tests.rs @@ -14,23 +14,17 @@ fn test_attributes() { .expect("cannot parse config"); let attributes = config.attributes().expect("cannot get hostname"); - assert_eq!( - attributes["AFTERBURN_PROXMOXVE_HOSTNAME"], - "dummy".to_string() - ); + assert_eq!(attributes["PROXMOXVE_HOSTNAME"], "dummy".to_string()); assert_eq!( - attributes["AFTERBURN_PROXMOXVE_INSTANCE_ID"], + attributes["PROXMOXVE_INSTANCE_ID"], "15a9919cb91024fbd1d70fa07f0efa749cbba03b".to_string() ); - assert_eq!( - attributes["AFTERBURN_PROXMOXVE_IPV4"], - "192.168.1.1".to_string() - ); + assert_eq!(attributes["PROXMOXVE_IPV4"], "192.168.1.1".to_string()); assert_eq!( - attributes["AFTERBURN_PROXMOXVE_IPV6"], + attributes["PROXMOXVE_IPV6"], "2001:db8:85a3::8a2e:370:0".to_string() ); }