diff options
Diffstat (limited to 'src/lib/Server/Plugins/NagiosGen.py')
-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) |