Skip to content

[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
stable-11from
patchback/backports/stable-11/54dfb5f3fdd7046f4e2e90f9d0d03923b17307ed/pr-3065
Open

[PR #3065/54dfb5f3 backport][stable-11] refactor(rds): rds_option_group_info uses shared module_utils/rds utilities#3071
patchback[bot] wants to merge 1 commit into
stable-11from
patchback/backports/stable-11/54dfb5f3fdd7046f4e2e90f9d0d03923b17307ed/pr-3065

Conversation

@patchback

@patchback patchback Bot commented Aug 21, 2026

Copy link
Copy Markdown

This is a backport of PR #3065 as merged into main (54dfb5f).

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:

Assisted-by: Claude Code / Opus 4.6 (Anthropic)

…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)
@github-actions

Copy link
Copy Markdown

Docs Build 📝

Thank you for contribution!✨

The docsite for this PR is available for download as an artifact from this run:
https://github.com/ansible-collections/amazon.aws/actions/runs/32508435479

You can compare to the docs for the main branch here:
https://ansible-collections.github.io/amazon.aws/branch/main

File changes:

  • M collections/amazon/aws/rds_option_group_info_module.html
Click to see the diff comparison.

NOTE: only file modifications are shown here. New and deleted files are excluded.
See the file list and check the published docs to see those files.

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>

@centosinfra-prod-github-app

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant