From: Matt Amos Date: Sun, 5 Feb 2017 19:11:56 +0000 (+0000) Subject: Add Time to whitelist of classes to load for YAML.safe_load X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/23399ca5a40b47ff871252a623339757e1442a0f?ds=sidebyside Add Time to whitelist of classes to load for YAML.safe_load The update to ruby 2.3.1 pulls in a different version of the YAML / Psych code which doesn't allow the Time class to be loaded in `safe_load`, unlike the previous version. This change whitelists Time, and appears to solve the problem. Since `state.yaml` files are not loaded from the internet, and rarely hand-edited, then this seems like an okay thing to whitelist. --- diff --git a/cookbooks/planet/files/default/replication-bin/replicate-changesets b/cookbooks/planet/files/default/replication-bin/replicate-changesets index 8c943902a..a5312e1e6 100644 --- a/cookbooks/planet/files/default/replication-bin/replicate-changesets +++ b/cookbooks/planet/files/default/replication-bin/replicate-changesets @@ -142,7 +142,7 @@ end class Replicator def initialize(config) @config = YAML.safe_load(File.read(config)) - @state = YAML.safe_load(File.read(@config["state_file"])) + @state = YAML.safe_load(File.read(@config["state_file"]), [Time]) @conn = PGconn.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]