Commit cba7c34e by Őry Máté

firewall: fix handling of MX and multiple A records

parent 969bd40c
......@@ -296,7 +296,7 @@ class Record(models.Model):
raise ValidationError(_("Unknown record type."))
def __get_name(self):
if self.host:
if self.host and self.type != 'MX':
if self.type in ['A', 'AAAA']:
return self.host.get_fqdn()
elif self.type == 'CNAME':
......
......@@ -420,11 +420,10 @@ class Instance(models.Model):
else:
if self.template.network.nat:
ip = self.firewall_host.pub_ipv4
return Record.objects.get(type='A', address=ip).get_data()['name']
return Record.objects.filter(type='A', address=ip)[0].get_data()['name']
else:
return self.firewall_host.record_set.filter(type='A')[0].get_data()['name']
except:
raise
if self.template.network.nat:
return self.firewall_host.pub_ipv4
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment