summaryrefslogtreecommitdiffstats
path: root/spec/unit/application
diff options
context:
space:
mode:
authorLuke Kanies <luke@reductivelabs.com>2010-01-18 17:26:06 -0800
committerLuke Kanies <luke@reductivelabs.com>2010-01-18 17:26:06 -0800
commitcdcbdc78bc399a60afaf36b6267688e72081fb6e (patch)
tree1a2e3bf8bbe06631acdcf7d0f6acc0021dfaa048 /spec/unit/application
parent67216aa5637a0e134750103abb74b5c2e3db3eb6 (diff)
Fixing #2914 - pre/post hooks now work for transactions
This was built to be used with etckeeper to version control files in /etc, but can be used for essentially anything. This patch was built to be added to 0.25.4, so it's a least-modify approach. A better approach would be to refactor application/puppet.rb just a bit so it uses Configurer more. This is a simple patch - it just defines 'prerun_command' and 'postrun_command' settings, and runs the appropriate command around each transaction if they're set. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
Diffstat (limited to 'spec/unit/application')
-rwxr-xr-xspec/unit/application/puppet.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/unit/application/puppet.rb b/spec/unit/application/puppet.rb
index 7703bac08..61dcf9061 100755
--- a/spec/unit/application/puppet.rb
+++ b/spec/unit/application/puppet.rb
@@ -173,6 +173,9 @@ describe "Puppet" do
describe "the main command" do
before :each do
Puppet.stubs(:[])
+ Puppet.settings.stubs(:use)
+ Puppet.stubs(:[]).with(:prerun_command).returns ""
+ Puppet.stubs(:[]).with(:postrun_command).returns ""
Puppet.stubs(:[]).with(:trace).returns(true)
@puppet.options.stubs(:[])
@@ -277,6 +280,16 @@ describe "Puppet" do
@puppet.main
end
+ it "should call the prerun and postrun commands on a Configurer instance" do
+ configurer = stub 'configurer'
+
+ Puppet::Configurer.expects(:new).returns configurer
+ configurer.expects(:execute_prerun_command)
+ configurer.expects(:execute_postrun_command)
+
+ @puppet.main
+ end
+
it "should apply the catalog" do
@catalog.expects(:apply)