Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: ninuxorg/nodeshot
base: master
...
head fork: johnsmar/nodeshot
compare: dns
Checking mergeability… Don’t worry, you can still create the pull request.
  • 14 commits
  • 12 files changed
  • 0 commit comments
  • 3 contributors
View
2  .gitignore
@@ -3,6 +3,8 @@
.komodotools/
projects/ninux/ninux/settings.py
projects/ninux/ninux/settings_test.py
+projects/ninux/ninux/wsgi.py
+projects/ninux/build
*.komodoproject
*.DS_Store
projects/ninux/ninux/media/*
View
17 README
@@ -27,4 +27,21 @@ How to install:
A basic guide on how to setup nodeshot for your community is available here:
http://wiki.ninux.org/InstallNodeshot
+<<<<<<< .merge_file_R33hh4
If you have any question, please feel free to contact us at contatti@ninux.org
+=======
+To run some test just type:
+
+ sudo pip install Django django-extensions
+ git clone git://github.com/ninuxorg/nodeshot.git mapserver
+ cd mapserver
+ cp settings.example.py settings.py
+ ./manage.py syncdb && ./manage.py runserver
+
+Enjoy on http://localhost:8000 !
+
+
+If you have any question, please feel free to contact us:
+ contatti@ninux.org
+
+>>>>>>> .merge_file_nB43h3
View
16 nodeshot/contrib/dns/admin.py
@@ -58,11 +58,25 @@ class UserRecordAdmin(BaseAdmin):
(None, {'fields': ['user']}),
]
+class ZoneToDnsAdmin(admin.ModelAdmin):
+ pass
+
+class NodeToDnsAdmin(admin.ModelAdmin):
+ pass
+
+class DeviceToDnsAdmin(admin.ModelAdmin):
+ pass
+
+class InterfaceToDnsAdmin(admin.ModelAdmin):
+ pass
admin.site.register(dns.models.Domain, DomainAdmin)
admin.site.register(dns.models.Record, RecordAdmin)
admin.site.register(dns.models.DomainPolicy, DomainPolicyAdmin)
admin.site.register(dns.models.UserRecord, UserRecordAdmin)
-#admin.site.register(dns.models.DomainManager)
+admin.site.register(dns.models.ZoneToDns, ZoneToDnsAdmin)
+admin.site.register(dns.models.NodeToDns, NodeToDnsAdmin)
+admin.site.register(dns.models.DeviceToDns, DeviceToDnsAdmin)
+admin.site.register(dns.models.InterfaceToDns, InterfaceToDnsAdmin)
View
45 nodeshot/contrib/dns/choices.py
@@ -0,0 +1,45 @@
+from django.utils.translation import ugettext_lazy as _
+
+ACCESS_LEVELS = (
+ ('owner', _('owner')),
+ ('manager', _('manager'))
+)
+
+DOMAIN_TYPE = (
+ 'NATIVE',
+ 'MASTER',
+ 'SLAVE',
+ 'SUPERSLAVE'
+)
+
+RECORD_TYPE = ( #All possible dns record types
+ 'A',
+ 'AAAA',
+ 'AFSDB',
+ 'CERT',
+ 'CNAME',
+ 'DNSKEY',
+ 'DS',
+ 'HINFO',
+ 'KEY',
+ 'LOC',
+ 'MX',
+ 'NAPTR',
+ 'NS',
+ 'NSEC',
+ 'PTR',
+ 'RP',
+ 'RRSIG',
+ 'SOA',
+ 'SPF',
+ 'SSHFP',
+ 'SRV',
+ 'TXT'
+)
+
+USER_RECORD_TYPE = ( #User-allowed record types
+ 'A',
+ 'AAAA',
+ 'CNAME',
+ 'MX'
+)
View
8 nodeshot/contrib/dns/dnsscript.py
@@ -1,8 +0,0 @@
-from nodeshot.contrib import dns
-
-class dnsscript:
-
- def prova(self):
- print 'hello,world'
-
- return True
View
103 nodeshot/contrib/dns/models.py
@@ -4,54 +4,12 @@
from django.utils.translation import ugettext_lazy as _
from django.contrib.contenttypes import generic
from django.contrib.auth.models import User
+from nodeshot.contrib.dns.choices import ACCESS_LEVELS, DOMAIN_TYPE, RECORD_TYPE, USER_RECORD_TYPE
from nodeshot.core.base.models import BaseDate
+from nodeshot.core.zones.models import Zone
+from nodeshot.core.nodes.models import Node
from nodeshot.core.network.models import Device, Interface
-import hashlib
-
-ACCESS_LEVELS = (
- ('owner', _('owner')),
- ('manager', _('manager'))
-)
-
-DOMAIN_TYPE = (
- 'NATIVE',
- 'MASTER',
- 'SLAVE',
- 'SUPERSLAVE'
-)
-
-RECORD_TYPE = ( #Can be implemented into a table with USER_RECORD_TYPE
- 'A',
- 'AAAA',
- 'AFSDB',
- 'CERT',
- 'CNAME',
- 'DNSKEY',
- 'DS',
- 'HINFO',
- 'KEY',
- 'LOC',
- 'MX',
- 'NAPTR',
- 'NS',
- 'NSEC',
- 'PTR',
- 'RP',
- 'RRSIG',
- 'SOA',
- 'SPF',
- 'SSHFP',
- 'SRV',
- 'TXT'
-)
-
-USER_RECORD_TYPE = (
- 'A',
- 'AAAA',
- 'CNAME',
- 'MX'
-)
class Domain(BaseDate):
"""
@@ -100,8 +58,6 @@ def save(self, *args, **kwargs):
super(Record, self).save(*args, **kwargs)
-
-
class Supermaster(BaseDate):
"""
Supermaster PowerDNS table (deprecated)
@@ -117,30 +73,50 @@ class Meta:
def __unicode__(self):
return self.nameserver
-"""
-OneToOne tables for customize automatic DNS names
-"""
+
class ZoneToDns(models.Model):
- zone = models.OneToOneField('zones.Zone', db_index=True, unique=True)
+ """
+ Extension of zone model with zone domain name
+ """
+ zone = models.OneToOneField(Zone, db_index=True, unique=True)
value = models.SlugField(_('value'), max_length=20)
+ def __unicode__(self):
+ return self.value
+
class NodeToDns(models.Model):
- zone = models.OneToOneField('nodes.Node', db_index=True, unique=True)
+ """
+ Extension of node model with node domain name
+ """
+ node = models.OneToOneField(Node, db_index=True, unique=True)
value = models.SlugField(_('value'), max_length=20)
+ def __unicode__(self):
+ return self.value
+
class DeviceToDns(models.Model):
- zone = models.OneToOneField(Device, db_index=True, unique=True)
+ """
+ Extension of device model with device domain name
+ """
+ device = models.OneToOneField(Device, db_index=True, unique=True)
value = models.SlugField(_('value'), max_length=20)
+ def __unicode__(self):
+ return self.value
+
class InterfaceToDns(models.Model):
- zone = models.OneToOneField(Interface, db_index=True)
+ """
+ Extension of interface model with interface domain name
+ """
+ interface = models.OneToOneField(Interface, db_index=True)
value = models.SlugField(_('value'), max_length=20)
-
+ def __unicode__(self):
+ return self.value
class DomainPolicy(BaseDate):
"""
- Domains and Subdomains restrictions and policies for users
+ [Sub]Domains restrictions and policies for users
"""
name = models.CharField(max_length=255, db_index=True, unique=True)
domain = models.ForeignKey(Domain)
@@ -163,19 +139,4 @@ class DomainManager(BaseDate):
class Meta:
unique_together = ('user', 'domain')
-class UserRecord(Record):
- """
- User's Records table
- """
-
- user = models.ForeignKey(User)
-
-class DNSScriptCache(models.Model):
- """
- DNS Script Caching table
- name is the domain without the extension
- content is the IPv4/IPv6 Address
- """
- name = models.CharField(_('name'), max_length=255)
- content = models.CharField(max_length=29)
View
12 nodeshot/contrib/dns/script.py
@@ -0,0 +1,12 @@
+from re import sub
+
+def domainize(name)
+"""
+Method who convert a string in a domain compatible name
+"""
+ domainized_name = name.lower()
+ domainized_name = sub(r'[^a-z0-9]+', '_', dn).strip('_')
+
+ return domainized_name
+
+
View
0  nodeshot/contrib/dns/script/__init__.py
No changes.
View
9 nodeshot/contrib/dns/script/dnsimport.py
@@ -1,9 +0,0 @@
-class DnsImport:
-
- def domainize(self, *args, **kwargs)
- """
- Method who convert a string in a domain compatible name, just containing a-z and -
- """
- return True
-
-
View
8 nodeshot/contrib/dns/script/dnsscript.py
@@ -1,8 +0,0 @@
-from nodeshot.contrib import dns
-
-class dnsscript:
-
- def test(self):
- print 'hello,world'
-
- return True
View
16 nodeshot/contrib/dns/tests.py
@@ -1,16 +0,0 @@
-"""
-This file demonstrates writing tests using the unittest module. These will pass
-when you run "manage.py test".
-
-Replace this with more appropriate tests for your application.
-"""
-
-from django.test import TestCase
-
-
-class SimpleTest(TestCase):
- def test_basic_addition(self):
- """
- Tests that 1 + 1 always equals 2.
- """
- self.assertEqual(1 + 1, 2)
View
1  projects/ninux/ninux/wsgi.py
@@ -16,7 +16,6 @@
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
-
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ninux.settings")
# This application object is used by any WSGI server configured to use this

No commit comments for this range

Something went wrong with that request. Please try again.