Search code examples
puppetcentos6

Ruby error when deploying a module with Puppet on CentOS 6


I have installed both Puppet master and agent on machines running CentOS 6

Everything went well, until the moment I have tried to deploy a simple sample module: I got an error, explained on the picture.

Trying to edit the file didn't help and the file was actually updated each time from repository

I tried running a different module which resulted in the same error

Error Screenshot


Solution

  • The error is because the formatting for Ruby code will not work with older Ruby. The CentOS 6 upstream Ruby package is 1.8.7, which is a super old Ruby version, and has been EOL for 3 years since 2014.

    To fix this problem, Puppet started packaging Ruby and other dependancies as part of an all-in-one package since Puppet 4. This means there's no dependancy hell when it comes to EOL Ruby, OpenSSL and any other dependancies: they're all bundled and supported as a single RPM, without affecting the system packages.

    It also means that you don't break any applications that require a different system Ruby, and generally makes using Puppet a lot easier.

    Adding to this, the version of Puppet in CentOS is 3.X, which is also EOL. You should upgrade to Puppet 4. Here's a handy script that will install the Puppet 4 agent package on CentOS 6: https://github.com/petems/puppet-install-shell

    If you are limited to using Puppet 3 for whatever reason, there are a few less preferable solutions:

    • Download a new Ruby RPM for CentOS 6, (such as from this Github repo) or a CloudPackage.io repo (such as this one I made for CentOS 6 Ruby packages https://packagecloud.io/petems/ruby2/install)
      • Disadvantage: Those RPMs are not supported officially and might have unintentional issues
    • Fork the module to change the Ruby code
      • Disadvantage: This is a big maintenance cost, and you'll have to do this every time an update happens to the module upstream.