zabbix-tooling / zabbix-ldap-sync

Sync Zabbix with LDAP directory server
BSD 3-Clause "New" or "Revised" License
50 stars 36 forks source link

ConfigParser issue #15

Closed Isonone closed 4 years ago

Isonone commented 5 years ago

First of all thank you for the script. Works like a charm, saving me a lot of time. I just have one recommendation. I'm using this script on Centos 7.5 and initially I had some issues with ConfigParser. Seems Centos/Red Hat doesn't like how config data being parsed using ConfigParser.

# ./zabbix-ldap-sync --verbose -f zabbix-ldap.conf
'%' must be followed by '%' or '(', found: '%^Geks281%^'
Traceback (most recent call last):
  File "/root/zabbix-ldap-sync/lib/zabbixldapconf.py", line 43, in __init__
    self.ldap_passwd = parser.get('ldap', 'bindpass')
  File "/usr/lib64/python3.6/configparser.py", line 799, in get
    return self._interpolation.before_get(self, section, option, value, d)
  File "/usr/lib64/python3.6/configparser.py", line 394, in before_get
    self._interpolate_some(parser, option, L, value, section, defaults, 1)
  File "/usr/lib64/python3.6/configparser.py", line 444, in _interpolate_some
    "found: %r" % (rest,))
configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: '%^Geks281%^'
Configuration issues detected in zabbix-ldap.conf`

So probably is a good idea changing the way config data beaing parsed with RawConfigParser.

scoopex commented 4 years ago

solved