Skip to content

Commit 4fbdcdc

Browse files
authored
Merge pull request #118 from lhhyung/master
Add null check for backend_ip_configuration in load balancer inbound NAT rules
2 parents 6bf3fe7 + a26dc0e commit 4fbdcdc

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/plugin/manager/load_balancers/instance_manager.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,15 @@ def create_cloud_service(self, options, secret_data, schema):
193193
)
194194

195195
for inr in load_balancer_dict["inbound_nat_rules"]:
196+
backend_ip_config = inr.get("backend_ip_configuration")
197+
target_vm = None
198+
199+
if backend_ip_config and backend_ip_config.get("id"):
200+
target_vm = self.get_matched_vm_info(
201+
backend_ip_config["id"],
202+
load_balancer_dict["network_interfaces"],
203+
)
204+
196205
inr.update(
197206
{
198207
"frontend_ip_configuration_display": self.get_frontend_ip_configuration_display(
@@ -201,10 +210,7 @@ def create_cloud_service(self, options, secret_data, schema):
201210
"port_mapping_display": self.get_port_mapping_display(
202211
inr["frontend_port"], inr["backend_port"]
203212
),
204-
"target_virtual_machine": self.get_matched_vm_info(
205-
inr["backend_ip_configuration"]["id"],
206-
load_balancer_dict["network_interfaces"],
207-
),
213+
"target_virtual_machine": target_vm,
208214
}
209215
)
210216

0 commit comments

Comments
 (0)