Alexandros Kosiaris has uploaded a new change for review.

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

Change subject: puppetmaster: wrap servermon report handler in transactions
......................................................................

puppetmaster: wrap servermon report handler in transactions

Obviously I should have done this in the first place.

Change-Id: Ie9b0998b6b98845c0b5d5cde8d0b08a80d488909
---
M modules/puppetmaster/lib/puppet/reports/servermon.rb
1 file changed, 2 insertions(+), 0 deletions(-)


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

diff --git a/modules/puppetmaster/lib/puppet/reports/servermon.rb 
b/modules/puppetmaster/lib/puppet/reports/servermon.rb
index cb30c39..806a574 100644
--- a/modules/puppetmaster/lib/puppet/reports/servermon.rb
+++ b/modules/puppetmaster/lib/puppet/reports/servermon.rb
@@ -29,6 +29,7 @@
         log_level = Puppet[:log_level]
         begin
             con = Mysql.new dbserver, dbuser, dbpassword, 'puppet'
+            con.query('BEGIN')
             # First we try to update the host, if it fails, insert it
             update_host = "UPDATE hosts SET \
             environment = '#{self.environment}', \
@@ -104,6 +105,7 @@
                     # rubocop:enable Style/Next
                 end
             end
+            con.query('COMMIT')
         rescue Mysql::Error => e
             puts "Mysql error: #{e.errno}, #{e.error}"
             puts e.errno

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie9b0998b6b98845c0b5d5cde8d0b08a80d488909
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Alexandros Kosiaris <akosia...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to