distil/is_provisioned.py
Aurynn Shaw bf671c0210 Moves the artifice web API into the artifice package. Updates the build
system to create a working .deb, based on the makefile.
Adds a new script to start up the web daemon.
Adds a new script to test if the database is provisioned
Adds a new script used by Puppet to provision the database
Adds puppet manifests (mirrored in main puppet)
Moves api/ to artifice/api
Alters some of the relative imports
Moves artifice.py to why_is_this_called_artifice.py, as it was causing
import issues.

Change-Id: Id8a909f7ffcc64a5c4e3281c6b5ba83cef73b596
2014-04-01 16:08:49 +13:00

16 lines
403 B
Python

from artifice.models import Base, __VERSION__, _Version
from sqlalchemy.orm import scoped_session, create_session
from sqlalchemy import create_engine
from sqlalchemy.pool import NullPool
import sys, os
uri = os.environ["DATABASE_URI"]
engine = create_engine(uri, poolclass=NullPool)
session = create_session(bind=engine)
v = session.query(_Version).first()
if v is None:
sys.exit(0)
sys.exit(1)