Add attributes to handle sticks-mantis fields
Change-Id: Ia7cdf6c43c173dc1fef6ae20d12aa56fbf3c8e91
This commit is contained in:
parent
96258f2faa
commit
836c035096
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from sticks.openstack.common._i18n import _ # noqa
|
from sticks.openstack.common.gettextutils import _ # noqa
|
||||||
|
|
||||||
keystone_opts = [
|
keystone_opts = [
|
||||||
cfg.StrOpt('auth_strategy', default='keystone',
|
cfg.StrOpt('auth_strategy', default='keystone',
|
||||||
|
@ -31,6 +31,9 @@ class TicketResource(base.Base):
|
|||||||
id = wtypes.text
|
id = wtypes.text
|
||||||
"""Id of the ticket."""
|
"""Id of the ticket."""
|
||||||
|
|
||||||
|
description = wtypes.text
|
||||||
|
"""Description of the ticket."""
|
||||||
|
|
||||||
project = wtypes.text
|
project = wtypes.text
|
||||||
"""Associated project of the ticket."""
|
"""Associated project of the ticket."""
|
||||||
|
|
||||||
@ -40,9 +43,12 @@ class TicketResource(base.Base):
|
|||||||
status = wtypes.text
|
status = wtypes.text
|
||||||
"""Status."""
|
"""Status."""
|
||||||
|
|
||||||
|
category = wtypes.text
|
||||||
|
"""Category ."""
|
||||||
|
|
||||||
def as_dict(self):
|
def as_dict(self):
|
||||||
return self.as_dict_from_keys(['title', 'id', 'project', 'start_date',
|
return self.as_dict_from_keys(['title', 'id', 'project', 'start_date',
|
||||||
'status'])
|
'status', 'description', 'category'])
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def sample(cls):
|
def sample(cls):
|
||||||
|
@ -23,7 +23,7 @@ from oslo.config import cfg
|
|||||||
from oslo import messaging
|
from oslo import messaging
|
||||||
|
|
||||||
from sticks.client import keystone_client
|
from sticks.client import keystone_client
|
||||||
from sticks.openstack.common._i18n import _ # noqa
|
from sticks.openstack.common.gettextutils import _ # noqa
|
||||||
from sticks.openstack.common import log
|
from sticks.openstack.common import log
|
||||||
|
|
||||||
|
|
||||||
@ -118,14 +118,19 @@ class TrackingBase(object):
|
|||||||
return [messaging.Target(topic=topic)
|
return [messaging.Target(topic=topic)
|
||||||
for topic in cfg.CONF.notification_topics]
|
for topic in cfg.CONF.notification_topics]
|
||||||
|
|
||||||
|
def get_project(self, project_id):
|
||||||
|
|
||||||
|
if self.kc is None:
|
||||||
|
self.kc = keystone_client.Client()
|
||||||
|
|
||||||
|
return self.kc.project_get(project_id)
|
||||||
|
|
||||||
def process_notification(self, ctxt, publisher_id, event_type, payload,
|
def process_notification(self, ctxt, publisher_id, event_type, payload,
|
||||||
metadata):
|
metadata):
|
||||||
""" Process events"""
|
""" Process events"""
|
||||||
# Default action : create project
|
# Default action : create project
|
||||||
if event_type == self._ROLE_ASSIGNMENT_CREATED:
|
if event_type == self._ROLE_ASSIGNMENT_CREATED:
|
||||||
if self.kc is None:
|
project = self.get_project(payload['project'])
|
||||||
self.kc = keystone_client.Client()
|
|
||||||
project = self.kc.project_get(payload['project'])
|
|
||||||
if self._has_sticks_role(payload['user'],
|
if self._has_sticks_role(payload['user'],
|
||||||
payload['role'],
|
payload['role'],
|
||||||
payload['project']):
|
payload['project']):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user