Skip to content

Commit 06f3e6a

Browse files
committed
Fix Deployment Get Func
1 parent bd515ad commit 06f3e6a

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ public virtual void NewPaaSDeploymentProcess()
159159
}
160160
}
161161

162-
Action<DeploymentSlot, DeploymentGetResponse> func = (t, d) =>
162+
Func<DeploymentSlot, DeploymentGetResponse> func = t =>
163163
{
164-
d = null;
164+
DeploymentGetResponse d = null;
165165
try
166166
{
167167
d = this.ComputeClient.Deployments.GetBySlot(this.ServiceName, t);
@@ -173,15 +173,17 @@ public virtual void NewPaaSDeploymentProcess()
173173
this.WriteExceptionDetails(ex);
174174
}
175175
}
176+
177+
return d;
176178
};
177179

178180
var slotType = (DeploymentSlot)Enum.Parse(typeof(DeploymentSlot), this.Slot, true);
179181
DeploymentGetResponse currentDeployment = null;
180-
InvokeInOperationContext(() => func(slotType, currentDeployment));
182+
InvokeInOperationContext(() => currentDeployment = func(slotType));
181183

182184
var peerSlottype = slotType == DeploymentSlot.Production ? DeploymentSlot.Staging : DeploymentSlot.Production;
183185
DeploymentGetResponse peerDeployment = null;
184-
InvokeInOperationContext(() => func(slotType, peerDeployment));
186+
InvokeInOperationContext(() => peerDeployment = func(peerSlottype));
185187

186188
ExtensionManager extensionMgr = new ExtensionManager(this, ServiceName);
187189
extConfig = extensionMgr.Set(currentDeployment, peerDeployment, ExtensionConfiguration, this.Slot);

src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ public void ExecuteCommand()
164164
}
165165
}
166166

167-
Action<DeploymentSlot, DeploymentGetResponse> func = (t, d) =>
167+
Func<DeploymentSlot, DeploymentGetResponse> func = t =>
168168
{
169-
d = null;
169+
DeploymentGetResponse d = null;
170170
try
171171
{
172172
d = this.ComputeClient.Deployments.GetBySlot(this.ServiceName, t);
@@ -178,15 +178,17 @@ public void ExecuteCommand()
178178
this.WriteExceptionDetails(ex);
179179
}
180180
}
181+
182+
return d;
181183
};
182184

183185
var slotType = (DeploymentSlot)Enum.Parse(typeof(DeploymentSlot), this.Slot, true);
184186
DeploymentGetResponse currentDeployment = null;
185-
InvokeInOperationContext(() => func(slotType, currentDeployment));
187+
InvokeInOperationContext(() => currentDeployment = func(slotType));
186188

187189
var peerSlottype = slotType == DeploymentSlot.Production ? DeploymentSlot.Staging : DeploymentSlot.Production;
188190
DeploymentGetResponse peerDeployment = null;
189-
InvokeInOperationContext(() => func(slotType, peerDeployment));
191+
InvokeInOperationContext(() => peerDeployment = func(peerSlottype));
190192

191193
ExtensionManager extensionMgr = new ExtensionManager(this, ServiceName);
192194
extConfig = extensionMgr.Add(currentDeployment, peerDeployment, ExtensionConfiguration, this.Slot);

0 commit comments

Comments
 (0)