awsam 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/awsam/ec2.rb +7 -7
  2. data/lib/awsam/version.rb +1 -1
  3. metadata +4 -4
@@ -17,7 +17,7 @@ module Awsam
17
17
  ec2 = RightAws::Ec2.new(acct.access_key, acct.secret_key,
18
18
  :logger => logger,
19
19
  :endpoint_url => acct.ec2_url)
20
-
20
+
21
21
  unless ec2
22
22
  puts "Unable to connect to EC2"
23
23
  return nil
@@ -25,7 +25,7 @@ module Awsam
25
25
 
26
26
  find(ec2, instance_id)
27
27
  end
28
-
28
+
29
29
  def self.find(ec2, instance_id)
30
30
  if instance_id =~ /^i-[0-9a-f]{8,17}$/
31
31
  find_by_instance_id(ec2, instance_id)
@@ -33,7 +33,7 @@ module Awsam
33
33
  find_by_tag(ec2, instance_id)
34
34
  end
35
35
  end
36
-
36
+
37
37
  def self.find_by_instance_id(ec2, instance_id)
38
38
  begin
39
39
  ec2.describe_instances(instance_id).first
@@ -42,7 +42,7 @@ module Awsam
42
42
  exit 1
43
43
  end
44
44
  end
45
-
45
+
46
46
  def self.find_by_tag(ec2, instance_id)
47
47
  results = []
48
48
 
@@ -59,7 +59,7 @@ module Awsam
59
59
  puts "No tags by this name are available in your account"
60
60
  exit 1
61
61
  end
62
-
62
+
63
63
  results.uniq! { |a| a[:resource_id] }
64
64
  results.sort! { |a,b| a[:value] <=> b[:value] }
65
65
 
@@ -87,7 +87,7 @@ module Awsam
87
87
  results.each_with_index do |elem, i|
88
88
  inst = rmap[elem[:resource_id]]
89
89
  puts "%d) %s (%s, %s, %s, %s)" %
90
- [i, elem[:value], inst[:aws_instance_id],
90
+ [i+1, elem[:value], inst[:aws_instance_id],
91
91
  inst[:aws_instance_type],
92
92
  inst[:aws_availability_zone],
93
93
  inst[:aws_launch_time]]
@@ -99,7 +99,7 @@ module Awsam
99
99
  input = $stdin.gets
100
100
  puts
101
101
  exit unless input =~ /^\d+$/
102
- node = results[input.to_i]
102
+ node = results[input.to_i-1]
103
103
  end
104
104
 
105
105
  return rmap[node[:resource_id]]
@@ -1,3 +1,3 @@
1
1
  module Awsam
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awsam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-12-29 00:00:00.000000000 Z
12
+ date: 2016-03-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: right_aws
@@ -119,7 +119,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
119
  version: '0'
120
120
  segments:
121
121
  - 0
122
- hash: -663979283149504482
122
+ hash: -2225821481215170753
123
123
  required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  none: false
125
125
  requirements:
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  version: '0'
129
129
  segments:
130
130
  - 0
131
- hash: -663979283149504482
131
+ hash: -2225821481215170753
132
132
  requirements: []
133
133
  rubyforge_project:
134
134
  rubygems_version: 1.8.23.2