Skip to content

Conversation

AriaXLi
Copy link
Contributor

@AriaXLi AriaXLi commented Oct 3, 2025

Previously when puppet_agent fails to upgrade, only the error is given. This commit updates install_puppet.ps1 and puppet_agent_upgrade_error provider to collect & provide more information about the error. Specifically, the last 10 lines of output from the installer.log and any other error(s) that caused the failure are now included in the puppet_agent_upgrade_failure.log and are output by the puppet_agent_upgrade_error type and provider.

@AriaXLi
Copy link
Contributor Author

AriaXLi commented Oct 3, 2025

I am able to recreate the ScriptHalted error using this upgrade.pp (with an invalid dir given for install_dir):

  class { 'puppet_agent':
    package_version => "8.11.0",
    # Upgrades in Docker cannot start the puppet service due to systemd
    # incompatibilities. Essentially, Docker expects an init system for
    # services, but puppet installs services as systemd services. The line below
    # ensures that no services are started, resulting in a proper upgrade
    # process.
    collection      => "puppetcore8",
    username        => "forge-key",
    password        => Sensitive("XXX"),
    install_dir => 'D:\Program Files\Puppet Labs'
  }
include puppet_agent

The output before my changes:

$ puppet apply --debug uprade.pp
...
Debug: Reading Error Log C:/ProgramData/PuppetLabs/puppet/cache/state/puppet_agent_upgrade_failure.log
Debug: Deleting Error Log
Error: Failed previous installation with: ScriptHalted

Error: /Stage[main]/Puppet_agent::Install::Windows/Puppet_agent_upgrade_error[puppet_agent_upgrade_failure.log]/ensure_notexist: change from false to true failed: Failed previous installation with: ScriptHalted

The output after my changes:

puppet apply --debug uprade.pp
...
Debug: Reading Error Log C:/ProgramData/PuppetLabs/puppet/cache/state/puppet_agent_upgrade_failure.log
Debug: Deleting Error Log
Error: Failed previous installation with: ScriptHalted
MSI (s) (40:88) [18:26:53:231]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied.  Counter after decrement: -1
MSI (s) (40:88) [18:26:53:231]: Destroying RemoteAPI object.
MSI (s) (40:B0) [18:26:53:231]: Custom Action Manager thread ending.
MSI (c) (58:08) [18:26:53:231]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied.  Counter after decrement: -1
MSI (c) (58:08) [18:26:53:231]: MainEngineThread is returning 1603
=== Verbose logging stopped: 10/2/2025  18:26:53 ===

10/2/2025 6:26 PM ****************************** End msiexec.exe output ******************************
10/2/2025 6:26 PM ERROR: msiexec.exe installation failed!!! Return code 1603
10/2/2025 6:26 PM ERROR: ScriptHalted

Error: /Stage[main]/Puppet_agent::Install::Windows/Puppet_agent_upgrade_error[puppet_agent_upgrade_failure.log]/ensure_notexist: change from false to true failed: Failed previous installation with: ScriptHalted
MSI (s) (40:88) [18:26:53:231]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied.  Counter after decrement: -1
MSI (s) (40:88) [18:26:53:231]: Destroying RemoteAPI object.
MSI (s) (40:B0) [18:26:53:231]: Custom Action Manager thread ending.
MSI (c) (58:08) [18:26:53:231]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied.  Counter after decrement: -1
MSI (c) (58:08) [18:26:53:231]: MainEngineThread is returning 1603
=== Verbose logging stopped: 10/2/2025  18:26:53 ===

10/2/2025 6:26 PM ****************************** End msiexec.exe output ******************************
10/2/2025 6:26 PM ERROR: msiexec.exe installation failed!!! Return code 1603
10/2/2025 6:26 PM ERROR: ScriptHalted

@AriaXLi AriaXLi force-pushed the PA-7407/windows_upgrade_fails branch from 7bba93b to b817bab Compare October 3, 2025 00:31
Previously when puppet_agent fails to upgrade, only the error is given. This
commit updates install_puppet.ps1 and puppet_agent_upgrade_error provider to
collect & provide more information about the error. Specifically, the last 10
lines of output from the installer.log and any other error(s) that caused the
failure are now included in the puppet_agent_upgrade_failure.log and are
output by the puppet_agent_upgrade_error type and provider.
@AriaXLi AriaXLi force-pushed the PA-7407/windows_upgrade_fails branch from b817bab to bb7e93a Compare October 7, 2025 22:59
@AriaXLi AriaXLi marked this pull request as ready for review October 7, 2025 22:59
@AriaXLi AriaXLi requested review from bastelfreak and a team as code owners October 7, 2025 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant