CC-3270: Update "airtime-update-db-settings.py" fails

-fixed. We no longer need to run phing.
This commit is contained in:
Martin Konecny 2012-01-24 17:26:45 -05:00
parent 1080bf692f
commit f4bca04edc
1 changed files with 12 additions and 8 deletions

View File

@ -2,7 +2,7 @@
The purpose of this script is to consolidate into one location where
we need to update database host, dbname, username and password.
This script reads from airtime.conf.
This script reads from /etc/airtime/airtime.conf.
"""
import os
import sys
@ -14,9 +14,11 @@ if os.geteuid() != 0:
print "Please run this as root."
sys.exit(1)
airtime_conf = '/etc/airtime/airtime.conf'
#Read the universal values
parser = ConfigParser.SafeConfigParser()
parser.read('/etc/airtime/airtime.conf')
parser.read(airtime_conf)
host = 'resources.db.params.host'
dbname = 'resources.db.params.dbname'
@ -24,7 +26,11 @@ username = 'resources.db.params.username'
password = 'resources.db.params.password'
airtime_dir = parser.get('general', 'airtime_dir')
print 'Airtime root folder found at %s' % airtime_dir
if os.path.exists(airtime_dir):
print 'Airtime root folder found at %s' % airtime_dir
else:
print 'Could not find Airtime root folder specified by "airtime_dir" in %s' % airtime_conf
sys.exit(1)
print ("Updating %s/application/configs/application.ini" % airtime_dir)
f = file('%s/application/configs/application.ini' % airtime_dir,'r')
@ -47,7 +53,7 @@ f.writelines(file_lines)
f.close()
print ("Updating %s/build.properties" % airtime_dir)
print ("Updating %s/build/build.properties" % airtime_dir)
f = file('%s/build/build.properties' % airtime_dir, 'r')
file_lines = []
@ -66,7 +72,7 @@ f = file('%s/build/build.properties' % airtime_dir, 'w')
f.writelines(file_lines)
f.close()
print ("Updating %s/runtime-conf.xml" % airtime_dir)
print ("Updating %s/build/runtime-conf.xml" % airtime_dir)
doc = xml.dom.minidom.parse('%s/build/runtime-conf.xml' % airtime_dir)
@ -78,6 +84,4 @@ xml_file = open('%s/build/runtime-conf.xml' % airtime_dir, "w")
xml_file.writelines(doc.toxml('utf-8'))
xml_file.close()
print 'Regenerating propel-config.php'
os.system('cd %s/build && %s/library/propel/generator/bin/propel-gen' % (airtime_dir, airtime_dir))
print "Success!"