Closed owenthereal closed 9 years ago
This just bit me as well. I read an application's default config file using TOML.load_file. When I then try to generate the TOML string again it blows up:
2.1.1p76 :014 > data = TOML.load_file('influxdb.toml')
=> {"bind-address"=>"0.0.0.0", "reporting-disabled"=>false, "logging"=> {"level"=>"info", "file"=>"/opt/influxdb/shared/log.txt"}, "admin"=>{"port"=>8083, "assets"=>"/opt/influxdb/current/admin"}, "api"=>{"port"=>8086, "read-timeout"=>"5s"}, "input_plugins"=>{"graphite"=>{"enabled"=>false}, "udp"=>{"enabled"=>false}, "udp_servers"=>[{"enabled"=>false}]}, "raft"=>{"port"=>8090, "dir"=>"/opt/influxdb/shared/data/raft"}, "storage"=>{"dir"=>"/opt/influxdb/shared/data/db", "write-buffer-size"=>10000}, "cluster"=>{"protobuf_port"=>8099, "protobuf_timeout"=>"2s", "protobuf_heartbeat"=>"200ms", "protobuf_min_backoff"=>"1s", "protobuf_max_backoff"=>"10s", "write-buffer-size"=>10000, "max-response-buffer-size"=>100, "concurrent-shard-query-limit"=>10}, "leveldb"=>{"max-open-files"=>40, "lru-cache-size"=>"200m", "max-open-shards"=>0, "point-batch-size"=>100, "write-batch-size"=>5000000}, "sharding"=>{"replication-factor"=>1, "short-term"=>{"duration"=>"7d", "split"=>1}, "long-term"=>{"duration"=>"30d", "split"=>1}}, "wal"=>{"dir"=>"/opt/influxdb/shared/data/wal", "flush-after"=>1000, "bookmark-after"=>1000, "index-after"=>1000, "requests-per-logfile"=>10000}}
2.1.1p76 :015 > TOML::Generator.new(data).body
NoMethodError: undefined method `to_toml' for {"enabled"=>false}:Hash
Great catch! Either of you have time to whip up a quick PR for this? Looks simple enough.
Trying to convert an array of table and an error was raised: