From 7720ef8ec19a0cae2102fdaa2db4c1b76dc6ee2e Mon Sep 17 00:00:00 2001 From: Sloane Hertel Date: Tue, 28 Mar 2017 17:00:26 -0400 Subject: [PATCH] [cloud][python3] bytes fix to make ec2_key work on python 3 (#23051) --- lib/ansible/modules/cloud/amazon/ec2_key.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/amazon/ec2_key.py b/lib/ansible/modules/cloud/amazon/ec2_key.py index ce02f954a0d..221ce24df42 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_key.py +++ b/lib/ansible/modules/cloud/amazon/ec2_key.py @@ -117,6 +117,7 @@ try: except ImportError: HAS_BOTO = False +from ansible.module_utils._text import to_bytes import random import string @@ -226,7 +227,7 @@ def main(): if not module.check_mode: if key_material: '''We are providing the key, need to import''' - key = ec2.import_key_pair(name, key_material) + key = ec2.import_key_pair(name, to_bytes(key_material)) else: ''' No material provided, let AWS handle the key creation and