easy-utils-dev 2.160__tar.gz → 2.162__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.
Files changed (42) hide show
  1. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/PKG-INFO +1 -1
  2. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/debugger.py +3 -2
  3. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/ne1830PSS.py +29 -16
  4. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/uiserver.py +1 -2
  5. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev.egg-info/PKG-INFO +1 -1
  6. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/setup.py +1 -1
  7. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/MANIFEST.in +0 -0
  8. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/EasySsh.py +0 -0
  9. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/Events.py +0 -0
  10. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/FastQueue.py +0 -0
  11. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/NameObject.py +0 -0
  12. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/__init__.py +0 -0
  13. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/abortable.py +0 -0
  14. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/brevosmtp.py +0 -0
  15. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/check_license.py +0 -0
  16. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/cplib.py +0 -0
  17. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/custom_env.py +0 -0
  18. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/easy_oracle.py +0 -0
  19. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/encryptor.py +0 -0
  20. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/ept.py +0 -0
  21. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/ept_sql/create_dirs.sql +0 -0
  22. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/ept_sql/create_ept_tables.sql +0 -0
  23. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/exceptions.py +0 -0
  24. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/filescompressor.py +0 -0
  25. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/generate_license.py +0 -0
  26. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/keycloakapi.py +0 -0
  27. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/lralib.py +0 -0
  28. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/nsp_kafka.py +0 -0
  29. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/openid_server.py +0 -0
  30. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/optics_utils.py +0 -0
  31. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/require_auth.py +0 -0
  32. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/simple_sqlite.py +0 -0
  33. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/temp_memory.py +0 -0
  34. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/utils.py +0 -0
  35. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/winserviceapi.py +0 -0
  36. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/wsnoclib.py +0 -0
  37. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev/wsselib.py +0 -0
  38. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev.egg-info/SOURCES.txt +0 -0
  39. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev.egg-info/dependency_links.txt +0 -0
  40. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev.egg-info/requires.txt +0 -0
  41. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/easy_utils_dev.egg-info/top_level.txt +0 -0
  42. {easy_utils_dev-2.160 → easy_utils_dev-2.162}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: easy_utils_dev
3
- Version: 2.160
3
+ Version: 2.162
4
4
  Keywords: python3
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Requires-Dist: psutil
@@ -42,8 +42,9 @@ class CensorFilter(logging.Filter):
42
42
  self.ip_regex = re.compile(r"\b\d{1,3}(?:\.\d{1,3}){3}\b")
43
43
 
44
44
  def add_censored_string(self, value):
45
- if value:
46
- self.censored_strings.append(str(value))
45
+ if value :
46
+ if str(value) not in self.censored_strings :
47
+ self.censored_strings.append(str(value))
47
48
 
48
49
  def filter(self, record):
49
50
  msg = record.getMessage()
@@ -46,6 +46,7 @@ class PSS1830 :
46
46
  self.requireAknow=None
47
47
  self.gmre = False
48
48
  self.isGmreLogin=False
49
+ self.censor_strings = False
49
50
  self.gmrePrompt=None
50
51
  self.connectionMethod=None
51
52
  self.jump_transport=None
@@ -61,6 +62,7 @@ class PSS1830 :
61
62
  self.screenBuffer = ""
62
63
  self.main_controller_client : paramiko.SSHClient = None
63
64
  self.standby_controller_client : paramiko.SSHClient = None
65
+ self.verify_node_reachability_by_ping = False
64
66
  self.create_jumphost = self.nfmtJumpServer
65
67
  if self.auto_enable_tcp_forward :
66
68
  self.logger.info(f'***WARNING*** : Auto enable tcp forwarding is enabled. This will allow tcp fowarding in target machine then restarting sshd service agent.')
@@ -439,6 +441,8 @@ class PSS1830 :
439
441
 
440
442
 
441
443
  def verify_node_reachability(self , neip ) :
444
+ if not self.verify_node_reachability_by_ping :
445
+ return True
442
446
  self.logger.debug(f"verify_node_reachability from jhost={self.isjumpserver}")
443
447
  if self.isjumpserver == False :
444
448
  if not pingAddress(neip) :
@@ -509,26 +513,32 @@ class PSS1830 :
509
513
  return client
510
514
 
511
515
  def port_switcher( self , mode ) :
512
- if mode == 'direct_cli' or self.sim:
513
- port = 22
516
+ if self.sim :
517
+ return 22 , 0
518
+ if mode == 'direct_cli':
519
+ # real be
520
+ # root cli@19.19,19,9
521
+ return 22 , 1
514
522
  else:
515
- port = 5122
516
- if mode in ('cli', 'ssh'):
517
- port = 5122
518
- return port
523
+ # real NE
524
+ # ssh root@10.0.0.1 -p 5122
525
+ return 5122 , 2
519
526
 
520
527
  def _connect(self , mode='cli' , neip=None , rootpw='QUx1MTIj') :
521
528
  self.client = self.createClient()
522
- port = self.port_switcher(mode)
529
+ port , reason = self.port_switcher(mode)
530
+ self.logger.debug(f"Auto switch to port : {port} reason : {reason}")
523
531
  try :
524
532
  jhostserver = self.createJhostInstance(neip , port)
