lib/rubber/instance.rb in nirvdrum-rubber-1.1.7 vs lib/rubber/instance.rb in nirvdrum-rubber-2.0.0.rails3.beta6

- old
+ new

@@ -8,11 +8,11 @@ class Instance attr_reader :file, :artifacts include Enumerable def initialize(file) - LOGGER.debug{"Reading rubber instances from #{file}"} + Rubber.logger.debug{"Reading rubber instances from #{file}"} @file = file @items = {} @artifacts = {'volumes' => {}, 'static_ips' => {}} if ENV['FILTER'] @filters = ENV['FILTER'].split(/\s*,\s*/) @@ -80,10 +80,11 @@ attr_accessor :roles, :zone attr_accessor :external_host, :external_ip attr_accessor :internal_host, :internal_ip attr_accessor :static_ip, :volumes, :partitions attr_accessor :spot_instance_request_id + attr_accessor :platform def initialize(name, domain, roles, instance_id, security_group_list=[]) @name = name @domain = domain @roles = roles @@ -95,9 +96,18 @@ "#@name.#@domain" end def role_names() roles.collect {|r| r.name} + end + + def platform + # Deal with old instance configurations that don't have a platform value persisted. + @platform || 'linux' + end + + def windows? + platform == 'windows' end end # The configuration for a single role contained in the list # of roles in InstanceItem