arcgis-powershell-dsc
arcgis-powershell-dsc copied to clipboard
Portal for ArcGIS HA: another site is created instead of joining existing
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
Module Version
- 4.1.0
Affected Resource(s)
- ArcGIS_Portal
Configuration Files
Expected Behavior
Second Portal for ArcGIS should be joining the already existing site instead of creating a new one.
Actual Behavior
I was facing some issues with a standby VM of Portal for ArcGIS and had to uninstall it. On a fresh VM, I rerun my configuration and noticed that at the end, the Portal for ArcGIS created another site instead of joining the already existing one. I tried to understand the logic at how it was determined:
In 'Set-TargetResource' of 'ArcGIS_Portal.psm1', I printed $IsHAPortal, $PeerMachineHostName and $Join :https://github.com/Esri/arcgis-powershell-dsc/blob/8621f7a7256d6f8b9431caf4674e01c8d3bce249/Modules/ArcGIS/DSCResources/ArcGIS_Portal/ArcGIS_Portal.psm1#L408
$IsHAPortal => 'True' $PeerMachineHostName => '' $Join => 'False'
So $Join is 'False', that is why it is not joining. Makes sense.
I then had a look the logic to determine whether $join should be True or Not in Configurations-OnPrem/ArcGISPortal.ps1
:
https://github.com/Esri/arcgis-powershell-dsc/blob/8621f7a7256d6f8b9431caf4674e01c8d3bce249/Modules/ArcGIS/Configurations-OnPrem/ArcGISPortal.ps1#L304-L326
So it seems like it depends whether the nodename is equal to $PrimaryPortalMachine variable. So how is the variable $PrimaryPortalMachine determined ? It is determined in ArcGIS in Invoke-ArcGISConfiguration
:
https://github.com/Esri/arcgis-powershell-dsc/blob/8621f7a7256d6f8b9431caf4674e01c8d3bce249/Modules/ArcGIS/ArcGIS.psm1#L1030-L1034
And what a surprise ! The first node in the list is considered the primary one ! That's quite an assumption don't you think @cameronkroeker ? I did not find any mention of this assumption anywhere in the documentation unless I missed it.
So I swapped the order of the nodes and everything went fine: my second 'Portal for ArcGIS' joined the already existing site.
It seems to me that the logic should be improved to test whether there is a "Portal for ArcGIS" running on the other node or not instead of swapping nodes order.
Steps to Reproduce
Run the configuration from the sample provided. Unregister node "Portal01" of the "Portal for ArcGIS" site, uninstall Portal for ArcGIS on "Portal01" and rerun the configuration. "Portal01" will create a new site instead of joining the one of "Portal02".
Thanks for listening !