[Camps-users] Bug: mkcamp cannot import a new MySQL-based camp's db_source_scripts due to an authentication error. [kludgy patch included]

Adam Vollrath adam at endpoint.com
Tue Feb 17 17:53:20 UTC 2009


My enviroment:
[deleteme at spreetest3 camps]$ mysql -V
mysql  Ver 14.12 Distrib 5.0.45, for redhat-linux-gnu (x86_64) using  
readline 5.0
[root at spreetest3 camp]# cat /etc/redhat-release
CentOS release 5.2 (Final)

To reproduce:
Create a project_type that uses MySQL as its database (i.e.  
db_type:mysql in local-config.)  Run mkcamp (as a user other than  
root) to create a camp of this camp_type.

Present behavior:
Processing script 'mysql/blank.spree.sql':
mysql --socket=/home/deleteme/camp19/mysql/tmp/mysql.19.sock < /home/ 
camp/spree/mysql/blank.spree.sql
ERROR 1045 (28000): Access denied for user  
'deleteme'@'localhost' (using password: NO)
Error importing data

Desired behavior:
mkcamp should connect to the camp instance database as a valid user  
when importing the project's db_source_scripts.

The following patch will implement the desired behavior for mkcamp by  
connecting as root (adding '-u root' to the shell command, as the  
roles import function presently does).  However, I don't feel this is  
an appropriate permanent solution.  Perhaps the _import_db_cmd_mysql()  
or camp_mysql_options() functions should check if they are doing a new  
camp import?  Perhaps the import process should be modified to connect  
as the camp project user instead of root as soon as that user becomes  
available?

diff --git a/lib/Camp/Master.pm b/lib/Camp/Master.pm
index deb25eb..16e8db0 100644
--- a/lib/Camp/Master.pm
+++ b/lib/Camp/Master.pm
@@ -2338,7 +2338,7 @@ sub _import_db_cmd_pg {

  sub _import_db_cmd_mysql {
      my ($script, $conf) = @_;
-    return 'mysql ' . camp_mysql_options() . " < $script";
+    return 'mysql ' . camp_mysql_options( user => 'root' ) . " <  
$script";
  }

  sub prepare_database {



More information about the Camps-users mailing list