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

Merge 2.6 Into Develop #10367

Merged
merged 29 commits into from
Jun 22, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fb3ded8
Tie the watcher lifecycle to the catacomb
SimonRichardson Jun 18, 2019
f60a226
Merge pull request #10341 from SimonRichardson/1833155-watcher-leak
jujubot Jun 19, 2019
bc4821b
Improve error checks to cater for 'not found' provider errors that do…
anastasiamac Jun 20, 2019
93a5dbe
add provider level IsNotFound-equivalent methods to providers that ar…
anastasiamac Jun 20, 2019
3d6378c
add provider level IsNotFound-equivalent methods to providers that ar…
anastasiamac Jun 20, 2019
0b44fac
Rename commit command to branch. Enhance renamed branch command to
hmlanigan Jun 18, 2019
9d0975f
Add Created, CreatedBy, and CompletedBy to a Branch in the model cache,
hmlanigan Jun 20, 2019
12d2082
Merge pull request #10359 from hmlanigan/createdtomodelcache
jujubot Jun 20, 2019
208f334
Merge pull request #10346 from hmlanigan/branch
jujubot Jun 20, 2019
4023a75
diversify handling of operational compute errors.
anastasiamac Jun 20, 2019
b1d584c
Use waiterror.
anastasiamac Jun 20, 2019
9a1a7a2
Only inspect errors after all attempts to run an operation have been …
anastasiamac Jun 20, 2019
ef3098c
adjust tests
anastasiamac Jun 21, 2019
16155dd
adjust tests
anastasiamac Jun 21, 2019
25ab285
Merge pull request #10354 from anastasiamac/provider-not-found-errors-25
jujubot Jun 21, 2019
5fd7824
Merge branch '2.5' into merge-25-26-2106
anastasiamac Jun 21, 2019
501494a
Merge branch '2.5' into merge-25-26-2106
anastasiamac Jun 21, 2019
a6d900b
Merge pull request #10362 from anastasiamac/merge-25-26-2106
jujubot Jun 21, 2019
c2391c8
Fixes case where watcher for unit not tracking any branch starts trac…
manadart Jun 21, 2019
56d6c10
Merge pull request #10364 from manadart/2.6-config-watch-branch-deter…
jujubot Jun 21, 2019
d9d191f
Relocates uniter access control method generation to a new module for…
manadart Jun 20, 2019
ee944e0
Moves event matchers from the modelcache_test package to core/cache/c…
manadart Jun 21, 2019
b78e03e
Adds new testing infrastructure for filling a cache with objects from…
manadart Jun 21, 2019
b345347
Internalises events notification channel in testing cache controller.
manadart Jun 21, 2019
32e0618
Makes cachetest event matchers into function declarations instead of …
manadart Jun 21, 2019
f402984
Adds copyright header to new cachetest matchers module.
manadart Jun 21, 2019
7671273
Merge pull request #10366 from manadart/2.6-cache-testing-infrastructure
jujubot Jun 21, 2019
fec148b
Merge branch 'upstream/2.6' into 2.6-into-develop
manadart Jun 21, 2019
e89fa76
Removes call to deprecated WantsVote method in cachetest package.
manadart Jun 21, 2019
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
Prev Previous commit
Next Next commit
Use waiterror.
  • Loading branch information
anastasiamac committed Jun 20, 2019
commit b1d584c15e845412463a9f023fbf6ca4d895ae80
33 changes: 14 additions & 19 deletions provider/gce/google/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,29 +91,24 @@ func HasDenialStatusCode(err error) bool {
return false
}

// http/url.Error is constructed with status code in mind and, at the time of writing for go-1.10,
// contains response status code and description in error.Error.
// We have to examine the error message to determine whether the error is related to authentication failure.
if cause, ok := errors.Cause(err).(*url.Error); ok {
for code, descs := range AuthorisationFailureStatusCodes {
for _, desc := range descs {
if strings.Contains(cause.Error(), fmt.Sprintf(": %v %v", code, desc)) {
return true
}
}
}
var cause error
switch e := errors.Cause(err).(type) {
case *url.Error:
cause = e
case *googleapi.Error:
cause = e
default:
return false
}
if cause, ok := errors.Cause(err).(*googleapi.Error); ok {
for code, descs := range AuthorisationFailureStatusCodes {
for _, desc := range descs {
if strings.Contains(cause.Error(), fmt.Sprintf(": %v %v", code, desc)) {
return true
}

for code, descs := range AuthorisationFailureStatusCodes {
for _, desc := range descs {
if strings.Contains(cause.Error(), fmt.Sprintf(": %v %v", code, desc)) {
return true
}
}
}
return false

}

// AuthorisationFailureStatusCodes contains http status code and
Expand All @@ -139,5 +134,5 @@ func IsNotFound(err error) bool {
if gerr, ok := errors.Cause(err).(*googleapi.Error); ok {
return gerr.Code == http.StatusNotFound
}
return errors.IsNotFound(err)
return errors.IsNotFound(errors.Cause(err))
}
17 changes: 11 additions & 6 deletions provider/gce/google/raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,16 @@ func (rc *rawConn) UpdateFirewall(projectID, name string, firewall *compute.Fire
type handleOperationErrors func(operation *compute.Operation) error

func returnNotFoundOperationErrors(operation *compute.Operation) error {
hadOtherErrors := false
if operation.Error != nil {
result := waitError{operation, nil}
for _, err := range operation.Error.Errors {
if err.Code == "RESOURCE_NOT_FOUND" {
return errors.NotFoundf("resource", err.Message)
result.cause = errors.NotFoundf("resource", err.Message)
continue
}
hadOtherErrors = true
logger.Errorf("GCE operation error: (%s) %s", err.Code, err.Message)
}
}
if hadOtherErrors {
return waitError{operation, nil}
return result
}
return nil
}
Expand Down Expand Up @@ -354,6 +352,13 @@ func (err waitError) Error() string {
return fmt.Sprintf("GCE operation %q failed", err.op.Name)
}

func (err waitError) Cause() error {
if err.cause != nil {
return err.cause
}
return err
}

func isWaitError(err error) bool {
_, ok := err.(*waitError)
return ok
Expand Down