script-server icon indicating copy to clipboard operation
script-server copied to clipboard

Executing an ansible playbook with user + password requires the parameter "same_arg_param"

Open DanielSchwartz1 opened this issue 1 year ago • 2 comments

Hi,

I am running the script-server version 1.17 within a docker container.

I have in my script inventory, an ansible playbook which requires the parameter "user" + "pw". When setting the parameters, it requires to flag the setting "Combine param with value". Also it requires to set the "Param" field to "-e ansible_user=".

Only if these setting is set to true ("same_arg_param": true), the playbook is executed properly.

The problem is that, after the script-server is restarted, these setting ("same_arg_param": true) for the parameter is removed from the runner json file of the dedicated script.

The assumption is that with the migration from 1.16 to 1.17 there is deletion of this parameter in the migrate.py file. https://github.com/bugy/script-server/blob/master/src/migrations/migrate.py#L306C1-L307C48 if same_arg_param is not None: del parameter['same_arg_param']

I see that the value "multiselect_argument_type": "repeat_param_value" is being added to the json file, but it does not have the same effect.

Do you have an easy fix for that?

Thank you very much!

DanielSchwartz1 avatar Dec 04 '23 15:12 DanielSchwartz1

Hi @DanielSchwartz1, to be honest, I don't remember the reason for this migration already. As far as I remember, there was some issue with inverting the meaning of the parameter for multi-select lists. But clearly, I missed your use case.

For you, as a quick solution, I would recommend keeping temp folder between restarts (i.e. mount it to some volume). In this folder it's stored, which migrations were executed already and do not reapply them.

bugy avatar Dec 06 '23 10:12 bugy

Thank you very much @bugy! It is possible to fix it with this approach.

Inside the Dockerfile:

  • Create the temp folder
  • Copy the migrations.txt to that temp folder

Migrations.txt has the content like: migrate_repeat_param_and_same_arg_param

DanielSchwartz1 avatar Dec 06 '23 12:12 DanielSchwartz1