Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

foss_cli: Not able to upload a file (error:fossology.exceptions.FossologyApiError: Upload upload via foss-cli could not be performed: Require uploadType (400)) #133

Open
IrinSamuel opened this issue Apr 30, 2024 · 3 comments

Comments

@IrinSamuel
Copy link

IrinSamuel commented Apr 30, 2024

Hi,

I installed fossology 3.2.0 and used the foss_cli. The fossology server is spinned up using docker and available and running at http://localhost:8081/repo
These are the commands followed:

  1. foss_cli config
  2. foss_cli -vv create_group FossGroup
  3. foss_cli -vv create_folder FossFolder --folder_group FossGroup --folder_description "Description of FossFolder"
  4. foss_cli -vv upload_file --folder_name FossFolder --access_level public /mnt/c/Users/xxx/Downloads/xxx.tar.gz

Step1 to 3 works, but for Step4, this is the output I get,


2024-04-30 11:20:23,035 - DEBUG - [foss_cli.py:305] - foss_cli called with: ['/home/xxxx/env_fossology/bin/foss_cli',
'-vv',
'upload_file',
'--folder_name',
'FossFolder',
'--access_level',
'public',
'/mnt/c/Users/xxxx/Downloads/xxxx.tar.gz']
2024-04-30 11:20:23,035 - DEBUG - [foss_cli.py:146] - Function needs_later_initialization_of_foss_instance called {'DEBUG': False,
'IS_REQUEST_FOR_CONFIG': False,
'IS_REQUEST_FOR_HELP': False,
'RESULT_DIR': '.foss_cli_results',
'TOKEN': None,
'VERBOSE': 2}
2024-04-30 11:20:23,035 - DEBUG - [foss_cli.py:309] - Initializing Fossology client according to the CLI context
2024-04-30 11:20:23,035 - DEBUG - [foss_cli.py:198] - INIT FOSS
2024-04-30 11:20:23,035 - DEBUG - [foss_cli.py:207] - Set server token from configfile http://localhost:8081/repo:xxxx
2024-04-30 11:20:23,179 - DEBUG - [foss_cli.py:224] - Logged in as user fossy
2024-04-30 11:20:23,184 - DEBUG - [foss_cli.py:555] - Try to upload file /mnt/c/Users/xxxx/Downloads/xxxx.tar.gz
2024-04-30 11:20:23,184 - DEBUG - [foss_cli.py:94] - Found upload folder FossFolder with id 3
Traceback (most recent call last):
File "/home/xxxx/env_fossology/bin/foss_cli", line 8, in
sys.exit(main())
^^^^^^
File "/home/xxxx/env_fossology/lib/python3.12/site-packages/fossology/foss_cli.py", line 813, in main
cli(obj=d) # pragma: no cover
^^^^^^^^^^
File "/home/xxxx/env_fossology/lib/python3.12/site-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxxx/env_fossology/lib/python3.12/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/home/xxxx/env_fossology/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxxx/env_fossology/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxxx/env_fossology/lib/python3.12/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxxx/env_fossology/lib/python3.12/site-packages/click/decorators.py", line 33, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxxx/env_fossology/lib/python3.12/site-packages/fossology/foss_cli.py", line 570, in upload_file
the_upload = foss.upload_file(
^^^^^^^^^^^^^^^^^
File "/home/xxxx/env_fossology/lib/python3.12/site-packages/fossology/uploads.py", line 309, in upload_file
raise FossologyApiError(description, response)
fossology.exceptions.FossologyApiError: Upload upload via foss-cli could not be performed: Require uploadType (400)


I also tried different other type of files (*.zip, *.txt) to upload, but could not do it successfully. However, uploading manually is successfull. Can you let me know what is wrong.

Thanks and regards,
Irin

@deveaud-m
Copy link
Collaborator

Dear @IrinSamuel,

thanks for the very precise bug report. This error has been fixed in version 3.2.1: https://github.com/fossology/fossology-python/releases/tag/v3.2.1.

Can you give it a try?

@IrinSamuel
Copy link
Author

IrinSamuel commented May 13, 2024

Hi @deveaud-m

Thanks for your answer. I tried now with the latest v3.2.1 and it works. However, this release is not available with pip install https://pypi.org/project/fossology/

The latest there is still 3.2.0. Can you please add this release there as well so that I can use it with pip and not do a manual install?

Thanks and regards,
Irin

@IrinSamuel
Copy link
Author

@deveaud-m any updates on this one? Can you publish 3.2.1 to pypi.org

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants