CC-3791: Media Monitor crash when there are media files with non-ascii name in watched folder
-move utf-8 locale check to bash
This commit is contained in:
parent
c1d33e9f72
commit
c397a6f797
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/bin/bash -e
|
||||
|
||||
# Location of pypo_cli.py Python script
|
||||
|
||||
|
@ -14,6 +14,14 @@ cd ${media_monitor_path}
|
|||
|
||||
exec 2>&1
|
||||
|
||||
set +e
|
||||
cat /etc/default/locale | grep -i "LANG=.*UTF-\?8"
|
||||
set -e
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "non UTF-8 default locale found in /etc/default/locale." > /var/log/airtime/pypo/error.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export PYTHONPATH=${api_client_path}
|
||||
export LC_ALL=`cat /etc/default/locale | grep "LANG=" | cut -d= -f2 | tr -d "\n\""`
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import os
|
|||
import signal
|
||||
import traceback
|
||||
import locale
|
||||
import re
|
||||
|
||||
from configobj import ConfigObj
|
||||
|
||||
|
@ -48,12 +47,7 @@ def configure_locale():
|
|||
else:
|
||||
new_locale = default_locale
|
||||
|
||||
test = re.compile(r"UTF-?8", re.IGNORECASE)
|
||||
if test.findall(new_locale):
|
||||
logger.info("New locale set to: %s", locale.setlocale(locale.LC_ALL, new_locale))
|
||||
else:
|
||||
logger.info("Invalid locale %s", new_locale)
|
||||
sys.exit(1)
|
||||
logger.info("New locale set to: %s", locale.setlocale(locale.LC_ALL, new_locale))
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/bin/bash -e
|
||||
|
||||
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
||||
. ${virtualenv_bin}activate
|
||||
|
@ -12,6 +12,14 @@ pypo_script="pypocli.py"
|
|||
cd ${pypo_path}
|
||||
exec 2>&1
|
||||
|
||||
set +e
|
||||
cat /etc/default/locale | grep -i "LANG=.*UTF-\?8"
|
||||
set -e
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "non UTF-8 default locale found in /etc/default/locale." > /var/log/airtime/pypo/error.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export HOME="/var/tmp/airtime/pypo/"
|
||||
export PYTHONPATH=${api_client_path}:$PYTHONPATH
|
||||
export LC_ALL=`cat /etc/default/locale | grep "LANG=" | cut -d= -f2 | tr -d "\n\""`
|
||||
|
|
|
@ -11,7 +11,6 @@ import logging.config
|
|||
import logging.handlers
|
||||
import locale
|
||||
import os
|
||||
import re
|
||||
from Queue import Queue
|
||||
|
||||
from threading import Lock
|
||||
|
@ -71,12 +70,7 @@ def configure_locale():
|
|||
else:
|
||||
new_locale = default_locale
|
||||
|
||||
test = re.compile(r"UTF-?8", re.IGNORECASE)
|
||||
if test.findall(new_locale):
|
||||
logger.info("New locale set to: %s", locale.setlocale(locale.LC_ALL, new_locale))
|
||||
else:
|
||||
logger.info("Invalid locale %s", new_locale)
|
||||
sys.exit(1)
|
||||
logger.info("New locale set to: %s", locale.setlocale(locale.LC_ALL, new_locale))
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue