#NEWLINE# def destroy( name , call = None ) : #NEWLINE# #INDENT# "\n    destroy a machine by name\n\n    :param name: name given to the machine\n    :param call: call value in this case is 'action'\n    :return: array of booleans , true if successfully stopped and true if\n             successfully removed\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt-cloud -d vm_name\n\n    " #NEWLINE# if ( call == 'function' ) : #NEWLINE# #INDENT# raise SaltCloudSystemExit ( 'The destroy action must be called with -d, --destroy, -a or --action.' ) #NEWLINE# #UNINDENT# salt . utils . cloud . fire_event ( 'event' , 'destroying instance' , 'salt/cloud/{0}/destroying' . format ( name ) , { #NEWLINE# #INDENT# 'name' : name , #NEWLINE# #UNINDENT# } , transport = __opts__ [ 'transport' ] ) #NEWLINE# datacenter_id = get_datacenter_id ( ) #NEWLINE# conn = get_conn ( ) #NEWLINE# node = get_node ( conn , name ) #NEWLINE# conn . delete_server ( datacenter_id = datacenter_id , server_id = node [ 'id' ] ) #NEWLINE# salt . utils . cloud . fire_event ( 'event' , 'destroyed instance' , 'salt/cloud/{0}/destroyed' . format ( conn ) , { #NEWLINE# #INDENT# 'name' : name , #NEWLINE# #UNINDENT# } , transport = __opts__ [ 'transport' ] ) #NEWLINE# if ( __opts__ . get ( 'update_cachedir' , False ) is True ) : #NEWLINE# #INDENT# salt . utils . cloud . delete_minion_cachedir ( name , __active_provider_name__ . split ( ':' ) [ 0 ] , __opts__ ) #NEWLINE# #UNINDENT# return True