From b1b6b5ae1cf3c96c2f70209c84800ac6c903f722 Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Wed, 26 Nov 2014 10:39:29 -0600 Subject: NagiosGen: Add bundles to configuration Signed-off-by: Sol Jerome --- doc/releases/1.4.0pre2.txt | 3 +++ src/lib/Bcfg2/Server/Plugins/NagiosGen.py | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/releases/1.4.0pre2.txt b/doc/releases/1.4.0pre2.txt index 7bbed5603..572748f73 100644 --- a/doc/releases/1.4.0pre2.txt +++ b/doc/releases/1.4.0pre2.txt @@ -17,6 +17,8 @@ and as such is not likely suitable for general production deployment. That said, please help us test the release in non- and preproduction environments. +* NagiosGen: Add bundles to configuration + backwards-incompatible user-facing changes ------------------------------------------ @@ -35,3 +37,4 @@ Special thanks to the following contributors for this release * Alexander Sulfrain * Matt Kemp + * Jeremie Banier diff --git a/src/lib/Bcfg2/Server/Plugins/NagiosGen.py b/src/lib/Bcfg2/Server/Plugins/NagiosGen.py index 045e46350..9d3b3488b 100644 --- a/src/lib/Bcfg2/Server/Plugins/NagiosGen.py +++ b/src/lib/Bcfg2/Server/Plugins/NagiosGen.py @@ -46,6 +46,11 @@ class NagiosGen(Plugin, Generator): metadata.hostname) host_groups = [grp for grp in metadata.groups if os.path.isfile('%s/%s-group.cfg' % (self.data, grp))] + if os.path.isfile('%s/%s-group.cfg' % + (self.data, grp))] + \ + [bundle for bundle in metadata.bundles + if os.path.isfile('%s/%s-bundle.cfg' % + (self.data, bundle))] host_config = ['define host {', self.line_fmt % ('host_name', metadata.hostname), self.line_fmt % ('alias', metadata.hostname), @@ -81,7 +86,8 @@ class NagiosGen(Plugin, Generator): def createserverconfig(self, entry, _): """Build monolithic server configuration file.""" host_configs = glob.glob(os.path.join(self.data, '*-host.cfg')) - group_configs = glob.glob(os.path.join(self.data, '*-group.cfg')) + group_configs = glob.glob(os.path.join(self.data, '*-group.cfg')) + \ + glob.glob(os.path.join(self.data, '*-bundle.cfg')) host_data = [] group_data = [] for host in host_configs: -- cgit v1.2.3-1-g7c22