Class: Chef::Knife::CfnUpdate

Inherits:
CfnBase show all
Defined in:
lib/chef/knife/cfn_update.rb

Instance Method Summary collapse

Methods inherited from CfnBase

#connection, included, #locate_config_value, #msg_pair, #validate!

Methods inherited from Chef::Knife

#create_create_def, #create_update_def

Instance Method Details

#runObject



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/chef/knife/cfn_update.rb', line 74

def run
$stdout.sync = true

validate!

stack_name = @name_args[0]
	
	if stack_name.nil?
	  show_usage
	  ui.error("You must specify a stack name")
  exit 1
	end

begin
  response = connection.update_stack(stack_name, create_update_def)
  rescue Excon::Errors::BadRequest => e
    i= e.response.body.index("<Message>")
    j = e.response.body.index("</Message>")
    if !i.nil? and !j.nil?
      ui.error(e.response.body[i+9,j-i-9])
    else
      print "\n#{e.response.body}"
    end
    exit 1
  else
    message = "Stack #{stack_name} update started"
    print "\n#{ui.color(message, :green)}\n"
  end
end