The Puppet Labs Issue Tracker has Moved:

Bug #7428

Puppet cert fails on 1.9.2 with wrong number of arguments

Added by Cody Herriges over 3 years ago. Updated over 2 years ago.

Status:ClosedStart date:05/06/2011
Priority:NormalDue date:
Assignee:Patrick Carlisle% Done:


Target version:2.7.10
Affected Puppet version: Branch:
Keywords:certificate cert 1.9

We've Moved!

Ticket tracking is now hosted in JIRA:

This issue is currently not available for export. If you are experiencing the issue described below, please file a new ticket in JIRA. Once a new ticket has been created, please add a link to it that points back to this Redmine ticket.


ody@orihime:[~]% rvm use 1.9.2                                            -- INSERT --
Using /Users/ody/.rvm/gems/ruby-1.9.2-p180
ody@orihime:[~]% sudo envpuppet puppet cert --trace --list                -- INSERT --
/Users/ody/gits/puppet/lib/puppet/application/cert.rb:42:in `block (2 levels) in <class:Cert>'
/Users/ody/gits/puppet/lib/puppet/application.rb:358:in `block (2 levels) in parse_options'
/Users/ody/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/optparse.rb:1277:in `call'
/Users/ody/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/optparse.rb:1277:in `block in parse_in_order'
/Users/ody/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/optparse.rb:1264:in `catch'
/Users/ody/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/optparse.rb:1264:in `parse_in_order'
/Users/ody/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/optparse.rb:1258:in `order!'
/Users/ody/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/optparse.rb:1349:in `permute!'
/Users/ody/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/optparse.rb:1370:in `parse!'
/Users/ody/gits/puppet/lib/puppet/application.rb:365:in `parse_options'
/Users/ody/gits/puppet/lib/puppet/application/cert.rb:212:in `parse_options'
/Users/ody/gits/puppet/lib/puppet/application.rb:303:in `block (2 levels) in run'
/Users/ody/gits/puppet/lib/puppet/application.rb:411:in `hook'
/Users/ody/gits/puppet/lib/puppet/application.rb:303:in `block in run'
/Users/ody/gits/puppet/lib/puppet/application.rb:402:in `exit_on_fail'
/Users/ody/gits/puppet/lib/puppet/application.rb:303:in `run'
/Users/ody/gits/puppet/lib/puppet/util/command_line.rb:61:in `execute'
/Users/ody/gits/puppet/bin/puppet:4:in `<main>'
Could not parse options: wrong number of arguments (1 for 0)

Related issues

Related to Puppet - Bug #10963: Collected resources with a puppet master fail on Ruby 1.9.x Closed 11/19/2011


#1 Updated by Ben Hughes about 3 years ago

  • Category set to ruby19
  • Status changed from Unreviewed to Accepted

#2 Updated by James Turnbull about 3 years ago

  • Status changed from Accepted to Needs Decision
  • Assignee set to Nigel Kersten

Nigel – this might be a 2.7.x blocker…

#3 Updated by Nigel Kersten about 3 years ago

  • Status changed from Needs Decision to Accepted
  • Assignee deleted (Nigel Kersten)
  • Target version set to 2.7.1

Targeting for 2.7.1. We will get this fixed, but it’s not going to block 2.7.0

#4 Updated by Cody Herriges about 3 years ago

I think that is completely acceptable. 1.9.x shouldn’t be a blocker because there is a solution, use Ruby 1.8.x. Also the server runs on 1.9.2 just isn’t usable.

#5 Updated by Michael Stahnke about 3 years ago

  • Target version changed from 2.7.1 to 2.7.x

#6 Updated by Tim Stoop almost 3 years ago

Not sure if this related, but I thought I’d better mention it here also. Using puppet 2.7.3 with ruby 1.9 also causes overrides of resources to fail with exactly that error. This same recipe works as expected on a puppetmaster 2.7.1 using ruby 1.8. The override looks as follows:

File <| title == "/etc/dovecot/dovecot-sql.conf" |> {
  source => "puppet://puppet/modules/local_mail/dovecot-sql.conf",

The puppet master logs only the above mentioned error (“Error 400 on SERVER: Puppet::Parser::Compiler failed with error ArgumentError: wrong number of arguments (1 for 0)”), even with trace and debug on, there’s no reference whatsoever to what causes this (so took us quite a while to find out what caused it). Should this be a separate bug or is it related to this one?

#7 Updated by Thomas Haggett almost 3 years ago

These issues have also been bugging me, they both seem to be manifestations of the same ruby18 – ruby19 change. In ruby18, you could pass arguments to a block with arity 0 and it would silently drop the argument. In ruby19 this raises the above exception.

I’ve filed the collected resources issue in a separate ticket (and also the quick hack I used to get them working again) at #10963.

For this issue, the opt-parse blocks are receiving unexpected arguments, so I’ve just patched the file on my machines.

For these options in lib/puppet/application/cert.rb:

option("--clean", "-c") do
  self.subcommand = "destroy"

option("--all", "-a") do
  @all = true


option("--signed", "-s") do
  @signed = true

I’ve hacked the three options to have a catch-all ignored argument, as such:

option("--all", "-a") do |*_|


option("--clean", "-c") do |*_|


option("--signed", "-s") do |*_|


and they all start working again.

Hope that helps.

#8 Updated by Jacob McCann over 2 years ago

Having the same issue. Used the workaround posted by Thomas Haggett. Seems to be working for me. THANKS!

#9 Updated by Patrick Carlisle over 2 years ago

  • Status changed from Accepted to In Topic Branch Pending Review
  • Assignee set to Patrick Carlisle
  • Affected Puppet version deleted (2.7.0rc1)

I don’t think you can use *arguments in a block in ruby 1.8, but as far as I can tell it’s safe to expect a single argument to all option blocks (OptionParser does the right thing even if the option doesn’t use an argument). I’ve submitted a pull request for this at

#10 Updated by Patrick Carlisle over 2 years ago

  • Status changed from In Topic Branch Pending Review to Merged - Pending Release
  • Target version changed from 2.7.x to 2.7.10

This was merged in commit:933844567fbe4078cb76f2c089ced1cb6c4170b7

(#7428) Fix option parsing for ruby 1.9 in cert application

In Ruby 1.9 block arity is strictly enforced. This changes options created
using blocks to all take one argument. The OptionParser library handles this
correctly even if an option doesn't take arguments (giving an argument of true
if the block takes an argument).

#11 Updated by Michael Stahnke over 2 years ago

  • Status changed from Merged - Pending Release to Closed

released in 2.7.10rc1

Also available in: Atom PDF