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

RHINENG-8858 Skip cloud-connector connection attempt when RHCID is empty #158

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

r14chandra
Copy link
Collaborator

@r14chandra r14chandra commented Apr 10, 2024

Why do we need this change? 💭

We should try to process messages only when a host is connected via Cloud Connector i.e. rhc_client_id should be there else it would give us a connection status error.

{"level":"info","module":"inventory-consumer","offset":10,"event_type":"created","time":"2024-04-10T11:02:49+05:30","message":"setting up new host for remote host configuration"}
{"level":"trace","http_client":"cloud-connector","method":"GET","url":"http://127.0.0.1:8084/api/cloud-connector/v2/connections/4b1efbbe-a447-48d0-98c3-3594aae1d2c5/status","headers":{"X-Rh-Cloud-Connector-Client-Id":["suraj"],"X-Rh-Cloud-Connector-Org-Id":["0002"],"X-Rh-Cloud-Connector-Psk":["surajskey"],"X-Rh-Insights-Request-Id":["c1364858-e305-4e2e-b40a-0fcc86c37376"]},"time":"2024-04-10T11:02:49+05:30","caller":"/home/rohinichandra/Rohini/config-manager/infrastructure/persistence/cloudconnector/cloudconnector.go:105","message":"sending HTTP request"}
{"level":"trace","http_client":"cloud-connector","method":"GET","url":"http://127.0.0.1:8084/api/cloud-connector/v2/connections/4b1efbbe-a447-48d0-98c3-3594aae1d2c5/status","headers":{"X-Rh-Cloud-Connector-Client-Id":["suraj"],"X-Rh-Cloud-Connector-Org-Id":["0002"],"X-Rh-Cloud-Connector-Psk":["surajskey"],"X-Rh-Insights-Request-Id":["c1364858-e305-4e2e-b40a-0fcc86c37376"]},"http_status":"OK","headers":{"Content-Length":["26"],"Content-Type":["application/json; charset=UTF-8"],"Date":["Wed, 10 Apr 2024 05:32:49 GMT"],"X-Rh-Insights-Request-Id":["c1364858-e305-4e2e-b40a-0fcc86c37376"]},"response":"{\"status\":\"disconnected\"}\n","time":"2024-04-10T11:02:49+05:30","caller":"/home/rohinichandra/Rohini/config-manager/infrastructure/persistence/cloudconnector/cloudconnector.go:119","message":"received HTTP response"}
.
.
.
.
{"level":"debug","org_id":"0002","subscription_manager_id":"4b1efbbe-a447-48d0-98c3-3594aae1d2c5","status":"disconnected","dispatchers":null,"time":"2024-04-10T11:05:19+05:30","caller":"/home/rohinichandra/Rohini/config-manager/internal/host.go:125","message":"connection status from cloud-connector"}
{"level":"error","module":"inventory-consumer","offset":10,"event_type":"created","error":"cannot get connected status after 3m0.03522911s, aborting","host":{"id":"19e2d2f6-476a-4ce8-8f70-a48e0959fea9","account":"111000","org_id":"0002","display_name":"ip-172-31-28-69.ec2.internal","reporter":"puptoo","per_reporter_staleness":{"puptoo":{"check_in_succeeded":true,"culled_timestamp":"2024-04-24T05:32:49.579606+00:00","last_check_in":"2024-04-10T05:32:49.579606+00:00","stale_timestamp":"2024-04-11T10:32:49.579606+00:00","stale_warning_timestamp":"2024-04-17T05:32:49.579606+00:00"}},"subscription_manager_id":"4b1efbbe-a447-48d0-98c3-3594aae1d2c5","system_profile":{"rhc_client_id":"","rhc_config_state":""}},"time":"2024-04-10T11:05:49+05:30","caller":"/home/rohinichandra/Rohini/config-manager/internal/cmd/inventoryconsumer/cmd.go:84","message":"cannot set up host"}

Documentation update? 📝

  • Yes
  • No

💂‍♂️ Checklist 🎯

  • Bugfix
  • New Feature
  • Refactor
  • Unittests Added
  • DRY code
  • Dependency Added
  • DB Migration Added

Additional 📣

Feel free to add any other relevant details such as links, notes, screenshots, here.

@r14chandra r14chandra requested a review from subpop April 10, 2024 12:53
Copy link
Collaborator

@subpop subpop left a comment

Choose a reason for hiding this comment

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

This sounds reasonable to me. In theory, I agree with this change, but in full disclosure, I did not run the code under any test conditions to verify the desired behavior. I also did not deeply scrutinize the changes, however I read the function flow-of-control in the changed state. I'll leave an approval here, but it might be worth getting another review if you're still unsure about the logical change.

@r14chandra
Copy link
Collaborator Author

/retest

@r14chandra
Copy link
Collaborator Author

Thanks for the review @subpop! I will merge the PR and I will ask @Ichimonji10 to test it.

@r14chandra r14chandra merged commit bd752e2 into RedHatInsights:master Apr 12, 2024
4 checks passed
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