Skip to content

Commit b404242

Browse files
author
chenyunliang520
committed
Refine tests-ssl.yml and cluster_ha_showcase.py: Remove separate config permissions step, use tee for file creation, simplify string quoting in postgresql.conf and pg_hba.conf, and fix string literal consistency in get_node_role
1 parent fd66a6c commit b404242

File tree

2 files changed

+25
-30
lines changed

2 files changed

+25
-30
lines changed

.github/workflows/tests-ssl.yml

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,9 @@ jobs:
6868
sudo chmod 644 ${{ github.workspace }}/certs/*key || true
6969
sudo chmod 644 ${{ github.workspace }}/certs/*.crt || true
7070
71-
- name: Set config permissions
72-
run: |
73-
sudo mkdir -p ${{ github.workspace }}/opengauss/conf
74-
sudo chown -R omm:omm ${{ github.workspace }}/opengauss
75-
7671
- name: Create postgresql.conf with SSL
7772
run: |
78-
sudo -u omm bash -c 'cat > ${{ github.workspace }}/opengauss/conf/postgresql.conf <<EOF
73+
sudo -u omm tee ${{ github.workspace }}/opengauss/conf/postgresql.conf > /dev/null <<'EOF'
7974
max_connections = 200
8075
session_timeout = 10min
8176
bulk_write_ring_size = 2GB
@@ -86,62 +81,62 @@ jobs:
8681
enable_double_write = on
8782
wal_keep_segments = 16
8883
enable_slot_log = off
89-
synchronous_standby_names = '"'"'*'"'"'
84+
synchronous_standby_names = '*'
9085
walsender_max_send_size = 8MB
9186
hot_standby = on
9287
enable_kill_query = off
9388
logging_collector = on
94-
log_filename = '"'"'postgresql-%Y-%m-%d_%H%M%S.log'"'"'
89+
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
9590
log_file_mode = 0600
9691
log_rotation_size = 20MB
9792
log_min_duration_statement = 1800000
9893
log_connections = off
9994
log_disconnections = off
10095
log_duration = off
10196
log_hostname = off
102-
log_line_prefix = '"'"'%m %u %d %h %p %S '"'"'
103-
log_timezone = '"'"'UTC'"'"'
97+
log_line_prefix = '%m %u %d %h %p %S '
98+
log_timezone = 'UTC'
10499
enable_alarm = on
105100
connection_alarm_rate = 0.9
106101
alarm_report_interval = 10
107-
alarm_component = '"'"'/opt/snas/bin/snas_cm_cmd'"'"'
102+
alarm_component = '/opt/snas/bin/snas_cm_cmd'
108103
use_workload_manager = on
109-
datestyle = '"'"'iso, mdy'"'"'
110-
timezone = '"'"'UTC'"'"'
111-
lc_messages = '"'"'en_US.utf8'"'"'
112-
lc_monetary = '"'"'en_US.utf8'"'"'
113-
lc_numeric = '"'"'en_US.utf8'"'"'
114-
lc_time = '"'"'en_US.utf8'"'"'
115-
default_text_search_config = '"'"'pg_catalog.english'"'"'
104+
datestyle = 'iso, mdy'
105+
timezone = 'UTC'
106+
lc_messages = 'en_US.utf8'
107+
lc_monetary = 'en_US.utf8'
108+
lc_numeric = 'en_US.utf8'
109+
lc_time = 'en_US.utf8'
110+
default_text_search_config = 'pg_catalog.english'
116111
lockwait_timeout = 1200s
117-
pgxc_node_name = '"'"'gaussdb'"'"'
112+
pgxc_node_name = 'gaussdb'
118113
audit_enabled = on
119114
job_queue_processes = 10
120115
dolphin.nulls_minimal_policy = on
121116
password_encryption_type = 0
122117
wal_level = logical
123-
application_name = '"'"''"'"'
124-
listen_addresses = '"'"'*'"'"'
118+
application_name = ''
119+
listen_addresses = '*'
125120
max_replication_slots = 10
126121
max_wal_senders = 10
127122
shared_buffers = 512MB
128123
ssl = on
129-
ssl_cert_file = '"'"'/var/lib/opengauss/certs/server.crt'"'"'
130-
ssl_key_file = '"'"'/var/lib/opengauss/certs/server.key'"'"'
131-
ssl_ca_file = '"'"'/var/lib/opengauss/certs/ca.crt'"'"'
132-
EOF'
124+
ssl_cert_file = '/var/lib/opengauss/certs/server.crt'
125+
ssl_key_file = '/var/lib/opengauss/certs/server.key'
126+
ssl_ca_file = '/var/lib/opengauss/certs/ca.crt'
127+
EOF
133128
sudo chmod 644 ${{ github.workspace }}/opengauss/conf/postgresql.conf
134129
135130
- name: Create pg_hba.conf with SSL
136131
run: |
137-
sudo -u omm bash -c 'cat > ${{ github.workspace }}/opengauss/conf/pg_hba.conf <<EOF
132+
sudo -u omm tee ${{ github.workspace }}/opengauss/conf/pg_hba.conf > /dev/null <<'EOF'
138133
local all all trust
139134
host all all 127.0.0.1/32 trust
140135
host all all ::1/128 trust
141136
hostssl all all 0.0.0.0/0 cert
142-
host all all 0.0.0.0/0 md5
143-
host replication gaussdb 0.0.0.0/0 md5
144-
EOF'
137+
host all all 0.0.0.0/0 md5
138+
host replication gaussdb 0.0.0.0/0 md5
139+
EOF
145140
sudo chmod 644 ${{ github.workspace }}/opengauss/conf/pg_hba.conf
146141
147142
- name: Debug file permissions

example/cluster_ha_showcase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def get_node_role(conn: Connection, cluster_mode: str, host: str, port: str) ->
8181
)
8282
row = cur.fetchone()
8383
if row is None:
84-
return 'single'
84+
return "single"
8585
return row[0]
8686
elif cluster_mode == "distributed":
8787
cur.execute(

0 commit comments

Comments
 (0)