summaryrefslogtreecommitdiffstats
path: root/lib/puppet/interface
diff options
context:
space:
mode:
authorMax Martin <max@puppetlabs.com>2011-04-27 13:28:22 -0700
committerMax Martin <max@puppetlabs.com>2011-04-27 13:28:22 -0700
commit7f9c9e1089c4bc36d52fcdd9751de559c658bf8d (patch)
treed3f136373e6a10819975fa1ec0a931c1eb4afb37 /lib/puppet/interface
parenta80ff1ad0d25cc7cfa98cd6f425e6230787950fb (diff)
parent68c82d4d8b75ebd8f0ab61b37ba78cf5fbc52081 (diff)
downloadpuppet-7f9c9e1089c4bc36d52fcdd9751de559c658bf8d.tar.gz
puppet-7f9c9e1089c4bc36d52fcdd9751de559c658bf8d.tar.xz
puppet-7f9c9e1089c4bc36d52fcdd9751de559c658bf8d.zip
Merge branch 'next'
* next: (#7101) Fix template error messages in Ruby 1.8.5 (#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 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.rb5
-rw-r--r--lib/puppet/interface/action_builder.rb10
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