diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2016-11-29 15:02:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-29 15:02:53 +0100 |
commit | 87f8f3f39fce01fc7355206a9d4dbb9f6ab238e5 (patch) | |
tree | f9b2075aa0d83be667873daca29a9fa6463e74b0 /src | |
parent | b82f5ccfc0b3065e4605e1753510f13da6019607 (diff) | |
parent | b4a27c9b3d2ebf2a143646f424f06a15e65a6cd9 (diff) | |
download | bcfg2-87f8f3f39fce01fc7355206a9d4dbb9f6ab238e5.tar.gz bcfg2-87f8f3f39fce01fc7355206a9d4dbb9f6ab238e5.tar.bz2 bcfg2-87f8f3f39fce01fc7355206a9d4dbb9f6ab238e5.zip |
Merge pull request #372 from AlexanderS/fix/nagiosgen
Some small fixes for NagiosGen
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Bcfg2/Server/Plugins/NagiosGen.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/NagiosGen.py b/src/lib/Bcfg2/Server/Plugins/NagiosGen.py index d3c38ef19..067e2faad 100644 --- a/src/lib/Bcfg2/Server/Plugins/NagiosGen.py +++ b/src/lib/Bcfg2/Server/Plugins/NagiosGen.py @@ -92,17 +92,15 @@ class NagiosGen(Plugin, Generator): for host in host_configs: host_data.append(open(host, 'r').read()) - group_list = [] + used_groups = set(['default']) for line in "\n".join(host_data).splitlines(): # only include those groups which are actually used if "hostgroup" in line: - group_list += line.split()[1].split(',') - - group_list = list(set(group_list)) + used_groups.update(line.split()[1].split(',')) for group in group_configs: group_name = re.sub("(-group.cfg|.*/(?=[^/]+))", "", group) - if group_name in group_list: + if group_name in used_groups: groupfile = open(group, 'r') group_data.append(groupfile.read()) groupfile.close() |