diff --git a/lib/puppet/application/configurer.rb b/lib/puppet/application/secret_agent.rb similarity index 74% rename from lib/puppet/application/configurer.rb rename to lib/puppet/application/secret_agent.rb index 6e86cd2d4..d704d14b2 100644 --- a/lib/puppet/application/configurer.rb +++ b/lib/puppet/application/secret_agent.rb @@ -1,23 +1,23 @@ require 'puppet/application' require 'puppet/face' -class Puppet::Application::Configurer < Puppet::Application +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[:configurer, '0.0.1'].synchronize(Puppet[:certname]) + 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/secret_agent.rb similarity index 87% rename from lib/puppet/face/configurer.rb rename to lib/puppet/face/secret_agent.rb index 74dfb854e..e2714122d 100644 --- a/lib/puppet/face/configurer.rb +++ b/lib/puppet/face/secret_agent.rb @@ -1,12 +1,12 @@ require 'puppet/face' -Puppet::Face.define(:configurer, '0.0.1') do +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/secret_agent_spec.rb similarity index 87% rename from spec/unit/application/configurer_spec.rb rename to spec/unit/application/secret_agent_spec.rb index 791a367ea..eba936447 100755 --- a/spec/unit/application/configurer_spec.rb +++ b/spec/unit/application/secret_agent_spec.rb @@ -1,32 +1,32 @@ #!/usr/bin/env rspec require 'spec_helper' -require 'puppet/application/configurer' +require 'puppet/application/secret_agent' require 'puppet/indirector/catalog/rest' require 'puppet/indirector/report/rest' require 'tempfile' -describe "Puppet::Application::Configurer" do +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::Configurer.new.run + 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/secret_agent_spec.rb similarity index 85% rename from spec/unit/face/configurer_spec.rb rename to spec/unit/face/secret_agent_spec.rb index 56b45031f..9117ad44d 100755 --- a/spec/unit/face/configurer_spec.rb +++ b/spec/unit/face/secret_agent_spec.rb @@ -1,25 +1,23 @@ #!/usr/bin/env rspec require 'spec_helper' require 'puppet/indirector/catalog/rest' require 'tempfile' -describe Puppet::Face[:configurer, '0.0.1'] do +describe Puppet::Face[:secret_agent, '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