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

Reporter: convert to class implementation (issue 166) #342

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions scubagoggles/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
from scubagoggles.auth import gws_auth
from scubagoggles.provider import Provider
from scubagoggles.run_rego import opa_eval
from scubagoggles.reporter import reporter, md_parser
from scubagoggles.reporter import md_parser
from scubagoggles.reporter.reporter import Reporter
from scubagoggles.utils import rel_abs_path


Expand Down Expand Up @@ -277,17 +278,16 @@ def _run_reporter(self):
products_bar = tqdm(products, leave=False, disable=args.quiet)
for product in products_bar:
products_bar.set_description(f"Creating the HTML and JSON Report for {product}...")
stats_and_data[product] = reporter.rego_json_to_ind_reports(
test_results_data,
product,
out_folder,
tenant_domain,
main_report_name,
prod_to_fullname,
baseline_policies[product],
successful_calls,
unsuccessful_calls
)
reporter = Reporter(product,
tenant_domain,
main_report_name,
prod_to_fullname,
baseline_policies[product],
successful_calls,
unsuccessful_calls)
stats_and_data[product] = \
reporter.rego_json_to_ind_reports(test_results_data,
out_folder)
baseline_product_summary = {product:stats_and_data[product][0]}
baseline_product_results_json = {product:stats_and_data[product][1]}
summary.update(baseline_product_summary)
Expand Down Expand Up @@ -323,9 +323,9 @@ def _run_reporter(self):
"Details": self._generate_summary(stats[0])
})

fragments.append(reporter.create_html_table(table_data))
fragments.append(Reporter.create_html_table(table_data))
with open(f"{report_path}", mode='w', encoding='UTF-8') as file:
file.write(reporter.build_front_page_html(fragments, tenant_info))
file.write(Reporter.build_front_page_html(fragments, tenant_info))

# suppress opening the report in the browser
if args.quiet:
Expand Down Expand Up @@ -359,7 +359,7 @@ def _run_cached(self):
if not os.path.exists(f'{args.outputpath}/{args.outputproviderfilename}.json'):
# When running run_cached, the provider output might not exist as a stand-alone
# file depending what version of ScubaGoggles created the output. If the provider
# ouptut doesn't exist as a standa-lone file, create it from the scuba results
# output doesn't exist as a standalone file, create it from the scuba results
# file so the other functions can execute as normal.
with open(f'{args.outputpath}/{args.outjsonfilename}.json', 'r',
encoding='UTF-8') as scuba_results:
Expand Down
Loading
Loading