Bug 18548

Summary: running koha-create --request-db without an instance name should abort
Product: Koha Reporter: Eric Vantillard <eric.vantillard>
Component: Command-line UtilitiesAssignee: Josef Moravec <josef.moravec>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: dilan, jonathan.druart, josef.moravec, katrin.fischer, kyle, mtj, robin
Version: masterKeywords: Academy
Hardware: All   
OS: Linux   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 18548: Print usage when missing instance name in koha-create script
Bug 18548: Print usage when missing instance name in koha-create script
Screenshot after applying patch - not working
Bug 18548: Print usage when missing instance name in koha-create script
Bug 18548: Print usage when missing instance name in koha-create script

Description Eric Vantillard 2017-05-05 09:47:22 UTC
running `koha-create --request-db` without an instance name will exit with this error message

getent: invalid option -- 'k'
Try `getent --help' or `getent --usage' for more information.
[...]

It should detect that the instance name is missing and exit with an error message explaining that the instance name is mandatory
Comment 1 Josef Moravec 2017-05-05 10:23:17 UTC
Created attachment 63159 [details] [review]
Bug 18548: Print usage when missing instance name in koha-create script

Test plan:
1. Run: debian/scripts/koha-create --request-db
-> Without patch you see the getent error message
-> With patch you see usage and "Missing instance name" message
Comment 2 Eric Vantillard 2017-05-05 11:31:55 UTC
test done. it's fine. thank you
Comment 3 Josef Moravec 2017-05-05 11:42:52 UTC
(In reply to Eric Vantillard from comment #2)
> test done. it's fine. thank you

Please note:
"RESOLVED FIXED" status is for bugs pushed to all relevant versions, if you test it and it works for you, you should use "signed off" status.

See https://wiki.koha-community.org/wiki/Development_workflow

anyway thanks for testing!
Comment 4 Eric Vantillard 2017-05-05 11:45:09 UTC
understood. thanks
Comment 5 Jonathan Druart 2017-05-05 16:01:20 UTC
Josef,
Regarding `git grep -i "missing instance" debian/scripts/` I'd suggest to follow the same pattern:
  [ $# -ge 1 ] || ( usage ; die "Missing instance name..." )
Comment 6 Josef Moravec 2017-05-05 18:32:07 UTC
(In reply to Jonathan Druart from comment #5)
> Josef,
> Regarding `git grep -i "missing instance" debian/scripts/` I'd suggest to
> follow the same pattern:
>   [ $# -ge 1 ] || ( usage ; die "Missing instance name..." )

thanks Jonathan, I'll make new patch...
Comment 7 Josef Moravec 2017-05-09 06:32:59 UTC
Created attachment 63278 [details] [review]
Bug 18548: Print usage when missing instance name in koha-create script

Test plan:
1. Run: debian/scripts/koha-create --request-db
-> Without patch you see the getent error message
-> With patch you see usage and "Missing instance name" message
Comment 8 Dilan Johnpullé 2017-05-10 05:06:37 UTC
Just tried it Josef. It's still giving a 'getent [...]' message instead.
Comment 9 Josef Moravec 2017-05-10 05:35:36 UTC
(In reply to dilan from comment #8)
> Just tried it Josef. It's still giving a 'getent [...]' message instead.

Can't help it, but it works for me... how do you try to test it? On devbox?
Comment 10 Dilan Johnpullé 2017-05-10 06:31:05 UTC
Created attachment 63319 [details]
Screenshot after applying patch - not working

Yeah on a devbox. Have a look at the attachment. This is the message I get after applying the patch.
Comment 11 Josef Moravec 2017-05-10 07:11:49 UTC
(In reply to dilan from comment #10)
> Created attachment 63319 [details]
> Screenshot after applying patch - not working
> 
> Yeah on a devbox. Have a look at the attachment. This is the message I get
> after applying the patch.

On devbox you should run it as 

debian/scripts/koha-create

because that's the modified file - the koha-create in system is that one installled by package - so old version
Comment 12 Dilan Johnpullé 2017-05-17 06:22:09 UTC
Created attachment 63495 [details] [review]
Bug 18548: Print usage when missing instance name in koha-create script

My apologies Josef, you are correct. It works prefectly with the right command.
Signed-off-by: Dilan Johnpulle <dilan@calyx.net.au>
Comment 13 Jonathan Druart 2017-05-19 16:38:50 UTC
Created attachment 63581 [details] [review]
Bug 18548: Print usage when missing instance name in koha-create script

Test plan:
1. Run: debian/scripts/koha-create --request-db
-> Without patch you see the getent error message
-> With patch you see usage and "Missing instance name" message

Signed-off-by: Dilan Johnpulle <dilan@calyx.net.au>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 14 Kyle M Hall 2017-05-24 14:25:14 UTC
Pushed to master for 17.05, thanks Josef!
Comment 15 Katrin Fischer 2017-06-05 12:19:47 UTC
This patch has been pushed to 16.11.x and will be in 16.11.09.
Comment 16 Mason James 2017-07-31 11:03:07 UTC
Pushed to 16.05.x, for 16.05.15 release