.
This commit is contained in:
@@ -800,7 +800,7 @@ For full documentation, see: dropshell help templates
|
||||
ordered_env_vars all_env_vars;
|
||||
std::vector<std::string> env_files = {
|
||||
"config/" + filenames::service_env,
|
||||
"config/" + filenames::template_info_env
|
||||
filenames::template_info_env
|
||||
};
|
||||
for (const auto& file : env_files) {
|
||||
{ // load service.env from the service on this machine.
|
||||
@@ -812,22 +812,19 @@ For full documentation, see: dropshell help templates
|
||||
}
|
||||
}
|
||||
|
||||
// determine template name.
|
||||
auto it = find_var(all_env_vars, "TEMPLATE");
|
||||
if (it == all_env_vars.end()) {
|
||||
error << "TEMPLATE variable not found in " << template_path << std::endl;
|
||||
return false;
|
||||
}
|
||||
std::vector<std::string> required_vars = {
|
||||
"REQUIRES_HOST_ROOT",
|
||||
"REQUIRES_DOCKER",
|
||||
"REQUIRES_DOCKER_ROOT"
|
||||
};
|
||||
|
||||
std::string env_template_name = it->second;
|
||||
if (env_template_name.empty()) {
|
||||
error << "TEMPLATE variable is empty in " << template_path << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (env_template_name != template_name) {
|
||||
error << "TEMPLATE variable is wrong in " << template_path << std::endl;
|
||||
return false;
|
||||
for (const auto & required_var : required_vars)
|
||||
{
|
||||
auto it = find_var(all_env_vars, required_var);
|
||||
if (it == all_env_vars.end()) {
|
||||
error << "Required variable "<< required_var<<" not defined in " << template_path << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user