Fix "assign where" for nested groups

fixes #7475
This commit is contained in:
Gunnar Beutner 2014-10-28 18:58:22 +01:00
parent c10da708ff
commit 4cb3d5b1f0
6 changed files with 12 additions and 9 deletions

View File

@ -41,6 +41,8 @@ void Host::OnConfigLoaded(void)
Array::Ptr groups = GetGroups();
if (groups) {
groups = groups->ShallowClone();
ObjectLock olock(groups);
BOOST_FOREACH(const String& name, groups) {

View File

@ -66,9 +66,6 @@ bool HostGroup::EvaluateObjectRuleOne(const Host::Ptr& host, const ObjectRule& r
/* assign host group membership */
group->ResolveGroupMembership(host, true);
/* update groups attribute for apply */
host->AddGroup(group_name);
return true;
}
@ -100,6 +97,8 @@ std::set<Host::Ptr> HostGroup::GetMembers(void) const
void HostGroup::AddMember(const Host::Ptr& host)
{
host->AddGroup(GetName());
boost::mutex::scoped_lock lock(m_HostGroupMutex);
m_Members.insert(host);
}

View File

@ -42,6 +42,8 @@ void Service::OnConfigLoaded(void)
Array::Ptr groups = GetGroups();
if (groups) {
groups = groups->ShallowClone();
ObjectLock olock(groups);
BOOST_FOREACH(const String& name, groups) {

View File

@ -69,9 +69,6 @@ bool ServiceGroup::EvaluateObjectRuleOne(const Service::Ptr& service, const Obje
/* assign service group membership */
group->ResolveGroupMembership(service, true);
/* update groups attribute for apply */
service->AddGroup(group_name);
return true;
}
@ -103,6 +100,8 @@ std::set<Service::Ptr> ServiceGroup::GetMembers(void) const
void ServiceGroup::AddMember(const Service::Ptr& service)
{
service->AddGroup(GetName());
boost::mutex::scoped_lock lock(m_ServiceGroupMutex);
m_Members.insert(service);
}

View File

@ -40,6 +40,8 @@ void User::OnConfigLoaded(void)
Array::Ptr groups = GetGroups();
if (groups) {
groups = groups->ShallowClone();
ObjectLock olock(groups);
BOOST_FOREACH(const String& name, groups) {

View File

@ -66,9 +66,6 @@ bool UserGroup::EvaluateObjectRuleOne(const User::Ptr& user, const ObjectRule& r
/* assign user group membership */
group->ResolveGroupMembership(user, true);
/* update groups attribute for apply */
user->AddGroup(group_name);
return true;
}
@ -100,6 +97,8 @@ std::set<User::Ptr> UserGroup::GetMembers(void) const
void UserGroup::AddMember(const User::Ptr& user)
{
user->AddGroup(GetName());
boost::mutex::scoped_lock lock(m_UserGroupMutex);
m_Members.insert(user);
}