Skip to content

Instantly share code, notes, and snippets.

@tarsisazevedo
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tarsisazevedo/c31c0e6ba62bee002784 to your computer and use it in GitHub Desktop.
Save tarsisazevedo/c31c0e6ba62bee002784 to your computer and use it in GitHub Desktop.
migrate cname in redis from tsuru 0.6.2 to 0.7.0
# using redis library: https://pypi.python.org/pypi/redis
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