pyxecm 1.3.0__py3-none-any.whl → 1.5__py3-none-any.whl
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.
Potentially problematic release.
This version of pyxecm might be problematic. Click here for more details.
- pyxecm/__init__.py +3 -0
- pyxecm/coreshare.py +2636 -0
- pyxecm/customizer/__init__.py +6 -0
- pyxecm/customizer/browser_automation.py +231 -56
- pyxecm/customizer/customizer.py +466 -235
- pyxecm/customizer/k8s.py +49 -27
- pyxecm/customizer/m365.py +1183 -263
- pyxecm/customizer/payload.py +13854 -5368
- pyxecm/customizer/pht.py +503 -0
- pyxecm/customizer/salesforce.py +1782 -0
- pyxecm/customizer/sap.py +5 -5
- pyxecm/customizer/servicenow.py +1221 -0
- pyxecm/customizer/successfactors.py +1056 -0
- pyxecm/customizer/translate.py +2 -2
- pyxecm/helper/__init__.py +2 -0
- pyxecm/helper/assoc.py +27 -7
- pyxecm/helper/data.py +1527 -0
- pyxecm/helper/web.py +189 -25
- pyxecm/helper/xml.py +244 -40
- pyxecm/otac.py +311 -25
- pyxecm/otcs.py +3866 -1103
- pyxecm/otds.py +397 -150
- pyxecm/otiv.py +1 -1
- pyxecm/otmm.py +808 -0
- pyxecm/otpd.py +17 -12
- {pyxecm-1.3.0.dist-info → pyxecm-1.5.dist-info}/METADATA +4 -1
- pyxecm-1.5.dist-info/RECORD +30 -0
- {pyxecm-1.3.0.dist-info → pyxecm-1.5.dist-info}/WHEEL +1 -1
- pyxecm-1.3.0.dist-info/RECORD +0 -23
- {pyxecm-1.3.0.dist-info → pyxecm-1.5.dist-info}/LICENSE +0 -0
- {pyxecm-1.3.0.dist-info → pyxecm-1.5.dist-info}/top_level.txt +0 -0
pyxecm/customizer/k8s.py
CHANGED
|
@@ -42,7 +42,7 @@ update_ingress_backend_services: Replace the backend service and port for an ing
|
|
|
42
42
|
"""
|
|
43
43
|
|
|
44
44
|
__author__ = "Dr. Marc Diefenbruch"
|
|
45
|
-
__copyright__ = "Copyright
|
|
45
|
+
__copyright__ = "Copyright 2024, OpenText"
|
|
46
46
|
__credits__ = ["Kai-Philip Gatzweiler"]
|
|
47
47
|
__maintainer__ = "Dr. Marc Diefenbruch"
|
|
48
48
|
__email__ = "mdiefenb@opentext.com"
|
|
@@ -245,13 +245,16 @@ class K8s:
|
|
|
245
245
|
|
|
246
246
|
# end method definition
|
|
247
247
|
|
|
248
|
-
def exec_pod_command(
|
|
248
|
+
def exec_pod_command(
|
|
249
|
+
self, pod_name: str, command: list, max_retry: int = 3, time_retry: int = 10
|
|
250
|
+
):
|
|
249
251
|
"""Execute a command inside a Kubernetes Pod (similar to kubectl exec on command line).
|
|
250
252
|
See: https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/CoreV1Api.md#connect_get_namespaced_pod_exec
|
|
251
253
|
Args:
|
|
252
254
|
pod_name (str): name of the Kubernetes pod in the current namespace
|
|
253
255
|
command (list): list of command and its parameters, e.g. ["/bin/bash", "-c", "pwd"]
|
|
254
256
|
The "-c" is required to make the shell executing the command.
|
|
257
|
+
max_retry (int): Max amount of attempts to execute the command
|
|
255
258
|
Returns:
|
|
256
259
|
Response of the command or None if the call fails
|
|
257
260
|
"""
|
|
@@ -260,29 +263,48 @@ class K8s:
|
|
|
260
263
|
if not pod:
|
|
261
264
|
logger.error("Pod -> %s does not exist", pod_name)
|
|
262
265
|
|
|
263
|
-
logger.
|
|
266
|
+
logger.debug("Execute command -> %s in pod -> %s", command, pod_name)
|
|
264
267
|
|
|
265
|
-
|
|
266
|
-
response = stream(
|
|
267
|
-
self.get_core_v1_api().connect_get_namespaced_pod_exec,
|
|
268
|
-
pod_name,
|
|
269
|
-
self.get_namespace(),
|
|
270
|
-
command=command,
|
|
271
|
-
stderr=True,
|
|
272
|
-
stdin=False,
|
|
273
|
-
stdout=True,
|
|
274
|
-
tty=False,
|
|
275
|
-
)
|
|
276
|
-
except ApiException as exception:
|
|
277
|
-
logger.error(
|
|
278
|
-
"Failed to execute command -> %s in pod -> %s; error -> %s",
|
|
279
|
-
command,
|
|
280
|
-
pod_name,
|
|
281
|
-
str(exception),
|
|
282
|
-
)
|
|
283
|
-
return None
|
|
268
|
+
retry_counter = 1
|
|
284
269
|
|
|
285
|
-
|
|
270
|
+
while retry_counter <= max_retry:
|
|
271
|
+
try:
|
|
272
|
+
response = stream(
|
|
273
|
+
self.get_core_v1_api().connect_get_namespaced_pod_exec,
|
|
274
|
+
pod_name,
|
|
275
|
+
self.get_namespace(),
|
|
276
|
+
command=command,
|
|
277
|
+
stderr=True,
|
|
278
|
+
stdin=False,
|
|
279
|
+
stdout=True,
|
|
280
|
+
tty=False,
|
|
281
|
+
)
|
|
282
|
+
logger.debug(response)
|
|
283
|
+
return response
|
|
284
|
+
except ApiException as exc:
|
|
285
|
+
logger.warning(
|
|
286
|
+
"Failed to execute command, retry (%s/%s) -> %s in pod -> %s; error -> %s",
|
|
287
|
+
retry_counter,
|
|
288
|
+
max_retry,
|
|
289
|
+
command,
|
|
290
|
+
pod_name,
|
|
291
|
+
str(exc),
|
|
292
|
+
)
|
|
293
|
+
retry_counter = retry_counter + 1
|
|
294
|
+
exception = exc
|
|
295
|
+
logger.debug("Wait %s seconds before next retry...", str(time_retry))
|
|
296
|
+
time.sleep(time_retry)
|
|
297
|
+
continue
|
|
298
|
+
|
|
299
|
+
logger.error(
|
|
300
|
+
"Failed to execute command with %s retries -> %s in pod -> %s; error -> %s",
|
|
301
|
+
max_retry,
|
|
302
|
+
command,
|
|
303
|
+
pod_name,
|
|
304
|
+
str(exception),
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
return None
|
|
286
308
|
|
|
287
309
|
# end method definition
|
|
288
310
|
|
|
@@ -349,17 +371,17 @@ class K8s:
|
|
|
349
371
|
got_response = False
|
|
350
372
|
response.update(timeout=timeout)
|
|
351
373
|
if response.peek_stdout():
|
|
352
|
-
logger.
|
|
374
|
+
logger.debug(response.read_stdout().replace("\n", " "))
|
|
353
375
|
got_response = True
|
|
354
376
|
if response.peek_stderr():
|
|
355
377
|
if write_stderr_to_error_log:
|
|
356
378
|
logger.error(response.read_stderr().replace("\n", " "))
|
|
357
379
|
else:
|
|
358
|
-
logger.
|
|
380
|
+
logger.debug(response.read_stderr().replace("\n", " "))
|
|
359
381
|
got_response = True
|
|
360
382
|
if commands:
|
|
361
383
|
command = commands.pop(0)
|
|
362
|
-
logger.
|
|
384
|
+
logger.debug("Execute command -> %s in pod -> %s", command, pod_name)
|
|
363
385
|
response.write_stdin(command + "\n")
|
|
364
386
|
else:
|
|
365
387
|
# We continue as long as we get some response during timeout period
|
|
@@ -866,7 +888,7 @@ class K8s:
|
|
|
866
888
|
backend = path.backend
|
|
867
889
|
service = backend.service
|
|
868
890
|
|
|
869
|
-
logger.
|
|
891
|
+
logger.debug(
|
|
870
892
|
"Replace backend service -> %s (%s) with new backend service -> %s (%s)",
|
|
871
893
|
service.name,
|
|
872
894
|
service.port.number,
|