diff --git a/.gitignore b/.gitignore index bc3c72ed9..c3b9f8c91 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .* *.pyc +*~ diff --git a/README b/README index a4be320b3..483367e88 100644 --- a/README +++ b/README @@ -42,15 +42,18 @@ For an interactive installation, run: The installer will then prompt you about how you want to set up your Airtime installation. -For a simple full installation (setting up apache and postgres configurations and users for you), run +For a simple full installation (do this if you're installing Airtime from scratch and don't have any of your own +configuration set up), run - sudo ./install -fap + sudo ./install -fiapd What this means: -f - force; non-interactive (no prompts) + -i - install the default Icecast 2 setup for Airtime -a - install the default apache setup for Airtime -p - create a default Airtime postgres user + -d - install binary dependencies needed for Airtime This will install all components necessary for Airtime, and set up /usr/share/airtime as your web root (where apache looks for your Airtime files). diff --git a/airtime_mvc/application/configs/config-check.php b/airtime_mvc/application/configs/config-check.php index fe2d24de9..58176f355 100644 --- a/airtime_mvc/application/configs/config-check.php +++ b/airtime_mvc/application/configs/config-check.php @@ -109,7 +109,7 @@ $result = $r && $database; ?>"> Make sure you aren't missing any of the Postgres dependencies in the table above. If your dependencies check out, make sure your database configuration settings in - airtime.conf are correct and the Airtime database was installed correctly. + /etc/airtime.conf are correct and the Airtime database was installed correctly. @@ -143,8 +143,14 @@ $result = $r && $database;

diff --git a/airtime_mvc/build/airtime-setup/forms/finish-settings.php b/airtime_mvc/build/airtime-setup/forms/finish-settings.php index bf98c954e..549cb9472 100644 --- a/airtime_mvc/build/airtime-setup/forms/finish-settings.php +++ b/airtime_mvc/build/airtime-setup/forms/finish-settings.php @@ -2,7 +2,7 @@ ?>
-

Media Settings

+

Setup Complete!

