lib/simple_deploy/stack.rb in simple_deploy-0.4.8 vs lib/simple_deploy/stack.rb in simple_deploy-0.5.0
- old
+ new
@@ -17,14 +17,20 @@
stack.create :attributes => attributes,
:template => args[:template]
end
def update(args)
- @logger.info "Updating #{@name}."
- attributes = stack_attribute_formater.updated_attributes args[:attributes]
- stack.update :attributes => attributes
- @logger.info "Update complete for #{@name}."
+ if !deployment.clear_for_deployment? && args[:force]
+ deployment.clear_deployment_lock true
+ end
+
+ if deployment.clear_for_deployment?
+ @logger.info "Updating #{@name}."
+ attributes = stack_attribute_formater.updated_attributes args[:attributes]
+ stack.update :attributes => attributes
+ @logger.info "Update complete for #{@name}."
+ end
end
def deploy(force = false)
deployment.create_deployment
deployment.execute force
@@ -33,13 +39,18 @@
def ssh
deployment.ssh
end
def destroy
- deployment.create_deployment
- stack.destroy
- @logger.info "#{@name} destroyed."
+ if attributes['protection'] != 'on'
+ stack.destroy
+ @logger.info "#{@name} destroyed."
+ true
+ else
+ @logger.warn "#{@name} could not be destroyed because it is protected. Run the protect subcommand to unprotect it"
+ false
+ end
end
def events(limit)
stack.events limit
end
@@ -85,10 +96,11 @@
:logger => @logger
end
def stack_attribute_formater
@saf ||= StackAttributeFormater.new :config => @config,
- :environment => @environment
+ :environment => @environment,
+ :main_attributes => attributes
end
def deployment
@deployment ||= Stack::Deployment.new :config => @config,
:environment => @environment,