@@ -391,24 +391,24 @@ def _return_tuple_manipulate(func):
391391 def wrapped (self , * args , ** kwargs ):
392392 return_tuple = func (self , * args , ** kwargs )
393393 return_tuple = list (return_tuple )
394-
394+
395395 # Decode stdout
396396 stdout = codecs .decode (return_tuple [1 ], errors = 'ignore' )
397-
397+
398398 # Remove "Done" messages with surrounding newlines
399399 regex = r"(\r\n|\r|\n|)( Done)(\r\n|\r|\n)+"
400400 stdout = re .sub (regex , "" , stdout , 0 , re .UNICODE )
401-
401+
402402 # Remove Warning messages (multi-line)
403403 warning_regex = r"Warning: \[[\s\S]*?\]\s*"
404404 stdout = re .sub (warning_regex , "" , stdout , 0 , re .UNICODE )
405-
405+
406406 # Remove leading "]" characters that might remain
407407 stdout = re .sub (r"^\]\s*" , "" , stdout , re .MULTILINE )
408-
408+
409409 # Remove extra blank lines
410410 stdout = re .sub (r"\n\s*\n" , "\n " , stdout )
411-
411+
412412 # Try to extract JSON if present
413413 regex2 = r'{.*}'
414414 try :
@@ -418,15 +418,14 @@ def wrapped(self, *args, **kwargs):
418418 except (IndexError , AttributeError ):
419419 pass
420420 # If no match, use the cleaned stdout
421-
421+
422422 return_tuple [1 ] = stdout .encode () if isinstance (return_tuple [1 ], bytes ) else stdout
423423 return_tuple = tuple (return_tuple )
424424 return return_tuple
425425 return wrapped
426426
427427
428428def _manipulate_cmd (func ):
429-
430429 @wraps (func )
431430 def wrapped (self , cmd , * args , ** kwargs ):
432431 # Adding the 'shell' command for the citrix adc cli
@@ -485,11 +484,11 @@ def put_file(self, in_path, out_path):
485484 Transfer a file from local to remote using piped method due to NetScaler limitations
486485 """
487486 display .vvv (u"PUT {0} TO {1}" .format (in_path , out_path ), host = self .host )
488-
487+
489488 # Force piped transfer for NetScaler
490489 # Save original transfer method
491490 original_method = self .get_option ('ssh_transfer_method' )
492-
491+
493492 try :
494493 # Temporarily set to piped
495494 self ._options ['ssh_transfer_method' ] = 'piped'
@@ -504,11 +503,11 @@ def fetch_file(self, in_path, out_path):
504503 Fetch a file from remote to local using piped method due to NetScaler limitations
505504 """
506505 display .vvv (u"FETCH {0} TO {1}" .format (in_path , out_path ), host = self .host )
507-
506+
508507 # Force piped transfer for NetScaler
509508 # Save original transfer method
510509 original_method = self .get_option ('ssh_transfer_method' )
511-
510+
512511 try :
513512 # Temporarily set to piped
514513 self ._options ['ssh_transfer_method' ] = 'piped'
0 commit comments