# File lib/puppet/ssl/certificate_authority.rb, line 177 177: def next_serial 178: serial = nil 179: 180: # This is slightly odd. If the file doesn't exist, our readwritelock creates 181: # it, but with a mode we can't actually read in some cases. So, use 182: # a default before the lock. 183: serial = 0x1 unless FileTest.exist?(Puppet[:serial]) 184: 185: Puppet.settings.readwritelock(:serial) { |f| 186: serial ||= File.read(Puppet.settings[:serial]).chomp.hex if FileTest.exist?(Puppet[:serial]) 187: 188: # We store the next valid serial, not the one we just used. 189: f << "%04X" % (serial + 1) 190: } 191: 192: serial 193: end