# Standard modules
import re
+import shlex
from subprocess import run
# Third party modules
# --------------------------------------------------------------------------
def get_automember(self):
"""Get configuration, definitions and regular expressions of the automember plugnin."""
- proc = run(
- [self.cmd, self.instance, 'plugin', 'automember', 'show'],
- capture_output=True, encoding=self.encoding)
+ cmd = [self.cmd, self.instance, 'plugin', 'automember', 'show']
+ proc = run(cmd, capture_output=True, encoding=self.encoding)
if proc.stderr:
- module.warn(proc.stderr)
+ msg = 'Error executing {!r}: '.format(shlex.join(cmd)) + proc.stderr
+ module.warn(msg)
if proc.returncode:
return
# --------------------------------------------------------------------------
def _get_automember_definitions(self):
- proc = run(
- [self.cmd, self.instance, 'plugin', 'automember', 'list', 'definitions'],
- capture_output=True, encoding=self.encoding)
+ cmd = [self.cmd, self.instance, 'plugin', 'automember', 'list', 'definitions']
+ proc = run(cmd, capture_output=True, encoding=self.encoding)
if proc.stderr:
- module.warn(proc.stderr)
+ msg = 'Error executing {!r}: '.format(shlex.join(cmd)) + proc.stderr
+ module.warn(msg)
if proc.returncode:
return
# --------------------------------------------------------------------------
def _get_automember_definition(self, def_name):
- proc = run(
- [self.cmd, self.instance, 'plugin', 'automember', 'definition', def_name, 'show'],
- capture_output=True, encoding=self.encoding)
-
+ cmd = [self.cmd, self.instance, 'plugin', 'automember', 'definition', def_name, 'show']
+ proc = run(cmd, capture_output=True, encoding=self.encoding)
if proc.stderr:
- module.warn(proc.stderr)
+ msg = 'Error executing {!r}: '.format(shlex.join(cmd)) + proc.stderr
+ module.warn(msg)
if proc.returncode:
return
# --------------------------------------------------------------------------
def _get_automember_regexes(self, def_name):
- proc = run(
- [self.cmd, self.instance, 'plugin', 'automember', 'list', 'regexes', def_name],
- capture_output=True, encoding=self.encoding)
+ cmd = [self.cmd, self.instance, 'plugin', 'automember', 'list', 'regexes', def_name]
+ proc = run(cmd, capture_output=True, encoding=self.encoding)
if proc.stderr:
- module.warn(proc.stderr)
+ msg = 'Error executing {!r}: '.format(shlex.join(cmd)) + proc.stderr
+ module.warn(msg)
if proc.returncode:
return
# --------------------------------------------------------------------------
def _get_automember_regex(self, def_name, re_name):
- proc = run(
- [self.cmd, self.instance, 'plugin', 'automember', 'definition',
- 'regex', re_name, 'show'],
- capture_output=True, encoding=self.encoding)
-
+ cmd = [
+ self.cmd, self.instance, 'plugin', 'automember',
+ 'definition', 'regex', re_name, 'show']
+ proc = run(cmd, capture_output=True, encoding=self.encoding)
if proc.stderr:
- module.warn(proc.stderr)
+ msg = 'Error executing {!r}: '.format(shlex.join(cmd)) + proc.stderr
+ module.warn(msg)
if proc.returncode:
return
# --------------------------------------------------------------------------
def get_memberof(self):
"""Get config of memberof plugin."""
- proc = run(
- [self.cmd, self.instance, 'plugin', 'memberof', 'show'],
- capture_output=True, encoding=self.encoding)
+ cmd = [self.cmd, self.instance, 'plugin', 'memberof', 'show']
+ proc = run(cmd, capture_output=True, encoding=self.encoding)
if proc.stderr:
- module.warn(proc.stderr)
+ msg = 'Error executing {!r}: '.format(shlex.join(cmd)) + proc.stderr
+ module.warn(msg)
if proc.returncode:
return
# --------------------------------------------------------------------------
def get_referint(self):
"""Get config of referential-integrity plugin."""
- proc = run(
- [self.cmd, self.instance, 'plugin', 'referential-integrity', 'show'],
- capture_output=True, encoding=self.encoding)
+ cmd = [self.cmd, self.instance, 'plugin', 'referential-integrity', 'show']
+ proc = run(cmd, capture_output=True, encoding=self.encoding)
if proc.stderr:
- module.warn(proc.stderr)
+ msg = 'Error executing {!r}: '.format(shlex.join(cmd)) + proc.stderr
+ module.warn(msg)
if proc.returncode:
return
# --------------------------------------------------------------------------
def get_root_dn_access(self):
"""Get config of the plugin managing the access of the root_dn."""
- proc = run(
- [self.cmd, self.instance, 'plugin', 'root-dn', 'show'],
- capture_output=True, encoding=self.encoding)
+ cmd = [self.cmd, self.instance, 'plugin', 'root-dn', 'show']
+ proc = run(cmd, capture_output=True, encoding=self.encoding)
if proc.stderr:
- module.warn(proc.stderr)
+ msg = 'Error executing {!r}: '.format(shlex.join(cmd)) + proc.stderr
+ module.warn(msg)
if proc.returncode:
return
# --------------------------------------------------------------------------
def get_account_policy(self):
"""Get config of the account-policy plugin."""
- proc = run(
- [self.cmd, self.instance, 'plugin', 'account-policy', 'show'],
- capture_output=True, encoding=self.encoding)
+ cmd = [self.cmd, self.instance, 'plugin', 'account-policy', 'show']
+ proc = run(cmd, capture_output=True, encoding=self.encoding)
if proc.stderr:
- module.warn(proc.stderr)
+ msg = 'Error executing {!r}: '.format(shlex.join(cmd)) + proc.stderr
+ module.warn(msg)
if proc.returncode:
return