Clean up pep8 E128 violations
Fixed E128 errors All ignores are to be removed in the next sequence of patches Change-Id: I3ccff7df8c382f83ae6aa9aa6a7f16324c3aec75
This commit is contained in:
parent
46d38734ec
commit
cb64f58b99
@ -47,7 +47,8 @@ class BaseController(object):
|
|||||||
except exception.Forbidden:
|
except exception.Forbidden:
|
||||||
msg = _("Forbidden image access")
|
msg = _("Forbidden image access")
|
||||||
LOG.debug(msg)
|
LOG.debug(msg)
|
||||||
raise webob.exc.HTTPForbidden(msg, request=request,
|
raise webob.exc.HTTPForbidden(msg,
|
||||||
|
request=request,
|
||||||
content_type='text/plain')
|
content_type='text/plain')
|
||||||
|
|
||||||
def get_active_image_meta_or_404(self, request, image_id):
|
def get_active_image_meta_or_404(self, request, image_id):
|
||||||
|
@ -361,8 +361,8 @@ class Controller(controller.BaseController):
|
|||||||
image_meta = registry.add_image_metadata(req.context, image_meta)
|
image_meta = registry.add_image_metadata(req.context, image_meta)
|
||||||
return image_meta
|
return image_meta
|
||||||
except exception.Duplicate:
|
except exception.Duplicate:
|
||||||
msg = (_("An image with identifier %s already exists")
|
msg = (_("An image with identifier %s already exists") %
|
||||||
% image_meta['id'])
|
image_meta['id'])
|
||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise HTTPConflict(explanation=msg,
|
raise HTTPConflict(explanation=msg,
|
||||||
request=req,
|
request=req,
|
||||||
@ -600,7 +600,8 @@ class Controller(controller.BaseController):
|
|||||||
|
|
||||||
def _handle_source(self, req, image_id, image_meta, image_data):
|
def _handle_source(self, req, image_id, image_meta, image_data):
|
||||||
if image_data:
|
if image_data:
|
||||||
image_meta = self._validate_image_for_activation(req, image_id,
|
image_meta = self._validate_image_for_activation(req,
|
||||||
|
image_id,
|
||||||
image_meta)
|
image_meta)
|
||||||
image_meta = self._upload_and_activate(req, image_meta)
|
image_meta = self._upload_and_activate(req, image_meta)
|
||||||
elif self._copy_from(req):
|
elif self._copy_from(req):
|
||||||
|
@ -290,11 +290,12 @@ class RequestDeserializer(wsgi.JSONRequestDeserializer):
|
|||||||
|
|
||||||
_readonly_properties = ['created_at', 'updated_at', 'status', 'checksum',
|
_readonly_properties = ['created_at', 'updated_at', 'status', 'checksum',
|
||||||
'size', 'direct_url', 'self', 'file', 'schema']
|
'size', 'direct_url', 'self', 'file', 'schema']
|
||||||
_reserved_properties = ['owner', 'is_public', 'location',
|
_reserved_properties = ['owner', 'is_public', 'location', 'deleted',
|
||||||
'deleted', 'deleted_at']
|
'deleted_at']
|
||||||
_base_properties = ['checksum', 'created_at', 'container_format',
|
_base_properties = ['checksum', 'created_at', 'container_format',
|
||||||
'disk_format', 'id', 'min_disk', 'min_ram', 'name', 'size',
|
'disk_format', 'id', 'min_disk', 'min_ram', 'name',
|
||||||
'status', 'tags', 'updated_at', 'visibility', 'protected']
|
'size', 'status', 'tags', 'updated_at', 'visibility',
|
||||||
|
'protected']
|
||||||
|
|
||||||
def __init__(self, schema=None):
|
def __init__(self, schema=None):
|
||||||
super(RequestDeserializer, self).__init__()
|
super(RequestDeserializer, self).__init__()
|
||||||
|
@ -98,9 +98,13 @@ def get_socket(default_port):
|
|||||||
# TODO(jaypipes): eventlet's greened socket module does not actually
|
# TODO(jaypipes): eventlet's greened socket module does not actually
|
||||||
# support IPv6 in getaddrinfo(). We need to get around this in the
|
# support IPv6 in getaddrinfo(). We need to get around this in the
|
||||||
# future or monitor upstream for a fix
|
# future or monitor upstream for a fix
|
||||||
address_family = [addr[0] for addr in socket.getaddrinfo(bind_addr[0],
|
address_family = [
|
||||||
bind_addr[1], socket.AF_UNSPEC, socket.SOCK_STREAM)
|
addr[0] for addr in socket.getaddrinfo(bind_addr[0],
|
||||||
if addr[0] in (socket.AF_INET, socket.AF_INET6)][0]
|
bind_addr[1],
|
||||||
|
socket.AF_UNSPEC,
|
||||||
|
socket.SOCK_STREAM)
|
||||||
|
if addr[0] in (socket.AF_INET, socket.AF_INET6)
|
||||||
|
][0]
|
||||||
|
|
||||||
cert_file = CONF.cert_file
|
cert_file = CONF.cert_file
|
||||||
key_file = CONF.key_file
|
key_file = CONF.key_file
|
||||||
@ -272,8 +276,10 @@ class Server(object):
|
|||||||
raise exception.WorkerCreationFailure(reason=msg)
|
raise exception.WorkerCreationFailure(reason=msg)
|
||||||
self.pool = self.create_pool()
|
self.pool = self.create_pool()
|
||||||
try:
|
try:
|
||||||
eventlet.wsgi.server(self.sock, self.app_func(),
|
eventlet.wsgi.server(self.sock,
|
||||||
log=WritableLogger(self.logger), custom_pool=self.pool)
|
self.app_func(),
|
||||||
|
log=WritableLogger(self.logger),
|
||||||
|
custom_pool=self.pool)
|
||||||
except socket.error, err:
|
except socket.error, err:
|
||||||
if err[0] != errno.EINVAL:
|
if err[0] != errno.EINVAL:
|
||||||
raise
|
raise
|
||||||
|
@ -239,7 +239,8 @@ def image_get_all(context, filters=None, marker=None, limit=None,
|
|||||||
@log_call
|
@log_call
|
||||||
def image_property_create(context, values):
|
def image_property_create(context, values):
|
||||||
image = image_get(context, values['image_id'])
|
image = image_get(context, values['image_id'])
|
||||||
prop = _image_property_format(values['image_id'], values['name'],
|
prop = _image_property_format(values['image_id'],
|
||||||
|
values['name'],
|
||||||
values['value'])
|
values['value'])
|
||||||
image['properties'].append(prop)
|
image['properties'].append(prop)
|
||||||
return prop
|
return prop
|
||||||
|
@ -22,19 +22,26 @@ from glance.db.sqlalchemy.migrate_repo.schema import (
|
|||||||
|
|
||||||
|
|
||||||
def define_images_table(meta):
|
def define_images_table(meta):
|
||||||
images = Table('images', meta,
|
images = Table('images',
|
||||||
|
meta,
|
||||||
Column('id', Integer(), primary_key=True, nullable=False),
|
Column('id', Integer(), primary_key=True, nullable=False),
|
||||||
Column('name', String(255)),
|
Column('name', String(255)),
|
||||||
Column('type', String(30)),
|
Column('type', String(30)),
|
||||||
Column('size', Integer()),
|
Column('size', Integer()),
|
||||||
Column('status', String(30), nullable=False),
|
Column('status', String(30), nullable=False),
|
||||||
Column('is_public', Boolean(), nullable=False, default=False,
|
Column('is_public',
|
||||||
|
Boolean(),
|
||||||
|
nullable=False,
|
||||||
|
default=False,
|
||||||
index=True),
|
index=True),
|
||||||
Column('location', Text()),
|
Column('location', Text()),
|
||||||
Column('created_at', DateTime(), nullable=False),
|
Column('created_at', DateTime(), nullable=False),
|
||||||
Column('updated_at', DateTime()),
|
Column('updated_at', DateTime()),
|
||||||
Column('deleted_at', DateTime()),
|
Column('deleted_at', DateTime()),
|
||||||
Column('deleted', Boolean(), nullable=False, default=False,
|
Column('deleted',
|
||||||
|
Boolean(),
|
||||||
|
nullable=False,
|
||||||
|
default=False,
|
||||||
index=True),
|
index=True),
|
||||||
mysql_engine='InnoDB',
|
mysql_engine='InnoDB',
|
||||||
extend_existing=True)
|
extend_existing=True)
|
||||||
|
@ -29,22 +29,33 @@ def define_image_properties_table(meta):
|
|||||||
|
|
||||||
images = define_images_table(meta)
|
images = define_images_table(meta)
|
||||||
|
|
||||||
image_properties = Table('image_properties', meta,
|
image_properties = Table('image_properties',
|
||||||
Column('id', Integer(), primary_key=True, nullable=False),
|
meta,
|
||||||
Column('image_id', Integer(), ForeignKey('images.id'), nullable=False,
|
Column('id',
|
||||||
|
Integer(),
|
||||||
|
primary_key=True,
|
||||||
|
nullable=False),
|
||||||
|
Column('image_id',
|
||||||
|
Integer(),
|
||||||
|
ForeignKey('images.id'),
|
||||||
|
nullable=False,
|
||||||
index=True),
|
index=True),
|
||||||
Column('key', String(255), nullable=False),
|
Column('key', String(255), nullable=False),
|
||||||
Column('value', Text()),
|
Column('value', Text()),
|
||||||
Column('created_at', DateTime(), nullable=False),
|
Column('created_at', DateTime(), nullable=False),
|
||||||
Column('updated_at', DateTime()),
|
Column('updated_at', DateTime()),
|
||||||
Column('deleted_at', DateTime()),
|
Column('deleted_at', DateTime()),
|
||||||
Column('deleted', Boolean(), nullable=False, default=False,
|
Column('deleted',
|
||||||
|
Boolean(),
|
||||||
|
nullable=False,
|
||||||
|
default=False,
|
||||||
index=True),
|
index=True),
|
||||||
UniqueConstraint('image_id', 'key'),
|
UniqueConstraint('image_id', 'key'),
|
||||||
mysql_engine='InnoDB',
|
mysql_engine='InnoDB',
|
||||||
extend_existing=True)
|
extend_existing=True)
|
||||||
|
|
||||||
Index('ix_image_properties_image_id_key', image_properties.c.image_id,
|
Index('ix_image_properties_image_id_key',
|
||||||
|
image_properties.c.image_id,
|
||||||
image_properties.c.key)
|
image_properties.c.key)
|
||||||
|
|
||||||
return image_properties
|
return image_properties
|
||||||
|
@ -27,20 +27,27 @@ def get_images_table(meta):
|
|||||||
Returns the Table object for the images table that
|
Returns the Table object for the images table that
|
||||||
corresponds to the images table definition of this version.
|
corresponds to the images table definition of this version.
|
||||||
"""
|
"""
|
||||||
images = Table('images', meta,
|
images = Table('images',
|
||||||
|
meta,
|
||||||
Column('id', Integer(), primary_key=True, nullable=False),
|
Column('id', Integer(), primary_key=True, nullable=False),
|
||||||
Column('name', String(255)),
|
Column('name', String(255)),
|
||||||
Column('disk_format', String(20)),
|
Column('disk_format', String(20)),
|
||||||
Column('container_format', String(20)),
|
Column('container_format', String(20)),
|
||||||
Column('size', Integer()),
|
Column('size', Integer()),
|
||||||
Column('status', String(30), nullable=False),
|
Column('status', String(30), nullable=False),
|
||||||
Column('is_public', Boolean(), nullable=False, default=False,
|
Column('is_public',
|
||||||
|
Boolean(),
|
||||||
|
nullable=False,
|
||||||
|
default=False,
|
||||||
index=True),
|
index=True),
|
||||||
Column('location', Text()),
|
Column('location', Text()),
|
||||||
Column('created_at', DateTime(), nullable=False),
|
Column('created_at', DateTime(), nullable=False),
|
||||||
Column('updated_at', DateTime()),
|
Column('updated_at', DateTime()),
|
||||||
Column('deleted_at', DateTime()),
|
Column('deleted_at', DateTime()),
|
||||||
Column('deleted', Boolean(), nullable=False, default=False,
|
Column('deleted',
|
||||||
|
Boolean(),
|
||||||
|
nullable=False,
|
||||||
|
default=False,
|
||||||
index=True),
|
index=True),
|
||||||
mysql_engine='InnoDB',
|
mysql_engine='InnoDB',
|
||||||
useexisting=True)
|
useexisting=True)
|
||||||
|
@ -27,20 +27,27 @@ def get_images_table(meta):
|
|||||||
Returns the Table object for the images table that
|
Returns the Table object for the images table that
|
||||||
corresponds to the images table definition of this version.
|
corresponds to the images table definition of this version.
|
||||||
"""
|
"""
|
||||||
images = Table('images', meta,
|
images = Table('images',
|
||||||
|
meta,
|
||||||
Column('id', Integer(), primary_key=True, nullable=False),
|
Column('id', Integer(), primary_key=True, nullable=False),
|
||||||
Column('name', String(255)),
|
Column('name', String(255)),
|
||||||
Column('disk_format', String(20)),
|
Column('disk_format', String(20)),
|
||||||
Column('container_format', String(20)),
|
Column('container_format', String(20)),
|
||||||
Column('size', Integer()),
|
Column('size', Integer()),
|
||||||
Column('status', String(30), nullable=False),
|
Column('status', String(30), nullable=False),
|
||||||
Column('is_public', Boolean(), nullable=False, default=False,
|
Column('is_public',
|
||||||
|
Boolean(),
|
||||||
|
nullable=False,
|
||||||
|
default=False,
|
||||||
index=True),
|
index=True),
|
||||||
Column('location', Text()),
|
Column('location', Text()),
|
||||||
Column('created_at', DateTime(), nullable=False),
|
Column('created_at', DateTime(), nullable=False),
|
||||||
Column('updated_at', DateTime()),
|
Column('updated_at', DateTime()),
|
||||||
Column('deleted_at', DateTime()),
|
Column('deleted_at', DateTime()),
|
||||||
Column('deleted', Boolean(), nullable=False, default=False,
|
Column('deleted',
|
||||||
|
Boolean(),
|
||||||
|
nullable=False,
|
||||||
|
default=False,
|
||||||
index=True),
|
index=True),
|
||||||
Column('checksum', String(32)),
|
Column('checksum', String(32)),
|
||||||
mysql_engine='InnoDB',
|
mysql_engine='InnoDB',
|
||||||
|
@ -28,20 +28,27 @@ def get_images_table(meta):
|
|||||||
Returns the Table object for the images table that
|
Returns the Table object for the images table that
|
||||||
corresponds to the images table definition of this version.
|
corresponds to the images table definition of this version.
|
||||||
"""
|
"""
|
||||||
images = Table('images', meta,
|
images = Table('images',
|
||||||
|
meta,
|
||||||
Column('id', Integer(), primary_key=True, nullable=False),
|
Column('id', Integer(), primary_key=True, nullable=False),
|
||||||
Column('name', String(255)),
|
Column('name', String(255)),
|
||||||
Column('disk_format', String(20)),
|
Column('disk_format', String(20)),
|
||||||
Column('container_format', String(20)),
|
Column('container_format', String(20)),
|
||||||
Column('size', BigInteger()),
|
Column('size', BigInteger()),
|
||||||
Column('status', String(30), nullable=False),
|
Column('status', String(30), nullable=False),
|
||||||
Column('is_public', Boolean(), nullable=False, default=False,
|
Column('is_public',
|
||||||
|
Boolean(),
|
||||||
|
nullable=False,
|
||||||
|
default=False,
|
||||||
index=True),
|
index=True),
|
||||||
Column('location', Text()),
|
Column('location', Text()),
|
||||||
Column('created_at', DateTime(), nullable=False),
|
Column('created_at', DateTime(), nullable=False),
|
||||||
Column('updated_at', DateTime()),
|
Column('updated_at', DateTime()),
|
||||||
Column('deleted_at', DateTime()),
|
Column('deleted_at', DateTime()),
|
||||||
Column('deleted', Boolean(), nullable=False, default=False,
|
Column('deleted',
|
||||||
|
Boolean(),
|
||||||
|
nullable=False,
|
||||||
|
default=False,
|
||||||
index=True),
|
index=True),
|
||||||
mysql_engine='InnoDB',
|
mysql_engine='InnoDB',
|
||||||
useexisting=True)
|
useexisting=True)
|
||||||
|
@ -43,16 +43,26 @@ def get_image_properties_table(meta):
|
|||||||
|
|
||||||
images = get_images_table(meta)
|
images = get_images_table(meta)
|
||||||
|
|
||||||
image_properties = Table('image_properties', meta,
|
image_properties = Table('image_properties',
|
||||||
Column('id', Integer(), primary_key=True, nullable=False),
|
meta,
|
||||||
Column('image_id', Integer(), ForeignKey('images.id'), nullable=False,
|
Column('id',
|
||||||
|
Integer(),
|
||||||
|
primary_key=True,
|
||||||
|
nullable=False),
|
||||||
|
Column('image_id',
|
||||||
|
Integer(),
|
||||||
|
ForeignKey('images.id'),
|
||||||
|
nullable=False,
|
||||||
index=True),
|
index=True),
|
||||||
Column('name', String(255), nullable=False),
|
Column('name', String(255), nullable=False),
|
||||||
Column('value', Text()),
|
Column('value', Text()),
|
||||||
Column('created_at', DateTime(), nullable=False),
|
Column('created_at', DateTime(), nullable=False),
|
||||||
Column('updated_at', DateTime()),
|
Column('updated_at', DateTime()),
|
||||||
Column('deleted_at', DateTime()),
|
Column('deleted_at', DateTime()),
|
||||||
Column('deleted', Boolean(), nullable=False, default=False,
|
Column('deleted',
|
||||||
|
Boolean(),
|
||||||
|
nullable=False,
|
||||||
|
default=False,
|
||||||
index=True),
|
index=True),
|
||||||
UniqueConstraint('image_id', 'name'),
|
UniqueConstraint('image_id', 'name'),
|
||||||
mysql_engine='InnoDB',
|
mysql_engine='InnoDB',
|
||||||
|
@ -28,20 +28,27 @@ def get_images_table(meta):
|
|||||||
Returns the Table object for the images table that corresponds to
|
Returns the Table object for the images table that corresponds to
|
||||||
the images table definition of this version.
|
the images table definition of this version.
|
||||||
"""
|
"""
|
||||||
images = Table('images', meta,
|
images = Table('images',
|
||||||
|
meta,
|
||||||
Column('id', Integer(), primary_key=True, nullable=False),
|
Column('id', Integer(), primary_key=True, nullable=False),
|
||||||
Column('name', String(255)),
|
Column('name', String(255)),
|
||||||
Column('disk_format', String(20)),
|
Column('disk_format', String(20)),
|
||||||
Column('container_format', String(20)),
|
Column('container_format', String(20)),
|
||||||
Column('size', BigInteger()),
|
Column('size', BigInteger()),
|
||||||
Column('status', String(30), nullable=False),
|
Column('status', String(30), nullable=False),
|
||||||
Column('is_public', Boolean(), nullable=False, default=False,
|
Column('is_public',
|
||||||
|
Boolean(),
|
||||||
|
nullable=False,
|
||||||
|
default=False,
|
||||||
index=True),
|
index=True),
|
||||||
Column('location', Text()),
|
Column('location', Text()),
|
||||||
Column('created_at', DateTime(), nullable=False),
|
Column('created_at', DateTime(), nullable=False),
|
||||||
Column('updated_at', DateTime()),
|
Column('updated_at', DateTime()),
|
||||||
Column('deleted_at', DateTime()),
|
Column('deleted_at', DateTime()),
|
||||||
Column('deleted', Boolean(), nullable=False, default=False,
|
Column('deleted',
|
||||||
|
Boolean(),
|
||||||
|
nullable=False,
|
||||||
|
default=False,
|
||||||
index=True),
|
index=True),
|
||||||
Column('checksum', String(32)),
|
Column('checksum', String(32)),
|
||||||
Column('owner', String(255)),
|
Column('owner', String(255)),
|
||||||
|
@ -48,16 +48,29 @@ def get_image_properties_table(meta):
|
|||||||
def get_image_members_table(meta):
|
def get_image_members_table(meta):
|
||||||
images = get_images_table(meta)
|
images = get_images_table(meta)
|
||||||
|
|
||||||
image_members = Table('image_members', meta,
|
image_members = Table('image_members',
|
||||||
Column('id', Integer(), primary_key=True, nullable=False),
|
meta,
|
||||||
Column('image_id', Integer(), ForeignKey('images.id'), nullable=False,
|
Column('id',
|
||||||
|
Integer(),
|
||||||
|
primary_key=True,
|
||||||
|
nullable=False),
|
||||||
|
Column('image_id',
|
||||||
|
Integer(),
|
||||||
|
ForeignKey('images.id'),
|
||||||
|
nullable=False,
|
||||||
index=True),
|
index=True),
|
||||||
Column('member', String(255), nullable=False),
|
Column('member', String(255), nullable=False),
|
||||||
Column('can_share', Boolean(), nullable=False, default=False),
|
Column('can_share',
|
||||||
|
Boolean(),
|
||||||
|
nullable=False,
|
||||||
|
default=False),
|
||||||
Column('created_at', DateTime(), nullable=False),
|
Column('created_at', DateTime(), nullable=False),
|
||||||
Column('updated_at', DateTime()),
|
Column('updated_at', DateTime()),
|
||||||
Column('deleted_at', DateTime()),
|
Column('deleted_at', DateTime()),
|
||||||
Column('deleted', Boolean(), nullable=False, default=False,
|
Column('deleted',
|
||||||
|
Boolean(),
|
||||||
|
nullable=False,
|
||||||
|
default=False,
|
||||||
index=True),
|
index=True),
|
||||||
UniqueConstraint('image_id', 'member'),
|
UniqueConstraint('image_id', 'member'),
|
||||||
mysql_engine='InnoDB',
|
mysql_engine='InnoDB',
|
||||||
|
@ -27,20 +27,27 @@ def get_images_table(meta):
|
|||||||
Returns the Table object for the images table that
|
Returns the Table object for the images table that
|
||||||
corresponds to the images table definition of this version.
|
corresponds to the images table definition of this version.
|
||||||
"""
|
"""
|
||||||
images = Table('images', meta,
|
images = Table('images',
|
||||||
|
meta,
|
||||||
Column('id', Integer(), primary_key=True, nullable=False),
|
Column('id', Integer(), primary_key=True, nullable=False),
|
||||||
Column('name', String(255)),
|
Column('name', String(255)),
|
||||||
Column('disk_format', String(20)),
|
Column('disk_format', String(20)),
|
||||||
Column('container_format', String(20)),
|
Column('container_format', String(20)),
|
||||||
Column('size', Integer()),
|
Column('size', Integer()),
|
||||||
Column('status', String(30), nullable=False),
|
Column('status', String(30), nullable=False),
|
||||||
Column('is_public', Boolean(), nullable=False, default=False,
|
Column('is_public',
|
||||||
|
Boolean(),
|
||||||
|
nullable=False,
|
||||||
|
default=False,
|
||||||
index=True),
|
index=True),
|
||||||
Column('location', Text()),
|
Column('location', Text()),
|
||||||
Column('created_at', DateTime(), nullable=False),
|
Column('created_at', DateTime(), nullable=False),
|
||||||
Column('updated_at', DateTime()),
|
Column('updated_at', DateTime()),
|
||||||
Column('deleted_at', DateTime()),
|
Column('deleted_at', DateTime()),
|
||||||
Column('deleted', Boolean(), nullable=False, default=False,
|
Column('deleted',
|
||||||
|
Boolean(),
|
||||||
|
nullable=False,
|
||||||
|
default=False,
|
||||||
index=True),
|
index=True),
|
||||||
Column('checksum', String(32)),
|
Column('checksum', String(32)),
|
||||||
Column('min_disk', Integer(), default=0),
|
Column('min_disk', Integer(), default=0),
|
||||||
|
@ -22,16 +22,29 @@ def define_image_tags_table(meta):
|
|||||||
# Load the images table so the foreign key can be set up properly
|
# Load the images table so the foreign key can be set up properly
|
||||||
schema.Table('images', meta, autoload=True)
|
schema.Table('images', meta, autoload=True)
|
||||||
|
|
||||||
image_tags = schema.Table('image_tags', meta,
|
image_tags = schema.Table('image_tags',
|
||||||
schema.Column('id', glance_schema.Integer(),
|
meta,
|
||||||
primary_key=True, nullable=False),
|
schema.Column('id',
|
||||||
schema.Column('image_id', glance_schema.String(36),
|
glance_schema.Integer(),
|
||||||
schema.ForeignKey('images.id'), nullable=False),
|
primary_key=True,
|
||||||
schema.Column('value', glance_schema.String(255), nullable=False),
|
nullable=False),
|
||||||
schema.Column('created_at', glance_schema.DateTime(), nullable=False),
|
schema.Column('image_id',
|
||||||
schema.Column('updated_at', glance_schema.DateTime()),
|
glance_schema.String(36),
|
||||||
schema.Column('deleted_at', glance_schema.DateTime()),
|
schema.ForeignKey('images.id'),
|
||||||
schema.Column('deleted', glance_schema.Boolean(), nullable=False,
|
nullable=False),
|
||||||
|
schema.Column('value',
|
||||||
|
glance_schema.String(255),
|
||||||
|
nullable=False),
|
||||||
|
schema.Column('created_at',
|
||||||
|
glance_schema.DateTime(),
|
||||||
|
nullable=False),
|
||||||
|
schema.Column('updated_at',
|
||||||
|
glance_schema.DateTime()),
|
||||||
|
schema.Column('deleted_at',
|
||||||
|
glance_schema.DateTime()),
|
||||||
|
schema.Column('deleted',
|
||||||
|
glance_schema.Boolean(),
|
||||||
|
nullable=False,
|
||||||
default=False),
|
default=False),
|
||||||
mysql_engine='InnoDB')
|
mysql_engine='InnoDB')
|
||||||
|
|
||||||
|
@ -86,7 +86,8 @@ class RegistryClient(BaseClient):
|
|||||||
def do_request(self, method, action, **kwargs):
|
def do_request(self, method, action, **kwargs):
|
||||||
try:
|
try:
|
||||||
res = super(RegistryClient, self).do_request(method,
|
res = super(RegistryClient, self).do_request(method,
|
||||||
action, **kwargs)
|
action,
|
||||||
|
**kwargs)
|
||||||
status = res.status
|
status = res.status
|
||||||
request_id = res.getheader('x-openstack-request-id')
|
request_id = res.getheader('x-openstack-request-id')
|
||||||
msg = _("Registry request %(method)s %(action)s HTTP %(status)s"
|
msg = _("Registry request %(method)s %(action)s HTTP %(status)s"
|
||||||
@ -94,8 +95,8 @@ class RegistryClient(BaseClient):
|
|||||||
LOG.debug(msg % locals())
|
LOG.debug(msg % locals())
|
||||||
|
|
||||||
except:
|
except:
|
||||||
LOG.exception(_("Registry request %(method)s %(action)s Exception")
|
LOG.exception(_("Registry request %(method)s %(action)s "
|
||||||
% locals())
|
"Exception") % locals())
|
||||||
raise
|
raise
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
@ -296,7 +296,8 @@ class Store(glance.store.base.Store):
|
|||||||
msg = _("Retrieved image object from S3 using (s3_host=%(s3_host)s, "
|
msg = _("Retrieved image object from S3 using (s3_host=%(s3_host)s, "
|
||||||
"access_key=%(accesskey)s, bucket=%(bucket)s, "
|
"access_key=%(accesskey)s, bucket=%(bucket)s, "
|
||||||
"key=%(obj_name)s)") % ({'s3_host': loc.s3serviceurl,
|
"key=%(obj_name)s)") % ({'s3_host': loc.s3serviceurl,
|
||||||
'accesskey': loc.accesskey, 'bucket': loc.bucket,
|
'accesskey': loc.accesskey,
|
||||||
|
'bucket': loc.bucket,
|
||||||
'obj_name': loc.key})
|
'obj_name': loc.key})
|
||||||
LOG.debug(msg)
|
LOG.debug(msg)
|
||||||
|
|
||||||
@ -358,7 +359,8 @@ class Store(glance.store.base.Store):
|
|||||||
msg = _("Adding image object to S3 using (s3_host=%(s3_host)s, "
|
msg = _("Adding image object to S3 using (s3_host=%(s3_host)s, "
|
||||||
"access_key=%(access_key)s, bucket=%(bucket)s, "
|
"access_key=%(access_key)s, bucket=%(bucket)s, "
|
||||||
"key=%(obj_name)s)") % ({'s3_host': self.s3_host,
|
"key=%(obj_name)s)") % ({'s3_host': self.s3_host,
|
||||||
'access_key': self.access_key, 'bucket': self.bucket,
|
'access_key': self.access_key,
|
||||||
|
'bucket': self.bucket,
|
||||||
'obj_name': obj_name})
|
'obj_name': obj_name})
|
||||||
LOG.debug(msg)
|
LOG.debug(msg)
|
||||||
|
|
||||||
@ -426,7 +428,8 @@ class Store(glance.store.base.Store):
|
|||||||
msg = _("Deleting image object from S3 using (s3_host=%(s3_host)s, "
|
msg = _("Deleting image object from S3 using (s3_host=%(s3_host)s, "
|
||||||
"access_key=%(accesskey)s, bucket=%(bucket)s, "
|
"access_key=%(accesskey)s, bucket=%(bucket)s, "
|
||||||
"key=%(obj_name)s)") % ({'s3_host': loc.s3serviceurl,
|
"key=%(obj_name)s)") % ({'s3_host': loc.s3serviceurl,
|
||||||
'accesskey': loc.accesskey, 'bucket': loc.bucket,
|
'accesskey': loc.accesskey,
|
||||||
|
'bucket': loc.bucket,
|
||||||
'obj_name': loc.key})
|
'obj_name': loc.key})
|
||||||
LOG.debug(msg)
|
LOG.debug(msg)
|
||||||
|
|
||||||
|
@ -543,7 +543,8 @@ class Store(glance.store.base.Store):
|
|||||||
except swiftclient.ClientException, e:
|
except swiftclient.ClientException, e:
|
||||||
if e.http_status == httplib.CONFLICT:
|
if e.http_status == httplib.CONFLICT:
|
||||||
raise exception.Duplicate(_("Swift already has an image at "
|
raise exception.Duplicate(_("Swift already has an image at "
|
||||||
"location %s") % location.get_uri())
|
"location %s") %
|
||||||
|
location.get_uri())
|
||||||
msg = (_("Failed to add object to Swift.\n"
|
msg = (_("Failed to add object to Swift.\n"
|
||||||
"Got error from Swift: %(e)s") % locals())
|
"Got error from Swift: %(e)s") % locals())
|
||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
@ -683,8 +684,8 @@ def create_container_if_missing(container, swift_conn):
|
|||||||
msg = (_("The container %(container)s does not exist in "
|
msg = (_("The container %(container)s does not exist in "
|
||||||
"Swift. Please set the "
|
"Swift. Please set the "
|
||||||
"swift_store_create_container_on_put option"
|
"swift_store_create_container_on_put option"
|
||||||
"to add container to Swift automatically.")
|
"to add container to Swift automatically.") %
|
||||||
% locals())
|
locals())
|
||||||
raise glance.store.BackendException(msg)
|
raise glance.store.BackendException(msg)
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
@ -240,7 +240,9 @@ class BaseTestCase(object):
|
|||||||
|
|
||||||
def test_image_get_all_with_filter(self):
|
def test_image_get_all_with_filter(self):
|
||||||
images = self.db_api.image_get_all(self.context,
|
images = self.db_api.image_get_all(self.context,
|
||||||
filters={'id': self.fixtures[0]['id']})
|
filters={
|
||||||
|
'id': self.fixtures[0]['id'],
|
||||||
|
})
|
||||||
self.assertEquals(len(images), 1)
|
self.assertEquals(len(images), 1)
|
||||||
self.assertEquals(images[0]['id'], self.fixtures[0]['id'])
|
self.assertEquals(images[0]['id'], self.fixtures[0]['id'])
|
||||||
|
|
||||||
@ -255,11 +257,15 @@ class BaseTestCase(object):
|
|||||||
prop = self.db_api.image_property_create(self.context,
|
prop = self.db_api.image_property_create(self.context,
|
||||||
fixture)
|
fixture)
|
||||||
images = self.db_api.image_get_all(self.context,
|
images = self.db_api.image_get_all(self.context,
|
||||||
filters={'properties': {'poo': 'bear'}})
|
filters={
|
||||||
|
'properties': {'poo': 'bear'},
|
||||||
|
})
|
||||||
self.assertEquals(len(images), 1)
|
self.assertEquals(len(images), 1)
|
||||||
self.db_api.image_property_delete(self.context, prop)
|
self.db_api.image_property_delete(self.context, prop)
|
||||||
images = self.db_api.image_get_all(self.context,
|
images = self.db_api.image_get_all(self.context,
|
||||||
filters={'properties': {'poo': 'bear'}})
|
filters={
|
||||||
|
'properties': {'poo': 'bear'},
|
||||||
|
})
|
||||||
self.assertEquals(len(images), 0)
|
self.assertEquals(len(images), 0)
|
||||||
|
|
||||||
def test_image_get_all_with_filter_undefined_property(self):
|
def test_image_get_all_with_filter_undefined_property(self):
|
||||||
@ -352,14 +358,16 @@ class BaseTestCase(object):
|
|||||||
TENANT1 = utils.generate_uuid()
|
TENANT1 = utils.generate_uuid()
|
||||||
ctxt1 = context.RequestContext(is_admin=False, tenant=TENANT1)
|
ctxt1 = context.RequestContext(is_admin=False, tenant=TENANT1)
|
||||||
UUIDX = utils.generate_uuid()
|
UUIDX = utils.generate_uuid()
|
||||||
self.db_api.image_create(ctxt1,
|
self.db_api.image_create(ctxt1, {'id': UUIDX,
|
||||||
{'id': UUIDX, 'status': 'queued', 'owner': TENANT1})
|
'status': 'queued',
|
||||||
|
'owner': TENANT1})
|
||||||
|
|
||||||
TENANT2 = utils.generate_uuid()
|
TENANT2 = utils.generate_uuid()
|
||||||
ctxt2 = context.RequestContext(is_admin=False, tenant=TENANT2)
|
ctxt2 = context.RequestContext(is_admin=False, tenant=TENANT2)
|
||||||
UUIDY = utils.generate_uuid()
|
UUIDY = utils.generate_uuid()
|
||||||
self.db_api.image_create(ctxt2,
|
self.db_api.image_create(ctxt2, {'id': UUIDY,
|
||||||
{'id': UUIDY, 'status': 'queued', 'owner': TENANT2})
|
'status': 'queued',
|
||||||
|
'owner': TENANT2})
|
||||||
|
|
||||||
# NOTE(bcwaldon): the is_public=True flag indicates that you want
|
# NOTE(bcwaldon): the is_public=True flag indicates that you want
|
||||||
# to get all images that are public AND those that are owned by the
|
# to get all images that are public AND those that are owned by the
|
||||||
@ -457,7 +465,8 @@ class BaseTestCase(object):
|
|||||||
def test_image_member_update(self):
|
def test_image_member_update(self):
|
||||||
TENANT1 = utils.generate_uuid()
|
TENANT1 = utils.generate_uuid()
|
||||||
member = self.db_api.image_member_create(self.context,
|
member = self.db_api.image_member_create(self.context,
|
||||||
{'member': TENANT1, 'image_id': UUID1})
|
{'member': TENANT1,
|
||||||
|
'image_id': UUID1})
|
||||||
member_id = member.pop('id')
|
member_id = member.pop('id')
|
||||||
|
|
||||||
expected = {'member': TENANT1, 'image_id': UUID1, 'can_share': False}
|
expected = {'member': TENANT1, 'image_id': UUID1, 'can_share': False}
|
||||||
|
@ -314,8 +314,10 @@ class TestSwiftStore(store_tests.BaseTestCase, unittest.TestCase):
|
|||||||
|
|
||||||
read_tenant = utils.generate_uuid()
|
read_tenant = utils.generate_uuid()
|
||||||
write_tenant = utils.generate_uuid()
|
write_tenant = utils.generate_uuid()
|
||||||
store.set_acls(location, public=False,
|
store.set_acls(location,
|
||||||
read_tenants=[read_tenant], write_tenants=[write_tenant])
|
public=False,
|
||||||
|
read_tenants=[read_tenant],
|
||||||
|
write_tenants=[write_tenant])
|
||||||
|
|
||||||
container_name = location.store_location.container
|
container_name = location.store_location.container
|
||||||
container, _ = swift_get_container(self.swift_client, container_name)
|
container, _ = swift_get_container(self.swift_client, container_name)
|
||||||
|
@ -25,10 +25,12 @@ from glance.tests.utils import execute
|
|||||||
|
|
||||||
|
|
||||||
TEST_IMAGE_DATA = '*' * 5 * 1024
|
TEST_IMAGE_DATA = '*' * 5 * 1024
|
||||||
TEST_IMAGE_META = {'name': 'test_image',
|
TEST_IMAGE_META = {
|
||||||
|
'name': 'test_image',
|
||||||
'is_public': False,
|
'is_public': False,
|
||||||
'disk_format': 'raw',
|
'disk_format': 'raw',
|
||||||
'container_format': 'ovf'}
|
'container_format': 'ovf',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class TestScrubber(functional.FunctionalTest):
|
class TestScrubber(functional.FunctionalTest):
|
||||||
|
@ -133,14 +133,15 @@ class TestApi(functional.FunctionalTest):
|
|||||||
|
|
||||||
for expected_key, expected_value in expected_image_headers.items():
|
for expected_key, expected_value in expected_image_headers.items():
|
||||||
self.assertEqual(response[expected_key], expected_value,
|
self.assertEqual(response[expected_key], expected_value,
|
||||||
"For key '%s' expected header value '%s'. Got '%s'"
|
"For key '%s' expected header value '%s'. "
|
||||||
% (expected_key, expected_value,
|
"Got '%s'" % (expected_key,
|
||||||
|
expected_value,
|
||||||
response[expected_key]))
|
response[expected_key]))
|
||||||
|
|
||||||
for expected_key, expected_value in expected_std_headers.items():
|
for expected_key, expected_value in expected_std_headers.items():
|
||||||
self.assertEqual(response[expected_key], expected_value,
|
self.assertEqual(response[expected_key], expected_value,
|
||||||
"For key '%s' expected header value '%s'. Got '%s'"
|
"For key '%s' expected header value '%s'. "
|
||||||
% (expected_key,
|
"Got '%s'" % (expected_key,
|
||||||
expected_value,
|
expected_value,
|
||||||
response[expected_key]))
|
response[expected_key]))
|
||||||
|
|
||||||
@ -187,8 +188,8 @@ class TestApi(functional.FunctionalTest):
|
|||||||
|
|
||||||
for expected_key, expected_value in expected_image.items():
|
for expected_key, expected_value in expected_image.items():
|
||||||
self.assertEqual(expected_value, image['images'][0][expected_key],
|
self.assertEqual(expected_value, image['images'][0][expected_key],
|
||||||
"For key '%s' expected header value '%s'. Got '%s'"
|
"For key '%s' expected header value '%s'. "
|
||||||
% (expected_key,
|
"Got '%s'" % (expected_key,
|
||||||
expected_value,
|
expected_value,
|
||||||
image['images'][0][expected_key]))
|
image['images'][0][expected_key]))
|
||||||
|
|
||||||
@ -228,8 +229,8 @@ class TestApi(functional.FunctionalTest):
|
|||||||
|
|
||||||
for expected_key, expected_value in expected_image.items():
|
for expected_key, expected_value in expected_image.items():
|
||||||
self.assertEqual(expected_value, image['images'][0][expected_key],
|
self.assertEqual(expected_value, image['images'][0][expected_key],
|
||||||
"For key '%s' expected header value '%s'. Got '%s'"
|
"For key '%s' expected header value '%s'. "
|
||||||
% (expected_key,
|
"Got '%s'" % (expected_key,
|
||||||
expected_value,
|
expected_value,
|
||||||
image['images'][0][expected_key]))
|
image['images'][0][expected_key]))
|
||||||
|
|
||||||
@ -358,7 +359,8 @@ class TestApi(functional.FunctionalTest):
|
|||||||
# 4. PUT image with image data, verify 200 returned
|
# 4. PUT image with image data, verify 200 returned
|
||||||
image_data = "*" * FIVE_KB
|
image_data = "*" * FIVE_KB
|
||||||
headers = {'Content-Type': 'application/octet-stream'}
|
headers = {'Content-Type': 'application/octet-stream'}
|
||||||
path = "http://%s:%d/v1/images/%s" % ("127.0.0.1", self.api_port,
|
path = "http://%s:%d/v1/images/%s" % ("127.0.0.1",
|
||||||
|
self.api_port,
|
||||||
image_id)
|
image_id)
|
||||||
http = httplib2.Http()
|
http = httplib2.Http()
|
||||||
response, content = http.request(path, 'PUT', headers=headers,
|
response, content = http.request(path, 'PUT', headers=headers,
|
||||||
@ -532,7 +534,8 @@ class TestApi(functional.FunctionalTest):
|
|||||||
http = httplib2.Http()
|
http = httplib2.Http()
|
||||||
headers = minimal_headers('Image1')
|
headers = minimal_headers('Image1')
|
||||||
headers['Content-Type'] = 'not octet-stream'
|
headers['Content-Type'] = 'not octet-stream'
|
||||||
response, content = http.request(path, 'POST',
|
response, content = http.request(path,
|
||||||
|
'POST',
|
||||||
body=test_data_file.name,
|
body=test_data_file.name,
|
||||||
headers=headers)
|
headers=headers)
|
||||||
self.assertEqual(response.status, 400)
|
self.assertEqual(response.status, 400)
|
||||||
@ -811,7 +814,8 @@ class TestApi(functional.FunctionalTest):
|
|||||||
yesterday = timeutils.isotime(timeutils.utcnow() -
|
yesterday = timeutils.isotime(timeutils.utcnow() -
|
||||||
datetime.timedelta(1))
|
datetime.timedelta(1))
|
||||||
params = "changes-since=%s" % yesterday
|
params = "changes-since=%s" % yesterday
|
||||||
path = "http://%s:%d/v1/images?%s" % ("127.0.0.1", self.api_port,
|
path = "http://%s:%d/v1/images?%s" % ("127.0.0.1",
|
||||||
|
self.api_port,
|
||||||
params)
|
params)
|
||||||
response, content = http.request(path, 'GET')
|
response, content = http.request(path, 'GET')
|
||||||
self.assertEqual(response.status, 200)
|
self.assertEqual(response.status, 200)
|
||||||
@ -826,7 +830,8 @@ class TestApi(functional.FunctionalTest):
|
|||||||
now = timeutils.utcnow()
|
now = timeutils.utcnow()
|
||||||
hour_ago = now.strftime('%Y-%m-%dT%H:%M:%S%%2B01:00')
|
hour_ago = now.strftime('%Y-%m-%dT%H:%M:%S%%2B01:00')
|
||||||
params = "changes-since=%s" % hour_ago
|
params = "changes-since=%s" % hour_ago
|
||||||
path = "http://%s:%d/v1/images?%s" % ("127.0.0.1", self.api_port,
|
path = "http://%s:%d/v1/images?%s" % ("127.0.0.1",
|
||||||
|
self.api_port,
|
||||||
params)
|
params)
|
||||||
response, content = http.request(path, 'GET')
|
response, content = http.request(path, 'GET')
|
||||||
self.assertEqual(response.status, 200)
|
self.assertEqual(response.status, 200)
|
||||||
@ -837,7 +842,8 @@ class TestApi(functional.FunctionalTest):
|
|||||||
tomorrow = timeutils.isotime(timeutils.utcnow() +
|
tomorrow = timeutils.isotime(timeutils.utcnow() +
|
||||||
datetime.timedelta(1))
|
datetime.timedelta(1))
|
||||||
params = "changes-since=%s" % tomorrow
|
params = "changes-since=%s" % tomorrow
|
||||||
path = "http://%s:%d/v1/images?%s" % ("127.0.0.1", self.api_port,
|
path = "http://%s:%d/v1/images?%s" % ("127.0.0.1",
|
||||||
|
self.api_port,
|
||||||
params)
|
params)
|
||||||
response, content = http.request(path, 'GET')
|
response, content = http.request(path, 'GET')
|
||||||
self.assertEqual(response.status, 200)
|
self.assertEqual(response.status, 200)
|
||||||
@ -848,7 +854,8 @@ class TestApi(functional.FunctionalTest):
|
|||||||
now = timeutils.utcnow()
|
now = timeutils.utcnow()
|
||||||
hour_hence = now.strftime('%Y-%m-%dT%H:%M:%S-01:00')
|
hour_hence = now.strftime('%Y-%m-%dT%H:%M:%S-01:00')
|
||||||
params = "changes-since=%s" % hour_hence
|
params = "changes-since=%s" % hour_hence
|
||||||
path = "http://%s:%d/v1/images?%s" % ("127.0.0.1", self.api_port,
|
path = "http://%s:%d/v1/images?%s" % ("127.0.0.1",
|
||||||
|
self.api_port,
|
||||||
params)
|
params)
|
||||||
response, content = http.request(path, 'GET')
|
response, content = http.request(path, 'GET')
|
||||||
self.assertEqual(response.status, 200)
|
self.assertEqual(response.status, 200)
|
||||||
@ -1076,7 +1083,8 @@ class TestApi(functional.FunctionalTest):
|
|||||||
|
|
||||||
# 3. GET /images sorted by name asc
|
# 3. GET /images sorted by name asc
|
||||||
params = 'sort_key=name&sort_dir=asc'
|
params = 'sort_key=name&sort_dir=asc'
|
||||||
path = "http://%s:%d/v1/images?%s" % ("127.0.0.1", self.api_port,
|
path = "http://%s:%d/v1/images?%s" % ("127.0.0.1",
|
||||||
|
self.api_port,
|
||||||
params)
|
params)
|
||||||
http = httplib2.Http()
|
http = httplib2.Http()
|
||||||
response, content = http.request(path, 'GET')
|
response, content = http.request(path, 'GET')
|
||||||
@ -1089,7 +1097,8 @@ class TestApi(functional.FunctionalTest):
|
|||||||
|
|
||||||
# 4. GET /images sorted by size desc
|
# 4. GET /images sorted by size desc
|
||||||
params = 'sort_key=size&sort_dir=desc'
|
params = 'sort_key=size&sort_dir=desc'
|
||||||
path = "http://%s:%d/v1/images?%s" % ("127.0.0.1", self.api_port,
|
path = "http://%s:%d/v1/images?%s" % ("127.0.0.1",
|
||||||
|
self.api_port,
|
||||||
params)
|
params)
|
||||||
http = httplib2.Http()
|
http = httplib2.Http()
|
||||||
response, content = http.request(path, 'GET')
|
response, content = http.request(path, 'GET')
|
||||||
@ -1102,7 +1111,8 @@ class TestApi(functional.FunctionalTest):
|
|||||||
|
|
||||||
# 5. GET /images sorted by size desc with a marker
|
# 5. GET /images sorted by size desc with a marker
|
||||||
params = 'sort_key=size&sort_dir=desc&marker=%s' % image_ids[0]
|
params = 'sort_key=size&sort_dir=desc&marker=%s' % image_ids[0]
|
||||||
path = "http://%s:%d/v1/images?%s" % ("127.0.0.1", self.api_port,
|
path = "http://%s:%d/v1/images?%s" % ("127.0.0.1",
|
||||||
|
self.api_port,
|
||||||
params)
|
params)
|
||||||
http = httplib2.Http()
|
http = httplib2.Http()
|
||||||
response, content = http.request(path, 'GET')
|
response, content = http.request(path, 'GET')
|
||||||
@ -1114,7 +1124,8 @@ class TestApi(functional.FunctionalTest):
|
|||||||
|
|
||||||
# 6. GET /images sorted by name asc with a marker
|
# 6. GET /images sorted by name asc with a marker
|
||||||
params = 'sort_key=name&sort_dir=asc&marker=%s' % image_ids[2]
|
params = 'sort_key=name&sort_dir=asc&marker=%s' % image_ids[2]
|
||||||
path = "http://%s:%d/v1/images?%s" % ("127.0.0.1", self.api_port,
|
path = "http://%s:%d/v1/images?%s" % ("127.0.0.1",
|
||||||
|
self.api_port,
|
||||||
params)
|
params)
|
||||||
http = httplib2.Http()
|
http = httplib2.Http()
|
||||||
response, content = http.request(path, 'GET')
|
response, content = http.request(path, 'GET')
|
||||||
@ -1258,7 +1269,8 @@ class TestApi(functional.FunctionalTest):
|
|||||||
test_data_file.write("XXX")
|
test_data_file.write("XXX")
|
||||||
test_data_file.flush()
|
test_data_file.flush()
|
||||||
http = httplib2.Http()
|
http = httplib2.Http()
|
||||||
response, content = http.request(path, 'POST',
|
response, content = http.request(path,
|
||||||
|
'POST',
|
||||||
headers=headers,
|
headers=headers,
|
||||||
body=test_data_file.name)
|
body=test_data_file.name)
|
||||||
self.assertEqual(response.status, 400)
|
self.assertEqual(response.status, 400)
|
||||||
@ -1319,7 +1331,8 @@ class TestApi(functional.FunctionalTest):
|
|||||||
test_data_file.write("XXX")
|
test_data_file.write("XXX")
|
||||||
test_data_file.flush()
|
test_data_file.flush()
|
||||||
http = httplib2.Http()
|
http = httplib2.Http()
|
||||||
response, content = http.request(path, 'PUT',
|
response, content = http.request(path,
|
||||||
|
'PUT',
|
||||||
headers=headers,
|
headers=headers,
|
||||||
body=test_data_file.name)
|
body=test_data_file.name)
|
||||||
self.assertEqual(response.status, 400)
|
self.assertEqual(response.status, 400)
|
||||||
|
@ -147,7 +147,9 @@ class TestSSL(functional.FunctionalTest):
|
|||||||
headers = minimal_headers('Image1')
|
headers = minimal_headers('Image1')
|
||||||
path = "https://%s:%d/v1/images" % ("127.0.0.1", self.api_port)
|
path = "https://%s:%d/v1/images" % ("127.0.0.1", self.api_port)
|
||||||
https = httplib2.Http(disable_ssl_certificate_validation=True)
|
https = httplib2.Http(disable_ssl_certificate_validation=True)
|
||||||
response, content = https.request(path, 'POST', headers=headers,
|
response, content = https.request(path,
|
||||||
|
'POST',
|
||||||
|
headers=headers,
|
||||||
body=image_data)
|
body=image_data)
|
||||||
self.assertEqual(response.status, 201)
|
self.assertEqual(response.status, 201)
|
||||||
data = json.loads(content)
|
data = json.loads(content)
|
||||||
@ -191,14 +193,15 @@ class TestSSL(functional.FunctionalTest):
|
|||||||
|
|
||||||
for expected_key, expected_value in expected_image_headers.items():
|
for expected_key, expected_value in expected_image_headers.items():
|
||||||
self.assertEqual(response[expected_key], expected_value,
|
self.assertEqual(response[expected_key], expected_value,
|
||||||
"For key '%s' expected header value '%s'. Got '%s'"
|
"For key '%s' expected header value '%s'. "
|
||||||
% (expected_key, expected_value,
|
"Got '%s'" % (expected_key,
|
||||||
|
expected_value,
|
||||||
response[expected_key]))
|
response[expected_key]))
|
||||||
|
|
||||||
for expected_key, expected_value in expected_std_headers.items():
|
for expected_key, expected_value in expected_std_headers.items():
|
||||||
self.assertEqual(response[expected_key], expected_value,
|
self.assertEqual(response[expected_key], expected_value,
|
||||||
"For key '%s' expected header value '%s'. Got '%s'"
|
"For key '%s' expected header value '%s'. "
|
||||||
% (expected_key,
|
"Got '%s'" % (expected_key,
|
||||||
expected_value,
|
expected_value,
|
||||||
response[expected_key]))
|
response[expected_key]))
|
||||||
|
|
||||||
@ -244,9 +247,10 @@ class TestSSL(functional.FunctionalTest):
|
|||||||
image = json.loads(content)
|
image = json.loads(content)
|
||||||
|
|
||||||
for expected_key, expected_value in expected_image.items():
|
for expected_key, expected_value in expected_image.items():
|
||||||
self.assertEqual(expected_value, image['images'][0][expected_key],
|
self.assertEqual(expected_value,
|
||||||
"For key '%s' expected header value '%s'. Got '%s'"
|
image['images'][0][expected_key],
|
||||||
% (expected_key,
|
"For key '%s' expected header value '%s'. "
|
||||||
|
"Got '%s'" % (expected_key,
|
||||||
expected_value,
|
expected_value,
|
||||||
image['images'][0][expected_key]))
|
image['images'][0][expected_key]))
|
||||||
|
|
||||||
@ -285,9 +289,10 @@ class TestSSL(functional.FunctionalTest):
|
|||||||
image = json.loads(content)
|
image = json.loads(content)
|
||||||
|
|
||||||
for expected_key, expected_value in expected_image.items():
|
for expected_key, expected_value in expected_image.items():
|
||||||
self.assertEqual(expected_value, image['images'][0][expected_key],
|
self.assertEqual(expected_value,
|
||||||
"For key '%s' expected header value '%s'. Got '%s'"
|
image['images'][0][expected_key],
|
||||||
% (expected_key,
|
"For key '%s' expected header value '%s'. "
|
||||||
|
"Got '%s'" % (expected_key,
|
||||||
expected_value,
|
expected_value,
|
||||||
image['images'][0][expected_key]))
|
image['images'][0][expected_key]))
|
||||||
|
|
||||||
@ -411,7 +416,9 @@ class TestSSL(functional.FunctionalTest):
|
|||||||
path = "https://%s:%d/v1/images/%s" % ("127.0.0.1", self.api_port,
|
path = "https://%s:%d/v1/images/%s" % ("127.0.0.1", self.api_port,
|
||||||
image_id)
|
image_id)
|
||||||
https = httplib2.Http(disable_ssl_certificate_validation=True)
|
https = httplib2.Http(disable_ssl_certificate_validation=True)
|
||||||
response, content = https.request(path, 'PUT', headers=headers,
|
response, content = https.request(path,
|
||||||
|
'PUT',
|
||||||
|
headers=headers,
|
||||||
body=image_data)
|
body=image_data)
|
||||||
self.assertEqual(response.status, 200)
|
self.assertEqual(response.status, 200)
|
||||||
data = json.loads(content)
|
data = json.loads(content)
|
||||||
@ -669,7 +676,8 @@ class TestSSL(functional.FunctionalTest):
|
|||||||
test_data_file.flush()
|
test_data_file.flush()
|
||||||
path = "https://%s:%d/v1/images" % ("127.0.0.1", self.api_port)
|
path = "https://%s:%d/v1/images" % ("127.0.0.1", self.api_port)
|
||||||
https = httplib2.Http(disable_ssl_certificate_validation=True)
|
https = httplib2.Http(disable_ssl_certificate_validation=True)
|
||||||
response, content = https.request(path, 'POST',
|
response, content = https.request(path,
|
||||||
|
'POST',
|
||||||
body=test_data_file.name)
|
body=test_data_file.name)
|
||||||
self.assertEqual(response.status, 400)
|
self.assertEqual(response.status, 400)
|
||||||
expected = "Content-Type must be application/octet-stream"
|
expected = "Content-Type must be application/octet-stream"
|
||||||
|
@ -76,8 +76,7 @@ class TestCacheMiddlewareRequestStashCacheInfo(unittest.TestCase):
|
|||||||
class ChecksumTestCacheFilter(glance.api.middleware.cache.CacheFilter):
|
class ChecksumTestCacheFilter(glance.api.middleware.cache.CacheFilter):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
class DummyCache(object):
|
class DummyCache(object):
|
||||||
def get_caching_iter(self, image_id, image_checksum,
|
def get_caching_iter(self, image_id, image_checksum, app_iter):
|
||||||
app_iter):
|
|
||||||
self.image_checksum = image_checksum
|
self.image_checksum = image_checksum
|
||||||
|
|
||||||
self.cache = DummyCache()
|
self.cache = DummyCache()
|
||||||
|
@ -1030,7 +1030,8 @@ class TestRegistryClient(base.IsolatedUnitTest):
|
|||||||
"""Tests replacing image members"""
|
"""Tests replacing image members"""
|
||||||
self.assertTrue(self.client.add_member(UUID2, 'pattieblack'))
|
self.assertTrue(self.client.add_member(UUID2, 'pattieblack'))
|
||||||
self.assertTrue(self.client.replace_members(UUID2,
|
self.assertTrue(self.client.replace_members(UUID2,
|
||||||
dict(member_id='pattieblack2')))
|
dict(member_id='pattie'
|
||||||
|
'black2')))
|
||||||
|
|
||||||
def test_add_delete_member(self):
|
def test_add_delete_member(self):
|
||||||
"""Tests deleting image members"""
|
"""Tests deleting image members"""
|
||||||
|
@ -165,7 +165,8 @@ class TestMigrations(utils.BaseTestCase):
|
|||||||
# Create the initial version of the images table
|
# Create the initial version of the images table
|
||||||
meta = MetaData()
|
meta = MetaData()
|
||||||
meta.bind = engine
|
meta.bind = engine
|
||||||
images_001 = Table('images', meta,
|
images_001 = Table('images',
|
||||||
|
meta,
|
||||||
Column('id', models.Integer, primary_key=True),
|
Column('id', models.Integer, primary_key=True),
|
||||||
Column('name', String(255)),
|
Column('name', String(255)),
|
||||||
Column('type', String(30)),
|
Column('type', String(30)),
|
||||||
@ -176,7 +177,10 @@ class TestMigrations(utils.BaseTestCase):
|
|||||||
Column('created_at', DateTime(), nullable=False),
|
Column('created_at', DateTime(), nullable=False),
|
||||||
Column('updated_at', DateTime()),
|
Column('updated_at', DateTime()),
|
||||||
Column('deleted_at', DateTime()),
|
Column('deleted_at', DateTime()),
|
||||||
Column('deleted', Boolean(), nullable=False, default=False))
|
Column('deleted',
|
||||||
|
Boolean(),
|
||||||
|
nullable=False,
|
||||||
|
default=False))
|
||||||
images_001.create()
|
images_001.create()
|
||||||
|
|
||||||
def _walk_versions(self, initial_version=0):
|
def _walk_versions(self, initial_version=0):
|
||||||
|
@ -330,9 +330,10 @@ class TestQpidNotifier(utils.BaseTestCase):
|
|||||||
self.mock_connection.open()
|
self.mock_connection.open()
|
||||||
self.mock_connection.session().AndReturn(self.mock_session)
|
self.mock_connection.session().AndReturn(self.mock_session)
|
||||||
for p in ["info", "warn", "error"]:
|
for p in ["info", "warn", "error"]:
|
||||||
expected_address = ('glance/glance_notifications.%s ; {"node": '
|
expected_address = ('glance/glance_notifications.%s ; '
|
||||||
'{"x-declare": {"auto-delete": true, "durable": false}, '
|
'{"node": {"x-declare": {"auto-delete": true, '
|
||||||
'"type": "topic"}, "create": "always"}' % p)
|
'"durable": false}, "type": "topic"}, '
|
||||||
|
'"create": "always"}' % p)
|
||||||
self.mock_session.sender(expected_address).AndReturn(
|
self.mock_session.sender(expected_address).AndReturn(
|
||||||
self.mock_sender)
|
self.mock_sender)
|
||||||
self.mock_sender.send(mox.IgnoreArg())
|
self.mock_sender.send(mox.IgnoreArg())
|
||||||
|
@ -59,9 +59,12 @@ SWIFT_CONF = {'verbose': True,
|
|||||||
def stub_out_swiftclient(stubs, swift_store_auth_version):
|
def stub_out_swiftclient(stubs, swift_store_auth_version):
|
||||||
fixture_containers = ['glance']
|
fixture_containers = ['glance']
|
||||||
fixture_container_headers = {}
|
fixture_container_headers = {}
|
||||||
fixture_headers = {'glance/%s' % FAKE_UUID:
|
fixture_headers = {
|
||||||
{'content-length': FIVE_KB,
|
'glance/%s' % FAKE_UUID: {
|
||||||
'etag': 'c2e5db72bd7fd153f53ede5da5a06de3'}}
|
'content-length': FIVE_KB,
|
||||||
|
'etag': 'c2e5db72bd7fd153f53ede5da5a06de3'
|
||||||
|
}
|
||||||
|
}
|
||||||
fixture_objects = {'glance/%s' % FAKE_UUID:
|
fixture_objects = {'glance/%s' % FAKE_UUID:
|
||||||
StringIO.StringIO("*" * FIVE_KB)}
|
StringIO.StringIO("*" * FIVE_KB)}
|
||||||
|
|
||||||
|
@ -1954,11 +1954,13 @@ class TestGlanceAPI(base.IsolatedUnitTest):
|
|||||||
self._do_test_defaulted_format(key, value)
|
self._do_test_defaulted_format(key, value)
|
||||||
|
|
||||||
def test_bad_disk_format(self):
|
def test_bad_disk_format(self):
|
||||||
fixture_headers = {'x-image-meta-store': 'bad',
|
fixture_headers = {
|
||||||
|
'x-image-meta-store': 'bad',
|
||||||
'x-image-meta-name': 'bogus',
|
'x-image-meta-name': 'bogus',
|
||||||
'x-image-meta-location': 'http://localhost:0/image.tar.gz',
|
'x-image-meta-location': 'http://localhost:0/image.tar.gz',
|
||||||
'x-image-meta-disk-format': 'invalid',
|
'x-image-meta-disk-format': 'invalid',
|
||||||
'x-image-meta-container-format': 'ami'}
|
'x-image-meta-container-format': 'ami',
|
||||||
|
}
|
||||||
|
|
||||||
req = webob.Request.blank("/images")
|
req = webob.Request.blank("/images")
|
||||||
req.method = 'POST'
|
req.method = 'POST'
|
||||||
@ -1970,10 +1972,12 @@ class TestGlanceAPI(base.IsolatedUnitTest):
|
|||||||
self.assertTrue('Invalid disk format' in res.body, res.body)
|
self.assertTrue('Invalid disk format' in res.body, res.body)
|
||||||
|
|
||||||
def test_create_with_location_no_container_format(self):
|
def test_create_with_location_no_container_format(self):
|
||||||
fixture_headers = {'x-image-meta-store': 'bad',
|
fixture_headers = {
|
||||||
|
'x-image-meta-store': 'bad',
|
||||||
'x-image-meta-name': 'bogus',
|
'x-image-meta-name': 'bogus',
|
||||||
'x-image-meta-location': 'http://localhost:0/image.tar.gz',
|
'x-image-meta-location': 'http://localhost:0/image.tar.gz',
|
||||||
'x-image-meta-disk-format': 'vhd'}
|
'x-image-meta-disk-format': 'vhd',
|
||||||
|
}
|
||||||
|
|
||||||
req = webob.Request.blank("/images")
|
req = webob.Request.blank("/images")
|
||||||
req.method = 'POST'
|
req.method = 'POST'
|
||||||
@ -1985,11 +1989,13 @@ class TestGlanceAPI(base.IsolatedUnitTest):
|
|||||||
self.assertTrue('Invalid container format' in res.body)
|
self.assertTrue('Invalid container format' in res.body)
|
||||||
|
|
||||||
def test_bad_container_format(self):
|
def test_bad_container_format(self):
|
||||||
fixture_headers = {'x-image-meta-store': 'bad',
|
fixture_headers = {
|
||||||
|
'x-image-meta-store': 'bad',
|
||||||
'x-image-meta-name': 'bogus',
|
'x-image-meta-name': 'bogus',
|
||||||
'x-image-meta-location': 'http://localhost:0/image.tar.gz',
|
'x-image-meta-location': 'http://localhost:0/image.tar.gz',
|
||||||
'x-image-meta-disk-format': 'vhd',
|
'x-image-meta-disk-format': 'vhd',
|
||||||
'x-image-meta-container-format': 'invalid'}
|
'x-image-meta-container-format': 'invalid',
|
||||||
|
}
|
||||||
|
|
||||||
req = webob.Request.blank("/images")
|
req = webob.Request.blank("/images")
|
||||||
req.method = 'POST'
|
req.method = 'POST'
|
||||||
@ -2001,12 +2007,14 @@ class TestGlanceAPI(base.IsolatedUnitTest):
|
|||||||
self.assertTrue('Invalid container format' in res.body)
|
self.assertTrue('Invalid container format' in res.body)
|
||||||
|
|
||||||
def test_bad_image_size(self):
|
def test_bad_image_size(self):
|
||||||
fixture_headers = {'x-image-meta-store': 'bad',
|
fixture_headers = {
|
||||||
|
'x-image-meta-store': 'bad',
|
||||||
'x-image-meta-name': 'bogus',
|
'x-image-meta-name': 'bogus',
|
||||||
'x-image-meta-location': 'http://example.com/image.tar.gz',
|
'x-image-meta-location': 'http://example.com/image.tar.gz',
|
||||||
'x-image-meta-disk-format': 'vhd',
|
'x-image-meta-disk-format': 'vhd',
|
||||||
'x-image-meta-size': 'invalid',
|
'x-image-meta-size': 'invalid',
|
||||||
'x-image-meta-container-format': 'bare'}
|
'x-image-meta-container-format': 'bare',
|
||||||
|
}
|
||||||
|
|
||||||
req = webob.Request.blank("/images")
|
req = webob.Request.blank("/images")
|
||||||
req.method = 'POST'
|
req.method = 'POST'
|
||||||
@ -2018,11 +2026,13 @@ class TestGlanceAPI(base.IsolatedUnitTest):
|
|||||||
self.assertTrue('Incoming image size' in res.body)
|
self.assertTrue('Incoming image size' in res.body)
|
||||||
|
|
||||||
def test_bad_image_name(self):
|
def test_bad_image_name(self):
|
||||||
fixture_headers = {'x-image-meta-store': 'bad',
|
fixture_headers = {
|
||||||
|
'x-image-meta-store': 'bad',
|
||||||
'x-image-meta-name': 'X' * 256,
|
'x-image-meta-name': 'X' * 256,
|
||||||
'x-image-meta-location': 'http://example.com/image.tar.gz',
|
'x-image-meta-location': 'http://example.com/image.tar.gz',
|
||||||
'x-image-meta-disk-format': 'vhd',
|
'x-image-meta-disk-format': 'vhd',
|
||||||
'x-image-meta-container-format': 'bare'}
|
'x-image-meta-container-format': 'bare',
|
||||||
|
}
|
||||||
|
|
||||||
req = webob.Request.blank("/images")
|
req = webob.Request.blank("/images")
|
||||||
req.method = 'POST'
|
req.method = 'POST'
|
||||||
|
@ -208,7 +208,10 @@ class TestImagesController(test_utils.BaseTestCase):
|
|||||||
url = '/images?status=queued&name=2'
|
url = '/images?status=queued&name=2'
|
||||||
request = unit_test_utils.get_fake_request(url)
|
request = unit_test_utils.get_fake_request(url)
|
||||||
output = self.controller.index(request,
|
output = self.controller.index(request,
|
||||||
filters={'status': 'queued', 'name': '2'})
|
filters={
|
||||||
|
'status': 'queued',
|
||||||
|
'name': '2',
|
||||||
|
})
|
||||||
self.assertEqual(1, len(output['images']))
|
self.assertEqual(1, len(output['images']))
|
||||||
actual = set([image['id'] for image in output['images']])
|
actual = set([image['id'] for image in output['images']])
|
||||||
expected = set([UUID2])
|
expected = set([UUID2])
|
||||||
@ -1118,7 +1121,8 @@ class TestImagesDeserializerWithExtendedSchema(test_utils.BaseTestCase):
|
|||||||
request.content_type = 'application/openstack-images-v2.0-json-patch'
|
request.content_type = 'application/openstack-images-v2.0-json-patch'
|
||||||
request.body = json.dumps([{'add': '/pants', 'value': 'cutoffs'}])
|
request.body = json.dumps([{'add': '/pants', 'value': 'cutoffs'}])
|
||||||
self.assertRaises(webob.exc.HTTPBadRequest,
|
self.assertRaises(webob.exc.HTTPBadRequest,
|
||||||
self.deserializer.update, request)
|
self.deserializer.update,
|
||||||
|
request)
|
||||||
|
|
||||||
|
|
||||||
class TestImagesDeserializerWithAdditionalProperties(test_utils.BaseTestCase):
|
class TestImagesDeserializerWithAdditionalProperties(test_utils.BaseTestCase):
|
||||||
@ -1199,11 +1203,19 @@ class TestImagesSerializer(test_utils.BaseTestCase):
|
|||||||
self.serializer = glance.api.v2.images.ResponseSerializer()
|
self.serializer = glance.api.v2.images.ResponseSerializer()
|
||||||
self.fixtures = [
|
self.fixtures = [
|
||||||
#NOTE(bcwaldon): This first fixture has every property defined
|
#NOTE(bcwaldon): This first fixture has every property defined
|
||||||
_fixture(UUID1, name='image-1', size=1024, tags=['one', 'two'],
|
_fixture(UUID1,
|
||||||
created_at=DATETIME, updated_at=DATETIME, owner=TENANT1,
|
name='image-1',
|
||||||
is_public=True, container_format='ami', disk_format='ami',
|
size=1024,
|
||||||
|
tags=['one', 'two'],
|
||||||
|
created_at=DATETIME,
|
||||||
|
updated_at=DATETIME,
|
||||||
|
owner=TENANT1,
|
||||||
|
is_public=True,
|
||||||
|
container_format='ami',
|
||||||
|
disk_format='ami',
|
||||||
checksum='ca425b88f047ce8ec45ee90e813ada91',
|
checksum='ca425b88f047ce8ec45ee90e813ada91',
|
||||||
min_ram=128, min_disk=10),
|
min_ram=128,
|
||||||
|
min_disk=10),
|
||||||
|
|
||||||
#NOTE(bcwaldon): This second fixture depends on default behavior
|
#NOTE(bcwaldon): This second fixture depends on default behavior
|
||||||
# and sets most values to None
|
# and sets most values to None
|
||||||
@ -1377,14 +1389,23 @@ class TestImagesSerializerWithUnicode(test_utils.BaseTestCase):
|
|||||||
self.serializer = glance.api.v2.images.ResponseSerializer()
|
self.serializer = glance.api.v2.images.ResponseSerializer()
|
||||||
self.fixtures = [
|
self.fixtures = [
|
||||||
#NOTE(bcwaldon): This first fixture has every property defined
|
#NOTE(bcwaldon): This first fixture has every property defined
|
||||||
_fixture(UUID1, name=u'OpenStack\u2122-1',
|
_fixture(UUID1,
|
||||||
size=1024, tags=[u'\u2160', u'\u2161'],
|
name=u'OpenStack\u2122-1',
|
||||||
created_at=DATETIME, updated_at=DATETIME, owner=TENANT1,
|
size=1024,
|
||||||
is_public=True, container_format='ami', disk_format='ami',
|
tags=[u'\u2160', u'\u2161'],
|
||||||
|
created_at=DATETIME,
|
||||||
|
updated_at=DATETIME,
|
||||||
|
owner=TENANT1,
|
||||||
|
is_public=True,
|
||||||
|
container_format='ami',
|
||||||
|
disk_format='ami',
|
||||||
checksum=u'ca425b88f047ce8ec45ee90e813ada91',
|
checksum=u'ca425b88f047ce8ec45ee90e813ada91',
|
||||||
min_ram=128, min_disk=10,
|
min_ram=128,
|
||||||
properties={'lang': u'Fran\u00E7ais',
|
min_disk=10,
|
||||||
u'dispos\u00E9': u'f\u00E2ch\u00E9'}),
|
properties={
|
||||||
|
'lang': u'Fran\u00E7ais',
|
||||||
|
u'dispos\u00E9': u'f\u00E2ch\u00E9',
|
||||||
|
}),
|
||||||
]
|
]
|
||||||
|
|
||||||
def test_index(self):
|
def test_index(self):
|
||||||
@ -1521,10 +1542,17 @@ class TestImagesSerializerWithExtendedSchema(test_utils.BaseTestCase):
|
|||||||
schema = glance.api.v2.images.get_schema(custom_image_properties)
|
schema = glance.api.v2.images.get_schema(custom_image_properties)
|
||||||
self.serializer = glance.api.v2.images.ResponseSerializer(schema)
|
self.serializer = glance.api.v2.images.ResponseSerializer(schema)
|
||||||
|
|
||||||
self.fixture = _fixture(UUID2, name='image-2', owner=TENANT2,
|
self.fixture = _fixture(UUID2,
|
||||||
|
name='image-2',
|
||||||
|
owner=TENANT2,
|
||||||
checksum='ca425b88f047ce8ec45ee90e813ada91',
|
checksum='ca425b88f047ce8ec45ee90e813ada91',
|
||||||
created_at=DATETIME, updated_at=DATETIME,
|
created_at=DATETIME,
|
||||||
size=1024, properties={'color': 'green', 'mood': 'grouchy'})
|
updated_at=DATETIME,
|
||||||
|
size=1024,
|
||||||
|
properties={
|
||||||
|
'color': 'green',
|
||||||
|
'mood': 'grouchy',
|
||||||
|
})
|
||||||
|
|
||||||
def test_show(self):
|
def test_show(self):
|
||||||
expected = {
|
expected = {
|
||||||
@ -1575,10 +1603,14 @@ class TestImagesSerializerWithAdditionalProperties(test_utils.BaseTestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestImagesSerializerWithAdditionalProperties, self).setUp()
|
super(TestImagesSerializerWithAdditionalProperties, self).setUp()
|
||||||
self.config(allow_additional_image_properties=True)
|
self.config(allow_additional_image_properties=True)
|
||||||
self.fixture = _fixture(UUID2, name='image-2', owner=TENANT2,
|
self.fixture = _fixture(UUID2,
|
||||||
|
name='image-2',
|
||||||
|
owner=TENANT2,
|
||||||
checksum='ca425b88f047ce8ec45ee90e813ada91',
|
checksum='ca425b88f047ce8ec45ee90e813ada91',
|
||||||
created_at=DATETIME, updated_at=DATETIME,
|
created_at=DATETIME,
|
||||||
properties={'marx': 'groucho'}, size=1024)
|
updated_at=DATETIME,
|
||||||
|
properties={'marx': 'groucho'},
|
||||||
|
size=1024)
|
||||||
|
|
||||||
def test_show(self):
|
def test_show(self):
|
||||||
serializer = glance.api.v2.images.ResponseSerializer()
|
serializer = glance.api.v2.images.ResponseSerializer()
|
||||||
@ -1656,20 +1688,27 @@ class TestImagesSerializerDirectUrl(test_utils.BaseTestCase):
|
|||||||
super(TestImagesSerializerDirectUrl, self).setUp()
|
super(TestImagesSerializerDirectUrl, self).setUp()
|
||||||
self.serializer = glance.api.v2.images.ResponseSerializer()
|
self.serializer = glance.api.v2.images.ResponseSerializer()
|
||||||
|
|
||||||
self.active_image = _fixture(UUID1, name='image-1', is_public=True,
|
self.active_image = _fixture(UUID1,
|
||||||
|
name='image-1',
|
||||||
|
is_public=True,
|
||||||
status='active', size=1024,
|
status='active', size=1024,
|
||||||
created_at=DATETIME, updated_at=DATETIME,
|
created_at=DATETIME, updated_at=DATETIME,
|
||||||
location='http://some/fake/location')
|
location='http://some/fake/location')
|
||||||
|
|
||||||
self.queued_image = _fixture(UUID2, name='image-2', status='active',
|
self.queued_image = _fixture(UUID2,
|
||||||
created_at=DATETIME, updated_at=DATETIME,
|
name='image-2',
|
||||||
checksum='ca425b88f047ce8ec45ee90e813ada91')
|
status='active',
|
||||||
|
created_at=DATETIME,
|
||||||
|
updated_at=DATETIME,
|
||||||
|
checksum='ca425b88f047ce8e'
|
||||||
|
'c45ee90e813ada91')
|
||||||
|
|
||||||
def _do_index(self):
|
def _do_index(self):
|
||||||
request = webob.Request.blank('/v2/images')
|
request = webob.Request.blank('/v2/images')
|
||||||
response = webob.Response(request=request)
|
response = webob.Response(request=request)
|
||||||
self.serializer.index(response,
|
self.serializer.index(response,
|
||||||
{'images': [self.active_image, self.queued_image]})
|
{'images': [self.active_image,
|
||||||
|
self.queued_image]})
|
||||||
return json.loads(response.body)['images']
|
return json.loads(response.body)['images']
|
||||||
|
|
||||||
def _do_show(self, image):
|
def _do_show(self, image):
|
||||||
|
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,E128,E711 --repeat --show-source --exclude=.venv,.tox,dist,doc,openstack .
|
commands = pep8 --ignore=E125,E126,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