diff options
author | Tim Laszlo <tim.laszlo@gmail.com> | 2010-07-15 04:53:40 +0000 |
---|---|---|
committer | Sol Jerome <sol.jerome@gmail.com> | 2010-07-16 16:36:15 -0500 |
commit | c76279defd35949ec87fa243acae6e141ee201ee (patch) | |
tree | 1133ffe8f46731782aaf95e690736ff44e0b7ae8 /src | |
parent | 864b75c5d085c29a581b6838332413bccb62f0e2 (diff) | |
download | bcfg2-c76279defd35949ec87fa243acae6e141ee201ee.tar.gz bcfg2-c76279defd35949ec87fa243acae6e141ee201ee.tar.bz2 bcfg2-c76279defd35949ec87fa243acae6e141ee201ee.zip |
NagiosGen: Allow default configuration via Properties
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5974 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Server/Plugins/NagiosGen.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/lib/Server/Plugins/NagiosGen.py b/src/lib/Server/Plugins/NagiosGen.py index f97085b1b..cd6f843fb 100644 --- a/src/lib/Server/Plugins/NagiosGen.py +++ b/src/lib/Server/Plugins/NagiosGen.py @@ -56,11 +56,16 @@ class NagiosGen(Bcfg2.Server.Plugin.Plugin, if host_groups: host_config += ' hostgroups %s\n' % (",".join(host_groups)) - if hasattr(metadata, 'Properties') and \ - 'NagiosGen.xml' in metadata.Properties and \ - metadata.Properties['NagiosGen.xml'].data.find(metadata.hostname) \ - is not None: - directives = list(metadata.Properties['NagiosGen.xml'].data.find(metadata.hostname)) + xtra = None + if hasattr(metadata, 'Properties') and \ + 'NagiosGen.xml' in metadata.Properties: + for q in (metadata.hostname, 'default'): + xtra = metadata.Properties['NagiosGen.xml'].data.find(q) + if xtra is not None: + break + + if xtra is not None: + directives = list(xtra) for item in directives: host_config += ' %-32s %s\n' % (item.tag, item.text) |