summaryrefslogtreecommitdiffstats
path: root/lib/puppet/face/plugin.rb
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-05-12 14:31:01 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-05-12 14:31:01 -0700
commit82fb02ce27c95d8326335a8d52a9ab7e676fe8d3 (patch)
tree6706dc7afa05bf4bbffb2ab7e616717fb6af0c86 /lib/puppet/face/plugin.rb
parent7f9c9e1089c4bc36d52fcdd9751de559c658bf8d (diff)
parent704623cb95aacb0544609620994dc36f61a4b463 (diff)
downloadpuppet-82fb02ce27c95d8326335a8d52a9ab7e676fe8d3.tar.gz
puppet-82fb02ce27c95d8326335a8d52a9ab7e676fe8d3.tar.xz
puppet-82fb02ce27c95d8326335a8d52a9ab7e676fe8d3.zip
Merge branch 'next'
Diffstat (limited to 'lib/puppet/face/plugin.rb')
-rw-r--r--lib/puppet/face/plugin.rb47
1 files changed, 47 insertions, 0 deletions
diff --git a/lib/puppet/face/plugin.rb b/lib/puppet/face/plugin.rb
new file mode 100644
index 000000000..969d42389
--- /dev/null
+++ b/lib/puppet/face/plugin.rb
@@ -0,0 +1,47 @@
+require 'puppet/face'
+Puppet::Face.define(:plugin, '0.0.1') do
+ copyright "Puppet Labs", 2011
+ license "Apache 2 license; see COPYING"
+
+ summary "Interact with the Puppet plugin system"
+ description <<-EOT
+ This face provides network access to the puppet master's store of
+ plugins. It is intended for use in other faces, rather than for direct
+ command line access.
+ EOT
+ notes <<-EOT
+ The puppet master can serve Ruby code collected from the lib directories
+ of its modules. These plugins can be used on agent nodes to extend
+ Facter and implement custom types and providers.
+ EOT
+
+ action :download do
+ summary "Download plugins from the configured master"
+ returns <<-EOT
+ An array containing the files actually downloaded. If all files
+ were in sync, this array will be empty.
+ EOT
+ notes "This action modifies files on disk without returning any data."
+ examples <<-EOT
+ Retrieve plugins from the puppet master:
+
+ Puppet::Face[:plugin, '0.0.1'].download
+ EOT
+
+ when_invoked do |options|
+ require 'puppet/configurer/downloader'
+ Puppet::Configurer::Downloader.new("plugin",
+ Puppet[:plugindest],
+ Puppet[:pluginsource],
+ Puppet[:pluginsignore]).evaluate
+ end
+
+ when_rendering :console do |value|
+ if value.empty? then
+ "No plugins downloaded."
+ else
+ "Downloaded these plugins: #{value.join(', ')}"
+ end
+ end
+ end
+end