Skip to content

Commit ee933a6

Browse files
committed
Added Web Deploy change summary output
1 parent be186b5 commit ee933a6

File tree

4 files changed

+22
-9
lines changed

4 files changed

+22
-9
lines changed

src/ServiceManagement/Services/Commands.Test/Websites/PublishAzureWebsiteProjectTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using Microsoft.WindowsAzure.Management.WebSites.Models;
1111
using Moq;
1212
using Xunit;
13+
using Microsoft.Web.Deployment;
1314

1415
namespace Microsoft.WindowsAzure.Commands.Test.Websites
1516
{

src/ServiceManagement/Services/Commands.Utilities/Websites/IWebsitesClient.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
namespace Microsoft.WindowsAzure.Commands.Utilities.Websites
2424
{
25+
using Web.Deployment;
2526
using Utilities = Services.WebEntities;
2627

2728
public interface IWebsitesClient
@@ -450,7 +451,7 @@ void EnableApplicationDiagnostic(
450451
/// <param name="connectionStrings">The connection strings to overwrite the ones in the Web.config file.</param>
451452
/// <param name="skipAppData">Skip app data</param>
452453
/// <param name="doNotDelete">Do not delete files at destination</param>
453-
void PublishWebProject(string websiteName, string slot, string package, string setParametersFile, Hashtable connectionStrings, bool skipAppData, bool doNotDelete);
454+
DeploymentChangeSummary PublishWebProject(string websiteName, string slot, string package, string setParametersFile, Hashtable connectionStrings, bool skipAppData, bool doNotDelete);
454455

455456
/// <summary>
456457
/// Parse the Web.config files to get the connection string names.

src/ServiceManagement/Services/Commands.Utilities/Websites/WebsitesClient.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,15 +1216,15 @@ public WebSiteGetPublishProfileResponse.PublishProfile GetWebDeployPublishProfil
12161216
/// <param name="connectionStrings">The connection strings to overwrite the ones in the Web.config file.</param>
12171217
/// <param name="skipAppData">Skip app data</param>
12181218
/// <param name="doNotDelete">Do not delete files at destination</param>
1219-
public void PublishWebProject(string websiteName, string slot, string package, string setParametersFile, Hashtable connectionStrings, bool skipAppData, bool doNotDelete)
1219+
public DeploymentChangeSummary PublishWebProject(string websiteName, string slot, string package, string setParametersFile, Hashtable connectionStrings, bool skipAppData, bool doNotDelete)
12201220
{
12211221
if (File.GetAttributes(package).HasFlag(FileAttributes.Directory))
12221222
{
1223-
PublishWebProjectFromPackagePath(websiteName, slot, package, connectionStrings, skipAppData, doNotDelete);
1223+
return PublishWebProjectFromPackagePath(websiteName, slot, package, connectionStrings, skipAppData, doNotDelete);
12241224
}
12251225
else
12261226
{
1227-
PublishWebProjectFromPackageFile(websiteName, slot, package, setParametersFile, connectionStrings, skipAppData, doNotDelete);
1227+
return PublishWebProjectFromPackageFile(websiteName, slot, package, setParametersFile, connectionStrings, skipAppData, doNotDelete);
12281228
}
12291229
}
12301230

@@ -1238,7 +1238,7 @@ public void PublishWebProject(string websiteName, string slot, string package, s
12381238
/// <param name="connectionStrings">The connection strings to overwrite the ones in the Web.config file.</param>
12391239
/// <param name="skipAppData">Skip app data</param>
12401240
/// <param name="doNotDelete">Do not delete files at destination</param>
1241-
private void PublishWebProjectFromPackageFile(string websiteName, string slot, string package, string setParametersFile, Hashtable connectionStrings, bool skipAppData, bool doNotDelete)
1241+
private DeploymentChangeSummary PublishWebProjectFromPackageFile(string websiteName, string slot, string package, string setParametersFile, Hashtable connectionStrings, bool skipAppData, bool doNotDelete)
12421242
{
12431243
DeploymentBaseOptions remoteBaseOptions = CreateRemoteDeploymentBaseOptions(websiteName, slot);
12441244
DeploymentBaseOptions localBaseOptions = new DeploymentBaseOptions();
@@ -1282,7 +1282,7 @@ private void PublishWebProjectFromPackageFile(string websiteName, string slot, s
12821282
DoNotDelete = doNotDelete
12831283
};
12841284

1285-
deployment.SyncTo(remoteProviderOptions, remoteBaseOptions, syncOptions);
1285+
return deployment.SyncTo(remoteProviderOptions, remoteBaseOptions, syncOptions);
12861286
}
12871287
}
12881288

@@ -1295,7 +1295,7 @@ private void PublishWebProjectFromPackageFile(string websiteName, string slot, s
12951295
/// <param name="connectionStrings">The connection strings to overwrite the ones in the Web.config file.</param>
12961296
/// <param name="skipAppData">Skip app data</param>
12971297
/// <param name="doNotDelete">Do not delete files at destination</param>
1298-
private void PublishWebProjectFromPackagePath(string websiteName, string slot, string package, Hashtable connectionStrings, bool skipAppData, bool doNotDelete)
1298+
private DeploymentChangeSummary PublishWebProjectFromPackagePath(string websiteName, string slot, string package, Hashtable connectionStrings, bool skipAppData, bool doNotDelete)
12991299
{
13001300
DeploymentBaseOptions remoteBaseOptions = CreateRemoteDeploymentBaseOptions(websiteName, slot);
13011301
DeploymentBaseOptions localBaseOptions = new DeploymentBaseOptions();
@@ -1309,7 +1309,7 @@ private void PublishWebProjectFromPackagePath(string websiteName, string slot, s
13091309
{
13101310
DoNotDelete = doNotDelete
13111311
};
1312-
deployment.SyncTo(DeploymentWellKnownProvider.ContentPath, SetWebsiteNameForWebDeploy(websiteName, slot), remoteBaseOptions, syncOptions);
1312+
return deployment.SyncTo(DeploymentWellKnownProvider.ContentPath, SetWebsiteNameForWebDeploy(websiteName, slot), remoteBaseOptions, syncOptions);
13131313
}
13141314
}
13151315

src/ServiceManagement/Services/Commands/Websites/PublishAzureWebsiteProject.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Microsoft.WindowsAzure.Commands.Properties;
66
using Microsoft.WindowsAzure.Commands.Utilities.Common;
77
using Microsoft.WindowsAzure.Commands.Utilities.Websites.Common;
8+
using Microsoft.Web.Deployment;
89

910
namespace Microsoft.WindowsAzure.Commands.Websites
1011
{
@@ -117,8 +118,18 @@ public override void ExecuteCmdlet()
117118
try
118119
{
119120
// Publish the package.
120-
WebsitesClient.PublishWebProject(Name, Slot, fullPackage, fullSetParametersFile, connectionStrings, SkipAppData.IsPresent, DoNotDelete.IsPresent);
121+
DeploymentChangeSummary changeSummary = WebsitesClient.PublishWebProject(Name, Slot, fullPackage, fullSetParametersFile, connectionStrings, SkipAppData.IsPresent, DoNotDelete.IsPresent);
121122
WriteVerbose(string.Format(Resources.CompletePublishingProjectTemplate, fullPackage));
123+
124+
WriteObject("Change Summary:");
125+
WriteObject(string.Format("Bytes Copied: {0}", changeSummary.BytesCopied.ToString()));
126+
WriteObject(string.Format("Files Added: {0}", changeSummary.ObjectsAdded.ToString()));
127+
WriteObject(string.Format("Files Updated: {0}", changeSummary.ObjectsUpdated.ToString()));
128+
WriteObject(string.Format("Files Deleted: {0}", changeSummary.ObjectsDeleted.ToString()));
129+
WriteObject(string.Format("Errors: {0}", changeSummary.Errors.ToString()));
130+
WriteObject(string.Format("Warnings: {0}", changeSummary.Warnings.ToString()));
131+
WriteObject(string.Format("Parameters Changed: {0}", changeSummary.ParameterChanges.ToString()));
132+
WriteObject(string.Format("Total No of Changes: {0}", changeSummary.TotalChanges.ToString()));
122133
}
123134
catch (Exception)
124135
{

0 commit comments

Comments
 (0)