Issue #12070 has been reported by Victor Engmark.

----------------------------------------
Bug #12070: "wrong argument type nil" when installing any gem with Puppet on Arch Linux
https://bugs.ruby-lang.org/issues/12070

* Author: Victor Engmark
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
Based on [Stack Exchange question](https://unix.stackexchange.com/questions/252937/how-to-install-a-ruby-gem-on-arch-linux-using-puppet):

I've got [the following][1]:

    class travis_linter {
      include shell
    
      package { 'travis-lint':
        ensure   => latest,
        provider => gem,
      }
    }

When I try to [test it][2], however, I get the following Puppet output:

    ==> default: Debug: Executing: '/usr/bin/gem install --no-rdoc --no-ri travis-lint'
    ==> default: Error: Could not update: Execution of '/usr/bin/gem install --no-rdoc --no-ri travis-lint' returned 1: ERROR:  While executing gem ... (TypeError)
    ==> default:     wrong argument type nil (expected Regexp)
    ==> default: Error: /Stage[main]/Travis_linter/Package[travis-lint]/ensure: change from absent to latest failed: Could not update: Execution of '/usr/bin/gem install --no-rdoc --no-ri travis-lint' returned 1: ERROR:  While executing gem ... (TypeError)
    ==> default:     wrong argument type nil (expected Regexp)

Other possibly relevant output from the [full log file][3]:

    Debug: Puppet::Type::Package::ProviderPuppet_gem: file /opt/puppetlabs/puppet/bin/gem does not exist
    Debug: /Package[puppet-lint]: Provider gem does not support features virtual_packages; not managing attribute allow_virtual
    Debug: /Package[reek]: Provider gem does not support features virtual_packages; not managing attribute allow_virtual
    Debug: /Package[travis-lint]: Provider gem does not support features virtual_packages; not managing attribute allow_virtual

Using `exec` instead of `package` results in the same error:

    ==> default: Debug: Exec[/usr/bin/gem install --no-rdoc --no-ri travis-lint](provider=posix): Executing '/usr/bin/gem install --no-rdoc --no-ri travis-lint'
    ==> default: Debug: Executing: '/usr/bin/gem install --no-rdoc --no-ri travis-lint'
    ==> default: Notice: /Stage[main]/Travis_linter/Exec[/usr/bin/gem install --no-rdoc --no-ri travis-lint]/returns: ERROR:  While executing gem ... (TypeError)
    ==> default: Notice: /Stage[main]/Travis_linter/Exec[/usr/bin/gem install --no-rdoc --no-ri travis-lint]/returns:     wrong argument type nil (expected Regexp)
    ==> default: Error: /usr/bin/gem install --no-rdoc --no-ri travis-lint returned 1 instead of one of [0]
    ==> default: Debug: Class[Travis_linter]: Resource is being skipped, unscheduling all events
    ==> default: Error: /Stage[main]/Travis_linter/Exec[/usr/bin/gem install --no-rdoc --no-ri travis-lint]/returns: change from notrun to 0 failed: /usr/bin/gem install --no-rdoc --no-ri travis-lint returned 1 instead of one of [0]

I am able to run the exact same command manually:

    [vagrant@archlinux ~]$ /usr/bin/gem install --no-rdoc --no-ri travis-lint
    Fetching: travis-lint-2.0.0.gem (100%)
    WARNING:  You don't have /home/vagrant/.gem/ruby/2.3.0/bin in your PATH,
              gem executables will not run.
    Successfully installed travis-lint-2.0.0
    1 gem installed

Ditto [in a root shell][4]:

    [vagrant@archlinux ~]$ sudo -s
    root@archlinux:/home/vagrant# /usr/bin/gem install --no-rdoc --no-ri travis-lint
    WARNING:  You don't have /root/.gem/ruby/2.3.0/bin in your PATH,
              gem executables will not run.
    Successfully installed travis-lint-2.0.0
    1 gem installed

And ditto in `sh`:

    [vagrant@archlinux ~]$ sudo sh
    sh-4.3# /usr/bin/gem install --no-rdoc --no-ri travis-lint
    WARNING:  You don't have /root/.gem/ruby/2.3.0/bin in your PATH,
              gem executables will not run.
    Successfully installed travis-lint-2.0.0
    1 gem installed

Is something broken about running `gem` 2.5.1 with Puppet 4.3.1/4.3.2?

  [1]: https://github.com/l0b0/root/blob/cf94a48397bb2323bbecfd657b43d6fd748818c8/modules/travis_linter/manifests/init.pp
  [2]: https://github.com/l0b0/root/tree/cf94a48397bb2323bbecfd657b43d6fd748818c8#test
  [3]: http://pastebin.com/GgT3Vy1E
  [4]: https://unix.stackexchange.com/questions/252937/how-to-install-a-ruby-gem-on-arch-linux-using-puppet#comment436507_252937
  [5]: https://tickets.puppetlabs.com/browse/PUP-5645



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>