Add sensu_subscription module #205

Merged
merged 1 commit into from Jun 6, 2016

Projects

None yet

7 participants

@andsens
Contributor
andsens commented Jan 19, 2015

This PR goes well with PR #203.

The module sensu_subscription manages sensu subscriptions of the sensu client running on a machine.

@gregdek
Contributor
gregdek commented Jun 17, 2015

Thanks for submitting this module to Ansible Extras. Apologies that it’s taken a while to get your module reviewed.

To help facilitate reviews, we’ve broadened the number of people who can approve modules for inclusion into the Extras repository. The list of official reviewers can be found here:

https://github.com/ansible/ansible-modules-extras/blob/devel/REVIEWERS.md

Our new policy is that if a new module is reviewed and approved by at least two official module reviewers, the module will be approved for inclusion. We will be asking the community of reviewers to take a look at these modules on a regular basis.

To ensure that your module has the best chance of being approved, please double-check that you adhere to the Ansible module guidelines: http://docs.ansible.com/developing_modules.html#module-checklist

@andsens
Contributor
andsens commented Jun 17, 2015

I went through the checklist and it seems like everything is in order.

@gregdek
Contributor
gregdek commented Jun 18, 2015

Hi monitoring module owners -- @bpennypacker @hkariti @ccollicutt @arturaz @skornehl @bwhaley @abulimov -- anyone interested in helping with another sensu module review? (See #203 for the first one)

@andsens
Contributor
andsens commented Jun 19, 2015

I applied the comments from #203 to this PR as well.

@bcoca bcoca closed this Jun 19, 2015
@bcoca bcoca reopened this Jun 19, 2015
@andsens
Contributor
andsens commented Jun 20, 2015

OK. I fixed the errors. Man, python 2.4 compat is a PITA

@andsens
Contributor
andsens commented Jun 20, 2015

I added some 2.4 compat, but I can see you already merged. You can apply this instead if you like:
andsens@f33eded

@gregdek
Contributor
gregdek commented Jun 22, 2015

Thanks @andsens -- still looking for reviewers for the module itself.

@andsens
Contributor
andsens commented Jul 31, 2015

Any chance this will be merged soon? It goes well with the sensu_check module from PR #203

@robynbergeron robynbergeron removed the P3 label Sep 25, 2015
@robynbergeron
Contributor

Hi @andsens -- comments below are re: the new process for PRs in extras. We will be evaluating all new module PRs according to this process, effective immediately. If you have any sensu + ansible loving friends, they are welcome to follow the guidelines below and help get this in :)

Thanks for submitting this new module to Ansible Extras! This module is now in community review, a process that is open to all Ansible users. In order for this module to be approved, it must gain the following votes:

“works_for_me”: If you have tested the module thoroughly, including testing of all of the module’s options, and if the module works for you, please add “works_for_me” in the comments.

“passes_guidelines”: If you have gone through the module guidelines and the module meets all of the requirements, please add “passes_guidelines” in the comments. Guidelines are available here: http://docs.ansible.com/developing_modules.html#module-checklist

“needs_revision”: If the module fails to work for you, or if it doesn’t meet guidelines, please add “needs_revision” in the comments with details about what needs to be fixed.

When a module has both “works_for_me” and “passes_guidelines” tags, we will promote the module for inclusion in Ansible Extras. At this point, you will be expected to maintain the module by fixing bugs and evaluating pull requests in a timely manner.

Thanks again for submitting your Ansible module!

@andsens
Contributor
andsens commented Feb 18, 2016

Any chance this can get merged soon?
The sensu_check module is already in 2.0.

works_for_me

@gregdek
Contributor
gregdek commented Mar 29, 2016

Thanks @andsens for this PR. This PR requires revisions, either because it fails to build or by reviewer request. Please make the suggested revisions. When you are done, please comment with text 'ready_for_review' and we will put this PR back into review.

[This message brought to you by your friendly Ansibull-bot.]

@andsens
Contributor
andsens commented Mar 29, 2016

ready_for_review
The failure is not in the module:

$ python2.4 -m compileall -fq -x 'cloud/|monitoring/zabbix.*\.py|/layman\.py|/maven_artifact\.py|clustering/consul.*\.py|notification/pushbullet\.py' .
Compiling ./clustering/znode.py ...
  File "./clustering/znode.py", line 123
    command_type = 'op' if 'op' in module.params and module.params['op'] is not None else 'state'
                         ^
