Skip to content

Commit

Permalink
Updates for 3.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Shailesh Goel committed Feb 18, 2022
1 parent 6a8456b commit dee7b0a
Show file tree
Hide file tree
Showing 91 changed files with 5,042 additions and 1,106 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright (c) 2018-2021 Environmental Systems Research Institute, Inc.
Copyright (c) 2018-2022 Environmental Systems Research Institute, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
10 changes: 5 additions & 5 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: 11/18/2021
# Generated on: 02/17/2022
#

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

# Version number of this module.
ModuleVersion = '3.3.0'
ModuleVersion = '3.3.1'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand All @@ -27,7 +27,7 @@
CompanyName = 'Esri'

# Copyright statement for this module
Copyright = '(c) 2018-2021 ESRI. All rights reserved.'
Copyright = '(c) 2018-2022 ESRI. All rights reserved.'

# Description of the functionality provided by this module
Description = 'ArcGIS Module for PowerShell DSC'
Expand Down Expand Up @@ -69,7 +69,7 @@
NestedModules = @('ArcGIS.psm1')

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'Get-FQDN', 'Invoke-ArcGISConfiguration', 'Invoke-PublishWebApp', 'Invoke-BuildArcGISAzureImage', 'Invoke-PublishGISService', 'Get-ArcGISProductDetails'
FunctionsToExport = 'Get-FQDN', 'Invoke-ArcGISConfiguration', 'Invoke-PublishWebApp', 'Invoke-BuildArcGISAzureImage', 'Invoke-PublishGISService', 'Get-ArcGISProductDetails', 'Wait-ForServiceToReachDesiredState'

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()
Expand Down Expand Up @@ -107,7 +107,7 @@
# IconUri = ''

# ReleaseNotes of this module
ReleaseNotes = 'ArcGIS Module for PowerShell DSC - 3.3.0'
ReleaseNotes = 'ArcGIS Module for PowerShell DSC - 3.3.1'

# External dependent modules of this module
# ExternalModuleDependencies = ''
Expand Down
543 changes: 405 additions & 138 deletions Modules/ArcGIS/ArcGIS.psm1

Large diffs are not rendered by default.

192 changes: 112 additions & 80 deletions Modules/ArcGIS/ArcGISUtility.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -149,66 +149,6 @@ function Get-LastModifiedDateForRemoteFile
}
}

function Wait-ForServiceToReachDesiredState
{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[System.String]
$ServiceName,

[Parameter(Mandatory=$true)]
[System.String]
$DesiredState,

[System.Int32]
$SleepTimeInSeconds=10,

[System.Int32]
$MaxSeconds=300,

[System.Int32]
$MaxAttempts=-1
)

$Attempts = 0
$Done = $false
$startTime = Get-Date

while ($true)
{
if ($Attempts++ -gt 0) { # to skip the message for first attempt
Write-Verbose "Checking state of Service '$ServiceName'. Attempt # $Attempts"
}

$Service = Get-Service -Name $ServiceName -ErrorAction Ignore

$msg = "Service '$ServiceName' not ready."
if ($Service) {
$msg = "Service '$ServiceName' is in '$($Service.Status)' state."
# exit if done
if ($Service.Status -ieq $DesiredState) {
Write-Verbose $msg
return
}
}

Write-Verbose $msg # not there yet, report current state

# exit on timeout
if (($MaxSeconds -gt 0) -and ($(Get-Date) - $startTime).TotalSeconds -ge $MaxSeconds) {
return
}

# exit on number of attempts
if (($MaxAttempts -gt 0) -and ($Attempts -ge $MaxAttempts)) {
return
}

Write-Verbose "Waiting $SleepTimeInSeconds seconds."
Start-Sleep -Seconds $SleepTimeInSeconds
}
}

function Wait-ForUrl
{
Expand Down Expand Up @@ -593,6 +533,65 @@ function Confirm-PropertyInPropertiesFile
}
}

