Skip to content

Conversation

wtobis-splunk
Copy link

The main goal for this change is to handle libs in unified way

This way, even if the TA path added to sys.path contains the specified library,
Python will always reference the already cached library from the Splunk Python path.
"""
lib_module = importlib.import_module(lib_name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if this way of importing wouldn't cause issue in the future if, for any reason, we'd like to override some library that comes with Splunk

I'd be more comfortable with something that just checks if there is a possibility to import rather than importing (eg. importlib.util.find_spec)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now we're doing something opposite - we're overriding our libraries with the ones from Splunk. In this case if some lib does not exists, it is an error and should be found during testing

pass


def handle_splunk_provided_lib(lib_name: str):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do believe that should be more meaningful what it does underneath - warning ... maybe even alerting - like: delete_addon_lib

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete is not the correct word here, as deleting is just a part of the job to be done. We should find a word for both importing new one and removing leftovers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants