Backslash continuation removal (Glance folsom-1)
Fixes bug #1000636 Removes backslash continuations (except sqlalchemy and mox related code) Change-Id: I08e6db28f157d67be9fc11ec02cc0844c006a6df
This commit is contained in:
parent
77552aaac7
commit
49a0f962f6
28
bin/glance
28
bin/glance
@ -63,8 +63,8 @@ def catch_error(action):
|
|||||||
ret = func(*args, **kwargs)
|
ret = func(*args, **kwargs)
|
||||||
return SUCCESS if ret is None else ret
|
return SUCCESS if ret is None else ret
|
||||||
except exception.Forbidden:
|
except exception.Forbidden:
|
||||||
print "Not authorized to make this request. Check "\
|
print ("Not authorized to make this request. Check "
|
||||||
"your credentials (OS_AUTH_USER, OS_AUTH_KEY, ...)."
|
"your credentials (OS_AUTH_USER, OS_AUTH_KEY, ...).")
|
||||||
return FAILURE
|
return FAILURE
|
||||||
except exception.ClientConfigurationError:
|
except exception.ClientConfigurationError:
|
||||||
raise
|
raise
|
||||||
@ -214,11 +214,11 @@ the command line using standard redirection. For example:
|
|||||||
EXAMPLES
|
EXAMPLES
|
||||||
===============================================================================
|
===============================================================================
|
||||||
|
|
||||||
%(prog)s add name="My Image" disk_format=raw container_format=ovf \\
|
%(prog)s add name="My Image" disk_format=raw container_format=ovf \
|
||||||
location=http://images.ubuntu.org/images/lucid-10.04-i686.iso \\
|
location=http://images.ubuntu.org/images/lucid-10.04-i686.iso \
|
||||||
distro="Ubuntu 10.04 LTS"
|
distro="Ubuntu 10.04 LTS"
|
||||||
|
|
||||||
%(prog)s add name="My Image" disk_format=raw container_format=ovf \\
|
%(prog)s add name="My Image" disk_format=raw container_format=ovf \
|
||||||
distro="Ubuntu 10.04 LTS" < /tmp/myimage.iso"""
|
distro="Ubuntu 10.04 LTS" < /tmp/myimage.iso"""
|
||||||
c = get_client(options)
|
c = get_client(options)
|
||||||
|
|
||||||
@ -448,8 +448,8 @@ Deletes an image from Glance"""
|
|||||||
print "as the first argument"
|
print "as the first argument"
|
||||||
return FAILURE
|
return FAILURE
|
||||||
|
|
||||||
if not options.force and \
|
if not (options.force or
|
||||||
not user_confirm("Delete image %s?" % (image_id,), default=False):
|
user_confirm("Delete image %s?" % (image_id,), default=False)):
|
||||||
print 'Not deleting image %s' % (image_id,)
|
print 'Not deleting image %s' % (image_id,)
|
||||||
return FAILURE
|
return FAILURE
|
||||||
|
|
||||||
@ -534,8 +534,8 @@ def _images_index(client, filters, limit, print_header=False, **kwargs):
|
|||||||
suppress_pagination = (options.force or
|
suppress_pagination = (options.force or
|
||||||
(getattr(os, 'isatty') and not os.isatty(sys.stdout.fileno())))
|
(getattr(os, 'isatty') and not os.isatty(sys.stdout.fileno())))
|
||||||
|
|
||||||
if not suppress_pagination and len(images) == limit and \
|
if not (suppress_pagination or len(images) != limit or
|
||||||
not user_confirm("Fetch next page?", True):
|
user_confirm("Fetch next page?", True)):
|
||||||
return SUCCESS
|
return SUCCESS
|
||||||
|
|
||||||
parameters['marker'] = images[-1]['id']
|
parameters['marker'] = images[-1]['id']
|
||||||
@ -593,8 +593,8 @@ def _images_details(client, filters, limit, print_header=False, **kwargs):
|
|||||||
print_image_formatted(client, image)
|
print_image_formatted(client, image)
|
||||||
print "=" * 80
|
print "=" * 80
|
||||||
|
|
||||||
if not options.force and len(images) == limit and \
|
if not (options.force or len(images) != limit or
|
||||||
not user_confirm("Fetch next page?", True):
|
user_confirm("Fetch next page?", True)):
|
||||||
return SUCCESS
|
return SUCCESS
|
||||||
|
|
||||||
parameters["marker"] = images[-1]['id']
|
parameters["marker"] = images[-1]['id']
|
||||||
@ -633,8 +633,8 @@ def images_clear(options, args):
|
|||||||
%(prog)s clear [options]
|
%(prog)s clear [options]
|
||||||
|
|
||||||
Deletes all images from a Glance server"""
|
Deletes all images from a Glance server"""
|
||||||
if not options.force and \
|
if not (options.force or
|
||||||
not user_confirm("Delete all images?", default=False):
|
user_confirm("Delete all images?", default=False)):
|
||||||
print 'Not deleting any images'
|
print 'Not deleting any images'
|
||||||
return FAILURE
|
return FAILURE
|
||||||
|
|
||||||
@ -998,7 +998,7 @@ def user_confirm(prompt, default=False):
|
|||||||
prompt_default = "[y/N]"
|
prompt_default = "[y/N]"
|
||||||
|
|
||||||
# for bug 884116, don't issue the prompt if stdin isn't a tty
|
# for bug 884116, don't issue the prompt if stdin isn't a tty
|
||||||
if not hasattr(sys.stdin, 'isatty') or not sys.stdin.isatty():
|
if not (hasattr(sys.stdin, 'isatty') and sys.stdin.isatty()):
|
||||||
return default
|
return default
|
||||||
|
|
||||||
answer = raw_input("%s %s " % (prompt, prompt_default))
|
answer = raw_input("%s %s " % (prompt, prompt_default))
|
||||||
|
@ -61,8 +61,8 @@ def catch_error(action):
|
|||||||
options.host)
|
options.host)
|
||||||
return FAILURE
|
return FAILURE
|
||||||
except exception.Forbidden:
|
except exception.Forbidden:
|
||||||
print "Not authorized to make this request. Check "\
|
print ("Not authorized to make this request. Check "
|
||||||
"your credentials (OS_AUTH_USER, OS_AUTH_KEY, ...)."
|
"your credentials (OS_AUTH_USER, OS_AUTH_KEY, ...).")
|
||||||
return FAILURE
|
return FAILURE
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
options = args[0]
|
options = args[0]
|
||||||
@ -147,9 +147,9 @@ Queues an image for caching"""
|
|||||||
print "from the cache as the first argument"
|
print "from the cache as the first argument"
|
||||||
return FAILURE
|
return FAILURE
|
||||||
|
|
||||||
if not options.force and \
|
if (not options.force and
|
||||||
not user_confirm("Queue image %s for caching?" % (image_id,),
|
not user_confirm("Queue image %s for caching?" % (image_id,),
|
||||||
default=False):
|
default=False)):
|
||||||
return SUCCESS
|
return SUCCESS
|
||||||
|
|
||||||
client = get_client(options)
|
client = get_client(options)
|
||||||
@ -174,9 +174,9 @@ Deletes an image from the cache"""
|
|||||||
print "from the cache as the first argument"
|
print "from the cache as the first argument"
|
||||||
return FAILURE
|
return FAILURE
|
||||||
|
|
||||||
if not options.force and \
|
if (not options.force and
|
||||||
not user_confirm("Delete cached image %s?" % (image_id,),
|
not user_confirm("Delete cached image %s?" % (image_id,),
|
||||||
default=False):
|
default=False)):
|
||||||
return SUCCESS
|
return SUCCESS
|
||||||
|
|
||||||
client = get_client(options)
|
client = get_client(options)
|
||||||
@ -194,8 +194,8 @@ def delete_all_cached_images(options, args):
|
|||||||
%(prog)s delete-all-cached-images [options]
|
%(prog)s delete-all-cached-images [options]
|
||||||
|
|
||||||
Removes all images from the cache"""
|
Removes all images from the cache"""
|
||||||
if not options.force and \
|
if (not options.force and
|
||||||
not user_confirm("Delete all cached images?", default=False):
|
not user_confirm("Delete all cached images?", default=False)):
|
||||||
return SUCCESS
|
return SUCCESS
|
||||||
|
|
||||||
client = get_client(options)
|
client = get_client(options)
|
||||||
@ -220,9 +220,9 @@ Deletes an image from the cache"""
|
|||||||
print "from the cache as the first argument"
|
print "from the cache as the first argument"
|
||||||
return FAILURE
|
return FAILURE
|
||||||
|
|
||||||
if not options.force and \
|
if (not options.force and
|
||||||
not user_confirm("Delete queued image %s?" % (image_id,),
|
not user_confirm("Delete queued image %s?" % (image_id,),
|
||||||
default=False):
|
default=False)):
|
||||||
return SUCCESS
|
return SUCCESS
|
||||||
|
|
||||||
client = get_client(options)
|
client = get_client(options)
|
||||||
@ -240,8 +240,8 @@ def delete_all_queued_images(options, args):
|
|||||||
%(prog)s delete-all-queued-images [options]
|
%(prog)s delete-all-queued-images [options]
|
||||||
|
|
||||||
Removes all images from the cache queue"""
|
Removes all images from the cache queue"""
|
||||||
if not options.force and \
|
if (not options.force and
|
||||||
not user_confirm("Delete all queued images?", default=False):
|
not user_confirm("Delete all queued images?", default=False)):
|
||||||
return SUCCESS
|
return SUCCESS
|
||||||
|
|
||||||
client = get_client(options)
|
client = get_client(options)
|
||||||
|
@ -94,8 +94,8 @@ def do_start(verb, server, conf, args):
|
|||||||
if verb != 'Respawn':
|
if verb != 'Respawn':
|
||||||
for pid_file, pid in pid_files(server, conf):
|
for pid_file, pid in pid_files(server, conf):
|
||||||
if os.path.exists('/proc/%s' % pid):
|
if os.path.exists('/proc/%s' % pid):
|
||||||
print "%s appears to already be running: %s" % \
|
print ("%s appears to already be running: %s" %
|
||||||
(server, pid_file)
|
(server, pid_file))
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
print "Removing stale pid file %s" % pid_file
|
print "Removing stale pid file %s" % pid_file
|
||||||
@ -205,8 +205,8 @@ def do_start(verb, server, conf, args):
|
|||||||
|
|
||||||
|
|
||||||
def get_pid_file(pid, conf):
|
def get_pid_file(pid, conf):
|
||||||
return os.path.abspath(conf.pid_file) if conf.pid_file else \
|
return (os.path.abspath(conf.pid_file) if conf.pid_file else
|
||||||
'/var/run/glance/%s.pid' % server
|
'/var/run/glance/%s.pid' % server)
|
||||||
|
|
||||||
|
|
||||||
def do_stop(server, conf, args, graceful=False):
|
def do_stop(server, conf, args, graceful=False):
|
||||||
@ -234,8 +234,8 @@ def do_stop(server, conf, args, graceful=False):
|
|||||||
break
|
break
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
else:
|
else:
|
||||||
print 'Waited 15 seconds for pid %s (%s) to die; giving up' % \
|
print ('Waited 15 seconds for pid %s (%s) to die; giving up' %
|
||||||
(pid, pid_file)
|
(pid, pid_file))
|
||||||
if not did_anything:
|
if not did_anything:
|
||||||
print 'No %s running' % server
|
print 'No %s running' % server
|
||||||
|
|
||||||
|
@ -99,12 +99,11 @@ def main():
|
|||||||
try:
|
try:
|
||||||
# We load the glance-registry config section because
|
# We load the glance-registry config section because
|
||||||
# sql_connection is only part of the glance registry.
|
# sql_connection is only part of the glance registry.
|
||||||
default_config_files = \
|
default_cfg_files = cfg.find_config_files(project='glance',
|
||||||
cfg.find_config_files(project='glance', prog='glance-registry')
|
prog='glance-registry')
|
||||||
|
|
||||||
conf = \
|
conf = config.GlanceConfigOpts(default_config_files=default_cfg_files,
|
||||||
config.GlanceConfigOpts(default_config_files=default_config_files,
|
usage="%prog [options] <cmd>")
|
||||||
usage="%prog [options] <cmd>")
|
|
||||||
glance.registry.db.add_options(conf)
|
glance.registry.db.add_options(conf)
|
||||||
args = conf()
|
args = conf()
|
||||||
config.setup_logging(conf)
|
config.setup_logging(conf)
|
||||||
|
@ -207,10 +207,10 @@ class BaseClient(object):
|
|||||||
DEFAULT_DOC_ROOT = None
|
DEFAULT_DOC_ROOT = None
|
||||||
# Standard CA file locations for Debian/Ubuntu, RedHat/Fedora,
|
# Standard CA file locations for Debian/Ubuntu, RedHat/Fedora,
|
||||||
# Suse, FreeBSD/OpenBSD
|
# Suse, FreeBSD/OpenBSD
|
||||||
DEFAULT_CA_FILE_PATH = '/etc/ssl/certs/ca-certificates.crt:'\
|
DEFAULT_CA_FILE_PATH = ('/etc/ssl/certs/ca-certificates.crt:'
|
||||||
'/etc/pki/tls/certs/ca-bundle.crt:'\
|
'/etc/pki/tls/certs/ca-bundle.crt:'
|
||||||
'/etc/ssl/ca-bundle.pem:'\
|
'/etc/ssl/ca-bundle.pem:'
|
||||||
'/etc/ssl/cert.pem'
|
'/etc/ssl/cert.pem')
|
||||||
|
|
||||||
OK_RESPONSE_CODES = (
|
OK_RESPONSE_CODES = (
|
||||||
httplib.OK,
|
httplib.OK,
|
||||||
|
@ -137,8 +137,8 @@ def generate_authors():
|
|||||||
new_authors = 'AUTHORS'
|
new_authors = 'AUTHORS'
|
||||||
if os.path.isdir('.git'):
|
if os.path.isdir('.git'):
|
||||||
# don't include jenkins email address in AUTHORS file
|
# don't include jenkins email address in AUTHORS file
|
||||||
git_log_cmd = "git log --format='%aN <%aE>' | sort -u | " \
|
git_log_cmd = ("git log --format='%aN <%aE>' | sort -u | "
|
||||||
"grep -v " + jenkins_email
|
"grep -v " + jenkins_email)
|
||||||
changelog = _run_shell_command(git_log_cmd)
|
changelog = _run_shell_command(git_log_cmd)
|
||||||
mailmap = parse_mailmap()
|
mailmap = parse_mailmap()
|
||||||
with open(new_authors, 'w') as new_authors_fh:
|
with open(new_authors, 'w') as new_authors_fh:
|
||||||
|
@ -27,8 +27,8 @@ import time
|
|||||||
|
|
||||||
import sqlalchemy
|
import sqlalchemy
|
||||||
from sqlalchemy import asc, create_engine, desc
|
from sqlalchemy import asc, create_engine, desc
|
||||||
from sqlalchemy.exc import IntegrityError, OperationalError, DBAPIError,\
|
from sqlalchemy.exc import (IntegrityError, OperationalError, DBAPIError,
|
||||||
DisconnectionError
|
DisconnectionError)
|
||||||
from sqlalchemy.orm import exc
|
from sqlalchemy.orm import exc
|
||||||
from sqlalchemy.orm import joinedload
|
from sqlalchemy.orm import joinedload
|
||||||
from sqlalchemy.orm import sessionmaker
|
from sqlalchemy.orm import sessionmaker
|
||||||
@ -193,8 +193,8 @@ def wrap_db_error(f):
|
|||||||
try:
|
try:
|
||||||
return f(*args, **kwargs)
|
return f(*args, **kwargs)
|
||||||
except OperationalError, e:
|
except OperationalError, e:
|
||||||
if remaining_attempts == 0 or \
|
if (remaining_attempts == 0 or
|
||||||
not is_db_connection_error(e.args[0]):
|
not is_db_connection_error(e.args[0])):
|
||||||
raise
|
raise
|
||||||
except DBAPIError:
|
except DBAPIError:
|
||||||
raise
|
raise
|
||||||
@ -374,8 +374,8 @@ def image_get_all(context, filters=None, marker=None, limit=None,
|
|||||||
|
|
||||||
session = get_session()
|
session = get_session()
|
||||||
query = session.query(models.Image).\
|
query = session.query(models.Image).\
|
||||||
options(joinedload(models.Image.properties)).\
|
options(joinedload(models.Image.properties)).\
|
||||||
options(joinedload(models.Image.members))
|
options(joinedload(models.Image.members))
|
||||||
|
|
||||||
if 'size_min' in filters:
|
if 'size_min' in filters:
|
||||||
query = query.filter(models.Image.size >= filters['size_min'])
|
query = query.filter(models.Image.size >= filters['size_min'])
|
||||||
@ -737,8 +737,8 @@ def image_member_get_memberships(context, member, marker=None, limit=None,
|
|||||||
|
|
||||||
session = get_session()
|
session = get_session()
|
||||||
query = session.query(models.ImageMember).\
|
query = session.query(models.ImageMember).\
|
||||||
options(joinedload(models.ImageMember.image)).\
|
options(joinedload(models.ImageMember.image)).\
|
||||||
filter_by(member=member)
|
filter_by(member=member)
|
||||||
|
|
||||||
if not can_show_deleted(context):
|
if not can_show_deleted(context):
|
||||||
query = query.filter_by(deleted=False)
|
query = query.filter_by(deleted=False)
|
||||||
@ -782,9 +782,9 @@ def image_tag_delete(context, image_id, value):
|
|||||||
"""Delete an image tag."""
|
"""Delete an image tag."""
|
||||||
session = get_session()
|
session = 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 exc.NoResultFound:
|
except exc.NoResultFound:
|
||||||
@ -797,7 +797,7 @@ def image_tag_get_all(context, image_id):
|
|||||||
"""Get a list of tags for a specific image."""
|
"""Get a list of tags for a specific image."""
|
||||||
session = get_session()
|
session = 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).\
|
||||||
all()
|
all()
|
||||||
return tags
|
return tags
|
||||||
|
@ -270,8 +270,8 @@ def schedule_delete_from_backend(uri, conf, context, image_id, **kwargs):
|
|||||||
exception.StoreDeleteNotSupported,
|
exception.StoreDeleteNotSupported,
|
||||||
exception.NotFound):
|
exception.NotFound):
|
||||||
exc_type = sys.exc_info()[0].__name__
|
exc_type = sys.exc_info()[0].__name__
|
||||||
msg = _("Failed to delete image at %s from store (%s)") % \
|
msg = (_("Failed to delete image at %s from store (%s)") %
|
||||||
(uri, exc_type)
|
(uri, exc_type))
|
||||||
logger.error(msg)
|
logger.error(msg)
|
||||||
finally:
|
finally:
|
||||||
# avoid falling through to the delayed deletion logic
|
# avoid falling through to the delayed deletion logic
|
||||||
|
@ -112,8 +112,8 @@ class Store(glance.store.base.Store):
|
|||||||
|
|
||||||
self.datadir = self.conf.filesystem_store_datadir
|
self.datadir = self.conf.filesystem_store_datadir
|
||||||
if self.datadir is None:
|
if self.datadir is None:
|
||||||
reason = _("Could not find %s in configuration options.") % \
|
reason = (_("Could not find %s in configuration options.") %
|
||||||
'filesystem_store_datadir'
|
'filesystem_store_datadir')
|
||||||
logger.error(reason)
|
logger.error(reason)
|
||||||
raise exception.BadStoreConfiguration(store_name="filesystem",
|
raise exception.BadStoreConfiguration(store_name="filesystem",
|
||||||
reason=reason)
|
reason=reason)
|
||||||
|
@ -229,8 +229,7 @@ class Store(glance.store.base.Store):
|
|||||||
else: # Defaults http
|
else: # Defaults http
|
||||||
self.full_s3_host = 'http://' + self.s3_host
|
self.full_s3_host = 'http://' + self.s3_host
|
||||||
|
|
||||||
self.s3_store_object_buffer_dir = \
|
self.s3_store_object_buffer_dir = self.conf.s3_store_object_buffer_dir
|
||||||
self.conf.s3_store_object_buffer_dir
|
|
||||||
|
|
||||||
def _option_get(self, param):
|
def _option_get(self, param):
|
||||||
result = getattr(self.conf, param)
|
result = getattr(self.conf, param)
|
||||||
|
@ -225,10 +225,10 @@ class Store(glance.store.base.Store):
|
|||||||
# The config file has swift_store_large_object_*size in MB, but
|
# The config file has swift_store_large_object_*size in MB, but
|
||||||
# internally we store it in bytes, since the image_size parameter
|
# internally we store it in bytes, since the image_size parameter
|
||||||
# passed to add() is also in bytes.
|
# passed to add() is also in bytes.
|
||||||
self.large_object_size = \
|
_obj_size = self.conf.swift_store_large_object_size
|
||||||
self.conf.swift_store_large_object_size * ONE_MB
|
self.large_object_size = _obj_size * ONE_MB
|
||||||
self.large_object_chunk_size = \
|
_obj_chunk_size = self.conf.swift_store_large_object_chunk_size
|
||||||
self.conf.swift_store_large_object_chunk_size * ONE_MB
|
self.large_object_chunk_size = _obj_chunk_size * ONE_MB
|
||||||
except cfg.ConfigFileValueError, e:
|
except cfg.ConfigFileValueError, e:
|
||||||
reason = _("Error in configuration conf: %s") % e
|
reason = _("Error in configuration conf: %s") % e
|
||||||
logger.error(reason)
|
logger.error(reason)
|
||||||
|
@ -153,8 +153,8 @@ class TestBinGlance(functional.FunctionalTest):
|
|||||||
|
|
||||||
line = lines[0]
|
line = lines[0]
|
||||||
|
|
||||||
image_id, name, disk_format, container_format, size = \
|
img_info = [c.strip() for c in line.split()]
|
||||||
[c.strip() for c in line.split()]
|
image_id, name, disk_format, container_format, size = img_info
|
||||||
self.assertEqual('MyImage', name)
|
self.assertEqual('MyImage', name)
|
||||||
|
|
||||||
self.assertEqual('0', size, "Expected image to be 0 bytes in size, "
|
self.assertEqual('0', size, "Expected image to be 0 bytes in size, "
|
||||||
@ -349,8 +349,8 @@ class TestBinGlance(functional.FunctionalTest):
|
|||||||
|
|
||||||
line = lines[0]
|
line = lines[0]
|
||||||
|
|
||||||
image_id, name, disk_format, container_format, size = \
|
img_info = [c.strip() for c in line.split()]
|
||||||
[c.strip() for c in line.split()]
|
image_id, name, disk_format, container_format, size = img_info
|
||||||
self.assertEqual('MyImage', name)
|
self.assertEqual('MyImage', name)
|
||||||
|
|
||||||
self.assertEqual('0', size, "Expected image to be 0 bytes in size, "
|
self.assertEqual('0', size, "Expected image to be 0 bytes in size, "
|
||||||
@ -406,8 +406,8 @@ class TestBinGlance(functional.FunctionalTest):
|
|||||||
|
|
||||||
line = lines[0]
|
line = lines[0]
|
||||||
|
|
||||||
image_id, name, disk_format, container_format, size = \
|
img_info = [c.strip() for c in line.split()]
|
||||||
[c.strip() for c in line.split()]
|
image_id, name, disk_format, container_format, size = img_info
|
||||||
self.assertEqual('MyImage', name)
|
self.assertEqual('MyImage', name)
|
||||||
|
|
||||||
self.assertEqual('3', size,
|
self.assertEqual('3', size,
|
||||||
@ -503,8 +503,8 @@ class TestBinGlance(functional.FunctionalTest):
|
|||||||
|
|
||||||
# 5. Update the image's Name attribute
|
# 5. Update the image's Name attribute
|
||||||
updated_image_name = "Updated image name"
|
updated_image_name = "Updated image name"
|
||||||
cmd = "bin/glance --port=%d update %s is_public=True name=\"%s\"" \
|
cmd = ("bin/glance --port=%d update %s is_public=True name=\"%s\"" %
|
||||||
% (api_port, image_id, updated_image_name)
|
(api_port, image_id, updated_image_name))
|
||||||
|
|
||||||
exitcode, out, err = execute(cmd)
|
exitcode, out, err = execute(cmd)
|
||||||
|
|
||||||
@ -1100,8 +1100,8 @@ class TestBinGlance(functional.FunctionalTest):
|
|||||||
|
|
||||||
line = lines[0]
|
line = lines[0]
|
||||||
|
|
||||||
image_id, name, disk_format, container_format, size = \
|
img_info = [c.strip() for c in line.split()]
|
||||||
[c.strip() for c in line.split()]
|
image_id, name, disk_format, container_format, size = img_info
|
||||||
self.assertEqual('MyImage', name)
|
self.assertEqual('MyImage', name)
|
||||||
|
|
||||||
# 3. Delete the image
|
# 3. Delete the image
|
||||||
@ -1113,8 +1113,8 @@ class TestBinGlance(functional.FunctionalTest):
|
|||||||
self.assertTrue(out.startswith('You do not have permission'))
|
self.assertTrue(out.startswith('You do not have permission'))
|
||||||
|
|
||||||
# 4. Remove image protection
|
# 4. Remove image protection
|
||||||
cmd = "bin/glance --port=%d --force update %s" \
|
cmd = ("bin/glance --port=%d --force update %s "
|
||||||
" protected=False" % (api_port, image_id)
|
"protected=False" % (api_port, image_id))
|
||||||
|
|
||||||
exitcode, out, err = execute(cmd)
|
exitcode, out, err = execute(cmd)
|
||||||
|
|
||||||
|
@ -225,8 +225,8 @@ paste.app_factory = glance.common.wsgi:app_factory
|
|||||||
glance.app_factory = glance.image_cache.queue_image:Queuer
|
glance.app_factory = glance.image_cache.queue_image:Queuer
|
||||||
""")
|
""")
|
||||||
|
|
||||||
cmd = "bin/glance-cache-prefetcher --config-file %s" % \
|
cmd = ("bin/glance-cache-prefetcher --config-file %s" %
|
||||||
cache_config_filepath
|
cache_config_filepath)
|
||||||
|
|
||||||
exitcode, out, err = execute(cmd)
|
exitcode, out, err = execute(cmd)
|
||||||
|
|
||||||
|
@ -495,8 +495,8 @@ glance.app_factory = glance.image_cache.queue_image:Queuer
|
|||||||
|
|
||||||
self.verify_no_cached_images()
|
self.verify_no_cached_images()
|
||||||
|
|
||||||
cmd = "bin/glance-cache-prefetcher --config-file %s" % \
|
cmd = ("bin/glance-cache-prefetcher --config-file %s" %
|
||||||
cache_config_filepath
|
cache_config_filepath)
|
||||||
|
|
||||||
exitcode, out, err = execute(cmd)
|
exitcode, out, err = execute(cmd)
|
||||||
|
|
||||||
|
@ -113,10 +113,10 @@ class TestMiscellaneous(functional.FunctionalTest):
|
|||||||
self.assertEqual(0, exitcode)
|
self.assertEqual(0, exitcode)
|
||||||
self.assertEqual('{"images": []}', out.strip())
|
self.assertEqual('{"images": []}', out.strip())
|
||||||
|
|
||||||
cmd = "curl -X POST -H 'Content-Type: application/octet-stream' "\
|
cmd = ("curl -X POST -H 'Content-Type: application/octet-stream' "
|
||||||
"-H 'X-Image-Meta-Name: ImageName' "\
|
"-H 'X-Image-Meta-Name: ImageName' "
|
||||||
"-H 'X-Image-Meta-Disk-Format: Invalid' "\
|
"-H 'X-Image-Meta-Disk-Format: Invalid' "
|
||||||
"http://0.0.0.0:%d/v1/images" % api_port
|
"http://0.0.0.0:%d/v1/images" % api_port)
|
||||||
ignored, out, err = execute(cmd)
|
ignored, out, err = execute(cmd)
|
||||||
|
|
||||||
self.assertTrue('Invalid disk format' in out,
|
self.assertTrue('Invalid disk format' in out,
|
||||||
|
@ -72,8 +72,8 @@ class TestPasteApp(unittest.TestCase):
|
|||||||
|
|
||||||
def test_load_paste_app_with_paste_flavor(self):
|
def test_load_paste_app_with_paste_flavor(self):
|
||||||
paste_group = {'paste_deploy': {'flavor': 'incomplete'}}
|
paste_group = {'paste_deploy': {'flavor': 'incomplete'}}
|
||||||
pipeline = '[pipeline:glance-registry-incomplete]\n' + \
|
pipeline = ('[pipeline:glance-registry-incomplete]\n'
|
||||||
'pipeline = context registryapp'
|
'pipeline = context registryapp')
|
||||||
|
|
||||||
type = context.ContextMiddleware
|
type = context.ContextMiddleware
|
||||||
self._do_test_load_paste_app(type, paste_group, paste_append=pipeline)
|
self._do_test_load_paste_app(type, paste_group, paste_append=pipeline)
|
||||||
@ -89,9 +89,9 @@ class TestPasteApp(unittest.TestCase):
|
|||||||
|
|
||||||
def test_load_paste_app_with_conf_name(self):
|
def test_load_paste_app_with_conf_name(self):
|
||||||
def fake_join(*args):
|
def fake_join(*args):
|
||||||
if len(args) == 2 and \
|
if (len(args) == 2 and
|
||||||
args[0].endswith('.glance') and \
|
args[0].endswith('.glance') and
|
||||||
args[1] == 'glance-cache.conf':
|
args[1] == 'glance-cache.conf'):
|
||||||
return os.path.join(os.getcwd(), 'etc', args[1])
|
return os.path.join(os.getcwd(), 'etc', args[1])
|
||||||
else:
|
else:
|
||||||
return orig_join(*args)
|
return orig_join(*args)
|
||||||
|
@ -251,8 +251,7 @@ class TestStore(base.StoreClearingUnitTest):
|
|||||||
expected_image_id = utils.generate_uuid()
|
expected_image_id = utils.generate_uuid()
|
||||||
expected_s3_size = FIVE_KB
|
expected_s3_size = FIVE_KB
|
||||||
expected_s3_contents = "*" * expected_s3_size
|
expected_s3_contents = "*" * expected_s3_size
|
||||||
expected_checksum = \
|
expected_checksum = hashlib.md5(expected_s3_contents).hexdigest()
|
||||||
hashlib.md5(expected_s3_contents).hexdigest()
|
|
||||||
new_conf = S3_CONF.copy()
|
new_conf = S3_CONF.copy()
|
||||||
new_conf['s3_store_host'] = variation
|
new_conf['s3_store_host'] = variation
|
||||||
expected_location = format_s3_location(
|
expected_location = format_s3_location(
|
||||||
|
@ -61,8 +61,8 @@ class RequestTest(unittest.TestCase):
|
|||||||
|
|
||||||
def test_content_type_from_accept_json_xml_quality(self):
|
def test_content_type_from_accept_json_xml_quality(self):
|
||||||
request = wsgi.Request.blank('/tests/123')
|
request = wsgi.Request.blank('/tests/123')
|
||||||
request.headers["Accept"] = \
|
request.headers["Accept"] = ("application/json; q=0.3, "
|
||||||
"application/json; q=0.3, application/xml; q=0.9"
|
"application/xml; q=0.9")
|
||||||
result = request.best_match_content_type()
|
result = request.best_match_content_type()
|
||||||
self.assertEqual(result, "application/json")
|
self.assertEqual(result, "application/json")
|
||||||
|
|
||||||
|
@ -87,8 +87,8 @@ class TestConfigOpts(config.GlanceConfigOpts):
|
|||||||
def __call__(self):
|
def __call__(self):
|
||||||
self._write_tmp_config_file()
|
self._write_tmp_config_file()
|
||||||
try:
|
try:
|
||||||
super(TestConfigOpts, self).\
|
super(TestConfigOpts, self).__call__(['--config-file',
|
||||||
__call__(['--config-file', self.temp_file])
|
self.temp_file])
|
||||||
finally:
|
finally:
|
||||||
if self.clean:
|
if self.clean:
|
||||||
os.remove(self.temp_file)
|
os.remove(self.temp_file)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user