lib/kumogata/client.rb in kumogata-0.4.15 vs lib/kumogata/client.rb in kumogata-0.4.16
- old
+ new
@@ -14,14 +14,16 @@
template = open_template(path_or_url)
update_deletion_policy(template)
add_encryption_password(template)
outputs = create_stack(template, stack_name)
- @outputs_filter.filter!(outputs)
- @post_processing.run(:create, outputs)
- outputs
+ unless @options.detach?
+ @outputs_filter.filter!(outputs)
+ @post_processing.run(:create, outputs)
+ outputs
+ end
end
def validate(path_or_url)
template = open_template(path_or_url)
add_encryption_password_for_validation(template)
@@ -58,24 +60,28 @@
template = open_template(path_or_url)
update_deletion_policy(template, :update_metadate => true)
add_encryption_password(template)
outputs = update_stack(template, stack_name)
- @outputs_filter.filter!(outputs)
- @post_processing.run(:update, outputs)
- outputs
+ unless @options.detach?
+ @outputs_filter.filter!(outputs)
+ @post_processing.run(:update, outputs)
+ outputs
+ end
end
def delete(stack_name)
validate_stack_name(stack_name)
if @options.force? or agree("Are you sure you want to delete `#{stack_name}`? ".yellow)
delete_stack(stack_name)
end
- true
+ unless @options.detach?
+ true
+ end
end
def list(stack_name = nil)
validate_stack_name(stack_name)
@@ -208,11 +214,10 @@
end
def evaluate_after_trigger(template)
triggers = template.delete('_after')
return {} unless triggers
-
end
def devaluate_template(template)
exclude_key = proc do |k|
k = k.to_s.gsub('::', '__')
@@ -293,10 +298,13 @@
stack_name.gsub!(/[^-a-zA-Z0-9]+/, '-')
end
Kumogata.logger.info("Creating stack: #{stack_name}".cyan)
stack = @cloud_formation.stacks.create(stack_name, template.to_json, build_create_options)
+
+ return if @options.detach?
+
event_log = {}
unless while_in_progress(stack, 'CREATE_COMPLETE', event_log)
errmsgs = ['Create failed']
errmsgs << stack_name
@@ -322,10 +330,12 @@
Kumogata.logger.info("Updating stack: #{stack_name}".green)
event_log = create_event_log(stack)
stack.update(build_update_options(template.to_json))
+ return if @options.detach?
+
unless while_in_progress(stack, 'UPDATE_COMPLETE', event_log)
errmsgs = ['Update failed']
errmsgs << stack_name
errmsgs << stack.status_reason if stack.status_reason
raise errmsgs.join(': ')
@@ -343,9 +353,11 @@
stack.status
Kumogata.logger.info("Deleting stack: #{stack_name}".red)
event_log = create_event_log(stack)
stack.delete
+
+ return if @options.detach?
completed = false
begin
completed = while_in_progress(stack, 'DELETE_COMPLETE', event_log)