Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 puppet (2.7.12-1) unstable; urgency=low
 .
   * New upstream release
   * Fix disabled puppetmaster init script return code (Closes: #661927)
Author: Stig Sandbeck Mathisen <ssm@debian.org>
Bug-Debian: http://bugs.debian.org/661927

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- puppet-2.7.12.orig/Rakefile
+++ puppet-2.7.12/Rakefile
@@ -9,7 +9,7 @@ require 'rspec'
 require "rspec/core/rake_task"
 
 module Puppet
-    PUPPETVERSION = File.read('lib/puppet.rb')[/PUPPETVERSION *= *'(.*)'/,1] or fail "Couldn't find PUPPETVERSION"
+    PUPPETVERSION = File.read('/usr/lib/ruby/1.8/puppet.rb')[/PUPPETVERSION *= *'(.*)'/,1] or fail "Couldn't find PUPPETVERSION"
 end
 
 Dir['tasks/**/*.rake'].each { |t| load t }
--- puppet-2.7.12.orig/test/lib/puppettest/fakes.rb
+++ puppet-2.7.12/test/lib/puppettest/fakes.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.join(File.dirname(__FILE__), '../../../lib/puppet/util'))
+require '/usr/lib/ruby/1.8/puppet/util'
 
 module PuppetTest
   # A baseclass for the faketypes.
--- puppet-2.7.12.orig/lib/puppet/provider/service/init.rb
+++ puppet-2.7.12/lib/puppet/provider/service/init.rb
@@ -129,7 +129,15 @@ Puppet::Type.type(:service).provide :ini
   # we just return that; otherwise, we return false, which causes it to
   # fallback to other mechanisms.
   def statuscmd
-    (@resource[:hasstatus] == :true) && [initscript, :status]
+      if @resource[:hasstatus] == :true then 
+          # Workaround the fact that initctl status command doesn't return
+          # proper exit codes. Can be removed once LP: #552786 is fixed.
+          if File.symlink?(initscript) && File.readlink(initscript) == "/lib/init/upstart-job" then
+              ['sh', '-c', "LANG=C invoke-rc.d #{File::basename(initscript)} status | grep -q '^#{File::basename(initscript)}.*running'" ]
+          else
+              [initscript, :status ]
+          end
+      end
   end
 
 end
