Skip to content

Commit b656934

Browse files
fix lint
Signed-off-by: varshaprasad96 <[email protected]>
1 parent 4b83e06 commit b656934

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ test-e2e-setup: build envtest
152152

153153
# install envtest binary
154154
envtest:
155-
go install $(GO_BUILD_ARGS) sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
155+
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
156156

157157
.PHONY: test-e2e-teardown
158158
test-e2e-teardown:

internal/cmd/ansible-operator/run/cmd.go

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,8 @@ func run(cmd *cobra.Command, f *flags.Flags) {
105105
os.Exit(1)
106106
}
107107

108-
urlPath, err := url.Parse(cfg.Host)
109-
110-
if err != nil {
111-
log.Error(err, "Failed to Parse the Path URL.")
112-
os.Exit(1)
113-
}
114-
115-
if urlPath != nil && urlPath.Path != "" {
116-
log.Error(fmt.Errorf("api endpoint '%s' contains a path component, which the proxy server is currently unable to handle properly. Work on this issue is being tracked here: https://github.com/operator-framework/operator-sdk/issues/4925", cfg.Host), "")
108+
if err := verifyCfgURL(cfg.Host); err != nil {
109+
log.Error(err, "Failed toverify config endpoint")
117110
os.Exit(1)
118111
}
119112

@@ -153,7 +146,6 @@ func run(cmd *cobra.Command, f *flags.Flags) {
153146
if err != nil {
154147
return nil, err
155148
}
156-
157149
return client.NewDelegatingClient(client.NewDelegatingClientInput{
158150
CacheReader: cache,
159151
Client: c,
@@ -280,6 +272,21 @@ func run(cmd *cobra.Command, f *flags.Flags) {
280272
log.Info("Exiting.")
281273
}
282274

275+
// verifyCfgURL verifies the path component of api endpoint
276+
// passed through the config.
277+
func verifyCfgURL(path string) error {
278+
urlPath, err := url.Parse(path)
279+
if err != nil {
280+
log.Error(err, "Failed to Parse the Path URL.")
281+
return err
282+
}
283+
if urlPath != nil && urlPath.Path != "" {
284+
log.Error(fmt.Errorf("api endpoint '%s' contains a path component, which the proxy server is currently unable to handle properly. Work on this issue is being tracked here: https://github.com/operator-framework/operator-sdk/issues/4925", path), "")
285+
return err
286+
}
287+
return nil
288+
}
289+
283290
// exitIfUnsupported prints an error containing unsupported field names and exits
284291
// if any of those fields are not their default values.
285292
func exitIfUnsupported(options manager.Options) {

0 commit comments

Comments
 (0)