@@ -144,11 +144,15 @@ private void GetThumbprintAndAlgorithm(IList<HostedServiceListExtensionsResponse
144
144
thumbprintAlgorithm = string . Empty ;
145
145
}
146
146
}
147
-
147
+
148
148
public ExtensionConfiguration InstallExtension ( ExtensionConfigurationInput context , string slot ,
149
- Microsoft . WindowsAzure . Management . Compute . Models . ExtensionConfiguration extConfig ,
150
- Microsoft . WindowsAzure . Management . Compute . Models . ExtensionConfiguration secondSlotExtConfig )
149
+ DeploymentGetResponse deployment , DeploymentGetResponse peerDeployment )
151
150
{
151
+ Func < DeploymentGetResponse , ExtensionConfiguration > func = ( d ) => d == null ? null : d . ExtensionConfiguration ;
152
+
153
+ ExtensionConfiguration extConfig = func ( deployment ) ;
154
+ ExtensionConfiguration secondSlotExtConfig = func ( peerDeployment ) ;
155
+
152
156
ExtensionConfigurationBuilder builder = GetBuilder ( extConfig ) ;
153
157
ExtensionConfigurationBuilder secondSlotConfigBuilder = null ;
154
158
if ( secondSlotExtConfig != null )
@@ -253,23 +257,21 @@ public void Uninstall(string nameSpace, string type, Microsoft.WindowsAzure.Mana
253
257
}
254
258
}
255
259
256
- public Microsoft . WindowsAzure . Management . Compute . Models . ExtensionConfiguration Set ( DeploymentGetResponse currentDeployment , DeploymentGetResponse peerDeployment , ExtensionConfigurationInput [ ] inputs , string slot )
260
+ public ExtensionConfiguration Set ( DeploymentGetResponse currentDeployment , DeploymentGetResponse peerDeployment , ExtensionConfigurationInput [ ] inputs , string slot )
257
261
{
258
262
string errorConfigInput = null ;
259
263
if ( ! Validate ( inputs , out errorConfigInput ) )
260
264
{
261
265
throw new Exception ( string . Format ( Resources . ServiceExtensionCannotApplyExtensionsInSameType , errorConfigInput ) ) ;
262
266
}
263
267
264
- var oldExtConfig = currentDeployment != null ? currentDeployment . ExtensionConfiguration : new ExtensionConfiguration ( ) ;
265
- var oldPeerExtConfig = peerDeployment != null ? peerDeployment . ExtensionConfiguration : new ExtensionConfiguration ( ) ;
266
-
267
268
ExtensionConfigurationBuilder configBuilder = this . GetBuilder ( ) ;
268
269
foreach ( ExtensionConfigurationInput context in inputs )
269
270
{
270
271
if ( context != null )
271
272
{
272
- Microsoft . WindowsAzure . Management . Compute . Models . ExtensionConfiguration currentConfig = this . InstallExtension ( context , slot , oldExtConfig , oldPeerExtConfig ) ;
273
+ ExtensionConfiguration currentConfig = this . InstallExtension ( context , slot , currentDeployment , peerDeployment ) ;
274
+
273
275
foreach ( var r in currentConfig . AllRoles )
274
276
{
275
277
if ( currentDeployment == null || ! this . GetBuilder ( currentDeployment . ExtensionConfiguration ) . ExistAny ( r . Id ) )
@@ -295,7 +297,7 @@ public Microsoft.WindowsAzure.Management.Compute.Models.ExtensionConfiguration S
295
297
return extConfig ;
296
298
}
297
299
298
- public Microsoft . WindowsAzure . Management . Compute . Models . ExtensionConfiguration Add ( DeploymentGetResponse deployment , DeploymentGetResponse peerDeployment , ExtensionConfigurationInput [ ] inputs , string slot )
300
+ public ExtensionConfiguration Add ( DeploymentGetResponse deployment , DeploymentGetResponse peerDeployment , ExtensionConfigurationInput [ ] inputs , string slot )
299
301
{
300
302
string errorConfigInput = null ;
301
303
if ( ! Validate ( inputs , out errorConfigInput ) )
@@ -311,7 +313,8 @@ public Microsoft.WindowsAzure.Management.Compute.Models.ExtensionConfiguration A
311
313
{
312
314
if ( context != null )
313
315
{
314
- Microsoft . WindowsAzure . Management . Compute . Models . ExtensionConfiguration currentConfig = this . InstallExtension ( context , slot , oldExtConfig , oldPeerExtConfig ) ;
316
+ ExtensionConfiguration currentConfig = this . InstallExtension ( context , slot , deployment , peerDeployment ) ;
317
+
315
318
foreach ( var r in currentConfig . AllRoles )
316
319
{
317
320
if ( ! this . GetBuilder ( oldExtConfig ) . ExistAny ( r . Id ) )
0 commit comments