Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,6 @@ ENV/

# Rope project settings
.ropeproject

# Pycharm project settings
.idea
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@ addons:
env:
global:
- VERSION="9.0" TESTS="0" LINT_CHECK="0"
- TRANSIFEX_USER='transbot@odoo-community.org'
- secure: "P8zdckjpfLcTbz/kq8FNOgVMHjFNESk0H5/lHQQinBg7nr3oiWIg1tStroOJQtIn26+qWT2GZUX8V90FNCH6aGvqH8oIGguhZGibFHINarho2LjQd5DhhyIgm0qF12H31hFLOQokmlyx9r3A8Sw6EWPtWQ/vFBsL97ErhMK7AyX9vhDZCvpLX/zQyGpSXGNbogpmlhrV4z1RBBE9AtvPienTqkdz86a5wFOSjXM8Is5QVWZfKyFIxytiIxDERt+AS71FNXdrh73qRNbMIkULO+ROcdgGcMXdigiSZmny3n/kkty3I7lZO6K6bXLPugfii4Y2EiyJm+Mod99p9AAPAdifKbXF+ZJDWqkVbeooCBt93V1juQwsn1RT1Yms3U6F2lrw9oMm1M27ht+DSfcKMhBdtvDMN4tzU1zwxUx9kZ+oPmSDqSvPECIlUpHOvn4IUBEEuO1fHzooSX9scMFKJAx4Q7wsuPyUySFUy0J22AlbJcKcZOqtVw3++9WH1foxSWxMHjL/UjLSAn1B03xJAj3hALHMj61+R1HA/9v1/UCigwxkpbsMrWJK6SkXqBUcd5ECiHEScwNXr0nKLEydZOqorofPk4BjroGGyTd2h1iqa1suZ2zb3QJXcPvlsxzO/hvLm+wdzMyeJTe4I78kOkfGlmzSWJgoEq2ngad1rng="

matrix:
- LINT_CHECK="1"
- TRANSIFEX="1"
- TESTS="1" ODOO_REPO="odoo/odoo"
- TESTS="1" ODOO_REPO="OCA/OCB"

Expand Down
105 changes: 105 additions & 0 deletions connector_dns/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

=============
Connector DNS
=============

This module aims to create a framework for DNS management through the
odoo-connector in order to be able to manage your DNS records in Odoo and be
able to connect to external service providers via API and the odoo-connector
job-queue.

This module only introduces the main data model and can be used as is to
manually store DNS records. It provides the objects or basic mapping to
create API connection but does not provide any connector per se.

Additional modules for specific connectors need to be added to manage the
service provider connection.

With specific DNS provider module, the DNS connector supports:

* Import the domains and records from your DNS provider into Odoo
* DNS domain creation / deletion (TBD) / update and synchronization to your
DNS provider
* Records creation / deletion (TBD) / update and synchronization to your
DNS provider

Installation
============

To install this module, you need to install the odoo-connector module.

Configuration
=============

To configure this module, you need to:

#. Install a specific module such as connector_dns_dnspod
#. Create and set up the authentication for the DNS service provider in
Connectors/DNS/backends

Usage
=====

To use this module, you need to:

#. Create your domains, select the DNS provider and confirm them in
Connectors/DNS/Domains
#. Once the domains are created, you can create the records accordingly
in Connectors/DNS/records
#. Every time you create, delete or update a new record, a job will be
created in Connectors/Queue/Jobs
#. if a job fails, you can check the error and retry the job if necessary.

You might want to check the official documentation of the
`Odoo Connector <http://odoo-connector.com/index.html>`_ to build your own
DNS provider connector.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/224/8.0

Known issues / Roadmap
======================

* Add validations for record types: ``SPF``, ``NAPTR``
* Add a delete synchronizer
* Add tests for each of the ``dns.record.type`` validation regexes
* Add missing tests for ``export_synchronizer`` & ``import_synchronizer``

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/infrastructure-dns/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.

Credits
=======

Contributors
------------

