Created
February 18, 2015 23:18
-
-
Save feniix/98d8258fe52c84c1c894 to your computer and use it in GitHub Desktop.
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 json | |
import sys | |
from pprint import pprint | |
files = sys.argv[1:] | |
if not files: | |
files = ["/dev/stdin"] | |
for file in files: | |
f = open(file) | |
json_data = json.load(f) | |
port = json_data['port'] | |
srv_list = [] | |
i = 0 | |
for server in json_data['servers']: | |
i = i + 1 | |
if i != len(json_data['servers']): | |
srv_list.append(server + ":" + str(port) + ",") | |
else: | |
srv_list.append(server + ":" + str(port) + "/kafka") | |
print(''.join(srv_list)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment