Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrades Fix - Web Adapter Configuration Fails if IWA is enabled + Federation Resource Failures + Data store test resource failures fix + Wrong Server URL endpoints displayed at the end #108

Merged
merged 5 commits into from
Nov 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Modules/ArcGIS/ArcGIS.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Esri
#
# Generated on: 10/31/2018
# Generated on: 11/1/2018
#

@{
Expand All @@ -12,7 +12,7 @@
# RootModule = ''

# Version number of this module.
ModuleVersion = '1.1.2'
ModuleVersion = '1.1.3'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down Expand Up @@ -107,7 +107,7 @@ PrivateData = @{
# IconUri = ''

# ReleaseNotes of this module
ReleaseNotes = 'ArcGIS Module for PowerShell DSC - 1.1.1'
ReleaseNotes = 'ArcGIS Module for PowerShell DSC - 1.1.3'

# External dependent modules of this module
# ExternalModuleDependencies = ''
Expand Down
43 changes: 30 additions & 13 deletions Modules/ArcGIS/ArcGIS.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ function Get-ArcGISURL
{
$ServerWAMachineNode = ($AllNodes | Where-Object { ($_.Role -icontains 'ServerWebAdaptor')} | Select-Object -First 1)
$ServerWAMachineName = $ServerWAMachineNode.NodeName
$ServerHostName = Get-FQDN $ServerWAMachineName
$ServerExternalDNSName = Get-FQDN $ServerWAMachineName
if(($ServerWAMachineNode.SslCertifcates | Where-Object { $_.Target -icontains 'WebAdaptor'} | Measure-Object).Count -gt 0)
{
$SSLCertificate = $ServerWAMachineNode.SslCertifcates | Where-Object { $_.Target -icontains 'WebAdaptor' } | Select-Object -First 1
Expand Down Expand Up @@ -712,21 +712,38 @@ function Configure-ArcGIS
}

if($JobFlag){
Write-Host "Dot Sourcing the Configuration:- ArcGISFederation"
. "$PSScriptRoot\Configuration\ArcGISFederation.ps1" -Verbose:$false

Write-Host "Compiling the Configuration:- ArcGISFederation"
ArcGISFederation -ConfigurationData $ConfigurationParamsHashtable

$RemoteFederation = if($ConfigurationParamsHashtable.ConfigData.Federation){$true}else{$false}

$PortalServerFederation = $False

if($Credential){
$JobFlag = Start-DSCJob -ConfigurationName ArcGISFederation -Credential $Credential -DebugMode $DebugMode
}else{

$JobFlag = Start-DSCJob -ConfigurationName ArcGISFederation -DebugMode $DebugMode
if(-not($RemoteFederation))
{
$ServerCheck = (($ConfigurationParamsHashtable.AllNodes | Where-Object { $_.Role -icontains 'Server' } | Measure-Object).Count -gt 0)
$PortalCheck = (($ConfigurationParamsHashtable.AllNodes | Where-Object { $_.Role -icontains 'Portal' } | Measure-Object).Count -gt 0)
if($ServerCheck -and $PortalCheck)
{
$PortalServerFederation = $True
}
}

if(Test-Path ".\ArcGISFederation") {
Remove-Item ".\ArcGISFederation" -Force -ErrorAction Ignore -Recurse
if($RemoteFederation -or $PortalServerFederation){
Write-Host "Dot Sourcing the Configuration:- ArcGISFederation"
. "$PSScriptRoot\Configuration\ArcGISFederation.ps1" -Verbose:$false

Write-Host "Compiling the Configuration:- ArcGISFederation"
ArcGISFederation -ConfigurationData $ConfigurationParamsHashtable

if($Credential){
$JobFlag = Start-DSCJob -ConfigurationName ArcGISFederation -Credential $Credential -DebugMode $DebugMode
}else{

$JobFlag = Start-DSCJob -ConfigurationName ArcGISFederation -DebugMode $DebugMode
}

if(Test-Path ".\ArcGISFederation") {
Remove-Item ".\ArcGISFederation" -Force -ErrorAction Ignore -Recurse
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion Modules/ArcGIS/Configuration/ArcGISFederation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Configuration ArcGISFederation
}
}

if($RemoteFederation -and $PortalServerFederation){
if($RemoteFederation -or $PortalServerFederation){
if($RemoteFederation){
$PortalHostName = $ConfigurationData.ConfigData.Federation.PortalHostName
$PortalPort = $ConfigurationData.ConfigData.Federation.PortalPort
Expand Down
30 changes: 18 additions & 12 deletions Modules/ArcGIS/DSCResources/ArcGIS_DataStore/ArcGIS_DataStore.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,10 @@ function Set-TargetResource
Write-Verbose "A Data Store has been registered. Now checking if this machine ($env:ComputerName) with FQDN '$MachineFQDN' belongs to it"
$result = Test-MachineParticipatingInBigDataStore -ServerURL $ServerURL -Token $token.token -Referer $Referer -MachineFQDN $MachineFQDN
if($result) {
Write-Verbose "The machine $($env:ComputerName) with FQDN '$MachineFQDN' already participates in the data store"
Write-Verbose "The machine $($env:ComputerName) with FQDN '$MachineFQDN' already participates in a Spatio Temporal data store"
$DsRegistered = $true
}else {
Write-Verbose "The machine $($env:ComputerName) with FQDN '$MachineFQDN' does NOT participates in the registered data store"
Write-Verbose "The machine $($env:ComputerName) with FQDN '$MachineFQDN' does NOT participates in a registered Spatio Temporal data store"
}
}else {
Write-Verbose "A Spatiotemporal Big Data Store has not been registered."
Expand Down Expand Up @@ -459,7 +459,7 @@ function Test-TargetResource
}

if($resultSpatioTemporal) {
$resultSpatioTemporal = Test-SpatiotemporalBigDataStoreStarted -ServerURL $ServerUrl -Token $token.token -Referer $Referer -MachineFQDN $FQDN
$resultSpatioTemporal = Test-SpatiotemporalBigDataStoreStarted -ServerURL $ServerUrl -Token $token.token -Referer $Referer -MachineFQDN $MachineFQDN
if($resultSpatioTemporal) {
Write-Verbose 'Big data store is started'
}else {
Expand All @@ -470,13 +470,8 @@ function Test-TargetResource
}

if(($result -or $resultSpatioTemporal) -and $DataStoreTypes) {
if(-not($token)) {
$token = Get-ServerToken -ServerEndPoint $ServerUrl -ServerSiteName 'arcgis' -Credential $SiteAdministrator -Referer $Referer
}

Write-Verbose $token.token

$info = Get-DataStoreInfo -DataStoreAdminEndpoint "https://$($MachineFQDN):2443/arcgis/datastoreadmin" -ServerSiteAdminCredential $SiteAdministrator -ServerSiteUrl "https://$($FQDN):6443/arcgis" `
$token = Get-ServerToken -ServerEndPoint $ServerUrl -ServerSiteName 'arcgis' -Credential $SiteAdministrator -Referer $Referer
$info = Get-DataStoreInfo -DataStoreAdminEndpoint "https://localhost:2443/arcgis/datastoreadmin" -ServerSiteAdminCredential $SiteAdministrator -ServerSiteUrl "https://$($FQDN):6443/arcgis" `
-Token $token.token -Referer $Referer

foreach($dstype in $DataStoreTypes) {
Expand Down Expand Up @@ -852,7 +847,8 @@ function Test-MachineParticipatingInBigDataStore
$i = 0
while(-not($done) -and ($i -lt $response.items.length)) {
$dataStorePath = $response.items[$i].path
if($dataStorePath) {
$dsType = $response.items[$i].info.dsFeature
if($dataStorePath -and ($dsType -ieq "spatioTemporal")) {
Write-Verbose "NoSQL DataStore $dataStorePath found"
$MachinesInDataStoreUrl = $ServerURL.TrimEnd('/') + '/arcgis/admin/data/items' + $dataStorePath + '/machines'
$response = Invoke-ArcGISWebRequest -Url $MachinesInDataStoreUrl -HttpFormParameters @{ f = 'json'; token = $Token } -Referer $Referer
Expand Down Expand Up @@ -972,7 +968,17 @@ function Test-SpatiotemporalBigDataStoreStarted
$response = Invoke-ArcGISWebRequest -Url $DataItemsUrl -HttpFormParameters @{ f = 'json'; token = $Token; types = 'nosql' } -Referer $Referer
$dataStorePath = $null
if($response.items -and $response.items.length -gt 0) {
$dataStorePath = $response.items[0].path
$done = $false
$i = 0
while(-not($done) -and ($i -lt $response.items.length)) {
$dsType = $response.items[$i].info.dsFeature
if($dsType -ieq "spatioTemporal") {
Write-Verbose "SpatioTemporal DataStore $dataStorePath found"
$dataStorePath = $response.items[$i].path
$done = $true
}
$i = $i + 1
}
} else {
throw "Spatiotemporal Big DataStore not found in arcgis data items"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function Set-TargetResource
}

$SiteURL = "https://$($ComponentHostName):6443"
$WAUrl = "http://$($HostName)/$($Context)/webadaptor"
$WAUrl = "https://$($HostName)/$($Context)/webadaptor"
Write-Verbose $WAUrl
$SiteUrlCheck = "$($SiteURL)/arcgis/rest/info?f=json"
Wait-ForUrl $SiteUrlCheck -HttpMethod 'GET'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ function Set-TargetResource
}
Write-Verbose "msiexec /x ""$ProdId"" /quiet"
Start-Process 'msiexec' -ArgumentList "/x ""$ProdId"" /quiet" -wait
Remove-WebConfigurationLocation -Name "Default Web Site/$($Context)"
break
}
}
Expand Down