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

Cli conversion (fix #189) #310

Open
wants to merge 49 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
f010a20
Add click to requirements-dev
borrob Dec 11, 2019
4b23e9b
WIP: updat import statements
borrob Dec 12, 2019
284b50b
Add first CLI commands
borrob Dec 12, 2019
84112f4
Add setup.py
robvl Dec 13, 2019
b648a31
CLI commands for models.py
borrob Dec 13, 2019
7aff5b1
Move all paver commands to click
borrob Dec 13, 2019
bfb74eb
Update command calls
borrob Dec 13, 2019
dd9d26b
Update documentation to add new cli
borrob Dec 13, 2019
adde2ab
Update readme on cli
borrob Dec 13, 2019
272d21d
Update README - fix sourcing venv
borrob Dec 13, 2019
8df7fd9
Update setup.py to complete build egg and wheel
borrob Dec 13, 2019
531162f
Update travis to cli commands
borrob Dec 14, 2019
f3ee207
Update docker scripts to cli
borrob Dec 14, 2019
b4513a8
Fix flake8 issues
borrob Dec 15, 2019
3c427a5
Update docker commands
borrob Dec 18, 2019
0741f99
Rename cli script
borrob Dec 18, 2019
efda72c
Final touches
borrob Dec 18, 2019
ce5ced3
Add Pycharm files to gitignore
borrob Dec 19, 2019
b3bbe00
WIP: fix docker
borrob Dec 19, 2019
ba875b6
Fix import statements app.py
borrob Dec 20, 2019
7277044
Format dockerfile
borrob Dec 20, 2019
a99bd78
Add paver again
borrob Dec 20, 2019
6f8508d
Update tests to new imports
borrob Dec 20, 2019
8989590
Cleanup and add documentation
borrob Dec 20, 2019
8a25408
Update install doc
borrob Dec 23, 2019
abf71b8
WIP: convert setup command
borrob Dec 26, 2019
3a3bd77
Fix path errors and wrap click functions
borrob Jan 1, 2020
8e5c8bb
Update path things in cli
borrob Jan 3, 2020
1e6129e
Fix flake8 issues
borrob Jan 3, 2020
fce898f
Remove paver from docker requirements
borrob Jan 3, 2020
88675bf
WIP: fix paths in docker
borrob Jan 6, 2020
a6a1da0
Fix docker build
borrob Jan 7, 2020
74d1455
Fix flake8
borrob Jan 8, 2020
09e87bb
Fix travis build
borrob Jan 8, 2020
25a3cbc
Fix travis build -2
borrob Jan 8, 2020
7e19425
Fix travis build -3
borrob Jan 8, 2020
5b708d5
Fix flake8 issues
borrob Jan 8, 2020
71ea488
Fix flake8 issues
borrob Jan 8, 2020
0d2cc5c
Update format versionnumner
borrob Jan 13, 2020
4263ffe
Rename file geohc_cli to cli
borrob Jan 13, 2020
b68098d
Use LOGGER.warning instead of warnings module
borrob Jan 13, 2020
bb96eb0
Fix acquiring version number
borrob Jan 13, 2020
f6da999
Update name to correct use of capitals
borrob Jan 13, 2020
040aa0a
Create cli subcommand for database
borrob Jan 13, 2020
14df3f0
Fix flake8
borrob Jan 13, 2020
f9afdfe
Fix version number in docs
borrob Jan 13, 2020
57383c0
Remove references to paver
borrob Jan 15, 2020
9675b12
Fix paths in setup script
borrob Jan 21, 2020
d52e6a9
Fix docker daemon
borrob Jan 22, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,6 @@ GeoHealthCheck.conf

# Data
GeoHealthCheck/data.db

# IDE
.idea
15 changes: 8 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ python:
sudo: false

install:
- pip install -r requirements.txt
- pip install -e .
- pip install -r requirements-dev.txt
- paver setup
- geohc create-instance
borrob marked this conversation as resolved.
Show resolved Hide resolved

script:
- echo -e "admin\ntest\ntest\[email protected]\[email protected]" | python GeoHealthCheck/models.py create
- geohc db create
- geohc db adduser -u admin -p test -e [email protected] -r admin
- flake8
- python GeoHealthCheck/models.py load tests/data/fixtures.json y
- python GeoHealthCheck/healthcheck.py
- python tests/run_tests.py
- geohc db load -f tests/data/fixtures.json -y
- geohc run-healthchecks
- geohc run-tests
- cd docs && make html

after-script:
- python GeoHealthCheck/models.py drop
- geohc db drop
32 changes: 16 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ ENV LC_ALL="en_US.UTF-8" \
GHC_SMTP_PASSWORD=None \
GHC_METADATA_CACHE_SECS=900 \
\
# WSGI server settings, assumed is gunicorn \
HOST=0.0.0.0 \
PORT=80 \
WSGI_WORKERS=4 \
WSGI_WORKER_TIMEOUT=6000 \
WSGI_WORKER_CLASS='eventlet' \
\
# GHC Core Plugins modules and/or classes, seldom needed to set: \
# if not specified here or in Container environment \
# all GHC built-in Plugins will be active. \
#ENV GHC_PLUGINS 'GeoHealthCheck.plugins.probe.owsgetcaps,\
# GeoHealthCheck.plugins.probe.wms, ...., ...\
# GeoHealthCheck.plugins.check.checks' \
\
# GHC User Plugins, best be overridden via Container environment \
GHC_USER_PLUGINS=''
# WSGI server settings, assumed is gunicorn \
HOST=0.0.0.0 \
PORT=80 \
WSGI_WORKERS=4 \
WSGI_WORKER_TIMEOUT=6000 \
WSGI_WORKER_CLASS='eventlet' \
\
# GHC Core Plugins modules and/or classes, seldom needed to set: \
# if not specified here or in Container environment \
# all GHC built-in Plugins will be active. \
#ENV GHC_PLUGINS 'GeoHealthCheck.plugins.probe.owsgetcaps,\
# GeoHealthCheck.plugins.probe.wms, ...., ...\
# GeoHealthCheck.plugins.check.checks' \
\
# GHC User Plugins, best be overridden via Container environment \
GHC_USER_PLUGINS=''

RUN apk add --no-cache --virtual .build-deps gcc build-base libxslt-dev libxml2-dev linux-headers postgresql-dev \
&& apk add --no-cache bash postgresql-client libxslt libxml2 tzdata openntpd python3 python3-dev \
Expand Down
10 changes: 1 addition & 9 deletions GeoHealthCheck/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,4 @@
#
# =================================================================

from util import read


def get_package_version(file_):
"""get version from top-level package init"""
return read(file_)


__version__ = get_package_version('../VERSION')
__version__ = '0.8.dev0'
24 changes: 13 additions & 11 deletions GeoHealthCheck/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@
from flask_migrate import Migrate
from itertools import chain

import views
from __init__ import __version__
from enums import RESOURCE_TYPES
from factory import Factory
from init import App
from models import Resource, Run, ProbeVars, CheckVars, Tag, User, Recipient
from resourceauth import ResourceAuth
from util import send_email, geocode, format_checked_datetime, \
from GeoHealthCheck import views
from GeoHealthCheck.__init__ import __version__
from GeoHealthCheck.enums import RESOURCE_TYPES
from GeoHealthCheck.factory import Factory
from GeoHealthCheck.init import App
from GeoHealthCheck.models import Resource, Run, ProbeVars, CheckVars, Tag, \
User, Recipient
from GeoHealthCheck.resourceauth import ResourceAuth
from GeoHealthCheck.util import send_email, geocode, format_checked_datetime, \
format_run_status, format_obj_value

# Module globals for convenience
Expand All @@ -76,7 +77,7 @@
# Should GHC Runner be run within GHC webapp?
if CONFIG['GHC_RUNNER_IN_WEBAPP'] is True:
LOGGER.info('Running GHC Scheduler in WebApp')
from scheduler import start_schedule
from GeoHealthCheck.scheduler import start_schedule

# Start scheduler
start_schedule()
Expand Down Expand Up @@ -531,7 +532,8 @@ def add():
url = request.form['url'].strip()
resources_to_add = []

from healthcheck import sniff_test_resource, run_test_resource
from GeoHealthCheck.healthcheck import sniff_test_resource, \
run_test_resource
sniffed_resources = sniff_test_resource(CONFIG, resource_type, url)

if not sniffed_resources:
Expand Down Expand Up @@ -734,7 +736,7 @@ def test(resource_identifier):
flash(gettext('Resource not found'), 'danger')
return redirect(request.referrer)

from healthcheck import run_test_resource
from GeoHealthCheck.healthcheck import run_test_resource
result = run_test_resource(
resource)

Expand Down
4 changes: 2 additions & 2 deletions GeoHealthCheck/check.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from plugin import Plugin
from result import CheckResult
from GeoHealthCheck.plugin import Plugin
from GeoHealthCheck.result import CheckResult


class Check(Plugin):
Expand Down
Loading