diff options
| author | Luke Kanies <luke@madstop.com> | 2005-08-02 00:24:18 +0000 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2005-08-02 00:24:18 +0000 |
| commit | 74dac8fd6f46c35cf79b15f1f7358bc32d4c7716 (patch) | |
| tree | 8b123cbd0b481d443cb882c704e7f2e16934d702 /lib/puppet | |
| parent | 8bf85e2faeb8a4776b64cf6cebac4733ff3739d5 (diff) | |
adding some consistency and tests to the whole puppet defaults system
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@485 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet')
| -rw-r--r-- | lib/puppet/client.rb | 4 | ||||
| -rwxr-xr-x | lib/puppet/filebucket.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/storage.rb | 22 | ||||
| -rw-r--r-- | lib/puppet/type.rb | 14 | ||||
| -rwxr-xr-x | lib/puppet/type/pfilebucket.rb | 4 |
5 files changed, 22 insertions, 24 deletions
diff --git a/lib/puppet/client.rb b/lib/puppet/client.rb index e4dd00801..d96bc158d 100644 --- a/lib/puppet/client.rb +++ b/lib/puppet/client.rb @@ -141,9 +141,9 @@ module Puppet Puppet::Storage.init Puppet::Storage.load rescue => detail - Puppet.err "Corrupt state file %s" % Puppet[:statefile] + Puppet.err "Corrupt state file %s" % Puppet[:checksumfile] begin - File.unlink(Puppet[:statefile]) + File.unlink(Puppet[:checksumfile]) retry rescue => detail raise Puppet::Error.new("Cannot remove %s: %s" % diff --git a/lib/puppet/filebucket.rb b/lib/puppet/filebucket.rb index e67b58668..f0e717146 100755 --- a/lib/puppet/filebucket.rb +++ b/lib/puppet/filebucket.rb @@ -61,7 +61,7 @@ module FileBucket hash.delete(:Path) else if defined? Puppet - @bucket = File.join(Puppet[:puppetroot], "bucket") + @bucket = Puppet[:bucketdir] else @bucket = File.expand_path("~/.filebucket") end diff --git a/lib/puppet/storage.rb b/lib/puppet/storage.rb index 67c2dbeab..c7c4a7ae1 100644 --- a/lib/puppet/storage.rb +++ b/lib/puppet/storage.rb @@ -25,16 +25,16 @@ module Puppet self.init def self.load - if Puppet[:statefile].nil? + if Puppet[:checksumfile].nil? raise "Somehow the statefile is nil" end - unless File.exists?(Puppet[:statefile]) - Puppet.info "Statefile %s does not exist" % Puppet[:statefile] + unless File.exists?(Puppet[:checksumfile]) + Puppet.info "Statefile %s does not exist" % Puppet[:checksumfile] return end - #Puppet.debug "Loading statefile %s" % Puppet[:statefile] - File.open(Puppet[:statefile]) { |file| + #Puppet.debug "Loading statefile %s" % Puppet[:checksumfile] + File.open(Puppet[:checksumfile]) { |file| file.each { |line| myclass, key, value = line.split(@@splitchar) @@ -61,22 +61,22 @@ module Puppet end def self.store - unless FileTest.directory?(File.dirname(Puppet[:statefile])) + unless FileTest.directory?(File.dirname(Puppet[:checksumfile])) begin - Puppet.recmkdir(File.dirname(Puppet[:statefile])) + Puppet.recmkdir(File.dirname(Puppet[:checksumfile])) Puppet.info "Creating state directory %s" % - File.dirname(Puppet[:statefile]) + File.dirname(Puppet[:checksumfile]) rescue => detail Puppet.err "Could not create state file: %s" % detail return end end - unless FileTest.exist?(Puppet[:statefile]) - Puppet.info "Creating state file %s" % Puppet[:statefile] + unless FileTest.exist?(Puppet[:checksumfile]) + Puppet.info "Creating state file %s" % Puppet[:checksumfile] end - File.open(Puppet[:statefile], File::CREAT|File::WRONLY, 0600) { |file| + File.open(Puppet[:checksumfile], File::CREAT|File::WRONLY, 0600) { |file| @@state.each { |klass, thash| thash.each { |key,value| mvalue = Marshal::dump(value) diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 4f58a971c..b96b01daa 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -57,7 +57,7 @@ class Type < Puppet::Element #@paramdoc = Hash.new # the methods that can be called from within the language - @allowedmethods = [:noop,:debug,:statefile] + @allowedmethods = [:noop,:debug,:checksumfile] # the parameters that all instances will accept @@metaparams = [ @@ -246,7 +246,7 @@ class Type < Puppet::Element def Type.statefile(value) if value =~ /^\// - Puppet[:statefile] = value + Puppet[:checksumfile] = value else raise "Statefile %s must be fully qualified" % value end @@ -1076,14 +1076,14 @@ class Type < Puppet::Element end # Puppet::Type end -require 'puppet/type/service' +require 'puppet/statechange' +require 'puppet/type/component' require 'puppet/type/exec' -require 'puppet/type/filebucket' +require 'puppet/type/package' require 'puppet/type/pfile' +require 'puppet/type/pfilebucket' +require 'puppet/type/service' require 'puppet/type/symlink' -require 'puppet/type/package' -require 'puppet/type/component' -require 'puppet/statechange' #require 'puppet/type/typegen' #require 'puppet/type/typegen/filetype' #require 'puppet/type/typegen/filerecord' diff --git a/lib/puppet/type/pfilebucket.rb b/lib/puppet/type/pfilebucket.rb index 16a323960..7fa059979 100755 --- a/lib/puppet/type/pfilebucket.rb +++ b/lib/puppet/type/pfilebucket.rb @@ -43,9 +43,7 @@ module Puppet ) end else - @parameters[:path] ||= File.join( - Puppet[:puppetroot], "bucket" - ) + @parameters[:path] ||= Puppet[:bucketdir] begin @bucket = FileBucket::Dipper.new( :Path => @parameters[:path] |