* Dave Lasley <dave@laslabs.com>
* Eric Caudal <eric.caudal@elico-corp.com>
* Noah Wang <noah.wang@elico-corp.com>
* Liu Lixia <contact@elico-corp.com>
* Augustin Cisterne-Kaas <contact@elico-corp.com>

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit https://odoo-community.org.
9 changes: 9 additions & 0 deletions connector_dns/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Elico Corp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import backend
from . import connector
from . import models
from . import unit

27 changes: 27 additions & 0 deletions connector_dns/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Elico Corp
# Copyright 2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': 'DNS connector',
'version': '9.0.1.0.0',
'category': 'Connector',
'depends': ['connector'],
'author': 'Elico Corp, '
'LasLabs, '
'Odoo Community Association (OCA)',
'license': 'AGPL-3',
'website': 'https://www.elico-corp.com',
'data': [
'views/dns_backend.xml',
'views/dns_record.xml',
'views/dns_zone.xml',
'views/dns_menu.xml',
'views/connector_config_settings.xml',
'data/dns_record_type.xml',
'security/dns.xml',
'security/ir.model.access.csv',
],
'installable': True,
}
6 changes: 6 additions & 0 deletions connector_dns/backend.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Elico Corp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import openerp.addons.connector.backend as backend

dns = backend.Backend('dns')
69 changes: 69 additions & 0 deletions connector_dns/connector.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Elico Corp
# Copyright 2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models, fields, api
from openerp.addons.connector.connector import ConnectorEnvironment
from openerp.addons.connector.checkpoint import checkpoint


def get_environment(session, model_name, backend_id):
""" Create an environment to work with. """
backend_record = session.env['dns.backend'].browse(backend_id)
env = ConnectorEnvironment(backend_record, session, model_name)
return env


class DNSBinding(models.AbstractModel):
""" Abstract Model for the Bindigs.
All the models used as bindings between External System and Odoo
(``aws.dns.record``, ``aws.dns.zone``, ...) should ``_inherit`` it.
"""
_name = 'dns.binding'
_inherit = 'external.binding'
_description = 'DNS Binding (abstract)'

dns_backend_id = fields.Many2one(
comodel_name='dns.backend',
string='DNS Backend',
store=True,
required=True,
ondelete='restrict',
default=lambda s: s._default_dns_backend_id()
)
dns_id_external = fields.Char(
string='External ID',
help='ID of the record in external system.',
)
fail_date = fields.Datetime()

_sql_constraints = [
('backend_uniq', 'unique(dns_backend_id, dns_id_external)',
'A binding already exists with the same DNS External ID.'),
]

@api.model
def _default_dns_backend_id(self):
return self.env['dns.backend'].search([
('is_default', '=', True),
('active', '=', True),
],
limit=1,
)


def add_checkpoint(session, model_name, record_id, backend_id):
""" Add a row in the model ``connector.checkpoint`` for a record,
meaning it has to be reviewed by a user.
:param session: current session
:type session: :class:`openerp.addons.connector.session.ConnectorSession`
:param model_name: name of the model of the record to be reviewed
:type model_name: str
:param record_id: ID of the record to be reviewed
:type record_id: int
:param backend_id: ID of the dnspod Backend
:type backend_id: int
"""
return checkpoint.add_checkpoint(session, model_name, record_id,
'dns.backend', backend_id)
34 changes: 34 additions & 0 deletions connector_dns/consumer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
# Copyright 2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from .unit.export_synchronizer import export_record


import logging
_logger = logging.getLogger(__name__)


def delay_export(session, model_name, record_id, vals):
""" Delay a job which export a binding record.
(A binding record being a ``dns.record.bind``,
``dns.zone.bind``, ...)
"""
if session.context.get('connector_no_export'):
return
fields = vals.keys()
export_record.delay(session, model_name, record_id, fields=fields)


def delay_export_all_bindings(session, model_name, record_id, vals):
""" Delay a job which export all the bindings of a record.
In this case, it is called on records of normal models and will delay
the export for all the bindings.
"""
if session.context.get('connector_no_export'):
return
record = session.env[model_name].browse(record_id)
fields = vals.keys()
for binding in record.dns_bind_ids:
export_record.delay(session, binding._model._name, binding.id,
fields=fields)
Loading