tunl 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/tunl.rb +7 -7
  2. metadata +3 -3
@@ -17,7 +17,7 @@ end
17
17
 
18
18
 
19
19
  # gem requirements
20
- require 'right_aws'
20
+ require 'aws'
21
21
 
22
22
  # hack to supress annoying log messages from right_aws gem
23
23
  module Tunl
@@ -45,7 +45,7 @@ module Tunl
45
45
  end
46
46
 
47
47
  def ec2
48
- @ec2 ||= RightAws::Ec2.new(config['aws_access_key'],config['aws_secret_key'], :logger => SilentLogger)
48
+ @ec2 ||= Aws::Ec2.new(config['aws_access_key'],config['aws_secret_key'], :logger => SilentLogger)
49
49
  end
50
50
 
51
51
  def key_pair_filepath(name)
@@ -58,7 +58,7 @@ module Tunl
58
58
  key_pair = ec2.create_key_pair("tunl_#{name}")
59
59
  File.open(filepath, 'w') { |f| f.write(key_pair[:aws_material]) }
60
60
  FileUtils.chmod 0400, filepath
61
- rescue RightAws::AwsError => e
61
+ rescue Aws::AwsError => e
62
62
  if e.message =~ /already exists/
63
63
  # WARNING : this could be dangerous.
64
64
  delete_key_pair(name)
@@ -88,7 +88,7 @@ module Tunl
88
88
  def create_security_group(name)
89
89
  log "create", "security group tunl_#{name}"
90
90
  ec2.create_security_group("tunl_#{name}", 'created by tunl gem')
91
- rescue RightAws::AwsError => e
91
+ rescue Aws::AwsError => e
92
92
  if e.message =~ /already exists/
93
93
  return true
94
94
  else
@@ -100,7 +100,7 @@ module Tunl
100
100
  [ 22, 80 ].each do |port|
101
101
  begin
102
102
  ec2.authorize_security_group_IP_ingress("tunl_#{name}", port, port)
103
- rescue RightAws::AwsError => e
103
+ rescue Aws::AwsError => e
104
104
  if e.message =~ /already been authorized/
105
105
  # do nothing
106
106
  else
@@ -140,7 +140,7 @@ module Tunl
140
140
  log "launch", "instance ..."
141
141
  instances = ec2.launch_instances('ami-ed46a784',
142
142
  :key_name => "tunl_#{name}",
143
- :group_ids => "tunl_#{name}",
143
+ :group_ids => ["tunl_#{name}"],
144
144
  :instance_type => 'm1.small',
145
145
  :availability_zone => 'us-east-1a',
146
146
  :user_data => %Q{#!/bin/sh
@@ -179,7 +179,7 @@ module Tunl
179
179
  def delete_instance(name)
180
180
  instance = find_instance(name)
181
181
  log "delete", "instance tunl_#{name} with id #{instance[:aws_instance_id]}"
182
- ec2.terminate_instances(instance[:aws_instance_id])
182
+ ec2.terminate_instances([instance[:aws_instance_id]])
183
183
  end
184
184
 
185
185
  def setup_instance(name)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - David Crockett
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2009-09-30 00:00:00 -06:00
17
+ date: 2010-03-07 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies: []
20
20