mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
dns/ddclient - add (optional) descriptive name for account selection to native backend, closes https://github.com/opnsense/plugins/issues/3553
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
PLUGIN_NAME= ddclient
|
||||
PLUGIN_VERSION= 1.21
|
||||
PLUGIN_REVISION= 2
|
||||
PLUGIN_VERSION= 1.22
|
||||
#PLUGIN_REVISION= 1
|
||||
PLUGIN_DEPENDS= ddclient py${PLUGIN_PYTHON}-boto3
|
||||
PLUGIN_COMMENT= Dynamic DNS client
|
||||
PLUGIN_MAINTAINER= ad@opnsense.org
|
||||
|
||||
@@ -6,6 +6,11 @@ WWW: https://github.com/ddclient/ddclient
|
||||
Plugin Changelog
|
||||
================
|
||||
|
||||
1.22
|
||||
|
||||
* Add gandi support
|
||||
* Optionally support descriptive values for account selection when using native backend
|
||||
|
||||
1.21
|
||||
|
||||
* Add Netcup support (contributed by Ingo Lafrenz)
|
||||
|
||||
+2
-3
@@ -42,9 +42,8 @@ class ServiceField extends BaseListField
|
||||
if ((string)$this->getParentModel()->general->backend == 'opnsense') {
|
||||
$supported = json_decode((new Backend())->configdRun("ddclient opnbackend supported"), true);
|
||||
if (!empty($supported)) {
|
||||
foreach ($supported as $srv) {
|
||||
self::$internalCacheOptionList[$srv] = $srv;
|
||||
}
|
||||
self::$internalCacheOptionList = $supported;
|
||||
asort(self::$internalCacheOptionList, SORT_NATURAL | SORT_FLAG_CASE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ class BaseAccount:
|
||||
|
||||
@staticmethod
|
||||
def known_services():
|
||||
return []
|
||||
return {}
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
|
||||
@@ -82,7 +82,7 @@ class Azure(BaseAccount):
|
||||
|
||||
@staticmethod
|
||||
def known_services():
|
||||
return Azure._services
|
||||
return {'azure': 'Microsoft Azure'}
|
||||
|
||||
@staticmethod
|
||||
def match(account):
|
||||
|
||||
@@ -42,7 +42,7 @@ class Cloudflare(BaseAccount):
|
||||
|
||||
@staticmethod
|
||||
def known_services():
|
||||
return Cloudflare._services.keys()
|
||||
return {'cloudflare': 'Cloudflare'}
|
||||
|
||||
@staticmethod
|
||||
def match(account):
|
||||
@@ -51,13 +51,7 @@ class Cloudflare(BaseAccount):
|
||||
def execute(self):
|
||||
if super().execute():
|
||||
# IPv4/IPv6
|
||||
recordType = None
|
||||
if str(self.current_address).find(':') > 1:
|
||||
#IPv6
|
||||
recordType = "AAAA"
|
||||
else:
|
||||
#IPv4
|
||||
recordType = "A"
|
||||
recordType = "AAAA" if str(self.current_address).find(':') > 1 else "A"
|
||||
|
||||
# get ZoneID
|
||||
url = "https://%s/client/v4/zones" % self._services[self.settings.get('service')]
|
||||
|
||||
@@ -63,9 +63,14 @@ class AccountFactory:
|
||||
return handler(account)
|
||||
|
||||
def known_services(self):
|
||||
all_services = []
|
||||
all_services = {}
|
||||
for handler in self._account_classes:
|
||||
all_services += handler.known_services()
|
||||
data = handler.known_services()
|
||||
if type(data) is dict:
|
||||
all_services.update(data)
|
||||
else:
|
||||
for item in data:
|
||||
all_services[item] = item
|
||||
return all_services
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user