Looks like you're almost done! Click "Done!" to bring up the Airtime configuration checklist; if diff --git a/airtime_mvc/build/airtime.example.conf b/airtime_mvc/build/airtime.example.conf index 090f4103d..cb1a71930 100644 --- a/airtime_mvc/build/airtime.example.conf +++ b/airtime_mvc/build/airtime.example.conf @@ -10,6 +10,44 @@ # ---------------------------------------------------------------------- +# ---------------------------------------------------------------------- +# G E N E R A L S E T T I N G S +# ---------------------------------------------------------------------- +# +# These settings are used for Airtime's webserver configuration, and +# for general-purpose properties. +# +# api_key: The API key for your Airtime installation. +# The value is generated the first time you use Airtime. +# +# web_server_user: The default webserver user. +# The default is www-data. +# +# base_url: The host name for your webserver. +# The default is localhost. +# +# base_port: The port for your webserver. +# The default is 80. +# +# base_dir: The root directory for your Airtime installation +# on your webserver, relative to the base_url. +# The default is /. +# +# cache_ahead_hours: How many hours ahead of time the Airtime playout +# engine (PYPO) should cache scheduled media files. +# The default is 1. +# +[general] +api_key = +web_server_user = www-data +base_url = localhost +base_port = 80 +base_dir = / +cache_ahead_hours = 1 +# +# ---------------------------------------------------------------------- + + # ---------------------------------------------------------------------- # D A T A B A S E # ---------------------------------------------------------------------- @@ -69,44 +107,6 @@ vhost = /airtime # ---------------------------------------------------------------------- -# ---------------------------------------------------------------------- -# G E N E R A L S E T T I N G S -# ---------------------------------------------------------------------- -# -# These settings are used for Airtime's webserver configuration, and -# for general-purpose properties. -# -# api_key: The API key for your Airtime installation. -# The value is generated the first time you use Airtime. -# -# web_server_user: The default webserver user. -# The default is www-data. -# -# base_url: The host name for your webserver. -# The default is localhost. -# -# base_port: The port for your webserver. -# The default is 80. -# -# base_dir: The root directory for your Airtime installation -# on your webserver, relative to the base_url. -# The default is /. -# -# cache_ahead_hours: How many hours ahead of time the Airtime playout -# engine (PYPO) should cache scheduled media files. -# The default is 1. -# -[general] -api_key = -web_server_user = www-data -base_url = localhost -base_port = 80 -base_dir = / -cache_ahead_hours = 1 -# -# ---------------------------------------------------------------------- - - # ---------------------------------------------------------------------- # M O N I T # ---------------------------------------------------------------------- @@ -124,6 +124,47 @@ monit_password = airtime # ---------------------------------------------------------------------- +# ---------------------------------------------------------------------- +# M E D I A M O N I T O R +# ---------------------------------------------------------------------- +# +# api_client: ??? +# +# bin_dir: Directory containing media monitor binaries +# +# log_dir: Directory containing media monitor log files +# +# check_filesystem_events: How long to queue up events performed on the +# files themselves +# +# check_airtime_events: How long to queue metadata input from airtime +# +# touch_interval +# +# chunking_number +# +# request_max_wait +# +# rmq_event_wait +# +# logpath +# +# index_path +# +[media-monitor] +api_client = "airtime" +check_filesystem_events = 5 +check_airtime_events = 30 +touch_interval = 5 +chunking_number = 450 +request_max_wait = 3.0 +rmq_event_wait = 0.1 +logpath = '/var/log/airtime/media-monitor/media-monitor.log' +index_path = '/var/tmp/airtime/media-monitor/last_index' +# +# ---------------------------------------------------------------------- + + # ---------------------------------------------------------------------- # S O U N D C L O U D # ---------------------------------------------------------------------- diff --git a/airtime_mvc/public/css/setup/config-check.css b/airtime_mvc/public/css/setup/config-check.css index 6967f1165..31983f4b1 100644 --- a/airtime_mvc/public/css/setup/config-check.css +++ b/airtime_mvc/public/css/setup/config-check.css @@ -18,12 +18,13 @@ body { .table { padding: 0; - margin: 3em 0 0 0; + margin: 1em 0 0 0; } .checklist { overflow: auto; height: 50%; + min-height: 200px; } .caption { @@ -40,7 +41,7 @@ body { } .check { - background: #dff0d8 url("css/images/accept.png") no-repeat center; + background: #dff0d8 url("../images/accept.png") no-repeat center; } .footer { diff --git a/airtime_mvc/public/css/setup/setup-config.css b/airtime_mvc/public/css/setup/setup-config.css index b2dd4844f..69870ede4 100644 --- a/airtime_mvc/public/css/setup/setup-config.css +++ b/airtime_mvc/public/css/setup/setup-config.css @@ -143,7 +143,7 @@ form .form-group { * Button Styles * * ############################################################################ */ - + .btn-primary { font-weight: bold; } diff --git a/airtime_mvc/public/js/setup/setup-config.js b/airtime_mvc/public/js/setup/setup-config.js index 255beb93c..5ffae047c 100644 --- a/airtime_mvc/public/js/setup/setup-config.js +++ b/airtime_mvc/public/js/setup/setup-config.js @@ -78,11 +78,15 @@ function removeOverlay() { } function formSlide(dir) { - var delta = (dir == "next") ? "-=100%" : "+=100%"; - $(".btn").attr("disabled", "disabled"); - $(".form-slider").animate({left: delta}, 500, function() { - $(".btn").removeAttr("disabled"); - }); + var delta = (dir == "next") ? "-=100%" : "+=100%", + parent = $(this).parents("div.form-wrapper"), + toForm = (dir == "next") ? parent.next() : parent.prev(); + + parent.find(".btn").attr("disabled", "disabled"); + toForm.find(".btn").removeAttr("disabled"); + toForm.find(":input :first").focus(); + + $(".form-slider").animate({left: delta}, 500); var stepCount = $("#stepCount"), steps = parseInt(stepCount.html()); stepCount.html((dir == "next") ? (steps + 1) : (steps - 1)); @@ -93,14 +97,14 @@ function formSlide(dir) { * Fade out the previous setup step and fade in the next one */ function nextSlide() { - formSlide("next"); + formSlide.call($(this), "next"); } /** * Fade out the current setup step and fade in the previous one */ function prevSlide() { - formSlide("prev"); + formSlide.call($(this), "prev"); } /** @@ -118,7 +122,7 @@ function submitForm(e, obj) { var d = $(e.target).serializeArray(); addOverlay(); // Append .promise().done() rather than using a - // callback to avoid weird alert duplication + // callback to avoid call duplication $("#overlay, #loadingImage").fadeIn(500).promise().done(function() { // Proxy function for passing the event to the cleanup function var cleanupProxy = function(data) { @@ -131,6 +135,8 @@ function submitForm(e, obj) { $(function() { // Stop the user from dragging the slider $(".form-slider").draggable('disable'); + $(".btn").attr("disabled", "disabled"); + $("form:first .btn").removeAttr("disabled"); window.onresize = function() { var headerHeight = $(".header").outerHeight(), diff --git a/airtime_mvc/public/setup/finish-setup.php b/airtime_mvc/public/setup/finish-setup.php index a79b5bf4b..3d35fee7b 100644 --- a/airtime_mvc/public/setup/finish-setup.php +++ b/airtime_mvc/public/setup/finish-setup.php @@ -9,6 +9,8 @@ * Wrapper class for finalizing and moving airtime.conf */ class FinishSetup extends Setup { + + const AIRTIME_CONF_PATH = "/etc/airtime/airtime.conf"; function __construct($settings) { } @@ -17,7 +19,7 @@ class FinishSetup extends Setup { $message = null; $errors = array(); - if ($this->checkAirtimeConfigDirectory()) { + if (file_exists("/etc/airtime/")) { if (!$this->moveAirtimeConfig()) { $message = "Error moving airtime.conf or deleting /tmp/airtime.conf.temp!"; $errors[] = "ERR"; @@ -26,20 +28,31 @@ class FinishSetup extends Setup { $message = "Failed to move airtime.conf; /etc/airtime doesn't exist!"; $errors[] = "ERR"; } - + + if (empty($errors)) { + // Write service configurations for pypo and media-monitor + $this->startServices(); + } + return array( "message" => $message, "errors" => $errors, ); } - - function checkAirtimeConfigDirectory() { - return file_exists("/etc/airtime/"); - } - + + /** + * Moves /tmp/airtime.conf.temp to /etc/airtime.conf and then removes it to complete setup + * @return boolean false if either of the copy or removal operations fail + */ function moveAirtimeConfig() { - return copy(AIRTIME_CONF_TEMP_PATH, "/etc/airtime/airtime.conf") + return copy(AIRTIME_CONF_TEMP_PATH, self::AIRTIME_CONF_PATH) && unlink(AIRTIME_CONF_TEMP_PATH); } + + function startServices() { + exec("service airtime-media-monitor start-with-monit"); + exec("service airtime-playout start-with-monit"); + exec("service airtime-liquidsoap start-with-monit"); + } } \ No newline at end of file diff --git a/dev_tools/compare_cc_files_to_fs.py b/dev_tools/compare_cc_files_to_fs.py index 3f35fc033..fe842332b 100644 --- a/dev_tools/compare_cc_files_to_fs.py +++ b/dev_tools/compare_cc_files_to_fs.py @@ -25,7 +25,7 @@ class AirtimeMediaMonitorBootstrap(): api_clients -- reference of api_clients to communicate with airtime-server """ def __init__(self): - config = ConfigObj('/etc/airtime/media-monitor.cfg') + config = ConfigObj('/etc/airtime/airtime.conf') self.api_client = apc.api_client_factory(config) """ diff --git a/installer/install b/installer/install index 92a901181..c2db7eae5 100755 --- a/installer/install +++ b/installer/install @@ -32,17 +32,17 @@ showhelp () { If no directory or an empty string is given, this defaults to an in-place installation, and will give the web user permissions on the current Airtime root - -i, --in-place + -I, --in-place Set the current Airtime root as the working directory for Airtime Note that you will need to give your web user permissions on these directories - -p, --postgres-init + -p, --postgres Create a default postgres user named 'airtime' with password 'airtime' -a, --apache Install apache and deploy a basic configuration for Airtime - -c, --icecast + -i, --icecast Install Icecast 2 and deploy a basic configuration for Airtime" exit 0 } @@ -114,7 +114,7 @@ while :; do --icecast) icecast="t" ;; - --postgres-init) + --postgres) postgres="t" ;; --in-place) @@ -182,13 +182,13 @@ while :; do a) apache="t" ;; - c) + i) icecast="t" ;; p) postgres="t" ;; - i) + I) in_place="t" ;; w) @@ -210,7 +210,7 @@ while :; do fi ;; *) - echo "$0: error - unrecognized option $1" >&2; + echo "$0: error - unrecognized option '${1:$i:1}'" >&2; echo "Try 'install --help' for more information." exit 1 esac @@ -237,18 +237,6 @@ echo "/ | \ || | \ | | | / Y \| \ " echo "\____|__ /___||____|_ / |____| |___\____|__ /_______ / " echo -e " \/ \/ \/ \/ \n" -# echo " ____ ______ ____ ____ __________ __ _________ ____ ____ " -# echo " / _ \\\\____ \_/ __ \ / \ / ___/ _ \| | \_ __ \_/ ___\/ __ \ " -# echo "( <_> ) |_> > ___/| | \ \___ ( <_> ) | /| | \/\ \__\ ___/ " -# echo " \____/| __/ \___ >___| / /____ >____/|____/ |__| \___ >___ > " -# echo " |__| \/ \/ \/ \/ \/ " -# echo " .___.__ __ __ .__ " -# echo "____________ __| _/|__| ____ _____ __ ___/ |_ ____ _____ _____ _/ |_|__| ____ ____ " -# echo "\_ __ \__ \ / __ | | |/ _ \ \__ \ | | \ __\/ _ \ / \\\\__ \\\\ __\ |/ _ \ / \ " -# echo " | | \// __ \_/ /_/ | | ( <_> ) / __ \| | /| | ( <_> ) Y Y \/ __ \| | | ( <_> ) | \ " -# echo " |__| (____ /\____ | |__|\____/ (____ /____/ |__| \____/|__|_| (____ /__| |__|\____/|___| / " -# echo -e " \/ \/ \/ \/ \/ \/ \n" - if [ "$apache" = "f" -a ${_i} -eq 1 ]; then echo -e "Install default Airtime apache configuration? (Y/n): \c" read IN @@ -304,6 +292,14 @@ if [ "$apache" = "t" ]; then fi fi +if [ "$icecast" = "f" -a ${_i} -eq 1 ]; then + echo -e "Install default Airtime Icecast configuration? (Y/n): \c" + read IN + if [ "$IN" = "y" -o "$IN" = "Y" ]; then + icecast="t" + fi +fi + if [ "$icecast" = "t" ]; then loud "\n-----------------------------------------------------" loud " * Installing Icecast * " @@ -318,6 +314,49 @@ if [ "$icecast" = "t" ]; then set -e fi +loud "\n-----------------------------------------------------" +loud " * Installing Python Apps * " +loud "-----------------------------------------------------" + +verbose "\n * Installing virtualenv..." +loudCmd "$AIRTIMEROOT/python_apps/python-virtualenv/virtualenv-install.sh" + +verbose "\n * Installing liquidsoap..." +loudCmd "apt-get -y --force-yes install liquidsoap" + +# ------------ Activate virtualenv ------------ +virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/" +. ${virtualenv_bin}activate + +verbose "\n * Installing API client..." +cp -R ${AIRTIMEROOT}/python_apps/api_clients /usr/lib/airtime/api_clients + +verbose "\n * Copying media-monitor files..." +cp -R ${AIRTIMEROOT}/python_apps/media-monitor /usr/lib/airtime/media-monitor +cp -R ${AIRTIMEROOT}/python_apps/media-monitor2 /usr/lib/airtime/media-monitor/mm2 + +sed -e "s@WEB_USER@${web_user}@g" /usr/lib/airtime/media-monitor/airtime-media-monitor-init-d > /etc/init.d/airtime-media-monitor +touch /etc/sudoers.d/airtime-media-monitor_${web_user} +echo "${web_user} ALL = (root) NOPASSWD: /sbin/start airtime-media-monitor, \ + /sbin/stop airtime-media-monitor, \ + /sbin/restart airtime-media-monitor, \ + /sbin/status airtime-media-monitor" > /etc/sudoers.d/airtime-media-monitor_${web_user} + +verbose "\n * Copying pypo files..." +python $AIRTIMEROOT/python_apps/pypo/install/pypo-copy-files.py + +verbose "\n * Initializing media monitor..." +python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-initialize.py + +verbose "\n * Initializing pypo..." +python $AIRTIMEROOT/python_apps/pypo/install/pypo-initialize.py + +loudCmd "service airtime-media-monitor restart 2>/dev/null" +loudCmd "service airtime-playout restart 2>/dev/null" + +deactivate +# ------------ Deactivate virtualenv ------------ + if [ ! -d /var/log/airtime ]; then loud "\n-----------------------------------------------------" loud " * Installing Log Files * " @@ -325,9 +364,9 @@ if [ ! -d /var/log/airtime ]; then verbose "\n * Creating /var/log/airtime..." mkdir -p /var/log/airtime - chmod a+x /var/log/airtime - chown ${web_user}:${web_user} /var/log/airtime/ - + mkdir -p /var/log/airtime/media-monitor + chmod -R a+x /var/log/airtime + chown -R ${web_user}:${web_user} /var/log/airtime/ cp ${AIRTIMEROOT}/airtime_mvc/build/airtime-php.logrotate /etc/logrotate.d/airtime-php fi @@ -367,7 +406,9 @@ loudCmd "apt-get -y --force-yes install postgresql php5-pgsql" setupAirtimePostgresUser() { # here-doc to execute this block as postgres user su postgres <<'EOF' + set +e psql -d postgres -tAc "CREATE USER airtime WITH ENCRYPTED PASSWORD 'airtime'; ALTER USER airtime CREATEDB;" + set -e # don't indent this! EOF } @@ -419,12 +460,20 @@ if [ ! -d "/etc/airtime" ]; then verbose "\n * Creating /etc/airtime/ directory..." mkdir /etc/airtime - chown -R ${web_user}:${web_user} /srv/airtime chown -R ${web_user}:${web_user} /etc/airtime fi if [ ! -d "/srv/airtime" ]; then mkdir -p /srv/airtime + chown -R ${web_user}:${web_user} /srv/airtime +fi + +if [ "$install_dependencies" = "f" -a ${_i} -eq 1 ]; then + echo -e "Install external binary dependencies? (Y/n): \c" + read IN + if [ "$IN" = "y" -o "$IN" = "Y" ]; then + install_dependencies="t" + fi fi if [ "$install_dependencies" = "t" ]; then @@ -434,7 +483,7 @@ if [ "$install_dependencies" = "t" ]; then verbose "\n * Reading requirements-${dist,,}-${code,,}.apt..." - loudCmd "apt-get -y --force-yes install $(grep -vE \"^\s*#\" \"bin/requirements-${dist,,}-${code,,}.apt\" | tr \"\n\" \" \")" + loudCmd "apt-get -y --force-yes install $(grep -vE '^\s*#' bin/requirements-${dist,,}-${code,,}.apt | tr '\n' ' ')" fi verbose "\n * Restarting apache..." diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py index 6c12e6fb6..6aaa0a7d0 100644 --- a/python_apps/api_clients/api_client.py +++ b/python_apps/api_clients/api_client.py @@ -83,6 +83,8 @@ api_config['push_stream_stats'] = 'push-stream-stats/api_key/%%api_key%%/format/ api_config['update_stream_setting_table'] = 'update-stream-setting-table/api_key/%%api_key%%/format/json' api_config['get_files_without_silan_value'] = 'get-files-without-silan-value/api_key/%%api_key%%' api_config['update_cue_values_by_silan'] = 'update-cue-values-by-silan/api_key/%%api_key%%' +api_config['api_base'] = 'api' +api_config['bin_dir'] = '/usr/lib/airtime/api_clients' @@ -203,7 +205,7 @@ class RequestProvider(object): class AirtimeApiClient(object): - def __init__(self, logger=None,config_path='/etc/airtime/api_client.cfg'): + def __init__(self, logger=None,config_path='/etc/airtime/airtime.conf'): if logger is None: self.logger = logging else: self.logger = logger diff --git a/python_apps/media-monitor/airtime-media-monitor-init-d b/python_apps/media-monitor/airtime-media-monitor-init-d index d059e9389..f1fb319de 100755 --- a/python_apps/media-monitor/airtime-media-monitor-init-d +++ b/python_apps/media-monitor/airtime-media-monitor-init-d @@ -9,8 +9,8 @@ # Short-Description: Manage airtime-media-monitor daemon ### END INIT INFO -USERID=root -GROUPID=www-data +USERID=WEB_USER +GROUPID=WEB_USER NAME=Airtime\ Media\ Monitor DAEMON=/usr/lib/airtime/media-monitor/airtime-media-monitor diff --git a/python_apps/media-monitor/airtimefilemonitor/mediaconfig.py b/python_apps/media-monitor/airtimefilemonitor/mediaconfig.py index f51b23506..5f3865829 100644 --- a/python_apps/media-monitor/airtimefilemonitor/mediaconfig.py +++ b/python_apps/media-monitor/airtimefilemonitor/mediaconfig.py @@ -16,7 +16,7 @@ class AirtimeMediaConfig: # loading config file try: - config = ConfigObj('/etc/airtime/media-monitor.cfg') + config = ConfigObj('/etc/airtime/airtime.conf') self.cfg = config except Exception, e: logger.info('Error loading config: ', e) diff --git a/python_apps/media-monitor/install/media-monitor-copy-files.py b/python_apps/media-monitor/install/media-monitor-copy-files.py index 073f09dad..0d149c67e 100644 --- a/python_apps/media-monitor/install/media-monitor-copy-files.py +++ b/python_apps/media-monitor/install/media-monitor-copy-files.py @@ -44,17 +44,13 @@ try: # load config file try: config = ConfigObj(PATH_INI_FILE) - config['rabbitmq_user'] = os.environ['RABBITMQ_USER'] - config['rabbitmq_password'] = os.environ['RABBITMQ_PASSWORD'] - config['rabbitmq_vhost'] = os.environ['RABBITMQ_VHOST'] - config.write() except Exception, e: print 'Error loading config file: ', e sys.exit(1) #copy monit files shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/') - subprocess.call('sed -i "s/\$admin_pass/%s/g" /etc/monit/conf.d/monit-airtime-generic.cfg' % get_rand_string(), shell=True) + subprocess.call('sed -i "s/\$admin_pass/%s/g" /etc/monit/conf.d/monit-airtime-generic.cfg' % get_rand_string(), shell=True, close_fds=True) shutil.copy('%s/../monit-airtime-media-monitor.cfg'%current_script_dir, '/etc/monit/conf.d/') #create log dir diff --git a/python_apps/media-monitor/media_monitor.py b/python_apps/media-monitor/media_monitor.py index d41bbac93..aabc2e6f5 100644 --- a/python_apps/media-monitor/media_monitor.py +++ b/python_apps/media-monitor/media_monitor.py @@ -4,8 +4,7 @@ import sys import mm2.mm2 as mm2 from std_err_override import LogWriter -global_cfg = '/etc/airtime/media-monitor.cfg' -api_client_cfg = '/etc/airtime/api_client.cfg' +global_cfg = '/etc/airtime/airtime.conf' logging_cfg = '/usr/lib/airtime/media-monitor/logging.cfg' -mm2.main( global_cfg, api_client_cfg, logging_cfg ) +mm2.main( global_cfg, logging_cfg ) diff --git a/python_apps/media-monitor2/media/saas/launcher.py b/python_apps/media-monitor2/media/saas/launcher.py index c561464e3..24a483ade 100644 --- a/python_apps/media-monitor2/media/saas/launcher.py +++ b/python_apps/media-monitor2/media/saas/launcher.py @@ -97,9 +97,9 @@ class MM2(InstanceThread, Loggable): manager.loop() -def launch_instance(name, root, global_cfg, apc_cfg): +def launch_instance(name, root, global_cfg): cfg = { - 'api_client' : apc_cfg, + 'api_client' : global_cfg, 'media_monitor' : global_cfg, } ai = AirtimeInstance(name, root, cfg) diff --git a/python_apps/media-monitor2/mm2.py b/python_apps/media-monitor2/mm2.py index 7c447c060..37b7b9e54 100644 --- a/python_apps/media-monitor2/mm2.py +++ b/python_apps/media-monitor2/mm2.py @@ -4,12 +4,12 @@ import os from media.saas.launcher import setup_global, launch_instance, setup_logger from media.monitor.config import MMConfig -def main(global_config, api_client_config, log_config): +def main(global_config, log_config): """ function to run hosted install """ mm_config = MMConfig(global_config) log = setup_logger( log_config, mm_config['logpath'] ) setup_global(log) - launch_instance('hosted_install', '/', global_config, api_client_config) + launch_instance('hosted_install', '/', global_config) __doc__ = """ Usage: diff --git a/python_apps/media-monitor2/tests/prepare_tests.py b/python_apps/media-monitor2/tests/prepare_tests.py index ebbce89b8..e145c9fa5 100644 --- a/python_apps/media-monitor2/tests/prepare_tests.py +++ b/python_apps/media-monitor2/tests/prepare_tests.py @@ -8,7 +8,7 @@ real_path1 = u'/home/rudi/throwaway/watch/unknown/unknown/ACDC_-_Back_In_Black-s opath = u"/home/rudi/Airtime/python_apps/media-monitor2/tests/" ppath = u"/home/rudi/Airtime/python_apps/media-monitor2/media/" -api_client_path = '/etc/airtime/api_client.cfg' +api_client_path = '/etc/airtime/airtime.conf' # holdover from the time we had a special config for testing sample_config = api_client_path real_config = api_client_path diff --git a/python_apps/pypo/install/pypo-copy-files.py b/python_apps/pypo/install/pypo-copy-files.py index f3e1a428d..8009c6a8d 100644 --- a/python_apps/pypo/install/pypo-copy-files.py +++ b/python_apps/pypo/install/pypo-copy-files.py @@ -81,17 +81,13 @@ try: # load config file try: config = ConfigObj(PATH_INI_FILE) - config['rabbitmq_user'] = os.environ['RABBITMQ_USER'] - config['rabbitmq_password'] = os.environ['RABBITMQ_PASSWORD'] - config['rabbitmq_vhost'] = os.environ['RABBITMQ_VHOST'] - config.write() except Exception, e: print 'Error loading config file: ', e sys.exit(1) #copy monit files shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/') - subprocess.call('sed -i "s/\$admin_pass/%s/g" /etc/monit/conf.d/monit-airtime-generic.cfg' % get_rand_string(), shell=True) + subprocess.call('sed -i "s/\$admin_pass/%s/g" /etc/monit/conf.d/monit-airtime-generic.cfg' % get_rand_string(), shell=True, close_fds=True) monit_version = get_monit_version() if version_compare(monit_version, "5.3.0") >= 0: diff --git a/python_apps/pypo/liquidsoap_scripts/liquidsoap_prepare_terminate.py b/python_apps/pypo/liquidsoap_scripts/liquidsoap_prepare_terminate.py index 2f632d9c7..4a2ddc08a 100644 --- a/python_apps/pypo/liquidsoap_scripts/liquidsoap_prepare_terminate.py +++ b/python_apps/pypo/liquidsoap_scripts/liquidsoap_prepare_terminate.py @@ -14,6 +14,6 @@ try: tn.read_all() except Exception, e: - print('Error loading config file: %s', e) + print 'Error loading config file: %s' % e sys.exit() diff --git a/utils/airtime-import/airtime-import.py b/utils/airtime-import/airtime-import.py index 97d4c4e35..0aba7d209 100644 --- a/utils/airtime-import/airtime-import.py +++ b/utils/airtime-import/airtime-import.py @@ -27,7 +27,7 @@ if (os.geteuid() != 0): # loading config file try: - config = ConfigObj('/etc/airtime/media-monitor.cfg') + config = ConfigObj('/etc/airtime/airtime.conf') except Exception, e: print('Error loading config file: %s', e) sys.exit() diff --git a/utils/airtime-silan.py b/utils/airtime-silan.py index d434d2ddb..0cc0d7f8b 100644 --- a/utils/airtime-silan.py +++ b/utils/airtime-silan.py @@ -24,7 +24,7 @@ if os.geteuid() != 0: # loading config file try: - config = ConfigObj('/etc/airtime/media-monitor.cfg') + config = ConfigObj('/etc/airtime/airtime.conf') except Exception, e: print('Error loading config file: %s', e) sys.exit(1)