Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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