From 94026dbdf7b0eb9c026d5598df09a5549cba9e3d Mon Sep 17 00:00:00 2001 From: Daniel Mann Date: Mon, 7 Mar 2016 15:57:52 -0500 Subject: [PATCH] Corrected an issue whereby unique parameters were not being correctly de-duplicated when generating script parameters for rollback blocks. --- .../ScriptGenerator.cs | 4 ++-- .../Templates/IndividualActionTemplate.cs | 4 ++-- .../Templates/IndividualActionTemplate.tt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/RMWorkflowMigrator.Generator.PowerShell/ScriptGenerator.cs b/src/RMWorkflowMigrator.Generator.PowerShell/ScriptGenerator.cs index 776567b..e66dcbc 100644 --- a/src/RMWorkflowMigrator.Generator.PowerShell/ScriptGenerator.cs +++ b/src/RMWorkflowMigrator.Generator.PowerShell/ScriptGenerator.cs @@ -365,8 +365,8 @@ stuff extracted from the RM XAML workflow and stuff we pull out of the RM databa var rollbackScript = CreateScriptFromTemplate( rollbackGroup.Value, - scriptManualInterventionElements, - rollbackGroup.Value.SelectMany(s => s.ConfigurationVariables).Distinct(), + scriptManualInterventionElements, + rollbackGroup.Value.SelectMany(s => s.ConfigurationVariables).Distinct(new ConfigurationVariableEqualityComparer()), false); this.fs.WriteAllText(Path.Combine(targetPath, rollbackScriptName), rollbackScript); } diff --git a/src/RMWorkflowMigrator.Generator.PowerShell/Templates/IndividualActionTemplate.cs b/src/RMWorkflowMigrator.Generator.PowerShell/Templates/IndividualActionTemplate.cs index bc353af..5550bdb 100644 --- a/src/RMWorkflowMigrator.Generator.PowerShell/Templates/IndividualActionTemplate.cs +++ b/src/RMWorkflowMigrator.Generator.PowerShell/Templates/IndividualActionTemplate.cs @@ -320,7 +320,7 @@ public virtual string TransformText() #line default #line hidden - this.Write(" .\\"); + this.Write(" .\\"); #line 65 "C:\Users\daniel.mann\Source\Repos\Migrate-assets-from-RM-server-to-TFS\src\RMWorkflowMigrator.Generator.PowerShell\Templates\IndividualActionTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(script.Key)); @@ -330,7 +330,7 @@ public virtual string TransformText() this.Write(".ps1 "); #line 65 "C:\Users\daniel.mann\Source\Repos\Migrate-assets-from-RM-server-to-TFS\src\RMWorkflowMigrator.Generator.PowerShell\Templates\IndividualActionTemplate.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(string.Join(" ", script.Value.OrderBy(rsa => rsa.Sequence).SelectMany(rsa => rsa.ConfigurationVariables).Where(s => !string.IsNullOrWhiteSpace(s.Value) && s.IsParameter).Select(s => "-" + s.RemappedName + " \"$" + s.RemappedName + "\"")))); + this.Write(this.ToStringHelper.ToStringWithCulture(string.Join(" ", script.Value.OrderBy(rsa => rsa.Sequence).SelectMany(rsa => rsa.ConfigurationVariables).Where(s => !string.IsNullOrWhiteSpace(s.Value) && s.IsParameter).Distinct(new ConfigurationVariableEqualityComparer()).Select(s => "-" + s.RemappedName + " \"$" + s.RemappedName + "\"")))); #line default #line hidden diff --git a/src/RMWorkflowMigrator.Generator.PowerShell/Templates/IndividualActionTemplate.tt b/src/RMWorkflowMigrator.Generator.PowerShell/Templates/IndividualActionTemplate.tt index abc67c9..4153f0e 100644 --- a/src/RMWorkflowMigrator.Generator.PowerShell/Templates/IndividualActionTemplate.tt +++ b/src/RMWorkflowMigrator.Generator.PowerShell/Templates/IndividualActionTemplate.tt @@ -62,7 +62,7 @@ Write-output "Executing rollback script(s)" cd $basePath <#}#> <#foreach (var script in action.RollbackScripts) {#> - .\\<#=script.Key#>.ps1 <#=string.Join(" ", script.Value.OrderBy(rsa => rsa.Sequence).SelectMany(rsa => rsa.ConfigurationVariables).Where(s => !string.IsNullOrWhiteSpace(s.Value) && s.IsParameter).Select(s => "-" + s.RemappedName + " \"$" + s.RemappedName + "\""))#> <#=string.Join(" ", script.Value.Where(s => s.IsComponent).Select(c => $"-ComponentPath{c.Sequence} $ComponentPath{c.Sequence}"))#> -DeployerToolsPath $DeployerToolsPath + .\\<#=script.Key#>.ps1 <#=string.Join(" ", script.Value.OrderBy(rsa => rsa.Sequence).SelectMany(rsa => rsa.ConfigurationVariables).Where(s => !string.IsNullOrWhiteSpace(s.Value) && s.IsParameter).Distinct(new ConfigurationVariableEqualityComparer()).Select(s => "-" + s.RemappedName + " \"$" + s.RemappedName + "\""))#> <#=string.Join(" ", script.Value.Where(s => s.IsComponent).Select(c => $"-ComponentPath{c.Sequence} $ComponentPath{c.Sequence}"))#> -DeployerToolsPath $DeployerToolsPath <#}#> <#}#> exit 1