@@ -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,13 @@ 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
427-
428427def _manipulate_cmd (func ):
429-
430428 @wraps (func )
431429 def wrapped (self , cmd , * args , ** kwargs ):
432430 # Adding the 'shell' command for the citrix adc cli
@@ -438,7 +436,6 @@ def wrapped(self, cmd, *args, **kwargs):
438436 return (returncode , stdout , stderr )
439437 return wrapped
440438
441-
442439def calculate_become_methods ():
443440 all_methods = []
444441 for item in become_loader .all ():
@@ -449,7 +446,6 @@ def calculate_become_methods():
449446
450447 return frozenset (all_methods )
451448
452-
453449class Connection (ConnectionSsh ):
454450 ''' ssh based connections '''
455451
@@ -485,11 +481,11 @@ def put_file(self, in_path, out_path):
485481 Transfer a file from local to remote using piped method due to NetScaler limitations
486482 """
487483 display .vvv (u"PUT {0} TO {1}" .format (in_path , out_path ), host = self .host )
488-
484+
489485 # Force piped transfer for NetScaler
490486 # Save original transfer method
491487 original_method = self .get_option ('ssh_transfer_method' )
492-
488+
493489 try :
494490 # Temporarily set to piped
495491 self ._options ['ssh_transfer_method' ] = 'piped'
@@ -504,11 +500,11 @@ def fetch_file(self, in_path, out_path):
504500 Fetch a file from remote to local using piped method due to NetScaler limitations
505501 """
506502 display .vvv (u"FETCH {0} TO {1}" .format (in_path , out_path ), host = self .host )
507-
503+
508504 # Force piped transfer for NetScaler
509505 # Save original transfer method
510506 original_method = self .get_option ('ssh_transfer_method' )
511-
507+
512508 try :
513509 # Temporarily set to piped
514510 self ._options ['ssh_transfer_method' ] = 'piped'
0 commit comments