aws-cloudformation / aws-cloudformation/cloudformation-cli-python-plugin

OOTB generated python CF resource cannot be used with cfn test

未关闭
#247 2 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
investigating
主要语言
Python
星标
107
派生
46
PR 合并指标
30 天内没有已合并 PR

描述

Repro:

- Install latest cloudformation-cli
- Install master branch of this repo
- Generate a new resource type - in my example I used `python3.9`
- run `cfn submit --dry-run`
- run `sam build`
- in new terminal run `sam local start-lambda`
- run just one contract test -`cfn test -- -k contract_create_delete`
- Error from cryptography library:
- `Unable to import module 'dd_dd_test1.handlers': cannot import name 'ObjectIdentifier' from 'cryptography.hazmat.bindings._rust' (unknown location)`

Environment:
- cfn version - `cfn 0.2.28`
- SAM version - `SAM CLI, version 1.66.0`
- Operating System - `macOS Monterey - 12.3.1`
- Architecture - Apple M1 Pro (arm64)
- plugin version - `cloudformation-cli-python-plugin @ git+https://github.com/aws-cloudformation/cloudformation-cli-python-plugin.git@fad3b0740a76c7bad0be18b08cb46f6e22973bde` (master as of 01/17/2023)
- requirements.txt (generated) - `cloudformation-cli-python-lib>=2.1.9`
- Resolved cryptography library - `cryptography 39.0.0`

Research:
- User having issues with python3.8 in lambda environment - https://stackoverflow.com/questions/75129142/aws-lambda-cannot-import-name-objectidentifier-from-cryptography-hazmat-b
- `aws-encryption-sdk` only [requires 3.4.0](https://github.com/aws/aws-encryption-sdk-python/blob/master/requirements.txt#L2) or above currently. This is used [here](https://github.com/aws-cloudformation/cloudformation-cli-python-plugin/blob/master/src/cloudformation_cli_python_lib/cipher.py#L4). And defined [here](https://github.com/aws-cloudformation/cloudformation-cli-python-plugin/blob/master/src/setup.py#L18)

贡献指南

打开贡献指南

调研方向

按照列出的 cloudformation-cli、SAM、macOS arm64 和生成资源步骤重现该故障,最后执行 cfn test -- -k contract_create_delete。然后检查 src/cloudformation_cli_python_lib/cipher.py、src/setup.py 以及生成的 requirements.txt 中与 aws-encryption-sdk 和 cryptography 约束相关的内容。生成的资源能够在没有 ObjectIdentifier 导入错误的情况下运行契约测试,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
aws, python
领域
testing, tooling
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。