-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor rds snapshot modules #2138
Refactor rds snapshot modules #2138
Conversation
recheck |
recheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, just some minor remarks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. Just some minor remarks
required_options = get_boto3_client_method_parameters(client, method_name, required=True) | ||
if any(parameters.get(k) is None for k in required_options): | ||
method_description = get_rds_method_attribute(method_name, module).operation_description | ||
module.fail_json(msg=f"To {method_description} requires the parameters: {required_options}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT if we raise an AnsibleRDSError
exception here and remove the module
from function arguments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case we also need module
for the get_rds_method_attribute
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which in turn is needed for module.params (as currently written) :(
8569f9c
to
d3ea854
Compare
required_options = get_boto3_client_method_parameters(client, method_name, required=True) | ||
if any(parameters.get(k) is None for k in required_options): | ||
method_description = get_rds_method_attribute(method_name, module).operation_description | ||
module.fail_json(msg=f"To {method_description} requires the parameters: {required_options}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which in turn is needed for module.params (as currently written) :(
- Add describe_db_cluster_snapshots() function - Add get_snapshot() function to retrieve a single db instance or cluster snapshot using internal describe_db_snapshots() and describe_db_cluster_snapshots() - Add format_rds_client_method_parameters() to validate and format parameters for boto3 rds client methods - Update internal collection imports to use full collection path - Add unit tests for new functions
Changes to rds_instance module: - Replace get_final_snapshot() function with calls to get_snapshot() from module_utils/rds.py - Replace parameter formatting logic in get_parameters() with call to format_rds_client_method_parameters() from module_utils/rds.py - Remove unit tests for deleted get_final_snapshot() function Changes to rds_instance_snapshot module: - Replace get_snapshot() function with calls to get_snapshot() from module_utils/rds.py - Replace get_parameters() function with call to format_rds_client_method_parameters() from module_utils/rds.py - Remove global variables - Add type hinting to all functions Changes to rds_cluster_snapshot module: - Replace get_parameters() function with call to format_rds_client_method_parameters() from module_utils/rds.py - Remove global variables - Add type hinting to all functions Changes to rds_snapshot_info module: - Refactor internal common_snapshot_info() function to use describe_db_snapshots() and describe_db_cluster_snapshots() functions from module_utils/rds.py - Rename some variables to ensure consistent variable naming - Add type hinting to all functions
d3ea854
to
133c590
Compare
recheck |
6f4143f
into
ansible-collections:main
SUMMARY
Move shared functionality from rds snapshot modules into rds module_utils. Second PR for #2003 / https://issues.redhat.com/browse/ACA-1343.
COMPONENT NAME
rds_cluster_snapshot
rds_instance_snapshot
rds_instance
rds_snapshot_info
module_utils/rds.py
ADDITIONAL INFORMATION
Detailed summary of all the changes:
module_utils/rds.py:
rds_instance module:
rds_instance_snapshot module:
rds_cluster_snapshot module:
rds_snapshot_info module: