easy-utils-dev 2.123__py3-none-any.whl → 2.125__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.
- easy_utils_dev/debugger.py +17 -17
- easy_utils_dev/ne1830PSS.py +0 -5
- easy_utils_dev/wsnoclib.py +19 -12
- {easy_utils_dev-2.123.dist-info → easy_utils_dev-2.125.dist-info}/METADATA +1 -1
- {easy_utils_dev-2.123.dist-info → easy_utils_dev-2.125.dist-info}/RECORD +8 -8
- {easy_utils_dev-2.123.dist-info → easy_utils_dev-2.125.dist-info}/WHEEL +0 -0
- {easy_utils_dev-2.123.dist-info → easy_utils_dev-2.125.dist-info}/license.dat +0 -0
- {easy_utils_dev-2.123.dist-info → easy_utils_dev-2.125.dist-info}/top_level.txt +0 -0
easy_utils_dev/debugger.py
CHANGED
|
@@ -34,18 +34,18 @@ def setGlobalDebugLevel(level='info') :
|
|
|
34
34
|
|
|
35
35
|
class DEBUGGER:
|
|
36
36
|
def __init__(self
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
37
|
+
, name
|
|
38
|
+
, level='info',
|
|
39
|
+
fullSyntax=True,
|
|
40
|
+
onscreen=True,
|
|
41
|
+
log_rotation=3,
|
|
42
|
+
homePath=None,
|
|
43
|
+
id=getRandomKey(9) ,
|
|
44
|
+
global_debugger=None,
|
|
45
|
+
disable_log_write=False,
|
|
46
|
+
file_name=None,
|
|
47
|
+
seperate_files=True
|
|
48
|
+
):
|
|
49
49
|
env = custom_env()
|
|
50
50
|
setupEnvironment( 'debugger' )
|
|
51
51
|
debugger_on_screen = env.get('debugger_on_screen' , True)
|
|
@@ -116,6 +116,8 @@ class DEBUGGER:
|
|
|
116
116
|
self.logger.error(f'EASY_UTILS_DEBUG_LEVEL ENV must be one of [info,debug,warning,error,critical] | Current Env Variable Is "{EASY_UTILS_DEBUG_LEVEL}". Skipping ')
|
|
117
117
|
else :
|
|
118
118
|
self.set_level(EASY_UTILS_DEBUG_LEVEL)
|
|
119
|
+
if os.environ.get("EASY_UTILS_ENABLE_PRINT" , False ).lower() == 'true' :
|
|
120
|
+
self.enable_print()
|
|
119
121
|
|
|
120
122
|
def switch_full_syntax(self , toggle) :
|
|
121
123
|
if toggle :
|
|
@@ -241,7 +243,9 @@ class DEBUGGER:
|
|
|
241
243
|
else :
|
|
242
244
|
self.set_level(EASY_UTILS_DEBUG_LEVEL)
|
|
243
245
|
self.updateGlobalHomePath()
|
|
244
|
-
|
|
246
|
+
if os.environ.get("EASY_UTILS_ENABLE_PRINT" , False ).lower() == 'true' :
|
|
247
|
+
self.enable_print()
|
|
248
|
+
sleep(5)
|
|
245
249
|
|
|
246
250
|
def close(self) :
|
|
247
251
|
try :
|
|
@@ -261,7 +265,6 @@ class DEBUGGER:
|
|
|
261
265
|
self.homePath = path
|
|
262
266
|
else :
|
|
263
267
|
self.homePath = os.path.join(os.getcwd() , 'debug')
|
|
264
|
-
|
|
265
268
|
if not os.path.exists( self.homePath ) :
|
|
266
269
|
try :
|
|
267
270
|
os.makedirs( self.homePath )
|
|
@@ -284,13 +287,10 @@ class DEBUGGER:
|
|
|
284
287
|
('error', logging.ERROR),
|
|
285
288
|
('critical', logging.CRITICAL),
|
|
286
289
|
]
|
|
287
|
-
|
|
288
290
|
# Optional custom level
|
|
289
291
|
if hasattr(logging, 'SCREEN'):
|
|
290
292
|
levels_order.append(('screen', logging.SCREEN))
|
|
291
|
-
|
|
292
293
|
current_level = self.logger.level
|
|
293
|
-
|
|
294
294
|
# Return all levels with numeric value >= current_level
|
|
295
295
|
return [name for name, value in levels_order if value >= current_level]
|
|
296
296
|
|
easy_utils_dev/ne1830PSS.py
CHANGED
|
@@ -711,25 +711,20 @@ class PSS1830 :
|
|
|
711
711
|
def disconnect(self) :
|
|
712
712
|
self.logger.debug(f'Disconnecting from PSS ...')
|
|
713
713
|
try :
|
|
714
|
-
self.logger.debug(f'Disconnecting from PSS [gmre , cli ] ...')
|
|
715
714
|
self.close_cliconnection()
|
|
716
715
|
except :
|
|
717
716
|
pass
|
|
718
717
|
|
|
719
718
|
try :
|
|
720
|
-
self.logger.debug(f'Disconnecting from PSS [cient.channel] ...')
|
|
721
719
|
self.client.close()
|
|
722
720
|
except :
|
|
723
721
|
pass
|
|
724
722
|
|
|
725
723
|
try :
|
|
726
|
-
self.logger.debug(f'Disconnecting from PSS [ssh] ...')
|
|
727
724
|
self.close_ssh()
|
|
728
725
|
except :
|
|
729
726
|
pass
|
|
730
|
-
self.logger.info('Disconnecting from pss completed')
|
|
731
727
|
try :
|
|
732
|
-
self.logger.debug(f'Disconnecting from PSS [logger] ...')
|
|
733
728
|
self.logger.close()
|
|
734
729
|
del self.logger
|
|
735
730
|
except :
|
easy_utils_dev/wsnoclib.py
CHANGED
|
@@ -28,9 +28,10 @@ class KafkaConfig :
|
|
|
28
28
|
self.nsp_cert = None
|
|
29
29
|
self.ca_cert = None
|
|
30
30
|
self.kafka_api_port =8443
|
|
31
|
-
self.kafka_refresh_period =
|
|
31
|
+
self.kafka_refresh_period = 1500
|
|
32
32
|
self.kafka_nsp_os_name = None
|
|
33
|
-
self.kafka_subscription_deleted = False
|
|
33
|
+
self.kafka_subscription_deleted = False
|
|
34
|
+
self.base_url = None
|
|
34
35
|
|
|
35
36
|
class WSNOCLIB :
|
|
36
37
|
def __init__(
|
|
@@ -269,15 +270,15 @@ class WSNOCLIB :
|
|
|
269
270
|
sftp.get('/tmp/nsp.pem' , f'{self.temp_dir}/nsp.pem')
|
|
270
271
|
sftp.get('/tmp/nsp.key' , f'{self.temp_dir}/nsp.key')
|
|
271
272
|
self.kafka.ca_cert = f'{self.temp_dir}/nsp.pem'
|
|
272
|
-
baseUrl = None
|
|
273
|
+
baseUrl = self.kafka.base_url = None
|
|
273
274
|
port = self.kafka.kafka_api_port
|
|
274
275
|
else :
|
|
275
276
|
self.logger.debug(f"Working on external NSP to copy the files ...")
|
|
276
277
|
CertLoc = f"""find /var/lib/kubelet/pods/ -type d -path "*/volumes/kubernetes.io~empty-dir/shared-tls-volume" | head -n1"""
|
|
277
278
|
CertLoc = self.ssh.ssh_execute(CertLoc).replace('\n','')
|
|
278
279
|
self.logger.debug(f"CertLoc Host: {CertLoc}")
|
|
279
|
-
baseUrl = f'https://{nsp_address}'
|
|
280
|
-
port = None
|
|
280
|
+
baseUrl = self.kafka.base_url = f'https://{nsp_address}'
|
|
281
|
+
port = self.kafka.kafka_port = None
|
|
281
282
|
if len(CertLoc) > 15 :
|
|
282
283
|
self.logger.debug(f"Copying cert files from nsp host machine ....")
|
|
283
284
|
copies = [
|
|
@@ -291,7 +292,7 @@ class WSNOCLIB :
|
|
|
291
292
|
self.kafka.ca_cert = f'{self.temp_dir}/cert.pem'
|
|
292
293
|
else :
|
|
293
294
|
self.logger.error(f'invalid shared volume location: {CertLoc}')
|
|
294
|
-
raise Exception(f'invalid
|
|
295
|
+
raise Exception(f'invalid shared volume location')
|
|
295
296
|
if sftp :
|
|
296
297
|
sftp.close()
|
|
297
298
|
if len(severities) == 0 :
|
|
@@ -336,7 +337,7 @@ class WSNOCLIB :
|
|
|
336
337
|
self.kafka.response = response
|
|
337
338
|
self.kafka.topicId = response['response']['data']['topicId']
|
|
338
339
|
if auto_refresh :
|
|
339
|
-
start_thread(target=self.renewSubscription
|
|
340
|
+
start_thread(target=self.renewSubscription)
|
|
340
341
|
self.killed=False
|
|
341
342
|
else :
|
|
342
343
|
self.logger.error(f"Failed to create kafka subscription.")
|
|
@@ -347,7 +348,7 @@ class WSNOCLIB :
|
|
|
347
348
|
def change_kafka_refresh_period(self , period : int =3000) :
|
|
348
349
|
self.kafka.kafka_refresh_period = period
|
|
349
350
|
|
|
350
|
-
def renewSubscription(self
|
|
351
|
+
def renewSubscription(self) :
|
|
351
352
|
while True :
|
|
352
353
|
try :
|
|
353
354
|
sleep(self.kafka.kafka_refresh_period)
|
|
@@ -356,12 +357,13 @@ class WSNOCLIB :
|
|
|
356
357
|
self.logger.info('Renewing subscription ...')
|
|
357
358
|
self.kafka.refresh_inprogress = True
|
|
358
359
|
URL = f"/nbi-notification/api/v1/notifications/subscriptions/{self.kafka.subscriptionId}/renewals"
|
|
359
|
-
self.post(
|
|
360
|
+
response = self.post(
|
|
360
361
|
url=URL,
|
|
361
|
-
|
|
362
|
-
port=kafka_port,
|
|
362
|
+
baseUrl=self.kafka.base_url,
|
|
363
|
+
port=self.kafka.kafka_port,
|
|
363
364
|
)
|
|
364
|
-
self.logger.info(f'Renewing subscription
|
|
365
|
+
self.logger.info(f'Renewing subscription [{response.status_code}]')
|
|
366
|
+
self.logger.info(f'Renewing subscription Response: [{response.text}]')
|
|
365
367
|
except Exception as error :
|
|
366
368
|
self.logger.error(f'failed to renew subscription. {error}')
|
|
367
369
|
self.logger.debug(traceback.format_exc())
|
|
@@ -504,6 +506,11 @@ class WSNOCLIB :
|
|
|
504
506
|
if r.status_code not in [200,201,206]:
|
|
505
507
|
self.logger.error(f'request [POST]: {url} status code: [{r.status_code}]')
|
|
506
508
|
return False
|
|
509
|
+
try :
|
|
510
|
+
if 'sign in' in r.text.lower() :
|
|
511
|
+
raise Exception("WSNOC Authentication Failed")
|
|
512
|
+
except :
|
|
513
|
+
pass
|
|
507
514
|
if return_json :
|
|
508
515
|
return r.json()
|
|
509
516
|
return r
|
|
@@ -8,7 +8,7 @@ easy_utils_dev/brevosmtp.py,sha256=A5n13MnVQnDuSjYQ91-MLftmqfg3VQ-36Zqw9OtoTB4,3
|
|
|
8
8
|
easy_utils_dev/check_license.py,sha256=C8vKXwaduoF3FSuDJ-J_j5jStNNyUdS-mOdLNfsCjmc,4825
|
|
9
9
|
easy_utils_dev/cplib.py,sha256=TPCFNQh4jYSGsm_CrMdivmD3G5B1rprco2O4B0BSnzo,19570
|
|
10
10
|
easy_utils_dev/custom_env.py,sha256=vxrjikpSNJlKfoBE-ef88UExlpXucUe-HcwHMn3gfB0,1510
|
|
11
|
-
easy_utils_dev/debugger.py,sha256=
|
|
11
|
+
easy_utils_dev/debugger.py,sha256=3ENr91vsWoHKFSa2YR9P-H7GJhgZKAfOr4NQFKp0Shg,18311
|
|
12
12
|
easy_utils_dev/easy_oracle.py,sha256=Jyc3HSl6eyLayjS8NoE4GOaf8otQlonR5_qOg2h1DjE,2157
|
|
13
13
|
easy_utils_dev/encryptor.py,sha256=f5Zjn0DGtXCyhldpVnBtfcTb4h4Wp0eQPHusEYwIags,1512
|
|
14
14
|
easy_utils_dev/exceptions.py,sha256=6eTYBa8AIXC0wI6zgkqsLreSXyPf459G-ToO7ziQuK4,1669
|
|
@@ -16,7 +16,7 @@ easy_utils_dev/filescompressor.py,sha256=iKAtLfkEXOuvvqF56jH0D9KAAeZ7iaa_sRaJnyY
|
|
|
16
16
|
easy_utils_dev/generate_license.py,sha256=fr_eoSjKCmDmAEBc6FWFXZxGQOHx9XO6hEK8dcyVUlA,3319
|
|
17
17
|
easy_utils_dev/keycloakapi.py,sha256=eHnc5fSC-YVYQU6EFs3ehutITnkHNJktx5BH_hpfxwM,7116
|
|
18
18
|
easy_utils_dev/lralib.py,sha256=3IjaZbTK_hhyETNP7eALsFyQjWM-jb2rg-rjvgdDDIc,6328
|
|
19
|
-
easy_utils_dev/ne1830PSS.py,sha256=
|
|
19
|
+
easy_utils_dev/ne1830PSS.py,sha256=WWfSMQLrQgjShIebwjhxovuRq30OsoH5zQkWJZcIjjo,70103
|
|
20
20
|
easy_utils_dev/nsp_kafka.py,sha256=oPJUk8GYMLjqXP_H0EbXQwLkpBxf_uGr6l2QtZO1cc8,10725
|
|
21
21
|
easy_utils_dev/openid_server.py,sha256=_odeg6omuizSUEJLtbAVn2PnG9vkcUAQ7rU3K5yXk_I,2545
|
|
22
22
|
easy_utils_dev/optics_utils.py,sha256=G-hFX2iiUCSJjk7BICBRGvVoDq0IBONLZSjagoB5FMg,964
|
|
@@ -26,10 +26,10 @@ easy_utils_dev/temp_memory.py,sha256=gfC-izYw8Sg1DD5iOdL8R5-fdB5RK0qkXZie9WmFjPA
|
|
|
26
26
|
easy_utils_dev/uiserver.py,sha256=aU4RRuOCg31hWDsup4BI5WDiSy7hffB-UZYXzwz5-wI,6811
|
|
27
27
|
easy_utils_dev/utils.py,sha256=BmVnbxc336c6WTeDFcEHN6Mavt7fJrIEyK4GXODV3gI,13345
|
|
28
28
|
easy_utils_dev/winserviceapi.py,sha256=2ZP6jaSt1-5vEJYXqwBhwX-1-eQ3V3YzntsoOoko2cw,18804
|
|
29
|
-
easy_utils_dev/wsnoclib.py,sha256=
|
|
29
|
+
easy_utils_dev/wsnoclib.py,sha256=tC-RmjddaLpihPCRBLGC2RnRpFJqexhvExUr1KncoQM,29063
|
|
30
30
|
easy_utils_dev/wsselib.py,sha256=YweScnoAAH_t29EeIjBpkQ6HtX0Rp9mQudRsRce2SE8,7920
|
|
31
|
-
easy_utils_dev-2.
|
|
32
|
-
easy_utils_dev-2.
|
|
33
|
-
easy_utils_dev-2.
|
|
34
|
-
easy_utils_dev-2.
|
|
35
|
-
easy_utils_dev-2.
|
|
31
|
+
easy_utils_dev-2.125.dist-info/METADATA,sha256=NOtO0hyknj91mVqerN1MGks8mjQWI2Evry-Qi2vSDIw,537
|
|
32
|
+
easy_utils_dev-2.125.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
33
|
+
easy_utils_dev-2.125.dist-info/license.dat,sha256=hTRbLnrYZdH7UOsZRYC3IntAhyUkUUXi4TuizI7gca4,74
|
|
34
|
+
easy_utils_dev-2.125.dist-info/top_level.txt,sha256=7vBsrpq7NmilkdU3YUvfd5iVDNBaT07u_-ut4F7zc7A,15
|
|
35
|
+
easy_utils_dev-2.125.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|