| 59 | } |
| 60 | |
| 61 | static bool IncludeNonLocalZone(const String& zonePath, const String& package, bool& success) |
| 62 | { |
| 63 | /* Note: This include function must not call RegisterZoneDir(). |
| 64 | * We do not need to copy it for cluster config sync. */ |
| 65 | |
| 66 | String zoneName = Utility::BaseName(zonePath); |
| 67 | |
| 68 | /* We don't have an activated zone object yet. We may forcefully guess from configitems |
| 69 | * to not include this specific synced zones directory. |
| 70 | */ |
| 71 | if(!ConfigItem::GetByTypeAndName(Type::GetByName("Zone"), zoneName)) { |
| 72 | return false; |
| 73 | } |
| 74 | |
| 75 | /* Check whether this node already has an authoritative config version |
| 76 | * from zones.d in etc or api package directory, or a local marker file) |
| 77 | */ |
| 78 | if (ConfigCompiler::HasZoneConfigAuthority(zoneName) || Utility::PathExists(zonePath + "/.authoritative")) { |
| 79 | Log(LogNotice, "config") |
| 80 | << "Ignoring non local config include for zone '" << zoneName << "': We already have an authoritative copy included."; |
| 81 | return true; |
| 82 | } |
| 83 | |
| 84 | std::vector<std::unique_ptr<Expression> > expressions; |
| 85 | Utility::GlobRecursive(zonePath, "*.conf", [&expressions, zoneName, package](const String& file) { |
| 86 | ConfigCompiler::CollectIncludes(expressions, file, zoneName, package); |
| 87 | }, GlobFile); |
| 88 | |
| 89 | DictExpression expr(std::move(expressions)); |
| 90 | if (!ExecuteExpression(&expr)) |
| 91 | success = false; |
| 92 | |
| 93 | return true; |
| 94 | } |
| 95 | |
| 96 | static void IncludePackage(const String& packagePath, bool& success) |
| 97 | { |
no test coverage detected