fuel-plugin-xenserver/cleardb.py
John Hua b0f773086c Add post deployment scripts
+ Install xen tools dpkg on compute nodes
+ Install nova/xapi plugin on compute nodes
+ Install xenapi sdk on compute nodes
+ Setup HIMN between compute nodes and xenservers
+ Initialize nova-compute.conf
+ Remove existed images from glance and create new
2015-07-20 11:42:20 +08:00

21 lines
482 B
Python
Executable File

#!/usr/bin/env python
import os
import yaml
settings = yaml.load(open('/etc/nailgun/settings.yaml'))
db_settings = settings['DATABASE']
os.environ["PGPASSWORD"] = db_settings['passwd']
def execute_sql(sql):
paras = dict(db_settings.items() + {'sql':sql}.items())
cmd = ('psql -h {host} -p {port} -U {user} -w -d {name} '
'-c "{sql}" '
).format(**paras)
print cmd
os.system(cmd)
if __name__ == '__main__':
execute_sql('delete from releases where name like \'%Xen%\';')