[PR #3065/54dfb5f3 backport][stable-11] refactor(rds): rds_option_group_info uses shared module_utils/rds utilities - #3071
Open
patchback[bot] wants to merge 1 commit into
Conversation
…lities (#3065) SUMMARY Refactor rds_option_group to use shared utilities from module_utils/rds, following the pattern established by the rds_cluster refactor in #3041. Replace local _describe_option_groups() with shared describe_option_groups() from module_utils/rds Use shared get_tags() for tag retrieval instead of raw list_tags_for_resource() + manual conversion Standardize error handling with AnsibleRDSError caught in main() Preserve retry behavior on all direct client calls with retry_decorator and aws_retry=True Clean up update_tags() using get_tags and compare_aws_tags, with proper check_mode early return before any boto3 call Add type hints and docstrings to all functions Fix return type annotation on compare_option_group to reflect Optional returns Add consistent msg= to all fail_json_aws calls Add unit tests covering get_option_group, update_tags, create_option_group check_mode, and main() success/failure paths Fixes ACA-2484 ISSUE TYPE Bugfix Pull Request Refactoring Pull Request COMPONENT NAME rds_option_group ADDITIONAL INFORMATION Bugfix: check_mode was not respected during option group creation when tags were provided. The if module.check_mode: return changed guard was incorrectly nested inside the else branch of the tags conditional (only applied when tags were not provided), so create_option_group would proceed with the actual AWS API call in check_mode when tags were present. Note on ensure_tags: This module keeps tag handling inline rather than using the shared ensure_tags() utility. ensure_tags calls call_method(), which calls get_rds_method_attribute() - that function raises NotImplementedError when wait=True and the resource type is not registered in _RESOURCE_CONFIGS. Since rds_option_group has wait=True but option groups are not in the resource configs, ensure_tags cannot be used without scope expansion. Modules without wait (e.g., rds_subnet_group) or with registered resource configs (e.g., rds_cluster) use ensure_tags successfully. The shared describe_option_groups() utility is needed before CI will pass on the rds_option_group refactor PR #3064, so this PR will need to be merged first. That PR should then be able to pass integration tests. Reference PRs: #3041: rds_cluster refactor (pattern followed) #3062: rds_engine_versions_info refactor (review feedback incorporated) Assisted-by: Claude Code / Opus 4.6 (Anthropic) Reviewed-by: Don Naro <dnaro@redhat.com> Reviewed-by: Bianca Henderson <beeankha@gmail.com> (cherry picked from commit 54dfb5f)
Docs Build 📝Thank you for contribution!✨ The docsite for this PR is available for download as an artifact from this run: You can compare to the docs for the File changes:
Click to see the diff comparison.NOTE: only file modifications are shown here. New and deleted files are excluded. diff --git a/home/runner/work/amazon.aws/amazon.aws/docsbuild/base/collections/amazon/aws/rds_option_group_info_module.html b/home/runner/work/amazon.aws/amazon.aws/docsbuild/head/collections/amazon/aws/rds_option_group_info_module.html
index a8511a0..cdb3159 100644
--- a/home/runner/work/amazon.aws/amazon.aws/docsbuild/base/collections/amazon/aws/rds_option_group_info_module.html
+++ b/home/runner/work/amazon.aws/amazon.aws/docsbuild/head/collections/amazon/aws/rds_option_group_info_module.html
@@ -259,7 +259,6 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-rds-opti
<a class="ansibleOptionLink" href="#parameter-marker" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
</div></td>
<td><div class="ansible-option-cell"><p>If this parameter is specified, the response includes only records beyond the marker, up to the value specified by <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-rds-option-group-info-module-parameter-max-records"><span class="std std-ref"><span class="pre">max_records</span></span></a></strong></code>.</p>
-<p>Allowed values are between <code class="ansible-value docutils literal notranslate"><span class="pre">20</span></code> and <code class="ansible-value docutils literal notranslate"><span class="pre">100</span></code>.</p>
</div></td>
</tr>
<tr class="row-even"><td><div class="ansible-option-cell">
@@ -267,6 +266,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-rds-opti
<a class="ansibleOptionLink" href="#parameter-max_records" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">integer</span></p>
</div></td>
<td><div class="ansible-option-cell"><p>The maximum number of records to include in the response.</p>
+<p>Allowed values are between <code class="ansible-value docutils literal notranslate"><span class="pre">20</span></code> and <code class="ansible-value docutils literal notranslate"><span class="pre">100</span></code>.</p>
<p class="ansible-option-line"><strong class="ansible-option-default-bold">Default:</strong> <code class="ansible-option-default docutils literal notranslate"><span class="pre">100</span></code></p>
</div></td>
</tr>
|
Contributor
|
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 2m 55s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a backport of PR #3065 as merged into main (54dfb5f).
SUMMARY
Refactor
rds_option_groupto use shared utilities frommodule_utils/rds, following the pattern established by therds_clusterrefactor in #3041._describe_option_groups()with shareddescribe_option_groups()frommodule_utils/rdsget_tags()for tag retrieval instead of rawlist_tags_for_resource()+ manual conversionAnsibleRDSErrorcaught inmain()retry_decoratorandaws_retry=Trueupdate_tags()usingget_tagsandcompare_aws_tags,with proper check_mode early return before any boto3 call
compare_option_groupto reflectOptionalreturnsmsg=to allfail_json_awscallsget_option_group,update_tags,create_option_groupcheck_mode, andmain()success/failure pathsFixes ACA-2484
ISSUE TYPE
COMPONENT NAME
rds_option_group
ADDITIONAL INFORMATION
Bugfix:
check_modewas not respected during option group creation when tags were provided. Theif module.check_mode: return changedguard was incorrectly nested inside theelsebranch of the tagsconditional (only applied when tags were not provided), so
create_option_groupwould proceed with the actual AWS API call in check_mode when tags were present.Note on
ensure_tags: This module keeps tag handling inline rather than using the sharedensure_tags()utility.ensure_tagscallscall_method(), which callsget_rds_method_attribute()- that function raisesNotImplementedErrorwhenwait=Trueand the resource type is not registered in_RESOURCE_CONFIGS. Sincerds_option_grouphaswait=Truebut option groups are not in the resource configs,ensure_tagscannot be used without scope expansion. Modules withoutwait(e.g.,rds_subnet_group) or with registered resource configs (e.g.,rds_cluster) useensure_tagssuccessfully.The shared describe_option_groups() utility is needed before CI will pass on the rds_option_group refactor PR #3064, so this PR will need to be merged first. That PR should then be able to pass integration tests.
Reference PRs:
rds_clusterrefactor (pattern followed)rds_engine_versions_inforefactor (review feedback incorporated)Assisted-by: Claude Code / Opus 4.6 (Anthropic)