SyntaxError: invalid syntax
@gregdek
Contributor
gregdek commented Mar 31, 2016

Yep, unrelated breakage. Should resolve itself when the issue is fixed in the base branch, at which point this should flip back to community_review. @andsens give it a couple of days and we'll see. If not, ping me in the comments.

@gregdek
Contributor
gregdek commented Apr 1, 2016

Thanks @andsens for this PR. This PR requires revisions, either because it fails to build or by reviewer request. Please make the suggested revisions. When you are done, please comment with text 'ready_for_review' and we will put this PR back into review.

[This message brought to you by your friendly Ansibull-bot.]

@gregdek
Contributor
gregdek commented Apr 17, 2016

@andsens A friendly reminder: this pull request has been marked as needing your action. If you still believe that this PR applies, and you intend to address the issues with this PR, just let us know in the PR itself and we will keep it open pending your changes. When you do address the issues, please respond with ready_for_review in your comment, so that we can notify the maintainer.

[This message brought to you by your friendly Ansibull-bot.]

@andsens
Contributor
andsens commented Apr 17, 2016

ready_for_review

I rebased the branch and added RETURN documentation.

@gregdek gregdek removed the needs_revision label Apr 17, 2016
@gregdek
Contributor
gregdek commented Apr 17, 2016

Thanks @andsens for this new module. When this module receives 'shipit' comments from two community members and any 'needs_revision' comments have been resolved, we will mark for inclusion.

[This message brought to you by your friendly Ansibull-bot.]

@jaredledvina

Nice! I wish this was already in Extras!

shipit

@gregdek
Contributor
gregdek commented May 5, 2016

Thanks @andsens for this PR. This PR requires revisions, either because it fails to build or by reviewer request. Please make the suggested revisions. When you are done, please comment with text 'ready_for_review' and we will put this PR back into review.

[This message brought to you by your friendly Ansibull-bot.]

@andsens
Contributor
andsens commented May 6, 2016

aw man, this is getting a little annoying. I'm not bumping the version number again. @gregdek, could you merge and bump the version? This module has been fine for almost a year now and keeps breaking because something keeps changing in ansible core.

@gregdek
Contributor
gregdek commented May 7, 2016

Apologies @andsens -- aware that the new module review process is not as well integrated as it could be. Will add this module to the agenda of our new module meeting on IRC.

@gregdek gregdek referenced this pull request in ansible/community May 7, 2016
Closed

Standing Agenda, New Modules Meeting #92

@gundalow gundalow commented on an outdated diff May 9, 2016
monitoring/sensu_subscription.py
+ }
+
+ module = AnsibleModule(argument_spec=arg_spec,
+ supports_check_mode=True)
+
+ path = module.params['path']
+ name = module.params['name']
+ state = module.params['state']
+ backup = module.params['backup']
+
+ changed, reasons = sensu_subscription(module, path, name, state, backup)
+
+ module.exit_json(path=path, name=name, changed=changed, msg='OK', reasons=reasons)
+
+from ansible.module_utils.basic import *
+main()
@gundalow
gundalow May 9, 2016 Contributor

This needs to be as follows so debuggers can work with ziploader:

if __name__ == '__main__':
    main()
@gregdek
Contributor
gregdek commented May 11, 2016

@gundalow are these the only changes you see being needed? If so, should we consider a merge and fix?

@gundalow
Contributor

I'm happy with a merge-and-fix

@gundalow
Contributor

@bcoca will address my comments once this has been merged

shipit

@gregdek gregdek added shipit and removed needs_revision labels May 11, 2016
@gregdek
Contributor
gregdek commented May 11, 2016

Thanks @gundalow -- @andsens sorry for the long delays, and thanks for hanging in there with us.

@andsens
Contributor
andsens commented May 11, 2016

@gregdek, no probs. I'm just glad to see it merged ;-)

@gregdek gregdek removed the shipit label May 11, 2016
@gregdek
Contributor
gregdek commented May 11, 2016

Thanks @andsens for this PR. This PR requires revisions, either because it fails to build or by reviewer request. Please make the suggested revisions. When you are done, please comment with text 'ready_for_review' and we will put this PR back into review.

[This message brought to you by your friendly Ansibull-bot.]

@gundalow
Contributor

