[POWERDNS] - deleted extra parameters in create and update record and used already present extra array
@@ -23,7 +23,6 @@ from libcloud.dns.base import DNSDriver, Zone, Record
from libcloud.dns.types import ZoneDoesNotExistError, ZoneAlreadyExistsError
from libcloud.dns.types import Provider, RecordType
from libcloud.utils.py3 import httplib
-import pprint
__all__ = [
'PowerDNSDriver',
@@ -144,7 +143,7 @@ class PowerDNSDriver(DNSDriver):
host=host, port=port,
**kwargs)
- def create_record(self, name, zone, type, data, extra=None, disabled=False, comment=None):
+ def create_record(self, name, zone, type, data, extra=None):
"""
Create a new record.
@@ -198,6 +197,9 @@ class PowerDNSDriver(DNSDriver):
}
if self._pdns_version() == 4:
+ disabled = False
+ if 'disabled' in extra:
+ disabled = extra['disabled']
record = {
'content': data,
'disabled': disabled,
@@ -213,8 +215,8 @@ class PowerDNSDriver(DNSDriver):
}]
}
- if (comment):
- payload["rrsets"][0]["comments"] = [comment]
+ if 'comment' in extra:
+ payload["rrsets"][0]["comments"] = extra['comment']
try:
@@ -392,7 +394,7 @@ class PowerDNSDriver(DNSDriver):
response = self.connection.request(action=action, method='GET')
return self._to_zones(response)
- def update_record(self, record, name, type, data, extra=None, disabled=False, comment=None):
+ def update_record(self, record, name, type, data, extra=None):
"""
Update an existing record.
@@ -438,6 +440,10 @@ class PowerDNSDriver(DNSDriver):
}
if self._pdns_version() == 4:
+ disabled = False
+ if "disabled" in extra:
+ disabled = extra['disabled']
+ comment = None
updated_record = {
'content': data,
'disabled': disabled,
@@ -453,8 +459,8 @@ class PowerDNSDriver(DNSDriver):
}]
}
- if (comment):
- payload["rrsets"][0]["comments"] = [comment]
+ if 'comment' in extra:
+ payload["rrsets"][0]["comments"] = extra['comment']
try:
self.connection.request(action=action, data=json.dumps(payload),
