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

fix(client): Display correct Insights URL #4297

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

pkoprda
Copy link
Contributor

@pkoprda pkoprda commented Dec 5, 2024

All Pull Requests:

Check all that apply:

  • Have you followed the guidelines in our Contributing document, including the instructions about commit messages?
  • No Sensitive Data in this change?
  • Is this PR to correct an issue?
  • Is this PR an enhancement?

Complete Description of Additions/Changes:

  • Card ID: CCT-1008

With the introduction of IoP, the insights-client should display the correct URL for the respective environment. The client differentiates between Hosted, Stage Hosted, and IoP environments during registration.

@codecov-commenter
Copy link

codecov-commenter commented Dec 5, 2024

Codecov Report

Attention: Patch coverage is 16.66667% with 5 lines in your changes missing coverage. Please review.

Project coverage is 76.97%. Comparing base (9c64871) to head (650b329).

Files with missing lines Patch % Lines
insights/client/client.py 16.66% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4297      +/-   ##
==========================================
- Coverage   76.98%   76.97%   -0.02%     
==========================================
  Files         735      735              
  Lines       41306    41311       +5     
  Branches     8772     8773       +1     
==========================================
- Hits        31801    31800       -1     
- Misses       8439     8444       +5     
- Partials     1066     1067       +1     
Flag Coverage Δ
unittests 76.96% <16.66%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jenkins-qa-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@xiangce xiangce added the client These issues represent work to be done by the "client" team. label Dec 9, 2024
Copy link
Contributor

@m-horky m-horky left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@Glutexo Glutexo left a comment

Choose a reason for hiding this comment

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

Matyáš gave ✅, so I am only giving a comment. I’d consider the URL parsing, but since we’re only dealing with know Red Hat URLs, in is probably fine.

I didn’t test running --register against stage. Unfortunately, I don’t know how to configure RHSM and the Client to connect to stage. If you know, please tell me.

Comment on lines +435 to +440
if "stage" in config.base_url:
console_url = "https://console.stage.redhat.com/insights/"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I‘d go with something more robust like

Suggested change
if "stage" in config.base_url:
console_url = "https://console.stage.redhat.com/insights/"
hostname = urlparse(config.base_url).hostname
if hostname.endswith("stage.redhat.com"):
console_url = "https://console.stage.redhat.com/insights/"

I’d even consider a function in insights.client.config and an enum with PRODUCTION, STAGE, SATELLITE options. I’ll utilize that in my CCT-963. That’d be over the scope of this simple PR though.

* Card ID: CCT-1008

With the introduction of IoP, the `insights-client` should display the
correct URL for the respective environment. The client differentiates
between Hosted, Stage Hosted, and IoP environments during registration.

Signed-off-by: pkoprda <[email protected]>
Copy link

@zpetrace zpetrace left a comment

Choose a reason for hiding this comment

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

LGTM from a QE POV, added a verification comment to the corresponding CCT card:)

@Glutexo
Copy link
Collaborator

Glutexo commented Jan 6, 2025

🎉 Merge? @xiangce

@xiangce xiangce merged commit 5be3260 into RedHatInsights:master Jan 7, 2025
12 of 16 checks passed
@Glutexo
Copy link
Collaborator

Glutexo commented Jan 7, 2025

Thanks! ❤️

xiangce pushed a commit that referenced this pull request Jan 9, 2025
* Card ID: CCT-1008

With the introduction of IoP, the `insights-client` should display the
correct URL for the respective environment. The client differentiates
between Hosted, Stage Hosted, and IoP environments during registration.

Signed-off-by: pkoprda <[email protected]>
(cherry picked from commit 5be3260)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client These issues represent work to be done by the "client" team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants