Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(MODULES-7698) Fix OSX agent upgrades
Previously, OSX agent upgrades tried installing the new agent via. a Puppet package resource using the pkgdmg provider. Unfortunately, this does not work for several reasons. * pkgdmg is unversioned. This means that whenever it installs a package, it outputs a /var/db/.puppet_pkgdmg_installed_<package_name> file indicating that the package is installed. For our case, we'd have a /var/db/.puppet_pkgdmg_installed_puppet_agent file. This means that upgrades of the form "V1 => V2 => V3" (e.g. 2018.1.3 => 2018.1.4 => 2018.5) fail at the "V2 => V3" path because that file would still exist from the "V1 => V2" upgrade. Thus, pkgdmg would be tricked into thinking that the V3 agent was installed since it queries that file to see if the package is already installed on the system. * The installer stops the Puppet service in the middle of the installation which interrupts the current Puppet run if that run was triggered by the Puppet service. The installer proceeds to restart the service in the post-installation step. This can trigger a Puppet run while the installer's still running, which leads to weird race conditions like an infinite loop or Puppet installing the upgraded agent several times (typically twice) in successful cases. This commit takes care of these issues by following the same pattern we use for our Solaris 10 agent upgrades. Specifically, our Puppet run performs the upgrade in the background. The background process waits for the current Puppet run to exit before initiating the upgrade.
- Loading branch information