Created
June 23, 2015 13:50
-
-
Save teodor-pripoae/8447f5f1f2afa0f8a9dc to your computer and use it in GitHub Desktop.
Update skydns from hosts file
This file contains hidden or 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
#!/usr/bin/env python | |
import os | |
def blank(el): | |
return len(el) == 2 | |
with open('dns.txt', 'r') as f: | |
lines = [x.split(' ') for x in f.read().split('\n')] | |
results = filter(blank, lines) | |
for result in results: | |
print result | |
ip = result[0] | |
key = "/".join(result[1].split('.')[::-1]) | |
cmd = "curl -XPUT http://127.0.0.1:4001/v2/keys/skydns/%s -d value='{\"host\":\"%s\"}'" %(key, ip) | |
os.system(cmd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment