lib/routes/main.rb in gaptool-server-0.3.6 vs lib/routes/main.rb in gaptool-server-0.3.7
- old
+ new
@@ -73,17 +73,13 @@
post '/terminate' do
data = JSON.parse request.body.read
AWS.config(:access_key_id => $redis.hget('config', 'aws_id'), :secret_access_key => $redis.hget('config', 'aws_secret'), :ec2_endpoint => "ec2.#{data['zone']}.amazonaws.com")
@ec2 = AWS::EC2.new
- begin
- @instance = @ec2.instances[data['id']]
- res = @instance.terminate
- res = $redis.del($redis.keys("*#{data['id']}"))
- out = {data['id'] => {'status'=> 'terminated'}}
- rescue
- error 404
- end
+ @instance = @ec2.instances[data['id']]
+ res = @instance.terminate
+ res = $redis.del($redis.keys("*#{data['id']}"))
+ out = {data['id'] => {'status'=> 'terminated'}}
out.to_json
end
put '/register' do
data = JSON.parse request.body.read