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.
This commit is contained in:
Rotaru Sergey 2020-02-01 01:20:58 +03:00 committed by GitHub
parent 919a9e33e8
commit ef1fd19c00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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