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

[MWTELE-48]: Do not create report if cert/key not present and report cannot be sent. #41

Merged
merged 1 commit into from
Mar 17, 2023

Conversation

ehsavoie
Copy link
Collaborator

  • InsightsMultiClient checks that at leat one of the client is ready.
  • InsightsFileWritingClient checks that the Insights certificates are present.

Jira: https://issues.redhat.com/browse/MWTELE-48

Copy link
Contributor

@mnovak1 mnovak1 left a comment

Choose a reason for hiding this comment

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

One comment. Otherwise LGTM.

We might also consider improvement in InsightsMultiClient.sendInsightsReport() (https://github.com/RedHatInsights/insights-java-client/blob/main/api/src/main/java/com/redhat/insights/http/InsightsMultiClient.java#L38) to filter clients which "are not ready" to sent.

@Override
public boolean isReadyToSend() {
return new File(config.getCertFilePath()).exists()
&& new File(config.getKeyFilePath()).exists();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that for file upload the location of cert/key is given and we should use defaults:
InsightsConfiguration.DEFAULT_RHEL_CERT_FILE_PATH and InsightsConfiguration.DEFAULT_RHEL_KEY_FILE_PATH

pointing to key and cert in /etc/pki/consumer directory. Retrieving it from configuration might be overriden by env/system properties.

We should investigate also https://github.com/RedHatInsights/insights-ingress-java/issues/126 to improve this logic.

Copy link
Collaborator

@kittylyst kittylyst left a comment

Choose a reason for hiding this comment

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

This appears to contain a bug.

@Override
public boolean isReadyToSend() {
return new File(configuration.getCertFilePath()).exists()
&& new File(configuration.getKeyFilePath()).exists();
Copy link
Collaborator

Choose a reason for hiding this comment

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

How will this code work if we're using token-based auth & there are no certs?

…cannot be sent.

 * InsightsMultiClient checks that at leat one of the client is ready.
 * InsightsFileWritingClient checks that the Insights certificates are present.
 * InsightsJdkHttpClient checks that the Insights certificates are
   present or that a token is being used.

Jira: https://issues.redhat.com/browse/MWTELE-48

Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
Copy link
Collaborator

@kittylyst kittylyst left a comment

Choose a reason for hiding this comment

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

LGTM.

@kittylyst kittylyst merged commit 22f196f into RedHatInsights:main Mar 17, 2023
@jponge jponge added this to the 1.0.0.Beta3 milestone Mar 30, 2023
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.

4 participants