return the SLO etag generated from the segment etags on PUT

Change-Id: Idf742035da51170ea6a4d6278422ef307a46e121
Staticweb shortcut object 404s

Right now static web checks to see if it should handle a
request and if it decides that it shouldn't, in all cases,
it lets the request pass through the pipeline normally.
After this change on "x-web-mode: t" obj requests where
staticweb is not setup and an object 404s it will just
return the 404 instead of letting the app send a duplicate
request to the object servers.

Change-Id: I824f4b03f7546d26084fd51b97ea6e290169d22a
Fix range GET w/If-None-Match.

An object GET request with both If-None-Match: <Etag> and
Range: bytes=N-M should result in a 304 Not Modified if the Etag
matches. However, it was resulting in a 416 Requested Range Not
Satisfiable. This commit fixes that.

The fix was to remove conditional_response=True from a request in the
proxy. As far as I can see, the only effect that
conditional_response=True has in swob is to enable range
checking. Since the object server handles all the range stuff, the
proxy shouldn't do it. Otherwise, you wind up with double-application
of the Range header, and that doesn't work very well.

This is probably left over from the WebOb days.

Fixes bug #1196805.

Change-Id: I207f3839731b7503baa3fdbd7cd1cfe3e1b46f62
Don't append %interface with ipv6 ips.

- Since netifaces is appending a %interface (i.e: %eth0) at the end and
  does not make a correct ipv6 address we are removing it.
- Improve the tests of whataremyips along the way.

Closes-Bug: 1209443
Change-Id: I585e795083783009961b429607ca3f66b8d7ec30
fix gettext calls to operate on uninterpolated strings

The strings need to be interpolated after the gettext call,
so that the gettext() lookup works correctly

Change-Id: Ibdb9044813f42039f7a87ca7e8fec20583aa61ae
Added container listing ratelimiting

Change-Id: If4e9cfe4e4c743de1f39704acf849164cf3f0bd0
Migrate to pbr for build

pbr is the libification of what was openstack.common.setup. If provides
the build information in a delcarative form, instead of as executable python
code, which works around the chicken and egg problem of needing setup
libraries present to run setup, but needing to run setup to tell if you
need setup libraries.

One of the features that comes along with this is versioning based on
git tags. If the current revision is a signed git tag, then that is the
version of the package. If it is not, the version is equal to the most
recent git tag, plus a commit count, plus a git sha (similar to git
describe, but scrubbed for python version rules compliance)

pbr updates are also part of the upcoming automation around ensuring
global requirements stay in sync.

Closes-Bug: #1179007
Change-Id: Ia473960be7e8aa44f09d48cea72ed3c8845f82fa
Add unit test for account/auditor.py

* Here lack tests for a long time; let's add tests for it.
* use mock module instead of monkeypatch in both account/test_auditor.py
  and container/test_auditor.py

Change-Id: I9ea23dc5034f7147629db59b1ef6cb491de9049f
use testCase.assert instead of assert and try...except

In unit tests, we should use: self.assertTrue or self.assertFalse
instead of 'assert xxx is True/False', and use self.assertRaises instead
of 'try ... except ...'

fixes bug #1212602

Change-Id: I25318eb59cd26a98afdce5495273e3b3266655a4
clean temp dir in /tmp

In unit tests, many test class use tempfile.mkdtemp in SetUp and
shutil.rmtree in tearDown.

A common wrong case is putting test data in `testdir = os.join(mkdtemp() +
'some_class')` and `rmmtree(testdir)`. As a result, /tmp/xxx/some_class
was deleted, but /tmp/xxx is still leaved in system. So a proper fix is
`rmtree(os.path.dirname(testdir), ignore_errors=1)`

fixes bug #1212583

Change-Id: Iafbe3e11f16b51bdf49abce9e68eb01f25bc5df2
Merge "Add unit test for account/auditor.py"
Implements configurable swift_owner_headers

These are headers that will be stripped unless the WSGI environment
contains a true value for 'swift_owner'. The exact definition of a
swift_owner is up to the auth system in use, but usually indicates
administrative responsibilities.

DocImpact

Change-Id: I972772fbbd235414e00130ca663428e8750cabca
DiskFile logger argument is not a keyword

This was broke somewhere pre-1.9.1.

Change-Id: Ic9cc615e431fbf8b49e5350725d6974b1f82184e
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Merge "return the SLO etag generated from the segment etags on PUT"
Merge "Staticweb shortcut object 404s"
Some how DELETE not using _parse_path()

It seems as this conversion was missed, as a git blame says the first
few lines of DELETE date all the way back to commit 001407b9 "(creiht)
2010-07-12 Initial commit of Swift code".

While we were in here, we moved _parse_path() to a module method as
there appears to be need to keep it as an object controller method.

We also fixed up as many of the tests that directly invoked the object
controller methods to use get_response(), addressing a few
inconsistencies along the way.

Change-Id: If491c7129d61d6fc7d81401fbc3650c29ed80465
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Merge "Implements configurable swift_owner_headers"
Merge "Some how DELETE not using _parse_path()"
Refactor how we pick listings' content type.

There were a few different places where we had some repeated code to
figure out what format an account or container listing response should
be in (text, JSON, or XML). Now that's been pulled into a single
function.

As part of this, you can now raise HTTPException subclasses in proxy
controllers instead of laboriously plumbing error responses all the
way back up to swift.proxy.server.Application.handle_request(). This
lets us avoid certain ugly patterns, like the one where a method
returns a tuple of (x, y, z, error) and the caller has to see if it
got (value, value, value, None) or (None, None, None, errorvalue). Now
we can just raise the error.

Change-Id: I316873df289160d526487ad116f6fbb9a575e3de
Unify DatabaseBroker.reclaim

Both AccountBroker and ContainerBroker install their own reclaim()
methods, which are the same, modulo the table and column names.
Also, the parent reclaim() method is unused, except as a tramptoline
to test _reclaim().

This patch gets rid of the unused code by moving it into the tests,
and unifies the reclaim() method in DatabaseBroker. We use the
same class parameters that are already in use elsewhere.

The unused code was found when documenting the DB broker API for
the LFS. The unification fell out of reviews by Clay and Peter.

Change-Id: Ic5e38a9e39dafe8e0bc062818151edece384f3b5