imjoey / pyhaproxy

Python library to parse haproxy configurations
MIT License
54 stars 21 forks source link

error when parsing a configuration containing a listen block #4

Closed gurretp closed 8 years ago

gurretp commented 8 years ago

Hi,

when parsing a configuration containing a listen block, I get the following error:

Traceback (most recent call last):
  File "/tmp/test.py", line 139, in getstats
    configuration = cfg_parser.build_configuration()
  File "/usr/lib/python2.7/site-packages/pyhaproxy/parse.py", line 45, in build_configuration
    self.build_listen(section_node))
  File "/usr/lib/python2.7/site-packages/pyhaproxy/parse.py", line 152, in build_listen
    service_address_node = listen_node.listen_header.service_address
AttributeError: 'ListenHeader' object has no attribute 'service_address'

The class definition of ListenHeader has no attribute service_address, adding the following line at line 90 in pegnode.py seems to do the trick:

self.service_address = elements[5]
imjoey commented 8 years ago

@gurretp Hi, you are right, sorry for the mistake. You can fork and commit PR, if you want, or I will fix this issue. Thanks.