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

Bug Fix - ops_manager User Creation #4790

Merged
merged 9 commits into from
Sep 13, 2023
19 changes: 9 additions & 10 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "go.mod|go.sum|.*.map|^.secrets.baseline$",
"lines": null
},
"generated_at": "2023-09-01T17:36:43Z",
"generated_at": "2023-09-07T20:07:50Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down Expand Up @@ -2050,31 +2050,31 @@
"hashed_secret": "deab23f996709b4e3d14e5499d1cc2de677bfaa8",
"is_secret": false,
"is_verified": false,
"line_number": 1560,
"line_number": 1559,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "20a25bac21219ffff1904bde871ded4027eca2f8",
"is_secret": false,
"is_verified": false,
"line_number": 2213,
"line_number": 2212,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "b732fb611fd46a38e8667f9972e0cde777fbe37f",
"is_secret": false,
"is_verified": false,
"line_number": 2232,
"line_number": 2231,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "1f5e25be9b575e9f5d39c82dfd1d9f4d73f1975c",
"is_secret": false,
"is_verified": false,
"line_number": 2497,
"line_number": 2496,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down Expand Up @@ -2139,8 +2139,7 @@
],
"ibm/service/database/resource_ibm_database_mongodb_sharding_test.go": [
{
"hashed_secret": "75074b1c70e165b25d1a07655ce513f0053018dc",
"is_secret": false,
"hashed_secret": "5667b8489a17faa9ef54941db31ed762be280bec",
"is_verified": false,
"line_number": 141,
"type": "Secret Keyword",
Expand Down Expand Up @@ -3586,23 +3585,23 @@
"hashed_secret": "f855f5027fd8fdb2df3f6a6f1cf858fffcbedb0c",
"is_secret": false,
"is_verified": false,
"line_number": 86802,
"line_number": 89160,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "5fb0fa884132a8724a8d7cba55853737e442adbd",
"is_secret": false,
"is_verified": false,
"line_number": 108081,
"line_number": 111481,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "1e5c2f367f02e47a8c160cda1cd9d91decbac441",
"is_secret": false,
"is_verified": false,
"line_number": 136739,
"line_number": 141026,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down
15 changes: 11 additions & 4 deletions ibm/service/database/resource_ibm_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -3152,11 +3152,18 @@ func userUpdateCreate(userData map[string]interface{}, instanceID string, meta i
return fmt.Errorf("[ERROR] ChangeUserPassword (%s) failed %s\n%s", *changeUserPasswordOptions.Username, err, response)
}

taskID := *changeUserPasswordResponse.Task.ID
updatePass, err := waitForDatabaseTaskComplete(taskID, d, meta, d.Timeout(schema.TimeoutUpdate))
updatePass := true // Assume that update password passed

if err != nil {
log.Printf("[ERROR] Error waiting for database (%s) user (%s) password update task to complete: %s", instanceID, *changeUserPasswordOptions.Username, err)
if userData["type"].(string) == "ops_manager" && response.StatusCode == 404 {
updatePass = false // when user_password api can't find an ops_manager user, it returns a 404 and does not get to the point of creating a task
} else {
// when user_password api can't find a database user, its task fails
taskID := *changeUserPasswordResponse.Task.ID
updatePass, err = waitForDatabaseTaskComplete(taskID, d, meta, d.Timeout(schema.TimeoutUpdate))

if err != nil {
log.Printf("[ERROR] Error waiting for database (%s) user (%s) password update task to complete: %s", instanceID, *changeUserPasswordOptions.Username, err)
}
}

// Updating the password has failed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ func testAccCheckIBMDatabaseInstanceMongoDBShardingFullyspecified(databaseResour
}
users {
name = "user124"
password = "password12password"
type = "database"
password = "password$12password"
type = "ops_manager"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Has this been tested with MongoDBEE? Could you please add a test to cover that as well?

}
allowlist {
address = "172.168.1.2/32"
Expand Down
Loading