log('The configuration file for EnvSetup script does not exist.\nPath of configuration file: %s'%path,error=True)
ifmandatory:
ifis_default:
sys.exit(1)
# Load conf
withopen(path,'r')asfo:
...
...
@@ -61,18 +63,22 @@ def load_conf():
name=name.strip('\t\'\"')
val=('='.join(val)).strip('\t\'\"')
CONF[name]=val
# Check a value to know if the config file has been changed
try:
value=getattr(CONF,'MS_SERVER_NAME')
exceptExceptionase:
log('The configuration file for EnvSetup script is missing a required value: MS_SERVER_NAME.\nPlease check that the configuration file is correct.\nPath of configuration file: %s\nError:\n %s'%(CONF_PATH,e))
sys.exit(1)
ifvalue=='mediaserver':
log('\033[93mWarning:\033[0m')
log('The configuration file for EnvSetup script contains the default value for MS_SERVER_NAME.')
log('Perhaps you forget to change the configuration.')
log('Path of configuration file: %s'%CONF_PATH)
log('Perhaps you want to quit this script to change the configuration?\n')
ifis_default:
status[name]=dict(value=val,using_default=True)
else:
only_default=False
ifnamenotinstatus:
status[name]=dict()
status[name]['value']=val
status[name]['using_default']=False
CONF['_config_status']=status
# Check a value to know if the config file has been changed
ifonly_default:
log('\033[93mWarning:\033[0m')
log('The configuration is using only default values.')
log('Perhaps you forget to change the configuration.')
log('Path of configuration file: %s'%CONF_PATH)
log('Perhaps you want to quit this script to change the configuration?\n')