Skip to content

Commit

Permalink
fix: Do not generate trigger manifest for connectors
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkheir committed Oct 20, 2023
1 parent 8206564 commit b6949d0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sekoia_automation/scripts/files_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,16 @@ def inspect_module(
modules: set[type[Module]],
actions: set[type[Action]],
triggers: set[type[Trigger]],
connectors: set[type[Connector]],
):
module = import_module(name)

for _, obj in getmembers(module, isclass):
if not isabstract(obj):
if issubclass(obj, Action):
actions.add(obj)
elif issubclass(obj, Connector):
connectors.add(obj)
elif issubclass(obj, Trigger):
triggers.add(obj)
elif issubclass(obj, Module) and obj != Module:
Expand All @@ -58,10 +61,11 @@ def execute(self):
modules = set()
actions = set()
triggers = set()
connectors = set()

for _, name, ispkg in walk_packages([self.base_path.as_posix()]):
if not ispkg and not (name == "tests" or name.startswith("tests.")):
self.inspect_module(name, modules, actions, triggers)
self.inspect_module(name, modules, actions, triggers, connectors)

if len(modules) != 1:
print("[bold red][!] Found 0 or more than 1 module, aborting[/bold red]")
Expand All @@ -71,7 +75,7 @@ def execute(self):
self.generate_main(module, actions, triggers)
self.generate_action_manifests(actions)
self.generate_trigger_manifests(triggers)
self.generate_connector_manifests(triggers)
self.generate_connector_manifests(connectors)
self.update_module_manifest(module)

sys.path = _old_path
Expand Down

0 comments on commit b6949d0

Please sign in to comment.