Skip to content

Commit

Permalink
fix debian pass_string
Browse files Browse the repository at this point in the history
Signed-off-by: Sean OMeara <someara@opscode.com>
  • Loading branch information
itsNikolay authored and Sean OMeara committed Sep 2, 2014
1 parent e813f06 commit 53dcd23
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libraries/helpers_debian.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ def pass_string
if new_resource.parsed_server_root_password.empty?
pass_string = ''
else
pass_string = '-p' + Shellwords.escape(new_resource.parsed_server_root_password)
pass_string = '-p ' + Shellwords.escape(new_resource.parsed_server_root_password)
end

pass_string = '-p' + ::File.open('/etc/.mysql_root').read.chomp if ::File.exist?('/etc/.mysql_root')
pass_string = '-p ' + ::File.open('/etc/.mysql_root').read.chomp if ::File.exist?('/etc/.mysql_root')
pass_string
end

Expand Down

3 comments on commit 53dcd23

@podwhitehawk
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's an regression. This code will fail on debian because of that space you added.
Please read mysql docs how to use passwords in cmdline: http://dev.mysql.com/doc/refman/5.0/en/command-line-options.html
Here is log:

[2014-09-07T07:25:47+00:00] ERROR: mysql_service[default] (mysql::server line 20) had an error: Mixlib::ShellOut::ShellCommandFailed: execute[install-grants] (/tmp/kitchen/cookbooks/mysql/libraries/provider_mysql_service_debian.rb line 79) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'       
---- Begin output of /usr/bin/mysql -u root -p p4ssw0rd < /etc/mysql_grants.sql ----       
STDOUT:        
STDERR: Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)       
       ---- End output of /usr/bin/mysql -u root -p p4ssw0rd < /etc/mysql_grants.sql ----
>>>>>> Converge failed on instance <test-debian-76-i386>.

As you can see using "/usr/bin/mysql -u root -p p4ssw0rd" with space bettween "-p" and password is a bad idea.

@gsreynolds
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just bit me. The added space is a regression and causes the same error for me.

@someara
Copy link
Contributor

@someara someara commented on 53dcd23 Sep 8, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted and shipped as v5.5.2

Please sign in to comment.