#!/usr/bin/env ruby # # convert the old data model for the gaptool server # to the new struct libpath = File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")) $:.unshift(libpath) require "#{libpath}/helpers/redis" require "#{libpath}/helpers/data" DH = Gaptool::Data $redis.keys("role:*").each do |k| next if k.end_with?('instances') || k.end_with?('apps') || k.end_with?('amis') puts "Migrating #{k}" sgroup = $redis.hget(k, "security_group") $redis.hset("#{k}:sg", "production", sgroup) $redis.del(k) end