From 670ae45d62bc13d8be21fc790308acb6cc50cb8c Mon Sep 17 00:00:00 2001 From: Moshe-Rappaport-CA Date: Wed, 2 Nov 2022 16:27:40 +0200 Subject: [PATCH] remove --submit from msg when not submitted --- core/core/initutils.go | 2 +- core/pkg/resultshandling/reporter/v2/mockreporter.go | 7 +++++-- .../reporter/v2/reporteventreceiver_test.go | 10 ---------- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/core/core/initutils.go b/core/core/initutils.go index 079f2015..2bd4f8af 100644 --- a/core/core/initutils.go +++ b/core/core/initutils.go @@ -69,7 +69,7 @@ func getReporter(tenantConfig cautils.ITenantConfig, reportID string, submit, fw } if tenantConfig.GetAccountID() == "" { // Add link only when scanning a cluster using a framework - return reporterv2.NewReportMock(reporterv2.NO_SUBMIT_QUERY, "run kubescape with the '--submit' flag") + return reporterv2.NewReportMock("https://hub.armosec.io/docs/installing-kubescape", "run kubescape with the '--account' flag") } var message string if !fwScan { diff --git a/core/pkg/resultshandling/reporter/v2/mockreporter.go b/core/pkg/resultshandling/reporter/v2/mockreporter.go index 3824e879..92899d22 100644 --- a/core/pkg/resultshandling/reporter/v2/mockreporter.go +++ b/core/pkg/resultshandling/reporter/v2/mockreporter.go @@ -44,8 +44,11 @@ func (reportMock *ReportMock) DisplayReportURL() { sep := "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" message := sep + "\n" message += "Scan results have not been submitted: " + reportMock.message + "\n" - message += "Sign up for free: " - message += reportMock.GetURL() + "\n" + if reportMock.query != "" { + message += "For more details: " + reportMock.query + "\n" + } + // message += "Sign up for free: " + // message += reportMock.GetURL() + "\n" message += sep + "\n" cautils.InfoTextDisplay(os.Stderr, fmt.Sprintf("\n%s\n", message)) } diff --git a/core/pkg/resultshandling/reporter/v2/reporteventreceiver_test.go b/core/pkg/resultshandling/reporter/v2/reporteventreceiver_test.go index d64a4f13..dc7c13f9 100644 --- a/core/pkg/resultshandling/reporter/v2/reporteventreceiver_test.go +++ b/core/pkg/resultshandling/reporter/v2/reporteventreceiver_test.go @@ -105,14 +105,4 @@ func TestGetURL(t *testing.T) { ) assert.Equal(t, "https://cloud.armosec.io/account/sign-up?customerGUID=1234&invitationToken=token&utm_campaign=Submit&utm_medium=CLI&utm_source=GitHub", reporter.GetURL()) } - // Test None submit url - { - reporter := NewReportMock(NO_SUBMIT_QUERY, "") - assert.Equal(t, "https://cloud.armosec.io/account/sign-up?utm_source=GitHub&utm_medium=CLI&utm_campaign=no_submit", reporter.GetURL()) - } - // Test None report url - { - reporter := NewReportMock("", "") - assert.Equal(t, "https://cloud.armosec.io/account/sign-up", reporter.GetURL()) - } }