SOLIDserverRest 2.3.10__tar.gz → 2.3.12__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.
- {SOLIDserverRest-2.3.10/SOLIDserverRest.egg-info → SOLIDserverRest-2.3.12}/PKG-INFO +196 -153
- SOLIDserverRest-2.3.10/PKG-INFO → SOLIDserverRest-2.3.12/README.md +38 -19
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest/SOLIDserverRest.py +0 -0
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/dns_record.py +5 -7
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/sds.py +11 -0
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/validators.py +3 -3
- SOLIDserverRest-2.3.10/README.md → SOLIDserverRest-2.3.12/SOLIDserverRest.egg-info/PKG-INFO +196 -133
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest.egg-info/SOURCES.txt +3 -1
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest.egg-info/entry_points.txt +0 -1
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest.egg-info/not-zip-safe +1 -1
- SOLIDserverRest-2.3.12/SOLIDserverRest.egg-info/requires.txt +7 -0
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/setup.cfg +4 -4
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/setup.py +7 -7
- SOLIDserverRest-2.3.12/tests/test_simple.py +104 -0
- SOLIDserverRest-2.3.12/tests/tests.py +287 -0
- SOLIDserverRest-2.3.10/SOLIDserverRest.egg-info/requires.txt +0 -7
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/LICENSE +0 -0
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest/Exception.py +0 -0
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest/__init__.py +0 -0
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/__init__.py +0 -0
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/base.py +0 -0
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/class_params.py +0 -0
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/device.py +0 -0
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/device_tools.py +0 -0
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/devif.py +0 -0
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/dns.py +0 -0
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/dns_zone.py +0 -0
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/ipaddress.py +0 -0
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/network.py +0 -0
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/space.py +0 -0
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest/mapper.py +0 -0
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest.egg-info/dependency_links.txt +0 -0
- {SOLIDserverRest-2.3.10 → SOLIDserverRest-2.3.12}/SOLIDserverRest.egg-info/top_level.txt +0 -0
|
@@ -1,153 +1,196 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: SOLIDserverRest
|
|
3
|
-
Version: 2.3.
|
|
4
|
-
Summary: The SOLIDserverRest is a library to drive EfficientIP API
|
|
5
|
-
Home-page: https://gitlab.com/efficientip/solidserverrest
|
|
6
|
-
Author: Gregory CUGAT / Alex Chauvin
|
|
7
|
-
Author-email: gregory.cugat@efficientip.com, ach@efficientip.com
|
|
8
|
-
License: BSD 2
|
|
9
|
-
|
|
10
|
-
Classifier:
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
This 'SOLIDserverRest'
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: SOLIDserverRest
|
|
3
|
+
Version: 2.3.12
|
|
4
|
+
Summary: The SOLIDserverRest is a library to drive EfficientIP API
|
|
5
|
+
Home-page: https://gitlab.com/efficientip/solidserverrest
|
|
6
|
+
Author: Gregory CUGAT / Alex Chauvin
|
|
7
|
+
Author-email: gregory.cugat@efficientip.com, ach@efficientip.com
|
|
8
|
+
License: BSD 2
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Requires-Python: >=3.7
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: requests~=2.0
|
|
18
|
+
Requires-Dist: PySocks~=1.0
|
|
19
|
+
Requires-Dist: urllib3~=1.0
|
|
20
|
+
Requires-Dist: idna~=3.0
|
|
21
|
+
Requires-Dist: chardet~=5.0
|
|
22
|
+
Requires-Dist: pyopenssl~=24.0
|
|
23
|
+
Requires-Dist: packaging~=23.0
|
|
24
|
+
|
|
25
|
+
[](https://opensource.org/licenses/BSD-2-Clause)
|
|
26
|
+
|
|
27
|
+
[](https://gitlab.com/efficientip/solidserverrest/commits/master)
|
|
28
|
+
|
|
29
|
+
# SOLIDserverRest
|
|
30
|
+
|
|
31
|
+
This 'SOLIDserverRest' allows to easily interact with [SOLIDserver](https://www.efficientip.com/products/solidserver/)'s REST API.
|
|
32
|
+
It allows managing all IPAM objects through CRUD operations.
|
|
33
|
+
|
|
34
|
+
* ***Free software***: BSD2 License
|
|
35
|
+
|
|
36
|
+
This 'SOLIDserverRest' is compatible with [SOLIDserver](https://www.efficientip.com/products/solidserver/) version 7 and ownward.
|
|
37
|
+
|
|
38
|
+
# Install
|
|
39
|
+
Install 'SOLIDserverRest' using pip in your virtualenv:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
pip install SOLIDserverRest
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
# Usage
|
|
46
|
+
|
|
47
|
+
## Using the SOLIDserverRest advanced object (recommended)
|
|
48
|
+
|
|
49
|
+
All commands and object manipulation are going through a SOLIDserver main object, handling the connection to the manager and pushing API calls. The creation of a SOLIDserver object is done like that:
|
|
50
|
+
```
|
|
51
|
+
from SOLIDserverRest import *
|
|
52
|
+
from SOLIDserverRest import adv as sdsadv
|
|
53
|
+
|
|
54
|
+
SDS_HOST = "192.168.254.254"
|
|
55
|
+
SDS_LOGIN = "foo"
|
|
56
|
+
SDS_PWD = "bar"
|
|
57
|
+
|
|
58
|
+
sds = sdsadv.SDS(ip_address=SDS_HOST,
|
|
59
|
+
user=SDS_LOGIN,
|
|
60
|
+
pwd=SDS_PWD)
|
|
61
|
+
try:
|
|
62
|
+
sds.connect(method="native")
|
|
63
|
+
except SDSError as e:
|
|
64
|
+
logging.error(e)
|
|
65
|
+
exit(1)
|
|
66
|
+
|
|
67
|
+
print(adv)
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
More examples in the example directory.
|
|
72
|
+
|
|
73
|
+
## Using the SOLIDserverRest object
|
|
74
|
+
|
|
75
|
+
The raw API is mapped using the SOLIDserverRest object which handle the connection, prepare the formating and handle some errors. It can be usefull twhen the advanced library is not yet implementing an object that you require in your code.
|
|
76
|
+
|
|
77
|
+
### 1. Declare endpoint API point
|
|
78
|
+
Set the API endpoint you want to talk with through API. Could use an IP address
|
|
79
|
+
(v4 or v6) or a host name
|
|
80
|
+
* host = IP address of the SOLIDserver server
|
|
81
|
+
```
|
|
82
|
+
con = SOLIDserverRest("fqdn_host.org")
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 2. Specify connection method
|
|
86
|
+
You can use native connection mode using SOLIDserver default method which provide
|
|
87
|
+
authentication through headers in the requests with information
|
|
88
|
+
encoded in base64
|
|
89
|
+
|
|
90
|
+
* user = user who want to use
|
|
91
|
+
* password = password of the user
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
con.use_native_sds(user="apiuser", password="apipwd")
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
You can also use the basic authentication method for connecting the SOLIDserver.
|
|
98
|
+
|
|
99
|
+
* user = user who want to use
|
|
100
|
+
* password = password of the user
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
con.use_basicauth_sds(user="apiuser", password="apipwd")
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 3. Set TLS security
|
|
107
|
+
SSL certificate chain is validated by default, to disable it, use the set_ssl_verify method
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
con.set_ssl_verify(False) # True by default
|
|
111
|
+
rest_answer = con.query("method", "parameters")
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Otherwise, you have to provide the certificate file:
|
|
115
|
+
```python
|
|
116
|
+
con = SOLIDserverRest(SERVER)
|
|
117
|
+
```
|
|
118
|
+
If the certificate file is not valide, an exception ```SDSInitError``` is raised.
|
|
119
|
+
|
|
120
|
+
### 4. Request to SOLIDserver API
|
|
121
|
+
|
|
122
|
+
You need parameters:
|
|
123
|
+
* method = choose your method in the list below
|
|
124
|
+
* parameters = Python dictionary with parameters you want to use
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
rest_answer = con.query("method", "parameters")
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 5. Analyze answer
|
|
131
|
+
|
|
132
|
+
* rest_answer => object name
|
|
133
|
+
* rest_answer.status_code => current http answer code set in the object
|
|
134
|
+
* rest_answer.content => Answer core from SOLIDserver API set in the object
|
|
135
|
+
|
|
136
|
+
Example:
|
|
137
|
+
```python
|
|
138
|
+
print(rest_answer)
|
|
139
|
+
print(rest_answer.status_code)
|
|
140
|
+
print(rest_answer.content)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
# Methods that could be used
|
|
144
|
+
Methods are organized to match the ontology used in SOLIDServer, you will find:
|
|
145
|
+
* Sites - address spaces
|
|
146
|
+
* Subnets (v4 and v6)
|
|
147
|
+
* Pools (v4 and v6)
|
|
148
|
+
* Addresses (v4 and v6)
|
|
149
|
+
* Aliases (v4 and v6)
|
|
150
|
+
* DNS servers, views, zones, RR, acl, key
|
|
151
|
+
* application manager
|
|
152
|
+
* DHCP server, scope, shared net, range, static, group
|
|
153
|
+
* device manager
|
|
154
|
+
* VLAN manager
|
|
155
|
+
|
|
156
|
+
More information about supported methods in the [specific document](docs/METHODS.md)
|
|
157
|
+
|
|
158
|
+
# Tests
|
|
159
|
+
|
|
160
|
+
Last set of tests run on 19/Feb/2024 using:
|
|
161
|
+
* SOLIDserver release 8.3.2
|
|
162
|
+
* python libs:
|
|
163
|
+
* chardet 5.2.0
|
|
164
|
+
* urllib3 1.26.18
|
|
165
|
+
* idna 3.6
|
|
166
|
+
* requests 2.31.0
|
|
167
|
+
* PySocks 1.7.1
|
|
168
|
+
* pyOpenSSL 24.0.0
|
|
169
|
+
* packaging 23.2
|
|
170
|
+
|
|
171
|
+
## coverage results
|
|
172
|
+
```
|
|
173
|
+
---------- coverage: platform win32, python 3.11.3-final-0 -----------
|
|
174
|
+
Name Stmts Miss Cover
|
|
175
|
+
---------------------------------------------------------
|
|
176
|
+
SOLIDserverRest\Exception.py 25 4 84%
|
|
177
|
+
SOLIDserverRest\SOLIDserverRest.py 137 17 88%
|
|
178
|
+
SOLIDserverRest\__init__.py 5 0 100%
|
|
179
|
+
SOLIDserverRest\adv\__init__.py 13 0 100%
|
|
180
|
+
SOLIDserverRest\adv\base.py 117 12 90%
|
|
181
|
+
SOLIDserverRest\adv\class_params.py 82 3 96%
|
|
182
|
+
SOLIDserverRest\adv\device.py 87 72 17%
|
|
183
|
+
SOLIDserverRest\adv\device_tools.py 128 113 12%
|
|
184
|
+
SOLIDserverRest\adv\devif.py 122 99 19%
|
|
185
|
+
SOLIDserverRest\adv\dns.py 150 5 97%
|
|
186
|
+
SOLIDserverRest\adv\dns_record.py 336 105 69%
|
|
187
|
+
SOLIDserverRest\adv\dns_zone.py 124 15 88%
|
|
188
|
+
SOLIDserverRest\adv\ipaddress.py 128 0 100%
|
|
189
|
+
SOLIDserverRest\adv\network.py 185 1 99%
|
|
190
|
+
SOLIDserverRest\adv\sds.py 118 3 97%
|
|
191
|
+
SOLIDserverRest\adv\space.py 56 1 98%
|
|
192
|
+
SOLIDserverRest\adv\validators.py 28 6 79%
|
|
193
|
+
SOLIDserverRest\mapper.py 22 0 100%
|
|
194
|
+
---------------------------------------------------------
|
|
195
|
+
TOTAL 1863 456 76%
|
|
196
|
+
```
|
|
@@ -1,25 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: SOLIDserverRest
|
|
3
|
-
Version: 2.3.10
|
|
4
|
-
Summary: The SOLIDserverRest is a library to drive EfficientIP API
|
|
5
|
-
Home-page: https://gitlab.com/efficientip/solidserverrest
|
|
6
|
-
Author: Gregory CUGAT / Alex Chauvin
|
|
7
|
-
Author-email: gregory.cugat@efficientip.com, ach@efficientip.com
|
|
8
|
-
License: BSD 2
|
|
9
|
-
Platform: UNKNOWN
|
|
10
|
-
Classifier: Intended Audience :: Developers
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
-
Requires-Python: >=3.7
|
|
16
|
-
Description-Content-Type: text/markdown
|
|
17
|
-
License-File: LICENSE
|
|
18
|
-
|
|
19
1
|
[](https://opensource.org/licenses/BSD-2-Clause)
|
|
20
2
|
|
|
21
3
|
[](https://gitlab.com/efficientip/solidserverrest/commits/master)
|
|
22
|
-
[](https://codecov.io/gl/efficientip/solidserverrest)
|
|
23
4
|
|
|
24
5
|
# SOLIDserverRest
|
|
25
6
|
|
|
@@ -150,4 +131,42 @@ Methods are organized to match the ontology used in SOLIDServer, you will find:
|
|
|
150
131
|
|
|
151
132
|
More information about supported methods in the [specific document](docs/METHODS.md)
|
|
152
133
|
|
|
134
|
+
# Tests
|
|
135
|
+
|
|
136
|
+
Last set of tests run on 19/Feb/2024 using:
|
|
137
|
+
* SOLIDserver release 8.3.2
|
|
138
|
+
* python libs:
|
|
139
|
+
* chardet 5.2.0
|
|
140
|
+
* urllib3 1.26.18
|
|
141
|
+
* idna 3.6
|
|
142
|
+
* requests 2.31.0
|
|
143
|
+
* PySocks 1.7.1
|
|
144
|
+
* pyOpenSSL 24.0.0
|
|
145
|
+
* packaging 23.2
|
|
153
146
|
|
|
147
|
+
## coverage results
|
|
148
|
+
```
|
|
149
|
+
---------- coverage: platform win32, python 3.11.3-final-0 -----------
|
|
150
|
+
Name Stmts Miss Cover
|
|
151
|
+
---------------------------------------------------------
|
|
152
|
+
SOLIDserverRest\Exception.py 25 4 84%
|
|
153
|
+
SOLIDserverRest\SOLIDserverRest.py 137 17 88%
|
|
154
|
+
SOLIDserverRest\__init__.py 5 0 100%
|
|
155
|
+
SOLIDserverRest\adv\__init__.py 13 0 100%
|
|
156
|
+
SOLIDserverRest\adv\base.py 117 12 90%
|
|
157
|
+
SOLIDserverRest\adv\class_params.py 82 3 96%
|
|
158
|
+
SOLIDserverRest\adv\device.py 87 72 17%
|
|
159
|
+
SOLIDserverRest\adv\device_tools.py 128 113 12%
|
|
160
|
+
SOLIDserverRest\adv\devif.py 122 99 19%
|
|
161
|
+
SOLIDserverRest\adv\dns.py 150 5 97%
|
|
162
|
+
SOLIDserverRest\adv\dns_record.py 336 105 69%
|
|
163
|
+
SOLIDserverRest\adv\dns_zone.py 124 15 88%
|
|
164
|
+
SOLIDserverRest\adv\ipaddress.py 128 0 100%
|
|
165
|
+
SOLIDserverRest\adv\network.py 185 1 99%
|
|
166
|
+
SOLIDserverRest\adv\sds.py 118 3 97%
|
|
167
|
+
SOLIDserverRest\adv\space.py 56 1 98%
|
|
168
|
+
SOLIDserverRest\adv\validators.py 28 6 79%
|
|
169
|
+
SOLIDserverRest\mapper.py 22 0 100%
|
|
170
|
+
---------------------------------------------------------
|
|
171
|
+
TOTAL 1863 456 76%
|
|
172
|
+
```
|
|
File without changes
|
|
@@ -463,7 +463,11 @@ class ExtendedDNSRecord(DNS_record):
|
|
|
463
463
|
|
|
464
464
|
if name is not None:
|
|
465
465
|
if _zone.name not in name:
|
|
466
|
-
name
|
|
466
|
+
if name == "":
|
|
467
|
+
name = _zone.name
|
|
468
|
+
else:
|
|
469
|
+
name = f"{name}.{_zone.name}"
|
|
470
|
+
|
|
467
471
|
super().__init__(sds, name)
|
|
468
472
|
self.set_zone(_zone)
|
|
469
473
|
self.mapping_dict = mapping_dict
|
|
@@ -503,12 +507,6 @@ class ExtendedDNSRecord(DNS_record):
|
|
|
503
507
|
self.set_additional_where_params(**add_param)
|
|
504
508
|
with_params_statement = with_params_statement[:-2] + " "
|
|
505
509
|
|
|
506
|
-
for _key, _value in self.additional_where_params.items():
|
|
507
|
-
if isinstance(_value, str):
|
|
508
|
-
params['WHERE'] += f" and {_key}='{_value}'"
|
|
509
|
-
elif isinstance(_value, int):
|
|
510
|
-
params['WHERE'] += f" and {_key}={_value}"
|
|
511
|
-
|
|
512
510
|
try:
|
|
513
511
|
duplicate_check = self.sds.query("dns_rr_list",
|
|
514
512
|
params=params)
|
|
@@ -11,6 +11,7 @@ SOLIDserver management server access
|
|
|
11
11
|
import logging
|
|
12
12
|
import ipaddress
|
|
13
13
|
import socket
|
|
14
|
+
import json
|
|
14
15
|
|
|
15
16
|
from json.decoder import JSONDecodeError
|
|
16
17
|
|
|
@@ -234,6 +235,16 @@ class SDS(ClassParams):
|
|
|
234
235
|
j = answer_req.json()
|
|
235
236
|
return j
|
|
236
237
|
except JSONDecodeError: # pragma: no cover
|
|
238
|
+
logging.warning(
|
|
239
|
+
"no json in return, trying array and returns first entry")
|
|
240
|
+
|
|
241
|
+
try:
|
|
242
|
+
j = json.loads(f'[{answer_req.content.decode()}]')
|
|
243
|
+
if isinstance(j, list):
|
|
244
|
+
return j[0]
|
|
245
|
+
except Error:
|
|
246
|
+
pass
|
|
247
|
+
|
|
237
248
|
logging.error("no json in return")
|
|
238
249
|
return None
|
|
239
250
|
|
|
@@ -16,7 +16,7 @@ class INTValidator:
|
|
|
16
16
|
try:
|
|
17
17
|
other_int = int(other)
|
|
18
18
|
except Exception:
|
|
19
|
-
raise SDSError("{} must be of type int"
|
|
19
|
+
raise SDSError(f"{name} must be of type int")
|
|
20
20
|
|
|
21
21
|
_range = range(self.min_val, self.max_val)
|
|
22
22
|
|
|
@@ -38,7 +38,7 @@ class STRValidator:
|
|
|
38
38
|
def validate(self, other, name):
|
|
39
39
|
is_string = isinstance(other, str)
|
|
40
40
|
if not is_string:
|
|
41
|
-
raise SDSError("{} must be of type string"
|
|
41
|
+
raise SDSError(f"{name} must be of type string")
|
|
42
42
|
|
|
43
43
|
_len = len(other)
|
|
44
44
|
|
|
@@ -46,5 +46,5 @@ class STRValidator:
|
|
|
46
46
|
raise SDSError(
|
|
47
47
|
f"{name} must be a string with a max"
|
|
48
48
|
f" length of {self.max_len}, provided string"
|
|
49
|
-
f" is of length {
|
|
49
|
+
f" is of length {_len}"
|
|
50
50
|
)
|