summaryrefslogtreecommitdiff
path: root/src/conf_mode/load-balancing-haproxy.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-05-19 12:21:29 +0200
committerGitHub <noreply@github.com>2023-05-19 12:21:29 +0200
commita66648596dc126b7bed37d8119ee8faa14909613 (patch)
tree4ada4f89dcd395b809b17232846ddf4e557cb5dc /src/conf_mode/load-balancing-haproxy.py
parent881e7e5710d5011a837d943dc7ae40a3181a6482 (diff)
parente201bd35511e1a000ffa21a4194d234634cfd76c (diff)
downloadvyos-1x-a66648596dc126b7bed37d8119ee8faa14909613.tar.gz
vyos-1x-a66648596dc126b7bed37d8119ee8faa14909613.zip
Merge pull request #2012 from sever-sever/T5222-mod
T5222: Refactoring load-balancing reverse-proxy
Diffstat (limited to 'src/conf_mode/load-balancing-haproxy.py')
-rwxr-xr-xsrc/conf_mode/load-balancing-haproxy.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/conf_mode/load-balancing-haproxy.py b/src/conf_mode/load-balancing-haproxy.py
index d2b895fbe..938af6cda 100755
--- a/src/conf_mode/load-balancing-haproxy.py
+++ b/src/conf_mode/load-balancing-haproxy.py
@@ -74,15 +74,12 @@ def verify(lb):
if not lb:
return None
- if 'backend' not in lb or 'server' not in lb:
- raise ConfigError(f'"server" and "backend" must be configured!')
+ if 'backend' not in lb or 'service' not in lb:
+ raise ConfigError(f'"service" and "backend" must be configured!')
- for front, front_config in lb['server'].items():
+ for front, front_config in lb['service'].items():
if 'port' not in front_config:
- raise ConfigError(f'"{front} server port" must be configured!')
- # We can use redirect to HTTPS without backend section
- if 'backend' not in front_config and 'redirect_http_to_https' not in front_config:
- raise ConfigError(f'"{front} backend" must be configured!')
+ raise ConfigError(f'"{front} service port" must be configured!')
# Check if bind address:port are used by another service
tmp_address = front_config.get('address', '0.0.0.0')
@@ -117,7 +114,7 @@ def generate(lb):
os.mkdir(load_balancing_dir)
# SSL Certificates for frontend
- for front, front_config in lb['server'].items():
+ for front, front_config in lb['service'].items():
if 'ssl' in front_config:
cert_file_path = os.path.join(load_balancing_dir, 'cert.pem')
cert_key_path = os.path.join(load_balancing_dir, 'cert.pem.key')