Skip to content
This repository has been archived by the owner on Jan 7, 2022. It is now read-only.

Commit

Permalink
deprecation warnings prior to rename
Browse files Browse the repository at this point in the history
  • Loading branch information
sneben committed Nov 19, 2015
1 parent 1cb8422 commit 41bf564
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ pybuilder_aws_lambda_plugin

PyBuilder plugin to handle packaging and uploading Python AWS Lambda code.

**WARNING**: You seem to be using an outdated version of this plugin.
It has recently been renamed from 'pybuilder_aws_lambda_plugin' to
'pybuilder_aws_plugin'. Please update your build.py!

How to use the Plugin
=====================
Add plugin dependency to your ``build.py``:
Expand Down
10 changes: 9 additions & 1 deletion src/main/python/pybuilder_aws_lambda_plugin/helpers.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import boto3
from pybuilder.ci_server_interaction import flush_text_line

deprecation_message = """
You seem to be using an outdated version of this plugin.
It has recently been renamed from 'pybuilder_aws_lambda_plugin' to
'pybuilder_aws_plugin'. Please update your build.py!
""".strip()


def upload_helper(logger, bucket_name, keyname, data, acl):
s3 = boto3.resource('s3')
logger.info(
'Uploading lambda-zip to bucket: "{0}" as key: "{1}"'
.format(bucket_name, keyname))
s3.Bucket(bucket_name).put_object(Key=keyname, Body=data, ACL=acl)


def teamcity_helper(tc_param, keyname):
flush_text_line(
"##teamcity[setParameter name='{0}' value='{1}']".format(
tc_param, keyname
))
))
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .helpers import upload_helper
from .helpers import upload_helper, deprecation_message
from pybuilder.core import task


Expand All @@ -13,6 +13,7 @@ def upload_cfn_to_s3(project, logger):
This means, when using Python<2.7, this task is not visible
(see __init__.py).
"""
logger.warn(deprecation_message)
from cfn_sphere.aws.cloudformation.template_loader import (
CloudFormationTemplateLoader)
from cfn_sphere.aws.cloudformation.template_transformer import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from pybuilder.plugins.python.install_dependencies_plugin import (
as_pip_argument)

from .helpers import upload_helper, teamcity_helper
from .helpers import upload_helper, teamcity_helper, deprecation_message


def zip_recursive(archive, directory, folder=''):
Expand Down Expand Up @@ -46,6 +46,7 @@ def get_path_to_zipfile(project):
'lambda-zip')
@depends('package')
def package_lambda_code(project, logger):
logger.warn(deprecation_message)
dir_target = project.expand_path('$dir_target')
lambda_dependencies_dir = os.path.join(dir_target, 'lambda_dependencies')
excludes = ['boto', 'boto3']
Expand All @@ -68,6 +69,7 @@ def package_lambda_code(project, logger):
@task('upload_zip_to_s3', description='Upload a packaged lambda-zip to S3')
@depends('package_lambda_code')
def upload_zip_to_s3(project, logger):
logger.warn(deprecation_message)
path_to_zipfile = get_path_to_zipfile(project)
with open(path_to_zipfile, 'rb') as fp:
data = fp.read()
Expand Down

0 comments on commit 41bf564

Please sign in to comment.