Skip to content

Commit

Permalink
Merge pull request #17 from al4/versionOne
Browse files Browse the repository at this point in the history
Version 0.1.0
  • Loading branch information
al4 committed Jan 19, 2016
2 parents 021a1e6 + ce99762 commit 6eb37df
Show file tree
Hide file tree
Showing 26 changed files with 913 additions and 196 deletions.
2 changes: 1 addition & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Vagrant.configure(2) do |config|
| sudo -u postgres -i psql
# Build tools
sudo apt-get -y install build-essential git-buildpackage debhelper python-dev
sudo apt-get -y install build-essential git-buildpackage debhelper python-dev dh-systemd
sudo pip install --upgrade pip
sudo pip install sphinx sphinxcontrib-httpdomain
Expand Down
2 changes: 1 addition & 1 deletion bin/orlo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

/usr/share/python/python-orlo/bin/python /usr/share/python/python-orlo/lib/python2.7/site-packages/orlo/cli.py $@
/usr/share/python/orlo/bin/python /usr/share/python/orlo/lib/python2.7/site-packages/orlo/cli.py $@


6 changes: 3 additions & 3 deletions debian/control
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Source: python-orlo
Source: orlo
Section: python
Priority: extra
Maintainer: Alex Forbes <[email protected]>
Build-Depends: debhelper (>= 9), python, dh-virtualenv, gcc, python-dev, postgresql-server-dev-all
Build-Depends: debhelper (>= 9), python, dh-virtualenv, gcc, python-dev, postgresql-server-dev-all, dh-systemd
Standards-Version: 3.9.5

Package: python-orlo
Package: orlo
Architecture: all
Depends: ${python:Depends}, ${misc:Depends}
Description: An API for tracking deployments, written with Python, Flask and SqlAlchemy.
Expand Down
1 change: 1 addition & 0 deletions debian/dirs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/var/log/orlo
2 changes: 2 additions & 0 deletions debian/install
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
bin/orlo usr/bin
etc/orlo.ini /etc/orlo
systemd/orlo.service /lib/systemd/system
8 changes: 5 additions & 3 deletions debian/preinst
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/bin/bash

set -ue

if grep -q "^orlo" /etc/passwd; then
:
else
useradd orlo -s /bin/false -U
fi

mkdir -p /var/lib/orlo
chown orlo:orlo /var/lib/orlo
chmod 755 /var/lib/orlo
mkdir -p /var/{lib,log}/orlo
chown orlo:orlo /var/{lib,log}/orlo
chmod 755 /var/{lib,log}/orlo
5 changes: 4 additions & 1 deletion debian/rules
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/make -f

%:
dh $@ --with python-virtualenv
dh $@ --with systemd --with python-virtualenv

override_dh_virtualenv:
dh_virtualenv --no-test
4 changes: 2 additions & 2 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ From the psql prompt:
CREATE DATABASE
postgres=#

Update uri under [db] in orlo.conf, e.g.
Update uri under [db] in orlo.ini, e.g.

::

Expand All @@ -96,7 +96,7 @@ Create a directory for the db, e.g. :
mkdir /var/lib/orlo
chown orlo:root /var/lib/orlo

Update the uri under [db] in orlo.conf to point to a file in this directory:
Update the uri under [db] in orlo.ini to point to a file in this directory:

::

Expand Down
11 changes: 11 additions & 0 deletions etc/orlo.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[db]
uri = sqlite://

[main]
time_zone = UTC
propagate_exceptions = true
time_format = %Y-%m-%dT%H:%M:%SZ

[logging]
file = /var/log/orlo/app.log
debug = false
4 changes: 2 additions & 2 deletions orlo/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def parse_args():

p_config = argparse.ArgumentParser(add_help=False)
p_config.add_argument('--file', '-f', dest='filepath', help="File to write to",
default='/etc/orlo.conf')
default='/etc/orlo/orlo.ini')

p_database = argparse.ArgumentParser(add_help=False)
p_server = argparse.ArgumentParser(add_help=False)
Expand Down Expand Up @@ -54,7 +54,7 @@ def setup_database(args):
if config.get('db', 'uri') == 'sqlite://':
print("Warning: setting up in-memory database, this is "
"probably not what you want!\n"
"Please configure db:uri in /etc/orlo.conf")
"Please configure db:uri in /etc/orlo/orlo.ini")
db.create_all()


Expand Down
2 changes: 1 addition & 1 deletion orlo/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
config.set('logging', 'debug', 'false')
config.set('logging', 'file', 'disabled')

config.read('/etc/orlo.conf')
config.read('/etc/orlo/orlo.ini')
4 changes: 3 additions & 1 deletion orlo/error_handlers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import print_function
from flask import jsonify, request
from orlo import app
from orlo.exceptions import InvalidUsage
from orlo.exceptions import InvalidUsage, OrloError

__author__ = 'alforbes'

Expand All @@ -12,6 +12,7 @@ def page_not_found(error):
return jsonify(d), 404


@app.errorhandler(OrloError)
@app.errorhandler(InvalidUsage)
def handle_invalid_usage(error):
response = jsonify(error.to_dict())
Expand All @@ -25,3 +26,4 @@ def handle_400(error):
response.status_code = error.status_code
return response


1 change: 1 addition & 0 deletions orlo/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@


class OrloError(Exception):
status_code = 500
def __init__(self, message, status_code=None, payload=None):
Exception.__init__(self)
self.message = message
Expand Down
Loading

0 comments on commit 6eb37df

Please sign in to comment.