google.cloud icon indicating copy to clipboard operation
google.cloud copied to clipboard

"'NoneType' object does not support item assignment" in gcp_storage_object

Open MarounMaroun opened this issue 4 years ago • 0 comments

SUMMARY

I get the following exception when I try to upload a file to Google storage:

The full traceback is:
Traceback (most recent call last):
  File "/Users/maroun.bassam/.ansible/tmp/ansible-tmp-1613983611.6898382-65652-79762399834691/AnsiballZ_gcp_storage_object.py", line 247, in <module>
    _ansiballz_main()
  File "/Users/maroun.bassam/.ansible/tmp/ansible-tmp-1613983611.6898382-65652-79762399834691/AnsiballZ_gcp_storage_object.py", line 237, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/Users/maroun.bassam/.ansible/tmp/ansible-tmp-1613983611.6898382-65652-79762399834691/AnsiballZ_gcp_storage_object.py", line 108, in invoke_module
    runpy.run_module(mod_name='ansible.modules.cloud.google.gcp_storage_object', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/local/Cellar/[email protected]/3.8.6_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 207, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/local/Cellar/[email protected]/3.8.6_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/local/Cellar/[email protected]/3.8.6_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/var/folders/wh/zy6_yz8n67d0w2_40cmcylfw0000gn/T/ansible_gcp_storage_object_payload_j9qs76d7/ansible_gcp_storage_object_payload.zip/ansible/modules/cloud/google/gcp_storage_object.py", line 286, in <module>
  File "/var/folders/wh/zy6_yz8n67d0w2_40cmcylfw0000gn/T/ansible_gcp_storage_object_payload_j9qs76d7/ansible_gcp_storage_object_payload.zip/ansible/modules/cloud/google/gcp_storage_object.py", line 168, in main
TypeError: 'NoneType' object does not support item assignment
ISSUE TYPE
  • Bug Report
COMPONENT NAME

gcp_storage_object

ANSIBLE VERSION
2.9.12
CONFIGURATION
DEFAULT_CALLBACK_WHITELIST(/Users/maroun.bassam/protean/devops/ansible/ansible.cfg) = ['profile_tasks']
DEFAULT_HOST_LIST(/Users/maroun.bassam/protean/devops/ansible/ansible.cfg) = ['/Users/maroun.bassam/protean/devops/ansible/inventory.yml']
DEFAULT_KEEP_REMOTE_FILES(env: ANSIBLE_KEEP_REMOTE_FILES) = True
HOST_KEY_CHECKING(/Users/maroun.bassam/protean/devops/ansible/ansible.cfg) = False
OS / ENVIRONMENT

MacOS

STEPS TO REPRODUCE

Just try to upload a file:

- name: create file
  gcp_storage_object:
    action: upload
    project: project_id
    bucket: my_bucket
    src: "/Users/test.txt"
    dest: "test.txt"
    state: present
EXPECTED RESULTS

I expect the file to be uploaded.

ACTUAL RESULTS

The exception pasted above.

MarounMaroun avatar Feb 22 '21 09:02 MarounMaroun