From 27e083151bfd1e167f810ceb38199ded3d8d8be5 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Thu, 21 Apr 2011 15:45:28 -0700 Subject: (#7181) Rename configurer face to secret_agent. This is a much more useful public name, especially given the code is aimed to eventually replace the agent entirely. Until then this is pleasant enough to talk about. Reviewed-By: Nick Lewis --- lib/puppet/application/configurer.rb | 23 --------------------- lib/puppet/application/secret_agent.rb | 23 +++++++++++++++++++++ lib/puppet/face/configurer.rb | 12 ----------- lib/puppet/face/secret_agent.rb | 12 +++++++++++ spec/unit/application/configurer_spec.rb | 32 ------------------------------ spec/unit/application/secret_agent_spec.rb | 32 ++++++++++++++++++++++++++++++ spec/unit/face/configurer_spec.rb | 25 ----------------------- spec/unit/face/secret_agent_spec.rb | 23 +++++++++++++++++++++ 8 files changed, 90 insertions(+), 92 deletions(-) delete mode 100644 lib/puppet/application/configurer.rb create mode 100644 lib/puppet/application/secret_agent.rb delete mode 100644 lib/puppet/face/configurer.rb create mode 100644 lib/puppet/face/secret_agent.rb delete mode 100755 spec/unit/application/configurer_spec.rb create mode 100755 spec/unit/application/secret_agent_spec.rb delete mode 100755 spec/unit/face/configurer_spec.rb create mode 100755 spec/unit/face/secret_agent_spec.rb diff --git a/lib/puppet/application/configurer.rb b/lib/puppet/application/configurer.rb deleted file mode 100644 index 6e86cd2d4..000000000 --- a/lib/puppet/application/configurer.rb +++ /dev/null @@ -1,23 +0,0 @@ -require 'puppet/application' -require 'puppet/face' - -class Puppet::Application::Configurer < Puppet::Application - should_parse_config - run_mode :agent - - option("--debug", "-d") - option("--verbose", "-v") - - def setup - if options[:debug] or options[:verbose] - Puppet::Util::Log.level = options[:debug] ? :debug : :info - end - - Puppet::Util::Log.newdestination(:console) - end - - def run_command - report = Puppet::Face[:configurer, '0.0.1'].synchronize(Puppet[:certname]) - Puppet::Face[:report, '0.0.1'].submit(report) - end -end diff --git a/lib/puppet/application/secret_agent.rb b/lib/puppet/application/secret_agent.rb new file mode 100644 index 000000000..d704d14b2 --- /dev/null +++ b/lib/puppet/application/secret_agent.rb @@ -0,0 +1,23 @@ +require 'puppet/application' +require 'puppet/face' + +class Puppet::Application::Secret_agent < Puppet::Application + should_parse_config + run_mode :agent + + option("--debug", "-d") + option("--verbose", "-v") + + def setup + if options[:debug] or options[:verbose] + Puppet::Util::Log.level = options[:debug] ? :debug : :info + end + + Puppet::Util::Log.newdestination(:console) + end + + def run_command + report = Puppet::Face[:secret_agent, '0.0.1'].synchronize(Puppet[:certname]) + Puppet::Face[:report, '0.0.1'].submit(report) + end +end diff --git a/lib/puppet/face/configurer.rb b/lib/puppet/face/configurer.rb deleted file mode 100644 index 74dfb854e..000000000 --- a/lib/puppet/face/configurer.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'puppet/face' - -Puppet::Face.define(:configurer, '0.0.1') do - action(:synchronize) do - when_invoked do |certname, options| - 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 - end - end -end diff --git a/lib/puppet/face/secret_agent.rb b/lib/puppet/face/secret_agent.rb new file mode 100644 index 000000000..e2714122d --- /dev/null +++ b/lib/puppet/face/secret_agent.rb @@ -0,0 +1,12 @@ +require 'puppet/face' + +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) + catalog = Puppet::Face[:catalog, '0.0.1'].download(certname, facts) + report = Puppet::Face[:catalog, '0.0.1'].apply(catalog) + report + end + end +end diff --git a/spec/unit/application/configurer_spec.rb b/spec/unit/application/configurer_spec.rb deleted file mode 100755 index 791a367ea..000000000 --- a/spec/unit/application/configurer_spec.rb +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env rspec -require 'spec_helper' -require 'puppet/application/configurer' -require 'puppet/indirector/catalog/rest' -require 'puppet/indirector/report/rest' -require 'tempfile' - -describe "Puppet::Application::Configurer" do - it "should retrieve and apply a catalog and submit a report" do - pending "REVISIT: 2.7 changes broke this, and we want the merge published" - - dirname = Dir.mktmpdir("puppetdir") - Puppet[:vardir] = dirname - Puppet[:confdir] = dirname - Puppet[:certname] = "foo" - @catalog = Puppet::Resource::Catalog.new - @file = Puppet::Resource.new(:file, File.join(dirname, "tmp_dir_resource"), :parameters => {:ensure => :present}) - @catalog.add_resource(@file) - - @report = Puppet::Transaction::Report.new("apply") - Puppet::Transaction::Report.stubs(:new).returns(@report) - - Puppet::Resource::Catalog::Rest.any_instance.stubs(:find).returns(@catalog) - @report.expects(:save) - - Puppet::Util::Log.stubs(:newdestination) - - Puppet::Application::Configurer.new.run - - @report.status.should == "changed" - end -end diff --git a/spec/unit/application/secret_agent_spec.rb b/spec/unit/application/secret_agent_spec.rb new file mode 100755 index 000000000..eba936447 --- /dev/null +++ b/spec/unit/application/secret_agent_spec.rb @@ -0,0 +1,32 @@ +#!/usr/bin/env rspec +require 'spec_helper' +require 'puppet/application/secret_agent' +require 'puppet/indirector/catalog/rest' +require 'puppet/indirector/report/rest' +require 'tempfile' + +describe "Puppet::Application::Secret_agent" do + it "should retrieve and apply a catalog and submit a report" do + pending "REVISIT: 2.7 changes broke this, and we want the merge published" + + dirname = Dir.mktmpdir("puppetdir") + Puppet[:vardir] = dirname + Puppet[:confdir] = dirname + Puppet[:certname] = "foo" + @catalog = Puppet::Resource::Catalog.new + @file = Puppet::Resource.new(:file, File.join(dirname, "tmp_dir_resource"), :parameters => {:ensure => :present}) + @catalog.add_resource(@file) + + @report = Puppet::Transaction::Report.new("apply") + Puppet::Transaction::Report.stubs(:new).returns(@report) + + Puppet::Resource::Catalog::Rest.any_instance.stubs(:find).returns(@catalog) + @report.expects(:save) + + Puppet::Util::Log.stubs(:newdestination) + + Puppet::Application::Secret_agent.new.run + + @report.status.should == "changed" + end +end diff --git a/spec/unit/face/configurer_spec.rb b/spec/unit/face/configurer_spec.rb deleted file mode 100755 index 56b45031f..000000000 --- a/spec/unit/face/configurer_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env rspec -require 'spec_helper' -require 'puppet/indirector/catalog/rest' -require 'tempfile' - -describe Puppet::Face[:configurer, '0.0.1'] do - describe "#synchronize" do - it "should retrieve and apply a catalog and return a report" do - pending "REVISIT: 2.7 changes broke this, and we want the merge published" - - dirname = Dir.mktmpdir("puppetdir") - Puppet[:vardir] = dirname - Puppet[:confdir] = dirname - @catalog = Puppet::Resource::Catalog.new - @file = Puppet::Resource.new(:file, File.join(dirname, "tmp_dir_resource"), :parameters => {:ensure => :present}) - @catalog.add_resource(@file) - Puppet::Resource::Catalog::Rest.any_instance.stubs(:find).returns(@catalog) - - report = subject.synchronize("foo") - - report.kind.should == "apply" - report.status.should == "changed" - end - end -end diff --git a/spec/unit/face/secret_agent_spec.rb b/spec/unit/face/secret_agent_spec.rb new file mode 100755 index 000000000..9117ad44d --- /dev/null +++ b/spec/unit/face/secret_agent_spec.rb @@ -0,0 +1,23 @@ +#!/usr/bin/env rspec +require 'spec_helper' +require 'puppet/indirector/catalog/rest' +require 'tempfile' + +describe Puppet::Face[:secret_agent, '0.0.1'] do + describe "#synchronize" do + it "should retrieve and apply a catalog and return a report" do + dirname = Dir.mktmpdir("puppetdir") + Puppet[:vardir] = dirname + Puppet[:confdir] = dirname + @catalog = Puppet::Resource::Catalog.new + @file = Puppet::Resource.new(:file, File.join(dirname, "tmp_dir_resource"), :parameters => {:ensure => :present}) + @catalog.add_resource(@file) + Puppet::Resource::Catalog::Rest.any_instance.stubs(:find).returns(@catalog) + + report = subject.synchronize("foo") + + report.kind.should == "apply" + report.status.should == "changed" + end + end +end -- cgit