We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
c7n_mailer, AWS not installing Lambda, no logs, no errors
I have tried to setup/install the c7n_mailer lambda on our AWS account according to the docs.  I have tried it from my Mac and from Docker Images (in a Jenkins pipeline) to no avail. The kicker is I am not getting any error, or output. Is there anything I can look at to see if I have an issue from my end our something on the AWS account.  This is the command I am running:
```
c7n-mailer --config mailer.yml --update-lambda
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `tools/c7n_mailer/c7n_mailer/deploy.py`
Content:
```
1 # Copyright 2016-2017 Capital One Services, LLC
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 from __future__ import absolute_import, division, print_function, unicode_literals
15 
16 import copy
17 import json
18 import os
19 
20 from c7n.mu import (
21     CloudWatchEventSource,
22     LambdaFunction,
23     LambdaManager,
24     PythonPackageArchive)
25 
26 
27 entry_source = """\
28 import logging
29 
30 from c7n_mailer import handle
31 
32 logger = logging.getLogger('custodian.mailer')
33 log_format = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
34 logging.basicConfig(level=logging.INFO, format=log_format)
35 logging.getLogger('botocore').setLevel(logging.WARNING)
36 
37 def dispatch(event, context):
38     return handle.start_c7n_mailer(logger)
39 """
40 
41 
42 def get_archive(config):
43     archive = PythonPackageArchive(modules=[
44         'c7n_mailer',
45         # core deps
46         'jinja2', 'markupsafe', 'ruamel', 'ldap3', 'pyasn1', 'redis',
47         # for other dependencies
48         'pkg_resources',
49         # transport datadog - recursive deps
50         'datadog', 'simplejson', 'decorator',
51         # requests (recursive deps), needed by datadog, slackclient, splunk
52         'requests', 'urllib3', 'idna', 'chardet', 'certifi',
53         # used by splunk; also dependencies of c7n itself
54         'jsonpointer', 'jsonpatch'])
55 
56     for d in set(config['templates_folders']):
57         if not os.path.exists(d):
58             continue
59         for t in [f for f in os.listdir(d) if os.path.splitext(f)[1] == '.j2']:
60             with open(os.path.join(d, t)) as fh:
61                 archive.add_contents('msg-templates/%s' % t, fh.read())
62 
63     function_config = copy.deepcopy(config)
64     function_config['templates_folders'] = ['msg-templates/']
65     archive.add_contents('config.json', json.dumps(function_config))
66     archive.add_contents('periodic.py', entry_source)
67 
68     archive.close()
69     return archive
70 
71 
72 def provision(config, session_factory):
73     func_config = dict(
74         name=config.get('lambda_name', 'cloud-custodian-mailer'),
75         description=config.get('lambda_description', 'Cloud Custodian Mailer'),
76         tags=config.get('lambda_tags', {}),
77         handler='periodic.dispatch',
78         runtime=config['runtime'],
79         memory_size=config['memory'],
80         timeout=config['timeout'],
81         role=config['role'],
82         subnets=config['subnets'],
83         security_groups=config['security_groups'],
84         dead_letter_config=config.get('dead_letter_config', {}),
85         events=[
86             CloudWatchEventSource(
87                 {'type': 'periodic',
88                  'schedule': config.get('lambda_schedule', 'rate(5 minutes)')},
89                 session_factory)
90         ])
91 
92     archive = get_archive(config)
93     func = LambdaFunction(func_config, archive)
94     manager = LambdaManager(session_factory)
95     manager.publish(func)
96
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/tools/c7n_mailer/c7n_mailer/deploy.py b/tools/c7n_mailer/c7n_mailer/deploy.py
--- a/tools/c7n_mailer/c7n_mailer/deploy.py
+++ b/tools/c7n_mailer/c7n_mailer/deploy.py
@@ -14,6 +14,7 @@
 from __future__ import absolute_import, division, print_function, unicode_literals
 
 import copy
+import logging
 import json
 import os
 
@@ -24,6 +25,8 @@
     PythonPackageArchive)
 
 
