Puppet: System Administration Automated

Support

Ticket #885 (closed defect: fixed)

Opened 10 months ago

Last modified 10 months ago

puppetmaster "stored configs"-config lacks of possibility to set dbsocket

Reported by: immerda Assigned to: community
Priority: normal Milestone: misspiggy
Component: library Version: 0.23.2
Severity: normal Keywords: configstore, mysql, socket
Cc: Triage Stage: Needs more info
Attached Patches: Code Complexity: Trivial

Description

If storing configs in a mysql database and you're mysql socket location is in a different path than /tmp/mysql.sock puppetmastered will fail to start with a configstored-configured. The following two patches enables the possiblity to set the socket within the config:

--- configuration.rb_old     2007-11-01 17:40:06.000000000 +0100
+++ configuration.rb 2007-11-01 17:42:06.000000000 +0100
@@ -512,6 +512,8 @@
             used when networked databases are used."],
         :dbpassword => [ "puppet", "The database password for Client caching. Only
             used when networked databases are used."],
+        :dbsocket => [ "/tmp/mysql.sock", "The database socket location. Only used when networked
+            databases are used."],
         :railslog => {:default => "$logdir/rails.log",
             :mode => 0600,
             :owner => "$user",

--- rails.rb_old     2007-11-01 17:34:15.000000000 +0100
+++ rails.rb 2007-11-01 17:43:48.000000000 +0100
@@ -45,6 +45,7 @@
             args[:username] = Puppet[:dbuser]
             args[:password] = Puppet[:dbpassword]
             args[:database] = Puppet[:dbname]
+            args[:socket] = Puppet[:dbsocket]
         else
             raise ArgumentError, "Invalid db adapter %s" % Puppet[:dbadapter]
         end

Tested and used on a gentoo system with puppet 0.23.2

Change History

11/19/07 21:14:43 changed by tim

  • complexity changed from Unknown to Trivial.
  • stage changed from Unreviewed to Ready for checkin.
  • milestone set to misspiggy.

Easy enough patch, should simply be included, although tests are probably worth your time too :)

11/19/07 23:43:43 changed by luke

  • stage changed from Ready for checkin to Needs more info.

Are you sure this won't break cases where people are using non-local mysql databases? That is, will mysql always try to use the socket, even when the db isn't local, or will it do some magic and use the socket if the host is local or the server name if it's not?

11/20/07 00:34:46 changed by immerda

good question if it won't break. however other question: where would you specifiy a custom mysql port? maybe this should be added as well.

We had found out that the rails was complaining that it couldn't find the socket (which was afair /tmp/mysql.sock) however we have a different one and the learned that rails is going through all possible socket locations it knows in ${rails}/lib/rails_generator/generators/applications/app/app_generator.rb and that if we define one it will use this one. so we patched puppet to provide a socket value and it worked. however maybe it would be still better to give an empty socket value with it if noone is specified. so maybe it would be better to add this:

args[:socket] = Puppet[:dbsocket] unless Puppet[:dbsocket].empty? 

than always enforce to set the socket. so if someone don't specify it would still use the old way and let rails looking for it (if needed)

11/23/07 23:16:06 changed by luke

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in [6d74ddd40a33e54c8007e3a256270e76e56517a0].

11/24/07 14:43:10 changed by immerda

in my opinion line 48 is now wrong:

args[:args]     = Puppet[:dbsocket] unless Puppet[:dbsocket] == "" 

shouldn't it be:

args[:socket]     = Puppet[:dbsocket] unless Puppet[:dbsocket] == "" 

??!!

11/24/07 20:55:55 changed by luke

Yes; danp is working up a fix to this, along with tests for the whole init method.