Skip to content

Commit

Permalink
Check for empty contextUUID
Browse files Browse the repository at this point in the history
  • Loading branch information
Merteg committed Sep 12, 2024
1 parent 908c24b commit f7360c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions Products/Zing/datamaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,23 +155,22 @@ def _generate_facts(self, facts_per_device, zing_tx_state):
device_organizers_fact = ZFact.organizer_fact_from_device(device)

for (f, ctx) in facts:

# Return datamap fact
comp_uuid = f.metadata.get(
ZFact.DimensionKeys.CONTEXT_UUID_KEY, ""
)
zing_tx_state.already_generated_device_info_facts.add(
comp_uuid
)
yield f
if f.is_valid():
yield f
if ctx is None:
for component in device.getDeviceComponents():
if component.getUUID() == comp_uuid:
ctx = ObjectMapContext(component)
break
comp_groups = []
if ctx is not None and ctx.is_device_component:

# organizers and impact relationships facts for the component
comp_groups = ctx._obj.getComponentGroupNames()
# organizers fact for the component
Expand Down
3 changes: 2 additions & 1 deletion Products/Zing/fact.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ def update(self, other):
self.data.update(other)

def is_valid(self):
return self.metadata.get(DimensionKeys.CONTEXT_UUID_KEY) is not None
uuid = self.metadata.get(DimensionKeys.CONTEXT_UUID_KEY)
return uuid is not None and uuid is not ""

def set_context_uuid_from_object(self, obj):
self.metadata[DimensionKeys.CONTEXT_UUID_KEY] = get_context_uuid(obj)
Expand Down

0 comments on commit f7360c0

Please sign in to comment.