@@ -61,20 +61,19 @@ def _describe_item(self, item_type: str, item_name: str) -> list:
6161
6262 def _check_item (self , item_type : str , item_name : str ) -> bool :
6363 """Get certain item from `_describe_item()` and check its status"""
64+ if item_type == "db_instance" :
65+ status_field = "DBInstanceStatus"
66+ else :
67+ status_field = "Status"
6468 try :
6569 items = self ._describe_item (item_type , item_name )
6670 except ClientError :
6771 return False
6872 else :
69- status_field = self ._check_status_field ()
7073 return bool (items ) and any (
7174 map (lambda status : items [0 ][status_field ].lower () == status , self .target_statuses )
7275 )
7376
74- def _check_status_field (self ) -> str :
75- """Return the name of the '_describe_item' response field that corresponds to the resource status."""
76- return "Status"
77-
7877
7978class RdsSnapshotExistenceSensor (RdsBaseSensor ):
8079 """
@@ -195,11 +194,6 @@ def poke(self, context: 'Context'):
195194 item_type = self ._check_item_type ()
196195 return self ._check_item (item_type = item_type , item_name = self .db_identifier )
197196
198- def _check_status_field (self ) -> str :
199- if self .db_type == RdsDbType .INSTANCE :
200- return "DBInstanceStatus"
201- return "Status"
202-
203197 def _check_item_type (self ):
204198 if self .db_type == RdsDbType .CLUSTER :
205199 return "db_cluster"
0 commit comments