URL:
https://github.com/SSSD/sssd/pull/5845
Title: #5845: sss-analyze: Fix self imports
justin-stephenson commented:
"""
@justin-stephenson, there is the circular import on the recent change
exposed with this PR:
```
[root@master1 /]# sssctl analyze
NOTE: Tevent chain ID support missing, request analysis will be limited.
It is recommended to use the --logdir option against tevent chain ID supported SSSD
logs.
Traceback (most recent call last):
File "/usr/libexec/sssd/sss_analyze", line 3, in <module>
from sssd import sss_analyze
File "/usr/lib/python3/site-packages/sssd/sss_analyze.py", line 3, in
<module>
from sssd.modules import request
File "/usr/lib/python3/site-packages/sssd/modules/request.py", line 6, in
<module>
from sssd.sss_analyze import SubparsersAction
ImportError: cannot import name 'SubparsersAction' from partially initialized
module 'sssd.sss_analyze' (most likely due to a circular import)
(/usr/lib/python3/site-packages/sssd/sss_analyze.py)
Command '/usr/libexec/sssd/sss_analyze' failed with [1]
```
I can fix this properly if I can push to your PR here.
class SubparsersAction and class Option can be moved to a separate file(like parser.py),
the Analyzer() instance can be passed as an argument to RequestAnalyzer setup_args()
therefore we don't need to import Analyzer in modules/request
"""
See the full comment at
https://github.com/SSSD/sssd/pull/5845#issuecomment-996048609