sous-chefs / mysql

Development repository for the mysql cookbook
https://supermarket.chef.io/cookbooks/mysql
Apache License 2.0
337 stars 691 forks source link

Fix initial password issues in MySQL 5.7+ #626

Closed gsomoza closed 3 years ago

gsomoza commented 4 years ago

This is exactly the same PR as #584 (all credit to @tealice), but without the MySQL 8.0 changes. Hopefully that makes it easier to merge?

Check List

damacus commented 4 years ago

This is awesome, thanks for this. Are you able to make the chef exec delivery local all test work please, and we'll ship this.

gsomoza commented 4 years ago

I'm on it, will ping you here once they work. Looks like we're inheriting broken tests from master though.

damacus commented 4 years ago

@gsomoza do you fancy fixing delivery in another PR, which we can rebase this PR on at a later date? (cheeky ask we know, but we're topped out on shipping some cookbook maintenance tools right now)

gsomoza commented 4 years ago

Looks like the delivery tests you mentioned worked out of the box – no issues there. The one that was failing was kitchen test due to an indentation issue in kitchen.yml. Do you want me to remove that into a different PR?

gsomoza commented 4 years ago

Alright, TBH I think all looks good - kitchen test also worked:

Profile: tests from {:path=>"/Users/gabriel/code/chef-cookbook-mysql/test/integration/smoke57"} (tests from {:path=>".Users.gabriel.code.chef-cookbook-mysql.test.integration.smoke57"})
Version: (not specified)
Target:  ssh://vagrant@127.0.0.1:2200

  File /usr/bin/mysql
     ✔  should exist
  Command: `/usr/bin/mysql --version`
     ✔  exit_status should eq 0
     ✔  stdout should match /Distrib 5.7/
     ✔  stderr should eq ""
  Command: `ldconfig -p`
     ✔  stdout should match /libmysqlclient.so/
  File /usr/include/mysql/mysql.h
     ✔  should exist
  File /usr/sbin/mysqld
     ✔  should exist
  Command: `/usr/sbin/mysqld --version`
     ✔  exit_status should eq 0
     ✔  stdout should match /Ver 5.7/
     ✔  stderr should eq ""
  Command: `/usr/bin/mysql -h 127.0.0.1 -P 3307 -u root -pAn0th3r_Pa\%\%w0rd\! -D databass -e "SELECT * FROM table1"
  `
     ✔  exit_status should eq 0
     ✔  stdout should match /awesome/
  Command: `/usr/bin/mysql -h 127.0.0.1 -P 3308 -u root -pAn0th3r_Pa\%\%w0rd\! -D databass -e "SELECT * FROM table1"
  `
     ✔  exit_status should eq 0
     ✔  stdout should match /awesome/
  Command: `/usr/bin/mysql -h 127.0.0.1 -P 3306 -u root -pMyPa\$\$word\\Has_\"Special\'Chars\%\! -D mysql -e "SELECT Host,User FROM mysql.user WHERE User='root' AND Host='127.0.0.1';"
  `
     ✔  exit_status should eq 0
     ✔  stdout should match /| 127.0.0.1 | root |/
  Command: `/usr/bin/mysql -h 127.0.0.1 -P 3306 -u root -pMyPa\$\$word\\Has_\"Special\'Chars\%\! -D mysql -e "SELECT Host,User FROM mysql.user WHERE User='root' AND Host='localhost';"
  `
     ✔  exit_status should eq 0
     ✔  stdout should match /| localhost | root |/
  Command: `/usr/bin/mysql -h 127.0.0.1 -P 3307 -u root -pAn0th3r_Pa\%\%w0rd\! -D mysql -e "SELECT Host,User FROM mysql.user WHERE User='root' AND Host='127.0.0.1';"
  `
     ✔  exit_status should eq 0
     ✔  stdout should match /| 127.0.0.1 | root |/
  Command: `/usr/bin/mysql -h 127.0.0.1 -P 3307 -u root -pAn0th3r_Pa\%\%w0rd\! -D mysql -e "SELECT Host,User FROM mysql.user WHERE User='root' AND Host='localhost';"
  `
     ✔  exit_status should eq 0
     ✔  stdout should match /| localhost | root |/
  Command: `/usr/bin/mysql -h 127.0.0.1 -P 3308 -u root -pAn0th3r_Pa\%\%w0rd\! -D mysql -e "SELECT Host,User FROM mysql.user WHERE User='root' AND Host='127.0.0.1';"
  `
     ✔  exit_status should eq 0
     ✔  stdout should match /| 127.0.0.1 | root |/
  Command: `/usr/bin/mysql -h 127.0.0.1 -P 3308 -u root -pAn0th3r_Pa\%\%w0rd\! -D mysql -e "SELECT Host,User FROM mysql.user WHERE User='root' AND Host='localhost';"
  `
     ✔  exit_status should eq 0
     ✔  stdout should match /| localhost | root |/

Test Summary: 26 successful, 0 failures, 0 skipped
gsomoza commented 4 years ago

The Fauxhai delivery failures definitely seem unrelated to this PR. Fauxhai doesn't support some of those platforms anymore I guess, but I wouldn't know how to best fix that other than maybe locking Fauxhai to the older version that did support them? Not sure what's best there.

gsomoza commented 4 years ago

For example, looks like Fauxhai dropped support for Debian 7.11 on version 7.5.0 (version 7.4.0 does support it).

damacus commented 4 years ago

Fauxhai can probably be limited to a platform major version using '7' or '8' which is easier for now.

damacus commented 4 years ago

Can you update the CHANGELOG and we'll get this shipped :)

Thanks for picking this one up

gsomoza commented 4 years ago

Updated changelog

gsomoza commented 4 years ago

Is there anything else you need from me to merge?

damacus commented 4 years ago

Yeah, looks like the tests haven't even started due to some markdown issues. Any chance you can look into fixing those please?

gsomoza commented 4 years ago

Done, took 10 seconds :)

gsomoza commented 4 years ago

@damacus I'll let you guys check the Dokken tests: it doesn't seem those issues were introduced in this PR – but if they are then I'm not sure I can fix them anyway and would at least need some guidance.

I'll also let you handle the merge conflicts because I already resolved other merged conflicts previously and the only reason we have more is that this is taking long to merge... I hope this makes sense.

ramereth commented 3 years ago

This should have been resolved with #653