WIP: Ansible: gcp_iam_service_account_key: python3 TypeError - add decode to variable assignment (#286)

Signed-off-by: Modular Magician <magic-modules@google.com>
This commit is contained in:
The Magician 2019-06-21 15:05:55 -07:00 committed by Alex Stephen
parent 6cbcd4c21e
commit bd7385b777

View file

@ -152,6 +152,7 @@ path:
################################################################################
from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict
from ansible.module_utils._text import to_native
import json
import os
import mimetypes
@ -204,7 +205,7 @@ def create(module):
auth = GcpSession(module, 'iam')
json_content = return_if_object(module, auth.post(self_link(module), resource_to_request(module)))
with open(module.params['path'], 'w') as f:
private_key_contents = base64.b64decode(json_content['privateKeyData'])
private_key_contents = to_native(base64.b64decode(json_content['privateKeyData']))
f.write(private_key_contents)