Merge lp:~niedbalski/goose/fix-pr-689 into lp:goose

Proposed by Jorge Niedbalski on 2014-10-29
Status: Rejected
Rejected by: Ian Booth on 2014-11-13
Proposed branch: lp:~niedbalski/goose/fix-pr-689
Merge into: lp:goose
Diff against target: 23 lines (+8/-1)
1 file modified
testservices/swiftservice/service_http.go (+8/-1)
To merge this branch: bzr merge lp:~niedbalski/goose/fix-pr-689
Reviewer Review Type Date Requested Status
Andrew Wilkins (community) 2014-10-29 Needs Fixing on 2014-10-30
Review via email: mp+240025@code.launchpad.net

Description of the change

- Justification

This patch is a complementary patch for addressing https://github.com/juju/juju/pull/689 required to run
the swift mock server , just to allow PUT/POST operations on en empty named container.

It is possible for Juju to erroneously send a DELETE HTTP request to the swift account API,
which in older versions of swift (and keystone) will result in the account DB for that user in swift being marked as deleted.

To post a comment you must log in.
Andrew Wilkins (axwalk) wrote :

Please add a test for DELETE with empty container in service_http_test.go.

Andrew Wilkins (axwalk) :
review: Needs Fixing
Ian Booth (wallyworld) wrote :

This work is not necessary as I've implemented a test in juju core slightly differently.

Unmerged revisions

128. By Jorge Niedbalski on 2014-10-29

- Complementary fix for https://github.com/juju/juju/pull/689

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'testservices/swiftservice/service_http.go'
2--- testservices/swiftservice/service_http.go 2014-04-30 07:35:19 +0000
3+++ testservices/swiftservice/service_http.go 2014-10-29 16:30:14 +0000
4@@ -187,11 +187,18 @@
5 w.WriteHeader(http.StatusUnauthorized)
6 return
7 }
8+
9 path := strings.TrimRight(r.URL.Path, "/")
10 path = strings.Trim(path, "/")
11 parts := strings.SplitN(path, "/", 4)
12 parts = parts[2:]
13- if len(parts) == 1 {
14+
15+ // Older versions of Swift API accepts "" containers to be created
16+ // This fix is almost exclusively to support the remove fix
17+ // proposed on: https://github.com/juju/juju/pull/689
18+ if len(parts) == 0 && (r.Method == "PUT" || r.Method == "POST") {
19+ s.handleContainers("", w, r)
20+ } else if len(parts) == 1 {
21 container := parts[0]
22 s.handleContainers(container, w, r)
23 } else if len(parts) == 2 {

Subscribers

People subscribed via source and target branches