Clean up pep8 E127 violations
Fixed E127 errors. All ignores are to be removed in the next sequence of patches. Change-Id: I56839ebe63dbccbb830dfed8923892c7c0837d7e
This commit is contained in:
parent
c5a1635a6b
commit
c05dd1c819
@ -40,7 +40,7 @@ common_opts = [
|
|||||||
help=_('Whether to allow users to specify image properties '
|
help=_('Whether to allow users to specify image properties '
|
||||||
'beyond what the image schema provides')),
|
'beyond what the image schema provides')),
|
||||||
cfg.StrOpt('data_api', default='glance.db.sqlalchemy.api',
|
cfg.StrOpt('data_api', default='glance.db.sqlalchemy.api',
|
||||||
help=_('Python module path of data access API')),
|
help=_('Python module path of data access API')),
|
||||||
cfg.IntOpt('limit_param_default', default=25,
|
cfg.IntOpt('limit_param_default', default=25,
|
||||||
help=_('Default value for the number of items returned by a '
|
help=_('Default value for the number of items returned by a '
|
||||||
'request if not specified explicitly in the request')),
|
'request if not specified explicitly in the request')),
|
||||||
|
@ -144,8 +144,8 @@ def _filter_images(images, filters, context):
|
|||||||
for p in image['properties']:
|
for p in image['properties']:
|
||||||
properties = {p['name']: p['value'],
|
properties = {p['name']: p['value'],
|
||||||
'deleted': p['deleted']}
|
'deleted': p['deleted']}
|
||||||
add = properties.get(key) == value and \
|
add = (properties.get(key) == value and
|
||||||
properties.get('deleted') is False
|
properties.get('deleted') is False)
|
||||||
if not add:
|
if not add:
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -161,8 +161,8 @@ def _filter_images(images, filters, context):
|
|||||||
can_see = image['is_public'] or has_ownership or context.is_admin
|
can_see = image['is_public'] or has_ownership or context.is_admin
|
||||||
|
|
||||||
if can_see:
|
if can_see:
|
||||||
return has_ownership or \
|
return (has_ownership or
|
||||||
(can_see and image['is_public'] == is_public_filter)
|
(can_see and image['is_public'] == is_public_filter))
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@ import logging
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
import sqlalchemy
|
import sqlalchemy
|
||||||
import sqlalchemy.orm
|
import sqlalchemy.orm as sa_orm
|
||||||
import sqlalchemy.sql
|
import sqlalchemy.sql as sa_sql
|
||||||
|
|
||||||
from glance.common import exception
|
from glance.common import exception
|
||||||
from glance.db.sqlalchemy import migration
|
from glance.db.sqlalchemy import migration
|
||||||
@ -145,9 +145,9 @@ def get_session(autocommit=True, expire_on_commit=False):
|
|||||||
global _MAKER
|
global _MAKER
|
||||||
if not _MAKER:
|
if not _MAKER:
|
||||||
assert _ENGINE
|
assert _ENGINE
|
||||||
_MAKER = sqlalchemy.orm.sessionmaker(bind=_ENGINE,
|
_MAKER = sa_orm.sessionmaker(bind=_ENGINE,
|
||||||
autocommit=autocommit,
|
autocommit=autocommit,
|
||||||
expire_on_commit=expire_on_commit)
|
expire_on_commit=expire_on_commit)
|
||||||
return _MAKER()
|
return _MAKER()
|
||||||
|
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ def wrap_db_error(f):
|
|||||||
remaining_attempts = _MAX_RETRIES
|
remaining_attempts = _MAX_RETRIES
|
||||||
while True:
|
while True:
|
||||||
LOG.warning(_('SQL connection failed. %d attempts left.'),
|
LOG.warning(_('SQL connection failed. %d attempts left.'),
|
||||||
remaining_attempts)
|
remaining_attempts)
|
||||||
remaining_attempts -= 1
|
remaining_attempts -= 1
|
||||||
time.sleep(_RETRY_INTERVAL)
|
time.sleep(_RETRY_INTERVAL)
|
||||||
try:
|
try:
|
||||||
@ -230,9 +230,9 @@ def image_get(context, image_id, session=None, force_show_deleted=False):
|
|||||||
session = session or get_session()
|
session = session or get_session()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
query = session.query(models.Image).\
|
query = session.query(models.Image)\
|
||||||
options(sqlalchemy.orm.joinedload(models.Image.properties)).\
|
.options(sa_orm.joinedload(models.Image.properties))\
|
||||||
filter_by(id=image_id)
|
.filter_by(id=image_id)
|
||||||
|
|
||||||
# filter out deleted images if context disallows it
|
# filter out deleted images if context disallows it
|
||||||
if not force_show_deleted and not can_show_deleted(context):
|
if not force_show_deleted and not can_show_deleted(context):
|
||||||
@ -240,7 +240,7 @@ def image_get(context, image_id, session=None, force_show_deleted=False):
|
|||||||
|
|
||||||
image = query.one()
|
image = query.one()
|
||||||
|
|
||||||
except sqlalchemy.orm.exc.NoResultFound:
|
except sa_orm.exc.NoResultFound:
|
||||||
raise exception.NotFound("No image found with ID %s" % image_id)
|
raise exception.NotFound("No image found with ID %s" % image_id)
|
||||||
|
|
||||||
# Make sure they can look at it
|
# Make sure they can look at it
|
||||||
@ -414,10 +414,10 @@ def paginate_query(query, model, limit, sort_keys, marker=None,
|
|||||||
raise ValueError(_("Unknown sort direction, "
|
raise ValueError(_("Unknown sort direction, "
|
||||||
"must be 'desc' or 'asc'"))
|
"must be 'desc' or 'asc'"))
|
||||||
|
|
||||||
criteria = sqlalchemy.sql.and_(*crit_attrs)
|
criteria = sa_sql.and_(*crit_attrs)
|
||||||
criteria_list.append(criteria)
|
criteria_list.append(criteria)
|
||||||
|
|
||||||
f = sqlalchemy.sql.or_(*criteria_list)
|
f = sa_sql.or_(*criteria_list)
|
||||||
query = query.filter(f)
|
query = query.filter(f)
|
||||||
|
|
||||||
if limit is not None:
|
if limit is not None:
|
||||||
@ -442,8 +442,8 @@ def image_get_all(context, filters=None, marker=None, limit=None,
|
|||||||
filters = filters or {}
|
filters = filters or {}
|
||||||
|
|
||||||
session = get_session()
|
session = get_session()
|
||||||
query = session.query(models.Image).\
|
query = session.query(models.Image)\
|
||||||
options(sqlalchemy.orm.joinedload(models.Image.properties))
|
.options(sa_orm.joinedload(models.Image.properties))
|
||||||
|
|
||||||
if 'is_public' in filters and filters['is_public'] is not None:
|
if 'is_public' in filters and filters['is_public'] is not None:
|
||||||
the_filter = [models.Image.is_public == filters['is_public']]
|
the_filter = [models.Image.is_public == filters['is_public']]
|
||||||
@ -453,7 +453,7 @@ def image_get_all(context, filters=None, marker=None, limit=None,
|
|||||||
models.Image.members.any(member=context.owner, deleted=False)
|
models.Image.members.any(member=context.owner, deleted=False)
|
||||||
])
|
])
|
||||||
if len(the_filter) > 1:
|
if len(the_filter) > 1:
|
||||||
query = query.filter(sqlalchemy.sql.or_(*the_filter))
|
query = query.filter(sa_sql.or_(*the_filter))
|
||||||
else:
|
else:
|
||||||
query = query.filter(the_filter[0])
|
query = query.filter(the_filter[0])
|
||||||
del filters['is_public']
|
del filters['is_public']
|
||||||
@ -768,13 +768,13 @@ def image_tag_create(context, image_id, value, session=None):
|
|||||||
def image_tag_delete(context, image_id, value, session=None):
|
def image_tag_delete(context, image_id, value, session=None):
|
||||||
"""Delete an image tag."""
|
"""Delete an image tag."""
|
||||||
session = session or get_session()
|
session = session or get_session()
|
||||||
query = session.query(models.ImageTag).\
|
query = session.query(models.ImageTag)\
|
||||||
filter_by(image_id=image_id).\
|
.filter_by(image_id=image_id)\
|
||||||
filter_by(value=value).\
|
.filter_by(value=value)\
|
||||||
filter_by(deleted=False)
|
.filter_by(deleted=False)
|
||||||
try:
|
try:
|
||||||
tag_ref = query.one()
|
tag_ref = query.one()
|
||||||
except sqlalchemy.orm.exc.NoResultFound:
|
except sa_orm.exc.NoResultFound:
|
||||||
raise exception.NotFound()
|
raise exception.NotFound()
|
||||||
|
|
||||||
tag_ref.delete(session=session)
|
tag_ref.delete(session=session)
|
||||||
@ -783,9 +783,9 @@ def image_tag_delete(context, image_id, value, session=None):
|
|||||||
def image_tag_get_all(context, image_id, session=None):
|
def image_tag_get_all(context, image_id, session=None):
|
||||||
"""Get a list of tags for a specific image."""
|
"""Get a list of tags for a specific image."""
|
||||||
session = session or get_session()
|
session = session or get_session()
|
||||||
tags = session.query(models.ImageTag).\
|
tags = session.query(models.ImageTag)\
|
||||||
filter_by(image_id=image_id).\
|
.filter_by(image_id=image_id)\
|
||||||
filter_by(deleted=False).\
|
.filter_by(deleted=False)\
|
||||||
order_by(sqlalchemy.asc(models.ImageTag.created_at)).\
|
.order_by(sqlalchemy.asc(models.ImageTag.created_at))\
|
||||||
all()
|
.all()
|
||||||
return [tag['value'] for tag in tags]
|
return [tag['value'] for tag in tags]
|
||||||
|
@ -50,14 +50,14 @@ def migrate_location_credentials(migrate_engine, to_quoted):
|
|||||||
|
|
||||||
images_table = sqlalchemy.Table('images', meta, autoload=True)
|
images_table = sqlalchemy.Table('images', meta, autoload=True)
|
||||||
|
|
||||||
images = images_table.select(images_table.c.location.startswith('swift')).\
|
images = images_table.select(images_table.c.location.startswith('swift'))\
|
||||||
execute()
|
.execute()
|
||||||
|
|
||||||
for image in images:
|
for image in images:
|
||||||
fixed_uri = fix_uri_credentials(image['location'], to_quoted)
|
fixed_uri = fix_uri_credentials(image['location'], to_quoted)
|
||||||
images_table.update().\
|
images_table.update()\
|
||||||
where(images_table.c.id == image['id']).\
|
.where(images_table.c.id == image['id'])\
|
||||||
values(location=fixed_uri).execute()
|
.values(location=fixed_uri).execute()
|
||||||
|
|
||||||
|
|
||||||
def fix_uri_credentials(uri, to_quoted):
|
def fix_uri_credentials(uri, to_quoted):
|
||||||
|
@ -170,7 +170,7 @@ class ImageCache(object):
|
|||||||
overage = current_size - max_size
|
overage = current_size - max_size
|
||||||
LOG.debug(_("Image cache currently %(overage)d bytes over max "
|
LOG.debug(_("Image cache currently %(overage)d bytes over max "
|
||||||
"size. Starting prune to max size of %(max_size)d ") %
|
"size. Starting prune to max size of %(max_size)d ") %
|
||||||
locals())
|
locals())
|
||||||
|
|
||||||
total_bytes_pruned = 0
|
total_bytes_pruned = 0
|
||||||
total_files_pruned = 0
|
total_files_pruned = 0
|
||||||
|
@ -97,17 +97,21 @@ def get_client(host, port=None, timeout=None, use_ssl=False, username=None,
|
|||||||
else:
|
else:
|
||||||
force_strategy = None
|
force_strategy = None
|
||||||
|
|
||||||
creds = dict(username=username or
|
creds = {
|
||||||
os.getenv('OS_AUTH_USER', os.getenv('OS_USERNAME')),
|
'username': username or
|
||||||
password=password or
|
os.getenv('OS_AUTH_USER', os.getenv('OS_USERNAME')),
|
||||||
os.getenv('OS_AUTH_KEY', os.getenv('OS_PASSWORD')),
|
'password': password or
|
||||||
tenant=tenant or
|
os.getenv('OS_AUTH_KEY', os.getenv('OS_PASSWORD')),
|
||||||
os.getenv('OS_AUTH_TENANT',
|
'tenant': tenant or
|
||||||
os.getenv('OS_TENANT_NAME')),
|
os.getenv('OS_AUTH_TENANT', os.getenv('OS_TENANT_NAME')),
|
||||||
auth_url=auth_url or os.getenv('OS_AUTH_URL'),
|
'auth_url': auth_url or
|
||||||
strategy=force_strategy or auth_strategy or
|
os.getenv('OS_AUTH_URL'),
|
||||||
os.getenv('OS_AUTH_STRATEGY', 'noauth'),
|
'strategy': force_strategy or
|
||||||
region=region or os.getenv('OS_REGION_NAME'))
|
auth_strategy or
|
||||||
|
os.getenv('OS_AUTH_STRATEGY', 'noauth'),
|
||||||
|
'region': region or
|
||||||
|
os.getenv('OS_REGION_NAME'),
|
||||||
|
}
|
||||||
|
|
||||||
if creds['strategy'] == 'keystone' and not creds['auth_url']:
|
if creds['strategy'] == 'keystone' and not creds['auth_url']:
|
||||||
msg = ("--os_auth_url option or OS_AUTH_URL environment variable "
|
msg = ("--os_auth_url option or OS_AUTH_URL environment variable "
|
||||||
|
@ -275,8 +275,8 @@ class Driver(base.Driver):
|
|||||||
final_path = self.get_image_filepath(image_id)
|
final_path = self.get_image_filepath(image_id)
|
||||||
LOG.debug(_("Fetch finished, moving "
|
LOG.debug(_("Fetch finished, moving "
|
||||||
"'%(incomplete_path)s' to '%(final_path)s'"),
|
"'%(incomplete_path)s' to '%(final_path)s'"),
|
||||||
dict(incomplete_path=incomplete_path,
|
dict(incomplete_path=incomplete_path,
|
||||||
final_path=final_path))
|
final_path=final_path))
|
||||||
os.rename(incomplete_path, final_path)
|
os.rename(incomplete_path, final_path)
|
||||||
|
|
||||||
# Make sure that we "pop" the image from the queue...
|
# Make sure that we "pop" the image from the queue...
|
||||||
|
@ -318,8 +318,8 @@ def make_member_list(members, **attr_map):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def _fetch_memb(memb, attr_map):
|
def _fetch_memb(memb, attr_map):
|
||||||
return dict([(k, memb[v]) for k, v in attr_map.items()
|
return dict([(k, memb[v])
|
||||||
if v in memb.keys()])
|
for k, v in attr_map.items() if v in memb.keys()])
|
||||||
|
|
||||||
# Return the list of members with the given attribute mapping
|
# Return the list of members with the given attribute mapping
|
||||||
return [_fetch_memb(memb, attr_map) for memb in members
|
return [_fetch_memb(memb, attr_map) for memb in members
|
||||||
|
@ -602,7 +602,7 @@ class Store(glance.store.base.Store):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
def set_acls(self, location, public=False, read_tenants=[],
|
def set_acls(self, location, public=False, read_tenants=[],
|
||||||
write_tenants=[]):
|
write_tenants=[]):
|
||||||
"""
|
"""
|
||||||
Sets the read and write access control list for an image in the
|
Sets the read and write access control list for an image in the
|
||||||
backend store.
|
backend store.
|
||||||
|
@ -200,12 +200,9 @@ class ApiServer(Server):
|
|||||||
self.key_file = ""
|
self.key_file = ""
|
||||||
self.cert_file = ""
|
self.cert_file = ""
|
||||||
self.metadata_encryption_key = "012345678901234567890123456789ab"
|
self.metadata_encryption_key = "012345678901234567890123456789ab"
|
||||||
self.image_dir = os.path.join(self.test_dir,
|
self.image_dir = os.path.join(self.test_dir, "images")
|
||||||
"images")
|
self.pid_file = pid_file or os.path.join(self.test_dir, "api.pid")
|
||||||
self.pid_file = pid_file or os.path.join(self.test_dir,
|
self.scrubber_datadir = os.path.join(self.test_dir, "scrubber")
|
||||||
"api.pid")
|
|
||||||
self.scrubber_datadir = os.path.join(self.test_dir,
|
|
||||||
"scrubber")
|
|
||||||
self.log_file = os.path.join(self.test_dir, "api.log")
|
self.log_file = os.path.join(self.test_dir, "api.log")
|
||||||
self.s3_store_host = "s3.amazonaws.com"
|
self.s3_store_host = "s3.amazonaws.com"
|
||||||
self.s3_store_access_key = ""
|
self.s3_store_access_key = ""
|
||||||
@ -360,8 +357,7 @@ class RegistryServer(Server):
|
|||||||
self.sql_connection = os.environ.get('GLANCE_TEST_SQL_CONNECTION',
|
self.sql_connection = os.environ.get('GLANCE_TEST_SQL_CONNECTION',
|
||||||
default_sql_connection)
|
default_sql_connection)
|
||||||
|
|
||||||
self.pid_file = os.path.join(self.test_dir,
|
self.pid_file = os.path.join(self.test_dir, "registry.pid")
|
||||||
"registry.pid")
|
|
||||||
self.log_file = os.path.join(self.test_dir, "registry.log")
|
self.log_file = os.path.join(self.test_dir, "registry.log")
|
||||||
self.owner_is_tenant = True
|
self.owner_is_tenant = True
|
||||||
self.server_control_options = '--capture-output'
|
self.server_control_options = '--capture-output'
|
||||||
|
@ -77,8 +77,8 @@ class TestScrubber(functional.FunctionalTest):
|
|||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
||||||
response, content = http.request(path, 'HEAD')
|
response, content = http.request(path, 'HEAD')
|
||||||
if response['x-image-meta-status'] == 'deleted' and \
|
if (response['x-image-meta-status'] == 'deleted' and
|
||||||
response['x-image-meta-deleted'] == 'True':
|
response['x-image-meta-deleted'] == 'True'):
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
@ -138,8 +138,8 @@ class TestScrubber(functional.FunctionalTest):
|
|||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
||||||
response, content = http.request(path, 'HEAD')
|
response, content = http.request(path, 'HEAD')
|
||||||
if response['x-image-meta-status'] == 'deleted' and \
|
if (response['x-image-meta-status'] == 'deleted' and
|
||||||
response['x-image-meta-deleted'] == 'True':
|
response['x-image-meta-deleted'] == 'True'):
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
|
@ -183,7 +183,7 @@ def stub_out_registry_and_store_server(stubs, base_dir):
|
|||||||
stubs.Set(glance.common.client.BaseClient, 'get_connection_type',
|
stubs.Set(glance.common.client.BaseClient, 'get_connection_type',
|
||||||
fake_get_connection_type)
|
fake_get_connection_type)
|
||||||
setattr(glance.common.client.BaseClient, '_stub_orig_sendable',
|
setattr(glance.common.client.BaseClient, '_stub_orig_sendable',
|
||||||
glance.common.client.BaseClient._sendable)
|
glance.common.client.BaseClient._sendable)
|
||||||
stubs.Set(glance.common.client.BaseClient, '_sendable',
|
stubs.Set(glance.common.client.BaseClient, '_sendable',
|
||||||
fake_sendable)
|
fake_sendable)
|
||||||
|
|
||||||
|
@ -37,36 +37,33 @@ glance_replicator = imp.load_source('glance_replicator',
|
|||||||
sys.dont_write_bytecode = False
|
sys.dont_write_bytecode = False
|
||||||
|
|
||||||
|
|
||||||
IMG_RESPONSE_ACTIVE = {'content-length': '0',
|
IMG_RESPONSE_ACTIVE = {
|
||||||
'property-image_state': 'available',
|
'content-length': '0',
|
||||||
'min_ram': '0',
|
'property-image_state': 'available',
|
||||||
'disk_format': 'aki',
|
'min_ram': '0',
|
||||||
'updated_at': '2012-06-25T02:10:36',
|
'disk_format': 'aki',
|
||||||
'date': 'Thu, 28 Jun 2012 07:20:05 GMT',
|
'updated_at': '2012-06-25T02:10:36',
|
||||||
'owner': '8aef75b5c0074a59aa99188fdb4b9e90',
|
'date': 'Thu, 28 Jun 2012 07:20:05 GMT',
|
||||||
'id': '6d55dd55-053a-4765-b7bc-b30df0ea3861',
|
'owner': '8aef75b5c0074a59aa99188fdb4b9e90',
|
||||||
'size': '4660272',
|
'id': '6d55dd55-053a-4765-b7bc-b30df0ea3861',
|
||||||
'property-image_location':
|
'size': '4660272',
|
||||||
('ubuntu-bucket/oneiric-server-cloudimg-amd64-'
|
'property-image_location': 'ubuntu-bucket/oneiric-server-cloudimg-amd64-'
|
||||||
'vmlinuz-generic.manifest.xml'),
|
'vmlinuz-generic.manifest.xml',
|
||||||
'property-architecture': 'x86_64',
|
'property-architecture': 'x86_64',
|
||||||
'etag': 'f46cfe7fb3acaff49a3567031b9b53bb',
|
'etag': 'f46cfe7fb3acaff49a3567031b9b53bb',
|
||||||
'location':
|
'location': 'http://127.0.0.1:9292/v1/images/'
|
||||||
('http://127.0.0.1:9292/v1/images/'
|
'6d55dd55-053a-4765-b7bc-b30df0ea3861',
|
||||||
'6d55dd55-053a-4765-b7bc-b30df0ea3861'),
|
'container_format': 'aki',
|
||||||
'container_format': 'aki',
|
'status': 'active',
|
||||||
'status': 'active',
|
'deleted': 'False',
|
||||||
'deleted': 'False',
|
'min_disk': '0',
|
||||||
'min_disk': '0',
|
'is_public': 'False',
|
||||||
'is_public': 'False',
|
'name': 'ubuntu-bucket/oneiric-server-cloudimg-amd64-vmlinuz-generic',
|
||||||
'name':
|
'checksum': 'f46cfe7fb3acaff49a3567031b9b53bb',
|
||||||
('ubuntu-bucket/oneiric-server-cloudimg-amd64-'
|
'created_at': '2012-06-25T02:10:32',
|
||||||
'vmlinuz-generic'),
|
'protected': 'False',
|
||||||
'checksum': 'f46cfe7fb3acaff49a3567031b9b53bb',
|
'content-type': 'text/html; charset=UTF-8'
|
||||||
'created_at': '2012-06-25T02:10:32',
|
}
|
||||||
'protected': 'False',
|
|
||||||
'content-type': 'text/html; charset=UTF-8'
|
|
||||||
}
|
|
||||||
|
|
||||||
IMG_RESPONSE_QUEUED = copy.copy(IMG_RESPONSE_ACTIVE)
|
IMG_RESPONSE_QUEUED = copy.copy(IMG_RESPONSE_ACTIVE)
|
||||||
IMG_RESPONSE_QUEUED['status'] = 'queued'
|
IMG_RESPONSE_QUEUED['status'] = 'queued'
|
||||||
|
@ -106,7 +106,7 @@ def stub_out_swiftclient(stubs, swift_store_auth_version):
|
|||||||
read_len = fixture_object.len
|
read_len = fixture_object.len
|
||||||
if read_len > MAX_SWIFT_OBJECT_SIZE:
|
if read_len > MAX_SWIFT_OBJECT_SIZE:
|
||||||
msg = ('Image size:%d exceeds Swift max:%d' %
|
msg = ('Image size:%d exceeds Swift max:%d' %
|
||||||
(read_len, MAX_SWIFT_OBJECT_SIZE))
|
(read_len, MAX_SWIFT_OBJECT_SIZE))
|
||||||
raise swiftclient.ClientException(
|
raise swiftclient.ClientException(
|
||||||
msg, http_status=httplib.REQUEST_ENTITY_TOO_LARGE)
|
msg, http_status=httplib.REQUEST_ENTITY_TOO_LARGE)
|
||||||
fixture_objects[fixture_key] = fixture_object
|
fixture_objects[fixture_key] = fixture_object
|
||||||
@ -323,7 +323,7 @@ class SwiftTests(object):
|
|||||||
expected_swift_size = FIVE_KB
|
expected_swift_size = FIVE_KB
|
||||||
expected_swift_contents = "*" * expected_swift_size
|
expected_swift_contents = "*" * expected_swift_size
|
||||||
expected_checksum = \
|
expected_checksum = \
|
||||||
hashlib.md5(expected_swift_contents).hexdigest()
|
hashlib.md5(expected_swift_contents).hexdigest()
|
||||||
|
|
||||||
image_swift = StringIO.StringIO(expected_swift_contents)
|
image_swift = StringIO.StringIO(expected_swift_contents)
|
||||||
|
|
||||||
@ -638,8 +638,7 @@ class TestStoreAuthV1(base.StoreClearingUnitTest, SwiftTests):
|
|||||||
self.config(**conf)
|
self.config(**conf)
|
||||||
super(TestStoreAuthV1, self).setUp()
|
super(TestStoreAuthV1, self).setUp()
|
||||||
self.stubs = stubout.StubOutForTesting()
|
self.stubs = stubout.StubOutForTesting()
|
||||||
stub_out_swiftclient(self.stubs,
|
stub_out_swiftclient(self.stubs, conf['swift_store_auth_version'])
|
||||||
conf['swift_store_auth_version'])
|
|
||||||
self.store = Store()
|
self.store = Store()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
@ -1837,7 +1837,7 @@ class TestRegistryAPI(base.IsolatedUnitTest):
|
|||||||
Tests replacing image members raises right exception
|
Tests replacing image members raises right exception
|
||||||
"""
|
"""
|
||||||
self.api = test_utils.FakeAuthMiddleware(rserver.API(self.mapper),
|
self.api = test_utils.FakeAuthMiddleware(rserver.API(self.mapper),
|
||||||
is_admin=False)
|
is_admin=False)
|
||||||
fixture = dict(member_id='pattieblack')
|
fixture = dict(member_id='pattieblack')
|
||||||
|
|
||||||
req = webob.Request.blank('/images/%s/members' % UUID2)
|
req = webob.Request.blank('/images/%s/members' % UUID2)
|
||||||
@ -1853,7 +1853,7 @@ class TestRegistryAPI(base.IsolatedUnitTest):
|
|||||||
Tests adding image members raises right exception
|
Tests adding image members raises right exception
|
||||||
"""
|
"""
|
||||||
self.api = test_utils.FakeAuthMiddleware(rserver.API(self.mapper),
|
self.api = test_utils.FakeAuthMiddleware(rserver.API(self.mapper),
|
||||||
is_admin=False)
|
is_admin=False)
|
||||||
req = webob.Request.blank('/images/%s/members/pattieblack' % UUID2)
|
req = webob.Request.blank('/images/%s/members/pattieblack' % UUID2)
|
||||||
req.method = 'PUT'
|
req.method = 'PUT'
|
||||||
|
|
||||||
@ -1865,7 +1865,7 @@ class TestRegistryAPI(base.IsolatedUnitTest):
|
|||||||
Tests deleting image members raises right exception
|
Tests deleting image members raises right exception
|
||||||
"""
|
"""
|
||||||
self.api = test_utils.FakeAuthMiddleware(rserver.API(self.mapper),
|
self.api = test_utils.FakeAuthMiddleware(rserver.API(self.mapper),
|
||||||
is_admin=False)
|
is_admin=False)
|
||||||
req = webob.Request.blank('/images/%s/members/pattieblack' % UUID2)
|
req = webob.Request.blank('/images/%s/members/pattieblack' % UUID2)
|
||||||
req.method = 'DELETE'
|
req.method = 'DELETE'
|
||||||
|
|
||||||
@ -3087,7 +3087,7 @@ class TestGlanceAPI(base.IsolatedUnitTest):
|
|||||||
Tests replacing image members raises right exception
|
Tests replacing image members raises right exception
|
||||||
"""
|
"""
|
||||||
self.api = test_utils.FakeAuthMiddleware(router.API(self.mapper),
|
self.api = test_utils.FakeAuthMiddleware(router.API(self.mapper),
|
||||||
is_admin=False)
|
is_admin=False)
|
||||||
fixture = dict(member_id='pattieblack')
|
fixture = dict(member_id='pattieblack')
|
||||||
|
|
||||||
req = webob.Request.blank('/images/%s/members' % UUID2)
|
req = webob.Request.blank('/images/%s/members' % UUID2)
|
||||||
@ -3103,7 +3103,7 @@ class TestGlanceAPI(base.IsolatedUnitTest):
|
|||||||
Tests adding image members raises right exception
|
Tests adding image members raises right exception
|
||||||
"""
|
"""
|
||||||
self.api = test_utils.FakeAuthMiddleware(router.API(self.mapper),
|
self.api = test_utils.FakeAuthMiddleware(router.API(self.mapper),
|
||||||
is_admin=False)
|
is_admin=False)
|
||||||
req = webob.Request.blank('/images/%s/members/pattieblack' % UUID2)
|
req = webob.Request.blank('/images/%s/members/pattieblack' % UUID2)
|
||||||
req.method = 'PUT'
|
req.method = 'PUT'
|
||||||
|
|
||||||
@ -3115,7 +3115,7 @@ class TestGlanceAPI(base.IsolatedUnitTest):
|
|||||||
Tests deleting image members raises right exception
|
Tests deleting image members raises right exception
|
||||||
"""
|
"""
|
||||||
self.api = test_utils.FakeAuthMiddleware(router.API(self.mapper),
|
self.api = test_utils.FakeAuthMiddleware(router.API(self.mapper),
|
||||||
is_admin=False)
|
is_admin=False)
|
||||||
req = webob.Request.blank('/images/%s/members/pattieblack' % UUID2)
|
req = webob.Request.blank('/images/%s/members/pattieblack' % UUID2)
|
||||||
req.method = 'DELETE'
|
req.method = 'DELETE'
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ def run_command(cmd, redirect_output=True, check_exit_code=True):
|
|||||||
HAS_EASY_INSTALL = bool(run_command(['which', 'easy_install'],
|
HAS_EASY_INSTALL = bool(run_command(['which', 'easy_install'],
|
||||||
check_exit_code=False).strip())
|
check_exit_code=False).strip())
|
||||||
HAS_VIRTUALENV = bool(run_command(['which', 'virtualenv'],
|
HAS_VIRTUALENV = bool(run_command(['which', 'virtualenv'],
|
||||||
check_exit_code=False).strip())
|
check_exit_code=False).strip())
|
||||||
|
|
||||||
|
|
||||||
def check_dependencies():
|
def check_dependencies():
|
||||||
|
2
tox.ini
2
tox.ini
@ -18,7 +18,7 @@ downloadcache = ~/cache/pip
|
|||||||
|
|
||||||
[testenv:pep8]
|
[testenv:pep8]
|
||||||
deps = pep8==1.3.3
|
deps = pep8==1.3.3
|
||||||
commands = pep8 --ignore=E125,E126,E127,E128,E711 --repeat --show-source --exclude=.venv,.tox,dist,doc,openstack .
|
commands = pep8 --ignore=E125,E126,E128,E711 --repeat --show-source --exclude=.venv,.tox,dist,doc,openstack .
|
||||||
|
|
||||||
[testenv:cover]
|
[testenv:cover]
|
||||||
setenv = NOSE_WITH_COVERAGE=1
|
setenv = NOSE_WITH_COVERAGE=1
|
||||||
|
Loading…
Reference in New Issue
Block a user