Remove start index 0 in range()

Remove the useless arg ("start index" = 0) in files, since its default
value is 0, to make code cleaner.

Change-Id: I9d91ab8a8033b9a6c9b77608dea92c91a994c7fc
Remove the unused mapper of image member create

For image members v1, we don't support "create" method,
but we're mapping it in router.py. So this fix will
remove the unused mapper.

Fixes bug 1223658

Change-Id: I20401656ea2930a026cf8b67825d9ec9f6623487
Fix misused assertTrue in unit tests

Refactored unit tests to use assertEqual instead of assertTrue
where needed.

Fixes bug #1226374

Change-Id: Iac5117c7a8dd3769aa6e303c6830aad291d5a0f7
Enclose command args in with_venv.sh

Sync tools/with_venv.sh from oslo, it will support argument with
blanks.

Change-Id: Ibb802b21d609ea6b54fc168b17705f06ad1cb86a
Closes-Bug: #1220937
Do not allow the same member to be added twice

This patch add an existence check before add new member for image.

Fixes bug 1231485

Change-Id: I10d37c6f169e070ea6699cca78b6360be9fb11dc
Glance GET /v2/images fails with 500 due to erroneous policy check

This patch will fix below two issues of V2 ResponseSerializer for
images-list, image-show, image-update and image-download.

1. A user should be able to list/show/update/download image without
needing permission on get_image_location.
2. A policy failure should result in a 403 return code. We're
getting a 500.

Fixes bug 1231255

Change-Id: Ie0ec2d574eea4433c4f610ec66a22cb16cae6dc6
Allow tests to run with both provenances of mox

We currently have a requirement for mox >= 0.5.3.

Confusingly there are two flavours of "mox 0.5.3"
in the wild:

1) pypi's mox-0.5.3.tar.gz (https://pypi.python.org/pypi/mox)
2) Google's mox-0.5.3.tar.gz (https://code.google.com/p/pymox/)

These are not exactly the same; tests which can pass on (1) may
fail on (2).

Fedora packages are based on (1) while Debian/Ubuntu packages
are based on (2).

This is a known issue: https://code.google.com/p/pymox/issues/detail?id=40

When running the tests using a virtual env (1) is used, but
on Debian/Ubuntu when not running using a virtual env (2)
will be used: this leads to 3 of the 1740 tests failing.

This patch allows all 1743 tests to run whether you are running
in a virtual env or using Debian/Ubuntu/Fedora packages.

Fix for bug 1212625.

Change-Id: Ib0b11ec18aafbfb7f3d243bf149b94f93a1c13c9
Update functional tests for swift changes

It seems that a couple of changes to the store calls have slipped
through unnoticed:

* store.add() now returns a 4-tuple
* x-container-read and x-container-write headers use tenant:user rather
  than just tenant.

fixes bug 1236339

Change-Id: Ic5c311bcc2999e13203e0d3ad37bce5ac5f27e2d
Fixes rbd _delete_image snapshot with missing image

Also ignore if _delete_image returns NotFound when cleaning up
following failed attempt to create a new image with add().

Also added unit tests.

Change-Id: Id66866b4260385a6324cc277c5ac665f81493c89
Fixes: bug 1233097
Merge "Allow tests to run with both provenances of mox"
Glance manage should parse glance-api.conf

glance-manage does not currently parse glance-api.conf, when
glance-registry.conf is present. Currently it's parsed conditionally.
But, when some configs from glance-api.conf are required, we would
need parse them both.
eg. CONF.swift_store_user, CONF.swift_store_key in glance-api.conf

Fixes bug #1225863

Change-Id: I553c1bb460229489b38a57d9c91995816bfe09ee
Adding 'download_image' policy enforcement to image cache middleware

Currently image cache middleware not care 'download_image' policy, the
enforcement caused user receive empty content but with HTTP 200 code
rather than 403 when client attempt to download image using v2 API. And
the real Forbidden exception be logged in glance-api log which image
application action raised. The end user is confused by this behavior.

Fixes bug: 1235378

Change-Id: Ibaa7ccf8613ee3cce4cb6a72e3206a2c94122222
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
Merge "Fix misused assertTrue in unit tests"
Merge "Do not allow the same member to be added twice"
Merge "Glance manage should parse glance-api.conf"
Merge "Remove the unused mapper of image member create"
Use Unix style LF instead of DOS style CRLF

This was causing pyflakes to fail with syntax errors on some systems:
<stdin>:22: invalid syntax

Change-Id: I57669392a5ee2a786d2a6e18a9dfd0abb054b71b
Merge "Remove start index 0 in range()"
Merge "Glance GET /v2/images fails with 500 due to erroneous policy check"
Merge "Fixes rbd _delete_image snapshot with missing image"