croc cloud - ec2 key patch (#60929)

This patch fixes "IndexError: list index out of range" error for https://console.cloud.croc.ru.
When key pair is new, croc return dict with an empty list for key KeyPairs that causes ansible to crush.
pull/67005/head
Rotaru Sergey 4 years ago committed by GitHub
parent 919a9e33e8
commit ef1fd19c00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -180,6 +180,8 @@ def find_key_pair(module, ec2_client, name):
if err.response['Error']['Code'] == "InvalidKeyPair.NotFound":
return None
module.fail_json_aws(err, msg="error finding keypair")
except IndexError:
key = None
return key

Loading…
Cancel
Save