83: def rc_add(service, rcvar, yesno)
84: append = "\# Added by Puppet\n#{rcvar}_enable=\"#{yesno}\"\n"
85:
86: if File.exists?(@@rcconf_dir)
87: File.open(@@rcconf_dir + "/#{service}", File::WRONLY | File::APPEND | File::CREAT, 0644) {
88: |f| f << append
89: self.debug("Appended to #{f.path}")
90: }
91: else
92:
93: if File.exists?(@@rcconf_local)
94: File.open(@@rcconf_local, File::WRONLY | File::APPEND) {
95: |f| f << append
96: self.debug("Appended to #{f.path}")
97: }
98: else
99:
100: File.open(@@rcconf, File::WRONLY | File::APPEND | File::CREAT, 0644) {
101: |f| f << append
102: self.debug("Appended to #{f.path}")
103: }
104: end
105: end
106: end