72 Commits

Author SHA1 Message Date
Paul Belanger
4e643e5d06 Replace oslo_config dependency with argparse
This is for the same reasoning as oslo_log. We don't want to depending
on OpenStack libraries.

Change-Id: I34e66af578d3f4b5ac5e710554aad91524285816
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-09 10:12:57 -04:00
Paul Belanger
3a66817727 Replace oslo_log dependency with standard logging
When I first started grafyaml, I wanted to better understand how
existing OpenStack libraries worked. So, with that in mind, I choose
oslo_log as the logging class for this program.  However, now that we
have imported it under openstack-infra, we don't really want to depend
on OpenStack libraries, incase there is a breakage.  The main reason
for this, if OpenStack libraries break, we still want the
infrastructure to work so we can fix the problem.

Change-Id: Iee9b1d9d9abb4da4d285531b64a7e2505240be12
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-06 09:15:20 -04:00
Jenkins
29fbf5e7d1 Merge "Add some verbose message for validate / update commands" 2015-10-05 21:47:32 +00:00
Paul Belanger
073d7c6806 Add some verbose message for validate / update commands
When you run grafana-dashboards, it currently lacks some basic
information what it is actually doing.  So, start building out some
logging to help others who decide to run the command.

Change-Id: I27b0c444139c5772b29ae3bd2c9550c6567dd4d6
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-05 14:22:41 -04:00
Paul Belanger
2cb88da1e8 Break out cmd testcases into seperate files
We are currently lacking some basic coverage for grafana-dashboards
command. This break is cosmetic but will allow future patchsets to
expand on it.

Change-Id: Idf80ac28b1d5aafac1b10305db26db4e766838c6
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-05 13:03:17 -04:00
Jenkins
82e48fdf08 Merge "Make sure dashboard exists after we create it" 0.0.1 2015-10-03 19:17:40 +00:00
Jenkins
580eb0a1b3 Merge "Add the ability to parse directories" 2015-10-03 18:39:09 +00:00
Jenkins
ff3a9f3b5e Merge "Add validate command" 2015-10-03 18:34:43 +00:00
Paul Belanger
30f7d21f3f Make sure dashboard exists after we create it
The long term goal here is to eventually create python-grafana from
our embedded grafana.py file. So, most of this code just makes the
Grafana object more user friendly.

However, we've also added some validation around create_dashboard, we
added some checks before we create and after. To ensure we actually
created our new dashboards.

Finally, add some sphinx docs since everybody loves documentation.

Change-Id: Icbba403afe5208fbef1855118d4c3f4293461e00
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-02 13:42:35 -04:00
Jenkins
5e88ddde1e Merge "Refactor grafana.py test coverage" 2015-10-02 15:51:17 +00:00
Paul Belanger
ead66d299d Clean up tox.ini
Leftovers from the cookie-cutter import.

Change-Id: I694104fe44a4b78214ae33a2bcc3470db397f572
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-01 14:12:24 -04:00
Paul Belanger
b5ecab6d05 Refactor grafana.py test coverage
Add 2 new tests for the __init__ function. Testing with / without the
apikey.  Also rework our requests_mock logic.

Change-Id: Idea77b59b1ea2d6a2566e48810aa19c0455479ac
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-01 14:09:54 -04:00
Paul Belanger
609733c116 Add the ability to parse directories
Change-Id: I0ff6c803608d91e04b8e40750265157d3f4f7530
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-01 13:36:58 -04:00
Paul Belanger
d35649e495 Reorder tox.ini envlist
Here we are replacing pypy with docs.  Mostly because we gate on docs
and not pypy.

Change-Id: I896e403a397b3964dcb3209cfcc84efcbe513fba
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-01 10:38:23 -04:00
Jenkins
a61e30d33b Merge "Add docs for grafana-dashboards command" 2015-10-01 14:25:55 +00:00
Paul Belanger
f4b18fdd74 Add validate command
Like JJB, Zuul and Nodepool, we need to have a CLI command to validate
our configuration files.

Change-Id: I4ccac21a2d77917667e1e844ab9ee1f1f281ea9f
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-10-01 09:59:21 -04:00
Jenkins
1444e69538 Merge "Add test coverate for grafana.py" 2015-10-01 13:52:18 +00:00
Jenkins
aa22eedada Merge "Add caching support" 2015-09-30 20:15:44 +00:00
Jenkins
001d109c0e Merge "Add a slug to better track dashboards" 2015-09-30 15:32:59 +00:00
Paul Belanger
103a882cbf Add caching support
Like we do with JJB, we create a md5sum of the dashboard then cache
it.  This is a simple way to determine if a yaml file has changed.

Change-Id: If7b80b84c5bbcb0d30b0325bae6b8e726bb2f41b
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-09-29 11:34:31 -04:00
James E. Blair
cff07e7bcc Fix documentation URL
Change-Id: I3140e161b11fb0fd7f43c050668f1d70b92d60cb
2015-09-28 13:59:15 -07:00
James E. Blair
ae0bc35810 Revert "Drop oslosphinx requirement"
This reverts commit 562d075a46121df2e473f8f085fb77a225d2f464.

Change-Id: Ibcbfb1da52a177fc213bc9e105e73be34b2a2429
2015-09-28 13:56:26 -07:00
Paul Belanger
789bf1f3a2 Add docs for grafana-dashboards command
Also rework index file to include README over a dedicated readme file.

Change-Id: I70108fb627131e7a8bfec6e64cbfc093e65ca48b
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-09-28 15:56:58 -04:00
Paul Belanger
562d075a46 Drop oslosphinx requirement
Since we are not an official OpenStack project, no need to look like
one.