function Get-NodeAgentAmazonElementsPresent
{
[CmdletBinding()]
[OutputType([System.Boolean])]
param(
[System.String]
$InstallDir
)

$Enabled = $false
$File = Join-Path $InstallDir 'framework\etc\NodeAgentExt.xml'
if(Test-Path $File){
[xml]$xml = Get-Content $File
if((($xml.NodeAgent.Observers.Observer | Where-Object { $_.platform -ieq 'amazon'}).Length -gt 0) -or `
($xml.NodeAgent.Observers.Observer.platform -ieq 'amazon') -or `
(($xml.NodeAgent.Plugins.Plugin | Where-Object { $_.platform -ieq 'amazon'}).Length -gt 0) -or `
($xml.NodeAgent.Plugins.Plugin.platform -ieq 'amazon'))
{
Write-Verbose "Amazon elements exist in $File"
$Enabled = $true
}
}

$Enabled
}

function Remove-NodeAgentAmazonElements
{
[CmdletBinding()]
[OutputType([System.Boolean])]
param(
[System.String]
$InstallDir
)

$Changed = $false
$File = Join-Path $InstallDir 'framework\etc\NodeAgentExt.xml'
if(Test-Path $File){
[xml]$xml = Get-Content $File
if($xml.NodeAgent.Observers.Observer.platform -ieq 'amazon')
{
$xml.NodeAgent.Observers.RemoveChild($xml.NodeAgent.Observers.Observer)
Write-Verbose "Amazon Observer exists in $File. Removing it"
$Changed = $true
}
if($xml.NodeAgent.Plugins.Plugin.platform -ieq 'amazon')
{
$xml.NodeAgent.Plugins.RemoveChild($xml.NodeAgent.Plugins.Plugin)
Write-Verbose "Amazon plugin exists in $File. Removing it"
$Changed = $true
}
if($Changed) {
$xml.Save($File)
}
}

$Changed
}

function Add-HostMapping
{
[CmdletBinding()]
Expand Down Expand Up @@ -826,6 +825,8 @@ function Get-ArcGISProductName
$ProductName = 'ArcGIS Data Store'
}elseif($Name -ieq "ArcGIS for Server" -or $Name -ieq 'Server'){
$ProductName = 'ArcGIS Server'
}elseif($Name -ieq 'ServerDeepLearningLibraries'){
$ProductName = 'Deep Learning Libraries for ArcGIS Server'
}elseif($Name -ieq "Mission Server" -or $Name -ieq 'MissionServer'){
$ProductName = 'ArcGIS Mission Server'
}elseif($Name -ieq "Notebook Server" -or $Name -ieq 'NotebookServer'){
Expand Down Expand Up @@ -985,7 +986,6 @@ function Get-ComponentCode
WorkflowManagerWebApp = @{
'10.8.1' = '96A58AC8-C040-4E4A-A118-BE963BF1A8CF'
'10.9' = '28F45C9F-9581-4F82-9377-5B165D0D8580'
'10.9.1' = '62242EB9-BB56-4F73-9A8D-B4891A142D5A'
}
Monitor = @{
'10.7' = '0497042F-0CBB-40C0-8F62-F1922B90E12E'
Expand Down Expand Up @@ -1241,24 +1241,28 @@ Function Test-Install{
}
}

if(-not($resultSetFlag)){
if(-not($ProdId.StartsWith('{'))){
$ProdId = '{' + $ProdId
}
if(-not($ProdId.EndsWith('}'))){
$ProdId = $ProdId + '}'
}
$PathToCheck = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$($ProdId)"
Write-Verbose "Testing Presence for Component '$Name' with Path $PathToCheck"
if (Test-Path $PathToCheck -ErrorAction Ignore){
$result = $true
}
if(-not($result)){
$PathToCheck = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\$($ProdId)"
if($null -eq $ProdId){
$result = $false
}else{
if(-not($resultSetFlag)){
if(-not($ProdId.StartsWith('{'))){
$ProdId = '{' + $ProdId
}
if(-not($ProdId.EndsWith('}'))){
$ProdId = $ProdId + '}'
}
$PathToCheck = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$($ProdId)"
Write-Verbose "Testing Presence for Component '$Name' with Path $PathToCheck"
if (Test-Path $PathToCheck -ErrorAction Ignore){
$result = $true
}
if(-not($result)){
$PathToCheck = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\$($ProdId)"
Write-Verbose "Testing Presence for Component '$Name' with Path $PathToCheck"
if (Test-Path $PathToCheck -ErrorAction Ignore){
$result = $true
}
}
}
}

Expand Down Expand Up @@ -1471,13 +1475,41 @@ function Invoke-DataStoreConfigureBackupLocationTool
$op
}

function Restart-ArcGISService
{
[CmdletBinding()]
param(
[System.String]
$ServiceName
)

try {
Write-Verbose "Restarting Service $ServiceName"
Stop-Service -Name $ServiceName -Force -ErrorAction Ignore
Write-Verbose 'Stopping the service'
Wait-ForServiceToReachDesiredState -ServiceName $ServiceName -DesiredState 'Stopped'
Write-Verbose 'Stopped the service'
}catch {
Write-Verbose "[WARNING] Stopping Service $_"
}

try {
Write-Verbose 'Starting the service'
Start-Service -Name $ServiceName -ErrorAction Ignore
Wait-ForServiceToReachDesiredState -ServiceName $ServiceName -DesiredState 'Running'
Write-Verbose "Restarted Service $ServiceName"
}catch {
Write-Verbose "[WARNING] Starting Service $_"
}
}

Export-ModuleMember -Function Invoke-ArcGISWebRequest, ConvertTo-HttpBody, Invoke-UploadFile,`
Export-ModuleMember -Function Invoke-ArcGISWebRequest, ConvertTo-HttpBody, Invoke-UploadFile, `
Wait-ForUrl, Get-LastModifiedDateForRemoteFile, Confirm-ResponseStatus, `
Get-ServerToken, Get-PortalToken, Wait-ForServiceToReachDesiredState,`
Get-ServerToken, Get-PortalToken, `
Get-EsriRegistryKeyForService, Confirm-PropertyInPropertiesFile, `
Get-PropertyFromPropertiesFile, Set-PropertyFromPropertiesFile, Add-HostMapping,`
Get-ConfiguredHostIdentifier, Set-ConfiguredHostIdentifier, Get-ConfiguredHostName,`
Get-PropertyFromPropertiesFile, Set-PropertyFromPropertiesFile, `
Get-NodeAgentAmazonElementsPresent, Remove-NodeAgentAmazonElements, Add-HostMapping, `
Get-ConfiguredHostIdentifier, Set-ConfiguredHostIdentifier, Get-ConfiguredHostName, `
Set-ConfiguredHostName, Get-ConfiguredHostIdentifierType, Get-ComponentCode, Get-ArcGISProductName, `
Test-Install, Convert-PSObjectToHashtable, Get-DataStoreBackupLocation, `
Invoke-DataStoreConfigureBackupLocationTool, Invoke-DescribeDataStore
Invoke-DataStoreConfigureBackupLocationTool, Invoke-DescribeDataStore, Restart-ArcGISService
6 changes: 3 additions & 3 deletions Modules/ArcGIS/Configurations-Azure-2/ServerUpgrade.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ Configuration ServerUpgrade{

if($ServerRole -ieq "NotebookServer"){
$NotebookSamplesDataInstallerFileName = Split-Path $NotebookSamplesDataInstallerPath -Leaf
$NotebookSamplesDataInstallerPathOnMachine = "$env:TEMP\Server\$NotebookSamplesDataInstallerFileName"
$NotebookSamplesDataInstallerPathOnMachine = "$env:TEMP\NBServer\$NotebookSamplesDataInstallerFileName"

File DownloadNotebookSampleInstallerFromFileShare
{
Expand Down Expand Up @@ -364,15 +364,15 @@ Configuration ServerUpgrade{

if(Get-Service 'ArcGISGeoEventGateway' -ErrorAction Ignore)
{
ArcGIS_WindowsService ArcGIS_GeoEventGateway_Service
ArcGIS_WindowsService ArcGIS_GeoEventGateway_Service_Start
{
Name = 'ArcGISGeoEventGateway'
Credential = $ServiceCredential
StartupType = 'Automatic'
State = 'Running'
DependsOn = $Depends
}
$Depends += "[ArcGIS_WindowsService]ArcGIS_GeoEventGateway_Service"
$Depends += "[ArcGIS_WindowsService]ArcGIS_GeoEventGateway_Service_Start"
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions Modules/ArcGIS/Configurations-Azure/ServerUpgrade.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Configuration ServerUpgrade{

if($ServerRole -ieq "NotebookServer"){
$NotebookSamplesDataInstallerFileName = Split-Path $NotebookSamplesDataInstallerPath -Leaf
$NotebookSamplesDataInstallerPathOnMachine = "$env:TEMP\Server\$NotebookSamplesDataInstallerFileName"
$NotebookSamplesDataInstallerPathOnMachine = "$env:TEMP\NBServer\$NotebookSamplesDataInstallerFileName"

File DownloadNotebookSampleInstallerFromFileShare
{
Expand Down Expand Up @@ -362,15 +362,15 @@ Configuration ServerUpgrade{

if(Get-Service 'ArcGISGeoEventGateway' -ErrorAction Ignore)
{
ArcGIS_WindowsService ArcGIS_GeoEventGateway_Service
ArcGIS_WindowsService ArcGIS_GeoEventGateway_Service_Start
{
Name = 'ArcGISGeoEventGateway'
Credential = $ServiceCredential
StartupType = 'Automatic'
State = 'Running'
DependsOn = $Depends
}
$Depends += "[ArcGIS_WindowsService]ArcGIS_GeoEventGateway_Service"
$Depends += "[ArcGIS_WindowsService]ArcGIS_GeoEventGateway_Service_Start"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
Version = "00"
ProductId = $Installer.ProductId
PatchesDir = $ExecutionContext.InvokeCommand.ExpandString($Installer.PatchesLocalDir)
PatchInstallOrder = $Installer.Patches
Ensure = "Present"
}
}
Expand Down
2 changes: 1 addition & 1 deletion Modules/ArcGIS/Configurations-OnPrem/ArcGISDataStore.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Configuration ArcGISDataStore
)

Import-DscResource -ModuleName PSDesiredStateConfiguration
Import-DSCResource -ModuleName @{ModuleName="ArcGIS";ModuleVersion="3.3.0"}
Import-DscResource -ModuleName ArcGIS -ModuleVersion 3.3.1
Import-DscResource -Name ArcGIS_xFirewall
Import-DscResource -Name ArcGIS_Service_Account
Import-DscResource -Name ArcGIS_DataStore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Configuration ArcGISDataStoreBackup
)

Import-DscResource -ModuleName PSDesiredStateConfiguration
Import-DSCResource -ModuleName @{ModuleName="ArcGIS";ModuleVersion="3.3.0"}
Import-DscResource -ModuleName ArcGIS -ModuleVersion 3.3.1
Import-DscResource -Name ArcGIS_DataStoreBackup

Node $AllNodes.NodeName
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Configuration ArcGISDataStoreCertificateUpdate
{
Import-DscResource -ModuleName PSDesiredStateConfiguration
Import-DSCResource -ModuleName @{ModuleName="ArcGIS";ModuleVersion="3.3.0"}
Import-DscResource -ModuleName ArcGIS -ModuleVersion 3.3.1
Import-DscResource -Name ArcGIS_DataStore_TLS

Node $AllNodes.NodeName
Expand Down
Loading

0 comments on commit dee7b0a

Please sign in to comment.