@@ -352,21 +352,18 @@ def save_cached_creds(token_data, bless_config):
352352def ssh_agent_remove_bless (identity_file ):
353353 DEVNULL = open (os .devnull , 'w' )
354354 try :
355- current = subprocess .check_output (['ssh-add' , '-l' ]).decode ('UTF-8' )
356- match = re .search (re .escape (identity_file ), current )
357- if match :
358- subprocess .check_call (
359- ['ssh-add' , '-d' , identity_file ], stderr = DEVNULL )
355+ subprocess .check_call (
356+ ['ssh-add' , '-d' , identity_file ], stderr = DEVNULL )
360357 except subprocess .CalledProcessError :
361358 logging .debug (
362359 "Non-zero exit from ssh-add, are there no identities in the current agent?" )
363360
364361
365362def ssh_agent_add_bless (identity_file ):
366363 DEVNULL = open (os .devnull , 'w' )
367- subprocess . check_call ([ 'ssh-add' , identity_file ], stderr = DEVNULL )
368- current = subprocess .check_output (['ssh-add' , '-l' ]). decode ( 'UTF-8' )
369- if not re . search ( re . escape ( identity_file ), current ) :
364+ try :
365+ subprocess .check_call (['ssh-add' , identity_file ], stderr = DEVNULL )
366+ except :
370367 logging .debug ("Could not add '{}' to ssh-agent" .format (identity_file ))
371368 sys .stderr .write (
372369 "Couldn't add identity to ssh-agent" )
0 commit comments