You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by XiLai Dai <xl...@talend.com> on 2017/02/27 07:50:23 UTC

Fail to execute macro-command e.g. la by client with karaf 4.1.0

Hi,


On karaf 4.1.0, the macro-commands defined in the etc/shell.init.script failed to execute from client/client.bat.


For example even with the "la" command:

G:\download\apache-karaf-4.1.0\bin>client.bat -h localhost -u karaf "la"
Logging in as karaf
Password:
Command not found: la
G:\download\apache-karaf-4.1.0\bin>


Any changes should be made in the ACL configuration? or is this a bug on 4.1.0?


Thanks

Xilai

Re: Fail to execute macro-command e.g. la by client with karaf 4.1.0

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Good catch.

I will take a look later today.

Regards
JB

On 02/28/2017 07:51 AM, XiLai Dai wrote:
> After debugging, the root cause is the shell.init.script couldn't be
> found with the default property in the system.properties
>
> {code}
>
> #
> # Location of a shell script that will be run when starting a shell
> # session. This script can be used to create aliases and define
> # additional commands.
> # Do not use absolute paths to avoid problems on windows.
> #
> karaf.shell.init.script = etc/shell.init.script,etc/scripts/*.script
>
> {code}
>
>
> the absolute path doesn't work on windows so by default it's using
> relative path, but FileNotFound will be thrown from
> org.apache.karaf.shell.ssh.ShellCommand.executeScript() when try to
> connect to karaf using client/client.bat/ssh.
>
>
> The workarount I found is adding "karaf.exec.init.script" property
> together with "karaf.shell.init.script" in the system.properties
>
> {code}
>
> karaf.exec.init.script = ${karaf.etc}/shell.init.script
>
> {code}
>
>
> Also the default shell.init.script need to be clean up a bit, otherwize,
> some shell scripts lines can't be parsed/executed.
>
> I think the logical in the org.apache.karaf.shell.ssh.ShellCommand class
> should be synced with the
> org.apache.karaf.shell.impl.console.ConsoleSessionImpl class.
>
>
> Regards.
>
> Xilai
>
> ------------------------------------------------------------------------
> *From:* XiLai Dai <xl...@talend.com>
> *Sent:* Monday, February 27, 2017 4:55:31 PM
> *To:* user@karaf.apache.org
> *Subject:* Re: Fail to execute macro-command e.g. la by client with
> karaf 4.1.0
>
>
> JB,
>
>
> yes, exactly, it's only about aliases commands defined in the
> etc/shell.init.script.
>
> ------------------------------------------------------------------------
> *From:* Jean-Baptiste Onofr <jb...@nanthrax.net>
> *Sent:* Monday, February 27, 2017 4:44:56 PM
> *To:* user@karaf.apache.org
> *Subject:* Re: Fail to execute macro-command e.g. la by client with
> karaf 4.1.0
>
> Hi Xilai,
>
> I guess that client.bat "bundle:list" works ?
>
> I suspect something about the aliases.
>
> Regards
> JB
>
> On 02/27/2017 08:50 AM, XiLai Dai wrote:
>> Hi,
>>
>>
>> On karaf 4.1.0, the macro-commands defined in the etc/shell.init.script
>> failed to execute from client/client.bat.
>>
>>
>> For example even with the "la" command:
>>
>> G:\download\apache-karaf-4.1.0\bin>client.bat -h localhost -u karaf "la"
>> Logging in as karaf
>> Password:
>> Command not found: la
>> G:\download\apache-karaf-4.1.0\bin>
>>
>>
>> Any changes should be made in the ACL configuration? or is this a bug on
>> 4.1.0?
>>
>>
>> Thanks
>>
>> Xilai
>>
>
> --
> Jean-Baptiste Onofr
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com

-- 
Jean-Baptiste Onofr
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Fail to execute macro-command e.g. la by client with karaf 4.1.0

Posted by XiLai Dai <xl...@talend.com>.
After debugging, the root cause is the shell.init.script couldn't be found with the default property in the system.properties

{code}

#
# Location of a shell script that will be run when starting a shell
# session. This script can be used to create aliases and define
# additional commands.
# Do not use absolute paths to avoid problems on windows.
#
karaf.shell.init.script = etc/shell.init.script,etc/scripts/*.script


{code}


the absolute path doesn't work on windows so by default it's using relative path, but FileNotFound will be thrown from org.apache.karaf.shell.ssh.ShellCommand.executeScript() when try to connect to karaf using client/client.bat/ssh.


The workarount I found is adding "karaf.exec.init.script" property together with "karaf.shell.init.script" in the system.properties

{code}

karaf.exec.init.script = ${karaf.etc}/shell.init.script

{code}


Also the default shell.init.script need to be clean up a bit, otherwize, some shell scripts lines can't be parsed/executed.

I think the logical in the org.apache.karaf.shell.ssh.ShellCommand class should be synced with the org.apache.karaf.shell.impl.console.ConsoleSessionImpl class.


Regards.

Xilai

________________________________
From: XiLai Dai <xl...@talend.com>
Sent: Monday, February 27, 2017 4:55:31 PM
To: user@karaf.apache.org
Subject: Re: Fail to execute macro-command e.g. la by client with karaf 4.1.0


JB,


yes, exactly, it's only about aliases commands defined in the etc/shell.init.script.

________________________________
From: Jean-Baptiste Onofré <jb...@nanthrax.net>
Sent: Monday, February 27, 2017 4:44:56 PM
To: user@karaf.apache.org
Subject: Re: Fail to execute macro-command e.g. la by client with karaf 4.1.0

Hi Xilai,

I guess that client.bat "bundle:list" works ?

I suspect something about the aliases.

Regards
JB

On 02/27/2017 08:50 AM, XiLai Dai wrote:
> Hi,
>
>
> On karaf 4.1.0, the macro-commands defined in the etc/shell.init.script
> failed to execute from client/client.bat.
>
>
> For example even with the "la" command:
>
> G:\download\apache-karaf-4.1.0\bin>client.bat -h localhost -u karaf "la"
> Logging in as karaf
> Password:
> Command not found: la
> G:\download\apache-karaf-4.1.0\bin>
>
>
> Any changes should be made in the ACL configuration? or is this a bug on
> 4.1.0?
>
>
> Thanks
>
> Xilai
>

--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Fail to execute macro-command e.g. la by client with karaf 4.1.0

Posted by XiLai Dai <xl...@talend.com>.
JB,


yes, exactly, it's only about aliases commands defined in the etc/shell.init.script.

________________________________
From: Jean-Baptiste Onofré <jb...@nanthrax.net>
Sent: Monday, February 27, 2017 4:44:56 PM
To: user@karaf.apache.org
Subject: Re: Fail to execute macro-command e.g. la by client with karaf 4.1.0

Hi Xilai,

I guess that client.bat "bundle:list" works ?

I suspect something about the aliases.

Regards
JB

On 02/27/2017 08:50 AM, XiLai Dai wrote:
> Hi,
>
>
> On karaf 4.1.0, the macro-commands defined in the etc/shell.init.script
> failed to execute from client/client.bat.
>
>
> For example even with the "la" command:
>
> G:\download\apache-karaf-4.1.0\bin>client.bat -h localhost -u karaf "la"
> Logging in as karaf
> Password:
> Command not found: la
> G:\download\apache-karaf-4.1.0\bin>
>
>
> Any changes should be made in the ACL configuration? or is this a bug on
> 4.1.0?
>
>
> Thanks
>
> Xilai
>

--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Fail to execute macro-command e.g. la by client with karaf 4.1.0

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Xilai,

I guess that client.bat "bundle:list" works ?

I suspect something about the aliases.

Regards
JB

On 02/27/2017 08:50 AM, XiLai Dai wrote:
> Hi,
>
>
> On karaf 4.1.0, the macro-commands defined in the etc/shell.init.script
> failed to execute from client/client.bat.
>
>
> For example even with the "la" command:
>
> G:\download\apache-karaf-4.1.0\bin>client.bat -h localhost -u karaf "la"
> Logging in as karaf
> Password:
> Command not found: la
> G:\download\apache-karaf-4.1.0\bin>
>
>
> Any changes should be made in the ACL configuration? or is this a bug on
> 4.1.0?
>
>
> Thanks
>
> Xilai
>

-- 
Jean-Baptiste Onofr
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com