static void Set(DeploymentArguments arguments, IEnumerable<ICommandLineElement> commandLineElements) { string command = commandLineElements.Where(x => x is IArgumentElement) .Select(x => (IArgumentElement) x) .DefaultIfEmpty(new ArgumentElement("trace")) .Select(x => x.Id) .SingleOrDefault(); arguments.Command = command.ToEnum<DeploymentCommands>(); string deployment = commandLineElements.GetDefinition("deployment", "SEARCH"); arguments.Deployment = deployment; string enviro = commandLineElements.GetDefinition("environment", "LOCAL"); arguments.Environment = enviro; string config = commandLineElements.GetDefinition("settings", ".\\settings"); arguments.SettingsDirectory = config; string roles = commandLineElements.GetDefinition("roles", "ALL"); arguments.Role = roles; bool silent = commandLineElements.GetSwitch("silent"); arguments.Silent = silent; }
//TODO: Switch to new Magnum Configuration stuff public static DeploymentArguments Parse(string commandline) { var args = new DeploymentArguments(); Set(args, P(commandline)); return(args); }
static void Set(DeploymentArguments arguments, IEnumerable <ICommandLineElement> commandLineElements) { string command = commandLineElements.Where(x => x is IArgumentElement) .Select(x => (IArgumentElement)x) .DefaultIfEmpty(new ArgumentElement("trace")) .Select(x => x.Id) .SingleOrDefault(); arguments.Command = command.ToEnum <DeploymentCommands>(); string deployment = commandLineElements.GetDefinition("deployment", "SEARCH"); arguments.Deployment = deployment; string part = commandLineElements.GetDefinition("part", "ALL"); arguments.Role = part; string enviro = commandLineElements.GetDefinition("environment", "LOCAL"); arguments.Environment = enviro; string config = commandLineElements.GetDefinition("settings", ".\\settings"); arguments.SettingsDirectory = config; string roles = commandLineElements.GetDefinition("roles", "ALL"); arguments.Role = roles; }
public static void Set(DeploymentArguments arguments, IEnumerable <ICommandLineElement> commandLineElements) { string command = ExtractCommandToRun(commandLineElements); arguments.Command = command.ToEnum <DeploymentCommands>(); string deployment = commandLineElements.GetDefinition("deployment", "SEARCH"); arguments.Deployment = deployment; string enviro = commandLineElements.GetDefinition("environment", "LOCAL"); arguments.Environment = enviro; string config = commandLineElements.GetDefinition("settings", ".\\settings"); arguments.SettingsDirectory = config; string roles = commandLineElements.GetDefinition("roles", "ALL"); arguments.Role = roles; bool silent = commandLineElements.GetSwitch("silent"); arguments.Silent = silent; }
public static DeploymentArguments Parse(string commandline) { var result = new DeploymentArguments(); Set( result, P(commandline)); return result; }
public static DeploymentArguments Parse(string commandline) { var result = new DeploymentArguments(); Set(result, P(commandline)); return(result); }
public static void Set(DeploymentArguments arguments, ICommandLineElement[] commandLineElements) { arguments.Command = ExtractCommandToRun(commandLineElements).ToEnum<DeploymentCommands>(); arguments.Deployment = commandLineElements.GetDefinition("deployment", "SEARCH"); arguments.Environment = commandLineElements.GetDefinition("environment", "LOCAL"); arguments.SettingsPath = commandLineElements.GetDefinition("settings", ".\\settings"); arguments.Role = commandLineElements.GetDefinition("roles", "ALL"); arguments.Silent = commandLineElements.GetSwitch("silent"); arguments.AbortOnError = commandLineElements.GetSwitch("abortOnError"); }
public static void KickItOutThereAlready(Deployment deployment, DeploymentArguments args) { _inspector = new DropkickDeploymentInspector(args.ServerMappings); if (args.Role != "ALL") _inspector.RolesToGet(args.Role.Split(',')); var plan = _inspector.GetPlan(deployment); //HOW TO PLUG IN args.Role //TODO: should be able to block here _actions[args.Command](plan); }
public static DeploymentResult KickItOutThereAlready(Deployment deployment, DeploymentArguments args) { _inspector = new DropkickDeploymentInspector(args.ServerMappings); if (args.Role != "ALL") _inspector.RolesToGet(args.Role.Split(',')); var plan = _inspector.GetPlan(deployment); plan.AbortOnError = args.AbortOnError; //HOW TO PLUG IN args.Role //TODO: should be able to block here return plan.Run(args.Command); }
public static void KickItOutThereAlready(Deployment deployment, DeploymentArguments args) { _inspector = new DropkickDeploymentInspector(args.ServerMappings); if (args.Role != "ALL") { _inspector.RolesToGet(args.Role.Split(',')); } var plan = _inspector.GetPlan(deployment); //HOW TO PLUG IN args.Role //TODO: should be able to block here _actions[args.Command](plan); }
public void Execute() { bool verifyRan = false; bool executeRan = false; bool traceRan = false; var detail = new DeploymentDetail(() => { traceRan = true; return "trace"; }, () => { verifyRan = true; var r = new DeploymentResult(); r.AddGood("test:v"); return r; }, () => { executeRan = true; var r = new DeploymentResult(); r.AddGood("test:e"); return r; }, ()=> new DeploymentResult()); var web = new DeploymentRole("WEB"); web.AddServer("BILL"); web.ForEachServerMapped(s => s.AddDetail(detail)); var plan = new DeploymentPlan(); plan.AddRole(web); var args = new DeploymentArguments { Role = "WEB", Command = DeploymentCommands.Execute }; plan.Execute(); Assert.IsTrue(traceRan, "trace"); Assert.IsTrue(verifyRan, "verify"); Assert.IsTrue(executeRan, "execute"); }
static void Set(DeploymentArguments arguments, IEnumerable<ICommandLineElement> commandLineElements) { var command = commandLineElements.Where(x => x is IArgumentElement) .Select(x => (IArgumentElement) x) .DefaultIfEmpty(new ArgumentElement("trace")) .Select(x=>x.Id) .SingleOrDefault(); arguments.Command = command.ToEnum<DeploymentCommands>(); var deployment = commandLineElements.GetDefinition("deployment", "SEARCH"); arguments.Deployment = deployment; var part = commandLineElements.GetDefinition("part", "ALL"); arguments.Role = part; var enviro = commandLineElements.GetDefinition("environment", "LOCAL"); arguments.Environment = enviro; }
public static void Set(DeploymentArguments arguments, IEnumerable<ICommandLineElement> commandLineElements) { string command = ExtractCommandToRun(commandLineElements); arguments.Command = command.ToEnum<DeploymentCommands>(); string deployment = commandLineElements.GetDefinition("deployment", "SEARCH"); arguments.Deployment = deployment; string enviro = commandLineElements.GetDefinition("environment", "LOCAL"); arguments.Environment = enviro; string config = commandLineElements.GetDefinition("settings", ".\\settings"); arguments.SettingsDirectory = config; string roles = commandLineElements.GetDefinition("roles", "ALL"); arguments.Role = roles; bool silent = commandLineElements.GetSwitch("silent"); arguments.Silent = silent; }
static void Set(DeploymentArguments arguments, IEnumerable <ICommandLineElement> commandLineElements) { var command = commandLineElements.Where(x => x is IArgumentElement) .Select(x => (IArgumentElement)x) .DefaultIfEmpty(new ArgumentElement("trace")) .Select(x => x.Id) .SingleOrDefault(); arguments.Command = command.ToEnum <DeploymentCommands>(); var deployment = commandLineElements.GetDefinition("deployment", "SEARCH"); arguments.Deployment = deployment; var part = commandLineElements.GetDefinition("part", "ALL"); arguments.Role = part; var enviro = commandLineElements.GetDefinition("environment", "LOCAL"); arguments.Environment = enviro; }
public void Trace() { bool verifyRan = false; bool executeRan = false; bool traceRan = false; var detail = new DeploymentDetail(() => { traceRan = true; return "trace"; }, () => { verifyRan = true; return new DeploymentResult(); }, () => { executeRan = true; return new DeploymentResult(); }); var web = new DeploymentRole("WEB"); web.AddServer(new DeploymentServer("bob")); web.ForEachServer(s => s.AddDetail(detail)); var plan = new DeploymentPlan(); plan.AddRole(web); var args = new DeploymentArguments { Role = "WEB", Command = DeploymentCommands.Trace }; plan.Trace(); Assert.IsTrue(traceRan); Assert.IsFalse(verifyRan); Assert.IsFalse(executeRan); }
//TODO: Switch to new Magnum Configuration stuff public static DeploymentArguments Parse(string commandline) { var args = new DeploymentArguments(); Set(args, P(commandline)); return args; }
public static void KickItOutThereAlready(Deployment deployment, DeploymentArguments args) { var plan = _inspector.GetPlan(deployment, args.ServerMappings); _actions[args.Command](plan); }
public static void Deploy(string commandLine) { if (!_coarseLog.IsDebugEnabled) { Console.WriteLine("Sad Emo Otter says \"DEBUG LOGGING IS OFF - THIS ISN'T GOING TO BE FUN :(\""); } try { _coarseLog.Info("****************************************************"); _coarseLog.Info("DropkicK"); _coarseLog.Info("****************************************************"); _coarseLog.Info(""); DeploymentArguments newArgs = DeploymentCommandLineParser.Parse(commandLine); _coarseLog.Info("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"); _coarseLog.InfoFormat("Command: {0}", newArgs.Command); _coarseLog.InfoFormat("Environment: {0}", newArgs.Environment); _coarseLog.InfoFormat("Role: {0}", newArgs.Role); //////// DEPLOYMENT STUFF FindResult findResult = _finder.Find(newArgs.Deployment); Deployment deployment = findResult.Deployment; _coarseLog.InfoFormat("Deployment Method: '{0}'", findResult.MethodOfFinding); _coarseLog.InfoFormat("Deployment Found: '{0}'", findResult.Deployment.GetType().Name); if (deployment.GetType().Equals(typeof(NullDeployment))) { _coarseLog.Fatal("Couldn't find a deployment to run."); return; } //////// ////////// File Checks if (!VerifyPathToServerMapsFile(newArgs.PathToServerMapsFile)) { return; } if (!VerifyPathToSettingsFile(newArgs.PathToSettingsFile)) { return; } //////////////////// RoleToServerMap maps = _serverParser.Parse(new FileInfo(newArgs.PathToServerMapsFile)); newArgs.ServerMappings.Merge(maps); DisplayServerMappingsForEnvironment(newArgs.ServerMappings); _coarseLog.Info(""); _coarseLog.Info("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"); _coarseLog.Info("Please review the settings above when you are ready,"); _coarseLog.Info(" Press 'ctrl+c' to cancel."); if (deployment.HardPrompt) { bool wrong = true; do { _coarseLog.Info(" Please type the environment name '{0}' to continue.".FormatWith(newArgs.Environment)); var environment = Console.ReadLine(); if (environment.EqualsIgnoreCase(newArgs.Environment)) { wrong = false; } } while (wrong); } else { _coarseLog.Info(" Press enter to kick it out there"); Console.ReadKey(true); } /////// how to clean this up - below Type settingsType = deployment.GetType().BaseType.GetGenericArguments()[1]; var settings = (DropkickConfiguration)_parser.Parse(settingsType, new FileInfo(newArgs.PathToSettingsFile), commandLine, newArgs.Environment); settings.Environment = newArgs.Environment; deployment.Initialize(settings); DeploymentPlanDispatcher.KickItOutThereAlready(deployment, newArgs); } catch (Exception ex) { _coarseLog.Debug(commandLine); _coarseLog.Error(ex); } }