Skip to content

Commit

Permalink
Fixing bug where unprivileged users cannot connect over a local socke…
Browse files Browse the repository at this point in the history
…t. Adding integration test.

Fixing bug in mysql_grants_cmd generation
  • Loading branch information
Sean OMeara committed Nov 5, 2013
1 parent a8b6a63 commit 1b85117
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion libraries/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def assign_root_password_cmd
def install_grants_cmd
str = '/usr/bin/mysql'
str << ' -u root '
node['mysql']['server_root_password'].empty? ? str << ' < /etc/mysql_grants.sql' : str << " -p#{node['mysql']['server_root_password']}"
node['mysql']['server_root_password'].empty? ? str << ' < /etc/mysql_grants.sql' : str << " -p#{node['mysql']['server_root_password']} < /etc/mysql_grants.sql"
end
end
end
Expand Down
4 changes: 1 addition & 3 deletions recipes/_server_debian.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@
end

node['mysql']['server']['directories'].each do |key, value|
log "DEBUG: #{value}"
directory value do
owner 'mysql'
group 'mysql'
mode '0770'
mode '0775'
action :create
recursive true
end
end

Expand Down
2 changes: 1 addition & 1 deletion recipes/_server_rhel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
directory value do
owner 'mysql'
group 'mysql'
mode '0775'
action :create
recursive true

This comment has been minimized.

Copy link
@et304383

et304383 Nov 6, 2013

This breaks installation due to parent directory missing. Filed bug:
https://tickets.opscode.com/browse/COOK-3952

end
end

Expand Down
4 changes: 4 additions & 0 deletions test/cookbooks/mysql_test/recipes/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@
EOF}
not_if "echo 'SELECT count(name) FROM tv_chef' | mysql #{mysql_conn_args} --skip-column-names #{node['mysql_test']['database']} | grep '^3$'"
end

user "unprivileged" do
action :create
end
5 changes: 5 additions & 0 deletions test/integration/server/serverspec/localhost/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@
expect(port 3306).to be_listening
end
end


describe command("su -s /bin/sh -c \"mysql --protocol socket -uroot -pilikerandompasswords -e 'show databases;'\" unprivileged") do
it { should return_exit_status 0 }
end

0 comments on commit 1b85117

Please sign in to comment.