Add s3_key module#208
Conversation
|
HELP: I would like to add automated tests but did not manage to execute the existing tests locally. Is there any documentation I missed describing how the test should be executed locally? |
@fpfuetsch, please see Testing Ansible and Collections for details on how to go about running the ansible sanity, unit and integration test cases. Also, see Testing collections. |
|
@fpfuetsch, you might want to fix the below module documentation error which is leading to ansible-sanity failing: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #208 +/- ##
==========================================
+ Coverage 90.41% 90.56% +0.14%
==========================================
Files 143 146 +3
Lines 16969 17287 +318
Branches 2354 2376 +22
==========================================
+ Hits 15343 15656 +313
- Misses 959 962 +3
- Partials 667 669 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
anupamaloke
left a comment
There was a problem hiding this comment.
Please fix the pylint errors.
|
@anupamaloke Okay will have a look. What do you think about the argument |
Thank you! It seems there are a few more in the latest sanity run and if you could fix them as well?
Yeah, this is the challenge with idempotency for all the modules that we have for configuring passwods/secrets/creds. One way I think of handling it would be like how it has been done in the ansible.builtin.user module with the On the similar lines, we can introduce a new argument called |
|
@anupamaloke Thanks for your input. Tests were added and |
|
@anupamaloke it would be nice if you could approve the workflow run for the latest commit :) |
|
@anupamaloke hopefully fixed now all sanity and linting errors |
f8984b5 to
167f2ef
Compare
Signed-off-by: fpfuetsch <54020707+fpfuetsch@users.noreply.github.com>
Signed-off-by: fpfuetsch <54020707+fpfuetsch@users.noreply.github.com>
Signed-off-by: fpfuetsch <54020707+fpfuetsch@users.noreply.github.com>
Signed-off-by: fpfuetsch <54020707+fpfuetsch@users.noreply.github.com>
Signed-off-by: fpfuetsch <54020707+fpfuetsch@users.noreply.github.com>
167f2ef to
a8db076
Compare
|
@anupamaloke What are the next steps now? :) |
|
@anupamaloke @ShrinidhiRao15 @gokul-srivathsan anybody there? 😶🌫️ |
|
@fpfuetsch , will check this. |
|
@anupamaloke @gokul-srivathsan |
|
My name is Amit, and I’m the new Chief Product Owner for the Ansible team. We will prioritize this PR with our new Product Manager. Thank you for your patience. |
- Fix shared mock state leakage across unit tests by using deepcopy
for params and fresh MagicMock instances for protocol_api methods
- Add 6 new unit tests: 404 handling, idempotency (if_not_present),
check mode (create/delete), generic exception, key rotation response
- Add mock data for rotation response (S3_CREATE_KEY_WITH_ROTATION_RESPONSE)
- Fix typo in module docstring ("exisitng" -> "existing")
- Add RST documentation for s3_key module (docs/modules/s3_key.rst)
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Add three new test cases to address coverage findings from build 916 report (ECS02C-990): - test_prereqs_validation_failure: covers lines 196-197 (validate_module_pre_reqs returning all_packages_found=False) - test_get_s3_key_returns_none: covers line 218 (get_s3_key API returning None) - test_create_s3_key_falsy_response: covers line 268 (create_s3_key API returning falsy/None response) Also adds PREREQS_VALIDATE_FAILURE fixture to mock_s3_key_api. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Address three categories of CheckMarx security issues: Use_Of_Hardcoded_Password: - Replace hardcoded secret key in RETURN doc sample with masked value - Replace hardcoded secret keys in test mock data with masked values Information_Exposure_Through_an_Error_Message: - Separate detailed error info (via utils.determine_error) from user-facing fail_json messages. Raw error details are logged for debugging but no longer included in the Ansible task failure output. Filtering_Sensitive_Logs: - Remove logging of s3_key_params dict which could contain sensitive SDK objects. Log operation context (user, access_zone) instead. - Remove explicit no_log=False on existing_key_expiry_minutes parameter. All 19 unit tests pass with these changes. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Replace f-string interpolation in LOG.error() calls with lazy % formatting as required by pylint. Affects 4 error handler sites in get_key_details, create_key, and delete_key methods. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The existing_key_expiry_minutes parameter name triggers Ansible's validate-modules no-log-needed check due to the 'key' substring. Restore explicit no_log=False to acknowledge it is not a secret. This is the standard pattern used across the collection (e.g. info.py filter_key, subnet.py ranges). Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>


Description
This PR adds the module
s3_keywhich allows the management of S3 keys for users.GitHub Issues
Fixes #207
Checklist:
How Has This Been Tested?