Compare commits

..

3 Commits

Author SHA1 Message Date
Ferdinand Thiessen 2880076705 [cli] Fix exporting of plugin interfaces
Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
2022-07-31 19:07:40 +02:00
Ferdinand Thiessen fa503fe142 [cli] Added install command to install the database and all plugins
Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
2022-07-31 19:07:40 +02:00
Ferdinand Thiessen f1d6b6a2f2 [plugins][cli] Fix initial migration file + Make sure plugin permissions are installed
Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
2022-07-31 19:07:32 +02:00
6 changed files with 12 additions and 11 deletions

View File

@ -1,4 +1,5 @@
import click
from importlib_metadata import entry_points
@click.command()
@ -8,14 +9,21 @@ import click
@click.option("--no-core", help="Skip models / types from flaschengeist core", is_flag=True)
def export(namespace, output, no_core, plugin):
from flaschengeist import logger, models
from flaschengeist.app import get_plugins
from .InterfaceGenerator import InterfaceGenerator
gen = InterfaceGenerator(namespace, output, logger)
if not no_core:
gen.run(models)
if plugin:
for plugin_class in get_plugins():
if (len(plugin) == 0 or plugin_class.id in plugin) and plugin_class.models is not None:
gen.run(plugin_class.models)
for entry_point in entry_points(group="flaschengeist.plugins"):
if len(plugin) == 0 or entry_point.name in plugin:
try:
plugin = entry_point.load()
gen.run(plugin.models)
except:
logger.error(
f"Plugin {entry_point.name} could not be loaded due to an error.",
exc_info=True,
)
continue
gen.write()

View File

@ -13,7 +13,6 @@ from flaschengeist.controller import sessionController, userController
class AuthRoutePlugin(Plugin):
id = "dev.flaschengeist.auth"
blueprint = Blueprint("auth", __name__)

View File

@ -14,8 +14,6 @@ from flaschengeist import logger
class AuthPlain(AuthPlugin):
id = "auth_plain"
def install(self):
plugins_installed(self.post_install)

View File

@ -16,7 +16,6 @@ from . import permissions
class RolesPlugin(Plugin):
id = "roles"
blueprint = Blueprint("roles", __name__)
permissions = permissions.permissions

View File

@ -39,8 +39,6 @@ def scheduled(id: str, replace=False, **kwargs):
class SchedulerPlugin(Plugin):
id = "scheduler"
def __init__(self, entry_point, config=None):
super().__init__(entry_point, config)
self.blueprint = Blueprint(self.name, __name__)

View File

@ -18,7 +18,6 @@ from flaschengeist.utils.datetime import from_iso_format
class UsersPlugin(Plugin):
id = "users"
blueprint = Blueprint("users", __name__)
permissions = permissions.permissions