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

Plugin installation failure #6

Open pdruzhinin opened 4 years ago

pdruzhinin commented 4 years ago

I'm unable to install plugin 'aks-clusters' using the module from this repository, receiving the following error. Adding 'impersonate user' parameter for a token did not help.

failed: [****-dss-sandbox01.****.com] (item=aks-clusters) => {"ansible_loop_var": "item", "changed": false, "item": "aks-clusters", "msg": "org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.Error: No associated user in this authentication context (source=CONFIGURABLE_API_KEY_GLOBAL)\n\nTraceback (most recent call last):\n File \"/tmp/ansible_dss_plugin_payload_d4sgorjx/ansible_dss_plugin_payload.zip/ansible/module_utils/dataikuapi/dssclient.py\", line 971, in _perform_http\n http_res.raise_for_status()\n File \"/usr/lib/python3.6/site-packages/requests/models.py\", line 940, in raise_for_status\n raise HTTPError(http_error_msg, response=self)\nrequests.exceptions.HTTPError: 500 Server Error: Server Error for url: http://127.0.0.1:********/dip/publicapi/plugins/actions/installFromStore\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/tmp/ansible_dss_plugin_payload_d4sgorjx/ansible_dss_plugin_payload.zip/ansible/modules/dss_plugin.py\", line 202, in run_module\n File \"/tmp/ansible_dss_plugin_payload_d4sgorjx/ansible_dss_plugin_payload.zip/ansible/module_utils/dataikuapi/dssclient.py\", line 246, in install_plugin_from_store\n \"pluginId\": plugin_id\n File \"/tmp/ansible_dss_plugin_payload_d4sgorjx/ansible_dss_plugin_payload.zip/ansible/module_utils/dataikuapi/dssclient.py\", line 987, in _perform_json\n return self._perform_http(method, path, params=params, body=body, files=files, stream=False, raw_body=raw_body).json()\n File \"/tmp/ansible_dss_plugin_payload_d4sgorjx/ansible_dss_plugin_payload.zip/ansible/module_utils/dataikuapi/dssclient.py\", line 978, in _perform_http\n raise DataikuException(\"%s: %s\" % (ex.get(\"errorType\", \"Unknown error\"), ex.get(\"message\", \"No message\")))\nansible.module_utils.dataikuapi.utils.DataikuException: org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.Error: No associated user in this authentication context (source=CONFIGURABLE_API_KEY_GLOBAL)\n\n\n File \"/home/****/.ansible/tmp/ansible-tmp-1597409308.2410111-157161467225112/AnsiballZ_dss_plugin.py\", line 102, in <module>\n _ansiballz_main()\n File \"/home/****/.ansible/tmp/ansible-tmp-1597409308.2410111-157161467225112/AnsiballZ_dss_plugin.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/****/.ansible/tmp/ansible-tmp-1597409308.2410111-157161467225112/AnsiballZ_dss_plugin.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.dss_plugin', init_globals=None, run_name='__main__', alter_sys=True)\n File \"/usr/lib64/python3.6/runpy.py\", line 205, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib64/python3.6/runpy.py\", line 96, in _run_module_code\n mod_name, mod_spec, pkg_name, script_name)\n File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_dss_plugin_payload_d4sgorjx/ansible_dss_plugin_payload.zip/ansible/modules/dss_plugin.py\", line 261, in <module>\n File \"/tmp/ansible_dss_plugin_payload_d4sgorjx/ansible_dss_plugin_payload.zip/ansible/modules/dss_plugin.py\", line 258, in main\n File \"/tmp/ansible_dss_plugin_payload_d4sgorjx/ansible_dss_plugin_payload.zip/ansible/modules/dss_plugin.py\", line 254, in run_module\n"}

pdruzhinin commented 4 years ago

I've tried another plugin (timeseries-preparation) and it fails with the same error.

duckie commented 4 years ago

Hello @pdruzhinin

Thank you for reporting this.

This error is sent because you try to install the plugin from the plugin store. Unfortunately, this is only possible with a user api key, not an admin api key, hence the message "No associated user in this authentication context ". User api keys can only be created in DSS UI. There is no automated way to create them yet, so it cannot be fixed on module side only.

To get out of this situation, either:

duckie commented 4 years ago

I reopen the issue until it is properly documented.

Auratons commented 2 years ago

Hello @pdruzhinin

Thank you for reporting this.

This error is sent because you try to install the plugin from the plugin store. Unfortunately, this is only possible with a user api key, not an admin api key, hence the message "No associated user in this authentication context ". User api keys can only be created in DSS UI. There is no automated way to create them yet, so it cannot be fixed on module side only.

To get out of this situation, either:

  • Install the plugin from a zip file or a github repo: this is supported with an admin api key
  • Use a user api key generated manually and available in your ansible facts.

Hello @duckie

This is a really interesting one. Conceptually, plugins are globally visible, but must be installed with a personal api key -- this doesn't seem as a necessity, just as an internal implementation's problem. This impression is even amplified by the fact that most(/all?) of other (global) administrative tasks can be done by a global API key.

The fact, that a personal API key cannot be created by Ansible is very unfortunate, the manual step in the deployment process complicates management of multiple Dataiku deployments within one company -- you must have a two stage deployment process, in the middle, you must created a personal API key, put it into your secrets manager, possibly create a PR, and after that deploy the rest of the Ansible code.

Finally, zip file installation just doesn't work. I'm creating a bug.

When summing it up, there is absolutely no working automated way how to install a plugin to Dataiku right now. There are more issues with plugin installation (more about them in other issues).