diff options
author | Mike Crute <mike@crute.us> | 2017-07-18 03:42:05 +0000 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2017-07-18 03:42:09 +0000 |
commit | 2867e66a0169073e8e4a604e45f3ebf465ecf2ef (patch) | |
tree | 38f4f56baca87ef152054f30b2944fbbb0594bfc /bugzilla | |
parent | b5a4f422d4709c390e47d54be1b17772dbf09344 (diff) | |
download | dockerfiles-2867e66a0169073e8e4a604e45f3ebf465ecf2ef.tar.bz2 dockerfiles-2867e66a0169073e8e4a604e45f3ebf465ecf2ef.tar.xz dockerfiles-2867e66a0169073e8e4a604e45f3ebf465ecf2ef.zip |
Add POC bugzilla mail fetcher
Diffstat (limited to 'bugzilla')
-rwxr-xr-x | bugzilla/bin/bugzilla_fetch.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/bugzilla/bin/bugzilla_fetch.py b/bugzilla/bin/bugzilla_fetch.py new file mode 100755 index 0000000..b4a9805 --- /dev/null +++ b/bugzilla/bin/bugzilla_fetch.py | |||
@@ -0,0 +1,24 @@ | |||
1 | #!/usr/bin/env python | ||
2 | |||
3 | import boto3 | ||
4 | import subprocess | ||
5 | |||
6 | |||
7 | client = boto3.client("s3") | ||
8 | bucket = "mcrute-bugs-emails" | ||
9 | email_bin = "/var/www/html/bugzilla/email_in.pl" | ||
10 | items = client.list_objects_v2(Bucket=bucket) | ||
11 | |||
12 | |||
13 | for item in items["Contents"]: | ||
14 | key = item["Key"] | ||
15 | |||
16 | if key == "AMAZON_SES_SETUP_NOTIFICATION": | ||
17 | continue | ||
18 | |||
19 | body = client.get_object(Bucket=bucket, Key=key)["Body"] | ||
20 | |||
21 | cmd = subprocess.Popen([email_bin], stdin=subprocess.PIPE) | ||
22 | cmd.communicate(body.read()) | ||
23 | |||
24 | client.delete_object(Bucket=bucket, Key=key) | ||