Don't assume every AWS VPC has tags

The default VPC has no tags (by default), so we should use get()
This commit is contained in:
Justin Santa Barbara 2014-11-27 17:31:02 -08:00
parent 7eceafa656
commit f9a9c75697

View File

@ -33,7 +33,7 @@ function get_instance_ids {
}
function get_vpc_id {
python -c 'import json,sys; lst = [str(vpc["VpcId"]) for vpc in json.load(sys.stdin)["Vpcs"] for tag in vpc["Tags"] if tag["Value"] == "kubernetes-vpc"]; print "".join(lst)'
python -c 'import json,sys; lst = [str(vpc["VpcId"]) for vpc in json.load(sys.stdin)["Vpcs"] for tag in vpc.get("Tags", []) if tag["Value"] == "kubernetes-vpc"]; print "".join(lst)'
}
function get_subnet_id {