diff --git a/parsedmarc/cli.py b/parsedmarc/cli.py index 19c406d9..908bd06b 100644 --- a/parsedmarc/cli.py +++ b/parsedmarc/cli.py @@ -222,30 +222,30 @@ def process_reports(reports_): smtp_tls_reports_) except splunk.SplunkError as e: logger.error("Splunk HEC error: {0}".format(e.__str__())) - if opts.la_dce: - try: - la_client = loganalytics.LogAnalyticsClient( - client_id=opts.la_client_id, - client_secret=opts.la_client_secret, - tenant_id=opts.la_tenant_id, - dce=opts.la_dce, - dcr_immutable_id=opts.la_dcr_immutable_id, - dcr_aggregate_stream=opts.la_dcr_aggregate_stream, - dcr_forensic_stream=opts.la_dcr_forensic_stream - ) - la_client.publish_results( - reports_, - opts.save_aggregate, - opts.save_forensic) - except loganalytics.LogAnalyticsException as e: - logger.error( - "Log Analytics error: {0}".format(e.__str__())) - except Exception as e: - logger.error( - "Unknown error occurred" + - " during the publishing" + - " to Log Analytics: " + - e.__str__()) + if opts.la_dce: + try: + la_client = loganalytics.LogAnalyticsClient( + client_id=opts.la_client_id, + client_secret=opts.la_client_secret, + tenant_id=opts.la_tenant_id, + dce=opts.la_dce, + dcr_immutable_id=opts.la_dcr_immutable_id, + dcr_aggregate_stream=opts.la_dcr_aggregate_stream, + dcr_forensic_stream=opts.la_dcr_forensic_stream + ) + la_client.publish_results( + reports_, + opts.save_aggregate, + opts.save_forensic) + except loganalytics.LogAnalyticsException as e: + logger.error( + "Log Analytics error: {0}".format(e.__str__())) + except Exception as e: + logger.error( + "Unknown error occurred" + + " during the publishing" + + " to Log Analytics: " + + e.__str__()) arg_parser = ArgumentParser(description="Parses DMARC reports") arg_parser.add_argument("-c", "--config-file",