Issue #12070 has been updated by Victor Engmark.


From a `--trace` run of Puppet:

    Error: Could not update: Execution of '/usr/bin/gem install --no-rdoc --no-ri travis-lint' returned 1: ERROR:  While executing gem ... (TypeError)
        wrong argument type nil (expected Regexp)
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/util/execution.rb:232:in `execute'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/provider.rb:102:in `execute'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/provider/package/gem.rb:128:in `install'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/provider/package/gem.rb:159:in `update'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/type/package.rb:106:in `block (3 levels) in <module:Puppet>'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/property.rb:427:in `set'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/property.rb:501:in `sync'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/transaction/resource_harness.rb:214:in `sync'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/transaction/resource_harness.rb:139:in `sync_if_needed'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/transaction/resource_harness.rb:81:in `perform_changes'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/transaction/resource_harness.rb:20:in `evaluate'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/transaction.rb:207:in `apply'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/transaction.rb:223:in `eval_resource'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/transaction.rb:150:in `call'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/transaction.rb:150:in `block (2 levels) in evaluate'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/util.rb:292:in `block in thinmark'
    /usr/lib/ruby/2.3.0/benchmark.rb:308:in `realtime'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/util.rb:291:in `thinmark'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/transaction.rb:150:in `block in evaluate'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/graph/relationship_graph.rb:118:in `traverse'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/transaction.rb:141:in `evaluate'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/resource/catalog.rb:202:in `block in apply'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/util/log.rb:153:in `with_destination'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/transaction/report.rb:107:in `as_logging_destination'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/resource/catalog.rb:201:in `apply'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/configurer.rb:119:in `block in apply_catalog'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/util.rb:129:in `block in benchmark'
    /usr/lib/ruby/2.3.0/benchmark.rb:308:in `realtime'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/util.rb:128:in `benchmark' 
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/configurer.rb:118:in `apply_catalog'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/configurer.rb:232:in `run_internal' 
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/configurer.rb:134:in `block in run'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/context.rb:65:in `override'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet.rb:240:in `override'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/configurer.rb:133:in `run'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/application/apply.rb:347:in `apply_catalog'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/application/apply.rb:274:in `block in main'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/context.rb:65:in `override'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet.rb:240:in `override'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/application/apply.rb:225:in `main'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/application/apply.rb:170:in `run_command'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/application.rb:344:in `block in run'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/util.rb:446:in `exit_on_fail'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/application.rb:344:in `run'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/util/command_line.rb:128:in `run'
    /usr/lib/ruby/vendor_ruby/2.3.0/puppet/util/command_line.rb:72:in `execute'
    /usr/bin/puppet:5:in `<main>'
    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)
        wrong argument type nil (expected Regexp)


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

* 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>