in lib/muchos/config/ec2.py [0:0]
def validate_template(self):
if not self.cluster_template_d:
exit(
"ERROR - Template '{0}' is not defined!".format(
self.get("ec2", "cluster_template")
)
)
if "worker" not in self.cluster_template_d:
exit(
"ERROR - '{0}' template config is invalid. No 'worker' "
"launch request is defined".format(
self.cluster_template_d["id"]
)
)
if "worker" not in self.cluster_template_d["devices"]:
exit(
"ERROR - '{0}' template is invalid. The devices file must "
"have a 'worker' device map".format(
self.cluster_template_d["id"]
)
)
if "default" not in self.cluster_template_d["devices"]:
exit(
"ERROR - '{0}' template is invalid. The devices file must "
"have a 'default' device map".format(
self.cluster_template_d["id"]
)
)
# Validate the selected launch template for each host
worker_count = 0
for hostname in self.node_d:
# first service listed denotes the selected template
selected_ec2_request = self.node_d[hostname][0]
if "worker" == selected_ec2_request:
worker_count = worker_count + 1
else:
if "worker" in self.node_d[hostname]:
exit(
"ERROR - '{0}' node config is invalid. The 'worker'"
" service should be listed first".format(hostname)
)
if selected_ec2_request not in self.cluster_template_d:
if len(self.node_d[hostname]) > 1:
print(
"Hint: In template mode, the first service listed"
" for a host denotes its EC2 template"
)
exit(
"ERROR - '{0}' node config is invalid. No EC2 "
"template defined for the '{1}' service".format(
hostname, selected_ec2_request
)
)
if worker_count == 0:
exit(
"ERROR - No worker instances are defined "
"for template '{0}'".format(self.cluster_template_d["id"])
)