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

[COST-4230] - add cluster-id to basic auth log message #4827

Merged
merged 1 commit into from
Dec 12, 2023
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
8 changes: 6 additions & 2 deletions koku/masu/external/kafka_msg_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,12 @@ def process_cr(report_meta):

auth_type = cr_status.get("authentication", {}).get("type")
if auth_type == "basic":
ctx = {"schema": report_meta.get("schema_name"), "provider_uuid": report_meta.get("provider_uuid")}
LOG.warning(log_json(report_meta.get("tracing_id"), msg="cluster is using basic auth", context=ctx))
ctx = {
"schema": report_meta.get("schema_name"),
"provider_uuid": report_meta.get("provider_uuid"),
"cluster_id": report_meta.get("cluster_id"),
}
LOG.info(log_json(report_meta.get("tracing_id"), msg="cluster is using basic auth", context=ctx))

return manifest_info

Expand Down
4 changes: 3 additions & 1 deletion koku/masu/test/external/test_kafka_msg_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,8 +895,10 @@ def test_extract_payload_content_and_process_cr(self):

# test that we warn when basic auth is being used:
report_meta["cr_status"]["authentication"]["type"] = "basic"
with self.assertLogs(logger="masu.external.kafka_msg_handler", level=logging.WARNING):
with self.assertLogs(logger="masu.external.kafka_msg_handler", level=logging.INFO) as log:
msg_handler.process_cr(report_meta)
self.assertEqual(len(log.output), 2)
self.assertIn("cluster is using basic auth", log.output[1])

def test_create_cost_and_usage_report_manifest(self):
manifest = Path("koku/masu/test/data/ocp/payload2/manifest.json")
Expand Down
Loading