@bcoca I believe you offered to merge and fix this, for reference the two items that need tweaking are:

  • ERROR: version_added should be 2.2. Currently 2.1
  • Add if __name__ == '__main__':
@gregdek
Contributor
gregdek commented May 27, 2016

@andsens A friendly reminder: this pull request has been marked as needing your action. If you still believe that this PR applies, and you intend to address the issues with this PR, just let us know in the PR itself and we will keep it open pending your changes. When you do address the issues, please respond with ready_for_review in your comment, so that we can notify the maintainer.

[This message brought to you by your friendly Ansibull-bot.]

@andsens
Contributor
andsens commented Jun 4, 2016

ready_for_review

Please merge this one before 2.2 gets released :-)

@gregdek
Contributor
gregdek commented Jun 4, 2016

Thanks @andsens for this new module. When this module receives 'shipit' comments from two community members and any 'needs_revision' comments have been resolved, we will mark for inclusion.

[This message brought to you by your friendly Ansibull-bot.]

@gundalow
Contributor
gundalow commented Jun 4, 2016

Shipit

@bcoca I believe you offers to merge this in a previous new modules meeting, could you please do the necessary. Thanks

@jaredledvina

shipit

@bcoca bcoca commented on the diff Jun 6, 2016
monitoring/sensu_subscription.py
+ config['client']['subscriptions'].append(name)
+ changed = True
+ reasons.append('channel subscription was absent and state is `present\'')
+ else:
+ if state == 'absent':
+ config['client']['subscriptions'].remove(name)
+ changed = True
+ reasons.append('channel subscription was present and state is `absent\'')
+
+ if changed and not module.check_mode:
+ if backup:
+ module.backup_local(path)
+ try:
+ open(path, 'w').write(json.dumps(config, indent=2) + '\n')
+ except IOError, e:
+ module.fail_json(msg=str(e))
@bcoca
bcoca Jun 6, 2016 Member

we normally want to return a more 'friendly' error message to the user, but leaving that for a follow up (same issue in a couple of places):

'We could not write to the %s file: %s' % (config, str(e))

@SamYaple
SamYaple Jun 6, 2016 edited Contributor

Syntax at 132 is breaking jobs

#1784

@bcoca bcoca merged commit 575fc6e into ansible:devel Jun 6, 2016
@andsens andsens deleted the andsens:sensu-subscription branch Jun 6, 2016
@SamYaple SamYaple added a commit to SamYaple/ansible-modules-extras that referenced this pull request Jun 7, 2016
@andsens @SamYaple andsens + SamYaple Add sensu_subscription module (#205) 1ea0b8b
@cinek810 cinek810 pushed a commit to cinek810/ansible-modules-extras that referenced this pull request Jun 12, 2016
@andsens andsens + Marlena Marlenowska Add sensu_subscription module (#205) cef1498
@liquidat liquidat pushed a commit to liquidat/ansible-modules-extras that referenced this pull request Jun 22, 2016
@andsens andsens + liquidat Add sensu_subscription module (#205) 3455145
@Constantin07 Constantin07 pushed a commit to Constantin07/ansible-modules-extras that referenced this pull request Jun 28, 2016
@andsens @Constantin007 andsens + Constantin007 Add sensu_subscription module (#205) d845f30
@haad haad pushed a commit to haad/ansible-modules-extras that referenced this pull request Jun 29, 2016
@andsens andsens + Adam Hamsik Add sensu_subscription module (#205) 1350f85
@calamityman calamityman added a commit to calamityman/ansible-modules-extras that referenced this pull request Jul 2, 2016
@andsens @calamityman andsens + calamityman Add sensu_subscription module (#205) 0aa0fa0
@perzizzle perzizzle pushed a commit to perzizzle/ansible-modules-extras that referenced this pull request Jul 12, 2016
@andsens andsens + Michael Perzel Add sensu_subscription module (#205) 906b48f
@defionscode defionscode pushed a commit to defionscode/ansible-modules-extras that referenced this pull request Aug 12, 2016
@andsens andsens + Jonathan Davila Add sensu_subscription module (#205) 9de4c0d
@defionscode defionscode pushed a commit to defionscode/ansible-modules-extras that referenced this pull request Aug 12, 2016
@andsens andsens + Jonathan Davila Add sensu_subscription module (#205) 29b218d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment