From 286607a409fe55de8b2b68cfbbee25b44c4a27d9 Mon Sep 17 00:00:00 2001 From: Anton Mokhovikov Date: Fri, 4 Sep 2020 02:42:04 -0700 Subject: [PATCH 1/3] added previous stack tags --- .travis.yml | 9 +++++++++ python/rpdk/python/__init__.py | 2 +- python/rpdk/python/templates/requirements.txt | 2 +- setup.py | 2 +- src/cloudformation_cli_python_lib/interface.py | 1 + src/cloudformation_cli_python_lib/resource.py | 1 + src/cloudformation_cli_python_lib/utils.py | 2 ++ src/setup.py | 2 +- tests/plugin/codegen_test.py | 2 +- 9 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index aab0f1b1..c53a54a6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,12 +25,21 @@ jobs: language: python python: "3.6" script: + - OUT=$(pwd) + - cd src/ + - python3 setup.py sdist + - cp dist/*.tar.gz "$OUT" + - rm -r dist/ + - cd .. + - ls -la - DIR=$(mktemp -d) + - cp cloudformation-cli-python-lib-2.1.1.tar.gz "$DIR" - cd "$DIR" - ls -la - printf "AWS::Foo::Bar\n1\ny" | cfn init -vv - ls -la - mypy src/aws_foo_bar/ --strict --implicit-reexport + - cfn submit --dry-run - stage: "integ python 3.7" language: python python: "3.7" diff --git a/python/rpdk/python/__init__.py b/python/rpdk/python/__init__.py index 2a5cd013..38a89be0 100644 --- a/python/rpdk/python/__init__.py +++ b/python/rpdk/python/__init__.py @@ -1,5 +1,5 @@ import logging -__version__ = "2.1.0" +__version__ = "2.1.1" logging.getLogger(__name__).addHandler(logging.NullHandler()) diff --git a/python/rpdk/python/templates/requirements.txt b/python/rpdk/python/templates/requirements.txt index bcfee769..35b044f6 100644 --- a/python/rpdk/python/templates/requirements.txt +++ b/python/rpdk/python/templates/requirements.txt @@ -1 +1 @@ -{{ support_lib_name }}==2.1.0 +{{ support_lib_name }}==2.1.1 diff --git a/setup.py b/setup.py index 94a7c654..10e9ab5c 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ def find_version(*file_paths): include_package_data=True, zip_safe=True, python_requires=">=3.6", - install_requires=["cloudformation-cli>=0.1,<0.2", "docker>=3.7,<3.8"], + install_requires=["cloudformation-cli>=0.1,<0.2", "docker>=3.7,<=4.3.1"], entry_points={ "rpdk.v1.languages": [ "python37 = rpdk.python.codegen:Python37LanguagePlugin", diff --git a/src/cloudformation_cli_python_lib/interface.py b/src/cloudformation_cli_python_lib/interface.py index 248053df..dbab5e51 100644 --- a/src/cloudformation_cli_python_lib/interface.py +++ b/src/cloudformation_cli_python_lib/interface.py @@ -131,6 +131,7 @@ class BaseResourceHandlerRequest: desiredResourceState: Optional[BaseModel] previousResourceState: Optional[BaseModel] desiredResourceTags: Optional[Mapping[str, Any]] + previousResourceTags: Optional[Mapping[str, Any]] systemTags: Optional[Mapping[str, Any]] awsAccountId: Optional[str] logicalResourceIdentifier: Optional[str] diff --git a/src/cloudformation_cli_python_lib/resource.py b/src/cloudformation_cli_python_lib/resource.py index e20c2ed8..51e44745 100644 --- a/src/cloudformation_cli_python_lib/resource.py +++ b/src/cloudformation_cli_python_lib/resource.py @@ -164,6 +164,7 @@ def _cast_resource_request( desiredResourceState=request.requestData.resourceProperties, previousResourceState=request.requestData.previousResourceProperties, desiredResourceTags=request.requestData.stackTags, + previousResourceTags=request.requestData.previousStackTags, systemTags=request.requestData.systemTags, awsAccountId=request.awsAccountId, logicalResourceIdentifier=request.requestData.logicalResourceId, diff --git a/src/cloudformation_cli_python_lib/utils.py b/src/cloudformation_cli_python_lib/utils.py index e4921ff0..c5f96972 100644 --- a/src/cloudformation_cli_python_lib/utils.py +++ b/src/cloudformation_cli_python_lib/utils.py @@ -114,6 +114,7 @@ class UnmodelledRequest: desiredResourceState: Optional[Mapping[str, Any]] = None previousResourceState: Optional[Mapping[str, Any]] = None desiredResourceTags: Optional[Mapping[str, Any]] = None + previousResourceTags: Optional[Mapping[str, Any]] = None systemTags: Optional[Mapping[str, Any]] = None awsAccountId: Optional[str] = None logicalResourceIdentifier: Optional[str] = None @@ -127,6 +128,7 @@ def to_modelled(self, model_cls: Type[BaseModel]) -> BaseResourceHandlerRequest: desiredResourceState=model_cls._deserialize(self.desiredResourceState), previousResourceState=model_cls._deserialize(self.previousResourceState), desiredResourceTags=self.desiredResourceTags, + previousResourceTags=self.previousResourceTags, systemTags=self.systemTags, awsAccountId=self.awsAccountId, logicalResourceIdentifier=self.logicalResourceIdentifier, diff --git a/src/setup.py b/src/setup.py index 658c3660..8911f068 100644 --- a/src/setup.py +++ b/src/setup.py @@ -3,7 +3,7 @@ setup( name="cloudformation-cli-python-lib", - version="2.0.0", + version="2.1.1", description=__doc__, author="Amazon Web Services", author_email="aws-cloudformation-developers@amazon.com", diff --git a/tests/plugin/codegen_test.py b/tests/plugin/codegen_test.py index fef2ecaf..11295f3c 100644 --- a/tests/plugin/codegen_test.py +++ b/tests/plugin/codegen_test.py @@ -149,7 +149,7 @@ def test_package_pip(project): # not real requirements, would make version bumps a pain to test (project.root / "requirements.txt").write_text("") - (project.root / f"{SUPPORT_LIB_NAME}-0.0.1.tar.gz").touch() + (project.root / f"{SUPPORT_LIB_NAME}-2.1.1.tar.gz").touch() # want to exclude *.pyc files from zip, but code isn't run, so never get made (project.root / "src" / "foo_bar_baz" / "coverage.pyc").touch() From ab26260f22404582550785565cb2d7e8890344b7 Mon Sep 17 00:00:00 2001 From: Anton Mokhovikov Date: Fri, 4 Sep 2020 10:16:14 -0700 Subject: [PATCH 2/3] removed dry run docker build --- .travis.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index c53a54a6..32b55ea0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,21 +25,13 @@ jobs: language: python python: "3.6" script: - - OUT=$(pwd) - - cd src/ - - python3 setup.py sdist - - cp dist/*.tar.gz "$OUT" - - rm -r dist/ - - cd .. - ls -la - DIR=$(mktemp -d) - - cp cloudformation-cli-python-lib-2.1.1.tar.gz "$DIR" - cd "$DIR" - ls -la - printf "AWS::Foo::Bar\n1\ny" | cfn init -vv - ls -la - mypy src/aws_foo_bar/ --strict --implicit-reexport - - cfn submit --dry-run - stage: "integ python 3.7" language: python python: "3.7" From 01c9745ec3b7d02263f262b0a313382add28effb Mon Sep 17 00:00:00 2001 From: Anton Mokhovikov Date: Fri, 4 Sep 2020 12:28:45 -0700 Subject: [PATCH 3/3] Update setup.py Co-authored-by: Pat Myron --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 10e9ab5c..ff662649 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ def find_version(*file_paths): include_package_data=True, zip_safe=True, python_requires=">=3.6", - install_requires=["cloudformation-cli>=0.1,<0.2", "docker>=3.7,<=4.3.1"], + install_requires=["cloudformation-cli>=0.1,<0.2", "docker>=3.7,<5"], entry_points={ "rpdk.v1.languages": [ "python37 = rpdk.python.codegen:Python37LanguagePlugin",