Skip to content

Commit 206a627

Browse files
authored
Merge pull request #1690 from grycap/dydns
Do not add already added dns entries
2 parents a9c865a + e98caeb commit 206a627

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

IM/connectors/CloudConnector.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -744,13 +744,13 @@ def manage_dns_entries(self, op, vm, auth_data, extra_args=None):
744744
for entry in dns_entries:
745745
hostname, domain, ip = entry
746746
try:
747-
if op == "add":
747+
if op == "add" and entry not in vm.dns_entries:
748748
success = self.add_dns_entry(hostname, domain, ip, auth_data, extra_args)
749-
if success and entry not in vm.dns_entries:
749+
if success:
750750
vm.dns_entries.append(entry)
751751
elif op == "del":
752-
self.del_dns_entry(hostname, domain, ip, auth_data, extra_args)
753-
if entry in vm.dns_entries:
752+
success = self.del_dns_entry(hostname, domain, ip, auth_data, extra_args)
753+
if success and entry in vm.dns_entries:
754754
vm.dns_entries.remove(entry)
755755
else:
756756
raise Exception("Invalid DNS operation.")
@@ -759,9 +759,9 @@ def manage_dns_entries(self, op, vm, auth_data, extra_args=None):
759759
im_auth = auth_data.getAuthInfo("InfrastructureManager")
760760
if im_auth and im_auth[0].get("token") or (hostname.startswith("dydns:") and "@" in hostname):
761761
from IM.connectors.EGI import EGICloudConnector
762-
if op == "add":
762+
if op == "add" and entry not in vm.dns_entries:
763763
success = EGICloudConnector.add_dns_entry(self, hostname, domain, ip, auth_data)
764-
if success and entry not in vm.dns_entries:
764+
if success:
765765
vm.dns_entries.append(entry)
766766
elif op == "del":
767767
success = EGICloudConnector.del_dns_entry(self, hostname, domain, ip, auth_data)

0 commit comments

Comments
 (0)