diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-05-03 14:36:13 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-05-03 14:54:38 -0700 |
| commit | 5120a95830183fdb30fc178452bfc3e6f44605b7 (patch) | |
| tree | b285f8ae0a1c7359632e81f5b10655bb64145f36 | |
| parent | bb889bf287f702e822d384f74af52fe2604ca37f (diff) | |
(#7276) Better reporting from the plugin download action.
Instead of just returning vague values, return useful information when
rendering for a human being.
Based on work by Luke Kaines <luke@puppetlabs.com> in
https://github.com/lak/puppet/commit/a61cc770ca9b2cad744b5b21b9776a834d6ca895
Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| -rw-r--r-- | lib/puppet/face/plugin.rb | 12 | ||||
| -rwxr-xr-x | spec/unit/face/plugin_spec.rb | 10 |
2 files changed, 22 insertions, 0 deletions
diff --git a/lib/puppet/face/plugin.rb b/lib/puppet/face/plugin.rb index 19060942a..4b45ed3a1 100644 --- a/lib/puppet/face/plugin.rb +++ b/lib/puppet/face/plugin.rb @@ -7,6 +7,10 @@ Puppet::Face.define(:plugin, '0.0.1') do action :download do summary "Download plugins from the configured master" + returns <<-EOT + An array containing the files actually downloaded. + This will be empty array when everything was in sync. + EOT when_invoked do |options| require 'puppet/configurer/downloader' @@ -15,5 +19,13 @@ Puppet::Face.define(:plugin, '0.0.1') do Puppet[:pluginsource], Puppet[:pluginsignore]).evaluate end + + when_rendering :for_humans do |value| + if value.empty? then + "No plugins downloaded." + else + "Downloaded these plugins: #{value.join(', ')}" + end + end end end diff --git a/spec/unit/face/plugin_spec.rb b/spec/unit/face/plugin_spec.rb new file mode 100755 index 000000000..383aaa3d3 --- /dev/null +++ b/spec/unit/face/plugin_spec.rb @@ -0,0 +1,10 @@ +#!/usr/bin/env rspec +require 'spec_helper' +require 'puppet/face' + +describe Puppet::Face[:plugin, '0.0.1'] do + [:download].each do |action| + it { should be_action action } + it { should respond_to action } + end +end |
