public static void ObtainedDeploymentConfigInfo(DeploymentConfigInfo deploymentConfigInfo) { if (!deploymentConfigInfo.Exception.HasValue && deploymentConfigInfo != DeploymentConfigInfo.Empty) { Log.LogDebug((int)EventIds.ObtainedDeploymentConfigInfo, "Obtained edge agent config"); } }
public Agent( IConfigSource configSource, IEnvironmentProvider environmentProvider, IPlanner planner, IPlanRunner planRunner, IReporter reporter, IModuleIdentityLifecycleManager moduleIdentityLifecycleManager, IEntityStore <string, string> configStore, DeploymentConfigInfo initialDeployedConfigInfo, ISerde <DeploymentConfigInfo> deploymentConfigInfoSerde, IEncryptionProvider encryptionProvider, IAvailabilityMetric availabilityMetric) { this.configSource = Preconditions.CheckNotNull(configSource, nameof(configSource)); this.planner = Preconditions.CheckNotNull(planner, nameof(planner)); this.planRunner = Preconditions.CheckNotNull(planRunner, nameof(planRunner)); this.reporter = Preconditions.CheckNotNull(reporter, nameof(reporter)); this.moduleIdentityLifecycleManager = Preconditions.CheckNotNull(moduleIdentityLifecycleManager, nameof(moduleIdentityLifecycleManager)); this.configStore = Preconditions.CheckNotNull(configStore, nameof(configStore)); this.environmentProvider = Preconditions.CheckNotNull(environmentProvider, nameof(environmentProvider)); this.currentConfig = Preconditions.CheckNotNull(initialDeployedConfigInfo); this.deploymentConfigInfoSerde = Preconditions.CheckNotNull(deploymentConfigInfoSerde, nameof(deploymentConfigInfoSerde)); this.environment = this.environmentProvider.Create(this.currentConfig.DeploymentConfig); this.encryptionProvider = Preconditions.CheckNotNull(encryptionProvider, nameof(encryptionProvider)); this.availabilityMetric = Preconditions.CheckNotNull(availabilityMetric, nameof(availabilityMetric)); this.status = DeploymentStatus.Unknown; Events.AgentCreated(); }
// This should be called only within the reconcile lock. async Task UpdateCurrentConfig(DeploymentConfigInfo deploymentConfigInfo) { this.environment = this.environmentProvider.Create(deploymentConfigInfo.DeploymentConfig); this.currentConfig = deploymentConfigInfo; string encryptedConfig = await this.encryptionProvider.EncryptAsync(this.deploymentConfigInfoSerde.Serialize(deploymentConfigInfo)); await this.configStore.Put(StoreConfigKey, encryptedConfig); }
async Task<(DeploymentConfigInfo deploymentConfigInfo, Exception ex)> GetDeploymentConfigInfoAsync() { DeploymentConfigInfo deploymentConfigInfo = null; Exception ex = null; try { Events.GettingDeploymentConfigInfo(); deploymentConfigInfo = await this.configSource.GetDeploymentConfigInfoAsync(); Events.ObtainedDeploymentConfigInfo(deploymentConfigInfo); } catch (Exception e) when (!e.IsFatal()) { ex = e; } return (deploymentConfigInfo, ex); }