From c7a0270b872f533c5ba6187b9202a23f9ae8ab23 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Thu, 21 Apr 2011 17:36:35 -0700 Subject: (#7121) Download plugins and upload reports in secret agent! This adds a plugin face, able to download plugins, and wires both that and the report face in to upload the result of the catalog run. This fills out the standard, boring agent behaviour and makes this a semi-credible replacement. Reviewed-By: Max Martin --- lib/puppet/face/plugin.rb | 16 ++++++++++++++++ lib/puppet/face/secret_agent.rb | 11 ++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 lib/puppet/face/plugin.rb (limited to 'lib') diff --git a/lib/puppet/face/plugin.rb b/lib/puppet/face/plugin.rb new file mode 100644 index 000000000..4d95bd93b --- /dev/null +++ b/lib/puppet/face/plugin.rb @@ -0,0 +1,16 @@ +require 'puppet/face' +Puppet::Face.define(:plugin, '0.0.1') do + summary "Interact with the Puppet plugin system" + + action :download do + summary "Download plugins from the configured master" + + when_invoked do |options| + require 'puppet/configurer/downloader' + Puppet::Configurer::Downloader.new("plugin", + Puppet[:plugindest], + Puppet[:pluginsource], + Puppet[:pluginsignore]).evaluate + end + end +end diff --git a/lib/puppet/face/secret_agent.rb b/lib/puppet/face/secret_agent.rb index a911467f8..af7ffb7b7 100644 --- a/lib/puppet/face/secret_agent.rb +++ b/lib/puppet/face/secret_agent.rb @@ -5,10 +5,15 @@ Puppet::Face.define(:secret_agent, '0.0.1') do action(:synchronize) do when_invoked do |certname, options| - facts = Puppet::Face[:facts, '0.0.1'].find(certname) + Puppet::Face[:plugin, '0.0.1'].download + + facts = Puppet::Face[:facts, '0.0.1'].find(certname) catalog = Puppet::Face[:catalog, '0.0.1'].download(certname, facts) - report = Puppet::Face[:catalog, '0.0.1'].apply(catalog) - report + report = Puppet::Face[:catalog, '0.0.1'].apply(catalog) + + Puppet::Face[:report, '0.0.1'].submit(report) + + return report end end end -- cgit