aboutsummaryrefslogtreecommitdiff
path: root/bugzilla
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2017-07-18 03:42:05 +0000
committerMike Crute <mike@crute.us>2017-07-18 03:42:09 +0000
commit2867e66a0169073e8e4a604e45f3ebf465ecf2ef (patch)
tree38f4f56baca87ef152054f30b2944fbbb0594bfc /bugzilla
parentb5a4f422d4709c390e47d54be1b17772dbf09344 (diff)
downloaddockerfiles-2867e66a0169073e8e4a604e45f3ebf465ecf2ef.tar.bz2
dockerfiles-2867e66a0169073e8e4a604e45f3ebf465ecf2ef.tar.xz
dockerfiles-2867e66a0169073e8e4a604e45f3ebf465ecf2ef.zip
Add POC bugzilla mail fetcher
Diffstat (limited to 'bugzilla')
-rwxr-xr-xbugzilla/bin/bugzilla_fetch.py24
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
3import boto3
4import subprocess
5
6
7client = boto3.client("s3")
8bucket = "mcrute-bugs-emails"
9email_bin = "/var/www/html/bugzilla/email_in.pl"
10items = client.list_objects_v2(Bucket=bucket)
11
12
13for 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)