* 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.
54 lines
1.5 KiB
Python
54 lines
1.5 KiB
Python
import sys
|
|
import os
|
|
import codecs
|
|
|
|
from setuptools import setup, find_packages
|
|
|
|
|
|
if sys.argv[-1] == 'publish':
|
|
os.system('python setup.py sdist upload')
|
|
sys.exit()
|
|
|
|
VERSION = "0.1.3"
|
|
|
|
with codecs.open('README.rst', encoding='utf-8') as f:
|
|
README = f.read()
|
|
|
|
with codecs.open('CHANGELOG.rst', encoding='utf-8') as f:
|
|
CHANGELOG = f.read()
|
|
|
|
setup(
|
|
name='puppetboard',
|
|
version=VERSION,
|
|
author='Daniele Sluijters',
|
|
author_email='daniele.sluijters+pypi@gmail.com',
|
|
packages=find_packages(),
|
|
url='https://github.com/voxpupuli/puppetboard',
|
|
license='Apache License 2.0',
|
|
description='Web frontend for PuppetDB',
|
|
include_package_data=True,
|
|
long_description='\n'.join((README, CHANGELOG)),
|
|
install_requires=[
|
|
"Flask >= 0.10.1",
|
|
"Flask-WTF >= 0.9.4, <= 0.9.5",
|
|
"WTForms < 2.0",
|
|
"pypuppetdb >= 0.3.0, < 0.4.0",
|
|
],
|
|
keywords="puppet puppetdb puppetboard",
|
|
classifiers=[
|
|
'Development Status :: 3 - Alpha',
|
|
'Environment :: Web Environment',
|
|
'Framework :: Flask',
|
|
'Intended Audience :: System Administrators',
|
|
'Natural Language :: English',
|
|
'License :: OSI Approved :: Apache Software License',
|
|
'Operating System :: POSIX',
|
|
'Programming Language :: Python :: 2',
|
|
'Programming Language :: Python :: 2.6',
|
|
'Programming Language :: Python :: 2.7',
|
|
'Programming Language :: Python :: 3',
|
|
'Programming Language :: Python :: 3.2',
|
|
'Programming Language :: Python :: 3.3',
|
|
],
|
|
)
|