Commit Graph

352 Commits

Author SHA1 Message Date
Michał Margula
1897a4393f Update README.rst
There is no random in os module, changed to urandom (same as in default_setttings), also fixed path in example apache config.
2016-10-22 10:51:52 +02:00
Mike Terzo
3fbd182453 Adding unittests (#300)
* Create a custom class to handle aborting 204 properly.  If this isn't
covered the server will send a 500 due to a python exception

* Moved py.test configuration under tool:pytest, this was causing a
warning.  This is new to 3.0.1 which is now the pinned version

* Unittest for puppetboard.utils
2016-09-11 21:01:13 -04:00
Corey Hammerton
dffd42af1d puppetboard/templates/metrics.html: Added searchability to the Metrics list (#298)
This resolves #297

Adding a search bar to the Metrics page to allow the user to filter the list
items to only show what the user wants.
2016-09-03 17:11:40 -04:00
Corey Hammerton
df3d4a5eaa puppetboard/app.py: Adding an environment filter for displaying Fact names (#295)
This resolves #276

Current behaviour of the Facts page would query the fact_names endpoint
regardless of environment. This update would query the Facts endpoint,
extracting each unique fact name known to the environment.
2016-09-03 17:11:28 -04:00
Alejandro Figueroa
c585251862 Change hostname to certname where applicable (#294)
Certain column headers were referring to a node's certname as its
hostname. This commit corrects that by renaming the column headers.
2016-09-03 17:11:03 -04:00
Corey Hammerton
43526279e0 puppetboard/templates/layout.html: Displaying the current active environment as the dropdown label (#291)
This fixed #290

To help make it more obvious for users to see what the current environment
is replacing the original text of the Environments dropdown menu from
'Environments' to the current environment.

The other suggestion was to make the active item stand out more but that
would require custom CSS that may conflict with the Sementic UI.
2016-09-03 17:10:46 -04:00
Corey Hammerton
5048662861 puppetboard/app.py: Simplifying the Inventory Code (#289)
* puppetboard/app.py: Simplifying the code generating and rendering the Inventory

This resolves #275

This update eliminates one iteration over the resulting inventory facts
that generates a multidimensional dictionary keyed by the node's certname
to another dictionary of key-value pairs of the fact name and fact value.

* puppetboard/templates/inventory.html: Wrapping the fact values in links to the Node page

This comes as a request from #280
2016-09-03 17:10:33 -04:00
Corey Hammerton
0c0a15bdf2 puppetboard/app.py: Enhancing queries for Node and Report states (#271)
* puppetboard/app.py: Enhancing queries for Node and Report states

This resolves #264

On the Nodes and Reports tabs when the user adds a status query string
argument additional query clauses are generated based on its value.
Can be one of failed, changed, unchanged, noop or unreported (for Nodes
only)

No query clause is generated for noop on the Nodes tab. The query field
latest_report_noop was added in PuppetDB 4.1 and we do not want to break
compatability between minor or bug-fix versions.

* puppetboard/app.py: Simplifying the query logic in nodes()

The new logic starts with a blank `AndOperator()` object then proceeds
to build the query based on environment and status values. After all
after all checking if there are no operations declare the object as
None.

* puppetboard/app.py: Simplifying the query logic for reports()

Similar to the work done for nodes()

* puppetboard/app.py: Fixing pep8 formatting in nodes()

* Add pagination to reports/<node>
2016-08-18 20:39:31 -04:00
Nikolai Røed Kristiansen
feac4441c9 Travis: run tests under python 3.5 (#284) 2016-07-27 19:59:44 -04:00
Thomas Hager
294e2d6559 Fixed a typo in Puppetboard's catalog view (#282)
Replaced oder_by_str with order_by_str in get_or_abort() to fix app crash.
2016-07-27 19:59:20 -04:00
Tim Meusel
12b0d09f9b Merge pull request #278 from petems/fix_badges
Fix rst syntax for badges
2016-07-15 10:50:16 +02:00
Peter Souter
510bdccbb5 Fix rst syntax for badges
* Require links to be on newline
2016-07-15 09:39:03 +01:00
Peter Souter
ba7dd9f264 Merge pull request #274 from mterzo/add_coveralls_badge
Add coveralls.io badge
2016-07-15 09:16:53 +01:00
Mike Terzo
a8ca234a3b Add coveralls.io badge 2016-07-14 21:38:49 -04:00
Peter Souter
c1fb6fbdc2 Add Travis Badge (#273) 2016-07-14 19:43:09 -04:00
Mike Terzo
1afe120a12 Update radiator view (#272)
* Fixing 404 on jquery.js

* Remove symlink for jquery.min.map
2016-07-14 19:40:06 -04:00
Mike Terzo
faac5fa1bc Travis ci integration (#267)
* Initial travis-ci integration

* Format code base to PEP8
2016-07-13 20:59:07 -04:00
Corey Hammerton
0ac64530bf README.rst: Fixing code-block strings. (#265)
Github wasn't showing the new readme blocks because they were encoded
code_block instead of the correct code-block.
2016-06-29 20:44:25 -04:00
Corey Hammerton
59c79c7592 Puppetboard: Version Bump to 0.2.0 (#263) v0.2.0 2016-06-28 20:42:44 -04:00
Corey Hammerton
2a6e2380ad puppetboard/app.py: Using the plain-text metric name in metrics() (#259)
This fixes #258

URL quoting is now done in pypuppetdb >= 0.2.3 which contributed to the
metric URL being double-quoted by the time it reached PuppetDB, which
responds with a 404. Instead using the plain-text name to build the
link to metric()
2016-06-28 20:09:30 -04:00
Mike Terzo
bf6f446182 Fix whitespace (#261) 2016-06-28 20:09:09 -04:00
Corey Hammerton
831c8bfaae puppetboard/default_settings.py: Reverting PUPPETDB_HOST change from #187 (#260)
This change is only useful for Docker image building, but for officially
supported packages in PIP this change will cause unnecessary breakage to
existing users. We will have to implement a different approach for configuring
settings in Docker images.

Adding a note to README.rst indicating that an officially supported Docker
image is planned.
2016-06-23 21:00:34 -04:00
Raphaël Pinson
dfaf6daec1 Add wsgi.py and Dockerfile (#187)
* Add a sample wsgi.py

* Add a sample Dockerfile making use of wsgi.py

* Use 'puppetdb' as default location for PUPPETDB_HOST
2016-06-23 20:52:11 -04:00
Corey Hammerton
da044271ee PuppetBoard: Upgrading WTForms to latest version and restoring CSRF Protection (#250)
Upgrading the following packages to the respected versions:

WTForms==2.1
Flask-WTF==0.12
Werkzeug==0.11.0

Passing newly required metadata to the QueryForm constructor in puppetboard/app.py

Apache >= 2.4 with mod_wsgi experienced a major issue where it would re-generate
the app's secret key on each request. The fix for this turned out to be placing
a permanent statis 'secret_key' value in the wsgi.py. Adding a block in README.rst
on how to implement the user's own secret_key
2016-06-23 20:32:31 -04:00
Corey Hammerton
adac2a46bf Implementing new pypuppetdb.QueryBuilder (#251)
* puppetboard/app.py: Implementing and utilizing the new PyPuppetDB QueryBuilder

This fixes https://github.com/voxpupuli/puppetboard/issues/239

Replacing all the directly declared query strings with various objects
from the pypuppetdb.QueryBuilder sub-module. Using this Object-Oriented
functionality it is programmatically safer to construct large, complex
queries.

* puppetboard/app.py: Simplifying the environment logic in `node()`

The query in this function will now always be an `AndOperator()` object.
If a specific environment is queried then that constraint is added.

The resulting query difference will be:

env == 'production'

`["and",["=", "environment", "production"],["=", "certname", "puppet01.hammertime.local"]]`

env == '*'

`["and",["=", "certname", "puppet01.hammertime.local"]]`

* puppetboard/app.py: Minor code simplification for more accurate results.

In index() adding the configured OVERVIEW_FILTER query after adding the previous
constraints to num_nodes_query
In inventory() wrapping fact_query in an AndOperator() regardless of environment.
This update makes it more common with other endpoints that only add environment
constraints if an environment is selected.

* requirements.txt: Bumping the pypuppetdb version requirement

* requirements.txt: Bumping pypuppetdb version to new requirement.

* puppetboard/app.py: Fixing module load error.
2016-06-23 20:26:21 -04:00
Raphaël Pinson
39f48c185c Fix result table markup 2016-06-21 12:22:17 +02:00
Raphaël Pinson
6a072d1f1b Merge branch 'pql' 2016-06-21 09:46:02 +02:00
Raphaël Pinson
38986047a6 Add PQL endpoint to Query form
Requires https://github.com/voxpupuli/pypuppetdb/pull/97
2016-06-21 06:59:24 +02:00
Raphaël Pinson
4887588662 Pretty print data from Query tab (#257) 2016-06-20 21:26:15 -04:00
Benjamin Merot
fac55edc98 Removing redudant declaration of upstream in Nginx example (#252)
With the IP address of the gunicorn server set in proxy_pass, the configuration example doesn't need to declare an upstream server.
2016-06-07 21:09:17 -04:00
Mike Terzo
00b2699d02 Fix exceptions to assign the exception to a variable (#248)
so that the logger can properly use it.
2016-06-06 20:09:36 -04:00
Chris Boot
d471663880 puppetboard/utils.py: fix Python3 compatibility (#247)
If xrange() is not defined, alias it to range().
2016-06-06 20:09:23 -04:00
Corey Hammerton
b7cd58ac2c More Easily View All Reports (#245)
* puppetboard/app.py: Refactoring the report event counts.

Writing the report event counts code in the node(), reports() and
reports_node() functions to iterate through report.events() instead
of querying the event counts endpoint for each report.

This solution is heavier than the original because we have to query
for all full event objects for each report and iterate through them
to interpret their statuses. I originally wanted to replace the
report.events() function with an events variable for the Report object
but that turned out to be not technically possible presently because
the report extended events' timestamps for in a different format which
python can't interpret. Specifically the timezone values contain ':',
there is no Python 2.x documentation that states timezones containing
colons is supported.

This does, however, lighten our dependency on the event-counts endpoint
which is marked as experimental. Which means that it may change or be
removed in a future release.

This also resolves a silent bug which may or may not include environment
filters on the event-counts queries. report.events() searches the Events
endpoint based on the report hash which eliminates the possibility of
mistaken relationships.

* puppetboard/app.py: Replacing url_for_* functions with a single url_for_field()

The url_for_pagination and url_for_environments functions only worked
with a single, fixed request argument, 'page' and 'env' respectively.
The new url_for_field() excepts 2 arguments, field: the name of the
argument to update, and value: its intended value.

Should consider adding a url_for_fields() function that accepts a
dict argument and updates all the request arguments using a dict.update().
There is currently no requirement for it so it will remain in the backlog.

* puppetboard/templates/reports.html: Adding a dropdown menu to limit the report count

This fixes https://github.com/voxpupuli/puppetboard/issues/202

This new dropdown allows users to select their desired number of reports
on the reports() and reports_node() pages. The available options are
app.config['REPORTS_COUNT'], 25, 50, 100 or All. The default value
is determined by the REPORTS_COUNT configuration value.

Had to modify url_for_field() to merge the request args to the view args
in order to generate the links that include the limit query string.
2016-06-06 20:09:07 -04:00
Joseph (Jy) Yaworski
554bd80e93 Merge pull request #249 from vchepkov/community
update links to github Puppet Community
2016-06-04 14:56:55 -04:00
Vadym Chepkov
b1a3d203a3 update links to github Puppet Community 2016-06-04 10:17:51 -04:00
Patrick K
59f27943fc reverse sort order to lump minorities in 'other' instead of majorities (#242) 2016-05-24 18:50:40 -04:00
Raphaël Pinson
0576e6d955 Add OVERVIEW_FILTER (#196) 2016-05-24 18:49:30 -04:00
Corey Hammerton
eb893ffef5 puppetboard/app.py: Protecting against ZeroDivisionErrors on calculations (#244)
This (re-)fixes https://github.com/voxpupuli/puppetboard/issues/220

Corner cases where new installations or empty environments will return
zero resources and zero nodes, this will result in a ZeroDivisionError.
Now if this happens setting the average-resources-per-node to zero.
2016-05-21 16:00:32 -04:00
Corey Hammerton
54fb258b06 puppetboard/app.py: Removing :func:puppetboard/report_latest (#237)
This fixes https://github.com/voxpupuli/puppetboard/issues/234

The report_latest() function was effectively deprecated when PuppetDB
introduced the latest_report_hash field in the Nodes endpoint response
format in version 3.2. With the breaking changes to PuppetDB 4.0.0
support this function can be safely removed.
2016-05-16 20:00:35 -04:00
Corey Hammerton
6c9bc4fda4 puppetboard/templates/_macros.html: Using the Semantic UI Pagination Menu (#236)
This fixes https://github.com/voxpupuli/puppetboard/issues/229

This menu provides a very user friendly interface for rendering the pagination
section, which is available in version 2.1.8. Updating the render_pagination
macro use the new HTML classes.
2016-05-16 20:00:16 -04:00
Corey Hammerton
c1284d21c6 utils.py: Adding logging to utils.py, specifically :func:puppetboard.utils.get_or_abort (#235)
This fixes https://github.com/voxpupuli/puppetboard/issues/230

If there are any connection issues between PuppetBoard and the PuppetDB
instance there wasn't any obvious evidence in log files. This additional
logging added to utils.py logs errors whenever there is an HTTPError,
ConnectionError or EmptyResponseError in get_or_abort.
2016-05-16 19:59:58 -04:00
Corey Hammerton
3833bbf0a1 puppetboard/app.py: Adding Radiator view (#232)
* puppetboard/app.py: Adding Radiator view

Part 2 of https://github.com/voxpupuli/puppetboard/issues/70

This is a refactoring of the changes in https://github.com/voxpupuli/puppetboard/pull/100.
Adds a simple Heads-Up Display of the last run statuses of managed nodes,
either environment filtered or not.

* puppetboard/app.py: Fixing environment filters and metric strings.

* The names of the population metrics have changes in PuppetDB 4.0, the initial
  commit used the metric names from PuppetDB 2.x.
* The main nodes query did not include a query string to filter on environments.
2016-05-16 19:59:40 -04:00
rob
f22ea84c68 Fix error "AttributeError: 'module' object has no attribute (#233)
'PROTOCOL_SSLv3'"

Upgrading the Requests package to 2.6.0

Running debian 8.2 (jessie) I experience the following:

```
Traceback (most recent call last):
  File "dev.py", line 11, in <module>
    from puppetboard.app import app
  File "/srv/puppetboard/puppetboard/puppetboard/app.py", line 19, in <module>
    from pypuppetdb import connect
  File "/srv/puppetboard/virtenv-puppetboard/local/lib/python2.7/site-packages/pypuppetdb/__init__.py", line 61, in <module>
    from pypuppetdb.api import BaseAPI
  File "/srv/puppetboard/virtenv-puppetboard/local/lib/python2.7/site-packages/pypuppetdb/api/__init__.py", line 7, in <module>
    import requests
  File "/srv/puppetboard/virtenv-puppetboard/local/lib/python2.7/site-packages/requests/__init__.py", line 53, in <module>
    from .packages.urllib3.contrib import pyopenssl
  File "/srv/puppetboard/virtenv-puppetboard/local/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 62, in <module>
    ssl.PROTOCOL_SSLv3: OpenSSL.SSL.SSLv3_METHOD,
AttributeError: 'module' object has no attribute 'PROTOCOL_SSLv3'
```

Bumped 'requests' version as suggested here: http://stackoverflow.com/questions/28987891/patch-pyopenssl-for-sslv3-issue
2016-05-07 17:00:49 -04:00
Michael
b5ba2515e2 Semantic UI update to 2.1.8 (#211)
* Update to Semantic UI 2.1.6

Basically I tried to rebuild the old layout as closely as possible.
It is a bit more mobile friendly but still misses Semantic UIs collapsable menu:
  https://github.com/Semantic-Org/Semantic-UI/issues/157

+ ditch old tablesorter for recommended one
+ use em instead of percentage for status labels in macros

Overview:

+ sort overview by report date per default
+ slightly different colors

Facts:

+ template based approach to even out the columns in facts view
+ don't show empty containers
+ needed an additional variable in context

* get rid of unnecessary semantic src files

* more cleanup

* clean jquery-tablesort directory as well

* drop unused theme files

* remove symlinks in static/{js,css}

* semantic_update

+ bump to semantic 2.1.8
+ minor adjustments
  - default-sort class in tables
  - table type in inventory
  - fixed and wrapped table for reports

* updated screenshots
2016-04-23 20:30:20 -04:00
Matthew Gyurgyik
a7a35c1829 puppetdb 4.x metric api calls (#228) 2016-04-23 20:08:29 -04:00
corey.hammerton
c80da7192d Version bump to 0.1.3 2016-03-21 20:31:45 -04:00
corey.hammerton
c13389cc3e Version bump to 0.1.2 2016-02-15 19:57:43 -05:00
Corey Hammerton
7c44854988 Merge pull request #162 from visibilityspots/master
Examples add to the readme
2016-02-09 19:40:59 -05:00
Corey Hammerton
3844d72bcb Merge pull request #219 from corey-hammerton/issue-218
puppetboard/app: Enabling environment filtering on overview metrics
2016-02-09 19:37:42 -05:00
Corey Hammerton
43ff09fbd4 Merge pull request #217 from corey-hammerton/issue-198
puppetboard/app: Disabling CSRF protection globally.

I still think this is a bad idea but I don't see any other way.
2016-02-09 19:37:18 -05:00