diff --git a/etc/reddwarf/reddwarf.conf.sample b/etc/reddwarf/reddwarf.conf.sample index cdc30086d7..234965103f 100644 --- a/etc/reddwarf/reddwarf.conf.sample +++ b/etc/reddwarf/reddwarf.conf.sample @@ -51,6 +51,16 @@ mount_point = /var/lib/mysql # Reddwarf DNS reddwarf_dns_support = False +#dns_driver=reddwarf.dns.rsdns.driver.RsDnsDriver +#dns_instance_entry_factory=reddwarf.dns.rsdns.driver.RsDnsInstanceEntryFactory +#dns_account_id=0 +#dns_domain_id=0 +#dns_username=username +#dns_passkey=passkey +#dns_domain_name=test.domain-test.com +#dns_management_base_url= +#dns_auth_url= +#dns_ttl=300 # ============ notifer queue kombu connection options ======================== diff --git a/reddwarf/db/sqlalchemy/mappers.py b/reddwarf/db/sqlalchemy/mappers.py index 62ba76e4a3..215f7222f0 100644 --- a/reddwarf/db/sqlalchemy/mappers.py +++ b/reddwarf/db/sqlalchemy/mappers.py @@ -34,8 +34,8 @@ def map(engine, models): Table('service_images', meta, autoload=True)) orm.mapper(models['service_statuses'], Table('service_statuses', meta, autoload=True)) - orm.mapper(models['rsdns_records'], - Table('rsdns_records', meta, autoload=True)) + orm.mapper(models['dns_records'], + Table('dns_records', meta, autoload=True)) def mapping_exists(model): diff --git a/reddwarf/db/sqlalchemy/migrate_repo/versions/005_rsdns_records.py b/reddwarf/db/sqlalchemy/migrate_repo/versions/006_dns_records.py similarity index 92% rename from reddwarf/db/sqlalchemy/migrate_repo/versions/005_rsdns_records.py rename to reddwarf/db/sqlalchemy/migrate_repo/versions/006_dns_records.py index 959425c4b2..e022dd589a 100644 --- a/reddwarf/db/sqlalchemy/migrate_repo/versions/005_rsdns_records.py +++ b/reddwarf/db/sqlalchemy/migrate_repo/versions/006_dns_records.py @@ -29,16 +29,16 @@ from reddwarf.db.sqlalchemy.migrate_repo.schema import String meta = MetaData() -rsdns_records = Table('rsdns_records', meta, +dns_records = Table('dns_records', meta, Column('name', String(length=255), primary_key=True), Column('record_id', String(length=64))) def upgrade(migrate_engine): meta.bind = migrate_engine - create_tables([rsdns_records]) + create_tables([dns_records]) def downgrade(migrate_engine): meta.bind = migrate_engine - drop_tables([rsdns_records]) + drop_tables([dns_records]) diff --git a/reddwarf/db/sqlalchemy/session.py b/reddwarf/db/sqlalchemy/session.py index a2f850d48d..9b560edeff 100644 --- a/reddwarf/db/sqlalchemy/session.py +++ b/reddwarf/db/sqlalchemy/session.py @@ -40,7 +40,7 @@ def configure_db(options, models_mapper=None): models_mapper.map(_ENGINE) else: from reddwarf.instance import models as base_models - from reddwarf.dns.rsdns import models as dns_models + from reddwarf.dns import models as dns_models from reddwarf.extensions.mysql import models as mysql_models model_modules = [ diff --git a/reddwarf/dns/manager.py b/reddwarf/dns/manager.py index 2fb7138ca7..a7ee42fde1 100644 --- a/reddwarf/dns/manager.py +++ b/reddwarf/dns/manager.py @@ -22,7 +22,6 @@ import logging from reddwarf.common import utils from reddwarf.common import config -from reddwarf.dns.rsdns.driver import RsDnsInstanceEntryFactory LOG = logging.getLogger(__name__) diff --git a/reddwarf/dns/rsdns/models.py b/reddwarf/dns/models.py similarity index 95% rename from reddwarf/dns/rsdns/models.py rename to reddwarf/dns/models.py index 60e9dd4573..27ea887481 100644 --- a/reddwarf/dns/rsdns/models.py +++ b/reddwarf/dns/models.py @@ -31,14 +31,14 @@ LOG = logging.getLogger(__name__) def persisted_models(): return { - 'rsdns_records': RsDnsRecord, + 'dns_records': DnsRecord, } -class RsDnsRecord(ModelBase): +class DnsRecord(ModelBase): _data_fields = ['name', 'record_id'] - _table_name = 'rsdns_records' + _table_name = 'dns_records' def __init__(self, name, record_id): self.name = name diff --git a/reddwarf/dns/rsdns/driver.py b/reddwarf/dns/rsdns/driver.py index a6114cbac6..0e7ea35b3a 100644 --- a/reddwarf/dns/rsdns/driver.py +++ b/reddwarf/dns/rsdns/driver.py @@ -19,13 +19,15 @@ Dns Driver that uses Rackspace DNSaaS. """ +__version__ = '2.4' + import hashlib import logging from reddwarf.common import config from reddwarf.common import exception from reddwarf.common.exception import NotFound -from reddwarf.dns.rsdns.models import RsDnsRecord +from reddwarf.dns.models import DnsRecord from rsdns.client import DNSaas from rsdns.client.future import RsDnsError @@ -127,16 +129,17 @@ class RsDnsDriver(object): try: #poll_until(lambda : future.ready, sleep_time=2, # time_out=60*2) - while(future.ready is None): + while(future.ready is False): import time time.sleep(2) + LOG.info("Waiting for the dns record_id.. ") if len(future.resource) < 1: raise RsDnsError("No DNS records were created.") elif len(future.resource) > 1: LOG.error("More than one DNS record created. Ignoring.") actual_record = future.resource[0] - RsDnsRecord.create(name=name, record_id=actual_record.id) + DnsRecord.create(name=name, record_id=actual_record.id) LOG.debug("Added RS DNS entry.") except RsDnsError as rde: LOG.error("An error occurred creating DNS entry!") @@ -148,9 +151,9 @@ class RsDnsDriver(object): def delete_entry(self, name, type, dns_zone=None): dns_zone = dns_zone or self.default_dns_zone long_name = name - db_record = RsDnsRecord.find_by(name=name) + db_record = DnsRecord.find_by(name=name) record = self.dns_client.records.get(domain_id=dns_zone.id, - record_id=db_record.id) + record_id=db_record.record_id) if record.name != name or record.type != 'A': LOG.error("Tried to delete DNS record with name=%s, id=%s, but the" " database returned a DNS record with the name %s and "