mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Added Plugin.call() method that calls an external executable via subprocess.call()
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user