]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/planet/files/default/replication-bin/replicate-changesets
Fix new rubocop warnings
[chef.git] / cookbooks / planet / files / default / replication-bin / replicate-changesets
index fac548bd5c2ef6dbdb573ac23e4d461c357d0a94..29131b2edd27c2394fb5d83f76157912d90a58ec 100755 (executable)
@@ -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
@@ -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