[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5
Daniel Pittman
daniel at puppetlabs.com
Tue May 10 08:17:47 UTC 2011
The following commit has been merged in the experimental branch:
commit 3c22e770625f3cc788b0d138c8101e259a534736
Merge: 681edda370ec3d33aca0ca61864ec4352cafe567 ff08ba2abc8a59caa2bae0cde0a84ded99337e1c
Author: Daniel Pittman <daniel at puppetlabs.com>
Date: Thu Apr 21 16:33:59 2011 -0700
Merge remote-tracking branch 'remotes/lak/tickets/next/7118-summaries_for_all_faces' into 2.7.x
Fix conflicts due to version drift in:
lib/puppet/face/certificate.rb
lib/puppet/face/facts.rb
lib/puppet/face/node.rb
lib/puppet/face/secret_agent.rb
spec/lib/puppet/face/basetest.rb
spec/unit/face/help_spec.rb
Reviewed-By: Markus Roberts <markus at puppetlabs.com>
diff --combined lib/puppet/face/certificate.rb
index 4c2950f,5f410fa..9ee83d0
--- a/lib/puppet/face/certificate.rb
+++ b/lib/puppet/face/certificate.rb
@@@ -2,16 -2,26 +2,18 @@@ require 'puppet/face/indirector
require 'puppet/ssl/host'
Puppet::Face::Indirector.define(:certificate, '0.0.1') do
- summary "Manage certificates, including signing and revoking them."
-
- # REVISIT: This should use a pre-invoke hook to run the common code that
- # needs to happen before we invoke any action; that would be much nicer than
- # the "please repeat yourself" stuff found in here right now.
- #
- # option "--ca-location LOCATION" do
- # type [:whatever, :location, :symbols]
- # hook :before do |value|
- # Puppet::SSL::Host.ca_location = value
- # end
- # end
- #
- # ...but should I pass the arguments as well?
- # --daniel 2011-04-05
- option "--ca-location LOCATION"
++ summary "provide access to the CA for certificate management"
++
+ option "--ca-location LOCATION" do
+ before_action do |action, args, options|
+ Puppet::SSL::Host.ca_location = options[:ca_location].to_sym
+ end
+ end
action :generate do
+ summary "Generate a new Certificate Signing Request for HOST"
+
when_invoked do |name, options|
- Puppet::SSL::Host.ca_location = options[:ca_location].to_sym
host = Puppet::SSL::Host.new(name)
host.generate_certificate_request
host.certificate_request.class.indirection.save(host.certificate_request)
@@@ -19,9 -29,8 +21,9 @@@
end
action :list do
+ summary "List all Certificate Signing Requests"
+
when_invoked do |options|
- Puppet::SSL::Host.ca_location = options[:ca_location].to_sym
Puppet::SSL::Host.indirection.search("*", {
:for => :certificate_request,
}).map { |h| h.inspect }
@@@ -29,9 -38,8 +31,9 @@@
end
action :sign do
+ summary "Sign a Certificate Signing Request for HOST"
+
when_invoked do |name, options|
- Puppet::SSL::Host.ca_location = options[:ca_location].to_sym
host = Puppet::SSL::Host.new(name)
host.desired_state = 'signed'
Puppet::SSL::Host.indirection.save(host)
diff --combined lib/puppet/face/facts.rb
index 04eab93,caa3cfd..a5a279d
--- a/lib/puppet/face/facts.rb
+++ b/lib/puppet/face/facts.rb
@@@ -2,10 -2,12 +2,12 @@@ require 'puppet/face/indirector
require 'puppet/node/facts'
Puppet::Face::Indirector.define(:facts, '0.0.1') do
+ summary "Retrieve, store, and view facts."
+
- set_default_format :yaml
-
# Upload our facts to the server
action(:upload) do
+ render_as :yaml
+
when_invoked do |options|
Puppet::Node::Facts.indirection.terminus_class = :facter
facts = Puppet::Node::Facts.indirection.find(Puppet[:certname])
diff --combined lib/puppet/face/node.rb
index 12336df,b7ffaf3..7032deb
--- a/lib/puppet/face/node.rb
+++ b/lib/puppet/face/node.rb
@@@ -1,3 -1,10 +1,7 @@@
require 'puppet/face/indirector'
-
Puppet::Face::Indirector.define(:node, '0.0.1') do
+ summary "View and manage nodes"
+
+ @longdocs = "It defaults to using whatever your node
+ terminus is set as."
-
- set_default_format :yaml
end
diff --combined lib/puppet/face/secret_agent.rb
index e271412,0000000..a911467
mode 100644,000000..100644
--- a/lib/puppet/face/secret_agent.rb
+++ b/lib/puppet/face/secret_agent.rb
@@@ -1,12 -1,0 +1,14 @@@
+require 'puppet/face'
+
+Puppet::Face.define(:secret_agent, '0.0.1') do
++ summary "Provides agent-like behavior, with no plugin downloading or reporting."
++
+ 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 --combined spec/unit/application/indirection_base_spec.rb
index 5774038,dedadb4..0d7554a
--- a/spec/unit/application/indirection_base_spec.rb
+++ b/spec/unit/application/indirection_base_spec.rb
@@@ -9,6 -9,7 +9,7 @@@ class Puppet::Application::TestIndirect
end
face = Puppet::Face::Indirector.define(:testindirection, '0.0.1') do
+ summary "fake summary"
end
# REVISIT: This horror is required because we don't allow anything to be
# :current except for if it lives on, and is loaded from, disk. --daniel 2011-03-29
@@@ -23,11 -24,12 +24,11 @@@ describe Puppet::Application::Indirecti
it "should accept a terminus command line option" do
# It would be nice not to have to stub this, but whatever... writing an
# entire indirection stack would cause us more grief. --daniel 2011-03-31
- terminus = mock("test indirection terminus")
+ terminus = stub_everything("test indirection terminus")
Puppet::Indirector::Indirection.expects(:instance).
- with(:testindirection).twice.returns()
+ with(:testindirection).returns(terminus)
- subject.command_line.
- instance_variable_set('@args', %w{--terminus foo save})
+ subject.command_line.instance_variable_set('@args', %w{--terminus foo save})
# Not a very nice thing. :(
$stderr.stubs(:puts)
diff --combined spec/unit/face/help_spec.rb
index faa5f96,33e13a2..f28c4f2
--- a/spec/unit/face/help_spec.rb
+++ b/spec/unit/face/help_spec.rb
@@@ -7,7 -7,7 +7,7 @@@ describe Puppet::Face[:help, '0.0.1'] d
end
it "should have a default action of help" do
- pending "REVISIT: we don't support default actions yet"
+ subject.get_action('help').should be_default
end
it "should accept a call with no arguments" do
@@@ -46,6 -46,12 +46,12 @@@
context "when listing subcommands" do
subject { Puppet::Face[:help, :current].help }
+ RSpec::Matchers.define :have_a_summary do
+ match do |instance|
+ instance.summary.is_a?(String)
+ end
+ end
+
# Check a precondition for the next block; if this fails you have
# something odd in your set of face, and we skip testing things that
# matter. --daniel 2011-04-10
@@@ -55,23 -61,24 +61,29 @@@
end
end
- Puppet::Face.faces.each do |name|
- face = Puppet::Face[name, :current]
- summary = face.summary
+ it "should list all faces" do
+ Puppet::Face.faces.each do |name|
+ face = Puppet::Face[name, :current]
+ summary = face.summary
- it "should list the '#{name}' face in the general help" do
- should =~ %r{ #{name} }
+ subject.should =~ %r{ #{name} }
+ summary and subject.should =~ %r{ #{name} +#{summary}}
end
+ end
++ Puppet::Face.faces.each do |name|
+ it "should have a summary for #{name}" do
- face.should have_a_summary
++ Puppet::Face[name, :current].should have_a_summary
+ end
+ end
+
- Puppet::Face[:help, :current].legacy_applications.each do |appname|
- it { should =~ %r{ #{appname} } }
+ it "should list all legacy applications" do
+ Puppet::Face[:help, :current].legacy_applications.each do |appname|
+ subject.should =~ %r{ #{appname} }
- summary = Puppet::Face[:help, :current].horribly_extract_summary_from(appname)
- summary and it { should =~ %r{ #{summary}\b} }
+ summary = Puppet::Face[:help, :current].horribly_extract_summary_from(appname)
+ summary and subject.should =~ %r{ #{summary}\b}
+ end
end
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list