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