Skip to content
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

rds_cluster: add support for removing cluster from global db #1705

Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ac9376a
add support for removing cluster from global db
mandar242 Aug 22, 2023
577e878
add changelogs fragment
mandar242 Aug 22, 2023
c974a8f
make linter happy
mandar242 Aug 23, 2023
0319842
make linter happy
mandar242 Aug 23, 2023
bace6a6
add integration test
mandar242 Aug 24, 2023
1ca22c6
restructure code logic to make remove_from_global_db a flag and not a…
mandar242 Aug 31, 2023
e1f22ba
update integration tests as per new logic
mandar242 Aug 31, 2023
e168c2d
modified based on review
mandar242 Sep 5, 2023
fd0a073
wait for cluster state to be available only when wait=true
mandar242 Sep 5, 2023
eedaa25
replace static 'sleep' with custom waiter to wait for status to chang…
mandar242 Sep 6, 2023
1c641a8
add amazon.cloud to test requirements.yml
mandar242 Sep 6, 2023
53fcb46
update logic for wait when remove_from_global_db for primary and repl…
mandar242 Sep 8, 2023
492fdcd
remove unused new param added earlier
mandar242 Sep 8, 2023
ba071bc
change engine version to fix integration test failure
mandar242 Sep 11, 2023
6d5fffb
doc fix, add required_if for remove_from_global_db
mandar242 Sep 11, 2023
8b19ae4
change engine version to fix integration test failure
mandar242 Sep 11, 2023
d5e650d
fix integration tests
mandar242 Sep 12, 2023
cc7091e
add another example
mandar242 Sep 13, 2023
b327e09
update logic to allow update without wait on remove_from_global_db
mandar242 Sep 19, 2023
d5ad59e
sanity fix
mandar242 Sep 20, 2023
6096c93
minor fix
mandar242 Sep 20, 2023
55b096e
minor fix
mandar242 Sep 20, 2023
0e748d8
modify as suggested
mandar242 Sep 21, 2023
3d4b523
increase wait time and retries
mandar242 Sep 26, 2023
3fa1d7a
fix edge case
mandar242 Sep 26, 2023
7844a8f
minor fix
mandar242 Sep 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make linter happy
mandar242 committed Aug 31, 2023
commit 03198428acbed2ec84f9c231b2d426d694a03015
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
minor_changes:
- rds_cluster - Add support for removing cluster from global db (https://github.com/ansible-collections/amazon.aws/pull/1705).
13 changes: 8 additions & 5 deletions plugins/modules/rds_cluster.py
Original file line number Diff line number Diff line change
@@ -1118,7 +1118,6 @@ def ensure_present(cluster, parameters, method_name, method_options_name):


def handle_remove_from_global_db(module):

changed = False
global_cluster_id = module.params.get("global_cluster_identifier")
db_cluster_id = module.params.get("db_cluster_identifier")
@@ -1131,9 +1130,13 @@ def handle_remove_from_global_db(module):
client.remove_from_global_cluster(DbClusterIdentifier=db_cluster_arn, GlobalClusterIdentifier=global_cluster_id)
changed = True
except (botocore.exceptions.BotoCoreError, botocore.exceptions.ClientError) as e:
module.fail_json_aws(e, msg=f"Failed to remove cluster {db_cluster_id} from global DB cluster {global_cluster_id}.")
module.fail_json_aws(
e, msg=f"Failed to remove cluster {db_cluster_id} from global DB cluster {global_cluster_id}."
)

module.exit_json(changed=changed, msg=f"Successfully removed cluster {db_cluster_id} from global DB cluster {global_cluster_id}")
module.exit_json(
mandar242 marked this conversation as resolved.
Show resolved Hide resolved
changed=changed, msg=f"Successfully removed cluster {db_cluster_id} from global DB cluster {global_cluster_id}"
)


def main():
@@ -1159,7 +1162,7 @@ def main():
backup_retention_period=dict(type="int", default=1),
character_set_name=dict(),
database_name=dict(aliases=["db_name"]),
db_cluster_arn=dict(type='str'),
db_cluster_arn=dict(type="str"),
db_cluster_identifier=dict(required=True, aliases=["cluster_id", "id", "cluster_name"]),
db_cluster_parameter_group_name=dict(),
db_subnet_group_name=dict(),
@@ -1189,7 +1192,7 @@ def main():
port=dict(type="int"),
preferred_backup_window=dict(aliases=["backup_window"]),
preferred_maintenance_window=dict(aliases=["maintenance_window"]),
remove_from_global_db=dict(type='bool'),
remove_from_global_db=dict(type="bool"),
replication_source_identifier=dict(aliases=["replication_src_id"]),
restore_to_time=dict(),
restore_type=dict(choices=["full-copy", "copy-on-write"]),