diff options
| author | Luke Kanies <luke@puppetlabs.com> | 2011-02-08 21:27:24 -0800 |
|---|---|---|
| committer | Luke Kanies <luke@puppetlabs.com> | 2011-02-08 21:27:24 -0800 |
| commit | 3ffb9abd3a500f1fb3246e04f737b79d232c082d (patch) | |
| tree | 2d76baf7a8043c7ff6cc7d746798de8470108f13 /lib/puppet/application/data_baseclass.rb | |
| parent | 9cb594f898496e36c76f0717b73897f07e8aca5a (diff) | |
| download | puppet-3ffb9abd3a500f1fb3246e04f737b79d232c082d.tar.gz puppet-3ffb9abd3a500f1fb3246e04f737b79d232c082d.tar.xz puppet-3ffb9abd3a500f1fb3246e04f737b79d232c082d.zip | |
Moving 'format' support to the application
This allows easier use of the Interfaces in ruby.
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
Diffstat (limited to 'lib/puppet/application/data_baseclass.rb')
| -rw-r--r-- | lib/puppet/application/data_baseclass.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/puppet/application/data_baseclass.rb b/lib/puppet/application/data_baseclass.rb index 3f498f56f..e67b1b368 100644 --- a/lib/puppet/application/data_baseclass.rb +++ b/lib/puppet/application/data_baseclass.rb @@ -18,7 +18,7 @@ class Puppet::Application::DataBaseclass < Puppet::Application end option("--format FORMAT") do |arg| - @format = arg + @format = arg.to_sym end # XXX this doesn't work, I think @@ -46,11 +46,11 @@ class Puppet::Application::DataBaseclass < Puppet::Application def main # Call the method associated with the provided action (e.g., 'find'). - interface.send(verb, name, *arguments) + result = interface.send(verb, name, *arguments) + puts result.render(format) end def setup - @format ||= :yaml Puppet::Util::Log.newdestination :console @@ -60,7 +60,7 @@ class Puppet::Application::DataBaseclass < Puppet::Application @type = self.class.name.to_s.sub(/.+:/, '').downcase.to_sym @interface = Puppet::Interface.interface(@type).new - @interface.format = format if format + @format ||= @interface.class.default_format || :pson validate |
