Andrew Bogott has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/302834

Change subject: WIP:  Aggregate instance root passwords on Labs puppet master
......................................................................

WIP:  Aggregate instance root passwords on Labs puppet master

Change-Id: I93e2d40c362892fa5ec331ffc4fef2dab95d66bc
---
A modules/puppetmaster/lib/puppet/reports/instancepasswords.rb
1 file changed, 25 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/34/302834/1

diff --git a/modules/puppetmaster/lib/puppet/reports/instancepasswords.rb 
b/modules/puppetmaster/lib/puppet/reports/instancepasswords.rb
new file mode 100644
index 0000000..95c9859
--- /dev/null
+++ b/modules/puppetmaster/lib/puppet/reports/instancepasswords.rb
@@ -0,0 +1,25 @@
+# Puppet Success reporter
+# 
+#  Updates labs instance metadata with the status of the last puppet run,
+#   generally 'changed' or 'failed'
+require 'puppet'
+require 'yaml'
+require 'erb'
+require 'open3'
+require 'time'
+
+Puppet::Reports.register_report(:labsstatus) do
+    desc 'Log instance root passwords as they are created'
+
+    def process
+        #system("echo trying this >> /var/log/labsstatus.log")
+        self.logs.each do |logline|
+            if logline.message =~ /'rootpass: (.*)'/
+                rootpass = $1
+            end
+        end
+        if (!root.empty?)
+            system("echo ${fqdn}: ${rootpass} >> 
/var/run/puppet/labspasswords")
+        end
+    end
+end

-- 
To view, visit https://gerrit.wikimedia.org/r/302834
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I93e2d40c362892fa5ec331ffc4fef2dab95d66bc
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Andrew Bogott <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to