Closed phracek closed 4 years ago
Can one of the admins verify this patch?
Can one of the admins verify this patch?
Can one of the admins verify this patch?
Can one of the admins verify this patch?
Can one of the admins verify this patch?
Can one of the admins verify this patch?
[test]
Petr, using <<'EOF'
instead of <<EOSQL
makes the variable in the heredoc not expanded, why do you think this should fix the issue?
I got inspired by https://github.com/mysql/mysql-docker/commit/13507953098b9cb707418a216ec5ac9d84326221 and https://github.com/sclorg/postgresql-container/blob/master/src/root/usr/share/container-scripts/postgresql/start/set_passwords.sh#L14 but did a copy-paste error. The next commit will fix it.
[test]
In the original 50-password-change.sh
file was used <<EOSQL
instead of <<-EOSQL
.
If the <<-EOSQL
is used then all leading tab characters are stripped from input lines.
I have rewritten it a bit so each line starts at the beginning of the line.
I still don't understand why you think it is a problem with syntax. How I understand it, the problem ERROR 1396 (HY000)
is that the newuser
doesn't exist, but the script is trying to set the password for it.
If I'm right, then it is still not clear to me how the startup script should behave in this case -- we can either return an error and fail starting the container. Or we can create the specified user. I'd probably incline for the second option, creating the user if user specifies it, and write the action of creating the user to the log, so we have an entry in the container log what was done. This option has one disadvantage -- people can create a new user by mistake.
I have solved the issue now. The output of MySQL SELECT
command is stored into
environment variable.
I have executed several local tests whether the functionality works properly. In case the user exists in mysql.user
the database then the password is updated. In case the user does not exist in mysql.user
the database then in container log can be seen the message, that the user does not exist.
[test]
[test-openshift]
[test-openshift]
Thanks a lot for the PR. I've changed the check section and used SQL directly to see whether the user exists. Also a regression test is added.
A similar PR for mariadb available at https://github.com/sclorg/mariadb-container/pull/121
[test]
This issue fixes BZ#1653215.
This commit fixes problem formatting MySQL commands in 50-passwd-change.sh script. Correct BASH syntax as an input to MySQL command is used.
Signed-off-by: Petr "Stone" Hracek phracek@redhat.com