imjoey / pyhaproxy

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

Trying to read/dump config fails #20

Closed InvisibleFunction closed 7 years ago

InvisibleFunction commented 7 years ago

Just trying to read in the config and then dump it fails:

Traceback (most recent call last):
  File "./scrapers/hap_virtualservers.py", line 28, in <module>
    main()
  File "./scrapers/hap_virtualservers.py", line 24, in main
    print(cfg_render.render_configuration())
  File "/Users/if/git/easierbutton/venv/lib/python3.6/site-packages/pyhaproxy/render.py", line 29, in render_configuration
    config_str = config_str + self.render_listen(listen_section)
  File "/Users/if/git/easierbutton/venv/lib/python3.6/site-packages/pyhaproxy/render.py", line 75, in render_listen
    if not bool(listen.config_block['binds']):
TypeError: list indices must be integers or slices, not str

listen.config_block does appear to be a list, I'm not sure what this function is trying to do though…

imjoey commented 7 years ago

@IgniFerroque Thanks for your issue. It is my mistake. I forgot to change the method call for retrieving bind configs. Please see PR #21 .

InvisibleFunction commented 7 years ago

Thanks!