dataiku / dataiku-ansible-modules

A role packaging custom modules to administrate a Dataiku Data Science Studio intance
https://dataiku.com
Apache License 2.0
10 stars 8 forks source link

[BUG] dss_plugin installation of zipped plugin doesn't work #11

Open Auratons opened 2 years ago

Auratons commented 2 years ago

We were not able to install zipped plugins by the ansible module (checked even with guys from Dataiku).

dss_plugin:
    api_key: <personal api key>
    port: <port>
    zip_file: <local path to zip>
    state: present
    plugin_id: <id>

We tried several ways of zipping our plugin (zip, tar, MacOS UI) -- all of them were installable from Dataiku UI by clicking, but none of them was installable by the Ansible module. It eventually ends with Java exception that says nothing.

matt6697 commented 1 year ago

The issue seems to caused by the future = client.install_plugin_from_archive(args.zip_file) line in library/dss_plugin.py :

  1. The install_plugin_from_archive() is called with the name of the file to upload instead of fileObj as described in python requests documentation. As a result, the name of the file is uploaded to the server instead of the zip file content.

  2. The install_plugin_from_archive() function of dataiku-api-client does not return any future object, which cause the result["job_results"].append(future.wait_for_result()) code line to fail

files – (optional) Dictionary of 'name': file-like-objects (or {'name': file-tuple}) for multipart encoding upload. file-tuple can be a 2-tuple ('filename', fileobj), 3-tuple ('filename', fileobj, 'content_type') or a 4-tuple ('filename', fileobj, 'content_type', custom_headers), where 'content-type' is a string defining the content type of the given file and custom_headers a dict-like object containing additional headers to add for the file.

matt6697 commented 1 year ago

@cstenac : PR https://github.com/dataiku/dataiku-ansible-modules/pull/16 is proposed to fix this issue. Would you mind to review this PR as this issue is quite annoying to fully automate DSS instance deployment with ansible ?