/usr/lib/ruby/vendor_ruby/specinfra/backend/powershell/support/find_iis_component.ps1 is in ruby-specinfra 2.35.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | function FindIISWebsite
{
param($name)
Import-Module WebAdministration
Try {
Get-Item "IIS:\Sites\$name" -Erroraction silentlycontinue
}
Catch [System.IO.FileNotFoundException] {
Get-Item "IIS:\Sites\$name" -Erroraction silentlycontinue
}
}
function FindIISAppPool
{
param($name)
Import-Module WebAdministration
Try {
Get-Item "IIS:\AppPools\$name" -Erroraction silentlycontinue
}
Catch [System.IO.FileNotFoundException] {
Get-Item "IIS:\AppPools\$name" -Erroraction silentlycontinue
}
}
function FindSiteBindings
{
param($name, $protocol, $hostHeader, $port, $ipAddress)
Import-Module WebAdministration
Try {
Get-WebBinding -Name $name -Protocol $protocol -HostHeader $hostHeader -Port $port -IPAddress $ipAddress
}
Catch [System.IO.FileNotFoundException] {
Get-WebBinding -Name $name -Protocol $protocol -HostHeader $hostHeader -Port $port -IPAddress $ipAddress
}
}
function FindSiteVirtualDir
{
param($name, $vdir, $path)
Import-Module WebAdministration
$webVirtDirPath = [string]::Format('IIS:\Sites\{0}\{1}',$name, $vdir);
if (Test-Path $webVirtDirPath)
{
if ([string]::IsNullOrEmpty($path))
{
$true
}
else
{
(Get-Item $webVirtDirPath).physicalPath -eq $path
}
}
else
{
$false
}
}
function FindSiteApplication
{
param($name, $app, $pool, $physicalPath)
Import-Module WebAdministration
$path = "IIS:\Sites\${name}\${app}"
$result = $false
if (Test-Path $path)
{
$result = $true
if ([string]::IsNullOrEmpty($pool) -eq $false)
{
$result = $result -and (Get-Item $path).applicationPool -eq $pool
}
if ([string]::IsNullOrEmpty($physicalPath) -eq $false)
{
$result = $result -and (Get-Item $path).physicalPath -eq $physicalPath
}
}
$result
}
|