community.general
community.general copied to clipboard
slack: add file upload functionality
SUMMARY
Add file upload functionality to upload the files with the new API SLACK.
Continuation of #9431.
ISSUE TYPE
- Feature Pull Request
COMPONENT NAME
- Slack
ADDITIONAL INFORMATION
This enhancement allows you to upload files with the new version of the Slack API https://api.slack.com/methods/files.completeUploadExternal https://api.slack.com/methods/files.getUploadURLExternal
Example usage:
- name: Upload a file to Slack
community.general.slack:
token: thetoken/generatedby/slack
channel: 'kuma'
upload_file:
path: "/tmp/test.py"
title: "main.py"
snippet_type: "python"
The test ansible-test sanity --test compile --python 2.7 [explain] failed with 1 error:
plugins/modules/slack.py:479:49: SyntaxError: headers = {"Authorization": f"Bearer {token}"}
The test ansible-test sanity --test import --python 2.7 [explain] failed with 1 error:
plugins/modules/slack.py:479:49: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test pep8 [explain] failed with 3 errors:
plugins/modules/slack.py:151:161: E501: line too long (177 > 160 characters)
plugins/modules/slack.py:477:1: E302: expected 2 blank lines, found 1
plugins/modules/slack.py:657:15: E121: continuation line under-indented for hanging indent
The test ansible-test sanity --test pep8 [explain] failed with 3 errors:
plugins/modules/slack.py:151:161: E501: line too long (177 > 160 characters)
plugins/modules/slack.py:477:1: E302: expected 2 blank lines, found 1
plugins/modules/slack.py:657:15: E121: continuation line under-indented for hanging indent
The test ansible-test sanity --test pep8 [explain] failed with 3 errors:
plugins/modules/slack.py:151:161: E501: line too long (177 > 160 characters)
plugins/modules/slack.py:477:1: E302: expected 2 blank lines, found 1
plugins/modules/slack.py:657:15: E121: continuation line under-indented for hanging indent
The test ansible-test sanity --test pep8 [explain] failed with 3 errors:
plugins/modules/slack.py:151:161: E501: line too long (177 > 160 characters)
plugins/modules/slack.py:477:1: E302: expected 2 blank lines, found 1
plugins/modules/slack.py:657:15: E121: continuation line under-indented for hanging indent
The test ansible-test sanity --test validate-modules [explain] failed with 2 errors:
plugins/modules/slack.py:0:0: parameter-type-not-in-doc: Argument 'thread_ts' in argument_spec found in upload_file defines type as 'str' but documentation doesn't define type
plugins/modules/slack.py:0:0: undocumented-parameter: Argument 'thread_ts' found in upload_file is listed in the argument_spec, but not documented in the module documentation
The test ansible-test sanity --test validate-modules [explain] failed with 2 errors:
plugins/modules/slack.py:0:0: parameter-type-not-in-doc: Argument 'thread_ts' in argument_spec found in upload_file defines type as 'str' but documentation doesn't define type
plugins/modules/slack.py:0:0: undocumented-parameter: Argument 'thread_ts' found in upload_file is listed in the argument_spec, but not documented in the module documentation
The test ansible-test sanity --test validate-modules [explain] failed with 2 errors:
plugins/modules/slack.py:0:0: parameter-type-not-in-doc: Argument 'thread_ts' in argument_spec found in upload_file defines type as 'str' but documentation doesn't define type
plugins/modules/slack.py:0:0: undocumented-parameter: Argument 'thread_ts' found in upload_file is listed in the argument_spec, but not documented in the module documentation
The test ansible-test sanity --test validate-modules [explain] failed with 2 errors:
plugins/modules/slack.py:0:0: parameter-type-not-in-doc: Argument 'thread_ts' in argument_spec found in upload_file defines type as 'str' but documentation doesn't define type
plugins/modules/slack.py:0:0: undocumented-parameter: Argument 'thread_ts' found in upload_file is listed in the argument_spec, but not documented in the module documentation
cc @ramondelafuente click here for bot help
The test ansible-test sanity --test compile --python 2.7 [explain] failed with 1 error:
plugins/modules/slack.py:496:35: SyntaxError: full_url = f"{url}?{query}"
The test ansible-test sanity --test import --python 2.7 [explain] failed with 1 error:
plugins/modules/slack.py:496:35: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test pep8 [explain] failed with 2 errors:
plugins/modules/slack.py:483:1: E302: expected 2 blank lines, found 1
plugins/modules/slack.py:663:17: E123: closing bracket does not match indentation of opening bracket's line
The test ansible-test sanity --test pep8 [explain] failed with 2 errors:
plugins/modules/slack.py:483:1: E302: expected 2 blank lines, found 1
plugins/modules/slack.py:663:17: E123: closing bracket does not match indentation of opening bracket's line
The test ansible-test sanity --test pep8 [explain] failed with 2 errors:
plugins/modules/slack.py:483:1: E302: expected 2 blank lines, found 1
plugins/modules/slack.py:663:17: E123: closing bracket does not match indentation of opening bracket's line
The test ansible-test sanity --test pep8 [explain] failed with 2 errors:
plugins/modules/slack.py:483:1: E302: expected 2 blank lines, found 1
plugins/modules/slack.py:663:17: E123: closing bracket does not match indentation of opening bracket's line
The test ansible-test sanity --test compile --python 2.7 [explain] failed with 1 error:
plugins/modules/slack.py:538:18: SyntaxError: **(
The test ansible-test sanity --test import --python 2.7 [explain] failed with 1 error:
plugins/modules/slack.py:538:18: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test pep8 [explain] failed with 1 error:
plugins/modules/slack.py:483:1: E302: expected 2 blank lines, found 1
The test ansible-test sanity --test pep8 [explain] failed with 1 error:
plugins/modules/slack.py:483:1: E302: expected 2 blank lines, found 1
The test ansible-test sanity --test pep8 [explain] failed with 1 error:
plugins/modules/slack.py:483:1: E302: expected 2 blank lines, found 1
The test ansible-test sanity --test pep8 [explain] failed with 1 error:
plugins/modules/slack.py:483:1: E302: expected 2 blank lines, found 1
ping @Powma
Are you still working on this?
needs_info
Sorry, I’ll take a look at it next week. I know there’s an IRC channel if I need help.
The test ansible-test sanity --test compile --python 2.7 [explain] failed with 1 error:
plugins/modules/slack.py:618:11: SyntaxError: try:
The test ansible-test sanity --test compile --python 3.10 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: SyntaxError: try:
The test ansible-test sanity --test compile --python 3.11 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: SyntaxError: try:
The test ansible-test sanity --test compile --python 3.12 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: SyntaxError: try:
The test ansible-test sanity --test compile --python 3.6 [explain] failed with 1 error:
plugins/modules/slack.py:618:11: SyntaxError: try:
The test ansible-test sanity --test compile --python 3.7 [explain] failed with 1 error:
plugins/modules/slack.py:618:11: SyntaxError: try:
The test ansible-test sanity --test compile --python 3.8 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: SyntaxError: try:
The test ansible-test sanity --test compile --python 3.9 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: SyntaxError: try:
The test ansible-test sanity --test import --python 2.7 [explain] failed with 1 error:
plugins/modules/slack.py:618:11: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 3.10 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 3.11 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 3.12 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 3.6 [explain] failed with 1 error:
plugins/modules/slack.py:618:11: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 3.7 [explain] failed with 1 error:
plugins/modules/slack.py:618:11: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 3.8 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 3.9 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test pep8 [explain] failed with 7 errors:
plugins/modules/slack.py:618:9: E122: continuation line missing indentation or outdented
plugins/modules/slack.py:619:28: E251: unexpected spaces around keyword / parameter equals
plugins/modules/slack.py:619:30: E251: unexpected spaces around keyword / parameter equals
plugins/modules/slack.py:620:9: E122: continuation line missing indentation or outdented
plugins/modules/slack.py:621:29: E251: unexpected spaces around keyword / parameter equals
plugins/modules/slack.py:621:31: E251: unexpected spaces around keyword / parameter equals
plugins/modules/slack.py:623:13: E123: closing bracket does not match indentation of opening bracket's line
The test ansible-test sanity --test yamllint [explain] failed with 1 error:
plugins/modules/slack.py:618:9: python-syntax-error: invalid syntax (<unknown>, line 618)
The test ansible-test sanity --test compile --python 3.10 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: SyntaxError: try:
The test ansible-test sanity --test compile --python 3.11 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: SyntaxError: try:
The test ansible-test sanity --test compile --python 3.12 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: SyntaxError: try:
The test ansible-test sanity --test compile --python 3.7 [explain] failed with 1 error:
plugins/modules/slack.py:618:11: SyntaxError: try:
The test ansible-test sanity --test compile --python 3.8 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: SyntaxError: try:
The test ansible-test sanity --test compile --python 3.9 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: SyntaxError: try:
The test ansible-test sanity --test import --python 3.10 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 3.11 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 3.12 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 3.7 [explain] failed with 1 error:
plugins/modules/slack.py:618:11: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 3.8 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 3.9 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test pep8 [explain] failed with 7 errors:
plugins/modules/slack.py:618:9: E122: continuation line missing indentation or outdented
plugins/modules/slack.py:619:28: E251: unexpected spaces around keyword / parameter equals
plugins/modules/slack.py:619:30: E251: unexpected spaces around keyword / parameter equals
plugins/modules/slack.py:620:9: E122: continuation line missing indentation or outdented
plugins/modules/slack.py:621:29: E251: unexpected spaces around keyword / parameter equals
plugins/modules/slack.py:621:31: E251: unexpected spaces around keyword / parameter equals
plugins/modules/slack.py:623:13: E123: closing bracket does not match indentation of opening bracket's line
The test ansible-test sanity --test yamllint [explain] failed with 1 error:
plugins/modules/slack.py:618:9: python-syntax-error: invalid syntax (<unknown>, line 618)
The test ansible-test sanity --test compile --python 3.10 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: SyntaxError: try:
The test ansible-test sanity --test compile --python 3.11 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: SyntaxError: try:
The test ansible-test sanity --test compile --python 3.12 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: SyntaxError: try:
The test ansible-test sanity --test compile --python 3.13 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: SyntaxError: try:
The test ansible-test sanity --test compile --python 3.8 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: SyntaxError: try:
The test ansible-test sanity --test compile --python 3.9 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: SyntaxError: try:
The test ansible-test sanity --test import --python 3.10 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 3.11 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 3.12 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 3.13 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 3.8 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 3.9 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test pep8 [explain] failed with 7 errors:
plugins/modules/slack.py:618:9: E122: continuation line missing indentation or outdented
plugins/modules/slack.py:619:28: E251: unexpected spaces around keyword / parameter equals
plugins/modules/slack.py:619:30: E251: unexpected spaces around keyword / parameter equals
plugins/modules/slack.py:620:9: E122: continuation line missing indentation or outdented
plugins/modules/slack.py:621:29: E251: unexpected spaces around keyword / parameter equals
plugins/modules/slack.py:621:31: E251: unexpected spaces around keyword / parameter equals
plugins/modules/slack.py:623:13: E123: closing bracket does not match indentation of opening bracket's line
The test ansible-test sanity --test yamllint [explain] failed with 1 error:
plugins/modules/slack.py:618:9: python-syntax-error: invalid syntax (<unknown>, line 618)
The test ansible-test sanity --test pylint [explain] failed with 1 error:
plugins/modules/slack.py:618:9: syntax-error: Parsing failed: 'invalid syntax (ansible_collections.community.general.plugins.modules.slack, line 618)'
The test ansible-test sanity --test ansible-doc [explain] failed with the error:
Command "ansible-doc -t module community.general.slack" returned exit status 1.
>>> Standard Error
ERROR! module community.general.slack missing documentation (or could not parse documentation): community.general.slack did not contain a DOCUMENTATION attribute (/root/ansible_collections/community/general/plugins/modules/slack.py). Unable to parse documentation in python file '/root/ansible_collections/community/general/plugins/modules/slack.py': invalid syntax (<unknown>, line 618). invalid syntax (<unknown>, line 618)
The test ansible-test sanity --test validate-modules [explain] failed with 1 error:
plugins/modules/slack.py:0:0: python-syntax-error: Python SyntaxError while parsing module
The test ansible-test sanity --test ansible-doc [explain] failed with the error:
Command "ansible-doc -t module community.general.slack" returned exit status 1.
>>> Standard Error
ERROR! module community.general.slack missing documentation (or could not parse documentation): community.general.slack did not contain a DOCUMENTATION attribute (/root/ansible_collections/community/general/plugins/modules/slack.py). Unable to parse documentation in python file '/root/ansible_collections/community/general/plugins/modules/slack.py': invalid syntax (<unknown>, line 618). invalid syntax (<unknown>, line 618)
The test ansible-test sanity --test validate-modules [explain] failed with 1 error:
plugins/modules/slack.py:0:0: python-syntax-error: Python SyntaxError while parsing module
The test ansible-test sanity --test pylint [explain] failed with 1 error:
plugins/modules/slack.py:618:9: syntax-error: Parsing failed: 'invalid syntax (<unknown>, line 618)'
The test ansible-test sanity --test pylint [explain] failed with 1 error:
plugins/modules/slack.py:618:9: syntax-error: Parsing failed: 'invalid syntax (ansible_collections.community.general.plugins.modules.slack, line 618)'
The test ansible-test sanity --test pylint [explain] failed with 1 error:
plugins/modules/slack.py:618:9: syntax-error: Parsing failed: 'invalid syntax (ansible_collections.community.general.plugins.modules.slack, line 618)'
The test ansible-test sanity --test ansible-doc [explain] failed with the error:
Command "ansible-doc -t module community.general.slack" returned exit status 1.
>>> Standard Error
ERROR! module community.general.slack missing documentation (or could not parse documentation): community.general.slack did not contain a DOCUMENTATION attribute (/root/ansible_collections/community/general/plugins/modules/slack.py). Unable to parse documentation in python file '/root/ansible_collections/community/general/plugins/modules/slack.py': invalid syntax (<unknown>, line 618). invalid syntax (<unknown>, line 618)
The test ansible-test sanity --test validate-modules [explain] failed with 1 error:
plugins/modules/slack.py:0:0: python-syntax-error: Python SyntaxError while parsing module
The test extra-docs failed with 2 errors:
plugins/modules/slack.py:0:0: Did not return correct DOCUMENTATION
plugins/modules/slack.py:0:0: Missing documentation or could not parse documentation: community.general.slack did not contain a DOCUMENTATION attribute (/tmp/antsibull-docs-8xllr_zr/ansible_collections/community/general/plugins/modules/slack.py). Unable to parse documentation in python file '/tmp/antsibull-docs-8xllr_zr/ansible_collections/community/general/plugins/modules/slack.py': invalid syntax (<unknown>, line 618). invalid syntax (<unknown>, line 618)
The test ansible-test sanity --test compile --python 3.10 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: SyntaxError: try:
The test ansible-test sanity --test compile --python 3.11 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: SyntaxError: try:
The test ansible-test sanity --test compile --python 3.12 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: SyntaxError: try:
The test ansible-test sanity --test compile --python 3.13 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: SyntaxError: try:
The test ansible-test sanity --test compile --python 3.8 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: SyntaxError: try:
The test ansible-test sanity --test compile --python 3.9 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: SyntaxError: try:
The test ansible-test sanity --test import --python 3.10 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 3.11 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 3.12 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 3.13 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 3.8 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 3.9 [explain] failed with 1 error:
plugins/modules/slack.py:618:9: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test pep8 [explain] failed with 7 errors:
plugins/modules/slack.py:618:9: E122: continuation line missing indentation or outdented
plugins/modules/slack.py:619:28: E251: unexpected spaces around keyword / parameter equals
plugins/modules/slack.py:619:30: E251: unexpected spaces around keyword / parameter equals
plugins/modules/slack.py:620:9: E122: continuation line missing indentation or outdented
plugins/modules/slack.py:621:29: E251: unexpected spaces around keyword / parameter equals
plugins/modules/slack.py:621:31: E251: unexpected spaces around keyword / parameter equals
plugins/modules/slack.py:623:13: E123: closing bracket does not match indentation of opening bracket's line
The test ansible-test sanity --test yamllint [explain] failed with 1 error:
plugins/modules/slack.py:618:9: python-syntax-error: invalid syntax (<unknown>, line 618)
The test ansible-test sanity --test ansible-doc [explain] failed with the error:
Command "ansible-doc -t module community.general.slack" returned exit status 1.
>>> Standard Error
ERROR! module community.general.slack missing documentation (or could not parse documentation): community.general.slack did not contain a DOCUMENTATION attribute (/root/ansible_collections/community/general/plugins/modules/slack.py). Unable to parse documentation in python file '/root/ansible_collections/community/general/plugins/modules/slack.py': invalid syntax (<unknown>, line 618). invalid syntax (<unknown>, line 618)
The test ansible-test sanity --test validate-modules [explain] failed with 1 error:
plugins/modules/slack.py:0:0: python-syntax-error: Python SyntaxError while parsing module
The test ansible-test sanity --test pep8 [explain] failed with 2 errors:
plugins/modules/slack.py:616:15: E111: indentation is not a multiple of 4
plugins/modules/slack.py:626:11: E111: indentation is not a multiple of 4
The test ansible-test sanity --test pep8 [explain] failed with 2 errors:
plugins/modules/slack.py:616:15: E111: indentation is not a multiple of 4
plugins/modules/slack.py:626:11: E111: indentation is not a multiple of 4
The test ansible-test sanity --test pep8 [explain] failed with 2 errors:
plugins/modules/slack.py:616:15: E111: indentation is not a multiple of 4
plugins/modules/slack.py:626:11: E111: indentation is not a multiple of 4
The test ansible-test sanity --test pep8 [explain] failed with 2 errors:
plugins/modules/slack.py:616:15: E111: indentation is not a multiple of 4
plugins/modules/slack.py:626:11: E111: indentation is not a multiple of 4
Hi @Powma
You are probably busy, but the PR is very close to being good to go, and we're having a release of the collection next week. Do you think you will have time to give it some TLC before that? No pressure, just trying to work on the logistics, there will be other releases in the future. :-)
needs_info
@Powma This pullrequest is waiting for your response. Please respond or the pullrequest will be closed.
@Powma You have not responded to information requests in this pullrequest so we will assume it no longer affects you. If you are still interested in this, please create a new pullrequest with the requested information.