New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add JBoss modules for remote management #25422
Conversation
lib/ansible/module_utils/jboss.py
Outdated
@@ -0,0 +1,39 @@ | |||
#!/usr/bin/python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line needs removing, that's why Shippable is failing
lib/ansible/module_utils/jboss.py
Outdated
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
|
||
# (c) 2017, Ansible by Red Hat, inc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this line is here as you've copied it from an existing file,
lib/ansible/module_utils/jboss.py
Outdated
@@ -0,0 +1,38 @@ | |||
# -*- coding: utf-8 -*- | |||
|
|||
# (c) 2017, Ansible by Red Hat, inc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this line is here (and in other files) as you've copied existing modules.
@jairojunior I've been playing with the urls.py util provided but having some issues getting to it pass the correct username and pass to force digest auth. Did you also attempt something similar and then decided to build jboss-py or was that the first direction you took ? |
@smbambling The first direction I took since I started with |
I wonder if it wouldn't be a better idea to use the included functions or urls.py in place of another library. But for the life of me I can't get it to return anything other the a 401. Even when using the URI module |
You're right, it can't be that hard. I'll take a look this weekend before I start to work on integration tests. |
I kind of got a basic setup work with digest, it seemed the pinned version of Ansible I was using was causing issue but moving to 2.3.x gets around that. @jairojunior If you would like a hand just let me know I'd be glad to help |
Thanks @smbambling. I'll be focusing on integration tests as I said before, but I'll definitely try to replace requests with Anything you can do to help would be appreciated, reviewing docs/parameters names, testing - manually, with the role or using Ansible integration suite [1]. I am also about to release this tool: https://github.com/jairojunior/cli-to-resource that can easily convert plain JBoss-CLI commands to Ansible representation. [1] |
19d187e
to
b9c49b1
Compare
The test
|
Re-triggering CI |
Tests are finally passing, for both py2 and py3. (: jboss-py no longer requires |
@jairojunior Good work on getting this passing on py2 & py3, I know this was a bit more involved that first expected. Is the question if https://github.com/jairojunior/jboss-py should be moved into |
Thanks for the feedback. I'll keep things separated then. 😄 Regarding py2/py3, no worries, I learned a lot about both Ansible and Python through the process. I'm looking at test/units now and thinking about a strategy to unit test this code. The integration tests I created are too slow as it evolves a lot of IO. |
http://docs.ansible.com/ansible/dev_guide/testing_units.html should give you a few pointers on the unit tests. as would looking at existing tests. |
@jairojunior this PR contains more than one new module. Please submit only one new module per pullrequest. For further explanation, please read grouped module documentation |
To anyone who's interested, we're putting together a JBoss/Wildfly working group to tackle things like this. If you'd like to be involved, shoot me an email or respond to the thread on the ansible-devel email list. |
I don't think these modules belong into the remote_management directory. In a way you could be adding all modules into the remote_management category. Instead remote_management is used for driving "remote management" hardware devices, like IBM RSA, HP iLO, Cisco IMC, HP Oneview, Wake-on-LAN, IPMI, ... I think Jboss-related stuff should go into web_infrastructure/jboss with other JBoss-related stuff. |
SUMMARY
This PR is composed of three remote management module for JBoss: jboss_deployment, jboss_resource and jboss_command
The rationale behind using Management API as opposed to traditional JBoss-CLI [1] approach is to reduce the burden of the module user to Manage JBoss's resources by introducing a declarative approach that is idempotent by nature (at least for jboss_deployment and jboss_resource).
There is already a jboss module in web_infrastructure [2] to perform deploys, but it's limited to standalone mode and it leverages deployment scanner, so it basically copy the file to deployment directory, hence it did not provide any feedback for module users regarding deployment success or failure.
I developed a showcase role [3] to develop these modules. There are a few examples there and it's fully functional. Molecule is converging twice to check for idempotence. At first I was planning to test everything using testinfra, but I found out that Ansible uses a different test approach that I am still getting to know.
The module dependency [4] was developed by me and has a pretty decent test coverage. Not sure if it could be part of Ansible codebase, or if it really should be in a separated package.
ISSUE TYPE
COMPONENT NAME
modules/remote_management/jboss
ANSIBLE VERSION
[1] https://github.com/jairojunior/wildfly-ha-tcpgossip-vagrant-puppet/blob/master/wildfly-rolling-deployment.yml#L24
[2] http://docs.ansible.com/ansible/jboss_module.html
[3] https://github.com/jairojunior/ansible-role-jboss
[4] https://github.com/jairojunior/jboss-py
CORE CHANGES
This PR changes
open_url
behavior to use a user provided Authentication Realm. A better way to handle this would be to guess this realm based on the first request, as other libraries do.