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 new grafana dashboard lookup plugin #41319

Merged
merged 1 commit into from
Jul 23, 2018

Conversation

seuf
Copy link
Contributor

@seuf seuf commented Jun 8, 2018

SUMMARY

New lookup plugin : grafana_dashboard

ISSUE TYPE
  • New Plugin Pull Request
COMPONENT NAME

grafana_dashboard lookup plugin

ANSIBLE VERSION
ansible 2.5.3
  config file = None
  configured module search path = [u'/home/seuf/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/seuf/python-virtualenv-ansible/lib/python2.7/site-packages/ansible
  executable location = /home/seuf/python-virtualenv-ansible/bin/ansible
  python version = 2.7.15 (default, May  2 2018, 14:12:52) [GCC 8.0.1 20180324 (Red Hat 8.0.1-0.20)]
ADDITIONAL INFORMATION

With this new lookup plugin, you can automate the grafana dashboard export (when #41249 will be merged).
Here is an example :

- name: get all grafana dashboards
  set_fact:
    grafana_dashboards: "{{ lookup('grafana_dashboard', 'grafana_url=http://grafana.company.com grafana_user=admin grafana_password=admin') }}"

- name: export all dashboards
  grafana_dashboard:
        grafana_url: http://grafana.company.com
        grafana_api_key: "{{ grafana_api_key }}"
        state: export
        uid: "{{ item .uid }}"
        path: "/path/to/dashboards/{{ item.uid }}.json"
      with_items: "{{ grafana_dashboards }}"

@seuf seuf force-pushed the grafana_dashboard_lookup_plugin branch from ae097d1 to d5df3fd Compare June 8, 2018 13:03
@ansibot ansibot added affects_2.7 This issue/PR affects Ansible v2.7 needs_triage Needs a first human triage before being processed. new_plugin This PR includes a new plugin. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Jun 8, 2018
@mkrizek mkrizek removed the needs_triage Needs a first human triage before being processed. label Jun 8, 2018
@ansibot
Copy link
Contributor

ansibot commented Jun 8, 2018

The test ansible-test sanity --test pylint [explain] failed with 2 errors:

lib/ansible/plugins/lookup/grafana_dashboard.py:121:84: undefined-variable Undefined variable 'org_id'
lib/ansible/plugins/lookup/grafana_dashboard.py:152:0: trailing-whitespace Trailing whitespace

The test ansible-test sanity --test ansible-doc --python 2.6 [explain] failed with 1 error:

lib/ansible/plugins/lookup/grafana_dashboard.py:0:0: missing documentation (or could not parse documentation): expected string or buffer

The test ansible-test sanity --test ansible-doc --python 2.7 [explain] failed with 1 error:

lib/ansible/plugins/lookup/grafana_dashboard.py:0:0: missing documentation (or could not parse documentation): expected string or buffer

The test ansible-test sanity --test ansible-doc --python 3.5 [explain] failed with 1 error:

lib/ansible/plugins/lookup/grafana_dashboard.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test ansible-doc --python 3.6 [explain] failed with 1 error:

lib/ansible/plugins/lookup/grafana_dashboard.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test ansible-doc --python 3.7 [explain] failed with 1 error:

lib/ansible/plugins/lookup/grafana_dashboard.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test pep8 [explain] failed with 5 errors:

lib/ansible/plugins/lookup/grafana_dashboard.py:54:161: E501 line too long (172 > 160 characters)
lib/ansible/plugins/lookup/grafana_dashboard.py:102:1: E302 expected 2 blank lines, found 1
lib/ansible/plugins/lookup/grafana_dashboard.py:124:5: E303 too many blank lines (2)
lib/ansible/plugins/lookup/grafana_dashboard.py:136:5: E303 too many blank lines (2)
lib/ansible/plugins/lookup/grafana_dashboard.py:152:78: W291 trailing whitespace

click here for bot help

@ansibot ansibot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Jun 8, 2018
@samdoran samdoran self-assigned this Jun 8, 2018
@seuf seuf force-pushed the grafana_dashboard_lookup_plugin branch from d5df3fd to 20616bd Compare June 8, 2018 15:37
@ansibot
Copy link
Contributor

ansibot commented Jun 8, 2018

The test ansible-test sanity --test ansible-doc --python 2.6 [explain] failed with 1 error:

lib/ansible/plugins/lookup/grafana_dashboard.py:0:0: missing documentation (or could not parse documentation): expected string or buffer

The test ansible-test sanity --test ansible-doc --python 2.7 [explain] failed with 1 error:

lib/ansible/plugins/lookup/grafana_dashboard.py:0:0: missing documentation (or could not parse documentation): expected string or buffer

The test ansible-test sanity --test ansible-doc --python 3.5 [explain] failed with 1 error:

lib/ansible/plugins/lookup/grafana_dashboard.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test ansible-doc --python 3.6 [explain] failed with 1 error:

lib/ansible/plugins/lookup/grafana_dashboard.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test ansible-doc --python 3.7 [explain] failed with 1 error:

lib/ansible/plugins/lookup/grafana_dashboard.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

click here for bot help

@mattclay
Copy link
Member

mattclay commented Jun 8, 2018

The integration test failure is unrelated but the sanity test errors are legitimate.

@mattclay mattclay added the ci_verified Changes made in this PR are causing tests to fail. label Jun 8, 2018
@seuf seuf force-pushed the grafana_dashboard_lookup_plugin branch from 20616bd to 3d59274 Compare June 11, 2018 11:34
@ansibot ansibot removed the ci_verified Changes made in this PR are causing tests to fail. label Jun 11, 2018
@seuf
Copy link
Contributor Author

seuf commented Jun 11, 2018

I don't know why the sanity check don't find the documentation. This plugin is documented. Any idea ?

@ansibot
Copy link
Contributor

ansibot commented Jun 11, 2018

The test ansible-test sanity --test ansible-doc --python 2.6 [explain] failed with 1 error:

lib/ansible/plugins/lookup/grafana_dashboard.py:0:0: missing documentation (or could not parse documentation): expected string or buffer

The test ansible-test sanity --test ansible-doc --python 2.7 [explain] failed with 1 error:

lib/ansible/plugins/lookup/grafana_dashboard.py:0:0: missing documentation (or could not parse documentation): expected string or buffer

The test ansible-test sanity --test ansible-doc --python 3.5 [explain] failed with 1 error:

lib/ansible/plugins/lookup/grafana_dashboard.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test ansible-doc --python 3.7 [explain] failed with 1 error:

lib/ansible/plugins/lookup/grafana_dashboard.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test ansible-doc --python 3.6 [explain] failed with 1 error:

lib/ansible/plugins/lookup/grafana_dashboard.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

click here for bot help

@ansibot ansibot added the ci_verified Changes made in this PR are causing tests to fail. label Jun 11, 2018
@bcoca
Copy link
Member

bcoca commented Jun 11, 2018

You have a : in your description (see Attention), quote the whole line as it must be valid YAML

@seuf seuf force-pushed the grafana_dashboard_lookup_plugin branch from 3d59274 to d34d8a9 Compare June 11, 2018 15:24
@ansibot ansibot removed the ci_verified Changes made in this PR are causing tests to fail. label Jun 11, 2018
@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. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Jun 19, 2018
@seuf
Copy link
Contributor Author

seuf commented Jul 18, 2018

Hi @bcoca ! The check are fixed. Do you have time to review this plugin ?

@@ -0,0 +1,177 @@
# python 3 headers, required if submitting to Ansible
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please replace this line with copyright and GPL license. See other lookup plugins for examples.

@seuf seuf force-pushed the grafana_dashboard_lookup_plugin branch from d34d8a9 to 2a70fe9 Compare July 19, 2018 07:56
@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Jul 19, 2018
@seuf seuf force-pushed the grafana_dashboard_lookup_plugin branch from 2a70fe9 to 4073fd0 Compare July 19, 2018 09:04
@seuf seuf force-pushed the grafana_dashboard_lookup_plugin branch from 4073fd0 to bac1499 Compare July 20, 2018 08:40
@seuf
Copy link
Contributor Author

seuf commented Jul 20, 2018

I thinks the tests are broken..

@ansibot ansibot added the bot_broken The bot is misbehaving. NOT for failing CI. A staff member will investigate. label Jul 20, 2018
@samdoran
Copy link
Contributor

@seuf The bot is not broken, but the test indeed was. Seems the macOS test server was down. I restarted the failed test.

@samdoran samdoran removed the bot_broken The bot is misbehaving. NOT for failing CI. A staff member will investigate. label Jul 20, 2018
@ansibot ansibot added the bot_broken The bot is misbehaving. NOT for failing CI. A staff member will investigate. label Jul 20, 2018
@mattclay mattclay removed the bot_broken The bot is misbehaving. NOT for failing CI. A staff member will investigate. label Jul 20, 2018
@ansibot ansibot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Jul 20, 2018
@seuf
Copy link
Contributor Author

seuf commented Jul 23, 2018

ok, so it's time to shipit 😄 cc @samdoran @bcoca

@samdoran samdoran merged commit 9faadce into ansible:devel Jul 23, 2018
@dagwieers dagwieers added the grafana Grafana community label Feb 7, 2019
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.7 This issue/PR affects Ansible v2.7 grafana Grafana community new_plugin This PR includes a new plugin. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants