Merge "Python3: Add support for raise and urlparse"
This commit is contained in:
commit
d77aeefd61
@ -125,7 +125,7 @@ def parallel_select(collection, func, limit=1000):
|
||||
except StopIteration:
|
||||
return map(lambda t: t[0], result)
|
||||
else:
|
||||
raise exception[0], None, exception[2]
|
||||
six.reraise(exception[0], None, exception[2])
|
||||
|
||||
|
||||
def enum(**enums):
|
||||
|
@ -76,7 +76,8 @@ class PropertySpec(Spec):
|
||||
except exceptions.ContractViolationException as e:
|
||||
msg = u'[{0}.{1}{2}] {3}'.format(
|
||||
self.class_name, self.property_name, e.path, six.text_type(e))
|
||||
raise exceptions.ContractViolationException, msg, sys.exc_info()[2]
|
||||
six.reraise(exceptions.ContractViolationException,
|
||||
msg, sys.exc_info()[2])
|
||||
|
||||
|
||||
class ArgumentSpec(Spec):
|
||||
@ -93,4 +94,5 @@ class ArgumentSpec(Spec):
|
||||
msg = u'[{0}::{1}({2}{3})] {4}'.format(
|
||||
self.class_name, self.method_name, self.arg_name,
|
||||
e.path, six.text_type(e))
|
||||
raise exceptions.ContractViolationException, msg, sys.exc_info()[2]
|
||||
six.reraise(exceptions.ContractViolationException,
|
||||
msg, sys.exc_info()[2])
|
||||
|
@ -82,7 +82,8 @@ class ApiPackageLoader(package_loader.MuranoPackageLoader):
|
||||
package_definition = self._get_definition(filter_opts)
|
||||
except LookupError:
|
||||
exc_info = sys.exc_info()
|
||||
raise exceptions.NoPackageFound(package_name), None, exc_info[2]
|
||||
six.reraise(exceptions.NoPackageFound(package_name),
|
||||
None, exc_info[2])
|
||||
return self._to_dsl_package(
|
||||
self._get_package_by_definition(package_definition))
|
||||
|
||||
@ -156,7 +157,7 @@ class ApiPackageLoader(package_loader.MuranoPackageLoader):
|
||||
package_id, str(e)
|
||||
)
|
||||
exc_info = sys.exc_info()
|
||||
raise pkg_exc.PackageLoadError(msg), None, exc_info[2]
|
||||
six.reraise(pkg_exc.PackageLoadError(msg), None, exc_info[2])
|
||||
package_file = None
|
||||
try:
|
||||
with tempfile.NamedTemporaryFile(delete=False) as package_file:
|
||||
@ -170,7 +171,7 @@ class ApiPackageLoader(package_loader.MuranoPackageLoader):
|
||||
except IOError:
|
||||
msg = 'Unable to extract package data for %s' % package_id
|
||||
exc_info = sys.exc_info()
|
||||
raise pkg_exc.PackageLoadError(msg), None, exc_info[2]
|
||||
six.reraise(pkg_exc.PackageLoadError(msg), None, exc_info[2])
|
||||
finally:
|
||||
try:
|
||||
if package_file:
|
||||
|
@ -16,12 +16,12 @@
|
||||
import copy
|
||||
import datetime
|
||||
import os
|
||||
import urlparse
|
||||
import uuid
|
||||
|
||||
import eventlet.event
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from six.moves import urllib
|
||||
from yaql import specs
|
||||
|
||||
import murano.common.exceptions as exceptions
|
||||
@ -258,7 +258,7 @@ class Agent(object):
|
||||
|
||||
def _is_url(self, file):
|
||||
file = self._get_url(file)
|
||||
parts = urlparse.urlsplit(file)
|
||||
parts = urllib.parse.urlsplit(file)
|
||||
if not parts.scheme or not parts.netloc:
|
||||
return False
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user