Add config support to transform run

graph_inquiry.py, init_db.py, and osintbuddy-plugins
This commit is contained in:
jerlendds
2024-01-21 11:13:04 -07:00
parent 034563d910
commit 3f1b9e89c8
3 changed files with 5 additions and 6 deletions

View File

@@ -8,7 +8,7 @@ from gremlin_python.process.graph_traversal import __ as _g
from gremlin_python.process.traversal import P
from gremlin_python.process.traversal import T, Cardinality
from osintbuddy.utils import to_snake_case, MAP_KEY, chunks
from osintbuddy import EntityRegistry, TransformUse
from osintbuddy import EntityRegistry, TransformUse, EntityConfig
from osintbuddy.errors import OBPluginError
from sqlalchemy.orm import Session
from starlette import status
@@ -267,7 +267,7 @@ async def nodes_transform(
transform_result = await plugin.run_transform(
transform_type=transform_type,
transform_context=entity_context,
use=TransformUse(get_driver=deps.get_driver)
use=TransformUse(get_driver=deps.get_driver, config=EntityConfig(enabled=False, test=1, test2="two"))
)
async def create_entity_data(
graph: AsyncGraphTraversal,

View File

@@ -2,8 +2,7 @@ import inspect, time, importlib, imp
import requests
from sqlalchemy.orm import Session
from osintbuddy.utils import to_snake_case
from osintbuddy.plugins import EntityRegistry, load_plugin_source, get_plugin
from osintbuddy.plugins import EntityRegistry
from app import crud, schemas
from app.core.logger import get_logger
@@ -37,7 +36,7 @@ def init_db(db: Session) -> None:
entity_count = crud.entities.count_all(db)[0][0]
if entity_count < 14:
for file_endpoint in core_entity_files:
log.info(f"Saving core plugin/entity: {file_endpoint}")
log.info(f"Saving core plugin/entity file: {file_endpoint}")
try:
resp = requests.get(core_ob_url + file_endpoint + ".py")
source_file = open(f"/app/app/plugins/{file_endpoint}.py", "w+")