Skip to content

Commit 717327b

Browse files
committed
cfg fix
1 parent 85885b9 commit 717327b

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

lib/tasks/eb_fast_deploy.rb

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ def update_eb_environment(options = {})
104104

105105
env = AWS.elastic_beanstalk.client.describe_environments(:application_name=>ENV['APP_NAME'], :environment_names => [ENV['ENVIRONMENT']])[:environments].first
106106

107-
raise "Enviroment status \"#{env[:status]}\" not supported" unless env[:status]=="Terminated" || env[:status]=="Ready"
107+
if (env.present? && !["Terminated", "Ready"].include?(env[:status]))
108+
raise "Enviroment status \"#{env[:status]}\" not supported"
109+
end
108110

109111
unless env.nil? || env[:status]=="Terminated"
110112
if version_label.nil?
@@ -121,7 +123,7 @@ def update_eb_environment(options = {})
121123
puts "New env config"
122124
new_env_config[:configuration_settings].first[:option_settings].each {|opt| puts "(Info) #{opt[:option_name]}=#{opt[:value]}" if opt[:namespace] == "aws:elasticbeanstalk:application:environment" }
123125
puts " ----- END ----- "
124-
else
126+
else
125127
if auto_create
126128
if version_label.nil?
127129
AWS.elastic_beanstalk.client.create_environment(:application_name => ENV['APP_NAME'],
@@ -151,6 +153,10 @@ def set_vars
151153
return if @is_config_loaded
152154
puts "-------------------------------------------------------------"
153155

156+
if (ENV['ENVIRONMENT'].include?("_"))
157+
raise "Value ENV['ENVIRONMENT'] at 'EnvironmentName' failed to satisfy constraint: Member must contain only letters, digits, and the dash character and may not start or end with a dash"
158+
end
159+
154160
@is_config_loaded = true
155161

156162
sha1 = `git log | head -1|cut -d \" \" -f2`
@@ -189,7 +195,7 @@ def rails_options
189195
opts = []
190196
#Default SYSLOG_APPLICATION_NAME
191197
opts << {:namespace => "aws:elasticbeanstalk:application:environment", :option_name =>"SYSLOG_APPLICATION_NAME", :value=>"#{ENV['APP_NAME'].gsub(' ', '')}_#{ENV['ENVIRONMENT'].gsub(' ', '')}"} unless ENV['SYSLOG_APPLICATION_NAME']
192-
198+
193199
@eb_ruby_container_options.each do |k,v|
194200
opts << {:namespace => "aws:elasticbeanstalk:application:environment", :option_name =>k, :value=>v}
195201
end
@@ -286,10 +292,10 @@ def print_env
286292

287293
print "storage = Fog::Storage.new provider: AWS, aws_access_key_id: #{ENV['AWS_ACCESS_KEY_ID']}, aws_secret_access_key: #{ENV['AWS_SECRET_ACCESS_KEY']}\n"
288294
storage = Fog::Storage.new({
289-
provider: 'AWS',
290-
region: ENV['AWS_REGION'],
291-
aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'],
292-
aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
295+
provider: 'AWS',
296+
region: ENV['AWS_REGION'],
297+
aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'],
298+
aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
293299
})
294300
print "bucket = storage.directories.get(#{ENV['AWS_DEPLOY_BUCKET']})\n"
295301
bucket = storage.directories.get(ENV['AWS_DEPLOY_BUCKET'])

0 commit comments

Comments
 (0)