OctopusDeploy / OctopusDSC

| Public | A PowerShell DSC resource for installing Octopus Deploy & Tentacles
Other
1 stars 61 forks source link

cTentacleAgent: Set-TargetResource doesn't create an agent certificate after the initial install #299

Open MikeCantCode opened 2 years ago

MikeCantCode commented 2 years ago

cTentacleAgent: Set-TargetResource doesn't create an agent certificate after the initial install

Error:

Registration fails if a certificate wasn't generated during the initial installation.

- LCM:  [ Start  Set      ]  [[cTentacleAgent]DirectResourceAccess]'
-                            [[cTentacleAgent]DirectResourceAccess] Checking if Tentacle is installed'
-                            [[cTentacleAgent]DirectResourceAccess] Tentacle present: True'
-                            [[cTentacleAgent]DirectResourceAccess] Checking for Windows Service: OctopusDeploy Tentacle'
-                            [[cTentacleAgent]DirectResourceAccess] Windows service: Stopped'
-                            [[cTentacleAgent]DirectResourceAccess] Configuring Tentacle...'
-                            [[cTentacleAgent]DirectResourceAccess] Upgrading/modifying Tentacle...'
-                            [[cTentacleAgent]DirectResourceAccess] Public host name: SomeComputer'
-                            [[cTentacleAgent]DirectResourceAccess] Executing command ''C:\Program Files\Octopus Deploy\Tentacle\\Tentacle.exe register-with --instance Tentacle --server https://OctoServerURL --name SomeName --apiKey ********** --force --console --comms-style TentaclePassive --publicHostName SomeComputer --environment SomeEnvironment --role SomeRole --tenant SomeTenant --tenanted-deployment-participation TenantedOrUntenanted'''
-                            [[cTentacleAgent]DirectResourceAccess] No certificate has been generated for this Tentacle. Please run the new-certificate command first.'
-                            [[cTentacleAgent]DirectResourceAccess] done.'
-                            [[cTentacleAgent]DirectResourceAccess] Starting OctopusDeploy Tentacle'
-                            [[cTentacleAgent]DirectResourceAccess] Finished'
- LCM:  [ End    Set      ]  [[cTentacleAgent]DirectResourceAccess]  in 1.9050 seconds.'
- LCM:  [ End    Set      ]    in  1.9600 seconds.'
- Operation 'Invoke CimMethod' complete.
- Time taken for configuration job to complete is 2.067 seconds

Issue:

Set-TargetResource should create an agent certificate if necessary in the Register-Tentacle and Add-TentacleToWorkerPool functions when $RegisterWithServer evaluates to True. Creating an agent certificate is currently only handled in the New-Tentacle function.