Moto's implementation of autoscaling:CreateLaunchConfiguration is a little too loose,
allowing the ImageId parameter to be omitted and defaulting it to None, which results
in dozens of deprecation warnings:
`PendingDeprecationWarning: Could not find AMI with image-id:ami-123456, in the near future this will cause an error.`
This commit refactors calls to CreateLaunchConfiguration to explicitly pass in a known
AMI ImageId in order to avoid these warnings.
The integrity of the tests is unaffected by this change.
* Added explicit exception raise when no stack found.
Currently, any operation that uses 'get_stack' method from 'CloudFormationBackend' class
will fail with AttributeError or jinja2 exception if ran against non-existing stack(created/deleted)
To fix the issue I explicitly raised a 'ValidationError' exception.
Added tests for boto and boto3 responses.
* Moved non-existing stack tests to 'test_stack_events'
When using 'update_stack' to test raising an exception when the stack doesn't exist
test coverage dropped by 0.5%. I am using stack_events instead.
* Removed some unreachable paths
After adding the exception couple of paths in the code are unreachable as 'get_stack' doesn't return 'None' anymore.
This is the reason why coverall was reporting decreased coverage.
* Removed an unreachable path I missed
* Added couple of tests in cloudformation/models
* Added more assertions around raised exception
* Formatted document using black to fix issue with travis.
The `boto` library (long ago superseded by `boto3`) has not had an official
release in over two years or even a commit in the last 18 months. Importing
the package (or indirectly importing it by via `moto`) generates a deprecation
warning. Additionally, an ever-increasing number of `moto` users who have
left `boto` behind for `boto3` are still being forced to install `boto`.
This commit vendors a very small subset of the `boto` library--only the code
required by `moto` to run--into the /packages subdirectory. A README file
is included explaining the origin of the files and a recommendation for how
they can be removed entirely in a future release.
NOTE: Users of `boto` will still be able to use `moto` after this is merged.
closes#2978closes#3013closes#3170closes#3418
relates to #2950
* IAM User Cloudformation Enhancements: update, delete, getatt.
* AWS::IAM::Policy Support
* Added unit tests for AWS:IAM:Policy for roles and groups. Fixed bug related to groups.
* AWS:IAM:AccessKey CloudFormation support.
* Refactor of CloudFormation parsing.py methods to simplify and standardize how they call to the models. Adjusted some models accordingly.
* Further model CloudFormation support changes to align with revised CloudFormation logic. Mostly avoidance of getting resoure name from properties.
* Support for Kinesis Stream RetentionPeriodHours param.
* Kinesis Stream Cloudformation Tag Support.
* Added omitted 'region' param to boto3.client() calls in new tests.
Co-authored-by: Joseph Weitekamp <jweite@amazon.com>
* lambda-responses: add method to dispatch concurrency calls
* lambda-resources: add route to handle concurrency requests
* lambda-model: implement put_function_concurrency and concurrency attribute
* put-concurrency-tests: add one simple test
* get_function: add concurrency entry - with test
* lambda-reserved-concurrency: cloudformation support
* lambda-concurrency: implement delete_reserved with tests
* lambda-concurrency: implement get_reserved with tests
* lint
* implementation-cov: mark delete_function_concurrency, put_function_concurrency and get_function_concurrency
* botocore doesn't display concurrency entry for lambdas without it
* lambda(refactor): improvements on response's handler
* Fixed defect with CloudFormation provisioning of S3 buckets occuring when stack has a long name, resulting in the default S3 bucket name's length exceeding its 63 char limit.
* PR 3169 July 23, 2020 2:57a ET comment: added additional asserts to assure provisioned bucket's name complies. Fixed bug in my earlier change that could produce default bucket names with illegal upper-case characters in it.
Co-authored-by: Joseph Weitekamp <jweite@amazon.com>
This change fixes:
* Replace call to non-existent exception yaml.ParserError
* Catches yaml scanner error for valid json with tabs
* Supply yaml loader to ensure yaml loading throws exception validly for json with tabs and doesn't try to load the json incorrectly
* change line position for uuid and last_modified because they're not input parameters
* add event_source_arn validator and setter
* refactor batch_size as setter
* add helper function to parse arn and return source service
* fix for EventSource's create_from_cfn, there was no reference in the lambda object for the esm if created by cfn
* add esm deletion by cloudformation
* remove unused variable in test
* add cfn's update
* add complete implementation of delete_from_cfn
* blacked changed files
* fix test with invalid batchsize for sqs
* Dynamodb2 Table - Bugfix for localindex and implemented get_cfn_attributes
* Dynamodb2 eventsource - fix test to use StreamArn attribute
* Lambda Test - fix test_update_event_source_mapping
* add EventBus to model's map
* add support for creation of EventBus through cloudformation's api
* add cloudformation's delete
* add cloudformation's update
* add cloudformation's attribute
* ENH: Add unit test for propagation tags
* BUG: Add missing translation of boolean PropagateAtLaunch tag values to strings
* BUG: Should really be checking for "true" and not True
* CLN: Black formatting
* Keep order in request body to ensure auth signing works.
* Lint.
* More OrderedDict to ensure data parameter order.
* Lint.
* Improve CF test assertions.
* Fix syntax error.
* Cleanup CF test.
* ENH: Add unit test for cloudformation DependsOn
* ENH: Add implementation of retrieving list of resources that account for dependencies
* ENH: Update the name mappings so that they are consistent with the latest cloudformation names
* ENH: Add launch configuration to type names
* ENH: Create subnet for test and test creation with dependencies
* CLN: Code reformatting
* CLN: Remove print statements
* BUG: Fix error resulting in possible infinite loop
* CLN: Remove commented out fixture decorator
* BUG: Remove subnet creation
* CLN: Remove main and ec2 dependencies
* BUG: Add back in instance profile name type
* CLN: Remove print
* BUG: Fix broken unit test
* CLN: Code reformatting
* CLN: Remove main
* ENH: Add autoscaling group name to type names
* ENH: Add unit test for string only dependency and add assertions to unit tests
* ENH: Add unit test for chained depends_on in cloudformation stack
* BUG: Remove f strings for python 2.7 compatibility
* BUG: List needs to be sorted for python2.7
* CLN: Fix code formatting