Enable anonymous access through context middleware

Certain deployments need to allow anonymous access to its
images. This patch allows a user that has failed to authenticate with
Keystone to access the API in read-only context.

* Configure through 'allow_anonymous_access' option, defaults to False
* Implements bp api-v2-anonymous-access

Change-Id: Ia8f57e54bd141a2da1ca4600d1970558fb497f67
Add additional info. to image.delete notification

Add additional information to the 'image.delete' notification payload
to simplify external usage tracking systems.

Please note that this is not a backwards-compatible change as the
old payload was simply a string consisting of the image id.  This
converts the payload to a dictionary.

Change-Id: I641b7de91fcc14dc3c81ec942aeb0acf5a63d128
Expose tags on image entities in v2 API

Enable users to set and view tags on image entities. Before, a user
had to navigate to the /tags subcollection to interact with image tags.
Additionally, this refactors the image_tag_* methods to return strings
rather than sqlalchemy objects.

* Related to bp api-v2-image-tags

Change-Id: Ifdebe9b660f78bee5fda798a1f83e384a8220049
Merge "Enable anonymous access through context middleware"
Add a base class for tests

This base class will allow us to DRY up the config setup and teardown.

Change-Id: I49fff259a38657110a4117134b1a8bd728404269
Add read-only enforcement to v2 API.

Provide a new @mutating decorator to provide a concise marker for
operations that should not be accessible to a read-only request.

Related to bp api-v2-anonymous-access

Change-Id: I52710083b4f112d2429afe4faa0660e2a6822929
Merge "Add a base class for tests"
Merge "Add additional info. to image.delete notification"
Glance should use openstack.common.importutils

Implements blueprint use-common-importutils

Change-Id: If92fcf85c6bbcd330fd3675401d03b12a5fc055c
Move glance.registry.db to glance.db

Related to bp refactor-db-layer

Change-Id: Ia7c5aea29eef8068a9b67ac5fd051b45a38a20de
Merge "Glance should use openstack.common.importutils"
Fix coverage jobs. Also, clean up the tox.ini.

Change-Id: I85e8f1b190e2c5f598ae76f2920dfbe7c4ed1500
Just use pure nosetests.

The test suite can be run now with pure nosetests + the openstack nose
plugin. There is no longer any need for the run_tests.py.

Change-Id: Iad89a2c1cc567ba10919a52166b3309edef20009
fix side effects from seekability test on input file

Fixes Bug #1007093

Mixing use of os.lseek(fileno, 0, os.SEEK_SET) with
file.seek seems to cause problems when reading data
with file.read

Change-Id: Ia96ce9bbdc93a1a8c6169d85b99187f8cd7b2fdc
Add cfg's new global CONF object

Implements blueprint cfg-global-object

Begin adopting cfg's global CONF object pattern rather than passing
a conf object around everywhere.

This iterations does just enough to have each of the glance programs
initialize CONF and get the unit tests working.

Change-Id: Ia34959b3ba52cbe933d5d347f31319271b2e14f9
Merge "Add cfg's new global CONF object"
Fix typo in doc

metdata -> metadata

Change-Id: I44e5e73946e9d1a37b8e3a5974083e3fbea33d2d
Clean up a few ugly bits from the testing patch.

The pep8 runner in run_tests.sh was still referencing run_tests.py
which no longer exists. Replaced that section with one that runs
pep8 the same way as tox.

Additionally, the first attempt at getting the test runner to do the
same thing with debug logging as run_tests.sh was doing became a bit
spammy. For now, actually have logging write out the log file in the
first place. Eventually, it would be nice to get this to properly
get spit out in such a way that nosetests would grab it and include
it in the failed test case output.

Change-Id: Ib5222a0c3507d5d7ede4d303c98323a622705301
Merge "fix side effects from seekability test on input file"
Glance should use openstack.common.timeutils

Implements blueprint use-common-timeutils

1. Edit openstack-common.conf and import glance/openstack/common/timeutils.py
2. Replace datetime.utcnow with timeutils.utcnow
3. Replace utils.isotime with timeutils.isotime
4. Replace utils.parse_isotime with timeutils.parse_isotime
5. Replace utils.normalize_time with timeutils.normalize_time
6. Remove datetime related functions and datetime related unittests

Change-Id: I014548848f738b00c670be3d372b16f47f6dee96