Change-Id: I6925799ebaf4086ea499be81c2be9de2aedb57ac
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-09-28 14:34:52 -04:00
Paul Belanger
42ef61dde0 Add a slug to better track dashboards
Currently grafana will generate a slug based on the title name. For
now, we can use an existing python library to do this.  Ideally, we'll
need to make sure the slugs generated between both are kept in sync.

How hard can that be?

Also move our validation logic into parser.py, since they are closely
related.

Change-Id: Id43f51d3f9db9131c25a8130f957572344a7d8f1
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-09-28 10:15:10 -04:00
Paul Belanger
aa97ba048d Initial support for singlestat panel
Change-Id: If1d579a81bbf874553624f5fb9fab0573a716514
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-09-25 17:00:18 -04:00
Paul Belanger
9068020fb2 Initial support for graph panel
Change-Id: I16b9affd4402fe5d1637238a2e27f22fdd3986ff
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-09-25 16:56:52 -04:00
Paul Belanger
29c17b9d23 Add test coverate for grafana.py
Previous to this we actually didn't install our requests dependency.
So grafyaml actually didn't work :( Now we have basic coverage with
mock.

Change-Id: I771ea12e444ea851d76983df75f69d1569653f9d
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-09-25 13:03:53 -04:00
Jenkins
a04ac20eaa Merge "Simplify .gitignore" 2015-09-25 16:39:26 +00:00
Jenkins
987de04d00 Merge "The apikey is now optional" 2015-09-24 17:42:21 +00:00
Paul Belanger
8029107fc8 The apikey is now optional
Grafana 2.1.0 added basic auth support. With that in mind, the api key
is now optional.

Change-Id: Ie186fa9ce48ca4ae222f75345e9b660f5ffa2909
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-09-23 14:55:34 -04:00
Paul Belanger
2ca5c35b28 Simplify .gitignore
Change-Id: I2991499044a834cb60a70b1c3f2763667f0558bc
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-09-23 10:37:18 -04:00
Jenkins
da752c6677 Merge "Bump pbr requirement to >= 1.3" 2015-09-22 23:17:43 +00:00
Jenkins
0a53589496 Merge "Fix scopping error with panel validation" 2015-09-22 16:49:10 +00:00
Jenkins
f09c71eec0 Merge "Remove Babel bits" 2015-09-22 16:46:45 +00:00
Paul Belanger
f83e3e45d8 Fix scopping error with panel validation
This fixes an issue where we were lumping each panel into all rows,
regardless of the yaml syntax provided.

Also add unit test for code coverage.

Change-Id: Ibc1e086d777692889f9c1dc26741e247bf90a985
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-09-21 10:55:16 -04:00
Monty Taylor
5be3782e4a Change ignore-errors to ignore_errors
Needed for coverage 4.0

Change-Id: Ic1c70842f4f7a13753809de307dc0cd1638b3d16
2015-09-21 14:23:17 +00:00
Jenkins
f7b74e0ada Merge "Enforce properly indentation for json fixtures" 2015-09-21 13:49:41 +00:00
Paul Belanger
fb128ea722 Bump pbr requirement to >= 1.3
Also remove invalid comment about setup.py being managed my requirements repo.

Change-Id: I0b3e604b14648f9ae52ca2381269c13cf9e1574f
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-09-21 13:38:59 +00:00
Paul Belanger
27917e59e0 Enforce properly indentation for json fixtures
Change-Id: I21415f27332decea555c3534a96e02ba1ea0c591
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-09-18 16:06:20 -04:00
Paul Belanger
eabed49f75 Remove Babel bits
These are currently unsed and left over bits from cookie-cutter.

Change-Id: I99d143898e2ef8e7dbd6e0c470d6afdba89fc1f7
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-09-17 14:15:51 -04:00
Timothy Chavez
ca481dd206 Use safe_load when parsing yaml
In Openstack I don't think we need to be too concerned with what we're
loading from yaml, but another project might?  So, in the name of
reusability, I propose we use safe_load.  Unless of course this actually
breaks something :)

Change-Id: Ib64f84cba22290a5059e649aee94d65dfa78344f
2015-08-14 17:33:38 -05:00
Paul Belanger
ae112ccee6 Fix --version CLI output
Change-Id: Ib933f7d3a6a1bd0238cb73739a123bacc5574bb0
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-06-30 13:07:51 -04:00
Paul Belanger
3a6973cc56 Initial unit tests for CLI
Change-Id: Ie18bda7edd09cf95bc2c0066ddaf73e1c4c8a7fa
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-06-30 13:07:51 -04:00
Jenkins
66131b485c Merge "Re-run tox -egenconfig to fix oslo.config bug" 2015-06-30 15:46:16 +00:00
Jenkins
7413c27b82 Merge "Move yaml functions into its own class" 2015-06-30 15:46:14 +00:00
Paul Belanger
54a434732c Re-run tox -egenconfig to fix oslo.config bug
Change-Id: Iee4b41269c6343f0c2bfa36a7a5d570e5bcb179d
Depends-On: I946d55fcd713369dda4cdf490391a75901bded22
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-06-22 10:31:28 -04:00
Paul Belanger
9030cad526 Move yaml functions into its own class
This will centeralize our overlapping yaml code paths.

Change-Id: Ib8bc0fc93b49363cb511d9891a24ea48fdee136d
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-06-17 13:34:28 -04:00
Paul Belanger
766af4a6c5 Drop support for py26 and py33
Unless anybody has major objections, we can drop coverage for them.

Change-Id: I3337987bae825ede377d5c88d2c028b25e66dfb1
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-06-08 11:49:52 -04:00
Paul Belanger
b02e007258 Clean up README after import
Change-Id: I148dd2f0e4c133cdbce68b1ca616978074ff58a1
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-06-08 11:32:28 -04:00