EC2: prevent KeyError on get_spot_fleet_request and change describe_spot_fleet_instances to behave the same as aws (#5323)

This commit is contained in:
Felipe Marinho 2022-08-06 17:11:09 -03:00 committed by GitHub
parent 034ecb9dfb
commit 218d032d71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -441,10 +441,12 @@ class SpotFleetBackend:
return request
def get_spot_fleet_request(self, spot_fleet_request_id):
return self.spot_fleet_requests[spot_fleet_request_id]
return self.spot_fleet_requests.get(spot_fleet_request_id)
def describe_spot_fleet_instances(self, spot_fleet_request_id):
spot_fleet = self.get_spot_fleet_request(spot_fleet_request_id)
if not spot_fleet:
return []
return spot_fleet.spot_requests
def describe_spot_fleet_requests(self, spot_fleet_request_ids):