diff --git a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/IRuntimeInfoProvider.cs b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/IRuntimeInfoProvider.cs
index 4c52c29cbb..4e4017434c 100644
--- a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/IRuntimeInfoProvider.cs
+++ b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/IRuntimeInfoProvider.cs
@@ -10,7 +10,7 @@ namespace Microsoft.Azure.Devices.Edge.Agent.Core
///
/// This interface provides the module runtime information.
/// TODO: Consider replacing this with IEnvironment and the decorator pattern.
- /// However, that would require IModule implementations to be made generic.
+ /// However, that would require IModule implementations to be made generic.
///
public interface IRuntimeInfoProvider
{
@@ -21,17 +21,20 @@ namespace Microsoft.Azure.Devices.Edge.Agent.Core
public class SystemInfo
{
- static SystemInfo Empty { get; } = new SystemInfo(string.Empty, string.Empty);
+ static SystemInfo Empty { get; } = new SystemInfo(string.Empty, string.Empty, string.Empty);
[JsonConstructor]
- public SystemInfo(string operatingSystemType, string architecture)
+ public SystemInfo(string operatingSystemType, string architecture, string version)
{
this.OperatingSystemType = operatingSystemType;
this.Architecture = architecture;
+ this.Version = version;
}
public string OperatingSystemType { get; }
public string Architecture { get; }
+
+ public string Version { get; }
}
}
diff --git a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerEnvironment.cs b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerEnvironment.cs
index 7aa0a828fb..a5c39887d2 100644
--- a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerEnvironment.cs
+++ b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerEnvironment.cs
@@ -15,7 +15,7 @@ namespace Microsoft.Azure.Devices.Edge.Agent.Docker
///
/// This implementation gets the module runtime information from IRuntimeInfoProvider and
/// the configuration information from the deploymentConfig.
- /// TODO: This could be made generic (not docker specific) and moved to Core.
+ /// TODO: This could be made generic (not docker specific) and moved to Core.
///
public class DockerEnvironment : IEnvironment
{
@@ -23,6 +23,7 @@ namespace Microsoft.Azure.Devices.Edge.Agent.Docker
readonly IEntityStore moduleStateStore;
readonly string operatingSystemType;
readonly string architecture;
+ readonly string version;
readonly DeploymentConfig deploymentConfig;
readonly IRestartPolicyManager restartManager;
@@ -31,7 +32,8 @@ namespace Microsoft.Azure.Devices.Edge.Agent.Docker
IEntityStore moduleStateStore,
IRestartPolicyManager restartManager,
string operatingSystemType,
- string architecture)
+ string architecture,
+ string version)
{
this.moduleStatusProvider = moduleStatusProvider;
this.deploymentConfig = deploymentConfig;
@@ -39,6 +41,7 @@ namespace Microsoft.Azure.Devices.Edge.Agent.Docker
this.restartManager = restartManager;
this.operatingSystemType = operatingSystemType;
this.architecture = architecture;
+ this.version = version;
}
public async Task GetModulesAsync(CancellationToken token)
@@ -103,13 +106,13 @@ namespace Microsoft.Azure.Devices.Edge.Agent.Docker
IRuntimeInfo runtimeInfo = this.deploymentConfig.Runtime;
if (runtimeInfo?.Type == "docker")
{
- var platform = new DockerPlatformInfo(this.operatingSystemType, this.architecture);
+ var platform = new DockerPlatformInfo(this.operatingSystemType, this.architecture, this.version);
DockerRuntimeConfig config = (runtimeInfo as DockerRuntimeInfo)?.Config;
runtimeInfo = new DockerReportedRuntimeInfo(runtimeInfo.Type, config, platform);
}
else if (runtimeInfo == null || runtimeInfo is UnknownRuntimeInfo)
{
- var platform = new DockerPlatformInfo(this.operatingSystemType, this.architecture);
+ var platform = new DockerPlatformInfo(this.operatingSystemType, this.architecture, this.version);
runtimeInfo = new DockerReportedUnknownRuntimeInfo(platform);
}
diff --git a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerEnvironmentProvider.cs b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerEnvironmentProvider.cs
index 224aa5d30a..03344fce14 100644
--- a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerEnvironmentProvider.cs
+++ b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerEnvironmentProvider.cs
@@ -14,13 +14,21 @@ namespace Microsoft.Azure.Devices.Edge.Agent.Docker
readonly IRestartPolicyManager restartPolicyManager;
readonly string operatingSystemType;
readonly string architecture;
+ readonly string version;
- DockerEnvironmentProvider(IRuntimeInfoProvider runtimeInfoProvider, IEntityStore store, IRestartPolicyManager restartPolicyManager, string operatingSystemType, string architecture)
+ DockerEnvironmentProvider(
+ IRuntimeInfoProvider runtimeInfoProvider,
+ IEntityStore store,
+ IRestartPolicyManager restartPolicyManager,
+ string operatingSystemType,
+ string architecture,
+ string version)
{
this.moduleStatusProvider = runtimeInfoProvider;
this.store = Preconditions.CheckNotNull(store, nameof(store));
this.operatingSystemType = operatingSystemType;
this.architecture = architecture;
+ this.version = version;
this.restartPolicyManager = Preconditions.CheckNotNull(restartPolicyManager, nameof(restartPolicyManager));
}
@@ -28,10 +36,16 @@ namespace Microsoft.Azure.Devices.Edge.Agent.Docker
IRestartPolicyManager restartPolicyManager)
{
SystemInfo systemInfo = await Preconditions.CheckNotNull(runtimeInfoProvider, nameof(runtimeInfoProvider)).GetSystemInfo();
- return new DockerEnvironmentProvider(runtimeInfoProvider, store, restartPolicyManager, systemInfo.OperatingSystemType, systemInfo.Architecture);
+ return new DockerEnvironmentProvider(
+ runtimeInfoProvider, store, restartPolicyManager,
+ systemInfo.OperatingSystemType, systemInfo.Architecture,
+ systemInfo.Version);
}
public IEnvironment Create(DeploymentConfig deploymentConfig) =>
- new DockerEnvironment(this.moduleStatusProvider, deploymentConfig, this.store, this.restartPolicyManager, this.operatingSystemType, this.architecture);
+ new DockerEnvironment(
+ this.moduleStatusProvider, deploymentConfig, this.store,
+ this.restartPolicyManager, this.operatingSystemType,
+ this.architecture, this.version);
}
}
diff --git a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerPlatformInfo.cs b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerPlatformInfo.cs
index 466fcbc008..f2db4ea8ff 100644
--- a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerPlatformInfo.cs
+++ b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerPlatformInfo.cs
@@ -9,10 +9,11 @@ namespace Microsoft.Azure.Devices.Edge.Agent.Docker
public class DockerPlatformInfo : IEquatable
{
[JsonConstructor]
- public DockerPlatformInfo(string operatingSystemType, string architecture)
+ public DockerPlatformInfo(string operatingSystemType, string architecture, string version)
{
this.OperatingSystemType = operatingSystemType ?? string.Empty;
this.Architecture = architecture ?? string.Empty;
+ this.Version = version ?? string.Empty;
}
[JsonProperty("os")]
@@ -21,16 +22,23 @@ namespace Microsoft.Azure.Devices.Edge.Agent.Docker
[JsonProperty("architecture")]
public string Architecture { get; }
+ [JsonProperty("version")]
+ public string Version { get; }
+
public override bool Equals(object obj) => this.Equals(obj as DockerPlatformInfo);
public bool Equals(DockerPlatformInfo other) =>
- other != null && this.OperatingSystemType == other.OperatingSystemType && this.Architecture == other.Architecture;
+ other != null &&
+ this.OperatingSystemType == other.OperatingSystemType &&
+ this.Architecture == other.Architecture &&
+ this.Version == other.Version;
public override int GetHashCode()
{
int hashCode = 577840947;
hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(this.OperatingSystemType);
hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(this.Architecture);
+ hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(this.Version);
return hashCode;
}
diff --git a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/RuntimeInfoProvider.cs b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/RuntimeInfoProvider.cs
index 658a685759..5f8a5cb029 100644
--- a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/RuntimeInfoProvider.cs
+++ b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/RuntimeInfoProvider.cs
@@ -25,13 +25,15 @@ namespace Microsoft.Azure.Devices.Edge.Agent.Docker
readonly IDockerClient client;
readonly string operatingSystemType;
readonly string architecture;
+ readonly string version;
- RuntimeInfoProvider(IDockerClient client, string operatingSystemType, string architecture)
+ RuntimeInfoProvider(IDockerClient client, string operatingSystemType, string architecture, string version)
{
this.client = Preconditions.CheckNotNull(client, nameof(client));
this.operatingSystemType = string.IsNullOrWhiteSpace(operatingSystemType) ? CoreConstants.Unknown : operatingSystemType;
this.architecture = string.IsNullOrWhiteSpace(architecture) ? CoreConstants.Unknown : architecture;
+ this.version = string.IsNullOrWhiteSpace(version) ? CoreConstants.Unknown : version;
}
public async static Task CreateAsync(IDockerClient client)
@@ -41,7 +43,7 @@ namespace Microsoft.Azure.Devices.Edge.Agent.Docker
// get system information from docker
SystemInfoResponse info = await client.System.GetSystemInfoAsync();
- return new RuntimeInfoProvider(client, info.OSType, info.Architecture);
+ return new RuntimeInfoProvider(client, info.OSType, info.Architecture, info.ServerVersion);
}
public async Task> GetModules(CancellationToken ctsToken)
@@ -171,7 +173,7 @@ namespace Microsoft.Azure.Devices.Edge.Agent.Docker
return status;
}
- public Task GetSystemInfo() => Task.FromResult(new SystemInfo(this.operatingSystemType, this.architecture));
+ public Task GetSystemInfo() => Task.FromResult(new SystemInfo(this.operatingSystemType, this.architecture, this.version));
static class Events
{
diff --git a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Edgelet/RuntimeInfoProvider.cs b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Edgelet/RuntimeInfoProvider.cs
index 3e4f23304b..f15fe631ef 100644
--- a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Edgelet/RuntimeInfoProvider.cs
+++ b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Edgelet/RuntimeInfoProvider.cs
@@ -32,8 +32,8 @@ namespace Microsoft.Azure.Devices.Edge.Agent.Edgelet
{
GeneratedCode.SystemInfo systemInfo = await this.moduleManager.GetSystemInfoAsync();
- return new Core.SystemInfo(systemInfo.OsType, systemInfo.Architecture);
- }
+ return new Core.SystemInfo(systemInfo.OsType, systemInfo.Architecture, systemInfo.Version);
+ }
internal static ModuleRuntimeInfo GetModuleRuntimeInfo(ModuleDetails moduleDetails)
{
@@ -46,7 +46,7 @@ namespace Microsoft.Azure.Devices.Edge.Agent.Edgelet
Option exitTime = exitStatus == null ? Option.None() : Option.Some(exitStatus.ExitTime);
Option startTime = !moduleDetails.Status.StartTime.HasValue ? Option.None() : Option.Some(moduleDetails.Status.StartTime.Value);
- if (!Enum.TryParse(moduleDetails.Status.RuntimeStatus.Status, true, out ModuleStatus status))
+ if (!Enum.TryParse(moduleDetails.Status.RuntimeStatus.Status, true, out ModuleStatus status))
{
status = ModuleStatus.Unknown;
}
diff --git a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Edgelet/generatedCode/EdgeletHttpClient.cs b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Edgelet/generatedCode/EdgeletHttpClient.cs
index 42e611a3c0..722834b6e0 100644
--- a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Edgelet/generatedCode/EdgeletHttpClient.cs
+++ b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Edgelet/generatedCode/EdgeletHttpClient.cs
@@ -7,7 +7,7 @@
namespace Microsoft.Azure.Devices.Edge.Agent.Edgelet.GeneratedCode
{
- #pragma warning disable // Disable all warnings
+#pragma warning disable // Disable all warnings
[System.CodeDom.Compiler.GeneratedCode("NSwag", "11.17.12.0 (NJsonSchema v9.10.50.0 (Newtonsoft.Json v9.0.0.0))")]
public partial class EdgeletHttpClient
@@ -1403,11 +1403,11 @@ namespace Microsoft.Azure.Devices.Edge.Agent.Edgelet.GeneratedCode
}
else if (value is byte[])
{
- return System.Convert.ToBase64String((byte[]) value);
+ return System.Convert.ToBase64String((byte[])value);
}
else if (value.GetType().IsArray)
{
- var array = System.Linq.Enumerable.OfType