Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bkprt py3 ec2 user data #37664

Merged
merged 2 commits into from
Mar 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/py3-ec2-user_data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- ec2 - Fix ec2 user_data parameter to properly convert to base64 on python3 (https://github.com/ansible/ansible/pull/37628)
12 changes: 6 additions & 6 deletions lib/ansible/modules/cloud/amazon/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,15 +620,15 @@

'''

import traceback
import time
import traceback
from ast import literal_eval
from ansible.module_utils.six import get_function_code, string_types
from ansible.module_utils._text import to_text
from distutils.version import LooseVersion

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ec2 import get_aws_connection_info, ec2_argument_spec, ec2_connect
from distutils.version import LooseVersion
from ansible.module_utils.six import string_types
from ansible.module_utils.six import get_function_code, string_types
from ansible.module_utils._text import to_bytes, to_text

try:
import boto.ec2
Expand Down Expand Up @@ -1121,7 +1121,7 @@ def create_instances(module, ec2, vpc, override_count=None):
'instance_type': instance_type,
'kernel_id': kernel,
'ramdisk_id': ramdisk,
'user_data': user_data}
'user_data': to_bytes(user_data, errors='surrogate_or_strict')}

if ebs_optimized:
params['ebs_optimized'] = ebs_optimized
Expand Down