Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mercari specific] Ignore gate client error #53

Merged
merged 2 commits into from
Aug 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spinnaker/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func providerConfigureFunc(data *schema.ResourceData) (interface{}, error) {

client, err := gate.NewGateClient(flags)
if err != nil {
return nil, err
return nil, nil
}

return gateConfig{
Expand Down
43 changes: 39 additions & 4 deletions spinnaker/resource_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,16 @@ func resourceSpinnakerApplicationCreate(d *schema.ResourceData, meta interface{}
}

func resourceSpinnakerApplicationRead(d *schema.ResourceData, meta interface{}) error {
clientConfig := meta.(gateConfig)
var clientConfig gateConfig
var ok bool
if clientConfig, ok = meta.(gateConfig); !ok {
// TODO(@KeisukeYamashita): Remove this. This is mercari specific problem
// once we fixed the CI, we will remove this
// This is only nil when the gate client failed to initialize
// Moreover, this patch will not be released to the main stream
return fmt.Errorf("gate client failed to instant")
}

client := clientConfig.client
appName := api.GetApplicationName(d)

Expand Down Expand Up @@ -151,7 +160,15 @@ func resourceSpinnakerApplicationRead(d *schema.ResourceData, meta interface{})
}

func resourceSpinnakerApplicationUpdate(d *schema.ResourceData, meta interface{}) error {
clientConfig := meta.(gateConfig)
var clientConfig gateConfig
var ok bool
if clientConfig, ok = meta.(gateConfig); !ok {
// TODO(@KeisukeYamashita): Remove this. This is mercari specific problem
// once we fixed the CI, we will remove this
// This is only nil when the gate client failed to initialize
// Moreover, this patch will not be released to the main stream
return fmt.Errorf("gate client failed to instant")
}
client := clientConfig.client
task, err := api.NewCreateApplicationTask(d)
if err != nil {
Expand All @@ -165,7 +182,16 @@ func resourceSpinnakerApplicationUpdate(d *schema.ResourceData, meta interface{}
}

func resourceSpinnakerApplicationDelete(d *schema.ResourceData, meta interface{}) error {
clientConfig := meta.(gateConfig)
var clientConfig gateConfig
var ok bool
if clientConfig, ok = meta.(gateConfig); !ok {
// TODO(@KeisukeYamashita): Remove this. This is mercari specific problem
// once we fixed the CI, we will remove this
// This is only nil when the gate client failed to initialize
// Moreover, this patch will not be released to the main stream
return fmt.Errorf("gate client failed to instant")
}

client := clientConfig.client
appName := api.GetApplicationName(d)

Expand All @@ -178,7 +204,16 @@ func resourceSpinnakerApplicationDelete(d *schema.ResourceData, meta interface{}
}

func resourceSpinnakerApplicationExists(d *schema.ResourceData, meta interface{}) (bool, error) {
clientConfig := meta.(gateConfig)
var clientConfig gateConfig
var ok bool
if clientConfig, ok = meta.(gateConfig); !ok {
// TODO(@KeisukeYamashita): Remove this. This is mercari specific problem
// once we fixed the CI, we will remove this
// This is only nil when the gate client failed to initialize
// Moreover, this patch will not be released to the main stream
return ok, fmt.Errorf("gate client failed to instant")
}

client := clientConfig.client
appName := api.GetApplicationName(d)

Expand Down