525
533
  self.verify_node_reachability(neip)
526
534
  ok = False
527
- self.logger.debug(f"connecting to {neip} with mode={mode} and port={port}")
535
+ self.logger.debug(f"connecting to {mode}::{neip}:{port} ")
528
536
  if mode == 'direct_cli' :
537
+ self.logger.debug("Mode direct_cli detected")
529
538
  self.client.connect(neip , port , "cli" , '' , sock=jhostserver)
530
539
  ok = True
531
540
  elif mode == 'cli' or mode == 'ssh' :
541
+ self.logger.debug("Mode cli or ssh detected")
532
542
  self.client.connect( neip , port , "root" , rootpw , sock=jhostserver )
533
543
  ok = True
534
544
  self.logger.debug(f"client={self.client} ok={ok} port={port} mode={mode}")
@@ -575,12 +585,14 @@ class PSS1830 :
575
585
  if pw == 'YWRtaW4=' :
576
586
  self.logger.debug(f"pw specified is obfuscated. Switch to plain text ...")
577
587
  pw = self.encryptor.dec_base64(pw)
578
- self.logger.debug(f"pw specified is obfuscated. Switch to plain text result {pw}")
579
588
  if rootpw == 'QUx1MTIj' :
580
589
  self.logger.debug(f"rootpw specified is obfuscated. Switch to plain text ...")
581
590
  rootpw = self.encryptor.dec_base64(rootpw)
582
- self.logger.debug(f"pw specified is obfuscated. Switch to plain text result {rootpw}")
583
- self.logger.debug(f'Opening SSH connection to NE {neip} mode={mode}, resetRequired={resetRequired}')
591
+ if self.censor_strings :
592
+ self.logger.censor.add_censored_string(str(rootpw))
593
+ self.logger.censor.add_censored_string(str(neip))
594
+ self.logger.censor.add_censored_string(str(pw))
595
+ self.logger.debug(f'Opening SSH connection to NE {mode}::{neip} -resetRequired={resetRequired}')
584
596
  self.cliUser = user
585
597
  self.mode = mode
586
598
  self.cliPw = pw
@@ -602,19 +614,18 @@ class PSS1830 :
602
614
  auto_disable_paging={auto_disable_paging}
603
615
  connect_to_standby_ec={connect_to_standby_ec}
604
616
  return_channel={return_channel}
605
- sim={self.sim}
617
+ isSim={self.sim}
606
618
  --------------------------------------------------------
607
619
  """)
608
620
  if connect_to_standby_ec and mode != 'ssh' :
609
621
  self.logger.error(f"connect_to_standby_ec is only supported for ssh mode. since PSS CLI only valid on Active Controller")
610
622
  raise exceptions.StandbyEcConnectionModeNotSupported('connect_to_standby_ec is only supported for cli/ssh mode.')
611
623
  # another method is to inject the jumpserver inside the connect itself.
612
- if jumpserver != None and self.jumpServerInSameInstance == False :
624
+ if jumpserver != None and self.jumpServerInSameInstance == False :
613
625
  self.isjumpserver = True
614
626
  self.jumpserver = jumpserver
615
627
  self.nfmtip = jumpserver.nfmtip
616
- self.connected = True
617
- # self.verify_node_reachability(neip)
628
+ # self.connected = True
618
629
  self.maxConnectAttempt = maxAttemps = maxReconnectAttemp
619
630
  self.currentConnectAttempt=0
620
631
  for i in range(maxAttemps) :
@@ -634,12 +645,14 @@ class PSS1830 :
634
645
  self.connected=True
635
646
  self.logger.debug(f'''\n
636
647
  --------------------------------------------------------
637
- Network Element - connected - {neip}
648
+ Network Element - connected - {mode}::{neip}:{self.port}
638
649
  ---------------------------------------------------------
639
650
  \n''')
640
651
  if mode == 'ssh' :
641
652
  self.logger.debug(f"ssh mode detected. returning self.client object with no switch_to_cli_shell()")
642
653
  self.connected = True
654
+ if return_channel :
655
+ return self.client , None
643
656
  return self.client
644
657
  self.channel = self.switch_to_cli_shell()
645
658
  self.logger.debug(f'set timeout in rcv channel to {self.TIMEOUT}')
@@ -248,7 +248,6 @@ class UISERVER :
248
248
  if request :
249
249
  return Response().ok(
250
250
  message='Result of async request found' ,
251
- internalid=id ,
252
251
  result=request.result ,
253
252
  in_progress=request.in_progress ,
254
253
  async_request=request.async_request ,
@@ -427,7 +426,7 @@ class UISERVER :
427
426
  def _wait_th(self , t ) :
428
427
  # t.join()
429
428
  while True :
430
- time.sleep(10)
429
+ time.sleep(36000)
431
430
 
432
431
 
433
432
  def thrStartUi(self , suppress_prints=True) :
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: easy_utils_dev
3
- Version: 2.160
3
+ Version: 2.162
4
4
  Keywords: python3
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Requires-Dist: psutil
@@ -1,6 +1,6 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
- VERSION = '2.160'
3
+ VERSION = '2.162'
4
4
 
5
5
  # Setting up
6
6
  setup(
File without changes