You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm receiving an error when running the gcp_iam_service_account_key module. It creates an empty JSON key file and the task fails. Rerunning the task after deleting the empty file works and the file is created successfully.
Run the playbook like directed in the instructions. The last task fails, delete the empty file, and rerun the task via debugger. File is created successfully.
create a gcp project, create a service account, create a service key and have it saved on my computer
ACTUAL RESULTS
empty ~/sa-{{ service_account_display_name }}.json file and the task fails
The full traceback is:
Traceback (most recent call last):
File "/Users/bluo/.ansible/tmp/ansible-tmp-1592427610.3913631-4932-201653545614182/AnsiballZ_gcp_iam_service_account_key.py", line 102, in <module>
_ansiballz_main()
File "/Users/bluo/.ansible/tmp/ansible-tmp-1592427610.3913631-4932-201653545614182/AnsiballZ_gcp_iam_service_account_key.py", line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/Users/bluo/.ansible/tmp/ansible-tmp-1592427610.3913631-4932-201653545614182/AnsiballZ_gcp_iam_service_account_key.py", line 40, in invoke_module
runpy.run_module(mod_name='ansible.modules.cloud.google.gcp_iam_service_account_key', init_globals=None, run_name='__main__', alter_sys=True)
File "/Users/bluo/anaconda3/lib/python3.7/runpy.py", line 205, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/Users/bluo/anaconda3/lib/python3.7/runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "/Users/bluo/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/var/folders/fz/m4s7z4p53fn_384hq601kn380000gn/T/ansible_gcp_iam_service_account_key_payload_b83tndte/ansible_gcp_iam_service_account_key_payload.zip/ansible/modules/cloud/google/gcp_iam_service_account_key.py", line 279, in <module>
File "/var/folders/fz/m4s7z4p53fn_384hq601kn380000gn/T/ansible_gcp_iam_service_account_key_payload_b83tndte/ansible_gcp_iam_service_account_key_payload.zip/ansible/modules/cloud/google/gcp_iam_service_account_key.py", line 201, in main
File "/var/folders/fz/m4s7z4p53fn_384hq601kn380000gn/T/ansible_gcp_iam_service_account_key_payload_b83tndte/ansible_gcp_iam_service_account_key_payload.zip/ansible/modules/cloud/google/gcp_iam_service_account_key.py", line 213, in create
TypeError: 'NoneType' object is not subscriptable
fatal: [localhost]: FAILED! => {
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File \"/Users/bluo/.ansible/tmp/ansible-tmp-1592427610.3913631-4932-201653545614182/AnsiballZ_gcp_iam_service_account_key.py\", line 102, in <module>\n _ansiballz_main()\n File \"/Users/bluo/.ansible/tmp/ansible-tmp-1592427610.3913631-4932-201653545614182/AnsiballZ_gcp_iam_service_account_key.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/Users/bluo/.ansible/tmp/ansible-tmp-1592427610.3913631-4932-201653545614182/AnsiballZ_gcp_iam_service_account_key.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.cloud.google.gcp_iam_service_account_key', init_globals=None, run_name='__main__', alter_sys=True)\n File \"/Users/bluo/anaconda3/lib/python3.7/runpy.py\", line 205, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/Users/bluo/anaconda3/lib/python3.7/runpy.py\", line 96, in _run_module_code\n mod_name, mod_spec, pkg_name, script_name)\n File \"/Users/bluo/anaconda3/lib/python3.7/runpy.py\", line 85, in _run_code\n exec(code, run_globals)\n File \"/var/folders/fz/m4s7z4p53fn_384hq601kn380000gn/T/ansible_gcp_iam_service_account_key_payload_b83tndte/ansible_gcp_iam_service_account_key_payload.zip/ansible/modules/cloud/google/gcp_iam_service_account_key.py\", line 279, in <module>\n File \"/var/folders/fz/m4s7z4p53fn_384hq601kn380000gn/T/ansible_gcp_iam_service_account_key_payload_b83tndte/ansible_gcp_iam_service_account_key_payload.zip/ansible/modules/cloud/google/gcp_iam_service_account_key.py\", line 201, in main\n File \"/var/folders/fz/m4s7z4p53fn_384hq601kn380000gn/T/ansible_gcp_iam_service_account_key_payload_b83tndte/ansible_gcp_iam_service_account_key_payload.zip/ansible/modules/cloud/google/gcp_iam_service_account_key.py\", line 213, in create\nTypeError: 'NoneType' object is not subscriptable\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
The text was updated successfully, but these errors were encountered:
I have the exact same error when providing an incorrect service_account.name param to the gcp_iam_service_account_key module.
The auth.post() request at line 258 returns 404, the json_content returned by return_if_object() is None, then the code fails like described above when doing json_content['privateKeyData'] because json_content is None.
SUMMARY
I'm receiving an error when running the gcp_iam_service_account_key module. It creates an empty JSON key file and the task fails. Rerunning the task after deleting the empty file works and the file is created successfully.
ISSUE TYPE
COMPONENT NAME
gcp_iam_service_account_key
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
macOS Catalina 10.15.5
STEPS TO REPRODUCE
Run the playbook like directed in the instructions. The last task fails, delete the empty file, and rerun the task via debugger. File is created successfully.
EXPECTED RESULTS
create a gcp project, create a service account, create a service key and have it saved on my computer
ACTUAL RESULTS
empty ~/sa-{{ service_account_display_name }}.json file and the task fails
The text was updated successfully, but these errors were encountered: