@@ -15,6 +15,41 @@ DB_ROOT_PW=${MYSQL_ROOT_PW:-insecure_slave}
15
15
DB_USER=openstack_citest
16
16
DB_PW=openstack_citest
17
17
18
+ function is_rhel7 {
19
+ [ -f /usr/bin/yum ] && \
20
+ cat /etc/* release | grep -q -e " Red Hat" -e " CentOS" -e " CloudLinux" && \
21
+ cat /etc/* release | grep -q ' release 7'
22
+ }
23
+
24
+ function is_rhel8 {
25
+ [ -f /usr/bin/dnf ] && \
26
+ cat /etc/* release | grep -q -e " Red Hat" -e " CentOS" -e " CloudLinux" && \
27
+ cat /etc/* release | grep -q ' release 8'
28
+ }
29
+
30
+ function set_conf_line { # file regex value
31
+ sudo sh -c " grep -q -e '$2 ' $1 && \
32
+ sed -i 's|$2 |$3 |g' $1 || \
33
+ echo '$3 ' >> $1 "
34
+ }
35
+
36
+ if is_rhel7 || is_rhel8; then
37
+ # mysql needs to be started on centos/rhel
38
+ sudo systemctl restart mariadb.service
39
+
40
+ # postgres setup for centos
41
+ sudo postgresql-setup --initdb
42
+ PG_CONF=/var/lib/pgsql/data/postgresql.conf
43
+ set_conf_line $PG_CONF ' ^password_encryption =.*' ' password_encryption = scram-sha-256'
44
+
45
+ PG_HBA=/var/lib/pgsql/data/pg_hba.conf
46
+ set_conf_line $PG_HBA ' ^local[ \t]*all[ \t]*all.*' ' local all all peer'
47
+ set_conf_line $PG_HBA ' ^host[ \t]*all[ \t]*all[ \t]*127.0.0.1\/32.*' ' host all all 127.0.0.1/32 scram-sha-256'
48
+ set_conf_line $PG_HBA ' ^host[ \t]*all[ \t]*all[ \t]*::1\/128.*' ' host all all ::1/128 scram-sha-256'
49
+
50
+ sudo systemctl restart postgresql.service
51
+ fi
52
+
18
53
sudo -H mysqladmin -u root password $DB_ROOT_PW
19
54
20
55
# It's best practice to remove anonymous users from the database. If
0 commit comments