Re: bin/client fails to connect when called via ansible.builtin.shell

2022-01-18 Thread Freeman Fang
Yes, this is the TTY thing and I ran into the same thing before.

On Tue, Jan 18, 2022 at 5:51 PM VIEILLARD Francois <
francois.vieill...@soprasteria.com> wrote:

> Hi Ralf
>
> I had the exact same problem as you and I found that the script fails
> because there is no TTY in the remote session opened using ansible
>
> You could use the script batch mode instead, which doesn’t require TTY
> (flag -b in the script)
>
> So your ansible task would become:
>
> - name: Use Karaf Client
>shell: "./client -v -l 4 -b <<< ls"
>
shell: "echo "no tty input"|./client -v -l 4 -b"

should also work



>args:
>  chdir: "{{ karaf_install_symlink }}/bin"
>
>
>
> Regards,
>
> François
>
>
>
> On 2022/01/04 20:17:37 Ralf Steppacher wrote:
> > Hello all,
> >
> > I am trying to provision Karaf using Ansible (on localhost). All is good
> > until I first try to use the bin/client script to interact with the
> > local Karaf server. For some reason all interactions, no matter what I
> > try, end with the error "Closed". However, I can run the client script
> > successfully on the command line. I ran the client with full trace logs
> > (-v -l 4) with Ansible and on the command line and diffed the output.
> > Apart from session IDs, timestamps, and encrypted content on the wire
> > the logs look identical as far as I can see until we reach this line:
> >
> > [main] DEBUG org.apache.sshd.client.session.ClientSessionImpl -
> > createExecChannel([ClientSessionImpl[karaf@localhost/127.0.0.1:8101],
> > ls, 0, null])[null] created id={} - PTY={}
> >
> > After which the client continues to process the ls command if called on
> > the command line and immediately closes the connection when called via
> > Ansible:
> >
> > 525 [Thread-2] DEBUG org.apache.sshd.client.channel.ChannelExec -
> > close(ChannelExec[id=0,
> > recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101])
> Closing
> > immediately
> > 525 [Thread-2] DEBUG org.apache.sshd.client.channel.ChannelExec -
> > close(ChannelExec[id=0,
> > recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101])
> prevent
> > sending EOF
> > 525 [main] DEBUG org.apache.sshd.client.channel.ChannelExec -
> > open(ChannelExec[id=0,
> > recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) Send
> > SSH_MSG_CHANNEL_OPEN - type=session
> > 525 [Thread-2] DEBUG org.apache.sshd.common.channel.Window - Closing
> > Window[client/local](ChannelExec[id=0,
> > recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101])
> > 525 [main] DEBUG org.apache.sshd.client.channel.ChannelExec -
> > writePacket(ChannelExec[id=0,
> > recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101])
> > Discarding output packet because channel state=Immediate
> > 525 [Thread-2] DEBUG org.apache.sshd.common.channel.Window - Closing
> > Window[client/remote](ChannelExec[id=0,
> > recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101])
> > [..]
> >
> > All output is on level DEBUG or TRACE. No error is reported.
> >
> > The Ansible task is as simple as they come:
> >
> > - name: Use Karaf Client
> >shell: "./client -v -l 4 ls"
> >args:
> >  chdir: "{{ karaf_install_symlink }}/bin"
> >
> > The karaf server log shows the connection, and a while later logs an
> > authentication timeout, presumably because the client left the
> > conversation dangling.
> >
> > 2022-01-04T20:53:13,178 | INFO  |
> > sshd-SshServer[315a8514](port=8101)-nio2-thread-2 | ServerSessionImpl
> >  | 43 - org.apache.sshd.osgi - 2.5.1 | Session
> > karaf@/127.0.0.1:33910 authenticated
> > 2022-01-04T20:55:12,564 | INFO  |
> > sshd-SshServer[315a8514](port=8101)-timer-thread-1 | ServerSessionImpl
> >   | 43 - org.apache.sshd.osgi - 2.5.1 |
> > Disconnecting(ServerSessionImpl[null@/127.0.0.1:33908]):
> > SSH2_DISCONNECT_PROTOCOL_ERROR - Detected AuthTimeout after
> > 120181/12 ms.
> > 2022-01-04T20:55:12,566 | WARN  |
> > sshd-SshServer[315a8514](port=8101)-nio2-thread-2 | ServerSessionImpl
> >  | 43 - org.apache.sshd.osgi - 2.5.1 |
> > disconnect(ServerSessionImpl[null@/127.0.0.1:33908]) operation failed
> > (IOException) for reason=SSH2_DISCONNECT_PROTOCOL_ERROR [Detected
> > AuthTimeout after 120181/12 ms.]: Broken pipe
> >
> > Where would I have to tweak the setup to make the karaf client work
> > through Ansible?
> >
> >
> > Thanks!
> > Ralf
> >
>


RE: bin/client fails to connect when called via ansible.builtin.shell

2022-01-18 Thread VIEILLARD Francois
Hi Ralf
I had the exact same problem as you and I found that the script fails because 
there is no TTY in the remote session opened using ansible
You could use the script batch mode instead, which doesn’t require TTY (flag -b 
in the script)
So your ansible task would become:
- name: Use Karaf Client
   shell: "./client -v -l 4 -b <<< ls"
   args:
 chdir: "{{ karaf_install_symlink }}/bin"

Regards,
François


On 2022/01/04 20:17:37 Ralf Steppacher wrote:
> Hello all,
>
> I am trying to provision Karaf using Ansible (on localhost). All is good
> until I first try to use the bin/client script to interact with the
> local Karaf server. For some reason all interactions, no matter what I
> try, end with the error "Closed". However, I can run the client script
> successfully on the command line. I ran the client with full trace logs
> (-v -l 4) with Ansible and on the command line and diffed the output.
> Apart from session IDs, timestamps, and encrypted content on the wire
> the logs look identical as far as I can see until we reach this line:
>
> [main] DEBUG org.apache.sshd.client.session.ClientSessionImpl -
> createExecChannel([ClientSessionImpl[karaf@localhost/127.0.0.1:8101],
> ls, 0, null])[null] created id={} - PTY={}
>
> After which the client continues to process the ls​ command if called on
> the command line and immediately closes the connection when called via
> Ansible:
>
> 525 [Thread-2] DEBUG org.apache.sshd.client.channel.ChannelExec -
> close(ChannelExec[id=0,
> recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) Closing
> immediately
> 525 [Thread-2] DEBUG org.apache.sshd.client.channel.ChannelExec -
> close(ChannelExec[id=0,
> recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) prevent
> sending EOF
> 525 [main] DEBUG org.apache.sshd.client.channel.ChannelExec -
> open(ChannelExec[id=0,
> recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) Send
> SSH_MSG_CHANNEL_OPEN - type=session
> 525 [Thread-2] DEBUG org.apache.sshd.common.channel.Window - Closing
> Window[client/local](ChannelExec[id=0,
> recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101])
> 525 [main] DEBUG org.apache.sshd.client.channel.ChannelExec -
> writePacket(ChannelExec[id=0,
> recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101])
> Discarding output packet because channel state=Immediate
> 525 [Thread-2] DEBUG org.apache.sshd.common.channel.Window - Closing
> Window[client/remote](ChannelExec[id=0,
> recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101])
> [..]
>
> All output is on level DEBUG or TRACE. No error is reported.
>
> The Ansible task is as simple as they come:
>
> - name: Use Karaf Client
>shell: "./client -v -l 4 ls"
>args:
>  chdir: "{{ karaf_install_symlink }}/bin"
>
> The karaf server log shows the connection, and a while later logs an
> authentication timeout, presumably because the client left the
> conversation dangling.
>
> 2022-01-04T20:53:13,178 | INFO  |
> sshd-SshServer[315a8514](port=8101)-nio2-thread-2 | ServerSessionImpl
>  | 43 - org.apache.sshd.osgi - 2.5.1 | Session
> karaf@/127.0.0.1:33910 authenticated
> 2022-01-04T20:55:12,564 | INFO  |
> sshd-SshServer[315a8514](port=8101)-timer-thread-1 | ServerSessionImpl
>   | 43 - org.apache.sshd.osgi - 2.5.1 |
> Disconnecting(ServerSessionImpl[null@/127.0.0.1:33908]):
> SSH2_DISCONNECT_PROTOCOL_ERROR - Detected AuthTimeout after
> 120181/12 ms.
> 2022-01-04T20:55:12,566 | WARN  |
> sshd-SshServer[315a8514](port=8101)-nio2-thread-2 | ServerSessionImpl
>  | 43 - org.apache.sshd.osgi - 2.5.1 |
> disconnect(ServerSessionImpl[null@/127.0.0.1:33908]) operation failed
> (IOException) for reason=SSH2_DISCONNECT_PROTOCOL_ERROR [Detected
> AuthTimeout after 120181/12 ms.]: Broken pipe
>
> Where would I have to tweak the setup to make the karaf client work
> through Ansible?
>
>
> Thanks!
> Ralf
>


Re: Karaf and SpringBoot

2022-01-18 Thread Jean-Baptiste Onofré

Hi Oleg,

Yes, it's always possible to wrap spring-boot app as a uber bundle and 
use the controller from K5.


Before starting K5, I added a spring-boot deployer doing that.

Not sure it makes sense to have it in K4 while K5 is coming.

Regards
JB

On 18/01/2022 19:24, Oleg Cohen wrote:

Greetings,

I have a general question. I know that Karaf 5 is coming with a 
capability to host SpringBoot based services. Are there any capabilities 
to deploy such services exist in Karaf 4?


Thank you!
Oleg

--
*Oleg Cohen | Principal | **A S S U R E B R I D G E*
*Office: +1 617 564 0737  |  Mobile: +1 617 455 7927  |  Fax: +1 888 409 
6995**
Email: _oleg.co...@assurebridge.com 
_ **| www.assurebridge.com 
*


Karaf and SpringBoot

2022-01-18 Thread Oleg Cohen
Greetings,

I have a general question. I know that Karaf 5 is coming with a capability
to host SpringBoot based services. Are there any capabilities to deploy
such services exist in Karaf 4?

Thank you!
Oleg

-- 
*Oleg Cohen  |  Principal  |  **A S S U R E B R I D G E*
*Office: +1 617 564 0737  |  Mobile: +1 617 455 7927  |  Fax: +1 888 409
6995*
*Email: oleg.co...@assurebridge.com   **|
 www.assurebridge.com *