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

feat(report interface): add reporting interface call after report #2948

Merged
merged 2 commits into from
Oct 23, 2023

Conversation

n4ch04
Copy link
Contributor

@n4ch04 n4ch04 commented Oct 19, 2023

Context

We need to have a more flexible custom report interface to suit our needs

Description

Import the custom report interface after report native function has been performed

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@n4ch04 n4ch04 requested a review from a team October 19, 2023 13:51
@n4ch04 n4ch04 force-pushed the change-interface-reporting branch from a8e17fc to 18daf43 Compare October 19, 2023 14:01
@codecov
Copy link

codecov bot commented Oct 19, 2023

Codecov Report

Merging #2948 (30a7789) into master (54fe10a) will increase coverage by 0.00%.
Report is 7 commits behind head on master.
The diff coverage is 50.00%.

@@           Coverage Diff            @@
##           master    #2948    +/-   ##
========================================
  Coverage   86.26%   86.26%            
========================================
  Files         551      559     +8     
  Lines       17652    17910   +258     
========================================
+ Hits        15227    15450   +223     
- Misses       2425     2460    +35     
Files Coverage Δ
...viders/aws/services/awslambda/awslambda_service.py 86.95% <100.00%> (+0.11%) ⬆️
...curitygroup_not_used/ec2_securitygroup_not_used.py 100.00% <100.00%> (ø)
prowler/lib/check/check.py 46.15% <18.18%> (-1.22%) ⬇️

... and 22 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Comment on lines 563 to 565
lib = os.environ["PROWLER_REPORT_LIB_PATH"]
outputs_module = importlib.import_module(lib)
curstom_report_interface = getattr(outputs_module, "report")
Copy link
Member

Choose a reason for hiding this comment

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

I think you have to handle more than a generic Exception here not to abort the execution if the "PROWLER_REPORT_LIB_PATH" is not present or if the import or getattr fails.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since the general report function is imported always we actually want Prowler to exit the execution if something wrong happens there

@n4ch04 n4ch04 force-pushed the change-interface-reporting branch from 68acad2 to 18daf43 Compare October 20, 2023 07:35
@n4ch04 n4ch04 requested a review from jfagoagas October 20, 2023 08:06
Copy link
Member

@jfagoagas jfagoagas left a comment

Choose a reason for hiding this comment

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

Smart move!

@n4ch04 n4ch04 merged commit 4746b8b into master Oct 23, 2023
@n4ch04 n4ch04 deleted the change-interface-reporting branch October 23, 2023 07:06
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