Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Add security_reset.expect.10.5 from kolla for mariadb>10.5
Browse files Browse the repository at this point in the history
https://review.opendev.org/c/openstack/tripleo-common/+/800580 adds
the support of building containers on CentOS Stream 9.

mariadb>10.5 does not works with
/usr/share/openstack-tripleo-common-containers/container-images/kolla/mariadb/security_reset.expect
file. It needs
https://opendev.org/openstack/kolla/src/branch/master/docker/mariadb/mariadb-server/security_reset.expect.debian
to be placed with in kolla/mariadb directly so that it
will work with mariadb>10.5.

The file is renamed to security_reset.expect.10.5 to
avoid debian in the end.

Since above filepath is hardcoded in the mariadb
container so putting it in c9 container build
patch is not working.
So we are moving it to a seperate patch.

Signed-off-by: Chandan Kumar (raukadah) <[email protected]>
Change-Id: I6609345d0e60af62ca75e4bd9b3ed63167a3bc70
(cherry picked from commit e08affe)
  • Loading branch information
chkumar246 committed Sep 10, 2021
1 parent 4d8cf39 commit f124c39
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions container-images/kolla/mariadb/security_reset.expect.10.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/usr/bin/expect -f

if [catch {set timeout $env(DB_MAX_TIMEOUT)}] {set timeout 10}
spawn mysql_secure_installation
expect {
timeout { send_user "\nFailed to get 'Enter current password for root (enter for none):' prompt\n"; exit 1 }
eof { send_user "\nFailed to get 'Enter current password for root (enter for none):' prompt\n"; exit 1 }
"Enter current password for root (enter for none):"
}
send "\r"

expect {
timeout { send_user "\nFailed to get 'Switch to unix_socket authentication [Y/n] ' prompt\n"; exit 1 }
eof { send_user "\nFailed to get 'Switch to unix_socket authentication' prompt\n"; exit 1 }
"Switch to unix_socket authentication \\\[Y/n\\\] "
}
send "n\r"

expect {
timeout { send_user "\nFailed to get 'Change the root password? [Y/n]' prompt\n"; exit 1 }
eof { send_user "\nFailed to get 'Change the root password?' prompt\n"; exit 1 }
"Change the root password? \\\[Y/n\\\] "
}
send "y\r"

expect {
timeout { send_user "\nFailed to get 'New password:' prompt\n"; exit 1 }
eof { send_user "\nFailed to get 'New password:' prompt\n"; exit 1 }
"New password:"
}
send "$env(DB_ROOT_PASSWORD)\r"

expect {
timeout { send_user "\nFailed to get 'Re-enter new password:' prompt\n"; exit 1 }
eof { send_user "\nFailed to get 'Re-enter new password:' prompt\n"; exit 1 }
"Re-enter new password:"
}
send "$env(DB_ROOT_PASSWORD)\r"

expect {
timeout { send_user "\nFailed to get 'Remove anonymous users?' prompt\n"; exit 1 }
eof { send_user "\nFailed to get 'Remove anonymous users?' prompt\n"; exit 1 }
"Remove anonymous users?"
}
send "y\r"

expect {
timeout { send_user "\nFailed to get 'Disallow root login remotely?' prompt\n"; exit 1 }
eof { send_user "\nFailed to get 'Disallow root login remotely?' prompt\n"; exit 1 }
"Disallow root login remotely?"
}
send "n\r"

expect {
timeout { send_user "\nFailed to get 'Remove test database and access to it?' prompt\n"; exit 1 }
eof { send_user "\nFailed to get 'Remove test database and access to it?' prompt\n"; exit 1 }
"Remove test database and access to it?"
}
send "y\r"

expect {
timeout { send_user "\nFailed to get 'Reload privilege tables now?' prompt\n"; exit 1 }
eof { send_user "\nFailed to get 'Reload privilege tables now?' prompt\n"; exit 1 }
"Reload privilege tables now?"
}
send "y\r"
expect eof

0 comments on commit f124c39

Please sign in to comment.