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 sticks.openstack.common._i18n import _ # noqa
|
||||
from sticks.openstack.common.gettextutils import _ # noqa
|
||||
|
||||
keystone_opts = [
|
||||
cfg.StrOpt('auth_strategy', default='keystone',
|
||||
|
@ -31,6 +31,9 @@ class TicketResource(base.Base):
|
||||
id = wtypes.text
|
||||
"""Id of the ticket."""
|
||||
|
||||
description = wtypes.text
|
||||
"""Description of the ticket."""
|
||||
|
||||
project = wtypes.text
|
||||
"""Associated project of the ticket."""
|
||||
|
||||
@ -40,9 +43,12 @@ class TicketResource(base.Base):
|
||||
status = wtypes.text
|
||||
"""Status."""
|
||||
|
||||
category = wtypes.text
|
||||
"""Category ."""
|
||||
|
||||
def as_dict(self):
|
||||
return self.as_dict_from_keys(['title', 'id', 'project', 'start_date',
|
||||
'status'])
|
||||
'status', 'description', 'category'])
|
||||
|
||||
@classmethod
|
||||
def sample(cls):
|
||||
|
@ -23,7 +23,7 @@ from oslo.config import cfg
|
||||
from oslo import messaging
|
||||
|
||||
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
|
||||
|
||||
|
||||
@ -118,14 +118,19 @@ class TrackingBase(object):
|
||||
return [messaging.Target(topic=topic)
|
||||
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,
|
||||
metadata):
|
||||
""" Process events"""
|
||||
# Default action : create project
|
||||
if event_type == self._ROLE_ASSIGNMENT_CREATED:
|
||||
if self.kc is None:
|
||||
self.kc = keystone_client.Client()
|
||||
project = self.kc.project_get(payload['project'])
|
||||
project = self.get_project(payload['project'])
|
||||
if self._has_sticks_role(payload['user'],
|
||||
payload['role'],
|
||||
payload['project']):
|
||||
|
Loading…
x
Reference in New Issue
Block a user