Skip to content

Commit a848fe9

Browse files
committed
1\ Added functionality to remove dynamodb entries for the cluster after an unplanned failover
2\ New script to delete entries manually if needed for a cluster promotion.
1 parent a01cda3 commit a848fe9

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

delete_gdb_entry.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from logging import FATAL
2+
import argparse
3+
import boto3
4+
from botocore.exceptions import ClientError
5+
6+
def main():
7+
# Main routine
8+
9+
try:
10+
#get the cluster name and the region name
11+
parser=argparse.ArgumentParser()
12+
parser.add_argument ("-c", "--regional-cluster-name", type=str, help="Name of the regional cluster entry to be deleted")
13+
parser.add_argument ("-r","--region-name", type=str, default='', help="region name")
14+
15+
#process arguments
16+
region = args.region_name
17+
cluname= args.regional_cluster_name
18+
19+
#delete the entry from the region
20+
ddbclient=boto3.client('dynamodb',region_name = region)
21+
22+
dresponse = ddbclient.delete_item(
23+
TableName='gdbcnamepair',
24+
Key = {
25+
'clustername':{'S':cluname}
26+
})
27+
28+
except ClientError as e:
29+
print(e)
30+
raise
31+
32+
if __name__ == "__main__":
33+
main()

0 commit comments

Comments
 (0)