Last active
August 29, 2015 14:06
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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