if not self.cmd:
return {}
+ self.get_automember()
self.get_memberof()
self.get_referint()
self.get_root_dn_access()
return value
+ # --------------------------------------------------------------------------
+ def get_automember(self):
+ """Get configuration, definitions and regular expressions of the automember plugnin."""
+ proc = run(
+ [self.cmd, self.instance, 'plugin', 'show'],
+ capture_output=True, encoding=self.encoding)
+ if proc.stderr:
+ module.warn(proc.stderr)
+ if proc.returncode:
+ return
+
+ key = 'automember'
+ re_processmodifyops = re.compile(r'^automemberProcessModifyOps:\s+(.*)', re.IGNORECASE)
+
+ if key not in self.result:
+ self.result[key] = {}
+
+ if 'definition' not in self.result[key]:
+ self.result[key]['definition'] = {}
+
+ for line in proc.stdout.splitlines():
+ line = line.strip()
+ if not line:
+ continue
+
+ m = self.re_cn.match(line)
+ if m:
+ self.result[key]['cn'] = m.group(1)
+ continue
+
+ m = self.re_plugin_version.match(line)
+ if m:
+ self.result[key]['plugin_version'] = m.group(1)
+ continue
+
+ m = self.re_enabled.match(line)
+ if m:
+ self.result[key]['enabled'] = self.mangle_value(m.group(1))
+ continue
+
+ m = re_processmodifyops.match(line)
+ if m:
+ self.result[key]['process_modify_ops'] = self.mangle_value(m.group(1))
+ continue
+
+ self._get_automember_definitions()
+
+ # --------------------------------------------------------------------------
+ def _get_automember_definitions(self):
+
+ proc = run(
+ [self.cmd, self.instance, 'plugin', 'list', 'definitions'],
+ capture_output=True, encoding=self.encoding)
+ if proc.stderr:
+ module.warn(proc.stderr)
+ if proc.returncode:
+ return
+
+ key = 'automember'
+
+ for def_name in proc.stdout.splitlines():
+ def_name = def_name.strip()
+ if not def_name:
+ continue
+
+ if def_name not in self.result[key]['definition']:
+ self.result[key]['definition'][def_name] = {}
+
# --------------------------------------------------------------------------
def get_memberof(self):
"""Get config of memberof plugin."""