arcgis-powershell-dsc icon indicating copy to clipboard operation
arcgis-powershell-dsc copied to clipboard

ArcGIS_License fails with a generic error

Open jkissling opened this issue 4 years ago • 1 comments

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

3.2.0

Affected Resource(s)

ArcGIS_License

Configuration Files

Sample config BaseDeployment-ThreeMachine.json has been used

Expected Behavior

Successful software authorization (or a meaningful error shall be thrown)

Actual Behavior

Licensing fails. Generic Error message thrown:

Trace-DSCJob : 07.10.2021 16:35:32: PowerShell DSC resource ArcGIS_License  failed to execute Set-TargetResource functionality with error message:  
At C:\Program Files\WindowsPowerShell\Modules\ArcGIS\3.2.0\ArcGIS.psm1:240 char:5
+     Trace-DSCJob -Job $Job -JobName $ConfigurationName -DebugMode $De ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Trace-DSCJob

Trace-DSCJob : 07.10.2021 16:35:32: The SendConfigurationApply function did not succeed.
At C:\Program Files\WindowsPowerShell\Modules\ArcGIS\3.2.0\ArcGIS.psm1:240 char:5
+     Trace-DSCJob -Job $Job -JobName $ConfigurationName -DebugMode $De ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Trace-DSCJob

After further investigation and running the module directly on the target machine, here are some findings:

The process in Invoke-LicenseSoftware outputs:

"Can't start FlexNet Licensing Service (try setting automatic start)
"

This seems to be not treated as an Error (ArcGIS_License.psm1 Line 340). Hence, the function does not throw/write an error, but finishes. It is unclear if the authorization was successful. Is this as desinged?

When not run on the target machine, the function 'Invoke-LicenseSoftware' seems to never finish and propably runs in some kind of time out. Line 389 (Write-Verbose "Finished Licensing Product [$Product]" -Verbose) never gets reached.

No further investigation has been performed so far. It remains unclear why and when exactly the script crashes.

The function Test-TargetResource does not succeed in checking wether the software has been authorized or not. It aims to check the license in $file = "$env:SystemDrive\Program Files\ESRI\License$($LicenseVersion)\sysgen\keycodes". But $LicenseVersion is never assigned a value. Thus, the function always returns $false

EDIT: New Day new behavior. When enabling debugging, the authorization process in Invoke-LicenseSoftware exits with ExitCode = 15 and StandrdOuput:

$op = Error authorizing with the following file
<Path to provisioning file>

The error StandardError, however is empty:

$err = $p.StandardError.ReadToEnd()
--> $null

The function Invoke does not finish and somehow crashes. Generic error, as mentioned above.

Steps to Reproduce

Run

Invoke-ArcGISConfiguration -ConfigurationParametersFile <config.json> -Mode [InsatllLicense or InstallLicenseConfigure] -Credential <same as in ConfigData.Credentials.ServiceAccount>

or on the target machine

Import-Module <Path to ArcGIS_License Module>
Set-TargetResource -Component Server -ServerRole GeneralPurposeServer -LicenseFilePath <Path to .prvc> -Version 10.9 -Ensure "Present"

Using DscDebugging

# Enable Debugging on the target machine
Enable-DscDebug -BreakAll

# Run Configuration from local machine
Start-DscConfiguration -Path ".\ArcGISLicense" -Force -Verbose -Credential <credential> -Wait

# Attach to process from Powershell ISE
Enter-PSSession -ComputerName <host name> -Credential <credential>
Enter-PSHostProcess -Id <ID> -AppDomainName DscPsPluginWkr_AppDomain
Debug-Runspace -Id <ID>

Important Factoids

  • When testing directly on the target machine, the same user as in ConfigData.Credentials.ServiceAccount has been used
  • Lisensing the software using the GUI with the same prvc file works just fine

References

No references

jkissling avatar Oct 07 '21 14:10 jkissling

Thanks for analysing this.

I can confirm that giving a random file as the license in ConfigData.Server.LicenseFilePath will cause exactly this error in 4.1. The error is very hard to understand or debug, and has nothing to do with a WRITE ERROR. if the license is not found, not well formatted or not valid, it would be helpful for the log to show it.

[[ArcGIS_License]ServerLicensearcgis-server-prod] Licensing Product [Server] using Software Authorization Utility at C:\Program Files\Common Files\ArcGIS\bin\SoftwareAuthorization.exe

9/27/2023 9:44:21 AM: [ARCGIS-SERVER-P]:                            [[ArcGIS_License]ServerLicensearcgis-server-prod] [Running Command] C:\Program Files\Common Files\ArcGIS\bin\SoftwareAuthorization.exe -s -ver 11.1 -lif "junk.txt"
 9:44:26 AM: [ARCGIS-SERVER-P]: LCM:  [ End    Set      ]  [[ArcGIS_License]ServerLicensearcgis-server-prod]  in 6.0390 seconds.
2023

9/27/2023 9:44:26 AM: Operation 'Invoke CimMethod' complete.
: Trace-DSCJob : 9/27/2023 9:44:26 AM: PowerShell DSC resource ArcGIS_License  failed to execute Set-TargetResource
functionality with error message:
At C:\Program Files\WindowsPowerShell\Modules\ArcGIS\4.1.0\ArcGIS.psm1:261 char:5
+     Trace-DSCJob -Job $Job -JobName $ConfigurationName -DebugMode $De ...

intotecho avatar Sep 29 '23 09:09 intotecho