Skip to content

Commit 1ec9a10

Browse files
committed
Fix haproxy.cfg for IPv6
1 parent 18fbdea commit 1ec9a10

2 files changed

Lines changed: 18 additions & 14 deletions

File tree

tests/foreman/data/haproxy.cfg

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ global
1010
stats socket /var/lib/haproxy/stats
1111

1212
listen stats
13-
bind :5566
13+
bind :::5566
1414
stats enable
1515
stats hide-version
1616
stats refresh 20s
@@ -31,7 +31,7 @@ defaults
3131

3232
#https + rhsm
3333
frontend https
34-
bind *:443
34+
bind :::443
3535
mode tcp
3636
option tcplog
3737
default_backend f-proxy-https
@@ -45,7 +45,7 @@ backend f-proxy-https
4545

4646
#http
4747
frontend http
48-
bind *:80
48+
bind :::80
4949
mode tcp
5050
option tcplog
5151
default_backend f-proxy-http
@@ -59,7 +59,7 @@ backend f-proxy-http
5959

6060
#amqp
6161
frontend amqp
62-
bind *:5647
62+
bind :::5647
6363
mode tcp
6464
option tcplog
6565
default_backend f-proxy-amqp
@@ -73,7 +73,7 @@ backend f-proxy-amqp
7373

7474
#anaconda
7575
frontend anaconda
76-
bind *:8000
76+
bind :::8000
7777
mode tcp
7878
option tcplog
7979
default_backend f-proxy-anaconda
@@ -87,7 +87,7 @@ backend f-proxy-anaconda
8787

8888
#scap
8989
frontend scap
90-
bind *:9090
90+
bind :::9090
9191
mode tcp
9292
option tcplog
9393
default_backend f-proxy-scap
@@ -101,7 +101,7 @@ backend f-proxy-scap
101101

102102
#docker
103103
frontend docker
104-
bind *:5000
104+
bind :::5000
105105
mode tcp
106106
option tcplog
107107
default_backend f-proxy-docker

tests/foreman/sys/test_capsule_loadbalancer.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,25 +139,28 @@ def setup_haproxy(
139139
module_haproxy.execute('firewall-cmd --add-service RH-Satellite-6-capsule')
140140
module_haproxy.execute('firewall-cmd --runtime-to-permanent')
141141
module_haproxy.register(module_org, None, haproxy_ak.name, module_target_sat)
142-
result = module_haproxy.execute('yum install haproxy policycoreutils-python-utils -y')
142+
result = module_haproxy.execute('yum install -y haproxy policycoreutils-python-utils')
143143
assert result.status == 0
144-
module_haproxy.execute('rm -f /etc/haproxy/haproxy.cfg')
144+
config_file = '/etc/haproxy/haproxy.cfg'
145+
module_haproxy.execute(f'mv {config_file} {config_file}.bak')
145146
module_haproxy.session.sftp_write(
146147
source=DataFile.DATA_DIR.joinpath('haproxy.cfg'),
147-
destination='/etc/haproxy/haproxy.cfg',
148+
destination=config_file,
148149
)
149150
module_haproxy.execute(
150151
f'sed -i -e s/CAPSULE_1/{setup_capsules[0].hostname}/g '
151-
f' --e s/CAPSULE_2/{setup_capsules[1].hostname}/g '
152-
f' /etc/haproxy/haproxy.cfg'
152+
f'-e s/CAPSULE_2/{setup_capsules[1].hostname}/g '
153+
f'{config_file}'
153154
)
154-
module_haproxy.execute('systemctl restart haproxy.service')
155+
module_haproxy.execute('systemctl enable haproxy.service')
156+
module_haproxy.execute('semanage boolean -m --on haproxy_connect_any')
157+
# HAProxy logging setup
155158
module_haproxy.execute('mkdir /var/lib/haproxy/dev')
156159
module_haproxy.session.sftp_write(
157160
source=DataFile.DATA_DIR.joinpath('99-haproxy.conf'),
158161
destination='/etc/rsyslog.d/99-haproxy.conf',
159162
)
160-
module_haproxy.execute('setenforce permissive')
163+
module_haproxy.execute('setenforce permissive') # logging setup requires permissive mode
161164
assert module_haproxy.execute('systemctl restart haproxy.service rsyslog.service').status == 0
162165

163166
haproxy_url = f'https://{module_haproxy.hostname}:9090'
@@ -179,6 +182,7 @@ def setup_haproxy(
179182
@pytest.mark.e2e
180183
@pytest.mark.rhel_ver_list([settings.content_host.default_rhel_version])
181184
def test_loadbalancer_install_package(
185+
setup_haproxy,
182186
setup_capsules,
183187
content_for_client,
184188
module_target_sat,

0 commit comments

Comments
 (0)