X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/c249fadcc5ce27698d1f11fe5ec4a1c299786b3c..0aaea8096fcdd565f0f1990a84ad68e9aeb90113:/cookbooks/planet/files/default/replication-bin/replicate-changesets diff --git a/cookbooks/planet/files/default/replication-bin/replicate-changesets b/cookbooks/planet/files/default/replication-bin/replicate-changesets index cbf34515b..29131b2ed 100755 --- a/cookbooks/planet/files/default/replication-bin/replicate-changesets +++ b/cookbooks/planet/files/default/replication-bin/replicate-changesets @@ -143,7 +143,7 @@ class Replicator def initialize(config) @config = YAML.safe_load(File.read(config)) @state = YAML.safe_load(File.read(@config["state_file"]), [Time]) - @conn = PGconn.connect(@config["db"]) + @conn = PG::Connection.connect(@config["db"]) # get current time from the database rather than the current system @now = @conn.exec("select now() as now").map { |row| Time.parse(row["now"]) }[0] end @@ -188,7 +188,7 @@ class Replicator "generator" => "replicate_changesets.rb", "copyright" => "OpenStreetMap and contributors", "attribution" => "https://www.openstreetmap.org/copyright", - "license" => "http://opendatacommons.org/licenses/odbl/1-0/" } + "license" => "https://opendatacommons.org/licenses/odbl/1-0/" } .each { |k, v| doc.root[k] = v } builder = ChangesetBuilder.new(@now, @conn) @@ -278,7 +278,7 @@ class Replicator fl.flock(File::LOCK_UN) rescue StandardError - STDERR.puts("Error! Couldn't update state.") + warn "Error! Couldn't update state." fl.flock(File::LOCK_UN) raise end @@ -290,6 +290,6 @@ begin rep = Replicator.new(ARGV[0]) rep.save! rescue StandardError => e - STDERR.puts "ERROR: #{e.message}" + warn "ERROR: #{e.message}" exit 1 end