Showing posts with label apache karaf tac shell script 4.1.5 4.0.9 differences. Show all posts
Showing posts with label apache karaf tac shell script 4.1.5 4.0.9 differences. Show all posts

Sunday, February 18, 2018

Karaf Shell Scripting Caveats - Part I

Karaf Shell Scripting is an incredibly powerful tool - it makes the Karaf platform even more of a very portable operating system riding over the Java Virtual Machine

But I'm learning the pitfalls of upgrading and it impacts shell scripting as well. I recently upgraded from Karaf 4.0.9 to Karaf 4.1.5 and a possibly rash dependence on shell:tac behavior, broke some very critical scripts.

I had created scripts in Karaf 4.0.9 to parse the output of a jdbc:query as follows:

jdbc:query localhost.information_schema "select schema_name from schemata"
The response on screen looks like this:
schema_name
------------------
information_schema
123homeloans
aark_digital
arihant_bak
mysql
performance_schema
sys


I used to parse the output with the following code:
dbList = (jdbc:query $hostName\.information_schema "select schema_name from schemata"  |  tac) ;
each ($dbList split "\n") {echo $it}  

I depended on newlines being inserted by tac. This is no longer the case in Karaf 4.1.5 - you only have spaces between the records

There is also some minor but significant changes in the behavior of scripting around closures - see the following link for a discussion on this: KARAF-5613