Rename async package to async_
In Python 3.7, "async" is a keyword. To prevent it from conflicting, rename the async package to async_. Change-Id: I1eaf87eedb86679d9ca9323aac05f0770c33efea Closes-Bug: #1781617
This commit is contained in:
parent
cacede14b4
commit
c58e5e02af
@ -243,17 +243,17 @@ specified in the ``glance-image-import.conf`` file. The plugins are loaded by
|
||||
the Glance project team, these are already registered for you.)
|
||||
|
||||
A plugin must be written in Python as a `Taskflow "Task" object`_. The file
|
||||
containing this object must be present in the ``glance/async/flows/plugins``
|
||||
containing this object must be present in the ``glance/async_/flows/plugins``
|
||||
directory. The plugin file must contain a ``get_flow`` function that returns a
|
||||
Taskflow Task object wrapped in a linear flow. See the ``no_op`` plugin,
|
||||
located at ``glance/async/flows/plugins/no_op.py`` for an example of how to do
|
||||
located at ``glance/async_/flows/plugins/no_op.py`` for an example of how to do
|
||||
this.
|
||||
|
||||
Specifying the plugins to be used
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
First, the plugin code must exist in the directory
|
||||
``glance/async/flows/plugins``. The name of a plugin is the filename (without
|
||||
``glance/async_/flows/plugins``. The name of a plugin is the filename (without
|
||||
extension) of the file containing the plugin code. For example, a file named
|
||||
``fred_mertz.py`` would contain the plugin ``fred_mertz``.
|
||||
|
||||
@ -269,7 +269,7 @@ of the form::
|
||||
|
||||
For example::
|
||||
|
||||
no_op = glance.async.flows.plugins.no_op:get_flow
|
||||
no_op = glance.async_.flows.plugins.no_op:get_flow
|
||||
|
||||
Make sure any plugin you want to use is included here.
|
||||
|
||||
@ -337,7 +337,7 @@ required.
|
||||
The first section, ``image_import_opts``, is used to enable the plugin by
|
||||
specifying the plugin name as one of the elements of the list that is the
|
||||
value of the `image_import_plugins` parameter. The plugin name is simply
|
||||
the module name under glance/async/flows/plugins/
|
||||
the module name under glance/async\_/flows/plugins/
|
||||
|
||||
The second section, ``inject_metadata_properties``, is where you set the
|
||||
parameters for the injection plugin. (Note that the values you specify here
|
||||
|
@ -23,8 +23,8 @@ from taskflow.patterns import linear_flow as lf
|
||||
from taskflow import retry
|
||||
from taskflow import task
|
||||
|
||||
import glance.async.flows._internal_plugins as internal_plugins
|
||||
import glance.async.flows.plugins as import_plugins
|
||||
import glance.async_.flows._internal_plugins as internal_plugins
|
||||
import glance.async_.flows.plugins as import_plugins
|
||||
from glance.common import exception
|
||||
from glance.common.scripts.image_import import main as image_import
|
||||
from glance.common.scripts import utils as script_utils
|
@ -30,7 +30,7 @@ from taskflow import retry
|
||||
from taskflow import task
|
||||
from taskflow.types import failure
|
||||
|
||||
from glance.async import utils
|
||||
from glance.async_ import utils
|
||||
from glance.common import exception
|
||||
from glance.common.scripts.image_import import main as image_import
|
||||
from glance.common.scripts import utils as script_utils
|
@ -21,7 +21,7 @@ from oslo_utils import encodeutils
|
||||
from oslo_utils import excutils
|
||||
from taskflow.patterns import linear_flow as lf
|
||||
|
||||
from glance.async import utils
|
||||
from glance.async_ import utils
|
||||
from glance.i18n import _LE
|
||||
|
||||
|
@ -24,7 +24,7 @@ from oslo_utils import excutils
|
||||
from taskflow.patterns import linear_flow as lf
|
||||
from taskflow import task
|
||||
|
||||
from glance.async import utils
|
||||
from glance.async_ import utils
|
||||
from glance.i18n import _
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
|
||||
import glance.async.flows.plugins.image_conversion
|
||||
import glance.async.flows.plugins.inject_image_metadata
|
||||
import glance.async_.flows.plugins.image_conversion
|
||||
import glance.async_.flows.plugins.inject_image_metadata
|
||||
|
||||
|
||||
# Note(jokke): This list contains tuples of config options for import plugins.
|
||||
@ -27,9 +27,9 @@ import glance.async.flows.plugins.inject_image_metadata
|
||||
# registered under at the config file.
|
||||
PLUGIN_OPTS = [
|
||||
('inject_metadata_properties',
|
||||
glance.async.flows.plugins.inject_image_metadata.inject_metadata_opts),
|
||||
glance.async_.flows.plugins.inject_image_metadata.inject_metadata_opts),
|
||||
('image_conversion',
|
||||
glance.async.flows.plugins.image_conversion.conversion_plugin_opts),
|
||||
glance.async_.flows.plugins.image_conversion.conversion_plugin_opts),
|
||||
]
|
||||
|
||||
|
@ -23,7 +23,7 @@ from stevedore import driver
|
||||
from taskflow import engines
|
||||
from taskflow.listeners import logging as llistener
|
||||
|
||||
import glance.async
|
||||
import glance.async_
|
||||
from glance.common import exception
|
||||
from glance.common.scripts import utils as script_utils
|
||||
from glance.i18n import _, _LE
|
||||
@ -85,7 +85,7 @@ CONF = cfg.CONF
|
||||
CONF.register_opts(taskflow_executor_opts, group='taskflow_executor')
|
||||
|
||||
|
||||
class TaskExecutor(glance.async.TaskExecutor):
|
||||
class TaskExecutor(glance.async_.TaskExecutor):
|
||||
|
||||
def __init__(self, context, task_repo, image_repo, image_factory):
|
||||
self.context = context
|
@ -128,7 +128,7 @@ def cooperative_read(fd):
|
||||
MAX_COOP_READER_BUFFER_SIZE = 134217728 # 128M seems like a sane buffer limit
|
||||
|
||||
CONF.import_group('import_filtering_opts',
|
||||
'glance.async.flows._internal_plugins')
|
||||
'glance.async_.flows._internal_plugins')
|
||||
|
||||
|
||||
def validate_import_uri(uri):
|
||||
|
@ -513,7 +513,7 @@ class TaskExecutorFactory(object):
|
||||
TaskExecutorFactory.eventlet_deprecation_warned = True
|
||||
task_executor = 'taskflow'
|
||||
|
||||
executor_cls = ('glance.async.%s_executor.'
|
||||
executor_cls = ('glance.async_.%s_executor.'
|
||||
'TaskExecutor' % task_executor)
|
||||
LOG.debug("Loading %s executor", task_executor)
|
||||
executor = importutils.import_class(executor_cls)
|
||||
|
@ -28,11 +28,11 @@ from osprofiler import opts as profiler
|
||||
|
||||
import glance.api.middleware.context
|
||||
import glance.api.versions
|
||||
import glance.async.flows._internal_plugins
|
||||
import glance.async.flows.api_image_import
|
||||
import glance.async.flows.convert
|
||||
from glance.async.flows.plugins import plugin_opts
|
||||
import glance.async.taskflow_executor
|
||||
import glance.async_.flows._internal_plugins
|
||||
import glance.async_.flows.api_image_import
|
||||
import glance.async_.flows.convert
|
||||
from glance.async_.flows.plugins import plugin_opts
|
||||
import glance.async_.taskflow_executor
|
||||
import glance.common.config
|
||||
import glance.common.location_strategy
|
||||
import glance.common.location_strategy.store_type
|
||||
@ -71,8 +71,8 @@ _api_opts = [
|
||||
('image_format', glance.common.config.image_format_opts),
|
||||
('task', glance.common.config.task_opts),
|
||||
('taskflow_executor', list(itertools.chain(
|
||||
glance.async.taskflow_executor.taskflow_executor_opts,
|
||||
glance.async.flows.convert.convert_task_opts))),
|
||||
glance.async_.taskflow_executor.taskflow_executor_opts,
|
||||
glance.async_.flows.convert.convert_task_opts))),
|
||||
('store_type_location_strategy',
|
||||
glance.common.location_strategy.store_type.store_type_opts),
|
||||
profiler.list_opts()[0],
|
||||
@ -109,9 +109,10 @@ _manage_opts = [
|
||||
(None, [])
|
||||
]
|
||||
_image_import_opts = [
|
||||
('image_import_opts', glance.async.flows.api_image_import.api_import_opts),
|
||||
('image_import_opts',
|
||||
glance.async_.flows.api_image_import.api_import_opts),
|
||||
('import_filtering_opts',
|
||||
glance.async.flows._internal_plugins.import_filtering_opts),
|
||||
glance.async_.flows._internal_plugins.import_filtering_opts),
|
||||
]
|
||||
|
||||
|
||||
|
@ -19,7 +19,7 @@ import os
|
||||
import glance_store
|
||||
from oslo_config import cfg
|
||||
|
||||
import glance.async.flows.plugins.inject_image_metadata as inject_metadata
|
||||
import glance.async_.flows.plugins.inject_image_metadata as inject_metadata
|
||||
from glance.common import utils
|
||||
from glance import domain
|
||||
from glance import gateway
|
@ -17,7 +17,7 @@ import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
import glance.async.flows.api_image_import as import_flow
|
||||
import glance.async_.flows.api_image_import as import_flow
|
||||
import glance.tests.utils as test_utils
|
||||
|
||||
CONF = cfg.CONF
|
||||
@ -52,7 +52,7 @@ class TestApiImageImportTask(test_utils.BaseTestCase):
|
||||
self.mock_task_repo = mock.MagicMock()
|
||||
self.mock_image_repo = mock.MagicMock()
|
||||
|
||||
@mock.patch('glance.async.flows.api_image_import._VerifyStaging.__init__')
|
||||
@mock.patch('glance.async_.flows.api_image_import._VerifyStaging.__init__')
|
||||
@mock.patch('taskflow.patterns.linear_flow.Flow.add')
|
||||
@mock.patch('taskflow.patterns.linear_flow.__init__')
|
||||
def _pass_uri(self, mock_lf_init, mock_flow_add, mock_VS_init,
|
@ -22,8 +22,8 @@ from oslo_concurrency import processutils
|
||||
from oslo_config import cfg
|
||||
import six
|
||||
|
||||
from glance.async.flows import convert
|
||||
from glance.async import taskflow_executor
|
||||
from glance.async_.flows import convert
|
||||
from glance.async_ import taskflow_executor
|
||||
from glance.common.scripts import utils as script_utils
|
||||
from glance.common import utils
|
||||
from glance import domain
|
@ -25,9 +25,9 @@ from six.moves import urllib
|
||||
from taskflow import task
|
||||
from taskflow.types import failure
|
||||
|
||||
import glance.async.flows.base_import as import_flow
|
||||
from glance.async import taskflow_executor
|
||||
from glance.async import utils as async_utils
|
||||
import glance.async_.flows.base_import as import_flow
|
||||
from glance.async_ import taskflow_executor
|
||||
from glance.async_ import utils as async_utils
|
||||
from glance.common.scripts.image_import import main as image_import
|
||||
from glance.common.scripts import utils as script_utils
|
||||
from glance.common import utils
|
@ -20,8 +20,8 @@ import glance_store
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_config import cfg
|
||||
|
||||
from glance.async.flows import introspect
|
||||
from glance.async import utils as async_utils
|
||||
from glance.async_.flows import introspect
|
||||
from glance.async_ import utils as async_utils
|
||||
from glance import domain
|
||||
import glance.tests.utils as test_utils
|
||||
|
@ -24,7 +24,7 @@ try:
|
||||
except ImportError:
|
||||
from defusedxml.ElementTree import ParseError
|
||||
|
||||
from glance.async.flows import ovf_process
|
||||
from glance.async_.flows import ovf_process
|
||||
import glance.tests.utils as test_utils
|
||||
from oslo_config import cfg
|
||||
|
@ -19,7 +19,7 @@ from glance_store._drivers import filesystem
|
||||
from glance_store import backend
|
||||
from oslo_config import cfg
|
||||
|
||||
from glance.async.flows._internal_plugins import web_download
|
||||
from glance.async_.flows._internal_plugins import web_download
|
||||
|
||||
import glance.common.exception
|
||||
import glance.common.scripts.utils as script_utils
|
@ -16,7 +16,7 @@
|
||||
|
||||
import mock
|
||||
|
||||
import glance.async
|
||||
import glance.async_
|
||||
import glance.tests.utils as test_utils
|
||||
|
||||
|
||||
@ -28,10 +28,10 @@ class TestTaskExecutor(test_utils.BaseTestCase):
|
||||
self.task_repo = mock.Mock()
|
||||
self.image_repo = mock.Mock()
|
||||
self.image_factory = mock.Mock()
|
||||
self.executor = glance.async.TaskExecutor(self.context,
|
||||
self.task_repo,
|
||||
self.image_repo,
|
||||
self.image_factory)
|
||||
self.executor = glance.async_.TaskExecutor(self.context,
|
||||
self.task_repo,
|
||||
self.image_repo,
|
||||
self.image_factory)
|
||||
|
||||
def test_begin_processing(self):
|
||||
# setup
|
||||
@ -40,7 +40,7 @@ class TestTaskExecutor(test_utils.BaseTestCase):
|
||||
task = mock.Mock()
|
||||
|
||||
with mock.patch.object(
|
||||
glance.async.TaskExecutor,
|
||||
glance.async_.TaskExecutor,
|
||||
'_run') as mock_run:
|
||||
self.task_repo.get.return_value = task
|
||||
self.executor.begin_processing(task_id)
|
@ -19,7 +19,7 @@ import glance_store
|
||||
from oslo_config import cfg
|
||||
from taskflow import engines
|
||||
|
||||
from glance.async import taskflow_executor
|
||||
from glance.async_ import taskflow_executor
|
||||
from glance.common.scripts.image_import import main as image_import
|
||||
from glance import domain
|
||||
import glance.tests.utils as test_utils
|
@ -21,8 +21,8 @@ import mock
|
||||
from oslo_config import cfg
|
||||
import oslo_utils.importutils
|
||||
|
||||
import glance.async
|
||||
from glance.async import taskflow_executor
|
||||
import glance.async_
|
||||
from glance.async_ import taskflow_executor
|
||||
from glance.common import exception
|
||||
from glance.common import timeutils
|
||||
from glance import domain
|
||||
@ -467,12 +467,12 @@ class TestTask(test_utils.BaseTestCase):
|
||||
self.task.expires_at
|
||||
)
|
||||
|
||||
@mock.patch.object(glance.async.TaskExecutor, 'begin_processing')
|
||||
@mock.patch.object(glance.async_.TaskExecutor, 'begin_processing')
|
||||
def test_run(self, mock_begin_processing):
|
||||
executor = glance.async.TaskExecutor(context=mock.ANY,
|
||||
task_repo=mock.ANY,
|
||||
image_repo=mock.ANY,
|
||||
image_factory=mock.ANY)
|
||||
executor = glance.async_.TaskExecutor(context=mock.ANY,
|
||||
task_repo=mock.ANY,
|
||||
image_repo=mock.ANY,
|
||||
image_factory=mock.ANY)
|
||||
self.task.run(executor)
|
||||
|
||||
mock_begin_processing.assert_called_once_with(self.task.task_id)
|
||||
|
@ -22,7 +22,7 @@ from oslo_config import cfg
|
||||
import oslo_messaging
|
||||
import webob
|
||||
|
||||
import glance.async
|
||||
import glance.async_
|
||||
from glance.common import exception
|
||||
from glance.common import timeutils
|
||||
import glance.context
|
||||
@ -681,7 +681,7 @@ class TestTaskNotifications(utils.BaseTestCase):
|
||||
self.assertEqual(0, len(output_logs))
|
||||
|
||||
def test_task_run_notification(self):
|
||||
with mock.patch('glance.async.TaskExecutor') as mock_executor:
|
||||
with mock.patch('glance.async_.TaskExecutor') as mock_executor:
|
||||
executor = mock_executor.return_value
|
||||
executor._run.return_value = mock.Mock()
|
||||
self.task_proxy.run(executor=mock_executor)
|
||||
@ -694,7 +694,7 @@ class TestTaskNotifications(utils.BaseTestCase):
|
||||
|
||||
def test_task_run_notification_disabled(self):
|
||||
self.config(disabled_notifications=['task.run'])
|
||||
with mock.patch('glance.async.TaskExecutor') as mock_executor:
|
||||
with mock.patch('glance.async_.TaskExecutor') as mock_executor:
|
||||
executor = mock_executor.return_value
|
||||
executor._run.return_value = mock.Mock()
|
||||
self.task_proxy.run(executor=mock_executor)
|
||||
|
18
setup.cfg
18
setup.cfg
@ -64,21 +64,21 @@ glance.database.metadata_backend =
|
||||
sqlalchemy = glance.db.sqlalchemy.metadata
|
||||
|
||||
glance.flows =
|
||||
api_image_import = glance.async.flows.api_image_import:get_flow
|
||||
import = glance.async.flows.base_import:get_flow
|
||||
api_image_import = glance.async_.flows.api_image_import:get_flow
|
||||
import = glance.async_.flows.base_import:get_flow
|
||||
|
||||
glance.flows.import =
|
||||
convert = glance.async.flows.convert:get_flow
|
||||
introspect = glance.async.flows.introspect:get_flow
|
||||
ovf_process = glance.async.flows.ovf_process:get_flow
|
||||
convert = glance.async_.flows.convert:get_flow
|
||||
introspect = glance.async_.flows.introspect:get_flow
|
||||
ovf_process = glance.async_.flows.ovf_process:get_flow
|
||||
|
||||
glance.image_import.plugins =
|
||||
no_op = glance.async.flows.plugins.no_op:get_flow
|
||||
inject_image_metadata=glance.async.flows.plugins.inject_image_metadata:get_flow
|
||||
image_conversion=glance.async.flows.plugins.image_conversion:get_flow
|
||||
no_op = glance.async_.flows.plugins.no_op:get_flow
|
||||
inject_image_metadata=glance.async_.flows.plugins.inject_image_metadata:get_flow
|
||||
image_conversion=glance.async_.flows.plugins.image_conversion:get_flow
|
||||
|
||||
glance.image_import.internal_plugins =
|
||||
web_download = glance.async.flows._internal_plugins.web_download:get_flow
|
||||
web_download = glance.async_.flows._internal_plugins.web_download:get_flow
|
||||
|
||||
|
||||
[egg_info]
|
||||
|
Loading…
Reference in New Issue
Block a user