Skip to content

Commit

Permalink
Skip installing templates and manifest when SDK, Ref, and Runtime pac…
Browse files Browse the repository at this point in the history
…k versions cannot be obtained. (#1)

This should fix a bug where when it can be obtained it would generate an error saying to run "Update" instead.

Signed-off-by: AraHaan <seandhunt_7@yahoo.com>
  • Loading branch information
AraHaan authored Mar 13, 2022
1 parent 37cba37 commit c555f79
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/Elskom.Check.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
<LangVersion>latest</LangVersion>
<PackageId>Elskom.Net.Check</PackageId>
<Title>.NET Elskom Workload Check Tool</Title>
<Version>1.0.11</Version>
<Version>1.0.12</Version>
<Authors>Els_kom org.</Authors>
<Owners>Els_kom org.</Owners>
<summary>A dotnet tool for installing/uninstalling and updating the Elskom workload.</summary>
<PackageDescription>
A dotnet tool for installing/uninstalling and updating the Elskom workload.
</PackageDescription>
<PackageReleaseNotes>
Fixed issue installing / updating the workload does not factor in manually installed runtime and reference pack updates.
Skip installing templates and manifest when SDK, Ref, and Runtime pack versions cannot be obtained.
</PackageReleaseNotes>
<Copyright>Copyright © 2021</Copyright>
<PackageProjectUrl>https://github.com/Elskom/installer</PackageProjectUrl>
Expand Down
31 changes: 19 additions & 12 deletions src/InstallCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,27 @@ public override async Task<int> ExecuteAsync([NotNull] CommandContext context, [
Console.WriteLine($"Successfully installed workload package '{Constants.RuntimePackName}'.");
}

var templatePackVersion = await DownloadPackageAsync(
Constants.TemplatePackName).ConfigureAwait(false);
if (!templatePackVersion.Equals("already installed"))
// avoid installing the templates and the workload manifest if sdkPackVersion, refPackVersion,
// and runtimePackVersion is null or empty.
if (!string.IsNullOrEmpty(sdkPackVersion)
&& !string.IsNullOrEmpty(refPackVersion)
&& !string.IsNullOrEmpty(runtimePackVersion))
{
Console.WriteLine($"Successfully installed workload package '{Constants.TemplatePackName}'.");
}
var templatePackVersion = await DownloadPackageAsync(
Constants.TemplatePackName).ConfigureAwait(false);
if (!templatePackVersion.Equals("already installed"))
{
Console.WriteLine($"Successfully installed workload package '{Constants.TemplatePackName}'.");
}

InstallManifest(settings.SdkVersion!, new Dictionary<string, string>
{
{ Constants.SdkPackName, sdkPackVersion },
{ Constants.RefPackName, refPackVersion },
{ Constants.RuntimePackName, runtimePackVersion },
{ Constants.TemplatePackName, templatePackVersion },
});
InstallManifest(settings.SdkVersion!, new Dictionary<string, string>
{
{ Constants.SdkPackName, sdkPackVersion },
{ Constants.RefPackName, refPackVersion },
{ Constants.RuntimePackName, runtimePackVersion },
{ Constants.TemplatePackName, templatePackVersion },
});
}
return 0;
}

Expand Down

0 comments on commit c555f79

Please sign in to comment.