Sha256: 27fec00d96efe14080185408e306eaac35a12fda206bceb95b2575d5d4a8c2d6

Contents?: true

Size: 1.79 KB

Versions: 44

Compression:

Stored size: 1.79 KB

Contents

#
# Author:: Philip (flip) Kromer (<flip@infochimps.com>)
# Copyright:: Copyright (c) 2011 Infochimps, Inc
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require File.expand_path('ironfan_knife_common', File.dirname(File.realdirpath(__FILE__)))

class Chef
  class Knife
    class ClusterList < Knife
      include Ironfan::KnifeCommon

      deps do
        require 'formatador'
      end

      banner 'knife cluster list (options)'

      option :facets,
        :long        => '--with-facets',
        :short       => '-f',
        :description => 'List cluster facets along with names and paths',
        :default     => false,
        :boolean     => true
      
      def run
        load_ironfan
        configure_dry_run

        data = Ironfan.cluster_filenames.map do |name, path|
          as_table = { :cluster => name, :path => path }
          if config[:facets]
            facets = Ironfan.load_cluster(name).facets.to_a.map(&:name).join(', ')
            as_table.merge!(:facets => facets)
          end
          as_table
        end

        ui.info "Cluster Path: #{ Ironfan.cluster_path.join ", " }"
        headers = config[:facets] ? [:cluster, :facets, :path] : [:cluster, :path] 
        Formatador.display_compact_table(data, headers)
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
ironfan-4.12.3 lib/chef/knife/cluster_list.rb
ironfan-4.12.2 lib/chef/knife/cluster_list.rb
ironfan-4.12.1 lib/chef/knife/cluster_list.rb
ironfan-4.12.0 lib/chef/knife/cluster_list.rb
ironfan-4.11.5 lib/chef/knife/cluster_list.rb
ironfan-4.11.4 lib/chef/knife/cluster_list.rb
ironfan-4.11.3 lib/chef/knife/cluster_list.rb
ironfan-4.11.2 lib/chef/knife/cluster_list.rb
ironfan-4.11.2.pre3 lib/chef/knife/cluster_list.rb
ironfan-4.11.2.pre2 lib/chef/knife/cluster_list.rb
ironfan-4.11.2.pre lib/chef/knife/cluster_list.rb
ironfan-4.11.1 lib/chef/knife/cluster_list.rb
ironfan-4.11.0 lib/chef/knife/cluster_list.rb
ironfan-4.10.4 lib/chef/knife/cluster_list.rb
ironfan-4.10.3 lib/chef/knife/cluster_list.rb
ironfan-4.10.2 lib/chef/knife/cluster_list.rb
ironfan-4.10.1 lib/chef/knife/cluster_list.rb
ironfan-4.9.10 lib/chef/knife/cluster_list.rb
ironfan-4.9.9 lib/chef/knife/cluster_list.rb
ironfan-4.9.8 lib/chef/knife/cluster_list.rb