prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <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
  ```
  
  </issue>
  <code>
  [start of tools/c7n_mailer/c7n_mailer/deploy.py]
  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 of tools/c7n_mailer/c7n_mailer/deploy.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: 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)
  
verification_info: {"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"}]}