Sha256: 3b2a390bd95052027ccf2f062bc26794cf177ca1975f6f956a3ba16a5169a812
Contents?: true
Size: 1.94 KB
Versions: 16
Compression:
Stored size: 1.94 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_relative '../cluster_knife' 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 Ironfan.dsl_files(Ironfan.clusters_dir).each{ |f| Ironfan.load_dsl_file f } data = Ironfan.clusters.values.map do |cluster| name, path = [cluster.name, cluster.source_file] as_table = { :cluster => name, :path => path } if config[:facets] facets = Ironfan.load_cluster(name).facets.to_a.map do |facet| "#{facet.name}(#{facet.instances})" end.join(', ') as_table.merge!(:facets => facets) end as_table end ui.info "Cluster Path: #{ Ironfan.clusters_dir.join ", " }" headers = config[:facets] ? [:cluster, :facets, :path] : [:cluster, :path] Formatador.display_compact_table(data, headers) end end end end
Version data entries
16 entries across 16 versions & 1 rubygems