guard against bugs
diff --git a/xos/synchronizers/vpn/steps/sync_vpntenant.py b/xos/synchronizers/vpn/steps/sync_vpntenant.py
index 01385b3..af12f63 100644
--- a/xos/synchronizers/vpn/steps/sync_vpntenant.py
+++ b/xos/synchronizers/vpn/steps/sync_vpntenant.py
@@ -26,7 +26,7 @@
if (not os.path.isdir(tenant.pki_dir)):
VPNService.execute_easyrsa_command(
tenant.pki_dir, "init-pki")
- if (tenant.use_ca_from[0]):
+ if (len(tenant.use_ca_form) > 0 and tenant.use_ca_from[0]):
shutil.copy2(
tenant.use_ca_from[0].pki_dir + "/ca.crt",
tenant.pki_dir)
@@ -36,7 +36,7 @@
else:
VPNService.execute_easyrsa_command(
tenant.pki_dir, "--req-cn=XOS build-ca nopass")
- elif (tenant.use_ca_from[0]):
+ elif (len(tenant.use_ca_form) > 0 and tenant.use_ca_from[0]):
shutil.copy2(
tenant.use_ca_from[0].pki_dir + "/ca.crt",
tenant.pki_dir)