Example #1
0
 def __init__(self, cfg):
     sec_level = cfg.collectd_security_level
     if sec_level in ("sign", "SIGN", "Sign", 1):
         self.sec_level = 1
     elif sec_level in ("encrypt", "ENCRYPT", "Encrypt", 2):
         self.sec_level = 2
     else:
         self.sec_level = 0
     self.auth_file = cfg.collectd_auth_file
     self.auth_db = {}
     self.cfg_mon = None
     if self.auth_file:
         self.load_auth_file()
         self.cfg_mon = FileMonitor(self.auth_file)
     if self.sec_level:
         if not self.auth_file:
             raise ConfigError("Collectd security level configured but no "
                               "auth file specified in configuration")
         if not self.auth_db:
             log.warning("Collectd security level configured but no "
                         "user/passwd entries loaded from auth file")