From 3b0e186281861681e23dea8cee26ada6aadf397d Mon Sep 17 00:00:00 2001 From: dcore94 Date: Mon, 22 Mar 2021 16:36:35 +0100 Subject: [PATCH] passing config to all plugins --- pyexecplugins/Ansible.py | 4 ++-- pyexecplugins/Eval.py | 4 ++-- pyexecplugins/Http.py | 4 ++-- pyexecplugins/Packer.py | 4 ++-- pyexecplugins/Shell.py | 4 ++-- pyexecplugins/pyexecplugins.py | 3 ++- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/pyexecplugins/Ansible.py b/pyexecplugins/Ansible.py index 17288f2..db1176b 100644 --- a/pyexecplugins/Ansible.py +++ b/pyexecplugins/Ansible.py @@ -54,8 +54,8 @@ class Ansible(PyExecPlugin): "ownerEmail" : "m.lettere@gmail.com" } - def __init__(self, data=None): - super().__init__(data) + def __init__(self, data=None, config=None): + super().__init__(data, config) self.playbook = self.data.get("playbook") self.hosts = self.data.get("hosts", ["localhost"]) self.connection = self.data.get("connection","local") diff --git a/pyexecplugins/Eval.py b/pyexecplugins/Eval.py index 7537cd1..ea02a15 100644 --- a/pyexecplugins/Eval.py +++ b/pyexecplugins/Eval.py @@ -11,8 +11,8 @@ class Plugin(PyExecPlugin): "ownerEmail" : "m.lettere@gmail.com" } - def __init__(self, data=None): - super().__init__(data) + def __init__(self, data=None, config=None): + super().__init__(data, config) def execute(self): code = self.data.get("code") diff --git a/pyexecplugins/Http.py b/pyexecplugins/Http.py index c3401b8..fc1c7dd 100644 --- a/pyexecplugins/Http.py +++ b/pyexecplugins/Http.py @@ -14,8 +14,8 @@ class Plugin(PyExecPlugin): "ownerEmail" : "m.lettere@gmail.com" } - def __init__(self, data): - super().__init__(data) + def __init__(self, data, config=None): + super().__init__(data, config) self.method = data.get("method") or "get" self.url = data.get("url") self.headers = data.get("headers") or {} diff --git a/pyexecplugins/Packer.py b/pyexecplugins/Packer.py index f362781..eb478fe 100644 --- a/pyexecplugins/Packer.py +++ b/pyexecplugins/Packer.py @@ -17,8 +17,8 @@ class Plugin(PyExecPlugin): "ownerEmail" : "m.lettere@gmail.com" } - def __init__(self, data=None): - super().__init__(data) + def __init__(self, data=None, config=None): + super().__init__(data, config) self.template = data["template"] self.command = data.get("command", "build") self.extra_vars = data.get("extra_vars", {}) diff --git a/pyexecplugins/Shell.py b/pyexecplugins/Shell.py index 28b08ff..dc9f74c 100644 --- a/pyexecplugins/Shell.py +++ b/pyexecplugins/Shell.py @@ -14,8 +14,8 @@ class Plugin(PyExecPlugin): "ownerEmail" : "m.lettere@gmail.com" } - def __init__(self, data=None): - super().__init__(data) + def __init__(self, data=None, config=None): + super().__init__(data, config) def execute(self): results = [] diff --git a/pyexecplugins/pyexecplugins.py b/pyexecplugins/pyexecplugins.py index 9844b22..738a4df 100644 --- a/pyexecplugins/pyexecplugins.py +++ b/pyexecplugins/pyexecplugins.py @@ -53,8 +53,9 @@ class PyExecPlugins(type): logging.getLogger("pyexec").warning("Unable to register task defs %s", e) class PyExecPlugin(object, metaclass=PyExecPlugins): - def __init__(self, data=None): + def __init__(self, data=None, config=None): self.data = data + self.config = config def hasDefinition(self): return (self.taskdef is not None)