From f4bca04edcff9a7e3189601424173a67e2e4dc13 Mon Sep 17 00:00:00 2001
From: Martin Konecny <martin@localhost.localdomain>
Date: Tue, 24 Jan 2012 17:26:45 -0500
Subject: [PATCH] CC-3270: Update "airtime-update-db-settings.py" fails

-fixed. We no longer need to run phing.
---
 utils/airtime-update-db-settings.py | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/utils/airtime-update-db-settings.py b/utils/airtime-update-db-settings.py
index ff292a460..d28322fb1 100644
--- a/utils/airtime-update-db-settings.py
+++ b/utils/airtime-update-db-settings.py
@@ -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!"