private void ValidateDCASettingsValueTypes() { this.IsAppLogCollectionEnabled = DCASettingsValidator.IsEnabled(this.fileStoreSettings, FabricValidatorConstants.ParameterNames.IsAppLogCollectionEnabled); if (this.IsAppLogCollectionEnabled) { this.DiagnosticsFileStoreConnectionString = this.fileStoreSettings.ContainsKey(FabricValidatorConstants.ParameterNames.StoreConnectionString) ? this.fileStoreSettings[FabricValidatorConstants.ParameterNames.StoreConnectionString].GetSecureValue(this.storeName) : null; string[] parameters = new string[] { FabricValidatorConstants.ParameterNames.UploadIntervalInMinutes }; ValidateSpecifiedValuesInSectionAreGreaterThanZero(this.fileStoreSettings, parameters, FabricValidatorConstants.SectionNames.DiagnosticFileStore); this.AppLogDirectoryQuotaInMB = this.fileStoreSettings.ContainsKey(FabricValidatorConstants.ParameterNames.AppLogDirectoryQuotaInMB) ? int.Parse(this.fileStoreSettings[FabricValidatorConstants.ParameterNames.AppLogDirectoryQuotaInMB].Value, CultureInfo.InvariantCulture) : 0; if (this.AppLogDirectoryQuotaInMB < 0) { WriteError(FabricValidatorUtility.TraceTag, StringResources.Error_SectionParameterShouldBeGreaterThanZero, FabricValidatorConstants.SectionNames.DiagnosticFileStore, FabricValidatorConstants.ParameterNames.AppLogDirectoryQuotaInMB); throw new ArgumentException(string.Format(StringResources.Error_SectionParameterShouldBeGreaterThanZero, FabricValidatorConstants.SectionNames.DiagnosticFileStore, FabricValidatorConstants.ParameterNames.AppLogDirectoryQuotaInMB)); } } }
// We need an overload to initialize without validation in tests since the // test can connect to clusters which might be in different versions than currently used // management dll hence validations might fail. For example when connecting to linux // cluster the DCA settings might not be valid. This class is only used to easily // access deployed cluster settings and no other reason public WindowsFabricSettings(ClusterManifestType manifest, bool skipValidation) { this.StoreName = GetStoreName(manifest); var configurations = ReadConfigurations(); var clusterManifest = ConvertSettingsToMap(manifest.FabricSettings); if (!skipValidation) { this.dcaSettingsValidator = new DCASettingsValidator( configurations, clusterManifest, this.StoreName); // !!!!! IMPORTANT !!!!! // // The method call below performs custom validation of sections that // are specific to DCA plugins. It is also removes those sections from // the settings map because the standard validation that we perform is // not applicable to those sections. Therefore, it is important to make // this method call before performing any other validation so that we // can prevent our standard validation logic from being applied to // DCA-plugin-specific sections. // // !!!!! IMPORTANT !!!!! if (!this.DcaSettingsValidator.ValidateDCAPluginSettings()) { throw new ArgumentException(StringResources.Error_FabricValidator_DCASettingsValidatorFailed); } this.dcaPluginSections = this.DcaSettingsValidator.DCAPluginSections; } this.MergeConfigurationsAndClusterManifest(configurations, clusterManifest, skipValidation); if (!skipValidation) { this.ValidateSettingsNamesAndTypes(); } }