Centralize plugin loaders in watcher/applier

Refactor all plugin loaders in watcher/applier into
watcher/applier/loading/default.py.

Change-Id: I0f0a87d4f72ead45d34aca1b14219fd2ede42a6f
Closes-Bug: #1591095
This commit is contained in:
Tin Lam 2016-06-22 00:02:03 -05:00
parent 9918f59227
commit 37595e9bb7
13 changed files with 18 additions and 42 deletions

View File

@ -19,7 +19,7 @@ from __future__ import unicode_literals
from oslo_log import log
from watcher.applier.actions.loading import default
from watcher.applier.loading import default
LOG = log.getLogger(__name__)

View File

@ -1,25 +0,0 @@
# -*- encoding: utf-8 -*-
# Copyright (c) 2015 b<>com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from __future__ import unicode_literals
from watcher.common.loader import default
class DefaultActionLoader(default.DefaultLoader):
def __init__(self):
super(DefaultActionLoader, self).__init__(namespace='watcher_actions')

View File

@ -20,7 +20,7 @@ from oslo_config import cfg
from oslo_log import log
from watcher.applier import base
from watcher.applier.workflow_engine.loading import default
from watcher.applier.loading import default
from watcher import objects
LOG = log.getLogger(__name__)

View File

@ -1,6 +1,3 @@
# -*- encoding: utf-8 -*-
# Copyright (c) 2015 b<>com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@ -13,10 +10,10 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from __future__ import unicode_literals
from watcher.common.loader import default
@ -24,3 +21,9 @@ class DefaultWorkFlowEngineLoader(default.DefaultLoader):
def __init__(self):
super(DefaultWorkFlowEngineLoader, self).__init__(
namespace='watcher_workflow_engines')
class DefaultActionLoader(default.DefaultLoader):
def __init__(self):
super(DefaultActionLoader, self).__init__(
namespace='watcher_actions')

View File

@ -19,10 +19,8 @@ from keystoneauth1 import loading as ka_loading
import prettytable as ptable
import watcher.api.app
from watcher.applier.actions.loading import default as action_loader
from watcher.applier.loading import default as applier_loader
from watcher.applier import manager as applier_manager
from watcher.applier.workflow_engine.loading import default as \
workflow_engine_loader
from watcher.common import clients
from watcher.common import utils
from watcher.decision_engine.loading import default as decision_engine_loader
@ -31,10 +29,10 @@ from watcher.decision_engine.planner import manager as planner_manager
PLUGIN_LOADERS = (
action_loader.DefaultActionLoader,
applier_loader.DefaultActionLoader,
decision_engine_loader.DefaultPlannerLoader,
decision_engine_loader.DefaultStrategyLoader,
workflow_engine_loader.DefaultWorkFlowEngineLoader,
applier_loader.DefaultWorkFlowEngineLoader,
)

View File

@ -16,7 +16,7 @@
from __future__ import unicode_literals
from watcher.applier.actions import base as abase
from watcher.applier.actions.loading import default
from watcher.applier.loading import default
from watcher.tests import base

View File

@ -15,8 +15,8 @@
# limitations under the License.
from __future__ import unicode_literals
from watcher.applier.loading import default
from watcher.applier.workflow_engine import base as wbase
from watcher.applier.workflow_engine.loading import default
from watcher.tests import base

View File

@ -19,7 +19,7 @@
import collections
import mock
from watcher.applier.actions.loading import default
from watcher.applier.loading import default
from watcher.common import exception
from watcher.decision_engine.model import model_root
from watcher.decision_engine.strategy import strategies

View File

@ -16,7 +16,7 @@
import mock
from watcher.applier.actions.loading import default
from watcher.applier.loading import default
from watcher.decision_engine.model import model_root
from watcher.decision_engine.strategy import strategies
from watcher.tests import base

View File

@ -19,7 +19,7 @@
import collections
import mock
from watcher.applier.actions.loading import default
from watcher.applier.loading import default
from watcher.common import exception
from watcher.decision_engine.model import model_root
from watcher.decision_engine.model import resource

View File

@ -19,7 +19,7 @@
import collections
import mock
from watcher.applier.actions.loading import default
from watcher.applier.loading import default
from watcher.common import exception
from watcher.decision_engine.model import model_root
from watcher.decision_engine.model import resource