public DeploymentResult Execute() { var deploymentResult = new DeploymentResult(); bool abort = false; Ex(d => { if(!abort) { var o = d.Verify(); deploymentResult.MergedWith(o); if(deploymentResult.ShouldAbort) { abort = true; } if(o.ContainsError()) { //display errors! DisplayResults(o); //stop. report verify error. return; } var result = d.Execute(); DisplayResults(result); deploymentResult.MergedWith(result); if(deploymentResult.ShouldAbort) { abort = true; } } else { Logging.Coarse(LogLevel.Error, "[Skip ] {0}", d.Name); } }); return deploymentResult; }
public override DeploymentResult VerifyCanRun() { var result = new DeploymentResult(); result.AddNote(_reason); if(_filesShouldExist.Count > 0) { var tmpDR = new DeploymentResult(); foreach(var filePath in _filesShouldExist) { string actualPath = _path.GetFullPath(filePath); if(!File.Exists(actualPath)) { tmpDR.AddError(" File '{0}' should exist!.".FormatWith(actualPath)); } } result.MergedWith(tmpDR); //errors show up anyway, give some feedback if everything OK. if(!tmpDR.ContainsError()) { result.AddNote(" All {0} files found!".FormatWith(_filesShouldExist.Count)); } } else { result.AddNote(" No Files that should exist."); } if(_directoriesShouldExist.Count > 0) { var tmpDR = new DeploymentResult(); foreach(var dirPath in _directoriesShouldExist) { string actualPath = _path.GetFullPath(dirPath); if(!Directory.Exists(actualPath)) { tmpDR.AddError(" Directory '{0}' should exist".FormatWith(actualPath)); } } result.MergedWith(tmpDR); //errors show up anyway, give some feedback if everything OK. if(!tmpDR.ContainsError()) { result.AddNote(" All {0} directories found!".FormatWith(_directoriesShouldExist.Count)); } } else { result.AddNote(" No Directories that should exist."); } if(_filesShould_NOT_Exist.Count > 0) { var tmpDR = new DeploymentResult(); foreach(var filePath in _filesShould_NOT_Exist) { string actualPath = _path.GetFullPath(filePath); if(File.Exists(actualPath)) { tmpDR.AddError(" File '{0}' should NOT exist!.".FormatWith(actualPath)); } } result.MergedWith(tmpDR); if(!tmpDR.ContainsError()) { result.AddNote(" None of the {0} files exist!".FormatWith(_filesShould_NOT_Exist.Count)); } } else { result.AddNote(" No Files that should NOT exist."); } if(_directoriesShould_NOT_Exist.Count > 0) { var tmpDR = new DeploymentResult(); foreach(var dirPath in _directoriesShould_NOT_Exist) { string actualPath = _path.GetFullPath(dirPath); if(Directory.Exists(actualPath)) { tmpDR.AddError(" Directory '{0}' should NOT exist".FormatWith(actualPath)); } } result.MergedWith(tmpDR); if(!tmpDR.ContainsError()) { result.AddNote(" None of the {0} directories exist!".FormatWith(_directoriesShould_NOT_Exist.Count)); } } else { result.AddNote(" No Directories that should NOT exist."); } if(_shouldAbortOnError && result.ContainsError()) { result.AddAbort(_reason); } return result; }
public DeploymentResult VerifyCanRun() { var result = new DeploymentResult(); foreach (var task in _tasks) { var r = task.VerifyCanRun(); result = result.MergedWith(r); } return result; }
public DeploymentResult Execute() { var result = new DeploymentResult(); foreach (var task in _tasks) { var r = task.Execute(); result = result.MergedWith(r); } return result; }
public DeploymentResult Execute() { var deploymentResult = new DeploymentResult(); try { Ex(detail => { if (!deploymentResult.ShouldAbort) { var verifyResult = detail.Verify(); deploymentResult.MergedWith(verifyResult); if (verifyResult.ContainsError()) { DisplayResults(verifyResult); } else { Logging.Coarse(LogLevel.Info, "[Run ] {0}", detail.Name); var executeResult = detail.Execute(); DisplayResults(executeResult); deploymentResult.MergedWith(executeResult); } if (deploymentResult.ContainsError() && AbortOnError) { var message = "[Abort] Aborting due to previous error (since --abortOnError switch was specified)."; deploymentResult.AddAbort(message); Logging.Coarse(LogLevel.Error, message); throw new DeploymentAbortedException(); } } else { Logging.Coarse(LogLevel.Error, "[Skip ] {0}", detail.Name); } }); } catch (DeploymentAbortedException) { } return deploymentResult; }
public DeploymentResult Execute() { var result = new DeploymentResult(); foreach (var task in _tasks) { var r = task.Execute(); result = result.MergedWith(r); } return(result); }
public DeploymentResult VerifyCanRun() { var result = new DeploymentResult(); foreach (var task in _tasks) { var r = task.VerifyCanRun(); result = result.MergedWith(r); } return(result); }
public DeploymentResult Trace() { var deploymentResult = new DeploymentResult(); Ex(d => { var result = d.Trace(); DisplayResults(result); deploymentResult.MergedWith(result); }); return deploymentResult; }
public DeploymentResult Execute() { var deploymentResult = new DeploymentResult(); Ex(d => { var o = d.Verify(); deploymentResult.MergedWith(o); if (o.ContainsError()) { //stop. report verify error. return; } var result = d.Execute(); DisplayResults(result); deploymentResult.MergedWith(result); }); return deploymentResult; }
DeploymentResult Ex(Func<DeploymentDetail, DeploymentResult> action) { Console.WriteLine(Name); var result = new DeploymentResult(); foreach (var role in _roles) { Console.WriteLine(" {0}", role.Name); role.ForEachServer(s => { Console.WriteLine(" {0}", s.Name); s.ForEachDetail(d => { Console.WriteLine(" {0}", d.Name); var r = action(d); result.MergedWith(r); foreach (var item in r.Results) { Console.WriteLine(" [{0}] {1}", item.Status, item.Message); } }); }); } return result; }
public override DeploymentResult VerifyCanRun() { var result = new DeploymentResult(); result.AddNote(_reason); if (_filesShouldExist.Count > 0) { var tmpDR = new DeploymentResult(); foreach (var filePath in _filesShouldExist) { string actualPath = _path.GetFullPath(filePath); if (!File.Exists(actualPath)) { tmpDR.AddError(" File '{0}' should exist!.".FormatWith(actualPath)); } } result.MergedWith(tmpDR); //errors show up anyway, give some feedback if everything OK. if (!tmpDR.ContainsError()) { result.AddNote(" All {0} files found!".FormatWith(_filesShouldExist.Count)); } } else { result.AddNote(" No Files that should exist."); } if (_directoriesShouldExist.Count > 0) { var tmpDR = new DeploymentResult(); foreach (var dirPath in _directoriesShouldExist) { string actualPath = _path.GetFullPath(dirPath); if (!Directory.Exists(actualPath)) { tmpDR.AddError(" Directory '{0}' should exist".FormatWith(actualPath)); } } result.MergedWith(tmpDR); //errors show up anyway, give some feedback if everything OK. if (!tmpDR.ContainsError()) { result.AddNote(" All {0} directories found!".FormatWith(_directoriesShouldExist.Count)); } } else { result.AddNote(" No Directories that should exist."); } if (_filesShould_NOT_Exist.Count > 0) { var tmpDR = new DeploymentResult(); foreach (var filePath in _filesShould_NOT_Exist) { string actualPath = _path.GetFullPath(filePath); if (File.Exists(actualPath)) { tmpDR.AddError(" File '{0}' should NOT exist!.".FormatWith(actualPath)); } } result.MergedWith(tmpDR); if (!tmpDR.ContainsError()) { result.AddNote(" None of the {0} files exist!".FormatWith(_filesShould_NOT_Exist.Count)); } } else { result.AddNote(" No Files that should NOT exist."); } if (_directoriesShould_NOT_Exist.Count > 0) { var tmpDR = new DeploymentResult(); foreach (var dirPath in _directoriesShould_NOT_Exist) { string actualPath = _path.GetFullPath(dirPath); if (Directory.Exists(actualPath)) { tmpDR.AddError(" Directory '{0}' should NOT exist".FormatWith(actualPath)); } } result.MergedWith(tmpDR); if (!tmpDR.ContainsError()) { result.AddNote(" None of the {0} directories exist!".FormatWith(_directoriesShould_NOT_Exist.Count)); } } else { result.AddNote(" No Directories that should NOT exist."); } if (_shouldAbortOnError && result.ContainsError()) { result.AddAbort(_reason); } return(result); }