diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/type/nagios_command.rb | 31 | ||||
| -rw-r--r-- | lib/puppet/type/nagios_contact.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/type/nagios_contactgroup.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/type/nagios_host.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/type/nagios_hostextinfo.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/type/nagios_hostgroup.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/type/nagios_hostgroupescalation.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/type/nagios_service.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/type/nagios_servicedependency.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/type/nagios_serviceescalation.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/type/nagios_serviceextinfo.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/type/nagios_timeperiod.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/util/nagios_maker.rb | 20 |
13 files changed, 53 insertions, 31 deletions
diff --git a/lib/puppet/type/nagios_command.rb b/lib/puppet/type/nagios_command.rb index f366e9d72..0d0e11b17 100644 --- a/lib/puppet/type/nagios_command.rb +++ b/lib/puppet/type/nagios_command.rb @@ -1,30 +1,3 @@ -require 'puppet/external/nagios' -require 'puppet/external/nagios/base' +require 'puppet/util/nagios_maker' -Puppet::Type.newtype(:nagios_command) do - ensurable - - nagtype = Nagios::Base.type(:command) - - raise "No nagios type" unless nagtype - - newparam(nagtype.namevar, :namevar => true) do - desc "The name parameter for Nagios type %s" % nagtype.name - end - - nagtype.parameters.each do |param| - next if param == nagtype.namevar - - newproperty(param) do - desc "Nagios configuration file parameter." - end - end - - newproperty(:target) do - desc 'target' - - defaultto do - resource.class.defaultprovider.default_target - end - end -end +Puppet::Util::NagiosMaker.create_nagios_type :command diff --git a/lib/puppet/type/nagios_contact.rb b/lib/puppet/type/nagios_contact.rb new file mode 100644 index 000000000..d5a1f3cba --- /dev/null +++ b/lib/puppet/type/nagios_contact.rb @@ -0,0 +1,3 @@ +require 'puppet/util/nagios_maker' + +Puppet::Util::NagiosMaker.create_nagios_type :contact diff --git a/lib/puppet/type/nagios_contactgroup.rb b/lib/puppet/type/nagios_contactgroup.rb new file mode 100644 index 000000000..b8f14c07b --- /dev/null +++ b/lib/puppet/type/nagios_contactgroup.rb @@ -0,0 +1,3 @@ +require 'puppet/util/nagios_maker' + +Puppet::Util::NagiosMaker.create_nagios_type :contactgroup diff --git a/lib/puppet/type/nagios_host.rb b/lib/puppet/type/nagios_host.rb new file mode 100644 index 000000000..f2e03f6fb --- /dev/null +++ b/lib/puppet/type/nagios_host.rb @@ -0,0 +1,3 @@ +require 'puppet/util/nagios_maker' + +Puppet::Util::NagiosMaker.create_nagios_type :host diff --git a/lib/puppet/type/nagios_hostextinfo.rb b/lib/puppet/type/nagios_hostextinfo.rb new file mode 100644 index 000000000..da8e08dd8 --- /dev/null +++ b/lib/puppet/type/nagios_hostextinfo.rb @@ -0,0 +1,3 @@ +require 'puppet/util/nagios_maker' + +Puppet::Util::NagiosMaker.create_nagios_type :hostextinfo diff --git a/lib/puppet/type/nagios_hostgroup.rb b/lib/puppet/type/nagios_hostgroup.rb new file mode 100644 index 000000000..e1943beec --- /dev/null +++ b/lib/puppet/type/nagios_hostgroup.rb @@ -0,0 +1,3 @@ +require 'puppet/util/nagios_maker' + +Puppet::Util::NagiosMaker.create_nagios_type :hostgroup diff --git a/lib/puppet/type/nagios_hostgroupescalation.rb b/lib/puppet/type/nagios_hostgroupescalation.rb new file mode 100644 index 000000000..21b39f681 --- /dev/null +++ b/lib/puppet/type/nagios_hostgroupescalation.rb @@ -0,0 +1,3 @@ +require 'puppet/util/nagios_maker' + +Puppet::Util::NagiosMaker.create_nagios_type :hostgroupescalation diff --git a/lib/puppet/type/nagios_service.rb b/lib/puppet/type/nagios_service.rb new file mode 100644 index 000000000..22b987f56 --- /dev/null +++ b/lib/puppet/type/nagios_service.rb @@ -0,0 +1,3 @@ +require 'puppet/util/nagios_maker' + +Puppet::Util::NagiosMaker.create_nagios_type :service diff --git a/lib/puppet/type/nagios_servicedependency.rb b/lib/puppet/type/nagios_servicedependency.rb new file mode 100644 index 000000000..0e3340c6e --- /dev/null +++ b/lib/puppet/type/nagios_servicedependency.rb @@ -0,0 +1,3 @@ +require 'puppet/util/nagios_maker' + +Puppet::Util::NagiosMaker.create_nagios_type :servicedependency diff --git a/lib/puppet/type/nagios_serviceescalation.rb b/lib/puppet/type/nagios_serviceescalation.rb new file mode 100644 index 000000000..cb2af1545 --- /dev/null +++ b/lib/puppet/type/nagios_serviceescalation.rb @@ -0,0 +1,3 @@ +require 'puppet/util/nagios_maker' + +Puppet::Util::NagiosMaker.create_nagios_type :serviceescalation diff --git a/lib/puppet/type/nagios_serviceextinfo.rb b/lib/puppet/type/nagios_serviceextinfo.rb new file mode 100644 index 000000000..6bdc70900 --- /dev/null +++ b/lib/puppet/type/nagios_serviceextinfo.rb @@ -0,0 +1,3 @@ +require 'puppet/util/nagios_maker' + +Puppet::Util::NagiosMaker.create_nagios_type :serviceextinfo diff --git a/lib/puppet/type/nagios_timeperiod.rb b/lib/puppet/type/nagios_timeperiod.rb new file mode 100644 index 000000000..25a06d3ed --- /dev/null +++ b/lib/puppet/type/nagios_timeperiod.rb @@ -0,0 +1,3 @@ +require 'puppet/util/nagios_maker' + +Puppet::Util::NagiosMaker.create_nagios_type :timeperiod diff --git a/lib/puppet/util/nagios_maker.rb b/lib/puppet/util/nagios_maker.rb index 7c019f55e..f1f85466f 100644 --- a/lib/puppet/util/nagios_maker.rb +++ b/lib/puppet/util/nagios_maker.rb @@ -19,9 +19,14 @@ module Puppet::Util::NagiosMaker desc "The name parameter for Nagios type %s" % nagtype.name end - nagtype.parameters.each do |param| + # We deduplicate the parameters because it makes sense to allow Naginator to have dupes. + nagtype.parameters.uniq.each do |param| next if param == nagtype.namevar + # We can't turn these parameter names into constants, so at least for now they aren't + # supported. + next if param.to_s =~ /^[0-9]/ + type.newproperty(param) do desc "Nagios configuration file parameter." end @@ -35,6 +40,17 @@ module Puppet::Util::NagiosMaker end end - type.provide(:naginator, :parent => Puppet::Provider::Naginator, :default_target => "/etc/nagios/#{full_name.to_s}.cfg") {} + provider = type.provide(:naginator, :parent => Puppet::Provider::Naginator, :default_target => "/etc/nagios/#{full_name.to_s}.cfg") {} + + type.desc "The Nagios type #{name.to_s}. This resource type is autogenerated using the + model developed in Naginator_, and all of the Nagios types are generated using the + same code and the same library. + + This type generates Nagios configuration statements in Nagios-parseable configuration + files. By default, the statements will be added to ``#{provider.default_target}, but + you can send them to a different file by setting their ``target`` attribute. + + .. _naginator: http://reductivelabs.com/trac/naginator + " end end |
