Skip to content

Commit 285798d

Browse files
authored
Merge pull request #224 from SumoLogic/vishal-set-error-message-on-failure
2 parents db7d1ef + 0437b39 commit 285798d

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
## 2.9.5 (Unreleased)
22

3+
ENHANCEMENTS:
4+
5+
* Add validation for monitor resource (GH-223)
6+
7+
BUG FIXES:
8+
9+
* Set error message on failure for content resource (GH-224)
10+
311
## 2.9.4 (June 24, 2021)
412

513
FEATURES:
@@ -9,7 +17,7 @@ FEATURES:
917

1018
ENHANCEMENTS:
1119

12-
* Remove requirement of placeholder values for `path` and `authentication` for `sumologic_gcp_source` resource (GH-205)
20+
* Remove requirement of placeholder values for `path` and `authentication` for `sumologic_gcp_source` resource (GH-205)
1321
* Add assertion consumer url to terraform saml configuration (GH-200)
1422

1523
## 2.9.3 (April 26, 2021)

sumologic/sumologic_content.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func (s *Client) CreateOrUpdateContent(content Content, timeout time.Duration, o
105105
return contentId, nil
106106
}
107107

108-
func waitForJob(url string, timeout time.Duration, s *Client) (Status, error) {
108+
func waitForJob(url string, timeout time.Duration, s *Client) (*Status, error) {
109109
conf := &resource.StateChangeConf{
110110
Pending: []string{
111111
"InProgress",
@@ -125,8 +125,8 @@ func waitForJob(url string, timeout time.Duration, s *Client) (Status, error) {
125125
return nil, "", err
126126
}
127127

128-
if status.Status == "failed" {
129-
return status, status.Status, fmt.Errorf("job failed: %s", status.StatusMessage)
128+
if status.Status == "Failed" {
129+
return status, status.Status, fmt.Errorf("Failed - %s", status.Error)
130130
}
131131

132132
return status, status.Status, nil
@@ -137,6 +137,10 @@ func waitForJob(url string, timeout time.Duration, s *Client) (Status, error) {
137137
}
138138

139139
result, err := conf.WaitForState()
140-
log.Printf("[DEBUG] job result: %v", result)
141-
return result.(Status), err
140+
log.Printf("[DEBUG] Done waiting for job; err: %s, result: %v", err, result)
141+
if status, ok := result.(Status); ok {
142+
return &status, err
143+
} else {
144+
return nil, err
145+
}
142146
}

0 commit comments

Comments
 (0)