Skip to content

Commit b3d7603

Browse files
abyrne55claude
andcommitted
Fix servicelog link validation for blocked egress URLs
When osdctl network verify-egress detects blocked egress URLs and attempts to send a service log, the link validator was failing because it tried to validate the egress URLs being reported. These URLs may return HTTP error codes (like 404) that fail link validation but are acceptable for egress verification purposes (a 404 still confirms successful TCP connectivity). Changes: - Export SkipLinkCheck field in PostCmdOptions (was skipLinkCheck) to allow other packages to set it - Set SkipLinkCheck=true when generating service logs for blocked egress URLs in verify-egress command This allows the service log to be sent successfully even when the egress URLs in the message body would fail link validation, since those URLs are intended for network connectivity verification rather than documentation. Fixes: SREP-2372 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 2a82df8 commit b3d7603

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

cmd/network/verification.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ func generateServiceLog(out *output.Output, clusterId string) servicelog.PostCmd
310310
Template: blockedEgressTemplateUrl,
311311
ClusterId: clusterId,
312312
TemplateParams: []string{fmt.Sprintf("URLS=%v", strings.Join(egressUrls, ","))},
313+
SkipLinkCheck: true,
313314
}
314315
}
315316
return servicelog.PostCmdOptions{}

cmd/network/verification_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,7 @@ func Test_generateServiceLog(t *testing.T) {
572572
Template: blockedEgressTemplateUrl,
573573
TemplateParams: []string{"URLS=storage.googleapis.com:443"},
574574
ClusterId: testClusterId,
575+
SkipLinkCheck: true,
575576
},
576577
},
577578
{
@@ -585,6 +586,7 @@ func Test_generateServiceLog(t *testing.T) {
585586
Template: blockedEgressTemplateUrl,
586587
TemplateParams: []string{"URLS=storage.googleapis.com:443,console.redhat.com:443,s3.amazonaws.com:443"},
587588
ClusterId: testClusterId,
589+
SkipLinkCheck: true,
588590
},
589591
},
590592
}

cmd/servicelog/post.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type PostCmdOptions struct {
4545
clustersFile string
4646
InternalOnly bool
4747
ClusterId string
48-
skipLinkCheck bool
48+
SkipLinkCheck bool
4949

5050
// Messaged clusters
5151
successfulClusters map[string]string
@@ -96,7 +96,7 @@ func newPostCmd() *cobra.Command {
9696
postCmd.Flags().StringArrayVarP(&opts.filterFiles, "query-file", "f", []string{}, "File containing search queries to apply. All lines in the file will be concatenated into a single query. If this flag is called multiple times, every file's search query will be combined with logical AND.")
9797
postCmd.Flags().StringVarP(&opts.clustersFile, "clusters-file", "c", "", `Read a list of clusters to post the servicelog to. the format of the file is: {"clusters":["$CLUSTERID"]}`)
9898
postCmd.Flags().BoolVarP(&opts.InternalOnly, "internal", "i", false, "Internal only service log. Use MESSAGE for template parameter (eg. -p MESSAGE='My super secret message').")
99-
postCmd.Flags().BoolVar(&opts.skipLinkCheck, "skip-link-check", false, "Skip validating if links in Service Log are valid")
99+
postCmd.Flags().BoolVar(&opts.SkipLinkCheck, "skip-link-check", false, "Skip validating if links in Service Log are valid")
100100

101101
return postCmd
102102
}
@@ -245,7 +245,7 @@ func (o *PostCmdOptions) Run() error {
245245
}
246246

247247
// Validate links in service log unless skipped via '--skip-link-check'
248-
if !o.skipLinkCheck {
248+
if !o.SkipLinkCheck {
249249
lv := link_validator.NewLinkValidator()
250250
messageText := o.Message.Summary + " " + o.Message.Description
251251
warnings, err := lv.ValidateLinks(messageText)

0 commit comments

Comments
 (0)