diff options
| author | Luke Kanies <luke@madstop.com> | 2005-04-19 15:24:31 +0000 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2005-04-19 15:24:31 +0000 |
| commit | 490854a2edf381c34083f0049e4c7ea3f1a20ad0 (patch) | |
| tree | c0c901ecc6bfc8bef398d412005ae1cca83b4779 | |
| parent | 6127e4340fc231b7279bfeaade35b7df8d219c10 (diff) | |
| download | puppet-490854a2edf381c34083f0049e4c7ea3f1a20ad0.tar.gz puppet-490854a2edf381c34083f0049e4c7ea3f1a20ad0.tar.xz puppet-490854a2edf381c34083f0049e4c7ea3f1a20ad0.zip | |
the client now executes "evaluate", which might not be a good thing -- i am getting failures if files do not exist, for instance
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@194 980ebf18-57e1-0310-9a29-db15c13687c0
| -rw-r--r-- | lib/blink/client.rb | 11 | ||||
| -rw-r--r-- | lib/blink/statechange.rb | 11 | ||||
| -rw-r--r-- | lib/blink/type.rb | 22 | ||||
| -rw-r--r-- | lib/blink/type/state.rb | 4 |
4 files changed, 37 insertions, 11 deletions
diff --git a/lib/blink/client.rb b/lib/blink/client.rb index 493d61d4b..9dd959b9f 100644 --- a/lib/blink/client.rb +++ b/lib/blink/client.rb @@ -44,10 +44,13 @@ module Blink # okay, we have a list of all of the objects we're supposed # to execute - # here's where we collect the rollbacks and record them, i guess - # the objects should deal internally with whether we're running - # under no-op, or whether a given object itself should be no-op - #objects.each { |obj| puts obj.class } + # here's where we collect the rollbacks and record them + # that means that we need, at the least: + # - a standard mechanism for specifying that an object is no-op + # - a standard object that is considered a rollback object + objects.each { |obj| + obj.evaluate + } end end end diff --git a/lib/blink/statechange.rb b/lib/blink/statechange.rb index a89029e3e..a9177a7bd 100644 --- a/lib/blink/statechange.rb +++ b/lib/blink/statechange.rb @@ -11,7 +11,10 @@ module Blink attr_accessor :is, :should, :type, :path #--------------------------------------------------------------- - def initialize + def initialize(state) + @path = state.fqpath + @is = state.is + @should = state.should end #--------------------------------------------------------------- @@ -26,5 +29,11 @@ module Blink @type.change(@path,@should,@is) end #--------------------------------------------------------------- + + #--------------------------------------------------------------- + def to_s + puts "%s: %s => %s" % [@path,@is,@should] + end + #--------------------------------------------------------------- end end diff --git a/lib/blink/type.rb b/lib/blink/type.rb index 344c21a40..2c9eae5b4 100644 --- a/lib/blink/type.rb +++ b/lib/blink/type.rb @@ -286,8 +286,8 @@ module Blink @actions = Hash.new #@opsgenned = false - # default to always syncing - @performoperation = :sync + # default to performing action + @noop = false # if they passed in a list of states they're interested in, # we mark them as "interesting" @@ -468,11 +468,20 @@ module Blink def evaluate self.retrieve unless self.insync? - if @performoperation == :sync - self.sync + if self.noop + Blink.verbose("%s is noop" % self) else - # we, uh, don't do anything + self.each { |state| + #Blink.notice("getting state change on %s" % state) + statechange = Blink::StateChange.new(state) + puts statechange + } end + #if @performoperation == :sync + # self.sync + #else + # # we, uh, don't do anything + #end end self.retrieve end @@ -498,7 +507,7 @@ module Blink #--------------------------------------------------------------- # should we actually do anything? def noop - return self.noop || Blink[:noop] || false + return @noop || Blink[:noop] || false end #--------------------------------------------------------------- @@ -664,3 +673,4 @@ require 'blink/type/file' require 'blink/type/symlink' require 'blink/type/package' require 'blink/component' +require 'blink/statechange' diff --git a/lib/blink/type/state.rb b/lib/blink/type/state.rb index 33a872706..4e17e4124 100644 --- a/lib/blink/type/state.rb +++ b/lib/blink/type/state.rb @@ -94,6 +94,10 @@ module Blink class Symbol attr_reader :is, :should + def fqpath + return "Symbol" + end + def initialize(symbol) @symbol = symbol end |
