fix logging in swift
This commit is contained in:
parent
74e8627738
commit
f46c961ffb
@ -111,9 +111,9 @@ class SwiftBackend(glance.store.Backend):
|
||||
# should be a stateful object with options parsed once in
|
||||
# a constructor.
|
||||
if not auth_address:
|
||||
logger.error(msg)
|
||||
msg = ("Could not find swift_store_auth_address in configuration "
|
||||
"options.")
|
||||
logger.error(msg)
|
||||
raise glance.store.BackendException(msg)
|
||||
else:
|
||||
full_auth_address = auth_address
|
||||
@ -121,15 +121,15 @@ class SwiftBackend(glance.store.Backend):
|
||||
full_auth_address = 'https://' + full_auth_address
|
||||
|
||||
if not user:
|
||||
logger.error(msg)
|
||||
msg = ("Could not find swift_store_user in configuration "
|
||||
"options.")
|
||||
logger.error(msg)
|
||||
raise glance.store.BackendException(msg)
|
||||
|
||||
if not key:
|
||||
logger.error(msg)
|
||||
msg = ("Could not find swift_store_key in configuration "
|
||||
"options.")
|
||||
logger.error(msg)
|
||||
raise glance.store.BackendException(msg)
|
||||
|
||||
swift_conn = swift_client.Connection(
|
||||
|
@ -324,6 +324,42 @@ class TestSwiftBackend(unittest.TestCase):
|
||||
SwiftBackend.add,
|
||||
2, image_swift, SWIFT_OPTIONS)
|
||||
|
||||
def test_add_no_user(self):
|
||||
"""
|
||||
Tests that adding options without user raises
|
||||
an appropriate exception
|
||||
"""
|
||||
image_swift = StringIO.StringIO("nevergonnamakeit")
|
||||
options = SWIFT_OPTIONS.copy()
|
||||
del options['swift_store_user']
|
||||
self.assertRaises(BackendException,
|
||||
SwiftBackend.add,
|
||||
2, image_swift, options)
|
||||
|
||||
def test_no_key(self):
|
||||
"""
|
||||
Tests that adding options without key raises
|
||||
an appropriate exception
|
||||
"""
|
||||
image_swift = StringIO.StringIO("nevergonnamakeit")
|
||||
options = SWIFT_OPTIONS.copy()
|
||||
del options['swift_store_key']
|
||||
self.assertRaises(BackendException,
|
||||
SwiftBackend.add,
|
||||
2, image_swift, options)
|
||||
|
||||
def test_add_no_auth_address(self):
|
||||
"""
|
||||
Tests that adding options without auth address raises
|
||||
an appropriate exception
|
||||
"""
|
||||
image_swift = StringIO.StringIO("nevergonnamakeit")
|
||||
options = SWIFT_OPTIONS.copy()
|
||||
del options['swift_store_auth_address']
|
||||
self.assertRaises(BackendException,
|
||||
SwiftBackend.add,
|
||||
2, image_swift, options)
|
||||
|
||||
def test_delete(self):
|
||||
"""
|
||||
Test we can delete an existing image in the swift store
|
||||
|
Loading…
Reference in New Issue
Block a user