Merge "Adding filesystem schema check in async task" into stable/juno

This commit is contained in:
Jenkins 2015-02-03 03:44:43 +00:00 committed by Gerrit Code Review
commit cd42a98b61
2 changed files with 6 additions and 4 deletions

View File

@ -92,10 +92,10 @@ def validate_location_uri(location):
return location
# NOTE: file type uri is being avoided for security reasons,
# see LP bug #942118.
elif location.startswith("file:///"):
msg = ("File based imports are not allowed. Please use a non-local "
"source of image data.")
# see LP bug #942118 #1400966.
elif location.startswith(("file:///", "filesystem:///")):
msg = _("File based imports are not allowed. Please use a non-local "
"source of image data.")
# NOTE: raise Exception and let the encompassing block save
# the error msg in the task.message.
raise StandardError(msg)

View File

@ -76,6 +76,8 @@ class TestScriptsUtils(test_utils.BaseTestCase):
def test_validate_location_file_location_error(self):
self.assertRaises(StandardError, script_utils.validate_location_uri,
"file:///tmp")
self.assertRaises(StandardError, script_utils.validate_location_uri,
"filesystem:///tmp")
def test_validate_location_unsupported_error(self):
location = 'swift'