Skip to content
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

Closed
wants to merge 0 commits into from

Conversation

jairojunior
Copy link
Contributor

@jairojunior jairojunior commented Jun 7, 2017

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
  • New Module Pull Request
COMPONENT NAME

modules/remote_management/jboss

ANSIBLE VERSION
2.4.0

[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.

@@ -0,0 +1,39 @@
#!/usr/bin/python
Copy link
Contributor

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

#!/usr/bin/python
# -*- coding: utf-8 -*-

# (c) 2017, Ansible by Red Hat, inc
Copy link
Contributor

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,

@@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-

# (c) 2017, Ansible by Red Hat, inc
Copy link
Contributor

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.

@ansibot ansibot added affects_2.4 This issue/PR affects Ansible v2.4 c:module_utils/ community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. new_module This PR includes a new module. new_plugin This PR includes a new plugin. labels Jun 8, 2017
@nitzmahone nitzmahone removed the needs_triage Needs a first human triage before being processed. label Jun 8, 2017
@smbambling
Copy link
Contributor

@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 ?

@jairojunior
Copy link
Contributor Author

@smbambling The first direction I took since I started with requests. I wasn't even aware of urls.py capabilities, but it seems to support digest: https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/urls.py#L862

@smbambling
Copy link
Contributor

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

@jairojunior
Copy link
Contributor Author

You're right, it can't be that hard. I'll take a look this weekend before I start to work on integration tests.

@smbambling
Copy link
Contributor

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

@jairojunior
Copy link
Contributor Author

Thanks @smbambling. I'll be focusing on integration tests as I said before, but I'll definitely try to replace requests with ansible.module_util.urls, as you suggested, before releasing jboss-py 1.0.

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] ansible-test integration jboss_{deployment, command, resource} --docker ubuntu1404

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed community_review In order to be merged, this PR must follow the community review workflow. labels Jun 12, 2017
@jairojunior jairojunior reopened this Jun 13, 2017
@ansibot
Copy link
Contributor

ansibot commented Jun 13, 2017

The test ansible-test sanity --test pep8 failed with the following error:

lib/ansible/cli/__init__.py:257:5: E303 too many blank lines (2)

click here for bot help

@sivel
Copy link
Member

sivel commented Jun 13, 2017

Re-triggering CI

@sivel sivel closed this Jun 13, 2017
@jairojunior
Copy link
Contributor Author

Tests are finally passing, for both py2 and py3. (:

jboss-py no longer requires requests as it uses Ansible's open_url now. The question is: Is jboss-py really necessary or should I move it to lib/ansible/module_utils/jboss.py?

@gundalow
Copy link
Contributor

@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 module_utils?
There is a fair amount of code in that repo. Also it's under Apache license

@jairojunior
Copy link
Contributor Author

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.

@gundalow
Copy link
Contributor

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.

@ansibot ansibot added stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. support:community This issue/PR relates to code supported by the Ansible community. labels Jun 27, 2017
@ansibot
Copy link
Contributor

ansibot commented Jul 3, 2017

@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

click here for bot help

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed community_review In order to be merged, this PR must follow the community review workflow. labels Jul 3, 2017
@wbrefvem
Copy link

wbrefvem commented Jul 7, 2017

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.

@ansibot ansibot added support:core This issue/PR relates to code supported by the Ansible Engineering Team. and removed module This issue/PR relates to a module. new_module This PR includes a new module. labels Jul 7, 2017
@ansibot ansibot added module This issue/PR relates to a module. new_module This PR includes a new module. labels Jul 18, 2017
@ansibot ansibot added the needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html label Jul 25, 2017
@ansibot ansibot removed the support:core This issue/PR relates to code supported by the Ansible Engineering Team. label Aug 24, 2017
@ansibot ansibot added module_utils/urls test This PR relates to tests. labels Sep 1, 2017
@ansibot
Copy link
Contributor

ansibot commented Nov 22, 2017

@ansibot ansibot added support:core This issue/PR relates to code supported by the Ansible Engineering Team. support:network This issue/PR relates to code supported by the Ansible Network Team. windows Windows community labels Nov 22, 2017
@dagwieers
Copy link
Contributor

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.

@jairojunior jairojunior closed this Dec 3, 2017
@jairojunior jairojunior mentioned this pull request May 3, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.4 This issue/PR affects Ansible v2.4 c:module_utils/urls c:module_utils/ jboss module_utils/urls module This issue/PR relates to a module. needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. new_module This PR includes a new module. new_plugin This PR includes a new plugin. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. support:network This issue/PR relates to code supported by the Ansible Network Team. test This PR relates to tests. windows Windows community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants