[Enhancement] Add parameters for executing actions programatically from calibre-server --manage-users

Bug #1912337 reported by Jonas Vacek
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Undecided
Unassigned

Bug Description

I would like to be able to create users for calibredb on the command line as part of an installation script, and due to the script being interactive, this hampers my flow a bit.

I've attempted to pipe the "answers" via stdin like so, but had little luck past "1"

``` bash
echo -e "1\n$user\n$password\n$password" > /tmp/calibreserverstdin.txt
calibre-server --userdb ~/.calibreconf/usrdb.sqlite --manage-users < /tmp/csuservdinput.txt
```

Having options like `--add-user $username $password`, `--change-pass $username $newpass` or `--remove-user $username` would be grand!

Jonas Vacek (jvacek)
tags: added: cli
tags: added: calibre-server content-server
Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 1912337

Should be trivial to do using the expect tool.

Revision history for this message
Jonas Vacek (jvacek) wrote :

I would assume so, however that is a dependency that is not available by default on most OS. This would be an extra package as well as its requirements that you'd have to install in order to do what is somewhat standard from most other tools that expose user management on the CLI.

Revision history for this message
Kovid Goyal (kovid) wrote : Fixed in master

Fixed in branch master. The fix will be in the next release. calibre is usually released every alternate Friday.

 status fixreleased

Changed in calibre:
status: New → Fix Released
Revision history for this message
Jonas Vacek (jvacek) wrote :

Essentially, the underlying issue is that the password does not seem to be passable via normal means to the CLI. I actually wonder now if expect would suffer from the same thing

When i run `echo -e "1\n$user\n\n$pass\n$pass" | calibre-server --userdb ~/.calibreconf/usrdb.sqlite --manage-users` I get stuck at the password prompt. The extra line-break after the user seems to not do much to the script.

```
1) Add a new user
2) Edit an existing user
3) Remove a user
4) Cancel

What do you want to do? [1-4]: Enter the username: Enter the new password for test:
Re-enter the new password for test, to verify:
User test added successfully!
```

Revision history for this message
Jonas Vacek (jvacek) wrote :

Ah, I didn't see the message before posting. Thanks a ton for the lightning fast turnaround!

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers