MCPcopy Create free account
hub / github.com/conforma/cli / SetImageAccessibleCheckFromError

Method SetImageAccessibleCheckFromError

internal/output/output.go:93–114  ·  view source on GitHub ↗

SetImageAccessibleCheck sets the passed and result.message fields of the ImageAccessibleCheck to the given values.

(err error)

Source from the content-addressed store, hash-verified

91
92// SetImageAccessibleCheck sets the passed and result.message fields of the ImageAccessibleCheck to the given values.
93func (o *Output) SetImageAccessibleCheckFromError(err error) {
94 metadata := map[string]interface{}{
95 "code": "builtin.image.accessible",
96 "title": "Image URL is accessible",
97 "description": "The image URL is available and accessible.",
98 }
99 var message string
100 if err == nil {
101 o.ImageAccessibleCheck.Passed = true
102 message = "Pass"
103 log.Debug("Image URL is accessible")
104 } else {
105 o.ImageAccessibleCheck.Passed = false
106 message = fmt.Sprintf("Image URL is not accessible: %s", err)
107 log.Debugf("%s. Error: %s", message, err.Error())
108 }
109 result := &evaluator.Result{Message: message, Metadata: metadata}
110 if !o.Detailed {
111 keepSomeMetadataSingle(*result)
112 }
113 o.ImageAccessibleCheck.Result = result
114}
115
116// SetImageSignatureCheck sets the passed and result.message fields of the ImageSignatureCheck to the given values.
117func (o *Output) SetImageSignatureCheckFromError(err error) {

Callers 2

ValidateImageFunction · 0.95

Calls 2

keepSomeMetadataSingleFunction · 0.85
ErrorMethod · 0.65

Tested by 1