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

Feat: add a retry mechanism for getSshKeyByName #849

Merged
merged 1 commit into from
May 12, 2024
Merged

Conversation

TomerHeber
Copy link
Collaborator

@TomerHeber TomerHeber commented May 12, 2024

Issue & Steps to Reproduce / Feature Request

resolves #848

Solution

  1. Added a backoff library.
  2. Added backoff for getSshKeyByName.
  3. Added an acceptance test.

@@ -62,26 +64,28 @@ func dataSshKeyRead(ctx context.Context, d *schema.ResourceData, meta interface{
func getSshKeyByName(name interface{}, meta interface{}) (*client.SshKey, error) {
apiClient := meta.(client.ApiClientInterface)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing much really changed here... the same code is just inside a retry mechanism.

return nil, fmt.Errorf("ssh key with name %v not found", name)
}
if len(sshKeysByName) > 1 {
return nil, backoff.Permanent(fmt.Errorf("found multiple ssh keys with name: %s. Use id instead or make sure ssh key names are unique %v", name, sshKeysByName))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added backoff.Permanent (means fail without retrying...).

@github-actions github-actions bot added ready to merge PR approved - can be merged once the PR owner is ready and removed pending final review labels May 12, 2024
@yaronya yaronya merged commit a76836d into main May 12, 2024
10 checks passed
@yaronya yaronya deleted the feat-retry-ssh-#848 branch May 12, 2024 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependency-change feature provider ready to merge PR approved - can be merged once the PR owner is ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a retry mechanism
2 participants