Skip to content

Commit 8a8d961

Browse files
authored
Merge pull request #183 from oracle/ramy-AllowDisableRetries
adding option to disable automatic retries
2 parents 00d87df + ec01b77 commit 8a8d961

File tree

5 files changed

+107
-60
lines changed

5 files changed

+107
-60
lines changed

docs/examples/compute/single_instance/provider.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ provider "baremetal" {
33
user_ocid = "${var.user_ocid}"
44
fingerprint = "${var.fingerprint}"
55
private_key_path = "${var.private_key_path}"
6+
disable_auto_retries = "true"
67
}

provider.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ func init() {
2828
"A private_key or a private_key_path must be provided.",
2929
"private_key_password": "(Optional) The password used to secure the private key.",
3030
"region": "(Optional) The region for API connections.",
31+
"disable_auto_retries": "(Optional) Disable Automatic retries for retriable errors.\n" +
32+
"Auto retries were introduced to solve some eventual consistency problems but it also introduced performance issues on destroy operations.",
3133
}
3234
}
3335

@@ -91,6 +93,13 @@ func schemaMap() map[string]*schema.Schema {
9193
Description: descriptions["region"],
9294
DefaultFunc: schema.EnvDefaultFunc("OBMCS_REGION", nil),
9395
},
96+
"disable_auto_retries": {
97+
Type: schema.TypeBool,
98+
Optional: true,
99+
Default: false,
100+
Description: descriptions["disable_auto_retries"],
101+
DefaultFunc: schema.EnvDefaultFunc("OBMCS_DISABLE_AUTO_RETRIES", nil),
102+
},
94103
}
95104
}
96105

@@ -219,6 +228,7 @@ func providerConfig(d *schema.ResourceData) (client interface{}, err error) {
219228
privateKeyPath, hasKeyPath := d.Get("private_key_path").(string)
220229
privateKeyPassword, hasKeyPass := d.Get("private_key_password").(string)
221230
region, hasRegion := d.Get("region").(string)
231+
disableAutoRetries, hasDisableRetries := d.Get("disable_auto_retries").(bool)
222232

223233
// for internal use
224234
urlTemplate := getEnvSetting("url_template", "")
@@ -258,6 +268,10 @@ func providerConfig(d *schema.ResourceData) (client interface{}, err error) {
258268
clientOpts = append(clientOpts, baremetal.Region(region))
259269
}
260270

271+
if hasDisableRetries {
272+
clientOpts = append(clientOpts, baremetal.DisableAutoRetries(disableAutoRetries))
273+
}
274+
261275
if urlTemplate != "" {
262276
clientOpts = append(clientOpts, baremetal.UrlTemplate(urlTemplate))
263277
}

vendor/github.com/MustWin/baremetal-sdk-go/client.go

Lines changed: 23 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/MustWin/baremetal-sdk-go/requestor.go

Lines changed: 66 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/vendor.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,10 @@
327327
"revisionTime": "2017-02-01T00:43:30Z"
328328
},
329329
{
330-
"checksumSHA1": "R4NLurUA0rFm9zXONd9lSdFrN/w=",
330+
"checksumSHA1": "kQcH7eYRiqBiQUPCNg55fwRtqgg=",
331331
"path": "github.com/MustWin/baremetal-sdk-go",
332-
"revision": "264b12431d5e7bb6b4c281f5a898c62200de323d",
333-
"revisionTime": "2017-07-14T00:37:53Z"
332+
"revision": "3875e156ba8b34e977ef1348a6838f73150dfcc8",
333+
"revisionTime": "2017-07-19T23:37:31Z"
334334
},
335335
{
336336
"checksumSHA1": "Aqy8/FoAIidY/DeQ5oTYSZ4YFVc=",

0 commit comments

Comments
 (0)