Make sure we pass userdata as bytes to base64 encoder

This commit is contained in:
Daniel A. Wozniak 2019-01-02 12:38:16 -07:00
parent 6b780c6d36
commit 37808fbc53
No known key found for this signature in database
GPG Key ID: 166B9D2C06C82D61

View File

@ -1818,7 +1818,9 @@ def request_instance(vm_=None, call=None):
if userdata is not None:
try:
params[spot_prefix + 'UserData'] = base64.b64encode(userdata)
params[spot_prefix + 'UserData'] = base64.b64encode(
salt.utils.stringutils.to_bytes(userdata)
)
except Exception as exc:
log.exception('Failed to encode userdata: %s', exc)