mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-24 16:03:47 +00:00
Support des enregistrements AAAA sur le @ de la zone
This commit is contained in:
parent
37870265f4
commit
4143558604
5 changed files with 40 additions and 5 deletions
|
@ -266,13 +266,14 @@ class ExtensionForm(ModelForm):
|
||||||
"""Formulaire d'ajout et edition d'une extension"""
|
"""Formulaire d'ajout et edition d'une extension"""
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Extension
|
model = Extension
|
||||||
fields = ['name', 'need_infra', 'origin']
|
fields = '__all__'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(ExtensionForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(ExtensionForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['name'].label = 'Extension à ajouter'
|
self.fields['name'].label = 'Extension à ajouter'
|
||||||
self.fields['origin'].label = 'Enregistrement A origin'
|
self.fields['origin'].label = 'Enregistrement A origin'
|
||||||
|
self.fields['origin_v6'].label = 'Enregistrement AAAA origin'
|
||||||
|
|
||||||
|
|
||||||
class DelExtensionForm(Form):
|
class DelExtensionForm(Form):
|
||||||
|
|
20
machines/migrations/0062_extension_origin_v6.py
Normal file
20
machines/migrations/0062_extension_origin_v6.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.10.7 on 2017-10-18 14:08
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('machines', '0061_auto_20171015_2033'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='extension',
|
||||||
|
name='origin_v6',
|
||||||
|
field=models.GenericIPAddressField(blank=True, null=True, protocol='IPv6'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -247,11 +247,23 @@ class Extension(models.Model):
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True
|
null=True
|
||||||
)
|
)
|
||||||
|
origin_v6 = models.GenericIPAddressField(
|
||||||
|
protocol='IPv6',
|
||||||
|
null=True,
|
||||||
|
blank=True
|
||||||
|
)
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def dns_entry(self):
|
def dns_entry(self):
|
||||||
""" Une entrée DNS A"""
|
""" Une entrée DNS A et AAAA sur origin (zone self)"""
|
||||||
return "@ IN A " + str(self.origin)
|
entry = ""
|
||||||
|
if self.origin:
|
||||||
|
entry += "@ IN A " + str(self.origin)
|
||||||
|
if self.origin_v6:
|
||||||
|
if entry:
|
||||||
|
entry += "\n"
|
||||||
|
entry += "@ IN AAAA " + str(self.origin_v6)
|
||||||
|
return entry
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
|
@ -161,7 +161,7 @@ class ExtensionSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Extension
|
model = Extension
|
||||||
fields = ('name', 'origin', 'zone_entry')
|
fields = ('name', 'origin', 'origin_v6', 'zone_entry')
|
||||||
|
|
||||||
def get_origin_ip(self, obj):
|
def get_origin_ip(self, obj):
|
||||||
return obj.origin.ipv4
|
return obj.origin.ipv4
|
||||||
|
|
|
@ -28,7 +28,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<th>Extension</th>
|
<th>Extension</th>
|
||||||
<th>Autorisation infra pour utiliser l'extension</th>
|
<th>Autorisation infra pour utiliser l'extension</th>
|
||||||
<th>Enregistrement A origin</th>
|
<th>Enregistrement A origin</th>
|
||||||
<th></th>
|
<th>Enregistrement AAAA origin</th>
|
||||||
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for extension in extension_list %}
|
{% for extension in extension_list %}
|
||||||
|
@ -36,6 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<td>{{ extension.name }}</td>
|
<td>{{ extension.name }}</td>
|
||||||
<td>{{ extension.need_infra }}</td>
|
<td>{{ extension.need_infra }}</td>
|
||||||
<td>{{ extension.origin }}</td>
|
<td>{{ extension.origin }}</td>
|
||||||
|
<td>{{ extension.origin_v6 }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{% if is_infra %}
|
{% if is_infra %}
|
||||||
{% include 'buttons/edit.html' with href='machines:edit-extension' id=extension.id %}
|
{% include 'buttons/edit.html' with href='machines:edit-extension' id=extension.id %}
|
||||||
|
|
Loading…
Reference in a new issue