Update source/src/services.cpp
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 35s
Build-Test-Publish / build (linux/arm64) (push) Successful in 1m4s

This commit is contained in:
Your Name
2025-08-24 22:10:32 +12:00
parent 3163eabda2
commit 51a571064b

View File

@@ -114,17 +114,13 @@ 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())
{ {
// Template might be available from registry but not cached yet // Template not found - this means it's not available locally OR from registry
// Don't fail here - let the install command handle downloading if needed error << "Template '" << service.template_name << "' not found locally or in registry" << std::endl;
warning << "Template '" << service.template_name << "' not found locally, may need to download from registry" << std::endl; return LocalServiceInfo();
// Set template_name but leave local_template_path empty
// The install command will try to get the template again
}
else
{
// find the template path
service.local_template_path = tinfo.local_template_path();
} }
// Template is available (either locally or downloaded from registry)
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");
@@ -279,13 +275,13 @@ namespace dropshell
<< std::endl; << std::endl;
return false; return false;
} }
// Try to get the template - this will download from registry if needed
template_info tinfo = gTemplateManager().get_template_info(it->second); template_info tinfo = gTemplateManager().get_template_info(it->second);
if (!tinfo.is_set()) if (!tinfo.is_set())
{ {
// Don't fail here - template might be available from registry but not cached yet // Template is not available locally or from registry
// This allows services to be installed even when templates need to be downloaded error << "Template '" << it->second << "' not found locally or in registry" << std::endl;
warning << "Template '" << it->second << "' not immediately available, may need to download from registry" << std::endl; return false;
// Continue anyway - the actual install/operation will handle downloading if needed
} }
return true; return true;