diff options
| author | Max Martin <max@puppetlabs.com> | 2011-04-27 13:27:40 -0700 |
|---|---|---|
| committer | Max Martin <max@puppetlabs.com> | 2011-04-27 13:27:40 -0700 |
| commit | 68c82d4d8b75ebd8f0ab61b37ba78cf5fbc52081 (patch) | |
| tree | d3f136373e6a10819975fa1ec0a931c1eb4afb37 /lib/puppet/interface | |
| parent | 32b13dad06195b37f0e10d13c6d2a9d958be00a7 (diff) | |
| parent | 1b12b55b6a2d3581f9643bf09d55727ba1213580 (diff) | |
Merge branch '2.7.next' into next
* 2.7.next:
(#3420) Nagios "name" attribute does not output correctly
(#4487) When setting environment on a host, ensure it is a string.
add test for ticket 7101
(#7220) Add the ability to "inherit" options.
(#6487) Add some testing for OS X version support in DirectoryService provider
(#6487) Directoryservice provider will fail in future OS releases
(#6368) Make the File type autorequire its nearest ancestor directory
Diffstat (limited to 'lib/puppet/interface')
| -rw-r--r-- | lib/puppet/interface/action.rb | 5 | ||||
| -rw-r--r-- | lib/puppet/interface/action_builder.rb | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/puppet/interface/action.rb b/lib/puppet/interface/action.rb index 08bc0a345..f8eef69b1 100644 --- a/lib/puppet/interface/action.rb +++ b/lib/puppet/interface/action.rb @@ -217,6 +217,11 @@ WRAPPER option end + def inherit_options_from(action) + options = action.options.map { |opt| action.get_option(opt, false) } + options.reject!(&:nil?).uniq.each { |option| add_option(option) } + end + def option?(name) @options.include? name.to_sym end diff --git a/lib/puppet/interface/action_builder.rb b/lib/puppet/interface/action_builder.rb index 2ffa38709..fd8b0856f 100644 --- a/lib/puppet/interface/action_builder.rb +++ b/lib/puppet/interface/action_builder.rb @@ -38,6 +38,16 @@ class Puppet::Interface::ActionBuilder @action.add_option(option) end + def inherit_options_from(action) + if action.is_a? Symbol + name = action + action = @face.get_action(name) or + raise ArgumentError, "This Face has no action named #{name}!" + end + + @action.inherit_options_from(action) + end + def default(value = true) @action.default = !!value end |
