diff --git a/VERSION b/VERSION index 293bfa8f06..75b5dfa4d3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.16.7 +1.16.8 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);