Rewrite config from /etc/airtime-saas to plain /etc/airtime

This is the results of sed -i -e 's|/etc/airtime-saas/|/etc/airtime/|' `grep -irl 'airtime-saas' airtime_mvc/ python_apps/` :P

It might need more testing, the airtime-saas part never really made sense, zf1 has environments for that, ie you would create a saas env based on production for instance.

I beleive legacy upstream was using this to share configuration between customers (ie. analyser runs only once and writes to a shared S3 bucket). I assume they mount the airtime-saas folder onto individual customers instances with a global config. Like I said, I don't feel that this makes sense since all it does is make hacking at the configs in airtime-saas a bit easier. A serious SaaS operation should be using something like puppet or ansible to achieve this.
This commit is contained in:
Lucas Bickel 2017-02-20 21:36:13 +01:00
parent 4557395a86
commit e28ad471f9
8 changed files with 23 additions and 18 deletions

View file

@ -25,8 +25,7 @@ require_once(dirname(dirname( __DIR__)) . "/application/models/airtime/CcMusicDi
class MediaSetup extends Setup {
const MEDIA_FOLDER = "mediaFolder";
const AIRTIME_CONF_PATH = "/etc/airtime/airtime.conf";
const RMQ_INI_BASE_PATH = "/etc/airtime-saas/";
const LIBRETIME_CONF_FILE_NAME = "airtime.conf";
const RMQ_INI_FILE_NAME = "rabbitmq-analyzer.ini";
static $path;
@ -77,8 +76,11 @@ class MediaSetup extends Setup {
* airtime.conf to airtime.conf.tmp during the setup process. Now that we're done,
* we can rename it to airtime.conf.bak to avoid confusion.
*/
if (file_exists(self::AIRTIME_CONF_PATH . ".tmp")) {
rename(self::AIRTIME_CONF_PATH . ".tmp", self::AIRTIME_CONF_PATH . ".bak");
$fileName = LIBRETIME_CONF_DIR . '/' . self::LIBRETIME_CONF_FILE_NAME;
$tmpFile = $fileName . '.tmp';
$bakFile = $fileName . '.bak';
if (file_exists($tmpFile)) {
rename($tmpFile, $bakFile);
}
} else {
self::$message = "Failed to move airtime.conf; /etc/airtime doesn't exist!";
@ -96,7 +98,7 @@ class MediaSetup extends Setup {
* @return boolean false if either of the copy or removal operations fail
*/
function moveAirtimeConfig() {
return copy(AIRTIME_CONF_TEMP_PATH, self::AIRTIME_CONF_PATH)
return copy(AIRTIME_CONF_TEMP_PATH, LIBRETIME_CONF_DIR . '/' . self::LIBRETIME_CONF_FILE_NAME)
&& unlink(AIRTIME_CONF_TEMP_PATH);
}
@ -105,8 +107,8 @@ class MediaSetup extends Setup {
* @return boolean false if either of the copy or removal operations fail
*/
function moveRmqConfig() {
return copy(RMQ_INI_TEMP_PATH, self::RMQ_INI_BASE_PATH . self::RMQ_INI_FILE_NAME)
&& copy(RMQ_INI_TEMP_PATH, self::RMQ_INI_BASE_PATH . "production/" . self::RMQ_INI_FILE_NAME)
return copy(RMQ_INI_TEMP_PATH, LIBRETIME_CONF_DIR . '/' . self::RMQ_INI_FILE_NAME)
&& copy(RMQ_INI_TEMP_PATH, LIBRETIME_CONF_DIR . '/production/' . self::RMQ_INI_FILE_NAME)
&& unlink(RMQ_INI_TEMP_PATH);
}