add fabfiles for all goodness

This commit is contained in:
Dmitry Shulyak 2013-09-20 11:51:57 +03:00
parent 53025a4aeb
commit 374fafdcd1
2 changed files with 51 additions and 1 deletions

50
fabfile.py vendored Normal file
View File

@ -0,0 +1,50 @@
from fabric.api import local
def createrole(user='ostf', password='ostf'):
local(('psql -U postgres -c "CREATE ROLE {0} WITH PASSWORD'
'\'{1}\' SUPERUSER CREATEDB LOGIN;"').format(user, password))
def createdb(user='ostf', database='ostf'):
local('psql -U postgres -c "CREATE DATABASE {0} WITH OWNER={1};"'.format(database, user))
def dropdb(database='ostf'):
local('psql -U postgres -c "DROP DATABASE {0};"'.format(database))
def deps():
local('python setup.py egg_info && pip install -r *.egg-info/requires.txt')
def devlink():
local('python setup.py develop')
def start_server():
local(('ostf-server '
'--dbpath postgresql+psycopg2://ostf:ostf@localhost/ostf'
'--debug --debug_tests=fuel_plugin/tests/functional/dummy_tests').format(path))
def migrate():
path='postgresql+psycopg2://ostf:ostf@localhost/ostf'
local('ostf-server --after-initialization-environment-hook --dbpath {0}'.format(path))
def auth(method='trust'):
"""By default postgres doesnot allow auth withour password
development without password is more fun
"""
path = '/etc/postgresql/9.1/main/pg_hba.conf'
wrong = '^local.*all.*postgres.*'
right = 'local all postgres {0}'.format(method)
local("sudo sed -i 's/{0}/{1}/' {2}".format(wrong, right, path))
local("sudo service postgresql restart")
def remakedb():
dropdb()
createdb()
migrate()

View File

@ -23,7 +23,7 @@ fuel_health_reqs = [
'python-keystoneclient>=0.3.1',
'python-novaclient>=2.13.0',
'paramiko>=1.10.1',
'requests>=1.2.3',
'requests>=1.1,<1.2.3',
'unittest2>=0.5.1',
'pyyaml>=3.10',
'testresources>=0.2.7'