ebs-linuxnode-core 3.1.6__tar.gz → 3.2.1__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.
- {ebs-linuxnode-core-3.1.6/ebs_linuxnode_core.egg-info → ebs-linuxnode-core-3.2.1}/PKG-INFO +1 -1
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs/linuxnode/core/http.py +15 -10
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs/linuxnode/core/log.py +16 -0
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1/ebs_linuxnode_core.egg-info}/PKG-INFO +1 -1
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/.gitignore +0 -0
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs/__init__.py +0 -0
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs/linuxnode/__init__.py +0 -0
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs/linuxnode/core/__init__.py +0 -0
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs/linuxnode/core/background.py +0 -0
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs/linuxnode/core/basemixin.py +0 -0
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs/linuxnode/core/basenode.py +0 -0
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs/linuxnode/core/busy.py +0 -0
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs/linuxnode/core/config.py +0 -0
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs/linuxnode/core/constants.py +0 -0
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs/linuxnode/core/nodeid.py +0 -0
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs/linuxnode/core/resources.py +0 -0
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs/linuxnode/core/shell.py +0 -0
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs/linuxnode/db/__init__.py +0 -0
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs/linuxnode/db/sequence.py +0 -0
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs_linuxnode_core.egg-info/SOURCES.txt +0 -0
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs_linuxnode_core.egg-info/dependency_links.txt +0 -0
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs_linuxnode_core.egg-info/requires.txt +0 -0
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs_linuxnode_core.egg-info/top_level.txt +0 -0
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/example.py +0 -0
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/setup.cfg +0 -0
- {ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/setup.py +0 -0
|
@@ -43,6 +43,9 @@ class HTTPError(Exception):
|
|
|
43
43
|
def __init__(self, response):
|
|
44
44
|
self.response = response
|
|
45
45
|
|
|
46
|
+
def __repr__(self):
|
|
47
|
+
return f"HTTP Response : {self.response}"
|
|
48
|
+
|
|
46
49
|
|
|
47
50
|
_http_errors = (HTTPError, DNSLookupError, NoRouteError, ConnectionRefusedError,
|
|
48
51
|
TimeoutError, ConnectError, ResponseNeverReceived)
|
|
@@ -178,20 +181,22 @@ class HttpClientMixin(NodeBusyMixin, NodeLoggingMixin, BaseMixin):
|
|
|
178
181
|
return url
|
|
179
182
|
|
|
180
183
|
@staticmethod
|
|
181
|
-
def
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
184
|
+
def _sanitize(kwargs):
|
|
185
|
+
response = {k: v for k, v in kwargs.items() if k not in {'_files'}}
|
|
186
|
+
if 'headers' not in response.keys():
|
|
187
|
+
return response
|
|
188
|
+
if b'Authorization' in response['headers'].keys():
|
|
189
|
+
new_headers = copy.deepcopy(response['headers'])
|
|
190
|
+
new_headers[b'Authorization'] = new_headers[b'Authorization'][:10] + b'...'
|
|
191
|
+
response['headers'] = new_headers
|
|
192
|
+
return response
|
|
193
|
+
return response
|
|
189
194
|
|
|
190
195
|
def http_get(self, url, **kwargs):
|
|
191
196
|
self.log.debug("Executing HTTP GET Request\n"
|
|
192
197
|
" to URL {url}\n"
|
|
193
198
|
" with kwargs {kwargs}",
|
|
194
|
-
url=url, kwargs=self.
|
|
199
|
+
url=url, kwargs=self._sanitize(kwargs))
|
|
195
200
|
deferred_response = self.http_semaphore.run(
|
|
196
201
|
self.http_client.get, url, **kwargs
|
|
197
202
|
)
|
|
@@ -208,7 +213,7 @@ class HttpClientMixin(NodeBusyMixin, NodeLoggingMixin, BaseMixin):
|
|
|
208
213
|
self.log.debug("Executing HTTP Post Request\n"
|
|
209
214
|
" to URL {url}\n"
|
|
210
215
|
" with kwargs {kwargs}",
|
|
211
|
-
url=url, kwargs=self.
|
|
216
|
+
url=url, kwargs=self._sanitize(kwargs))
|
|
212
217
|
deferred_response = self.http_semaphore.run(
|
|
213
218
|
self.http_client.post, url, **kwargs
|
|
214
219
|
)
|
|
@@ -4,6 +4,7 @@ import os
|
|
|
4
4
|
import io
|
|
5
5
|
import sys
|
|
6
6
|
import time
|
|
7
|
+
import zipfile
|
|
7
8
|
from twisted import logger
|
|
8
9
|
from twisted.logger import LogLevel
|
|
9
10
|
from twisted.logger import LogLevelFilterPredicate
|
|
@@ -102,6 +103,21 @@ class NodeLoggingMixin(ConfigMixin, BaseMixin):
|
|
|
102
103
|
os.makedirs(user_log_dir(self.appname), exist_ok=True)
|
|
103
104
|
return user_log_dir(self.appname)
|
|
104
105
|
|
|
106
|
+
def log_build_package(self, out_path=None):
|
|
107
|
+
if not out_path:
|
|
108
|
+
ctime = datetime.now().strftime("%Y%m%d%H%M%S")
|
|
109
|
+
out_path = os.path.join('/tmp', f'{self.id}.{ctime}.logs.zip')
|
|
110
|
+
|
|
111
|
+
with zipfile.ZipFile(out_path, 'w', zipfile.ZIP_DEFLATED) as zip_file:
|
|
112
|
+
for root, dirs, files in os.walk(self.log_dir):
|
|
113
|
+
for file_or_dir in files + dirs:
|
|
114
|
+
zip_file.write(
|
|
115
|
+
os.path.join(root, file_or_dir),
|
|
116
|
+
os.path.relpath(os.path.join(root, file_or_dir), self.log_dir)
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
return out_path
|
|
120
|
+
|
|
105
121
|
def exim_install(self):
|
|
106
122
|
super(NodeLoggingMixin, self).exim_install()
|
|
107
123
|
self.exim.register_export('logs', self.log_dir)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs_linuxnode_core.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs_linuxnode_core.egg-info/requires.txt
RENAMED
|
File without changes
|
{ebs-linuxnode-core-3.1.6 → ebs-linuxnode-core-3.2.1}/ebs_linuxnode_core.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|