Skip to content

Commit 8acd7bc

Browse files
committed
Revert "Adding #AddCustomHostNamesForSlot method after passing the slot name."
This reverts commit aac1d2e.
1 parent aac1d2e commit 8acd7bc

File tree

2 files changed

+3
-47
lines changed

2 files changed

+3
-47
lines changed

src/Websites/Websites/Cmdlets/DeploymentSlots/SetAzureWebAppSlot.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public override void ExecuteCmdlet()
252252

253253
site = new Site
254254
{
255-
Location = location,
255+
Location = location,
256256
Tags = tags,
257257
ServerFarmId = WebApp.ServerFarmId,
258258
Identity = parameters.Contains("AssignIdentity") ? AssignIdentity ? new ManagedServiceIdentity("SystemAssigned", null, null) : new ManagedServiceIdentity("None", null, null) : WebApp.Identity,
@@ -266,7 +266,7 @@ public override void ExecuteCmdlet()
266266
}
267267
if (parameters.Contains("HostNames"))
268268
{
269-
WebsitesClient.AddCustomHostNamesForSlots(ResourceGroupName, location, Name, Slot, HostNames);
269+
WebsitesClient.AddCustomHostNames(ResourceGroupName, location, Name, HostNames);
270270
}
271271

272272
break;
@@ -306,7 +306,6 @@ public override void ExecuteCmdlet()
306306
CmdletHelpers.TryParseAppServicePlanMetadataFromResourceId(WebApp.ServerFarmId, out rg, out servicePlanName);
307307
WebApp.AzureStoragePath = null; // the API to update site Object doesn't have the AzureStorage Path property
308308
WebsitesClient.UpdateWebApp(ResourceGroupName, location, Name, Slot, servicePlanName, WebApp);
309-
WebsitesClient.AddCustomHostNamesForSlots(ResourceGroupName, location, Name,Slot, WebApp.HostNames.ToArray());
310309
break;
311310
}
312311

src/Websites/Websites/Utilities/WebsitesClient.cs

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ public void AddCustomHostNames(string resourceGroupName, string location, string
150150
catch (Exception e)
151151
{
152152
WriteWarning("Could not set custom hostname '{0}'. Details: {1}", hostName, e.ToString());
153+
return;
153154
}
154155
}
155156

@@ -170,50 +171,6 @@ public void AddCustomHostNames(string resourceGroupName, string location, string
170171
}
171172
}
172173

173-
public void AddCustomHostNamesForSlots(string resourceGroupName, string location, string webAppName, string slotName, string[] hostNames)
174-
{
175-
var webAppSlot = GetWebApp(resourceGroupName, webAppName, slotName);
176-
var currentHostNames = webAppSlot.HostNames;
177-
178-
// Add new hostnames
179-
foreach (var hostName in hostNames)
180-
{
181-
try
182-
{
183-
if (!currentHostNames.Contains(hostName, StringComparer.OrdinalIgnoreCase))
184-
{
185-
WrappedWebsitesClient.WebApps().CreateOrUpdateHostNameBindingSlot(resourceGroupName, webAppName,
186-
hostName, new HostNameBinding
187-
{
188-
SiteName = webAppName,
189-
}, slotName);
190-
}
191-
}
192-
catch (Exception e)
193-
{
194-
WriteWarning("Could not set custom hostname '{0}' for Slot. Details: {1}", hostName, e.ToString());
195-
return;
196-
}
197-
}
198-
199-
// Delete removed hostnames
200-
foreach (var hostName in currentHostNames)
201-
{
202-
try
203-
{
204-
if (!hostNames.Contains(hostName, StringComparer.OrdinalIgnoreCase))
205-
{
206-
WrappedWebsitesClient.WebApps().DeleteHostNameBindingSlot(resourceGroupName, webAppName, slotName, hostName);
207-
}
208-
}
209-
catch (Exception e)
210-
{
211-
WriteWarning("Could not remove custom hostname '{0}' for Slot. Details: {1}", hostName, e.ToString());
212-
}
213-
}
214-
}
215-
216-
217174
public void StartWebApp(string resourceGroupName, string webSiteName, string slotName)
218175
{
219176
string qualifiedSiteName;

0 commit comments

Comments
 (0)