Skip to content
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

IndexError: list index out of range in compliance-script #134

Closed
zagro1 opened this issue Jan 4, 2024 · 1 comment · Fixed by #135
Closed

IndexError: list index out of range in compliance-script #134

zagro1 opened this issue Jan 4, 2024 · 1 comment · Fixed by #135

Comments

@zagro1
Copy link

zagro1 commented Jan 4, 2024

Hi,
Happy New Year!
When running compliance-script on some tenancy where LZ was not deployed I get an error:
File "./cis_reports.py", line 3378, in __search_resources_in_root_compartment
if item.identifier.split('.')[3]:
IndexError: list index out of range

The full output below:

python3 ./cis_reports.py -dt --regions eu-frankfurt-1

##########################################################################################

Running CIS Reports - Release 2.7.0

##########################################################################################
Version 2.7.0 Updated on November 20, 2023
Please use --help for more info

Tested oci-python-sdk version: 2.115.1
Installed oci-python-sdk version: 2.117.0
The command line arguments are: ['./cis_reports.py', '-dt', '--regions', 'eu-frankfurt-1']

Starts at 2024-01-04T15:27:57

Regions to run in: ['eu-frankfurt-1']
Home region for tenancy is eu-frankfurt-1
Creating regional signers and configs...

Processing Compartments...
Processed 20 Compartments
Processed Cloud Guard Configuration.

Processing Home Region resources...
Processing Identity Domains...
Processed Audit Configuration.
Processed 3 Availability Domains in eu-frankfurt-1
Processed 5 Dynamic Groups
Processed Tenancy Password Policy...
Processed 24 IAM Policies
Processed 2 Tag Defaults
Processed 12 Users

Processing regional resources...
Processed 6 Subscriptions
Processed 3 Event Rules
Processed 1 Vaults
Processed 0 Network Security Groups
Processed 46 Security Lists
Processed 0 Autonomous Databases
Processed 0 Analytics Instances
Processed 0 Integration Instance
Processed 0 Block Volumes
Processed 1 File Storage service
Processed 47 Network Subnets
Processed 3 Boot Volumes
Processed 4 Log Group Logs
Processed 20 Buckets
Traceback (most recent call last):
File "./cis_reports.py", line 3378, in __search_resources_in_root_compartment
if item.identifier.split('.')[3]:
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./cis_reports.py", line 5610, in
execute_report()
File "./cis_reports.py", line 5567, in execute_report
csv_report_directory = report.generate_reports(int(cmd.level))
File "./cis_reports.py", line 5321, in generate_reports
self.__collect_tenancy_data()
File "./cis_reports.py", line 4995, in __collect_tenancy_data
future.result()
File "/opt/rh/rh-python38/root/usr/lib64/python3.8/concurrent/futures/_base.py", line 437, in result
return self.__get_result()
File "/opt/rh/rh-python38/root/usr/lib64/python3.8/concurrent/futures/_base.py", line 389, in __get_result
raise self._exception
File "/opt/rh/rh-python38/root/usr/lib64/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "./cis_reports.py", line 4985, in execute_function
func()
File "./cis_reports.py", line 3387, in __search_resources_in_root_compartment
raise RuntimeError(
RuntimeError: Error in __search_resources_in_root_compartment ('list index out of range',)

The same error happens if I run it from CloudShell or from oci command line on laptop. Interestingly when I run this for just eu-amsterdam-1 then it works fine. Of course for all regions - does not.
The user profile used has even full admin rights to the tenancy. While --debug option provides some more info during the Identity processing it gives no additional hints for this error at all. Just context (comparing with output from Amsterdam) suggests it has something to do with Event Rules processing.

Regards

@Halimer
Copy link
Collaborator

Halimer commented Jan 4, 2024

Hi @zagro1 ,

In our next release, we will add improved error handling to resolve this issue. In that version, we will output the item that is causing the issue to the error_report.csv file.

Thank you.

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 a pull request may close this issue.

2 participants