Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#624] Add OutgoingMessage#mail_server_logs #3039

Merged
merged 6 commits into from
Feb 23, 2016

Conversation

garethrees
Copy link
Member

Part of #624

Basic framework for collecting exim MTA logs for a specific OutgoingMessage.

Based on my current understanding, the last bits to add to get an OutgoingMessage#delivered? value are:

  def delivered?
    delivery_message ? true : false
  end

  def delivery_message
    m = delivery_line.match(/C="(.*)"/i)
    m ? m[0] : nil
  end

  def delivery_line
    mail_server_logs.
      where("line ILIKE :mta AND line ILIKE :msgtype",
             mta: "%#{ mta_id.last }%", msgtype: "%=>%").
        last.
          line
  end

@garethrees
Copy link
Member Author

Marking as 5 - awaiting review for a first pass look. The specs are (sometimes) failing because of some sort of ordering issue (5a30cd3) but I don't t think its worth diving in to unless we're happy with the general progress of this.

I'm interested in edge cases that make mail_server_logs not produce the output you'd expect.

@crowbot
Copy link
Member

crowbot commented Feb 15, 2016

Looks good - I wonder if there's going to be some value in storing the association between the outgoing message and the log lines at this point - I think it might be easier to use this code to write some associations to the database and then iterate through them examining them than to try and do all that on the fly.

@garethrees
Copy link
Member Author

I wonder if there's going to be some value in storing the association between the outgoing message and the log lines

Made a note on the original ticket #624 (comment) to do this at a later stage once we've used the on-the-fly way to check a random sample of messages and logs.

@crowbot
Copy link
Member

crowbot commented Feb 23, 2016

👍 Looks good!

Returns the logged Message-IDs of an OutgoingMessage. This will be used
to find the MTA ID of the message.
Handle the santisation and creation in a single method call. Can use the
new method in specs.
Return the logged MTA IDs for an OutgoingMessage. Currently only
implemented for the exim MTA.

The specs could be dryed up, and  I think there's some more coverage we could
add by creating other log lines to ensure the correct ones are plucked from the
more complicated list.
Returns the MTA logs for an OutgoingMessage. Only implemented for exim.
@mysociety-pusher mysociety-pusher force-pushed the 624-outgoing-message-mail-server-logs branch from fccf96a to dab6213 Compare February 23, 2016 14:12
@mysociety-pusher mysociety-pusher merged commit dab6213 into develop Feb 23, 2016
@mysociety-pusher mysociety-pusher deleted the 624-outgoing-message-mail-server-logs branch February 23, 2016 14:35
@garethrees garethrees mentioned this pull request Jun 17, 2016
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants