Kimai2: Make kimai:create-user scriptable

Created on 2 Dec 2019  路  8Comments  路  Source: kevinpapst/kimai2

It appears that console kimai:create-user don't work in non-interactive mode?

console -n kimai:create-user chris email="[email protected]" password="foobar"
13:43:48 ERROR     [console] Error thrown while running command "-n kimai:create-user chris '[email protected]' 'password=foobar'". Message: "Return value of App\Command\CreateUserCommand::askForPassword() must be of the type string, null returned" ["exception" => TypeError { 鈥,"command" => "-n kimai:create-user chris '[email protected]' 'password=foobar'","message" => "Return value of App\Command\CreateUserCommand::askForPassword() must be of the type string, null returned"]

In CreateUserCommand.php line 167:

  Return value of App\Command\CreateUserCommand::askForPassword() must be of the type string, null returned  


kimai:create-user [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> <username> <email> [<role> [<password>]]

I'd like to be able to create the first admin user via Ansible without having to resort to using expect if possible.

support

All 8 comments

RTFM 馃榿

bin/console kimai:create-user chris [email protected] ROLE_SUPER_ADMIN foobar123

BTW: I never used Ansible, but having a public recipe (or role if that is the ansible wording) is a great idea.

If it is done, can you please share it - eg. in the Kimai documentation?
https://github.com/kimai/www.kimai.org/blob/master/_documentation/installation.md

Thanks @kevinpapst, would this addition be suitable for a pull request?

Almost, please move it below FTP installation, then its fine (even though I am not a big fan of commercial links ... no promise that it will stay there forever).

Any chance this check (and the one for update) could be changed:

     failed_when: ( "Successfully installed Kimai 2 version {{ kimai_version }} " not in kimai_install.stdout )

Who knows if I will change the output at some point. Can you use the exit code?

Looks good! Just drop in the PR

Thanks Kevin, I have simply removed the failed_when lines — if the exit code isn't 0 the tasks will stop at this point without them.

I wouldn't call Webarchitects commercial, we have never made a profit, only host good causes, mostly non-profits and pay terrible wages :roll_eyes:, but remove the hyperlink if you wish :slightly_smiling_face:.

In that case you are more than welcome to keep it

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. If you use Kimai on a daily basis, please consider donating to support further development of Kimai.

Was this page helpful?
0 / 5 - 0 ratings