275: def to_ldif
276: base = self.class.ldapbase
277: str = self.dn + "\n"
278: ocs = Array.new
279: if self.class.ocs
280:
281: kocs = self.class.ocs
282: ocs.push(*kocs)
283: end
284: ocs.push "top"
285: oc = self.class.to_s
286: oc.sub!(/Nagios/,'nagios')
287: oc.sub!(/::/,'')
288: ocs.push oc
289: ocs.each { |oc|
290: str += "objectclass: " + oc + "\n"
291: }
292: @parameters.each { |name,value|
293: if self.class.suppress.include?(name)
294: next
295: end
296: ldapname = self.parammap(name)
297: str += ldapname + ": " + value + "\n"
298: }
299: str += "\n"
300: str
301: end