Uploaded image for project: 'Modules'
  1. Modules
  2. MODULES-10594

puppet_install.ps1 leaves behind pid lock if it fails to reset services

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • None
    • None
    • puppet_agent
    • None
    • Night's Watch
    • 2
    • NW - 2020-04-01
    • Not Needed
    • Needs Assessment

    Description

      On Windows, if the puppet or pxp-agent services are running before the puppet_agent module upgrades the puppet-agent package, and the module is unable to reset one of the services (such as due to PCP-893) then the puppet_agent_upgrade.pid file is never removed.

      This is because install_puppet.ps1 resets the service, but if that fails:

      Set-Service : Failed to start service 'Puppet PXP Agent (pxp-agent)'.
      At C:\Windows\TEMP\install_puppet.ps1:253 char:9
      +         Set-Service $service.Name -Status $service.Status
      +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Set-Service], ServiceCommandException
          + FullyQualifiedErrorId : StartServiceFailed,Microsoft.PowerShell.Commands.SetServiceCommand
      

      Then it never calls Unlock-Installation:

      } finally {
        Reset-PuppetServices $services_before
        Unlock-Installation $install_pid_lock
      }
      

      The code should add another level of try/finally to ensure we always unlock if even reset raises.

      Attachments

        Activity

          People

            mihai.buzgau Mihai Buzgau
            josh Josh Cooper
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support