+log = logging.getLogger('custodian-mailer')
+
 entry_source = """\
 import logging
 
@@ -91,5 +94,6 @@
 
     archive = get_archive(config)
     func = LambdaFunction(func_config, archive)
+    log.info("Provisioning mailer lambda %s" % (session_factory().region_name))
     manager = LambdaManager(session_factory)
     manager.publish(func)

{"golden_diff": "diff --git a/tools/c7n_mailer/c7n_mailer/deploy.py b/tools/c7n_mailer/c7n_mailer/deploy.py\n--- a/tools/c7n_mailer/c7n_mailer/deploy.py\n+++ b/tools/c7n_mailer/c7n_mailer/deploy.py\n@@ -14,6 +14,7 @@\n from __future__ import absolute_import, division, print_function, unicode_literals\n \n import copy\n+import logging\n import json\n import os\n \n@@ -24,6 +25,8 @@\n     PythonPackageArchive)\n \n \n+log = logging.getLogger('custodian-mailer')\n+\n entry_source = \"\"\"\\\n import logging\n \n@@ -91,5 +94,6 @@\n \n     archive = get_archive(config)\n     func = LambdaFunction(func_config, archive)\n+    log.info(\"Provisioning mailer lambda %s\" % (session_factory().region_name))\n     manager = LambdaManager(session_factory)\n     manager.publish(func)\n", "issue": "c7n_mailer, AWS not installing Lambda, no logs, no errors\nI have tried to setup/install the c7n_mailer lambda on our AWS account according to the docs.  I have tried it from my Mac and from Docker Images (in a Jenkins pipeline) to no avail. The kicker is I am not getting any error, or output. Is there anything I can look at to see if I have an issue from my end our something on the AWS account.  This is the command I am running:\r\n```\r\nc7n-mailer --config mailer.yml --update-lambda\r\n```\n", "before_files": [{"content": "# Copyright 2016-2017 Capital One Services, LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport copy\nimport json\nimport os\n\nfrom c7n.mu import (\n    CloudWatchEventSource,\n    LambdaFunction,\n    LambdaManager,\n    PythonPackageArchive)\n\n\nentry_source = \"\"\"\\\nimport logging\n\nfrom c7n_mailer import handle\n\nlogger = logging.getLogger('custodian.mailer')\nlog_format = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'\nlogging.basicConfig(level=logging.INFO, format=log_format)\nlogging.getLogger('botocore').setLevel(logging.WARNING)\n\ndef dispatch(event, context):\n    return handle.start_c7n_mailer(logger)\n\"\"\"\n\n\ndef get_archive(config):\n    archive = PythonPackageArchive(modules=[\n        'c7n_mailer',\n        # core deps\n        'jinja2', 'markupsafe', 'ruamel', 'ldap3', 'pyasn1', 'redis',\n        # for other dependencies\n        'pkg_resources',\n        # transport datadog - recursive deps\n        'datadog', 'simplejson', 'decorator',\n        # requests (recursive deps), needed by datadog, slackclient, splunk\n        'requests', 'urllib3', 'idna', 'chardet', 'certifi',\n        # used by splunk; also dependencies of c7n itself\n        'jsonpointer', 'jsonpatch'])\n\n    for d in set(config['templates_folders']):\n        if not os.path.exists(d):\n            continue\n        for t in [f for f in os.listdir(d) if os.path.splitext(f)[1] == '.j2']:\n            with open(os.path.join(d, t)) as fh:\n                archive.add_contents('msg-templates/%s' % t, fh.read())\n\n    function_config = copy.deepcopy(config)\n    function_config['templates_folders'] = ['msg-templates/']\n    archive.add_contents('config.json', json.dumps(function_config))\n    archive.add_contents('periodic.py', entry_source)\n\n    archive.close()\n    return archive\n\n\ndef provision(config, session_factory):\n    func_config = dict(\n        name=config.get('lambda_name', 'cloud-custodian-mailer'),\n        description=config.get('lambda_description', 'Cloud Custodian Mailer'),\n        tags=config.get('lambda_tags', {}),\n        handler='periodic.dispatch',\n        runtime=config['runtime'],\n        memory_size=config['memory'],\n        timeout=config['timeout'],\n        role=config['role'],\n        subnets=config['subnets'],\n        security_groups=config['security_groups'],\n        dead_letter_config=config.get('dead_letter_config', {}),\n        events=[\n            CloudWatchEventSource(\n                {'type': 'periodic',\n                 'schedule': config.get('lambda_schedule', 'rate(5 minutes)')},\n                session_factory)\n        ])\n\n    archive = get_archive(config)\n    func = LambdaFunction(func_config, archive)\n    manager = LambdaManager(session_factory)\n    manager.publish(func)\n", "path": "tools/c7n_mailer/c7n_mailer/deploy.py"}], "after_files": [{"content": "# Copyright 2016-2017 Capital One Services, LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport copy\nimport logging\nimport json\nimport os\n\nfrom c7n.mu import (\n    CloudWatchEventSource,\n    LambdaFunction,\n    LambdaManager,\n    PythonPackageArchive)\n\n\nlog = logging.getLogger('custodian-mailer')\n\nentry_source = \"\"\"\\\nimport logging\n\nfrom c7n_mailer import handle\n\nlogger = logging.getLogger('custodian.mailer')\nlog_format = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'\nlogging.basicConfig(level=logging.INFO, format=log_format)\nlogging.getLogger('botocore').setLevel(logging.WARNING)\n\ndef dispatch(event, context):\n    return handle.start_c7n_mailer(logger)\n\"\"\"\n\n\ndef get_archive(config):\n    archive = PythonPackageArchive(modules=[\n        'c7n_mailer',\n        # core deps\n        'jinja2', 'markupsafe', 'ruamel', 'ldap3', 'pyasn1', 'redis',\n        # for other dependencies\n        'pkg_resources',\n        # transport datadog - recursive deps\n        'datadog', 'simplejson', 'decorator',\n        # requests (recursive deps), needed by datadog, slackclient, splunk\n        'requests', 'urllib3', 'idna', 'chardet', 'certifi',\n        # used by splunk; also dependencies of c7n itself\n        'jsonpointer', 'jsonpatch'])\n\n    for d in set(config['templates_folders']):\n        if not os.path.exists(d):\n            continue\n        for t in [f for f in os.listdir(d) if os.path.splitext(f)[1] == '.j2']:\n            with open(os.path.join(d, t)) as fh:\n                archive.add_contents('msg-templates/%s' % t, fh.read())\n\n    function_config = copy.deepcopy(config)\n    function_config['templates_folders'] = ['msg-templates/']\n    archive.add_contents('config.json', json.dumps(function_config))\n    archive.add_contents('periodic.py', entry_source)\n\n    archive.close()\n    return archive\n\n\ndef provision(config, session_factory):\n    func_config = dict(\n        name=config.get('lambda_name', 'cloud-custodian-mailer'),\n        description=config.get('lambda_description', 'Cloud Custodian Mailer'),\n        tags=config.get('lambda_tags', {}),\n        handler='periodic.dispatch',\n        runtime=config['runtime'],\n        memory_size=config['memory'],\n        timeout=config['timeout'],\n        role=config['role'],\n        subnets=config['subnets'],\n        security_groups=config['security_groups'],\n        dead_letter_config=config.get('dead_letter_config', {}),\n        events=[\n            CloudWatchEventSource(\n                {'type': 'periodic',\n                 'schedule': config.get('lambda_schedule', 'rate(5 minutes)')},\n                session_factory)\n        ])\n\n    archive = get_archive(config)\n    func = LambdaFunction(func_config, archive)\n    log.info(\"Provisioning mailer lambda %s\" % (session_factory().region_name))\n    manager = LambdaManager(session_factory)\n    manager.publish(func)\n", "path": "tools/c7n_mailer/c7n_mailer/deploy.py"}]}