Sha256: 496b981bfbaeef9c508f66150c588fb9be7fb7c764c0b0f7f1994907195ef61d

Contents?: true

Size: 1.88 KB

Versions: 9

Compression:

Stored size: 1.88 KB

Contents

require File.dirname(__FILE__) + "/remoter"

module PoolParty  
  module Remote
    
    class RemoteInstance
      include Remote
      include Configurable
      include CloudResourcer
            
      def initialize(opts, parent=self)
        @parent = parent
        set_vars_from_options(parent.options) if parent && parent.respond_to?(:options)
        set_vars_from_options(opts) unless opts.nil? || opts.empty?
        on_init
      end
      
      # Callback
      def on_init        
      end
      
      # Is this remote instance the master?
      def master?
        name == "master"
      end
      
      # The remote instances is only valid if there is an ip and a name
      def valid?
        !(ip.nil? || name.nil?)
      end
      
      # Determine if the RemoteInstance is responding
      def responding?
        !responding.nil?
      end
      
      # This is how we get the current load of the instance
      # The approach of this may change entirely, but the usage of
      # it will always be the same
      def load
        current_load ||= 0.0
      end
            
      # Is this instance running?
      def running?
        !(status =~ /running/).nil?
      end
      # Is this instance pending?
      def pending?
        !(status =~ /pending/).nil?
      end
      # Is this instance terminating?
      def terminating?
        !(status =~ /shutting/).nil?
      end
      # Has this instance been terminated?
      def terminated?
        !(status =~ /terminated/).nil?
      end
      
      # Printing. This is how we extract the instances into the listing on the 
      # local side into the local listing file
      def to_s
        "#{name}\t#{ip}"
      end
      
      # Commands for the servers
      def puppet_runner_command
        ". /etc/profile && /usr/sbin/puppetd --onetime --no-daemonize --logdest syslog --server master 2>&1"
      end
    end
    
  end  
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
auser-poolparty-0.2.16 lib/poolparty/net/remote_instance.rb
auser-poolparty-0.2.20 lib/poolparty/net/remote_instance.rb
auser-poolparty-0.2.21 lib/poolparty/net/remote_instance.rb
auser-poolparty-0.2.22 lib/poolparty/net/remote_instance.rb
auser-poolparty-0.2.23 lib/poolparty/net/remote_instance.rb
auser-poolparty-0.2.24 lib/poolparty/net/remote_instance.rb
auser-poolparty-0.2.25 lib/poolparty/net/remote_instance.rb
auser-poolparty-0.2.26 lib/poolparty/net/remote_instance.rb
poolparty-0.2.18 lib/poolparty/net/remote_instance.rb