Пример #1
0
        private OptionSet GetOptionSet()
        {
            Params = new CommandLineParams();

            var optionSet = new OptionSet()
                                {
                                    {"s=|server=", "Server to deploy to", v => Params.Server = v},
                                    {"c=|context=", "Context to deploy", v => Params.Context = v},
                                    {"t=|traceLevel=", "The level of verbosity on output. Valid values are Off, Info, Warning, Error, Verbose. Default is Info.", v => Logger.TraceLevel = ConvertStringToTraceLevel(v)},
                                    {"webDeployExist", "Tells ConDep not to deploy WebDeploy, because it already exist on server.", v => Params.WebDeployExist = v != null },
                                    {"infraOnly", "Deploy infrastructure only", v => Params.InfraOnly = v != null },
                                    {"deployOnly", "Deploy all except infrastructure", v => Params.DeployOnly = v != null},
                                    {"bypassLB", "Don't use configured load balancer during execution.", v => Params.BypassLB = v != null},
                                    {"h|?|help",  "show this message and exit", v => Params.ShowHelp = v != null }
                                };
            try
            {
                optionSet.Parse(_args);
            }
            catch (OptionException oe)
            {
                System.Console.Error.WriteLine(oe.ToString());
                Environment.Exit(1);
            }
            return optionSet;
        }
Пример #2
0
        private OptionSet GetOptionSet()
        {
            Params = new CommandLineParams();

            var optionSet = new OptionSet()
                                {
                                    {"t=|traceLevel=", "The level of verbosity on output. Valid values are Off, Info, Warning, Error, Verbose. Default is Info.\n", v =>
                                        {
                                            var traceLevel = ConvertStringToTraceLevel(v);
                                            Logger.TraceLevel = traceLevel;
                                            Params.TraceLevel = traceLevel;
                                        }},
                                    {"w|webDeployExist", "Tells ConDep not to deploy WebDeploy, because it already exist on server.\n", v => Params.WebDeployExist = v != null },
                                    {"q=|webQ=", "Will use ConDep's Web Queue to queue the deployment, preventing multiple deployments to execute at the same time. Useful when ConDep is triggered often from CI environments. Expects the url for the WebQ as its value.\n", v => Params.WebQAddress = v },
                                    {"d|deployOnly", "Deploy all except infrastructure\n", v => Params.DeployOnly = v != null},
                                    {"b|bypassLB", "Don't use configured load balancer during execution.\n", v => Params.BypassLB = v != null},
                                    {"s|sams|stopAfterMarkedServer", "Will only deploy to server marked as StopServer in json config, or first server if no server is marked. After execution, run ConDep with the continueAfterMarkedServer switch to continue deployment to remaining servers.\n", v => Params.StopAfterMarkedServer = v != null},
                                    {"c|cams|continueAfterMarkedServer", "Will continue deployment to remaining servers. Used after ConDep has previously executed with the stopAfterMarkedServer switch.\n", v => Params.ContinueAfterMarkedServer = v != null},
                                    {"h|?|help",  "show this message and exit", v => Params.ShowHelp = v != null }
                                };
            try
            {
                optionSet.Parse(_args);
            }
            catch (OptionException oe)
            {
                System.Console.Error.WriteLine(oe.ToString());
                Environment.Exit(1);
            }
            return optionSet;
        }
Пример #3
0
        private OptionSet GetOptionSet()
        {
            Params = new CommandLineParams();

            var optionSet = new OptionSet()
            {
                { "t=|traceLevel=", "The level of verbosity on output. Valid values are Off, Info, Warning, Error, Verbose. Default is Info.\n", v =>
                  {
                      var traceLevel = ConvertStringToTraceLevel(v);
                      Logger.TraceLevel = traceLevel;
                      Params.TraceLevel = traceLevel;
                  } },
                { "w|webDeployExist", "Tells ConDep not to deploy WebDeploy, because it already exist on server.\n", v => Params.WebDeployExist = v != null },
                { "q=|webQ=", "Will use ConDep's Web Queue to queue the deployment, preventing multiple deployments to execute at the same time. Useful when ConDep is triggered often from CI environments. Expects the url for the WebQ as its value.\n", v => Params.WebQAddress = v },
                { "d|deployOnly", "Deploy all except infrastructure\n", v => Params.DeployOnly = v != null },
                { "b|bypassLB", "Don't use configured load balancer during execution.\n", v => Params.BypassLB = v != null },
                { "s|sams|stopAfterMarkedServer", "Will only deploy to server marked as StopServer in json config, or first server if no server is marked. After execution, run ConDep with the continueAfterMarkedServer switch to continue deployment to remaining servers.\n", v => Params.StopAfterMarkedServer = v != null },
                { "c|cams|continueAfterMarkedServer", "Will continue deployment to remaining servers. Used after ConDep has previously executed with the stopAfterMarkedServer switch.\n", v => Params.ContinueAfterMarkedServer = v != null },
                { "h|?|help", "show this message and exit", v => Params.ShowHelp = v != null }
            };

            try
            {
                optionSet.Parse(_args);
            }
            catch (OptionException oe)
            {
                System.Console.Error.WriteLine(oe.ToString());
                Environment.Exit(1);
            }
            return(optionSet);
        }
Пример #4
0
        private static ConDepConfig GetEnvConfig(CommandLineParams cmdParams, Assembly assembly)
        {
            var envFileName = string.Format("{0}.Env.json", cmdParams.Environment);
            var envFilePath = Path.Combine(Path.GetDirectoryName(assembly.Location), envFileName);

            var jsonConfigParser = new EnvConfigParser();
            var envConfig = jsonConfigParser.GetEnvConfig(envFilePath);
            envConfig.EnvironmentName = cmdParams.Environment;

            //todo: add unit tests for these conditions
            if (!string.IsNullOrWhiteSpace(cmdParams.Server))
            {
                envConfig.Servers.RemoveAllExcept(cmdParams.Server);
            }

            if (cmdParams.BypassLB)
            {
                envConfig.LoadBalancer = null;
            }
            return envConfig;
        }