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

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: puppet_agent
    • Labels:
      None
    • Template:
    • Team:
      Night's Watch
    • Story Points:
      2
    • Sprint:
      NW - 2020-04-01
    • Release Notes:
      Not Needed
    • QA Risk Assessment:
      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

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

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support