https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37025
--- Comment #24 from Paul Derscheid <[email protected]> --- Created attachment 191345 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191345&action=edit Bug 37025: (QA follow-up) Use standard koha- script invocation pattern - Add Koha::Perl::Instance module for shared environment setup logic - Script now takes instance name as last argument - Re-exec with proper environment setup (PERL5LIB, KOHA_CONF) - Pass arguments directly via exec() to avoid shell quoting issues - Support both package and git installs - Use Koha::Script to set CLI interface for proper audit logging - Add APIKEY module to log viewer - Add translation for GENERATE action - Usage: sudo koha-api-keys [options] instancename - Update POD and DocBook XML documentation The new Koha::Perl::Instance module provides reusable functions for other perl-based debian scripts that need to run in a Koha environment: - in_koha_env(): Check if already running in Koha environment - get_instance_perl5lib(): Get PERL5LIB for an instance - reexec_in_koha_env(): Re-execute script with proper environment Test plan: NOTE: For testing, copy files first: cp debian/scripts/koha-api-keys /usr/sbin/ mkdir -p /usr/share/koha/bin/Koha/Perl cp debian/scripts/Koha/Perl/Instance.pm /usr/share/koha/bin/Koha/Perl/ 1. Test help output: sudo koha-api-keys --help 2. Test API key generation (with spaces in description): sudo koha-api-keys --generate --description 'Test key' --borrowernumber 51 instancename => Should output Client ID and Client Secret 3. Test interactive deletion: sudo koha-api-keys --delete instancename => Should prompt for Client ID, then delete 4. Test scripted deletion: sudo koha-api-keys --delete --client-id CLIENT_ID instancename => Should delete without prompting 5. Test error handling: sudo koha-api-keys --generate --description test instancename => Should show error about missing --borrowernumber 6. Test invalid instance: sudo koha-api-keys --generate --description test --borrowernumber 51 nonexistent => Should show error about instance not existing 7. Verify audit logging in log viewer: - Go to Tools > Log viewer - Select "API keys" module - Should see GENERATE and DELETE actions with interface "Command-line" 8. Verify DocBook XML validation: prove -v xt/verify-debian-docbook.t -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
