Skip to content

Instantly share code, notes, and snippets.

@jblancett
Created September 23, 2014 16:01
Show Gist options
  • Save jblancett/354672866c5bd0bafc71 to your computer and use it in GitHub Desktop.
Save jblancett/354672866c5bd0bafc71 to your computer and use it in GitHub Desktop.
migrate cname in redis from tsuru 0.6.2 to 0.7.0
import redis, os
HOST = os.getenv("HOST", "localhost")
PORT = os.getenv("PORT", 6379)
r = redis.StrictRedis(host=HOST, port=PORT)
cnames_app = r.keys("cname:*")
for cname_app in cnames_app:
cname = r.get(cname_app)
r.delete(cname_app)
r.lpush(cname_app, cname)
print "converted %s to list" % cname_app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment