#NEWLINE# def uninstall( self , params ) : #NEWLINE# #INDENT# process = subprocess . Popen ( [ 'powershell.exe' , '-Command' , 'Stop-Service' , '-Name' , 'codedeployagent' ] , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) #NEWLINE# ( output , error ) = process . communicate ( ) #NEWLINE# not_found = "Cannot find any service with service name 'codedeployagent'" #NEWLINE# if ( process . returncode == 0 ) : #NEWLINE# #INDENT# self . _remove_agent ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not_found not in error ) : #NEWLINE# #INDENT# raise RuntimeError ( 'Failed to stop the AWS CodeDeploy Agent:\n{0}' . format ( error ) )