kopia lustrzana https://github.com/kartoza/docker-osm
remove state file config
rodzic
5a61c1837d
commit
5e45e9c5c9
|
@ -70,13 +70,10 @@ for folder in folders:
|
|||
exit()
|
||||
|
||||
# Test files
|
||||
state_file = None
|
||||
osm_file = None
|
||||
mapping_file = None
|
||||
post_import_file = None
|
||||
for f in listdir(default['SETTINGS']):
|
||||
if f == 'last.state.txt':
|
||||
state_file = join(default['SETTINGS'], f)
|
||||
|
||||
if f.endswith('.pbf'):
|
||||
osm_file = join(default['SETTINGS'], f)
|
||||
|
@ -91,10 +88,6 @@ if not osm_file:
|
|||
print >> stderr, 'OSM file *.pbf is missing in %s' % default['SETTINGS']
|
||||
exit()
|
||||
|
||||
if not state_file:
|
||||
print >> stderr, 'State file last.state.txt is missing in %s' % default['SETTINGS']
|
||||
exit()
|
||||
|
||||
if not mapping_file:
|
||||
print >> stderr, 'Mapping file *.json is missing in %s' % default['SETTINGS']
|
||||
exit()
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
from os.path import exists, join, isabs, abspath
|
||||
from os import listdir, environ
|
||||
from sys import exit
|
||||
from subprocess import call
|
||||
from subprocess import call, Popen, PIPE
|
||||
from datetime import datetime
|
||||
from time import sleep
|
||||
from sys import stderr
|
||||
|
@ -57,11 +57,8 @@ for folder in folders:
|
|||
exit()
|
||||
|
||||
# Test files
|
||||
state_file = None
|
||||
osm_file = None
|
||||
for f in listdir(default['SETTINGS']):
|
||||
if f == 'last.state.txt':
|
||||
state_file = join(default['SETTINGS'], f)
|
||||
|
||||
if f.endswith('.pbf'):
|
||||
osm_file = join(default['SETTINGS'], f)
|
||||
|
@ -73,10 +70,6 @@ for f in listdir(default['SETTINGS']):
|
|||
default['BASE_URL'] = content_file.read()
|
||||
"""
|
||||
|
||||
if not state_file:
|
||||
print >> stderr, 'State file last.state.txt is missing in %s' % default['SETTINGS']
|
||||
exit()
|
||||
|
||||
if not osm_file:
|
||||
print >> stderr, 'OSM file *.osm.pbf is missing in %s' % default['SETTINGS']
|
||||
exit()
|
||||
|
@ -101,14 +94,13 @@ while True:
|
|||
|
||||
else:
|
||||
# Take the timestamp from original file.
|
||||
state_file_settings = {}
|
||||
with open(state_file) as a_file:
|
||||
for line in a_file:
|
||||
if '=' in line:
|
||||
name, value = line.partition("=")[::2]
|
||||
state_file_settings[name] = value
|
||||
command = ['osmconvert', osm_file, '--out-timestamp']
|
||||
processus = Popen(command, stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
||||
timestamp, err = processus.communicate()
|
||||
|
||||
# Remove new line
|
||||
timestamp = timestamp.strip()
|
||||
|
||||
timestamp = state_file_settings['timestamp'].strip()
|
||||
print 'Timestamp from the original state file : %s' % timestamp
|
||||
|
||||
# Removing some \ in the timestamp.
|
||||
|
|
Ładowanie…
Reference in New Issue