Sha256: 50dcfb2507c50da4e5ca31cf5a2c34b2853a132ade30fbdb303c3336907fb252

Contents?: true

Size: 820 Bytes

Versions: 2

Compression:

Stored size: 820 Bytes

Contents

module Ironfan
  class Dsl

    class Cluster < Ironfan::Dsl::Compute
      collection :facets,       Ironfan::Dsl::Facet,   :resolver => :deep_resolve

      def initialize(attrs={},&block)
        super
        self.cluster_role       Ironfan::Dsl::Role.new(:name => "#{attrs[:name]}-cluster")
        self.realm_name         attrs[:owner].name unless attrs[:owner].nil?
        self.cluster_names      attrs[:owner].cluster_names unless attrs[:owner].nil?
      end

      # Utility method to reference all servers from constituent facets
      def servers
        result = Gorillib::ModelCollection.new(:item_type => Ironfan::Dsl::Server, :key_method => :full_name)
        facets.each {|f| f.servers.each {|s| result << s} }
        result
      end

      def cluster_name
        name
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ironfan-4.12.3 lib/ironfan/dsl/cluster.rb
ironfan-4.12.2 lib/ironfan/dsl/cluster.rb