Make sure that child zones accept commands from their parent zone

refs #6964
This commit is contained in:
Gunnar Beutner 2014-08-22 13:46:32 +02:00
parent f1c8073dd3
commit 913e35da9e
1 changed files with 10 additions and 4 deletions

View File

@ -982,8 +982,14 @@ Value ApiEvents::UpdateRepositoryAPIHandler(const MessageOrigin& origin, const D
Host::Ptr ApiEvents::FindHostByVirtualName(const String& hostName, const MessageOrigin& origin)
{
if (origin.FromZone && hostName == "localhost")
return Host::GetByName(origin.FromZone->GetName());
else
return Host::GetByName(hostName);
if (origin.FromZone) {
Zone::Ptr my_zone = Zone::GetLocalZone();
if (origin.FromZone->IsChildOf(my_zone) && hostName == "localhost")
return Host::GetByName(origin.FromZone->GetName());
else if (!origin.FromZone->IsChildOf(my_zone) && hostName == my_zone->GetName())
return Host::GetByName("localhost");
}
return Host::GetByName(hostName);
}