[wildfly-dev] HTTP API support for plain JBoss-CLI commands

Jairo Junior junior.jairo1 at gmail.com
Fri May 29 08:38:38 EDT 2015


Darran,

Thank you, wish I had found your blog post before. Fortunately, I was able
to build almost the same thing with a lot of effort:
https://github.com/biemond/biemond-wildfly/blob/master/lib/puppet_x/util/wildfly_cli.rb

My point is: Sysadmins often build CLI scripts to automate tasks and I want
to "reuse" this knowledge in HTTP API. Sysadmins don't talk JSON, they talk
CLI...

I heard somewhere that jboss-cli.sh and Management Console are using the
same HTTP API in Wildfly, but I'm not sure how jboss-cli.sh use this
commands...

In fact, I tried to use jboss-cli.sh but bash is incredible slow compared
to HTTP API: https://github.com/cpitman/puppet-jboss_admin/issues/68

On Fri, May 29, 2015 at 9:22 AM Darran Lofthouse <darran.lofthouse at jboss.com>
wrote:

> It was written a couple of years back but this is a good blog post to
> look at for different clients sending in management requests: -
>
>
> http://pilhuhn.blogspot.co.uk/2012/01/polyglot-management-of-secured-as7.html
>
> You don't need to go as far as the Base64 encoding and decoding if you
> do not want to and just create the json formatted requests and parse the
> json responses.
>
> Regards,
> Darran Lofthouse.
>
> On 29/05/15 13:11, Jairo Junior wrote:
> > No, it's not. Only ruby. Although, I could use JRuby to import and use
> > Java classes, it would give me more trouble than solutions.
> >
> > What I want is: An interoperable way to talk with JBoss. application/dmr
> > is a binary/proprietary format.
> >
> > On Fri, May 29, 2015 at 8:17 AM Heiko Braun <hbraun at redhat.com
> > <mailto:hbraun at redhat.com>> wrote:
> >
> >     What the constraints when developing a puppet module? Is plain java
> >     supported?
> >
> >
> >
> >
> >     Am 29.05.2015 um 01:39 schrieb Jairo Junior <junior.jairo1 at gmail.com
> >     <mailto:junior.jairo1 at gmail.com>>:
> >
> >>     Heiko,
> >>
> >>     Thank you, but how do I build a ModelNode from a CLI command?
> >>
> >>     Before using JSON I was investigating how Administration Console
> >>     perform operations and I realized (using firebug) that it uses
> >>     application/dmr, but I presumed it uses ModelNode to build
> >>     commands, not plain CLI syntax.
> >>
> >>     On Thu, May 28, 2015 at 5:58 AM Heiko Braun <hbraun at redhat.com
> >>     <mailto:hbraun at redhat.com>> wrote:
> >>
> >>         The DMR library can be found here:
> >>
> >>         https://github.com/jbossas/jboss-dmr
> >>
> >>
> >>>         On 28 May 2015, at 10:56, Heiko Braun <hbraun at redhat.com
> >>>         <mailto:hbraun at redhat.com>> wrote:
> >>>
> >>>
> >>>         You can already use DMR over HTTP. It requires a different
> >>>         content-type ('application/dmr-encoded') and uses a base64
> >>>         encoded representation of the payload
> >>>         ('ModelNode.toBase64String()').
> >>>
> >>>         You can describe an operation through the DMR API and then
> >>>         simply do HTTP POST to ‘/management’ endpoint. make sure to
> >>>         use 'application/dmr-encoded’ for both 'Content-Type' and
> >>>         ‘Accept’ headers.
> >>>
> >>>         The response can be parse using 'ModelNode.fromBase64()'.
> >>>
> >>>         Hope this helps,
> >>>         Heiko
> >>>
> >>>
> >>>
> >>>>         On 27 May 2015, at 19:54, Jairo Junior
> >>>>         <junior.jairo1 at gmail.com <mailto:junior.jairo1 at gmail.com>>
> >>>>         wrote:
> >>>>
> >>>>         I've been working on a Puppet Module for Wildfly [1] that
> >>>>         uses his HTTP Management API to perform operations (manage
> >>>>         resources/deploys and execute commands), but my command
> >>>>         execution code is a little bit limited cause I have to
> >>>>         transform from CLI syntax to JSON. e.g.:
> >>>>
> >>>>         :shutdown(restart=true)
> >>>>
> >>>>         becomes
> >>>>
> >>>>         {"operation" : "shutdown", "restart" : "true" }
> >>>>
> >>>>         Is there any specific reason to not support plain CLI
> >>>>         commands through HTTP API? I looked at the code and it
> >>>>         didn't see hard to implement this...
> >>>>
> >>>>         [1] https://github.com/biemond/biemond-wildfly
> >>>>
> >>>>         _______________________________________________
> >>>>         wildfly-dev mailing list
> >>>>         wildfly-dev at lists.jboss.org <mailto:
> wildfly-dev at lists.jboss.org>
> >>>>         https://lists.jboss.org/mailman/listinfo/wildfly-dev
> >>>
> >>
> >
> >
> > _______________________________________________
> > wildfly-dev mailing list
> > wildfly-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/wildfly-dev
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/wildfly-dev/attachments/20150529/b60130e5/attachment-0001.html 


More information about the wildfly-dev mailing list