Issue #8300 has been updated by Jeff McCune.
# Additional information #
The before_action only appears to be invoked if the command line option is
provided on the command line. for example, providing --platform AWS does
trigger the before action:
<pre>
Breakpoint 2 at /Users/jeff/src/modules/cloudpack/lib/puppet/cloudpack.rb:10
[5, 14] in /Users/jeff/src/modules/cloudpack/lib/puppet/cloudpack.rb
5 module Puppet::CloudPack
6 class << self
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
</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.