From ec841e5d7ab29d08de294b3fa863a631cd50e30a Mon Sep 17 00:00:00 2001 From: Jan Cholasta Date: Thu, 2 Jun 2016 10:12:26 +0200 Subject: ipaclient: implement thin client Dynamically create plugin package for the remote server with modules and commands based on the API schema when client API is finalizes. For in-tree API instances, use ipalib.plugins directly. https://fedorahosted.org/freeipa/ticket/4739 Reviewed-By: David Kupka --- ipalib/__init__.py | 15 ++++++++++----- ipalib/plugable.py | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'ipalib') diff --git a/ipalib/__init__.py b/ipalib/__init__.py index dffe2315e..0070e62db 100644 --- a/ipalib/__init__.py +++ b/ipalib/__init__.py @@ -907,15 +907,20 @@ class API(plugable.API): @property def packages(self): - import ipalib.plugins - result = (ipalib.plugins,) - if self.env.in_server: + import ipalib.plugins import ipaserver.plugins - result += (ipaserver.plugins,) + result = ( + ipalib.plugins, + ipaserver.plugins, + ) else: + import ipaclient.remote_plugins import ipaclient.plugins - result += (ipaclient.plugins,) + result = ( + ipaclient.remote_plugins.get_package(self), + ipaclient.plugins, + ) if self.env.context in ('installer', 'updates'): import ipaserver.install.plugins diff --git a/ipalib/plugable.py b/ipalib/plugable.py index b248a2c28..497b5450e 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -524,7 +524,7 @@ class API(ReadOnly): ) self.log.debug("importing all plugin modules in %s...", package_name) - modules = find_modules_in_dir(package_dir) + modules = getattr(package, 'modules', find_modules_in_dir(package_dir)) modules = ['.'.join((package_name, name)) for name in modules] for name in modules: -- cgit