Skip to content
Browse files

- Fix.

unattis
  • Loading branch information...
1 parent 9134563 commit 865b3fbaf454671227b424e032a4594e1ae6caaa @udlei udlei committed Jul 31, 2011
Showing with 138 additions and 4 deletions.
  1. +1 −1 bin/mdnscli
  2. +5 −2 bin/mdnsd
  3. +131 −0 libs/pyManDNS_Tables.py
  4. +1 −1 libs/pyManDNS_Zones.py
View
2 bin/mdnscli
@@ -5,7 +5,7 @@ import xmlrpclib
import socket
import sys
import os
-sys.path.append(os.path.dirname(__file__) + '/../libs')
+sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/../libs')
from pyManDNS_Cli import *
parser = argparse.ArgumentParser()
View
7 bin/mdnsd
@@ -3,7 +3,7 @@
#
import sys
import os
-sys.path.append(os.path.dirname(__file__) + '/../libs')
+sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/../libs')
import ConfigParser
import re
from sqlalchemy import create_engine, Table, Column, Integer, String, MetaData, ForeignKey
@@ -15,7 +15,7 @@ from pyManDNS_ToAPI import pyManDNS_ToAPI
# Parse config file
config = ConfigParser.ConfigParser()
-config.read(os.path.dirname(__file__) + '/../etc/pyManDNS.cfg');
+config.read(os.path.dirname(os.path.realpath(__file__)) + '/../etc/pyManDNS.cfg');
# Database connection
db_engine = config.get('Database','db.engine')
@@ -63,5 +63,8 @@ server_port = config.get('Server','server.port')
server = SimpleXMLRPCServer((server_host, int(server_port)), allow_none=True)
server.register_instance(pyToAPI, True)
+
+print 'Server started'
+
server.serve_forever()
View
131 libs/pyManDNS_Tables.py
@@ -80,3 +80,134 @@ def queue_table(self):
def create(self):
self.metadata.create_all(self.engine)
+
+ # Verifica se existe informacao de SOA
+ soa_table = self.soa_table()
+ soa_result = self.engine.execute(soa_table.select())
+ soa_row = soa_result.first()
+
+ if not soa_row:
+
+ self.engine.execute(soa_table.insert().values(
+ soa_ttl='14400',
+ soa_refresh='10800',
+ soa_retry='3600',
+ soa_expire='604800',
+ soa_minimum='38400'
+ ))
+
+ # Verifica se existe registro padrao
+ records_default_table = self.records_default_table()
+ records_default_result = self.engine.execute(records_default_table.select())
+ record_default_row = records_default_result.first()
+
+ if not record_default_row:
+
+ self.engine.execute(records_default_table.insert().values(
+ record_default_type='NS',
+ record_default_name='',
+ record_default_value='ns1.DOMAIN'
+ ))
+
+ self.engine.execute(records_default_table.insert().values(
+ record_default_type='NS',
+ record_default_name='',
+ record_default_value='ns2.DOMAIN'
+ ))
+
+ self.engine.execute(records_default_table.insert().values(
+ record_default_type='A',
+ record_default_name='ns1',
+ record_default_value='192.168.1.1'
+ ))
+
+ self.engine.execute(records_default_table.insert().values(
+ record_default_type='A',
+ record_default_name='ns2',
+ record_default_value='192.168.1.2'
+ ))
+
+ self.engine.execute(records_default_table.insert().values(
+ record_default_type='A',
+ record_default_name='',
+ record_default_value='127.0.0.1'
+ ))
+
+ self.engine.execute(records_default_table.insert().values(
+ record_default_type='CNAME',
+ record_default_name='www',
+ record_default_value='DOMAIN'
+ ))
+
+ self.engine.execute(records_default_table.insert().values(
+ record_default_type='CNAME',
+ record_default_name='mail',
+ record_default_value='ghs.google.com'
+ ))
+
+ self.engine.execute(records_default_table.insert().values(
+ record_default_type='CNAME',
+ record_default_name='docs',
+ record_default_value='ghs.google.com'
+ ))
+
+ self.engine.execute(records_default_table.insert().values(
+ record_default_type='CNAME',
+ record_default_name='calendar',
+ record_default_value='ghs.google.com'
+ ))
+
+ self.engine.execute(records_default_table.insert().values(
+ record_default_type='TXT',
+ record_default_name='',
+ record_default_value='v=spf1 a mx include:aspmx.googlemail.com ~all'
+ ))
+
+ self.engine.execute(records_default_table.insert().values(
+ record_default_type='MX',
+ record_default_name='',
+ record_default_value='aspmx.l.google.com',
+ record_default_priority='10'
+ ))
+
+ self.engine.execute(records_default_table.insert().values(
+ record_default_type='MX',
+ record_default_name='',
+ record_default_value='alt1.aspmx.l.google.com',
+ record_default_priority='20'
+ ))
+
+ self.engine.execute(records_default_table.insert().values(
+ record_default_type='MX',
+ record_default_name='',
+ record_default_value='alt2.aspmx.l.google.com',
+ record_default_priority='20'
+ ))
+
+ self.engine.execute(records_default_table.insert().values(
+ record_default_type='MX',
+ record_default_name='',
+ record_default_value='aspmx2.googlemail.com',
+ record_default_priority='30'
+ ))
+
+ self.engine.execute(records_default_table.insert().values(
+ record_default_type='MX',
+ record_default_name='',
+ record_default_value='aspmx3.googlemail.com',
+ record_default_priority='30'
+ ))
+
+ self.engine.execute(records_default_table.insert().values(
+ record_default_type='MX',
+ record_default_name='',
+ record_default_value='aspmx4.googlemail.com',
+ record_default_priority='30'
+ ))
+
+ self.engine.execute(records_default_table.insert().values(
+ record_default_type='MX',
+ record_default_name='',
+ record_default_value='aspmx5.googlemail.com',
+ record_default_priority='30'
+ ))
View
2 libs/pyManDNS_Zones.py
@@ -22,7 +22,7 @@ def create_db_file(self,v_domain):
# Recupera dados do SOA
soa_table = self.pyTables.soa_table()
soa_result = self.engine.execute(soa_table.select())
- soa_row = soa_result.first();
+ soa_row = soa_result.first()
zone_type_NS = ""
zone_type_MX = ""

0 comments on commit 865b3fb

Please sign in to comment.
Something went wrong with that request. Please try again.