Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-5427

incorrect path being defined in puppet-agent's init script is causing gems to be installed into puppet's gem env.

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • PUP 4.2.2
    • PUP 4.3.0
    • None
    • None
    • 1
    • RE 2015-10-28, RE 2015-11-04, RE 2015-11-11
    • Bug Fix
    • Hide
      When running puppet as a daemon, our private bin directory, /opt/puppetlabs/puppet/bin was prepended to the PATH for the puppet process, causing puppet to install gems (such as when using the `gem` package provider) into puppet's vendored ruby instead of system ruby. Now puppet correctly installs gems into system ruby when running daemonized, which is consistent with running puppet in the foreground, e.g. puppet agent -t.
      Show
      When running puppet as a daemon, our private bin directory, /opt/puppetlabs/puppet/bin was prepended to the PATH for the puppet process, causing puppet to install gems (such as when using the `gem` package provider) into puppet's vendored ruby instead of system ruby. Now puppet correctly installs gems into system ruby when running daemonized, which is consistent with running puppet in the foreground, e.g. puppet agent -t.

    Description

      OS: CentOS 6.x
      Puppet 4.2.2: puppet-agent-1.2.4-1.el6.x86_64 AND puppet-agent-1.2.6-1.el6.x86_64

      Puppet is installing gems into the puppet provided ruby and not into the system ruby.

      Steps to reproduce:

      Add this to your node manifest:
      package

      {'redis': ensure => 'present', provider => 'gem', }

      run "sudo service puppet restart" on your node.
      run "gem list" - You will find no redis gem.
      run "/opt/puppetlabs/puppet/bin/gem list" - Redis gem will be installed here!

      With some help from the folks on IRC, I found that the init script shipped by puppetlabs has a path which causes the puppet daemon/service to use the puppet provided gem binary vs the system's gem binary.

      $ cat /etc/init.d/puppet |grep PATH
      PATH=/opt/puppetlabs/puppet/bin:/usr/bin:/sbin:/bin:/usr/sbin

      If I remove "/opt/puppetlabs/puppet/bin" from the path line and restart the service, the puppet deamon does the right thing and installs the gem into the system ruby.

      Attachments

        Issue Links

          Activity

            People

              john.duarte John Duarte
              jbehrends Josh Behrends
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support