Issue #8300 has been updated by Jeff McCune.

# Possible Yak required broken? #

Adding the required keyword to the platform option does not cause the before 
action to be invoked:

<pre>
$ rdebug -- puppet cloudnode create --image ami-abcdefgh --keypair jeff_initial 
--type t1.micro
[-2, 4] in /Users/jeff/src/puppet/bin/puppet
   1  #!/usr/bin/env ruby
   2  
=> 3  require 'puppet/util/command_line'
   4  Puppet::Util::CommandLine.new.execute
/Users/jeff/src/puppet/bin/puppet:3
require 'puppet/util/command_line'
(rdb:1) b lib/puppet/cloudpack.rb:11
Breakpoint 1 file /Users/jeff/src/modules/cloudpack/lib/puppet/cloudpack.rb, 
line 11
(rdb:1) c
err: The following options are required: platform
err: Try 'puppet help cloudnode create' for usage
        /Users/jeff/src/puppet/lib/puppet/application/face_base.rb:244:in `exit'
        /Users/jeff/src/puppet/lib/puppet/application/face_base.rb:244:in `main'
        /Users/jeff/src/puppet/lib/puppet/application.rb:315:in `run_command'
        /Users/jeff/src/puppet/lib/puppet/application.rb:307:in `run'
        /Users/jeff/src/puppet/lib/puppet/application.rb:411:in `hook'
        /Users/jeff/src/puppet/lib/puppet/application.rb:307:in `run'
        /Users/jeff/src/puppet/lib/puppet/application.rb:402:in `exit_on_fail'
        /Users/jeff/src/puppet/lib/puppet/application.rb:307:in `run'
        /Users/jeff/src/puppet/lib/puppet/util/command_line.rb:69:in `execute'
        /Users/jeff/src/puppet/bin/puppet:4
        
/Users/jeff/.rvm/gems/ruby-1.8.7-p334@global/gems/ruby-debug-0.10.4/bin/rdebug:126:in
 `debug_load'
        
/Users/jeff/.rvm/gems/ruby-1.8.7-p334@global/gems/ruby-debug-0.10.4/bin/rdebug:126:in
 `debug_program'
        
/Users/jeff/.rvm/gems/ruby-1.8.7-p334@global/gems/ruby-debug-0.10.4/bin/rdebug:413
        /Users/jeff/.rvm/gems/ruby-1.8.7-p334@global/bin/rdebug:19:in `load'
        /Users/jeff/.rvm/gems/ruby-1.8.7-p334@global/bin/rdebug:19
Uncaught exception: exit
</pre>

----------------------------------------
Bug #8300: Option validation does not appear to be workin when run from the 
command line
https://projects.puppetlabs.com/issues/8300

Author: Jeff McCune
Status: Needs More Information
Priority: Normal
Assignee: 
Category: 
Target version: 
Keywords: 
Branch: 


# Overview #

Working on #8265 I'm running into the situation where not supplying a 
--platform option results in a nil value being passed directly to Fog.

For example, the following section of code does not seem to be evaluated:

<pre>
# lib/puppet/cloudpack.rb
  7     def add_platform_option(action)
  8       action.option '--platform=' do
  9         before_action do |action, args, options|
 10           supported_platforms = [ 'AWS' ]
 11           unless supported_platforms.include?(options[:platform])
 12             raise ArgumentError, "Platform must be one of the following: 
#{supported_platforms.join(', ')}"
 13           end
 14         end
 15       end
 16     end
</pre>

Instead, the error I'm getting flows all the way through to:

<pre>
337     def create_connection(options = {})
338       Fog::Compute.new(:provider => options[:platform])
339     end
</pre>

I set a breakpoint at line 10 above in the call to `supported_platforms = [ 
'AWS' ]` and this line was never evaluated in the debugger.

-Jeff


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to