Sha256: db2f09c3cbda293eb76297d83d0afe6d46f3890d4c26161484c502308aec43ed

Contents?: true

Size: 1.13 KB

Versions: 9

Compression:

Stored size: 1.13 KB

Contents

module Ironfan
  class Dsl

    class Cluster < Ironfan::Dsl::Compute
      collection :facets,       Ironfan::Dsl::Facet,   :resolver => :deep_resolve
      include Ironfan::Plugin::Base; register_with Ironfan::Dsl::Realm

      def children
        facets.to_a + components.to_a
      end

      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

      def self.plugin_hook owner, attrs, plugin_name, full_name, &blk
        owner.cluster(plugin_name, new(attrs.merge(name: full_name, owner: owner)))
        _project cluster, &blk
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ironfan-5.0.11 lib/ironfan/dsl/cluster.rb
ironfan-5.0.10 lib/ironfan/dsl/cluster.rb
ironfan-5.0.8 lib/ironfan/dsl/cluster.rb
ironfan-5.0.5 lib/ironfan/dsl/cluster.rb
ironfan-5.0.4 lib/ironfan/dsl/cluster.rb
ironfan-5.0.3 lib/ironfan/dsl/cluster.rb
ironfan-5.0.2 lib/ironfan/dsl/cluster.rb
ironfan-5.0.1 lib/ironfan/dsl/cluster.rb
ironfan-5.0.0 lib/ironfan/dsl/cluster.rb