Skip to content

Commit

Permalink
feat: added logging
Browse files Browse the repository at this point in the history
  • Loading branch information
1101-1 committed Dec 4, 2024
1 parent a6fe865 commit 95a6a11
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions plugins/gcp/fix_plugin_gcp/resources/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,35 @@ def add_region_to_node(self, node: GcpResourceType, source: Optional[Json] = Non
node._region = self.region_by_zone_name[zone_name]
self.add_edge(node, node=zone, reverse=True)
return
else:
log.warning(
"Zone property '%s' found in the source but no corresponding zone object is available to associate with the node.",
zone_name,
)

if InternalZoneProp in source:
if zone := self.zone_by_name.get(source[InternalZoneProp]):
node._zone = zone
node._region = self.region_by_zone_name[source[InternalZoneProp]]
self.add_edge(node, node=zone, reverse=True)
return
else:
log.warning(
"Internal zone property '%s' exists in the source but no corresponding zone object is available to associate with the node.",
source[InternalZoneProp],
)

if RegionProp in source:
region_name = source[RegionProp].rsplit("/", 1)[-1]
if region := self.region_by_name.get(region_name):
node._region = region
self.add_edge(node, node=region, reverse=True)
return
else:
log.warning(
"Region property '%s' found in the source but no corresponding region object is available to associate with the node.",
region_name,
)

# Fallback to GraphBuilder region, i.e. regional collection
if self.region is not None:
Expand Down

0 comments on commit 95a6a11

Please sign in to comment.