Skip to content

Commit

Permalink
Added checks to see if IIS can find ASP.NET modules (#78)
Browse files Browse the repository at this point in the history
* Added checks to see if IIS can find ASP.NET modules

* Bumped version

Co-authored-by: Pedro Nunes <[email protected]>
  • Loading branch information
DiogoCastilho and pintonunes authored Jun 24, 2020
1 parent 9ecc440 commit c4ecf87
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 22 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Outsystems.SetupTools Release History

## 3.5.0.0

- Get-OSServerPreReqs: Now check if IIS can find ASP.NET modules

## 3.4.0.0

- ExecuteCommand: Enabled real time logging for all executed processes. This impacts the execution of PlatformInstaller, ConfigTool, Scinstall
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 3.4.0.{build}
version: 3.5.0.{build}

only_commits:
files:
Expand Down
59 changes: 39 additions & 20 deletions src/Outsystems.SetupTools/Functions/Get-OSServerPreReqs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function Get-OSServerPreReqs
$RequirementStatus = @{}
$RequirementStatus.Title = $Title
$RequirementStatus.Status = $Result.Status
$RequirementStatus.OptionalsFailed = $Result.OptionalsFailed
$RequirementStatus.OptionalsStatus = $Result.OptionalsStatus

$TextStatus = "OK"
if (-not $($Result.Status))
Expand All @@ -68,7 +68,10 @@ function Get-OSServerPreReqs
[Bool]$Status,

[Parameter(Mandatory = $false)]
[Bool]$OptionalsFailed,
[Bool]$OptionalsStatus = $True,

[Parameter(Mandatory = $false)]
[Bool]$IISStatus = $True,

[Parameter(Mandatory = $true)]
[AllowEmptyCollection()]
Expand All @@ -81,21 +84,19 @@ function Get-OSServerPreReqs

$Result = @{}
$Result.Status = $Status
$Result.OptionalsStatus = $OptionalsStatus
$Result.IISStatus = $IISStatus

if ($null -eq $OptionalsFailed)
{
$Result.OptionalsFailed = $false
}
else
{
$Result.OptionalsFailed = $OptionalsFailed
}

if ($Result.Status -and -not $Result.OptionalsFailed)
if ($Result.Status -and $Result.OptionalsStatus)
{
$Result.Messages = $OKMessages
}
elseif ($Result.Status -and $Result.OptionalsFailed)
elseif ($Result.Status -and -not $Result.OptionalsStatus)
{
$Result.Messages = $NOKMessages
}
elseif (-not $Result.IISStatus)
{
$Result.Messages = $NOKMessages
}
Expand All @@ -109,7 +110,8 @@ function Get-OSServerPreReqs

$GlobalRequirementsResults = @{}
$GlobalRequirementsResults.Success = $True
$GlobalRequirementsResults.OptionalsFailed = $False
$GlobalRequirementsResults.OptionalsStatus = $True
$GlobalRequirementsResults.IISStatus = $True

$RequirementStatuses = @()
}
Expand Down Expand Up @@ -145,10 +147,23 @@ function Get-OSServerPreReqs
-ScriptBlock `
{
$Status = $([version]$(GetWindowsServerHostingVersion) -ge [version]$OS11ReqsMinDotNetCoreVersion)
$aspModules = Get-WebGlobalModule | Where-Object { $_.Name -like "aspnetcoremodule*" }
$OKMessages = @("Minimum .NET Core Windows Server Hosting found.")
$NOKMessages = @("Minimum .NET Core Windows Server Hosting not found.")

return $(CreateResult -Status $Status -OKMessages $OKMessages -NOKMessages $NOKMessages)
# Check if IIS can find ASP.NET modules
if ($aspModules.Count -lt 1)
{
$Status = $False
$IISStatus = $False
$NOKMessages = @("IIS can't find ASP.NET modules")
}
else
{
$IISStatus = $True
}

return $(CreateResult -Status $Status -IISStatus $IISStatus -OKMessages $OKMessages -NOKMessages $NOKMessages)
}
}
}
Expand Down Expand Up @@ -255,7 +270,7 @@ function Get-OSServerPreReqs
-ScriptBlock `
{
$Status = $True
$OptionalsFailed = $False
$OptionalsStatus = $True
$OKMessages = @("All Event Logs are correctly configured.")
$NOKMessages = @()

Expand All @@ -276,7 +291,7 @@ function Get-OSServerPreReqs

if ($CheckMaxLogSize -or $CheckOverflowAction)
{
$OptionalsFailed = $True
$OptionalsStatus = $False
$NOKMessage += "Event Log '$EventLogName' is not correctly configured."

if ($CheckMaxLogSize)
Expand All @@ -295,11 +310,11 @@ function Get-OSServerPreReqs
}
catch
{
$OptionalsFailed = $True
$OptionalsStatus = $False
$NOKMessages += "Something went wrong when trying to obtain Event Logs information: `"$_`""
}

return $(CreateResult -Status $Status -OptionalsFailed $OptionalsFailed -OKMessages $OKMessages -NOKMessages $NOKMessages)
return $(CreateResult -Status $Status -OptionalsStatus $OptionalsStatus -OKMessages $OKMessages -NOKMessages $NOKMessages)
}

$RequirementStatuses += CreateRequirementStatus -Title "FIPS Compliant Algorithms" `
Expand All @@ -323,9 +338,13 @@ function Get-OSServerPreReqs
{
$GlobalRequirementsResults.Success = $False
}
if ($RequirementStatus.OptionalsFailed)
if (-not $RequirementStatus.OptionalsStatus)
{
$GlobalRequirementsResults.OptionalsStatus = $False
}
if (-not $RequirementStatus.IISStatus)
{
$GlobalRequirementsResults.OptionalsFailed = $True
$GlobalRequirementsResults.IISStatus = $False
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Outsystems.SetupTools/OutSystems.SetupTools.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'OutSystems.SetupTools.psm1'

# Version number of this module.
ModuleVersion = '3.4.0.0'
ModuleVersion = '3.5.0.0'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down

0 comments on commit c4ecf87

Please sign in to comment.