예제 #1
0
        internal UpgradeCommandOptions(UpgradeCommandOptionsRaw rawConfig)
        {
            if (!rawConfig.ApplicationName.HasValue())
                throw new ArgumentException("No Application Name specified");
            if (!rawConfig.TargetVersion.HasValue())
                throw new ArgumentException("No Target Version specified");

            ApplicationName = rawConfig.ApplicationName.Value();
            TargetVersion = rawConfig.TargetVersion.Value();
            RollingUpgradeMode = OptionsHelper.GetEnumValueOrDefault(rawConfig.RollingUpgradeMode,
                Constants.RollingUpgradeMode.Monitored);
            ForceRestart = rawConfig.ForceRestart.HasValue();
            FailureAction = OptionsHelper.GetEnumValueOrDefault(rawConfig.FailureAction,
                Constants.FailureAction.Rollback);
            HealthCheckWaitDuration = OptionsHelper.GetIntOrDefaultValue(rawConfig.HealthCheckWaitDuration, 60);
            HealthCheckStableDuration = OptionsHelper.GetIntOrDefaultValue(rawConfig.HealthCheckStableDuration, 60);
            HealthCheckRetryTimeout = OptionsHelper.GetIntOrDefaultValue(rawConfig.HealthCheckRetryTimeout, 60);
        }
예제 #2
0
        public static AppOptions ValidateAndCreate(AppOptionsRaw rawOptions)
        {
            if (!rawOptions.ClusterHostname.HasValue())
            {
                return(new InvalidAppOptions("No ClusterHostname specified"));
            }

            var config = new AppOptions
            {
                SecureCluster         = rawOptions.CertificateThumbprint.HasValue(),
                ClusterHostname       = rawOptions.ClusterHostname.Value(),
                ClusterPort           = OptionsHelper.GetIntOrDefaultValue(rawOptions.ClusterPort, 19080),
                CertificateThumbprint = OptionsHelper.GetStringOrDefaultValue(rawOptions.CertificateThumbprint, string.Empty),
                CertificateStore      = OptionsHelper.GetEnumValueOrDefault(rawOptions.CertificateStore, StoreName.My),
                CertificateLocation   = OptionsHelper.GetEnumValueOrDefault(rawOptions.CertificateLocation, StoreLocation.CurrentUser),
                Verbose = rawOptions.Verbose.HasValue()
            };

            return(config);
        }