예제 #1
0
        internal void OnDeserializedMethod(StreamingContext context)
        {
            SettingsSectionDescription setupSetting = this.Properties.FabricSettings.FirstOrDefault(x => x.Name == StringConstants.SectionName.Setup);

            if (setupSetting == null)
            {
                return;
            }

            SettingsParameterDescription dataRootParam = setupSetting.Parameters.FirstOrDefault(x => x.Name == StringConstants.ParameterName.FabricDataRoot);

            if (dataRootParam != null)
            {
                dataRootParam.Value = Environment.ExpandEnvironmentVariables(dataRootParam.Value);
            }

            SettingsParameterDescription logRootParam = setupSetting.Parameters.FirstOrDefault(x => x.Name == StringConstants.ParameterName.FabricLogRoot);

            if (logRootParam != null)
            {
                logRootParam.Value = Environment.ExpandEnvironmentVariables(logRootParam.Value);
            }

            SettingsParameterDescription devClusterParam = setupSetting.Parameters.FirstOrDefault(x => x.Name == StringConstants.ParameterName.IsDevCluster);

            setupSetting.Parameters.Remove(devClusterParam);

            this.Properties.DiagnosticsStore.Connectionstring = Environment.ExpandEnvironmentVariables(this.Properties.DiagnosticsStore.Connectionstring);
        }
예제 #2
0
        public static FaultInjectionConfig TryGetFaultInjectionConfig(List <SettingsSectionDescription> fabricSettings)
        {
            if (fabricSettings == null)
            {
                return(null);
            }

            SettingsSectionDescription section = fabricSettings.FirstOrDefault(sec => sec.Name == StringConstants.SectionName.UpgradeOrchestrationService);

            if (section == null)
            {
                return(null);
            }

            SettingsParameterDescription faultStepParameter = section.Parameters.FirstOrDefault(p => p.Name == StringConstants.ParameterName.FaultStep);

            if (faultStepParameter == null)
            {
                return(null);
            }

            int         faultStep;
            UpgradeFlow faultFlow;

            if (!int.TryParse(faultStepParameter.Value, out faultStep) || faultStep < 0)
            {
                return(null);
            }

            SettingsParameterDescription faultFlowParameter = section.Parameters.FirstOrDefault(p => p.Name == StringConstants.ParameterName.FaultFlow);

            if (faultFlowParameter == null)
            {
                return(null);
            }

            if (!Enum.TryParse <UpgradeFlow>(faultFlowParameter.Value, out faultFlow))
            {
                return(null);
            }

            return(new FaultInjectionConfig(faultFlow, faultStep));
        }