Update source/src/services.cpp
This commit is contained in:
@@ -114,12 +114,17 @@ namespace dropshell
|
|||||||
template_info tinfo = gTemplateManager().get_template_info(service.template_name);
|
template_info tinfo = gTemplateManager().get_template_info(service.template_name);
|
||||||
if (!tinfo.is_set())
|
if (!tinfo.is_set())
|
||||||
{
|
{
|
||||||
error << "Template specified '" << service.template_name << "' could not be found" << std::endl;
|
// Template might be available from registry but not cached yet
|
||||||
return LocalServiceInfo();
|
// Don't fail here - let the install command handle downloading if needed
|
||||||
|
warning << "Template '" << service.template_name << "' not found locally, may need to download from registry" << std::endl;
|
||||||
|
// Set template_name but leave local_template_path empty
|
||||||
|
// The install command will try to get the template again
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// find the template path
|
// find the template path
|
||||||
service.local_template_path = tinfo.local_template_path();
|
service.local_template_path = tinfo.local_template_path();
|
||||||
|
}
|
||||||
|
|
||||||
{ // set the user.
|
{ // set the user.
|
||||||
auto it = variables.find("SSH_USER");
|
auto it = variables.find("SSH_USER");
|
||||||
@@ -140,12 +145,17 @@ namespace dropshell
|
|||||||
auto it = variables.find("TEMPLATE_HASH");
|
auto it = variables.find("TEMPLATE_HASH");
|
||||||
if (it == variables.end())
|
if (it == variables.end())
|
||||||
error << "Variable TEMPLATE_HASH not found in the service " << filenames::template_info_env << std::endl;
|
error << "Variable TEMPLATE_HASH not found in the service " << filenames::template_info_env << std::endl;
|
||||||
else
|
else if (tinfo.is_set())
|
||||||
{
|
{
|
||||||
uint64_t service_template_hash = std::stoull(it->second);
|
uint64_t service_template_hash = std::stoull(it->second);
|
||||||
service.service_template_hash_match = (service_template_hash == tinfo.hash());
|
service.service_template_hash_match = (service_template_hash == tinfo.hash());
|
||||||
//debug << "Service template hash: " << service_template_hash << " == " << tinfo.hash() << std::endl;
|
//debug << "Service template hash: " << service_template_hash << " == " << tinfo.hash() << std::endl;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Template not available yet, can't check hash
|
||||||
|
service.service_template_hash_match = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return service;
|
return service;
|
||||||
|
Reference in New Issue
Block a user