Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check_puppet: Add "reason" information if puppet is disabled #360

Open
sottolski opened this issue Feb 15, 2021 · 0 comments
Open

check_puppet: Add "reason" information if puppet is disabled #360

sottolski opened this issue Feb 15, 2021 · 0 comments

Comments

@sottolski
Copy link

I think it's useful to see why puppet has been disbled right away, so I hacked a little patch. I'm not into ruby, so it's probably not the correct style, but it works:

@@ -28,6 +28,7 @@
 $LOAD_PATH.unshift File.expand_path('/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/', __FILE__)
 # end fix to make it run on jessie
 
+require "json"
 require "optparse"
 require "puppet"
 require "puppet/defaults"
@@ -227,10 +228,13 @@
             puts "checking puppet is enabled"
         end
         if FileTest.exist?("#{OPTIONS[:lockfile]}")
+            lfile = File.open("#{OPTIONS[:lockfile]}", 'r')
+            ldata = JSON.load lfile
+            lreason = ldata["disabled_message"]
             # This used to be the case pre 2.6, not supporting that any more
             # if File.zero?("#{OPTIONS[:lockfile]}")
                 @enabled_status = "CRITICAL"
-                @enabled_msg = "PUPPET RUNS DISABLED"
+                @enabled_msg = "PUPPET RUNS DISABLED, reason: '#{lreason}'"
             # else
             #    @enabled_status = "OK"
             #    @enabled_msg = "puppet runs enabled (currently in progress)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant