# File lib/puppet/util/storage.rb, line 54
54:     def self.load
55:         Puppet.settings.use(:main) unless FileTest.directory?(Puppet[:statedir])
56: 
57:         unless File.exists?(Puppet[:statefile])
58:             unless defined? @@state and ! @@state.nil?
59:                 self.init
60:             end
61:             return
62:         end
63:         Puppet::Util.benchmark(:debug, "Loaded state") do
64:             Puppet::Util::FileLocking.readlock(Puppet[:statefile]) do |file|
65:                 begin
66:                     @@state = YAML.load(file)
67:                 rescue => detail
68:                     Puppet.err "Checksumfile %s is corrupt (%s); replacing" %
69:                         [Puppet[:statefile], detail]
70:                     begin
71:                         File.rename(Puppet[:statefile],
72:                             Puppet[:statefile] + ".bad")
73:                     rescue
74:                         raise Puppet::Error,
75:                             "Could not rename corrupt %s; remove manually" %
76:                             Puppet[:statefile]
77:                     end
78:                 end
79:             end
80:         end
81: 
82:         unless @@state.is_a?(Hash)
83:             Puppet.err "State got corrupted"
84:             self.init
85:         end
86: 
87:         #Puppet.debug "Loaded state is %s" % @@state.inspect
88:     end