Add Glare action pack
This patch adds Glare action pack into Mistral. Change-Id: Icf4ce5a37f555d01cf9c0b865a6816e3f6801f3a Implements-blueprint: glare-action-pack
This commit is contained in:
parent
8367452608
commit
fec851381d
@ -21,6 +21,7 @@ SUPPORTED_MODULES = [
|
||||
'Nova', 'Glance', 'Keystone', 'Heat', 'Neutron', 'Cinder', 'Ceilometer',
|
||||
'Trove', 'Ironic', 'Baremetal Introspection', 'Swift', 'Zaqar', 'Barbican',
|
||||
'Mistral', 'Designate', 'Magnum', 'Murano', 'Tacker', 'Aodh', 'Gnocchi',
|
||||
'Glare'
|
||||
]
|
||||
|
||||
|
||||
|
@ -53,6 +53,7 @@ ceilometerclient = _try_import('ceilometerclient.v2.client')
|
||||
cinderclient = _try_import('cinderclient.v2.client')
|
||||
designateclient = _try_import('designateclient.v1')
|
||||
glanceclient = _try_import('glanceclient.v2.client')
|
||||
glareclient = _try_import('glareclient.v1.client')
|
||||
gnocchiclient = _try_import('gnocchiclient.v1.client')
|
||||
heatclient = _try_import('heatclient.v1.client')
|
||||
ironic_inspector_client = _try_import('ironic_inspector_client.v1')
|
||||
@ -843,3 +844,31 @@ class GnocchiAction(base.OpenStackAction):
|
||||
@classmethod
|
||||
def _get_fake_client(cls):
|
||||
return cls._get_client_class()()
|
||||
|
||||
|
||||
class GlareAction(base.OpenStackAction):
|
||||
_service_name = 'glare'
|
||||
|
||||
@classmethod
|
||||
def _get_client_class(cls):
|
||||
return glareclient.Client
|
||||
|
||||
def _create_client(self, context):
|
||||
|
||||
LOG.debug("Glare action security context: %s", context)
|
||||
|
||||
glare_endpoint = self.get_service_endpoint()
|
||||
|
||||
endpoint_url = keystone_utils.format_url(
|
||||
glare_endpoint.url,
|
||||
{'tenant_id': context.project_id}
|
||||
)
|
||||
|
||||
return self._get_client_class()(
|
||||
endpoint_url,
|
||||
**self.get_session_and_auth(context)
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def _get_fake_client(cls):
|
||||
return cls._get_client_class()("http://127.0.0.1:9494/")
|
||||
|
@ -1366,5 +1366,24 @@
|
||||
"get_event": "get_event",
|
||||
"actions": "actions",
|
||||
"get_action": "get_action"
|
||||
},
|
||||
"glare": {
|
||||
"_comment": "It uses glareclient.v1.",
|
||||
"artifacts_create": "artifacts.create",
|
||||
"artifacts_delete": "artifacts.delete",
|
||||
"artifacts_get": "artifacts.get",
|
||||
"artifacts_list": "artifacts.list",
|
||||
"artifacts_update": "artifacts.update",
|
||||
"artifacts_activate": "artifacts.activate",
|
||||
"artifacts_deactivate": "artifacts.deactivate",
|
||||
"artifacts_reactivate": "artifacts.reactivate",
|
||||
"artifacts_publish": "artifacts.publish",
|
||||
"artifacts_add_tag": "artifacts.add_tag",
|
||||
"artifacts_remove_tag": "artifacts.remove_tag",
|
||||
"artifacts_get_type_list": "artifacts.get_type_list",
|
||||
"artifacts_get_type_schema": "artifacts.get_type_schema",
|
||||
"artifacts_upload_blob": "artifacts.upload_blob",
|
||||
"artifacts_download_blob": "artifacts.download_blob",
|
||||
"artifacts_add_external_location": "artifacts.add_external_location"
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ MODULE_MAPPING = {
|
||||
'senlin': ['senlin.get_profile', actions.SenlinAction],
|
||||
'aodh': ['aodh.alarm_list', actions.AodhAction],
|
||||
'gnocchi': ['gnocchi.metric_list', actions.GnocchiAction],
|
||||
'glare': ['glare.artifacts_list', actions.GlareAction]
|
||||
}
|
||||
|
||||
EXTRA_MODULES = ['neutron', 'swift', 'zaqar', 'tacker']
|
||||
|
@ -303,3 +303,16 @@ class OpenStackActionTest(base.BaseTestCase):
|
||||
|
||||
self.assertTrue(mocked().metric.get.called)
|
||||
mocked().metric.get.assert_called_once_with(metric_id="1234-abcd")
|
||||
|
||||
@mock.patch.object(actions.GlareAction, '_get_client')
|
||||
def test_glare_action(self, mocked):
|
||||
mock_ctx = mock.Mock()
|
||||
method_name = "artifacts.get"
|
||||
action_class = actions.GlareAction
|
||||
action_class.client_method_name = method_name
|
||||
params = {'artifact_id': '1234-abcd'}
|
||||
action = action_class(**params)
|
||||
action.run(mock_ctx)
|
||||
|
||||
self.assertTrue(mocked().artifacts.get.called)
|
||||
mocked().artifacts.get.assert_called_once_with(artifact_id="1234-abcd")
|
||||
|
@ -35,6 +35,7 @@ python-ceilometerclient>=2.5.0 # Apache-2.0
|
||||
python-cinderclient>=3.0.0 # Apache-2.0
|
||||
python-designateclient>=1.5.0 # Apache-2.0
|
||||
python-glanceclient>=2.7.0 # Apache-2.0
|
||||
python-glareclient>=0.3.0 # Apache-2.0
|
||||
python-heatclient>=1.6.1 # Apache-2.0
|
||||
python-keystoneclient>=3.8.0 # Apache-2.0
|
||||
python-mistralclient>=3.1.0 # Apache-2.0
|
||||
|
@ -27,6 +27,7 @@ from cinderclient.apiclient import base as cinder_base
|
||||
from cinderclient.v2 import client as cinderclient
|
||||
from designateclient import client as designateclient
|
||||
from glanceclient.v2 import client as glanceclient
|
||||
from glareclient.v1 import client as glareclient
|
||||
from gnocchiclient.v1 import base as gnocchi_base
|
||||
from gnocchiclient.v1 import client as gnocchiclient
|
||||
from heatclient.common import base as heat_base
|
||||
@ -150,6 +151,9 @@ DESIGNATE_NAMESPACE_LIST = [
|
||||
]
|
||||
|
||||
|
||||
GLARE_NAMESPACE_LIST = ['artifacts', 'versions']
|
||||
|
||||
|
||||
def get_nova_client(**kwargs):
|
||||
return novaclient.Client(2)
|
||||
|
||||
@ -213,6 +217,10 @@ def get_gnocchi_client(**kwargs):
|
||||
return gnocchiclient.Client()
|
||||
|
||||
|
||||
def get_glare_client(**kwargs):
|
||||
return glareclient.Client('')
|
||||
|
||||
|
||||
CLIENTS = {
|
||||
'nova': get_nova_client,
|
||||
'heat': get_heat_client,
|
||||
@ -229,6 +237,7 @@ CLIENTS = {
|
||||
'murano': get_murano_client,
|
||||
'aodh': get_aodh_client,
|
||||
'gnocchi': get_gnocchi_client,
|
||||
'glare': get_glare_client,
|
||||
# 'neutron': get_nova_client
|
||||
# 'baremetal_introspection': ...
|
||||
# 'swift': ...
|
||||
@ -250,6 +259,7 @@ BASE_MANAGERS = {
|
||||
'murano': BASE_MURANO_MANAGER,
|
||||
'aodh': BASE_AODH_MANAGER,
|
||||
'gnocchi': BASE_GNOCCHI_MANAGER,
|
||||
'glare': None,
|
||||
# 'neutron': BASE_NOVA_MANAGER
|
||||
# 'baremetal_introspection': ...
|
||||
# 'swift': ...
|
||||
@ -258,7 +268,8 @@ BASE_MANAGERS = {
|
||||
NAMESPACES = {
|
||||
'glance': GLANCE_NAMESPACE_LIST,
|
||||
'ceilometer': CEILOMETER_NAMESPACE_LIST,
|
||||
'designate': DESIGNATE_NAMESPACE_LIST
|
||||
'designate': DESIGNATE_NAMESPACE_LIST,
|
||||
'glare': GLARE_NAMESPACE_LIST
|
||||
}
|
||||
ALLOWED_ATTRS = ['service_catalog', 'catalog']
|
||||
FORBIDDEN_METHODS = [
|
||||
|
Loading…
Reference in New Issue
Block a user