diff --git a/pkg/remote/remote_direct.go b/pkg/remote/remote_direct.go index 958be4d3f..ee6b126dc 100644 --- a/pkg/remote/remote_direct.go +++ b/pkg/remote/remote_direct.go @@ -77,6 +77,11 @@ func getRemoteDirectConfig(settings *environment.AirshipCTLSettings) (*config.Re return nil, "", err } + remoteConfig := bootstrapSettings.RemoteDirect + if remoteConfig == nil { + return nil, "", config.ErrMissingConfig{What: "RemoteDirect options not defined in bootstrap config"} + } + // TODO (dukov) replace with the appropriate function once it's available // in document module docBundle, err := document.NewBundle(fs.MakeRealFS(), manifest.TargetPath, "") @@ -106,7 +111,7 @@ func getRemoteDirectConfig(settings *environment.AirshipCTLSettings) (*config.Re return nil, "", err } - return bootstrapSettings.RemoteDirect, remoteURL, nil + return remoteConfig, remoteURL, nil } // Top level function to execute remote direct based on remote type diff --git a/pkg/remote/remote_direct_test.go b/pkg/remote/remote_direct_test.go index ea349f6dd..e2a557ddb 100644 --- a/pkg/remote/remote_direct_test.go +++ b/pkg/remote/remote_direct_test.go @@ -71,3 +71,16 @@ func TestRedfishRemoteDirectWithEmptyIsoPath(t *testing.T) { _, ok := err.(redfish.ErrRedfishMissingConfig) assert.True(t, ok) } + +func TestBootstrapRemoteDirectMissingConfigOpts(t *testing.T) { + s := initSettings( + t, + nil, + "base", + ) + + err := DoRemoteDirect(s) + + _, ok := err.(config.ErrMissingConfig) + assert.True(t, ok) +}