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

Updating for 2.1.1 #204

Merged
merged 2 commits into from
Sep 16, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 6/10/2019
# Generated on: 9/16/2019
#

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

# Version number of this module.
ModuleVersion = '2.1.0'
ModuleVersion = '2.1.1'

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

# ReleaseNotes of this module
ReleaseNotes = 'ArcGIS Module for PowerShell DSC - 2.1.0'
ReleaseNotes = 'ArcGIS Module for PowerShell DSC - 2.1.1'

# External dependent modules of this module
# ExternalModuleDependencies = ''
Expand Down
36 changes: 20 additions & 16 deletions Modules/ArcGIS/ArcGIS.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ Function Trace-DSCJob{
$i = 0
foreach($item in $j.Error) {
if($i -ge $PosError) {
Write-Host "[]$item" -foregroundcolor red
Write-Error $item
#Write-Host "[]$item" -foregroundcolor red
}
$i++
}
Expand Down Expand Up @@ -780,26 +781,29 @@ function Configure-ArcGIS
$ProCheck = (($ConfigurationParamsHashtable.AllNodes | Where-Object { $_.Role -icontains 'Pro' } | Measure-Object).Count -gt 0)
$LicenseManagerCheck = (($ConfigurationParamsHashtable.AllNodes | Where-Object { $_.Role -icontains 'LicenseManager' } | Measure-Object).Count -gt 0)

$EnterpriseSkipLicenseStep = $false
if($ConfigurationParamsHashtable.ConfigData.Version){
$EnterpriseSkipLicenseStep = $true
if($ConfigurationParamsHashtable.ConfigData.Version -and ($ServerCheck -or $PortalCheck)){
$EnterpriseSkipLicenseStep = $false
$EnterpriseVersionArray = $ConfigurationParamsHashtable.ConfigData.Version.Split(".")
$EnterpriseMajorVersion = $EnterpriseVersionArray[1]
if(($EnterpriseMajorVersion -ge 7) -and -not($ServerCheck) -and $PortalCheck){
$EnterpriseSkipLicenseStep = $true
}
}

$DesktopSkipLicenseStep = $false
if($ConfigurationParamsHashtable.ConfigData.DesktopVersion){
if($DesktopCheck -and ($ConfigurationParamsHashtable.ConfigData.Desktop.AuthorizationType -ieq "Float" -and -not($LicenseManagerCheck))){
$DesktopSkipLicenseStep = $true
if($ConfigurationParamsHashtable.ConfigData.DesktopVersion -and $DesktopCheck){
$DesktopSkipLicenseStep = $false
if($ConfigurationParamsHashtable.ConfigData.Desktop.AuthorizationType -ieq "Float" -and -not($LicenseManagerCheck)){
$DesktopSkipLicenseStep = $true
}
}

$ProSkipLicenseStep = $false
if($ConfigurationParamsHashtable.ConfigData.ProVersion){
if($ProCheck -and (($ConfigurationParamsHashtable.ConfigData.Pro.AuthorizationType -ieq "NAMED_USER") -or
($ConfigurationParamsHashtable.ConfigData.Pro.AuthorizationType -ieq "CONCURRENT_USE" -and -not($LicenseManagerCheck)))){
$ProSkipLicenseStep = $true
if($ConfigurationParamsHashtable.ConfigData.ProVersion -and $ProCheck){
$ProSkipLicenseStep = $false
if(($ConfigurationParamsHashtable.ConfigData.Pro.AuthorizationType -ieq "NAMED_USER") -or
($ConfigurationParamsHashtable.ConfigData.Pro.AuthorizationType -ieq "CONCURRENT_USE" -and -not($LicenseManagerCheck))){
$ProSkipLicenseStep = $true
}
}
Expand Down Expand Up @@ -979,7 +983,7 @@ function Configure-ArcGIS
$StandByPortalMachineNode = $null
$IsMultiMachinePortal = $False

for ( $i = 0; $i -lt $HostingConfig.AllNodes.count; $i++ ){
for ( $i = 0; $i -lt $PortalConfig.AllNodes.count; $i++ ){
$Role = $PortalConfig.AllNodes[$i].Role
if($Role -icontains 'Portal'){
if(-not($PrimaryPortalMachine)){
Expand Down Expand Up @@ -1349,7 +1353,7 @@ function Configure-ArcGIS
}
if($DsTypes -icontains "SpatioTemporal" -and -not($PrimaryBigDataStore))
{
$PrimaryBigDataStore =$DSConfig.AllNodes[$i].NodeName
$PrimaryBigDataStore = $DSConfig.AllNodes[$i].NodeName
}
if($DsTypes -icontains "TileCache" -and -not($PrimaryTileCache))
{
Expand All @@ -1371,7 +1375,7 @@ function Configure-ArcGIS
Remove-Item ".\DataStoreUpgradeConfigure" -Force -ErrorAction Ignore -Recurse
}
DataStoreUpgradeConfigure -ConfigurationData $cd -PrimarySiteAdmin $DSPSACredential -ServerMachineName $PrimaryServerMachine `
-ContentDirectoryLocation $DSConfig.ConfigData.DataStore.ContentDirectoryLocation -InstallDir $DSConfig.ConfigData.DataStore.Installer.InstallDir -Verbose
-ContentDirectoryLocation $DSConfig.ConfigData.DataStore.ContentDirectoryLocation -InstallDir $DSConfig.ConfigData.DataStore.Installer.InstallDir -Version $DSConfig.ConfigData.Version -Verbose
if($Credential){
$JobFlag = Start-DSCJob -ConfigurationName DataStoreUpgradeConfigure -Credential $Credential -DebugMode $DebugMode
}else{
Expand All @@ -1392,7 +1396,7 @@ function Configure-ArcGIS
Remove-Item ".\DataStoreUpgradeConfigure" -Force -ErrorAction Ignore -Recurse
}
DataStoreUpgradeConfigure -ConfigurationData $cd -PrimarySiteAdmin $DSPSACredential -ServerMachineName $PrimaryServerMachine `
-ContentDirectoryLocation $DSConfig.ConfigData.DataStore.ContentDirectoryLocation -InstallDir $DSConfig.ConfigData.DataStore.Installer.InstallDir -Verbose
-ContentDirectoryLocation $DSConfig.ConfigData.DataStore.ContentDirectoryLocation -InstallDir $DSConfig.ConfigData.DataStore.Installer.InstallDir -Version $DSConfig.ConfigData.Version -Verbose
if($Credential){
$JobFlag = Start-DSCJob -ConfigurationName DataStoreUpgradeConfigure -Credential $Credential -DebugMode $DebugMode
}else{
Expand All @@ -1413,7 +1417,7 @@ function Configure-ArcGIS
Remove-Item ".\DataStoreUpgradeConfigure" -Force -ErrorAction Ignore -Recurse
}
DataStoreUpgradeConfigure -ConfigurationData $cd -PrimarySiteAdmin $DSPSACredential -ServerMachineName $PrimaryServerMachine `
-ContentDirectoryLocation $DSConfig.ConfigData.DataStore.ContentDirectoryLocation -InstallDir $DSConfig.ConfigData.DataStore.Installer.InstallDir -Verbose
-ContentDirectoryLocation $DSConfig.ConfigData.DataStore.ContentDirectoryLocation -InstallDir $DSConfig.ConfigData.DataStore.Installer.InstallDir -Version $DSConfig.ConfigData.Version -Verbose
if($Credential){
$JobFlag = Start-DSCJob -ConfigurationName DataStoreUpgradeConfigure -Credential $Credential -DebugMode $DebugMode
}else{
Expand Down Expand Up @@ -1453,7 +1457,7 @@ function Configure-ArcGIS
}
if($JobFlag -eq $True){
DataStoreUpgradeConfigure -ConfigurationData $cd -PrimarySiteAdmin $DSPSACredential -ServerMachineName $PrimaryServerMachine `
-ContentDirectoryLocation $DSConfig.ConfigData.DataStore.ContentDirectoryLocation -InstallDir $DSConfig.ConfigData.DataStore.Installer.InstallDir -Verbose
-ContentDirectoryLocation $DSConfig.ConfigData.DataStore.ContentDirectoryLocation -InstallDir $DSConfig.ConfigData.DataStore.Installer.InstallDir -Version $DSConfig.ConfigData.Version -Verbose
if($Credential){
$JobFlag = Start-DSCJob -ConfigurationName DataStoreUpgradeConfigure -Credential $Credential -DebugMode $DebugMode
}else{
Expand Down
2 changes: 1 addition & 1 deletion Modules/ArcGIS/ArcGISUtility.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1540,7 +1540,7 @@ function Get-ComponentCode
'2.1' = '0368352A-8996-4E80-B9A1-B1BA43FAE6E6'
'2.2' = 'A23CF244-D194-4471-97B4-37D448D2DE76'
'2.3' = '9CB8A8C5-202D-4580-AF55-E09803BA1959'
'2.4' = '78D498E7-1791-4796-9A4F-6BFAD51C09B5'
'2.4' = 'E3B1CE52-A1E6-4386-95C4-5AB450EF57BD'
}
}
$ProductCodes[$ComponentName][$Version]
Expand Down
24 changes: 12 additions & 12 deletions Modules/ArcGIS/Configurations-OnPrem/ArcGISConfigure.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1174,26 +1174,26 @@ Configuration ArcGISConfigure
}
}
'RasterDataStoreItem'{
ArcGIS_FileShare RasterAnalysisFileShare
{
FileShareName = $ConfigurationData.ConfigData.DataStoreItems.RasterStore.FileShareName
FileShareLocalPath = $ConfigurationData.ConfigData.DataStoreItems.RasterStore.FileShareLocalPath
Ensure = 'Present'
Credential = $SACredential
IsDomainAccount = $ConfigurationData.ConfigData.Credentials.ServiceAccount.IsDomainAccount
if(-not($ConfigurationData.ConfigData.DataStoreItems.RasterStore.ExternalFileSharePath)){
ArcGIS_FileShare RasterAnalysisFileShare
{
FileShareName = $ConfigurationData.ConfigData.DataStoreItems.RasterStore.FileShareName
FileShareLocalPath = $ConfigurationData.ConfigData.DataStoreItems.RasterStore.FileShareLocalPath
Ensure = 'Present'
Credential = $SACredential
IsDomainAccount = $ConfigurationData.ConfigData.Credentials.ServiceAccount.IsDomainAccount
}
}

$DataStorePath = "\\$($env:ComputerName)\$($ConfigurationData.ConfigData.DataStoreItems.RasterStore.FileShareName)"

ArcGIS_DataStoreItem RasterDataStoreItem
{
Name = "RasterFileShareDataStore"
HostName = (Get-FQDN $PrimaryServerMachine)
Ensure = "Present"
SiteAdministrator = $PSACredential
DataStoreType = "RasterStore"
DataStorePath = $DataStorePath
DependsOn = @('[ArcGIS_FileShare]RasterAnalysisFileShare')
DataStorePath = if($ConfigurationData.ConfigData.DataStoreItems.RasterStore.ExternalFileSharePath){ $ConfigurationData.ConfigData.DataStoreItems.RasterStore.ExternalFileSharePath }else{ "\\$($env:ComputerName)\$($ConfigurationData.ConfigData.DataStoreItems.RasterStore.FileShareName)" }
DependsOn = if(-not($ConfigurationData.ConfigData.DataStoreItems.RasterStore.ExternalFileSharePath)){ @('[ArcGIS_FileShare]RasterAnalysisFileShare') }else{ @() }
}
}
'FileShare'{
Expand Down Expand Up @@ -1385,4 +1385,4 @@ Configuration ArcGISConfigure
}
}
}
}
}
4 changes: 2 additions & 2 deletions Modules/ArcGIS/Configurations-OnPrem/ArcGISLicense.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ Configuration ArcGISLicense

if($Node.PortalLicenseFilePath -and $Node.PortalLicensePassword)
{
$LicenseFilePath=$Node.ServerLicenseFilePath
$LicensePassword=$Node.ServerLicensePassword
$LicenseFilePath=$Node.PortalLicenseFilePath
$LicensePassword=$Node.PortalLicensePassword
}

ArcGIS_License "PortalLicense$($Node.NodeName)"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Configuration DataStoreUpgradeConfigure{
param(
[System.String]
$Version,

[System.Management.Automation.PSCredential]
$PrimarySiteAdmin,

Expand Down Expand Up @@ -27,6 +30,7 @@ Configuration DataStoreUpgradeConfigure{
SiteAdministrator = $PrimarySiteAdmin
ContentDirectory = $ContentDirectoryLocation
InstallDir = $InstallDir
Version = $Version
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ function Set-TargetResource
$DatastoresToRegisterString = ($DatastoresToRegister -join ',')
Write-Verbose "Registering datastores $DatastoresToRegisterString"
Register-DataStore -DataStoreAdminEndpoint $DataStoreAdminEndpoint -ServerSiteAdminCredential $SiteAdministrator `
-ServerSiteUrl "https://$($FQDN):6443/arcgis" -DataStoreContentDirectory $ContentDirectory -ServerAdminUrl "$ServerUrl/arcgis/admin" `
-ServerUrl $ServerUrl -DataStoreContentDirectory $ContentDirectory -ServerAdminUrl "$ServerUrl/arcgis/admin" `
-Token $token.token -Referer $Referer -MachineFQDN $MachineFQDN -DataStoreTypes $DataStoreTypes
}

Expand Down Expand Up @@ -453,12 +453,9 @@ function Get-DataStoreInfo
getConfigureInfo = 'true'
}

$HttpBody = To-HttpBody $WebParams
#Write-Verbose ($WebParams | ConvertTo-Json -Depth 4)
$DataStoreConfigureUrl = $DataStoreAdminEndpoint.TrimEnd('/') + '/configure'
Wait-ForUrl -Url $DataStoreConfigureUrl -MaxWaitTimeInSeconds 90 -SleepTimeInSeconds 20
Invoke-ArcGISWebRequest -Url $DataStoreConfigureUrl -HttpFormParameters $WebParams -Referer $Referer -HttpMethod 'POST' -LogResponse

}

function Register-DataStore
Expand All @@ -472,7 +469,7 @@ function Register-DataStore
$ServerSiteAdminCredential,

[System.String]
$ServerSiteUrl,
$ServerUrl,

[System.String]
$DataStoreContentDirectory,
Expand All @@ -496,6 +493,8 @@ function Register-DataStore
$DataStoreTypes
)

$ServerSiteUrl = $ServerURL.TrimEnd('/') + '/arcgis'

if(!$DataStoreContentDirectory) { throw "Must Specify DataStoreContentDirectory" }

$featuresJson = ',"features":{'
Expand Down Expand Up @@ -550,7 +549,7 @@ function Register-DataStore
Write-Verbose "Checking if datastore is registered"
$DatastoresToRegister = Get-DataStoreTypesToRegister -ServerURL $ServerUrl -Token $Token -Referer $Referer `
-DataStoreTypes $DataStoreTypes -MachineFQDN (Get-FQDN $env:ComputerName) `
-ServerSiteAdminCredential $ServerSiteAdminCredential
-DataStoreAdminEndpoint $DataStoreAdminEndpoint -ServerSiteAdminCredential $ServerSiteAdminCredential

$alreadyRegistered = ($DatastoresToRegister.Count -gt 0)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
- "Present" ensures that DataStore is Upgraded to the version specified.
- "Absent" ensures that DataStore is not upgraded or downgraded from a give version (Not Implemented).
.PARAMETER ServerHostName
HostName of the GIS Server for which the datastore was created and registered.
HostName of the GIS Server for which the datastore was created and registered.
.PARAMETER Version
Version to which the Datastore will be upgraded to.
.PARAMETER SiteAdministrator
A MSFT_Credential Object - Primary Site Administrator to access the GIS Server.
.PARAMETER ContentDirectory
Expand All @@ -23,7 +25,11 @@ function Get-TargetResource
(
[parameter(Mandatory = $true)]
[System.String]
$ServerHostName,
$ServerHostName,

[parameter(Mandatory = $true)]
[System.String]
$Version,

[ValidateSet("Present","Absent")]
[System.String]
Expand Down Expand Up @@ -52,7 +58,11 @@ function Set-TargetResource
(
[parameter(Mandatory = $true)]
[System.String]
$ServerHostName,
$ServerHostName,

[parameter(Mandatory = $true)]
[System.String]
$Version,

[ValidateSet("Present","Absent")]
[System.String]
Expand Down Expand Up @@ -130,7 +140,7 @@ function Set-TargetResource
$ExecPath = Join-Path $InstallDir 'tools\configuredatastore.bat'
$Arguments = "$($ServerAdminUrl) $($SiteAdministrator.GetNetworkCredential().UserName) $($SiteAdministrator.GetNetworkCredential().Password) $($ContentDirectory) --stores $dstypes"

write-verbose "$ExecPath $Arguments"
write-verbose "Executeing $ExecPath"

$psi = New-Object System.Diagnostics.ProcessStartInfo
$psi.FileName = $ExecPath
Expand Down Expand Up @@ -174,7 +184,11 @@ function Test-TargetResource
(
[parameter(Mandatory = $true)]
[System.String]
$ServerHostName,
$ServerHostName,

[parameter(Mandatory = $true)]
[System.String]
$Version,

[ValidateSet("Present","Absent")]
[System.String]
Expand All @@ -196,12 +210,25 @@ function Test-TargetResource

$ServerUrl = "https://$($ServerHostName):6443"
$Referer = $ServerUrl
Wait-ForUrl -Url "$ServerUrl/arcgis/admin" -MaxWaitTimeInSeconds 90 -SleepTimeInSeconds 5
$result = $true
$info = Invoke-ArcGISWebRequest -Url "https://localhost:2443/arcgis/datastoreadmin/configure" -HttpFormParameters @{ f = 'json'} -Referer $Referer -HttpMethod 'GET' -LogResponse
Wait-ForUrl -Url "$ServerUrl/arcgis/admin" -MaxWaitTimeInSeconds 90 -SleepTimeInSeconds 5 -Verbose
$result = $false
$Done = $false
$NumAttempts = 0
while(-not($Done) -and ($NumAttempts -lt 5)) {
try {
$info = Invoke-ArcGISWebRequest -Url "https://localhost:2443/arcgis/datastoreadmin/configure" -HttpFormParameters @{ f = 'json'} -Referer $Referer -HttpMethod 'GET' -LogResponse -Verbose

if($info.upgrading -and (($info.upgrading -ieq 'outplace') -or ($info.upgrading -ieq 'inplace'))){
$result = $false
if($info.upgrading -and (($info.upgrading -ieq 'outplace') -or ($info.upgrading -ieq 'inplace'))){
Write-Verbose "Upgrade in progress - $($info.upgrading)"
}elseif($info.currentVersion -ieq $Version){
Write-Verbose "Already upgraded to $Version"
$result = $true
}
$Done = $true
}
catch {
Write-Verbose "[WARNING]:- $_ on attempt $($NumAttempts + 1). Retry after 15 seconds"
}
}

if($Ensure -ieq 'Present') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
class ArcGIS_DataStoreUpgrade : OMI_BaseResource
{
[Key] String ServerHostName;
[Key] String Version;
[Write, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
[Write, EmbeddedInstance("MSFT_Credential")] String SiteAdministrator;
[Write] String ContentDirectory;
Expand Down
Loading