-
Notifications
You must be signed in to change notification settings - Fork 11
feat: add core lib handling #448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
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) |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
The main goal for this change is to handle libs in unified way