vincbeck commented on code in PR #25975:
URL: https://github.com/apache/airflow/pull/25975#discussion_r956316856
##########
airflow/providers/amazon/aws/hooks/redshift_cluster.py:
##########
@@ -153,3 +153,18 @@ def create_cluster_snapshot(
ManualSnapshotRetentionPeriod=retention_period,
)
return response['Snapshot'] if response['Snapshot'] else None
+
+ def get_cluster_snapshot_status(self, snapshot_identifier: str,
cluster_identifier: str):
+ try:
+ response = self.get_conn().describe_cluster_snapshots(
+ ClusterIdentifier=cluster_identifier,
+ SnapshotIdentifier=snapshot_identifier,
+ )
+ snapshot = response.get("Snapshots")[0]
+ snapshot_status: str = snapshot.get("Status")
+ return snapshot_status
+ except ClientError as exception:
+ if exception.response.get("Error", {}).get("Code", "") ==
"ClusterSnapshotNotFound":
+ return "cluster_snapshot_not_found"
Review Comment:
That's a good point but I rather break the inconsistency than keep doing the
"bad" thing. What we can do is duplicate `cluster_status` and name it
`get_cluster_status`. `get_cluster_status` would return `None` instead of
`cluster_not_found`. Use `get_cluster_status` instead of `cluster_status` and
mark the latter as deprecated
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]