首页 > 解决方案 > Pyhaproxy 作业在“前端”定义中给出未指定主机和端口

问题描述

我的 pyhaproxy 脚本有一个小问题,我希望你能引导我走向正确的方向。

我的 haproxy.cfg 包含两个前端...

frontend http
    bind 0.0.0.0:80
    acl test_site1 hdr(host) -i test_site1.local
    use_backend test_site1_back if test_site1
    etc. etc.

frontend https
    bind 0.0.0.0:443 ssl crt /etc/ssl/private
    option forwardfor
    reqadd X-Forwarded-Proto:\ https
    acl test_site1 hdr(host) -i test_site1.local
    use_backend test_site1_back if test_site1
    etc. etc.

haproxy 工作得很好——那里没问题。

我的 pyhaproxy 清理脚本的一部分如下所示:

haproxy_cfg = '/etc/haproxy.cfg'
haproxy_bak = '/etc/haproxy.bak'

parser = Parser(haproxy_cfg)
configuration = parser.build_configuration()
frontends = configuration.frontends
backends = configuration.backends

它给出以下错误消息:[第 287 行是配置 = parser.build_configuration()]

Traceback(最近一次调用最后一次):文件“./cleaner.py”,第 287 行,在 configuration = parser.build_configuration()

文件“/a-lot-of-folders/python2.7/site-packages/pyhaproxy/parse.py”,第 41 行,在 build_configuration

self.build_frontend(section_node))

文件“/a-lot-of-folders/python2.7/site-packages/pyhaproxy/parse.py”,第 203 行,在 build_frontend

frontend'未在定义中指定主机和端口')

frontend例外:未在定义中指定主机和端口

分段故障

我做错了什么或错过了什么?

问候 - 拉斯

标签: pythonhaproxy

解决方案


推荐阅读