class Biosphere::CLI::TerraformPlanning::TerraformPlan
Attributes
items[RW]
Public Class Methods
new()
click to toggle source
# File lib/biosphere/cli/terraformplanning.rb, line 240 def initialize() @items = [] @graph = nil end
Public Instance Methods
get_resources()
click to toggle source
# File lib/biosphere/cli/terraformplanning.rb, line 289 def get_resources() @items.select { |x| x[:action] != :not_picked }.collect { |x| x[:resource_name] } end
has_unpicked_resources()
click to toggle source
# File lib/biosphere/cli/terraformplanning.rb, line 285 def has_unpicked_resources() @items.find_index { |x| x[:action] == :not_picked } != nil end
length()
click to toggle source
# File lib/biosphere/cli/terraformplanning.rb, line 245 def length @items.length end
print(out = STDOUT)
click to toggle source
# File lib/biosphere/cli/terraformplanning.rb, line 249 def print(out = STDOUT) last_target_group = nil @items.sort_by { |a| a[:target_group] }.each do |item| if last_target_group != item[:target_group] if item[:target_group] != "" out.write "\nTarget group: #{item[:target_group]}\n" else out.write "\nNot in any target groups:\n" end last_target_group = item[:target_group] end out.write "\t" out.write "#{item[:resource_name]} " if item[:action] == :create out.write "(#{item[:reason]})".colorize(:green) elsif item[:action] == :relaunch out.write "(#{item[:reason]})".colorize(:yellow) elsif item[:action] == :destroy out.write "(#{item[:reason]})".colorize(:red) elsif item[:action] == :change out.write "(#{item[:reason]})".colorize(:yellow) elsif item[:action] == :not_picked out.write "(#{item[:reason]})".colorize(:yellow) else out.write "(#{item[:reason]}) unknown action: #{item[:action]}".colorize(:red) end out.write "\n" end if has_unpicked_resources() out.write "\nWARNING: Not all resource changes will be applied!".colorize(:yellow) out.write "\nYou need to do \"biosphere commit\" again when you have verified that it is safe to do so!".colorize(:yellow) end end