Skip to content

Instantly share code, notes, and snippets.

@rmyers
Created July 28, 2017 15:16
Show Gist options
  • Save rmyers/bb7d74ff8d843394a36d2a3c7546b3a6 to your computer and use it in GitHub Desktop.
Save rmyers/bb7d74ff8d843394a36d2a3c7546b3a6 to your computer and use it in GitHub Desktop.
Generate a list of ddi's to add to a flag
#!/usr/bin/env python
#
# Generate a list of flags for a set of customer DDI's from a csv file.
#
# Usage:
# python aws.py ddi_file.csv
import sys
import json
if len(sys.argv) < 2:
sys.exit('Please enter a csv file: python {0} csv_file.csv'.format(sys.argv[0]))
with open(sys.argv[1], mode='U') as ddi_list:
DDI_LIST = [line.strip() for line in ddi_list.readlines()]
flags = []
for ddi in DDI_LIST:
flags.append({"args": "{0}".format(ddi), "name": "Tenant"})
print json.dumps(flags)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment