Skip to content

Commit

Permalink
Fixed an issue with installing multiple packages post restart. The ba…
Browse files Browse the repository at this point in the history
…ckground job was getting started when it shouldn't
  • Loading branch information
cturano committed Aug 9, 2017
1 parent 801e0fa commit 652560d
Show file tree
Hide file tree
Showing 9 changed files with 160 additions and 9 deletions.
4 changes: 2 additions & 2 deletions SitecorePackageDeployer.Web/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.8.0.0")]
[assembly: AssemblyFileVersion("1.8.0.0")]
[assembly: AssemblyVersion("1.9.0.0")]
[assembly: AssemblyFileVersion("1.9.0.0")]
10 changes: 10 additions & 0 deletions SitecorePackageDeployer.Web/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Data.Edm" version="5.7.0" targetFramework="net45" />
<package id="Microsoft.Data.OData" version="5.7.0" targetFramework="net45" />
<package id="Microsoft.Data.Services.Client" version="5.7.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="net45" />
<package id="System.Spatial" version="5.7.0" targetFramework="net45" />
<package id="WindowsAzure.Storage" version="8.0.1" targetFramework="net45" />
</packages>
30 changes: 30 additions & 0 deletions SitecorePackageDeployer.Web/web.Debug.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>

<!-- For more information on using web.config transformation visit https://go.microsoft.com/fwlink/?LinkId=125889 -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
In the example below, the "SetAttributes" transform will change the value of
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
finds an attribute "name" that has a value of "MyDB".
<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<system.web>
<!--
In the example below, the "Replace" transform will replace the entire
<customErrors> section of your web.config file.
Note that because there is only one customErrors section under the
<system.web> node, there is no need to use the "xdt:Locator" attribute.
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>
31 changes: 31 additions & 0 deletions SitecorePackageDeployer.Web/web.Release.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>

<!-- For more information on using web.config transformation visit https://go.microsoft.com/fwlink/?LinkId=125889 -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
In the example below, the "SetAttributes" transform will change the value of
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
finds an attribute "name" that has a value of "MyDB".
<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
<!--
In the example below, the "Replace" transform will replace the entire
<customErrors> section of your web.config file.
Note that because there is only one customErrors section under the
<system.web> node, there is no need to use the "xdt:Locator" attribute.
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>
21 changes: 21 additions & 0 deletions SitecorePackageDeployer.Web/web.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
</system.diagnostics>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
53 changes: 53 additions & 0 deletions SitecorePackageDeployer.packagedef.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<project>
<Metadata>
<metadata>
<PackageName>SitecorePackageDeployer</PackageName>
<Author>Charles Turano</Author>
<Version>1.8</Version>
<Revision />
<License />
<Comment />
<Attributes />
<Readme />
<Publisher>Hedgehog Development</Publisher>
<PostStep />
<PackageID />
</metadata>
</Metadata>
<SaveProject>True</SaveProject>
<Sources>
<xfiles>
<Entries>
<x-item>/App_Config/Include/Hhogdev.SitecorePackageDeployer.config</x-item>
<x-item>/bin/Hhogdev.SitecorePackageDeployer.dll</x-item>
<x-item>/bin/Hhogdev.SitecorePackageDeployer.pdb</x-item>
<x-item>/bin/Hhogdev.SitecorePackageDeployer.Web.dll</x-item>
<x-item>/bin/Hhogdev.SitecorePackageDeployer.Web.pdb</x-item>
<x-item>/sitecore/admin/StartSitecorePackageDeployer.aspx</x-item>
</Entries>
<Converter>
<FileToEntryConverter>
<Root>/</Root>
<Transforms />
</FileToEntryConverter>
</Converter>
<Include />
<Exclude />
<Name>Package Deployer Files</Name>
</xfiles>
</Sources>
<Converter>
<TrivialConverter>
<Transforms />
</TrivialConverter>
</Converter>
<Include />
<Exclude />
<Name />
</project>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,300italic,400italic,600italic,700italic,300,600,700,800" rel="stylesheet" />

<link href="/sitecore/shell/themes/standard/default/Default.css" rel="stylesheet" />

<link href="/sitecore/shell/controls/Lib/Flexie/flex.css" rel="stylesheet" />

Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private void RunPostInitializeStepsIfNeeded()

try
{
InstallPackage.ExecutePostSteps(installLogger, details);
InstallPackage.ExecutePostSteps(installLogger, details, true);

InstallPackage.NotifiyPackageComplete(InstallPackage.SUCCESS, details);
}
Expand Down
4 changes: 2 additions & 2 deletions SitecorePackageDeployer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.8.0.0")]
[assembly: AssemblyFileVersion("1.8.0.0")]
[assembly: AssemblyVersion("1.9.0.0")]
[assembly: AssemblyFileVersion("1.9.0.0")]
14 changes: 10 additions & 4 deletions SitecorePackageDeployer/Tasks/InstallPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,11 @@ private void InstallPackages()
}
else
{
ExecutePostSteps(installLogger, postStepDetails);
ExecutePostSteps(installLogger, postStepDetails, false);
installStatus = SUCCESS;

Log.Info(String.Format("Installation Complete: {0}", updatePackageFilenameStripped), this);
SetInstallerState(InstallerState.Ready);
SetInstallerState(InstallerState.InstallingPackage);
}
}
catch (PostStepInstallerException ex)
Expand Down Expand Up @@ -363,7 +363,7 @@ private void RunPostStepsAtStartup(string updatePackageFilename, string historyP
/// Executes the post install steps
/// </summary>
/// <param name="postStepDetails"></param>
internal static void ExecutePostSteps(InstallLogger installLogger, PostStepDetails postStepDetails)
internal static void ExecutePostSteps(InstallLogger installLogger, PostStepDetails postStepDetails, bool setReadyStateWhenDone)
{
try
{
Expand Down Expand Up @@ -391,11 +391,17 @@ internal static void ExecutePostSteps(InstallLogger installLogger, PostStepDetai

installLogger.Fatal("Post step execution failed", ex);

//If the post step fails, we need to make the installer ready for the next package so it doesn't get stuck waiting for this one to finish.
SetInstallerState(InstallerState.Ready);

throw;
}
finally
{
SetInstallerState(InstallerState.Ready);
if (setReadyStateWhenDone)
{
SetInstallerState(InstallerState.Ready);
}
}
}

Expand Down

0 comments on commit 652560d

Please sign in to comment.