diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-10-28 09:20:12 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-10-28 09:20:12 -0400 |
commit | 99c5e5ca3f834bd1d42b280eb03c73cfcf7c52d8 (patch) | |
tree | 5468ffd8e07b500c6b6732c853e7f23840a76181 /src/lib/Bcfg2/Server/Plugins/GroupLogic.py | |
parent | 48934ccb7f7bec3151c1aa24cb5bf495836e5b89 (diff) | |
parent | 1d27fdadac37eb95d56f98cf7bdd1721a339df81 (diff) | |
download | bcfg2-99c5e5ca3f834bd1d42b280eb03c73cfcf7c52d8.tar.gz bcfg2-99c5e5ca3f834bd1d42b280eb03c73cfcf7c52d8.tar.bz2 bcfg2-99c5e5ca3f834bd1d42b280eb03c73cfcf7c52d8.zip |
Merge branch 'maint'
Conflicts:
doc/development/lint.txt
misc/bcfg2.spec
src/lib/Bcfg2/Reporting/Collector.py
src/lib/Bcfg2/Server/Core.py
src/lib/Bcfg2/Server/Plugins/Metadata.py
src/lib/Bcfg2/Server/models.py
testsuite/install.sh
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/GroupLogic.py')
-rw-r--r-- | src/lib/Bcfg2/Server/Plugins/GroupLogic.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/GroupLogic.py b/src/lib/Bcfg2/Server/Plugins/GroupLogic.py index ebcab1a6b..06e797ec3 100644 --- a/src/lib/Bcfg2/Server/Plugins/GroupLogic.py +++ b/src/lib/Bcfg2/Server/Plugins/GroupLogic.py @@ -41,19 +41,21 @@ class GroupLogic(Bcfg2.Server.Plugin.Plugin, self.config = GroupLogicConfig(os.path.join(self.data, "groups.xml"), should_monitor=True) self._local = local() - # building is a thread-local set that tracks which machines - # GroupLogic is getting additional groups for. If a - # get_additional_groups() is called twice for a machine before - # the first call has completed, the second call returns an - # empty list. This is for infinite recursion protection; - # without this check, it'd be impossible to use things like - # metadata.query.in_group() in GroupLogic, since that requires - # building all metadata, which requires running - # GroupLogic.get_additional_groups() for all hosts, which - # requires building all metadata... - self._local.building = set() def get_additional_groups(self, metadata): + if not hasattr(self._local, "building"): + # building is a thread-local set that tracks which + # machines GroupLogic is getting additional groups for. + # If a get_additional_groups() is called twice for a + # machine before the first call has completed, the second + # call returns an empty list. This is for infinite + # recursion protection; without this check, it'd be + # impossible to use things like metadata.query.in_group() + # in GroupLogic, since that requires building all + # metadata, which requires running + # GroupLogic.get_additional_groups() for all hosts, which + # requires building all metadata... + self._local.building = set() if metadata.hostname in self._local.building: return [] self._local.building.add(metadata.hostname) |