new open weather fact gathering module #536

Closed
wants to merge 4 commits into
from

Projects

None yet

5 participants

@bcoca
Member
bcoca commented May 26, 2015

No description provided.

@gregdek
Contributor
gregdek commented Jun 19, 2015

LOL -- so who wants to review @bcoca's P5 module for openweather facts?

I nominate @resmo just because.

@bcoca
Member
bcoca commented Jun 19, 2015

this was actually part of my tips n tricks talk, but left it out as I thought it already had too much info

@resmo
Contributor
resmo commented Jun 19, 2015

@gregdek I even got a use case for this :)

@bcoca
Member
bcoca commented Jun 19, 2015

I had one, but it involved a 10yr contract w/o SLA and a datacenter with marginal AC and machines w/o usable on board temp sensors .... fun days!

@gregdek
Contributor
gregdek commented Sep 25, 2015

Updating with the new process. We will be evaluating all new module PRs according to this process, effective immediately.

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.

“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!

@gregdek gregdek removed the P5 label Dec 11, 2015
@gregdek
Contributor
gregdek commented May 20, 2016

Thanks @bcoca 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 Jun 5, 2016

@bcoca 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.]

@gregdek
Contributor
gregdek commented Jun 20, 2016

@bcoca Another 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. If you have addressed the issues and believe it's ready for review, please comment with the text "ready_for_review". If we don't hear from you within another 14 days, we will close this pull request.

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

@gundalow gundalow commented on an outdated diff Jun 23, 2016
openweather_facts.py
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+
+DOCUMENTATION = '''
+---
+module: openweather_facts
+author:
+ - '"Brian Coca (@bcoca)" <bcoca@ansible.com>'
+version_added: "2.0"
+description:
+ - Use the openweathermap API to retrieve the current weather at a location.
+ - Even though none of the fields are required, you must supply one (and only one) for the query.
+ - You can get more info on the return data and codes at http://openweathermap.org/current
@gundalow
gundalow Jun 23, 2016 Contributor

U(http://openweathermap.org/current)

@gundalow gundalow commented on an outdated diff Jun 23, 2016
openweather_facts.py
+ - a tuple with lattitude and longitude of the area you wish to query for.
+ required: false
+ default: null
+ country_code:
+ description:
+ - a 2 letter ISO country code, used to disambiguate when querying by name and zipcodes
+ required: false
+ default: null
+ units:
+ description:
+ - What units you want in the response, the default null is the same as specifying 'internal'
+ required: False
+ default: null
+ choices: ['internal', 'metric', 'imperial']
+note:
+ - This module uses the free tier of openweathermap.org, it should be easy to expand to use a developer or higher tier
@gundalow
gundalow Jun 23, 2016 Contributor

U(http://openweathermap.org)

@gundalow gundalow commented on an outdated diff Jun 23, 2016
openweather_facts.py
+ if p.units:
+ uri += '&units=' + p.units.lower()
+ response,info = fetch_url(module, uri)
+
+ if info['status'] != 200:
+ module.fail_json("Failed to get the weather: %s" % info['msg'])
+
+ data = json.loads(response.read())
+ weather['weather_' + str(data['id'])] = data
+
+ module.exit_json(info=info, ansible_facts=weather, uri=uri)
+
+# import module snippets
+from ansible.module_utils.basic import *
+from ansible.module_utils.urls import *
+main()
@gundalow
gundalow Jun 23, 2016 Contributor

main() needs to be in if

@gundalow
Contributor

Hi,

Looks like this branch needs updating to fix Travis Issues, please see this guide on how to do that cleanly.

http://docs.ansible.com/ansible/community.html#contributing-code-features-or-bugfixes

needs_revision

@bcoca bcoca removed the pending_action label Jun 23, 2016
@bcoca bcoca removed the needs_revision label Oct 4, 2016
@gregdek
Contributor
gregdek commented Nov 21, 2016

Thanks @bcoca 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.]

@ansibot
ansibot commented Dec 6, 2016

This repository has been locked. All new issues and pullrequests should be filed in https://github.com/ansible/ansible

Please read through the repomerge page in the dev guide. The guide contains links to tools which automatically move your issue or pullrequest to the ansible/ansible repo.

@bcoca
Member
bcoca commented Jan 31, 2017

closing in favor of ansible/ansible#20880

@bcoca bcoca closed this Jan 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment