CC-2138: update_db_info.py to read from /etc/airtime/airtime.conf
-done
This commit is contained in:
parent
86f2129f8d
commit
d3ec3ef1e8
|
@ -20,9 +20,9 @@ $CC_CONFIG = array(
|
||||||
|
|
||||||
'rabbitmq' => $values['rabbitmq'],
|
'rabbitmq' => $values['rabbitmq'],
|
||||||
|
|
||||||
'baseFilesDir' => $values['general']['baseFilesDir'],
|
'baseFilesDir' => $values['general']['base_files_dir'],
|
||||||
// main directory for storing binary media files
|
// main directory for storing binary media files
|
||||||
'storageDir' => $values['general']['baseFilesDir']."/stor",
|
'storageDir' => $values['general']['base_files_dir']."/stor",
|
||||||
|
|
||||||
// Database config
|
// Database config
|
||||||
'dsn' => array(
|
'dsn' => array(
|
||||||
|
|
|
@ -13,8 +13,9 @@ vhost = /
|
||||||
|
|
||||||
[general]
|
[general]
|
||||||
api_key = AAA
|
api_key = AAA
|
||||||
webServerUser = www-data
|
web_server_user = www-data
|
||||||
baseFilesDir = x
|
airtime_dir = x
|
||||||
|
base_files_dir = x
|
||||||
|
|
||||||
[soundcloud]
|
[soundcloud]
|
||||||
connection_retries = 3
|
connection_retries = 3
|
||||||
|
|
|
@ -161,7 +161,8 @@ class AirtimeIni{
|
||||||
{
|
{
|
||||||
$api_key = AirtimeIni::GenerateRandomString();
|
$api_key = AirtimeIni::GenerateRandomString();
|
||||||
AirtimeIni::UpdateIniValue('/etc/airtime/airtime.conf', 'api_key', $api_key);
|
AirtimeIni::UpdateIniValue('/etc/airtime/airtime.conf', 'api_key', $api_key);
|
||||||
AirtimeIni::UpdateIniValue('/etc/airtime/airtime.conf', 'baseFilesDir', realpath(__DIR__.'/../../').'/files');
|
AirtimeIni::UpdateIniValue('/etc/airtime/airtime.conf', 'base_files_dir', realpath(__DIR__.'/../../').'/files');
|
||||||
|
AirtimeIni::UpdateIniValue('/etc/airtime/airtime.conf', 'airtime_dir', realpath(__DIR__.'/../../'));
|
||||||
AirtimeIni::UpdateIniValue('/etc/airtime/pypo.cfg', 'api_key', "'$api_key'");
|
AirtimeIni::UpdateIniValue('/etc/airtime/pypo.cfg', 'api_key', "'$api_key'");
|
||||||
AirtimeIni::UpdateIniValue('/etc/airtime/recorder.cfg', 'api_key', "'$api_key'");
|
AirtimeIni::UpdateIniValue('/etc/airtime/recorder.cfg', 'api_key', "'$api_key'");
|
||||||
AirtimeIni::UpdateIniValue(__DIR__.'/../../build/build.properties', 'project.home', realpath(__dir__.'/../../'));
|
AirtimeIni::UpdateIniValue(__DIR__.'/../../build/build.properties', 'project.home', realpath(__dir__.'/../../'));
|
||||||
|
|
|
@ -167,10 +167,14 @@ class AirtimeInstall {
|
||||||
|
|
||||||
$dir = realpath(__DIR__."/../../utils/airtime-clean-storage");
|
$dir = realpath(__DIR__."/../../utils/airtime-clean-storage");
|
||||||
exec("ln -s $dir /usr/bin/airtime-clean-storage");
|
exec("ln -s $dir /usr/bin/airtime-clean-storage");
|
||||||
|
|
||||||
|
$dir = realpath(__DIR__."/../../utils/airtime-update-db-settings");
|
||||||
|
exec("ln -s $dir /usr/bin/airtime-update-db-settings");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function RemoveSymlinks(){
|
public static function RemoveSymlinks(){
|
||||||
exec("rm -f /usr/bin/airtime-import");
|
exec("rm -f /usr/bin/airtime-import");
|
||||||
exec("rm -f /usr/bin/airtime-clean-storage");
|
exec("rm -f /usr/bin/airtime-clean-storage");
|
||||||
|
exec("rm -f /usr/bin/airtime-update-db-settings");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
The purpose of this script is to consolidate into one location where
|
The purpose of this script is to consolidate into one location where
|
||||||
we need to update database host, dbname, username and password.
|
we need to update database host, dbname, username and password.
|
||||||
|
|
||||||
This script reads from database.conf.
|
This script reads from airtime.conf.
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
|
@ -11,18 +11,18 @@ from xml.dom.minidom import Node
|
||||||
|
|
||||||
#Read the universal values
|
#Read the universal values
|
||||||
parser = ConfigParser.SafeConfigParser()
|
parser = ConfigParser.SafeConfigParser()
|
||||||
parser.read('airtime.conf')
|
parser.read('/etc/airtime/airtime.conf')
|
||||||
section_names = parser.sections();
|
|
||||||
items_in_section = parser.items(section_names[0])
|
|
||||||
|
|
||||||
|
|
||||||
print "Updating ../application/configs/application.ini"
|
|
||||||
host = 'resources.db.params.host'
|
host = 'resources.db.params.host'
|
||||||
dbname = 'resources.db.params.dbname'
|
dbname = 'resources.db.params.dbname'
|
||||||
username = 'resources.db.params.username'
|
username = 'resources.db.params.username'
|
||||||
password = 'resources.db.params.password'
|
password = 'resources.db.params.password'
|
||||||
|
|
||||||
f = file('../application/configs/application.ini','r')
|
airtime_dir = parser.get('general', 'airtime_dir')
|
||||||
|
print 'Airtime root folder found at %s' % airtime_dir
|
||||||
|
|
||||||
|
print ("Updating %s/application/configs/application.ini" % airtime_dir)
|
||||||
|
f = file('%s/application/configs/application.ini' % airtime_dir,'r')
|
||||||
file_lines = []
|
file_lines = []
|
||||||
|
|
||||||
for line in f:
|
for line in f:
|
||||||
|
@ -37,14 +37,14 @@ for line in f:
|
||||||
file_lines.append(line)
|
file_lines.append(line)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
f = file('../application/configs/application.ini', 'w')
|
f = file('%s/application/configs/application.ini' % airtime_dir, 'w')
|
||||||
f.writelines(file_lines)
|
f.writelines(file_lines)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
print "Updating ./build.properties"
|
print ("Updating %s/build.properties" % airtime_dir)
|
||||||
|
|
||||||
f = file('build.properties', 'r')
|
f = file('%s/build/build.properties' % airtime_dir, 'r')
|
||||||
file_lines = []
|
file_lines = []
|
||||||
|
|
||||||
db_url = 'propel.database.url'
|
db_url = 'propel.database.url'
|
||||||
|
@ -57,22 +57,22 @@ for line in f:
|
||||||
file_lines.append(line)
|
file_lines.append(line)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
f = file('build.properties', 'w')
|
f = file('%s/build/build.properties' % airtime_dir, 'w')
|
||||||
f.writelines(file_lines)
|
f.writelines(file_lines)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
print "Updating ./runtime-conf.xml"
|
print ("Updating %s/runtime-conf.xml" % airtime_dir)
|
||||||
|
|
||||||
doc = xml.dom.minidom.parse('./runtime-conf.xml')
|
doc = xml.dom.minidom.parse('%s/build/runtime-conf.xml' % airtime_dir)
|
||||||
|
|
||||||
node = doc.getElementsByTagName("dsn")[0]
|
node = doc.getElementsByTagName("dsn")[0]
|
||||||
node.firstChild.nodeValue = 'pgsql:host=%s;port=5432;dbname=%s;user=%s;password=%s' % (parser.get('database', 'host'), \
|
node.firstChild.nodeValue = 'pgsql:host=%s;port=5432;dbname=%s;user=%s;password=%s' % (parser.get('database', 'host'), \
|
||||||
parser.get('database', 'dbname'), parser.get('database', 'dbuser'), parser.get('database', 'dbpass'))
|
parser.get('database', 'dbname'), parser.get('database', 'dbuser'), parser.get('database', 'dbpass'))
|
||||||
|
|
||||||
xml_file = open('runtime-conf.xml', "w")
|
xml_file = open('%s/build/runtime-conf.xml' % airtime_dir, "w")
|
||||||
xml_file.writelines(doc.toxml('utf-8'))
|
xml_file.writelines(doc.toxml('utf-8'))
|
||||||
xml_file.close()
|
xml_file.close()
|
||||||
|
|
||||||
print 'Regenerating propel-config.php'
|
print 'Regenerating propel-config.php'
|
||||||
os.system('../library/propel/generator/bin/propel-gen')
|
os.system('cd %s/build && %s/library/propel/generator/bin/propel-gen' % (airtime_dir, airtime_dir))
|
||||||
|
|
Loading…
Reference in New Issue