summaryrefslogtreecommitdiffstats
path: root/ipalib/plugable.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-11-06 11:57:21 -0700
committerJason Gerard DeRose <jderose@redhat.com>2008-11-06 11:57:21 -0700
commit5bdf860647c5d5825791d50a94b34fbd9a7a71a9 (patch)
treec7345b3cdb4a855ea3b6748ba2870a7bdefa3a24 /ipalib/plugable.py
parentd10a5131f8d7d6eba4eea23789c7ea0497f926af (diff)
downloadfreeipa-5bdf860647c5d5825791d50a94b34fbd9a7a71a9.tar.gz
freeipa-5bdf860647c5d5825791d50a94b34fbd9a7a71a9.tar.xz
freeipa-5bdf860647c5d5825791d50a94b34fbd9a7a71a9.zip
Added Plugin.call() method that calls an external executable via subprocess.call()
Diffstat (limited to 'ipalib/plugable.py')
-rw-r--r--ipalib/plugable.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/ipalib/plugable.py b/ipalib/plugable.py
index 08a978ed1..5e0611f91 100644
--- a/ipalib/plugable.py
+++ b/ipalib/plugable.py
@@ -32,6 +32,7 @@ import threading
import logging
import os
from os import path
+import subprocess
import errors
from errors import check_type, check_isinstance
from config import Environment, Env
@@ -366,6 +367,16 @@ class Plugin(ReadOnly):
assert not hasattr(self, name)
setattr(self, name, getattr(api, name))
+ def call(self, *args):
+ """
+ Call an external command via ``subprocess.call``.
+
+ Returns the exit status of the call.
+ """
+ if hasattr(self, 'log'):
+ self.log.debug('Calling %r', args)
+ return subprocess.call(args)
+
def __repr__(self):
"""
Return 'module_name.class_name()' representation.