kopia lustrzana https://github.com/kartoza/docker-osm
fix overwrite env vars in python script
rodzic
a65dbdb785
commit
c5cfb679a0
|
@ -48,8 +48,8 @@ default = {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if we overwrite default values.
|
# Check if we overwrite default values.
|
||||||
for key in default.keys():
|
for key in environ.keys():
|
||||||
if key in environ:
|
if key in default.keys():
|
||||||
default[key] = environ[key]
|
default[key] = environ[key]
|
||||||
|
|
||||||
# Check valid SRID.
|
# Check valid SRID.
|
||||||
|
|
|
@ -27,10 +27,6 @@ from datetime import datetime
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from sys import stderr
|
from sys import stderr
|
||||||
|
|
||||||
# In docker-compose, we should wait for the DB is ready.
|
|
||||||
print 'The container will start soon, after the database.'
|
|
||||||
sleep(45)
|
|
||||||
|
|
||||||
# Default values which can be overwritten.
|
# Default values which can be overwritten.
|
||||||
default = {
|
default = {
|
||||||
'MAX_DAYS': '100',
|
'MAX_DAYS': '100',
|
||||||
|
@ -44,8 +40,8 @@ default = {
|
||||||
'TIME': 120,
|
'TIME': 120,
|
||||||
}
|
}
|
||||||
|
|
||||||
for key in default.keys():
|
for key in environ.keys():
|
||||||
if key in environ:
|
if key in default.keys():
|
||||||
default[key] = environ[key]
|
default[key] = environ[key]
|
||||||
|
|
||||||
# Folders
|
# Folders
|
||||||
|
@ -94,19 +90,23 @@ if not poly_file:
|
||||||
else:
|
else:
|
||||||
print '%s detected for clipping.' % poly_file
|
print '%s detected for clipping.' % poly_file
|
||||||
|
|
||||||
|
# In docker-compose, we should wait for the DB is ready.
|
||||||
|
print 'The checkup is OK. The container will continue soon, after the database.'
|
||||||
|
sleep(45)
|
||||||
|
|
||||||
# Finally launch the listening process.
|
# Finally launch the listening process.
|
||||||
while True:
|
while True:
|
||||||
# Check if diff to be imported is empty. If not, take the latest diff.
|
# Check if diff to be imported is empty. If not, take the latest diff.
|
||||||
diff_to_be_imported = sorted(listdir(default['IMPORT_QUEUE']))
|
diff_to_be_imported = sorted(listdir(default['IMPORT_QUEUE']))
|
||||||
if len(diff_to_be_imported):
|
if len(diff_to_be_imported):
|
||||||
timestamp = diff_to_be_imported[-1].split('.')[0]
|
timestamp = diff_to_be_imported[-1].split('.')[0]
|
||||||
print "Timestamp from the latest not imported diff : %s" % timestamp
|
print 'Timestamp from the latest not imported diff : %s' % timestamp
|
||||||
else:
|
else:
|
||||||
# Check if imported diff is empty. If not, take the latest diff.
|
# Check if imported diff is empty. If not, take the latest diff.
|
||||||
imported_diff = sorted(listdir(default['IMPORT_DONE']))
|
imported_diff = sorted(listdir(default['IMPORT_DONE']))
|
||||||
if len(imported_diff):
|
if len(imported_diff):
|
||||||
print "Timestamp from the latest imported diff : %s" % timestamp
|
|
||||||
timestamp = imported_diff[-1].split('.')[0]
|
timestamp = imported_diff[-1].split('.')[0]
|
||||||
|
print 'Timestamp from the latest imported diff : %s' % timestamp
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Take the timestamp from original file.
|
# Take the timestamp from original file.
|
||||||
|
@ -118,7 +118,7 @@ while True:
|
||||||
state_file_settings[name] = value
|
state_file_settings[name] = value
|
||||||
|
|
||||||
timestamp = state_file_settings['timestamp'].strip()
|
timestamp = state_file_settings['timestamp'].strip()
|
||||||
print "Timestamp from the original state file : %s" % timestamp
|
print 'Timestamp from the original state file : %s' % timestamp
|
||||||
|
|
||||||
# Removing some \ in the timestamp.
|
# Removing some \ in the timestamp.
|
||||||
timestamp = timestamp.replace('\\', '')
|
timestamp = timestamp.replace('\\', '')
|
||||||
|
|
Ładowanie…
Reference in New Issue