21: def checkforcdrom
22: unless defined? @@checkedforcdrom
23: if FileTest.exists? "/etc/apt/sources.list"
24: if File.read("/etc/apt/sources.list") =~ /^[^#]*cdrom:/
25: @@checkedforcdrom = true
26: else
27: @@checkedforcdrom = false
28: end
29: else
30:
31:
32: @@checkedforcdrom = false
33: end
34: end
35:
36: if @@checkedforcdrom and @resource[:allowcdrom] != :true
37: raise Puppet::Error,
38: "/etc/apt/sources.list contains a cdrom source; not installing. Use 'allowcdrom' to override this failure."
39: end
40: end