diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/blink/client.rb | 11 | ||||
-rw-r--r-- | lib/blink/type.rb | 23 |
2 files changed, 31 insertions, 3 deletions
diff --git a/lib/blink/client.rb b/lib/blink/client.rb index ce92d7a97..3f64c37ba 100644 --- a/lib/blink/client.rb +++ b/lib/blink/client.rb @@ -26,11 +26,11 @@ module Blink @nil = nil @url = hash[:Server] if hash.include?(:Listen) and hash[:Listen] == false - Blink.notice "We're local" + Blink.notice "We're a local client" @localonly = true @driver = @url else - Blink.notice "We're networked" + Blink.notice "We're a networked client" @localonly = false @driver = SOAP::RPC::Driver.new(@url, 'urn:blink-server') @driver.add_method("getconfig", "name") @@ -53,7 +53,12 @@ module Blink Blink.debug "server is %s" % @url #client.loadproperty('files/sslclient.properties') Blink.notice("getting config") - objects = @driver.getconfig(self) + objects = nil + if @localonly + objects = @driver.getconfig(self) + else + objects = @driver.getconfig(Blink::Fact["hostname"]) + end self.config(objects) end diff --git a/lib/blink/type.rb b/lib/blink/type.rb index 1b7f0e252..e697e0a15 100644 --- a/lib/blink/type.rb +++ b/lib/blink/type.rb @@ -39,6 +39,7 @@ class Blink::Type < Blink::Element @abstract = true @name = :blink # a little fakery, since Blink itself isn't a type + @namevar = :notused @allowedmethods = [:noop,:debug] @@ -236,6 +237,25 @@ class Blink::Type < Blink::Element #--------------------------------------------------------------- #--------------------------------------------------------------- + # remove all type instances + def Type.allclear + @@typeary.each { |subtype| + Blink.notice "Clearing %s of objects" % subtype + subtype.clear + } + end + #--------------------------------------------------------------- + + #--------------------------------------------------------------- + # per-type clearance + def Type.clear + if defined? @objects + @objects.clear + end + end + #--------------------------------------------------------------- + + #--------------------------------------------------------------- # all objects total def Type.push(object) @@allobjects.push object @@ -247,6 +267,9 @@ class Blink::Type < Blink::Element #--------------------------------------------------------------- # some simple stuff to make it easier to get a name from everyone def Type.namevar + unless defined? @namevar and ! @namevar.nil? + raise "Class %s has no namevar defined" % self + end return @namevar end #--------------------------------------------------------------- |