octodns-cloudns 0.0.7__tar.gz → 0.0.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {octodns_cloudns-0.0.7 → octodns_cloudns-0.0.9}/PKG-INFO +15 -13
- {octodns_cloudns-0.0.7 → octodns_cloudns-0.0.9}/README.md +14 -12
- {octodns_cloudns-0.0.7 → octodns_cloudns-0.0.9}/octodns_cloudns/__init__.py +28 -47
- {octodns_cloudns-0.0.7 → octodns_cloudns-0.0.9}/octodns_cloudns.egg-info/PKG-INFO +15 -13
- {octodns_cloudns-0.0.7 → octodns_cloudns-0.0.9}/LICENSE +0 -0
- {octodns_cloudns-0.0.7 → octodns_cloudns-0.0.9}/octodns_cloudns.egg-info/SOURCES.txt +0 -0
- {octodns_cloudns-0.0.7 → octodns_cloudns-0.0.9}/octodns_cloudns.egg-info/dependency_links.txt +0 -0
- {octodns_cloudns-0.0.7 → octodns_cloudns-0.0.9}/octodns_cloudns.egg-info/requires.txt +0 -0
- {octodns_cloudns-0.0.7 → octodns_cloudns-0.0.9}/octodns_cloudns.egg-info/top_level.txt +0 -0
- {octodns_cloudns-0.0.7 → octodns_cloudns-0.0.9}/setup.cfg +0 -0
- {octodns_cloudns-0.0.7 → octodns_cloudns-0.0.9}/setup.py +0 -0
- {octodns_cloudns-0.0.7 → octodns_cloudns-0.0.9}/tests/test_octodns_cloudns_provider.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: octodns-cloudns
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.9
|
|
4
4
|
Summary: ClouDNS API provider for octoDNS
|
|
5
5
|
Home-page: https://github.com/octodns/octodns-cloudns
|
|
6
6
|
Author: ClouDNS
|
|
@@ -40,28 +40,30 @@ An [octoDNS](https://github.com/octodns/octodns/) provider that targets ClouDNS.
|
|
|
40
40
|
pip install octodns-cloudns
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Pinning specific versions or SHAs is recommended to avoid unplanned upgrades.
|
|
43
|
+
### Configuration
|
|
46
44
|
|
|
47
|
-
|
|
45
|
+
For more safety, we recommend you to use an API sub-user with limited permissions.
|
|
46
|
+
You can create it from [your ClouDNS account](https://www.cloudns.net/api-settings/)
|
|
47
|
+
and store your credentials in environment variables:
|
|
48
48
|
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
octodns-cloudns==0.0.1
|
|
49
|
+
```bash
|
|
50
|
+
export CLOUDNS_API_AUTH_ID=XXXXX
|
|
51
|
+
export CLOUDNS_API_AUTH_PASSWORD=XXXXX
|
|
53
52
|
```
|
|
54
53
|
|
|
55
|
-
|
|
54
|
+
Then add your ClouDNS account to your octoDNS configuration file:
|
|
56
55
|
|
|
57
56
|
```yaml
|
|
58
57
|
providers:
|
|
59
58
|
cloudns_account:
|
|
60
|
-
class:
|
|
61
|
-
auth_id:
|
|
62
|
-
auth_password:
|
|
59
|
+
class: octodns_cloudns.ClouDNSProvider
|
|
60
|
+
auth_id: env/CLOUDNS_API_AUTH_ID
|
|
61
|
+
auth_password: env/CLOUDNS_API_AUTH_PASSWORD
|
|
62
|
+
# "sub_auth" must be enabled if *only* you log in using a sub-user.
|
|
63
|
+
sub_auth: true
|
|
63
64
|
```
|
|
64
65
|
|
|
66
|
+
|
|
65
67
|
### Support Information
|
|
66
68
|
|
|
67
69
|
#### GeoDNS records
|
|
@@ -10,28 +10,30 @@ An [octoDNS](https://github.com/octodns/octodns/) provider that targets ClouDNS.
|
|
|
10
10
|
pip install octodns-cloudns
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Pinning specific versions or SHAs is recommended to avoid unplanned upgrades.
|
|
13
|
+
### Configuration
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
For more safety, we recommend you to use an API sub-user with limited permissions.
|
|
16
|
+
You can create it from [your ClouDNS account](https://www.cloudns.net/api-settings/)
|
|
17
|
+
and store your credentials in environment variables:
|
|
18
18
|
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
octodns-cloudns==0.0.1
|
|
19
|
+
```bash
|
|
20
|
+
export CLOUDNS_API_AUTH_ID=XXXXX
|
|
21
|
+
export CLOUDNS_API_AUTH_PASSWORD=XXXXX
|
|
23
22
|
```
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
Then add your ClouDNS account to your octoDNS configuration file:
|
|
26
25
|
|
|
27
26
|
```yaml
|
|
28
27
|
providers:
|
|
29
28
|
cloudns_account:
|
|
30
|
-
class:
|
|
31
|
-
auth_id:
|
|
32
|
-
auth_password:
|
|
29
|
+
class: octodns_cloudns.ClouDNSProvider
|
|
30
|
+
auth_id: env/CLOUDNS_API_AUTH_ID
|
|
31
|
+
auth_password: env/CLOUDNS_API_AUTH_PASSWORD
|
|
32
|
+
# "sub_auth" must be enabled if *only* you log in using a sub-user.
|
|
33
|
+
sub_auth: true
|
|
33
34
|
```
|
|
34
35
|
|
|
36
|
+
|
|
35
37
|
### Support Information
|
|
36
38
|
|
|
37
39
|
#### GeoDNS records
|
|
@@ -8,7 +8,7 @@ from octodns.record import Record
|
|
|
8
8
|
logging.basicConfig(level=logging.DEBUG)
|
|
9
9
|
logger = logging.getLogger(__name__)
|
|
10
10
|
|
|
11
|
-
__version__ = __VERSION__ = '0.0.
|
|
11
|
+
__version__ = __VERSION__ = '0.0.9'
|
|
12
12
|
|
|
13
13
|
class ClouDNSClientException(ProviderException):
|
|
14
14
|
pass
|
|
@@ -44,7 +44,8 @@ class ClouDNSClientGeoDNSNotSupported(ClouDNSClientException):
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
class ClouDNSClient(object):
|
|
47
|
-
def __init__(self, auth_id, auth_password, sub_auth=False):
|
|
47
|
+
def __init__(self, auth_id, auth_password, id, sub_auth=False):
|
|
48
|
+
self.log = getLogger(f"ClouDNSProvider[{id}]")
|
|
48
49
|
session = Session()
|
|
49
50
|
session.headers.update(
|
|
50
51
|
{
|
|
@@ -75,9 +76,9 @@ class ClouDNSClient(object):
|
|
|
75
76
|
|
|
76
77
|
def _raw_request(self, function, params=''):
|
|
77
78
|
url = self._urlbase.format(function, params)
|
|
78
|
-
|
|
79
|
+
self.log.debug(f"Request URL: {url}")
|
|
79
80
|
response = self._session.get(url)
|
|
80
|
-
|
|
81
|
+
self.log.debug(f"Request Response: {response.text}")
|
|
81
82
|
return response
|
|
82
83
|
|
|
83
84
|
def _handle_response(self, response):
|
|
@@ -241,11 +242,11 @@ class ClouDNSProvider(BaseProvider):
|
|
|
241
242
|
]
|
|
242
243
|
)
|
|
243
244
|
|
|
244
|
-
def __init__(self, id, auth_id, auth_password, *args, **kwargs):
|
|
245
|
+
def __init__(self, id, auth_id, auth_password, sub_auth=False, *args, **kwargs):
|
|
245
246
|
self.log = getLogger(f"ClouDNSProvider[{id}]")
|
|
246
|
-
self.log.debug("__init__: id=%s, auth_id
|
|
247
|
+
self.log.debug("__init__: id=%s, auth_id=***, auth_password=***, sub_auth=%s", id, sub_auth)
|
|
247
248
|
super().__init__(id, *args, **kwargs)
|
|
248
|
-
self._client = ClouDNSClient(auth_id, auth_password)
|
|
249
|
+
self._client = ClouDNSClient(auth_id, auth_password, id, sub_auth)
|
|
249
250
|
|
|
250
251
|
self._zone_records = {}
|
|
251
252
|
|
|
@@ -371,27 +372,10 @@ class ClouDNSProvider(BaseProvider):
|
|
|
371
372
|
|
|
372
373
|
values = defaultdict(lambda: defaultdict(list))
|
|
373
374
|
records_data = self.zone_records(zone)
|
|
374
|
-
|
|
375
|
+
|
|
375
376
|
if 'status' in records_data and records_data['status'] == 'Failed':
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
if 'id' in response and response['id'] == 'not_found':
|
|
379
|
-
e = ClouDNSClientUnknownDomainName(
|
|
380
|
-
'Missing domain name'
|
|
381
|
-
)
|
|
382
|
-
e.__cause__ = None
|
|
383
|
-
raise e
|
|
384
|
-
|
|
385
|
-
if (self.isGeoDNS(response['statusDescription'])):
|
|
386
|
-
response = self._client.zone_create(zone.name[:-1], 'geodns')
|
|
387
|
-
|
|
388
|
-
if(response['status'] == 'Failed'):
|
|
389
|
-
e = ClouDNSClientUnknownDomainName(f"{response['status']} : {response['statusDescription']}")
|
|
390
|
-
e.__cause__ = None
|
|
391
|
-
raise e
|
|
392
|
-
self.log.info("populate: zone has been successfully created")
|
|
393
|
-
records_data = self._client.zone_records(zone.name[:-1])
|
|
394
|
-
|
|
377
|
+
return []
|
|
378
|
+
|
|
395
379
|
for record_id, record in records_data.items():
|
|
396
380
|
_type = record["type"]
|
|
397
381
|
|
|
@@ -412,7 +396,7 @@ class ClouDNSProvider(BaseProvider):
|
|
|
412
396
|
)
|
|
413
397
|
zone.add_record(record, lenient=lenient)
|
|
414
398
|
exists = zone.name in self._zone_records
|
|
415
|
-
|
|
399
|
+
self.log.debug(
|
|
416
400
|
"populate: found %s records, exists=%s",
|
|
417
401
|
len(zone.records) - before,
|
|
418
402
|
exists,
|
|
@@ -679,27 +663,24 @@ class ClouDNSProvider(BaseProvider):
|
|
|
679
663
|
desired = plan.desired
|
|
680
664
|
|
|
681
665
|
changes = plan.changes
|
|
682
|
-
|
|
666
|
+
zone_name = desired.name[:-1]
|
|
683
667
|
self.log.debug("_apply: zone=%s, len(changes)=%d", desired.name, len(changes))
|
|
684
668
|
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
)
|
|
701
|
-
e.__cause__ = None
|
|
702
|
-
raise e
|
|
669
|
+
# Does the zone actually exist?
|
|
670
|
+
zone = self._client.zone(zone_name)
|
|
671
|
+
if zone['status'] == 'Failed':
|
|
672
|
+
# All errors other than nonexistent zone.
|
|
673
|
+
if not zone['statusDescription'] == 'Missing domain-name':
|
|
674
|
+
raise ClouDNSClientException(zone)
|
|
675
|
+
|
|
676
|
+
# Check if subscription only allows GeoDNS zones.
|
|
677
|
+
geodns_only = self.isGeoDNS(zone['statusDescription'])
|
|
678
|
+
|
|
679
|
+
# Trying to create the zone.
|
|
680
|
+
zone = self._client.zone_create(zone_name, 'geodns' if geodns_only else 'master')
|
|
681
|
+
if zone['status'] == 'Failed':
|
|
682
|
+
raise ClouDNSClientException(zone)
|
|
683
|
+
self.log.info("_apply: zone has been successfully created")
|
|
703
684
|
|
|
704
685
|
for change in changes:
|
|
705
686
|
class_name = change.__class__.__name__
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: octodns-cloudns
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.9
|
|
4
4
|
Summary: ClouDNS API provider for octoDNS
|
|
5
5
|
Home-page: https://github.com/octodns/octodns-cloudns
|
|
6
6
|
Author: ClouDNS
|
|
@@ -40,28 +40,30 @@ An [octoDNS](https://github.com/octodns/octodns/) provider that targets ClouDNS.
|
|
|
40
40
|
pip install octodns-cloudns
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Pinning specific versions or SHAs is recommended to avoid unplanned upgrades.
|
|
43
|
+
### Configuration
|
|
46
44
|
|
|
47
|
-
|
|
45
|
+
For more safety, we recommend you to use an API sub-user with limited permissions.
|
|
46
|
+
You can create it from [your ClouDNS account](https://www.cloudns.net/api-settings/)
|
|
47
|
+
and store your credentials in environment variables:
|
|
48
48
|
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
octodns-cloudns==0.0.1
|
|
49
|
+
```bash
|
|
50
|
+
export CLOUDNS_API_AUTH_ID=XXXXX
|
|
51
|
+
export CLOUDNS_API_AUTH_PASSWORD=XXXXX
|
|
53
52
|
```
|
|
54
53
|
|
|
55
|
-
|
|
54
|
+
Then add your ClouDNS account to your octoDNS configuration file:
|
|
56
55
|
|
|
57
56
|
```yaml
|
|
58
57
|
providers:
|
|
59
58
|
cloudns_account:
|
|
60
|
-
class:
|
|
61
|
-
auth_id:
|
|
62
|
-
auth_password:
|
|
59
|
+
class: octodns_cloudns.ClouDNSProvider
|
|
60
|
+
auth_id: env/CLOUDNS_API_AUTH_ID
|
|
61
|
+
auth_password: env/CLOUDNS_API_AUTH_PASSWORD
|
|
62
|
+
# "sub_auth" must be enabled if *only* you log in using a sub-user.
|
|
63
|
+
sub_auth: true
|
|
63
64
|
```
|
|
64
65
|
|
|
66
|
+
|
|
65
67
|
### Support Information
|
|
66
68
|
|
|
67
69
|
#### GeoDNS records
|
|
File without changes
|
|
File without changes
|
{octodns_cloudns-0.0.7 → octodns_cloudns-0.0.9}/octodns_cloudns.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|