From 7e2037f12710aa31f4cb3a43eb3ea2ba8054bc76 Mon Sep 17 00:00:00 2001 From: Yang Pan Date: Thu, 7 Nov 2024 23:17:17 -0800 Subject: [PATCH 1/2] Report linux distro full name in metadata --- .../Metadata/MetadataExtensionsTests.cs | 6 +++--- .../VirtualClient.Core/Metadata/MetadataExtensions.cs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/VirtualClient/VirtualClient.Core.UnitTests/Metadata/MetadataExtensionsTests.cs b/src/VirtualClient/VirtualClient.Core.UnitTests/Metadata/MetadataExtensionsTests.cs index c01c83a990..292092afdd 100644 --- a/src/VirtualClient/VirtualClient.Core.UnitTests/Metadata/MetadataExtensionsTests.cs +++ b/src/VirtualClient/VirtualClient.Core.UnitTests/Metadata/MetadataExtensionsTests.cs @@ -126,7 +126,7 @@ public async Task GetHostMetadataReturnsTheExpectedOperatingSystemMetadataContra object value; Assert.IsTrue(metadata.TryGetValue("computerName", out value) && value.ToString() == Environment.MachineName); Assert.IsTrue(metadata.TryGetValue("osFamily", out value) && value.ToString() == "Unix"); - Assert.IsTrue(metadata.TryGetValue("osName", out value) && value.ToString() == "Ubuntu"); + Assert.IsTrue(metadata.TryGetValue("osName", out value) && value.ToString() == "Ubuntu 20.01 build 1234"); Assert.IsTrue(metadata.TryGetValue("osPlatformArchitecture", out value) && value.ToString() == PlatformSpecifics.GetPlatformArchitectureName(platform, architecture)); Assert.IsTrue(metadata.TryGetValue("osDescription", out value)); Assert.IsTrue(metadata.TryGetValue("osVersion", out value)); @@ -334,7 +334,7 @@ public async Task GetHostMetadataAsyncExtensionExtensionReturnsTheExpectedMetada // Host/OS Metadata Assert.IsTrue(metadata.TryGetValue("computerName", out value) && value.ToString() == Environment.MachineName); Assert.IsTrue(metadata.TryGetValue("osFamily", out value) && value.ToString() == "Unix"); - Assert.IsTrue(metadata.TryGetValue("osName", out value) && value.ToString() == "Ubuntu"); + Assert.IsTrue(metadata.TryGetValue("osName", out value) && value.ToString() == "TestUbuntu"); Assert.IsTrue(metadata.TryGetValue("osDescription", out value)); Assert.IsTrue(metadata.TryGetValue("osVersion", out value)); Assert.IsTrue(metadata.TryGetValue("osPlatformArchitecture", out value) && value.ToString() == "linux-x64"); @@ -386,7 +386,7 @@ public async Task GetHostMetadataExtensionReturnsTheExpectedMetadataContractInfo object value; Assert.IsTrue(metadata.TryGetValue("computerName", out value) && value.ToString() == Environment.MachineName); Assert.IsTrue(metadata.TryGetValue("osFamily", out value) && value.ToString() == "Unix"); - Assert.IsTrue(metadata.TryGetValue("osName", out value) && value.ToString() == "Ubuntu"); + Assert.IsTrue(metadata.TryGetValue("osName", out value) && value.ToString() == "TestUbuntu"); Assert.IsTrue(metadata.TryGetValue("osDescription", out value)); Assert.IsTrue(metadata.TryGetValue("osVersion", out value)); Assert.IsTrue(metadata.TryGetValue("osPlatformArchitecture", out value) && value.ToString() == "linux-arm64"); diff --git a/src/VirtualClient/VirtualClient.Core/Metadata/MetadataExtensions.cs b/src/VirtualClient/VirtualClient.Core/Metadata/MetadataExtensions.cs index cee7f91bdb..2b90080c4e 100644 --- a/src/VirtualClient/VirtualClient.Core/Metadata/MetadataExtensions.cs +++ b/src/VirtualClient/VirtualClient.Core/Metadata/MetadataExtensions.cs @@ -6,6 +6,7 @@ namespace VirtualClient.Metadata using System; using System.Collections.Generic; using System.Linq; + using System.Runtime.InteropServices; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; @@ -220,22 +221,21 @@ public static async Task> GetHostMetadataAsync(this break; } - string osName = null; if (systemManagement.Platform == PlatformID.Win32NT) { - osName = "Windows"; + metadata.Add("osName", "Windows"); } else if (systemManagement.Platform == PlatformID.Unix) { LinuxDistributionInfo distro = await systemManagement.GetLinuxDistributionAsync(CancellationToken.None); - osName = distro.LinuxDistribution.ToString(); + metadata.Add("osName", distro.OperationSystemFullName); } // Operating System Metadata // ------------------------------------------------- metadata.Add("computerName", Environment.MachineName); metadata.Add("osFamily", osFamily); - metadata.Add("osName", osName); + metadata.Add("osDescription", Environment.OSVersion.VersionString); metadata.Add("osVersion", Environment.OSVersion.Version.ToString()); metadata.Add("osPlatformArchitecture", systemManagement.PlatformArchitectureName); From e99aa6c00d656795e649a4a92a140adf028efa70 Mon Sep 17 00:00:00 2001 From: Yang Pan Date: Fri, 8 Nov 2024 09:56:56 -0800 Subject: [PATCH 2/2] bump version --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 293bfa8f06..75b5dfa4d3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.16.7 +1.16.8