Skip to content

Commit

Permalink
fix version issue for automatic connector install
Browse files Browse the repository at this point in the history
This is a patch from Kestrel side. A upstream patch on stix-shifter will
be better preventing the issue:
opencybersecurityalliance/stix-shifter#1087
  • Loading branch information
subbyte committed Aug 29, 2022
1 parent 1bbfa7a commit 342be5e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/kestrel_datasource_stixshifter/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import importlib
import subprocess
import requests
import pkg_resources
from lxml import html

from kestrel.exceptions import DataSourceError
Expand Down Expand Up @@ -69,10 +70,14 @@ def check_module_availability(connector_name):

verify_package_origin(connector_name)

_logger.info(f'install Python package "{package_name}".')
stixshifter_version = pkg_resources.get_distribution("stix_shifter").version

package_w_ver = package_name + "==" + stixshifter_version

_logger.info(f'install Python package "{package_w_ver}".')
try:
subprocess.check_call(
[sys.executable, "-m", "pip", "install", package_name]
[sys.executable, "-m", "pip", "install", package_w_ver]
)
except:
_logger.info("package installation with 'pip' failed.")
Expand Down

0 comments on commit 342be5e

Please sign in to comment.