Add zaqarclient to TripleOAction

In order to allow sending messages to zaqar queue we need to
provide Zaqar client in TripleOAction.

Change-Id: I2378e3626a415fd0cdf085735a4ed890e6aa61f4
This commit is contained in:
Lukas Bezdicka 2017-10-30 16:23:55 +01:00 committed by Dougal Matthews
parent a8caa24f1b
commit e862155531
2 changed files with 19 additions and 0 deletions

View File

@ -24,3 +24,4 @@ passlib>=1.7.0 # BSD
netifaces>=0.10.4 # MIT
paramiko>=2.0.0 # LGPLv2.1+
netaddr>=0.7.18 # BSD
python-zaqarclient>=1.0.0 # Apache-2.0

View File

@ -24,6 +24,7 @@ from mistralclient.api import client as mistral_client
from novaclient.client import Client as nova_client
from swiftclient import client as swift_client
from swiftclient import exceptions as swiftexceptions
from zaqarclient.queues.v2 import client as zaqarclient
from tripleo_common import constants
from tripleo_common.utils import keystone as keystone_utils
@ -105,6 +106,23 @@ class TripleOAction(actions.Action):
username=context.user_name
)
def get_messaging_client(self, context):
zaqar_endpoint = keystone_utils.get_endpoint_for_project(
context, service_type='messaging')
keystone_endpoint = keystone_utils.get_endpoint_for_project(
context, 'keystone')
opts = {
'os_auth_token': context.auth_token,
'os_auth_url': keystone_endpoint.url,
'os_project_id': context.project_id,
'insecure': context.insecure,
}
auth_opts = {'backend': 'keystone', 'options': opts}
conf = {'auth_opts': auth_opts}
return zaqarclient.Client(zaqar_endpoint.url, conf=conf)
def get_workflow_client(self, context):
mistral_endpoint = keystone_utils.get_endpoint_for_project(
context, 'mistral')