Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit 2efa061

Browse files
committed
[client] Fix export artifacts
1 parent c0750a5 commit 2efa061

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

pycti/connector/opencti_connector_helper.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,14 +315,17 @@ def run(self) -> None:
315315
self.channel.start_consuming()
316316
except (KeyboardInterrupt, SystemExit):
317317
self.channel.stop_consuming()
318+
self.pika_connection.close()
318319
LOGGER.info("Connector stop")
319320
sys.exit(0)
320321
except Exception as err: # pylint: disable=broad-except
322+
self.pika_connection.close()
321323
LOGGER.error("%s", err)
322-
self.pika_connection.close()
324+
sys.exit(1)
323325

324326
def stop(self):
325327
self.exit_event.set()
328+
self.pika_connection.close()
326329
if self.thread:
327330
self.thread.join()
328331

@@ -433,7 +436,6 @@ def __init__(
433436
self.recover_iso_date = recover_iso_date
434437
self.with_inferences = with_inferences
435438
self.exit_event = threading.Event()
436-
self.exit = False
437439

438440
def run(self) -> None: # pylint: disable=too-many-branches
439441
try:
@@ -503,7 +505,7 @@ def run(self) -> None: # pylint: disable=too-many-branches
503505
)
504506
# Iter on stream messages
505507
for msg in messages:
506-
if self.exit:
508+
if self.exit_event.is_set():
507509
stream_alive.stop()
508510
break
509511
if msg.id is not None:
@@ -516,7 +518,7 @@ def run(self) -> None: # pylint: disable=too-many-branches
516518
# state can be None if reset from the UI
517519
# In this case, default parameters will be used but SSE Client needs to be restarted
518520
if state is None:
519-
self.exit = True
521+
self.exit_event.set()
520522
else:
521523
state["start_from"] = str(msg.id)
522524
self.helper.set_state(state)
@@ -533,7 +535,6 @@ def run(self) -> None: # pylint: disable=too-many-branches
533535
sys.excepthook(*sys.exc_info())
534536

535537
def stop(self):
536-
self.exit = True
537538
self.exit_event.set()
538539

539540

pycti/entities/opencti_stix_cyber_observable.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ def __init__(self, opencti, file):
155155
id
156156
name
157157
size
158+
metaData {
159+
mimetype
160+
version
161+
}
158162
}
159163
}
160164
}

0 commit comments

Comments
 (0)