dont add vitrage_resource_project_id if None

Depends-On: Idb2ce0aef7a051ce2d2bd60a6c5ec5628e5a009b
Change-Id: Id8f1d77802c0071df778f4a9b7fb0a25c473cf9c
This commit is contained in:
Anna Reznikov 2018-08-13 09:27:33 +00:00
parent 72d018cc7d
commit 2531c72a3f
3 changed files with 4 additions and 3 deletions

View File

@ -43,6 +43,7 @@ notification_driver = messagingv2
verbose = true
debug = false
notifiers = nova,webhook
rpc_response_timeout=300
[datasources]
types=doctor,mock_graph_datasource

View File

@ -343,7 +343,6 @@ class Processor(processor.ProcessorBase):
for alarm in alarms:
if not resource:
self.add_resource_details(alarm, None, None, None)
continue
project_id = resource.get(VProps.PROJECT_ID)
@ -361,7 +360,8 @@ class Processor(processor.ProcessorBase):
def add_resource_details(alarm, r_id, r_type, r_project_id):
alarm[VProps.VITRAGE_RESOURCE_ID] = r_id
alarm[VProps.VITRAGE_RESOURCE_TYPE] = r_type
alarm[VProps.VITRAGE_RESOURCE_PROJECT_ID] = r_project_id
if r_project_id:
alarm[VProps.VITRAGE_RESOURCE_PROJECT_ID] = r_project_id
@staticmethod
def _set_datasource_name(entity, event):

View File

@ -137,7 +137,7 @@ class EvaluatorEventTransformer(transformer_base.TransformerBase):
VProps.VITRAGE_SAMPLE_TIMESTAMP:
event[VProps.VITRAGE_SAMPLE_TIMESTAMP],
VProps.IS_REAL_VITRAGE_ID: True,
VProps.VITRAGE_TYPE: event[VProps.VITRAGE_RESOURCE_TYPE],
VProps.VITRAGE_TYPE: event.get(VProps.VITRAGE_RESOURCE_TYPE),
VProps.VITRAGE_CATEGORY: EntityCategory.RESOURCE,
}
neighbor = Vertex(event[TFields.TARGET], neighbor_props)