ec2ssh 3.1.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2d501500de8bca04cf4261c8c97725b215c787e2
4
- data.tar.gz: cbd4138197443a93a89b53be60f19c5e5263ff4b
2
+ SHA256:
3
+ metadata.gz: 82094a4ffb0cc7177a3174c0eb775bb77806541076133d515af86172ecb83bf6
4
+ data.tar.gz: 575e64da09628b5469c974133d2fcde4508498ca07c1a5bc9e55921e4fb9b5ee
5
5
  SHA512:
6
- metadata.gz: 7b82d0e74f4a9332c6a9d375018e3ba3e54f57032a8abd901b218b91287c2bbc2b712276b6af37586b5162aab534e25b281341775cc2bbe190730be4f7af0028
7
- data.tar.gz: 294504a89c81005a6e77958e6d5728dc8cf30bff31f03a054aa57b57f167d96340f314ce38370a00f1e552e8560cd7fb7185c55a28b2462f25642f11c743073b
6
+ metadata.gz: d14febefd3c85a7b3288fc60bf2836b303d3e5b89874c26bed96b4626c78f37fb1ebde3cd0b68f1f335e7330bb963295bef2174e6a1c3efbd44ef4f0cac26b27
7
+ data.tar.gz: 1f001fef1061f9e3ce41abea0984a7f36662699ad7290d945701bfd769c056cbd902661e405698673e5d876cb055cfb5535c4d0dee3cae3510fada99ef12d403
@@ -1,9 +1,11 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0
4
- - 2.1
5
3
  - 2.2
6
- - 2.3.0
4
+ - 2.3
5
+ - 2.4.0
7
6
  - ruby-head
8
7
  script: 'bundle exec rspec spec'
9
- before_install: gem install bundler -v 1.11.2
8
+ before_install: gem install bundler -v 1.14.3
9
+ notifications:
10
+ slack:
11
+ secure: CYxJDs0jJkrgXfbOyHuF+gJtxgK5JjS0GAFRNOlkWlDUmpEErtcnPuBOrlzkIBJS4eXaDOuSvpyRJSuJZJjEhmp94GEI98GEcyvByHuaehUWhzhUrhXstX/gg/Ntt6jiFR5dC6NrRWAnmKb7cDsfvagGAVNAuNzAtX0Z9iXWQDo=
@@ -1,4 +1,8 @@
1
1
  # Change Log
2
+ ## 3.1.1
3
+ * Fix a bug in `--verbose` option (#41)
4
+ Thanks to @adamlazz
5
+
2
6
  ## 3.1.0
3
7
  * Use credentials from `~/.aws/credentials` as default. Credential profiles are set as `profiles` in dotfile.
4
8
  * Revive path option for changing ssh config path (#34)
data/Gemfile CHANGED
@@ -1,6 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
+ gem 'rake', '>= 12.0.0'
4
5
  gem 'rspec', '~> 3.0'
5
6
  gem 'rspec-its', '~> 1.0'
6
7
  gem 'guard-rspec', '~> 4.3'
@@ -8,3 +9,4 @@ gem 'webmock', '~> 1.9'
8
9
  gem 'rb-fsevent', '~> 0.9.1'
9
10
  gem 'timecop', '~> 0.5'
10
11
  gem 'fakefs', '~> 0.6.0', require: 'fakefs/safe'
12
+ gem 'vcr', '~> 3.0'
data/Rakefile CHANGED
@@ -1 +1,4 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+ RSpec::Core::RakeTask.new("spec")
4
+ task :default => :spec
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.homepage = "http://github.com/mirakui/ec2ssh"
12
12
  s.summary = %q{A ssh_config manager for AWS EC2}
13
13
  s.description = %q{ec2ssh is a ssh_config manager for AWS EC2}
14
- s.required_ruby_version = ">= 2.0.0"
14
+ s.required_ruby_version = ">= 2.2.0"
15
15
 
16
16
  s.rubyforge_project = "ec2ssh"
17
17
  s.add_dependency "thor", "~> 0.14"
@@ -0,0 +1,178 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://ec2.us-west-1.amazonaws.com/
6
+ body:
7
+ encoding: UTF-8
8
+ string: Action=DescribeInstances&Filter.1.Name=instance-state-name&Filter.1.Value.1=running&Timestamp=2017-02-11T09%3A25%3A44Z&Version=2014-10-01
9
+ headers:
10
+ Content-Type:
11
+ - application/x-www-form-urlencoded; charset=utf-8
12
+ Accept-Encoding:
13
+ - ''
14
+ Content-Length:
15
+ - '137'
16
+ User-Agent:
17
+ - aws-sdk-ruby/1.66.0 ruby/2.3.3 x86_64-darwin15 memoizing
18
+ Host:
19
+ - ec2.us-west-1.amazonaws.com
20
+ X-Amz-Date:
21
+ - 20170211T092544Z
22
+ X-Amz-Content-Sha256:
23
+ - b522eeb0f435881e058aaba87cf05aad80856e36205835b070f61e3a2cea2f66
24
+ Accept:
25
+ - "*/*"
26
+ response:
27
+ status:
28
+ code: 200
29
+ message: OK
30
+ headers:
31
+ Content-Type:
32
+ - text/xml;charset=UTF-8
33
+ Transfer-Encoding:
34
+ - chunked
35
+ Vary:
36
+ - Accept-Encoding
37
+ Date:
38
+ - Sat, 11 Feb 2017 09:25:44 GMT
39
+ Server:
40
+ - AmazonEC2
41
+ body:
42
+ encoding: UTF-8
43
+ string: |-
44
+ <?xml version="1.0" encoding="UTF-8"?>
45
+ <DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2014-10-01/">
46
+ <requestId>9b40910f-51b7-44e2-b75b-96078a730000</requestId>
47
+ <reservationSet>
48
+ <item>
49
+ <reservationId>r-058c6185fab780000</reservationId>
50
+ <ownerId>000000000000</ownerId>
51
+ <groupSet/>
52
+ <instancesSet>
53
+ <item>
54
+ <instanceId>i-09e547eca106b0000</instanceId>
55
+ <imageId>ami-165a0000</imageId>
56
+ <instanceState>
57
+ <code>16</code>
58
+ <name>running</name>
59
+ </instanceState>
60
+ <privateDnsName>ip-172-31-9-193.us-west-1.compute.internal</privateDnsName>
61
+ <dnsName>ec2-54-215-142-250.us-west-1.compute.amazonaws.com</dnsName>
62
+ <reason/>
63
+ <keyName>aws.pem</keyName>
64
+ <amiLaunchIndex>0</amiLaunchIndex>
65
+ <productCodes/>
66
+ <instanceType>t2.micro</instanceType>
67
+ <launchTime>2017-02-11T09:22:47.000Z</launchTime>
68
+ <placement>
69
+ <availabilityZone>us-west-1c</availabilityZone>
70
+ <groupName/>
71
+ <tenancy>default</tenancy>
72
+ </placement>
73
+ <monitoring>
74
+ <state>disabled</state>
75
+ </monitoring>
76
+ <subnetId>subnet-b02b0000</subnetId>
77
+ <vpcId>vpc-f8790000</vpcId>
78
+ <privateIpAddress>172.31.9.193</privateIpAddress>
79
+ <ipAddress>54.215.142.250</ipAddress>
80
+ <sourceDestCheck>true</sourceDestCheck>
81
+ <groupSet>
82
+ <item>
83
+ <groupId>sg-a83f0000</groupId>
84
+ <groupName>default</groupName>
85
+ </item>
86
+ <item>
87
+ <groupId>sg-4db20000</groupId>
88
+ <groupName>ssh</groupName>
89
+ </item>
90
+ </groupSet>
91
+ <architecture>x86_64</architecture>
92
+ <rootDeviceType>ebs</rootDeviceType>
93
+ <rootDeviceName>/dev/xvda</rootDeviceName>
94
+ <blockDeviceMapping>
95
+ <item>
96
+ <deviceName>/dev/xvda</deviceName>
97
+ <ebs>
98
+ <volumeId>vol-02a0f01045aadbf7f</volumeId>
99
+ <status>attached</status>
100
+ <attachTime>2017-02-11T09:22:48.000Z</attachTime>
101
+ <deleteOnTermination>true</deleteOnTermination>
102
+ </ebs>
103
+ </item>
104
+ </blockDeviceMapping>
105
+ <virtualizationType>hvm</virtualizationType>
106
+ <clientToken>XDpiz1486804967277</clientToken>
107
+ <tagSet>
108
+ <item>
109
+ <key>Role</key>
110
+ <value>ec2ssh-test</value>
111
+ </item>
112
+ <item>
113
+ <key>Name</key>
114
+ <value>ec2ssh-test-02</value>
115
+ </item>
116
+ </tagSet>
117
+ <hypervisor>xen</hypervisor>
118
+ <networkInterfaceSet>
119
+ <item>
120
+ <networkInterfaceId>eni-f79a7ff6</networkInterfaceId>
121
+ <subnetId>subnet-b02b2ef6</subnetId>
122
+ <vpcId>vpc-f879939d</vpcId>
123
+ <description/>
124
+ <ownerId>000000000000</ownerId>
125
+ <status>in-use</status>
126
+ <macAddress>06:05:50:b3:b3:d8</macAddress>
127
+ <privateIpAddress>172.31.9.193</privateIpAddress>
128
+ <privateDnsName>ip-172-31-9-193.us-west-1.compute.internal</privateDnsName>
129
+ <sourceDestCheck>true</sourceDestCheck>
130
+ <groupSet>
131
+ <item>
132
+ <groupId>sg-a83f0000</groupId>
133
+ <groupName>default</groupName>
134
+ </item>
135
+ <item>
136
+ <groupId>sg-4db20000</groupId>
137
+ <groupName>ssh</groupName>
138
+ </item>
139
+ </groupSet>
140
+ <attachment>
141
+ <attachmentId>eni-attach-e6ce6187</attachmentId>
142
+ <deviceIndex>0</deviceIndex>
143
+ <status>attached</status>
144
+ <attachTime>2017-02-11T09:22:47.000Z</attachTime>
145
+ <deleteOnTermination>true</deleteOnTermination>
146
+ </attachment>
147
+ <association>
148
+ <publicIp>54.215.142.250</publicIp>
149
+ <publicDnsName>ec2-54-215-142-250.us-west-1.compute.amazonaws.com</publicDnsName>
150
+ <ipOwnerId>amazon</ipOwnerId>
151
+ </association>
152
+ <privateIpAddressesSet>
153
+ <item>
154
+ <privateIpAddress>172.31.9.193</privateIpAddress>
155
+ <privateDnsName>ip-172-31-9-193.us-west-1.compute.internal</privateDnsName>
156
+ <primary>true</primary>
157
+ <association>
158
+ <publicIp>54.215.142.250</publicIp>
159
+ <publicDnsName>ec2-54-215-142-250.us-west-1.compute.amazonaws.com</publicDnsName>
160
+ <ipOwnerId>amazon</ipOwnerId>
161
+ </association>
162
+ </item>
163
+ </privateIpAddressesSet>
164
+ </item>
165
+ </networkInterfaceSet>
166
+ <iamInstanceProfile>
167
+ <arn>arn:aws:iam::000000000000:instance-profile/ec2ssh-test-role</arn>
168
+ <id>AIPAJF7H4IAXZXXXXXXXX</id>
169
+ </iamInstanceProfile>
170
+ <ebsOptimized>false</ebsOptimized>
171
+ </item>
172
+ </instancesSet>
173
+ </item>
174
+ </reservationSet>
175
+ </DescribeInstancesResponse>
176
+ http_version:
177
+ recorded_at: Sat, 11 Feb 2017 09:25:45 GMT
178
+ recorded_with: VCR 3.0.3
@@ -8,7 +8,7 @@ module Ec2ssh
8
8
  class CLI < Thor
9
9
  class_option :path, banner: "/path/to/ssh_config"
10
10
  class_option :dotfile, banner: '$HOME/.ec2ssh', default: "#{ENV['HOME']}/.ec2ssh"
11
- class_option :verbose, banner: 'enable debug log', default: false
11
+ class_option :verbose, banner: 'enable debug log', type: 'boolean'
12
12
 
13
13
  desc 'init', 'Add ec2ssh mark to ssh_config'
14
14
  def init
@@ -1,3 +1,3 @@
1
1
  module Ec2ssh
2
- VERSION = '3.1.0'
2
+ VERSION = '3.1.1'
3
3
  end
@@ -0,0 +1,91 @@
1
+ require 'spec_helper'
2
+ require 'ec2ssh/ec2_instances'
3
+
4
+ describe 'aws-sdk compatibility' do
5
+ let(:region) { 'us-west-1' }
6
+ let(:root_device) { '/dev/xvda' }
7
+
8
+ let!(:ec2_instances) do
9
+ VCR.use_cassette('ec2-instances') do
10
+ Ec2ssh::Ec2Instances.new(
11
+ {'foo' => {access_key_id: '', secret_access_key: ''}},
12
+ ['us-west-1']
13
+ ).instances('foo')
14
+ end
15
+ end
16
+
17
+ let(:ins) { ec2_instances.first }
18
+
19
+ it { expect(ec2_instances.count).to be == 1 }
20
+
21
+ it { expect(ins.tags['Name']).to match /.+/ }
22
+ it { expect(ins.tags['Role']).to match /.+/ }
23
+ it { expect(ins.ami_launch_index).to be == 0 }
24
+ it { expect(ins.architecture).to be == :x86_64 }
25
+ it { expect(ins.attachments.to_h).to match( root_device => an_instance_of(AWS::EC2::Attachment) ) }
26
+ it { expect(ins.availability_zone).to match /\A#{region}[a-c]\z/ }
27
+ it { expect(ins.block_device_mappings.to_h).to match( root_device => an_instance_of(AWS::EC2::Attachment) ) }
28
+ it do
29
+ expect(ins.block_devices.to_a).to match [{
30
+ device_name: root_device,
31
+ ebs: {
32
+ volume_id: /\Avol-\w+\z/,
33
+ status: 'attached',
34
+ attach_time: an_instance_of(Time),
35
+ delete_on_termination: true
36
+ }
37
+ }]
38
+ end
39
+ it { expect(ins.client_token).to match /\A\w{18}\z/ }
40
+ it { expect(ins.dedicated_tenancy?).to be_falsy }
41
+ it { expect(ins.dns_name).to match /\Aec2-[\d\.\-]+\.#{region}\.compute\.amazonaws\.com\z/ }
42
+ it { expect(ins.ebs_optimized).to be_falsy }
43
+ it do
44
+ expect(ins.group_set.to_a).to all match(
45
+ group_id: /\Asg-\w+\z/,
46
+ group_name: /\A.+\z/,
47
+ )
48
+ end
49
+ it { expect(ins.groups.to_a).to all match(AWS::EC2::SecurityGroup) }
50
+ it { expect(ins.hypervisor).to be == :xen }
51
+ it { expect(ins.iam_instance_profile_arn).to match /\Aarn:aws:iam::\d+:instance-profile\/[\w\-]+\z/ }
52
+ it { expect(ins.iam_instance_profile_id).to match /\A\w{21}\z/ }
53
+ it { expect(ins.id).to match /\Ai-\w+\z/ }
54
+ it { expect(ins.image).to be_a(AWS::EC2::Image) }
55
+ it { expect(ins.image_id).to match /\Aami-\w+\z/ }
56
+ it { expect(ins.instance_id).to match /\Ai-\w+\z/ }
57
+ it { expect(ins.instance_lifecycle).to be_nil }
58
+ it { expect(ins.instance_type).to match /\A[trmci][1248]\.\w+\z/ }
59
+ it { expect(ins.ip_address).to match /\A[\d\.]+\z/ }
60
+ it { expect(ins.kernel_id).to be_nil }
61
+ it { expect(ins.key_name).to match /\A.+\.pem\z/ }
62
+ it { expect(ins.key_pair).to be_a(AWS::EC2::KeyPair) }
63
+ it { expect(ins.launch_time).to be_a(Time) }
64
+ it { expect(ins.monitoring).to be == :disabled }
65
+ it { expect(ins.monitoring_enabled?).to be_falsy }
66
+ it { expect(ins.network_interfaces.to_a).to all match(an_instance_of(AWS::EC2::NetworkInterface)) }
67
+ # it { expect(ins.owner_id).to match /\A\d{12}\z/ }
68
+ it { expect(ins.placement.to_h).to match( availability_zone: /\A#{region}[a-c]\z/, group_name: nil, tenancy: 'default' ) }
69
+ it { expect(ins.platform).to be_nil }
70
+ it { expect(ins.private_dns_name).to match /\Aip-[\w\-]+\.#{region}\.compute\.internal\z/ }
71
+ it { expect(ins.private_ip_address).to match /\A[\d\.]+\z/ }
72
+ it { expect(ins.product_codes).to be == [] }
73
+ it { expect(ins.public_dns_name).to match /\Aec2-[\w\-]+\.#{region}\.compute\.amazonaws\.com\z/ }
74
+ it { expect(ins.public_ip_address).to match /\A[\d\.]+\z/ }
75
+ it { expect(ins.ramdisk_id).to be_nil }
76
+ it { expect(ins.requester_id).to be_nil }
77
+ # it { expect(ins.reservation_id).to match /\Ar-\w+\z/ }
78
+ it { expect(ins.root_device_name).to eq root_device }
79
+ it { expect(ins.root_device_type).to be == :ebs }
80
+ it { expect(ins.security_groups.to_a).to all match(an_instance_of(AWS::EC2::SecurityGroup)) }
81
+ it { expect(ins.spot_instance?).to be_falsy }
82
+ it { expect(ins.state_transition_reason).to be_nil }
83
+ it { expect(ins.status).to be == :running }
84
+ it { expect(ins.status_code).to be == 16 }
85
+ it { expect(ins.subnet).to be_a(AWS::EC2::Subnet) }
86
+ it { expect(ins.subnet_id).to match /\Asubnet-\w+\z/ }
87
+ it { expect(ins.virtualization_type).to be == :hvm }
88
+ it { expect(ins.vpc).to be_a(AWS::EC2::VPC) }
89
+ it { expect(ins.vpc?).to be_truthy }
90
+ it { expect(ins.vpc_id).to match /\Avpc-\w+\z/ }
91
+ end
@@ -2,6 +2,8 @@ require 'spec_helper'
2
2
  require 'ec2ssh/command/migrate'
3
3
 
4
4
  describe Ec2ssh::Command::Migrate do
5
+ include FakeFS::SpecHelpers
6
+
5
7
  describe '#run' do
6
8
  let(:cli) do
7
9
  double(:cli,
@@ -2,6 +2,8 @@ require 'spec_helper'
2
2
  require 'ec2ssh/command/remove'
3
3
 
4
4
  describe Ec2ssh::Command::Remove do
5
+ include FakeFS::SpecHelpers
6
+
5
7
  describe '#run' do
6
8
  let(:command) do
7
9
  described_class.new(cli).tap do |cmd|
@@ -3,6 +3,8 @@ require 'ec2ssh/command/update'
3
3
  require 'ec2ssh/exceptions'
4
4
 
5
5
  describe Ec2ssh::Command::Update do
6
+ include FakeFS::SpecHelpers
7
+
6
8
  describe '#run' do
7
9
  let(:command) do
8
10
  described_class.new(cli).tap do |cmd|
@@ -2,6 +2,8 @@ require 'spec_helper'
2
2
  require 'ec2ssh/migrator'
3
3
 
4
4
  describe Ec2ssh::Migrator do
5
+ include FakeFS::SpecHelpers
6
+
5
7
  subject(:migrator) { described_class.new '/dotfile' }
6
8
 
7
9
  before do
@@ -2,6 +2,8 @@ require 'spec_helper'
2
2
  require 'ec2ssh/ssh_config'
3
3
 
4
4
  describe Ec2ssh::SshConfig do
5
+ include FakeFS::SpecHelpers
6
+
5
7
  let(:path) { Pathname('/ssh_config') }
6
8
 
7
9
  subject(:ssh_config) do
@@ -34,6 +34,10 @@ RSpec.configure do |config|
34
34
  end
35
35
 
36
36
  alias :silence :capture
37
+ end
37
38
 
38
- config.include FakeFS::SpecHelpers
39
+ require 'vcr'
40
+ VCR.configure do |config|
41
+ config.cassette_library_dir = "fixtures/vcr_cassettes"
42
+ config.hook_into :webmock
39
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ec2ssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Issei Naruta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-22 00:00:00.000000000 Z
11
+ date: 2018-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -62,7 +62,6 @@ extra_rdoc_files: []
62
62
  files:
63
63
  - ".gitignore"
64
64
  - ".rspec"
65
- - ".tachikoma.yml"
66
65
  - ".travis.yml"
67
66
  - ChangeLog.md
68
67
  - Gemfile
@@ -74,6 +73,7 @@ files:
74
73
  - bin/ec2ssh
75
74
  - ec2ssh.gemspec
76
75
  - example/example.ec2ssh
76
+ - fixtures/vcr_cassettes/ec2-instances.yml
77
77
  - lib/ec2ssh.rb
78
78
  - lib/ec2ssh/builder.rb
79
79
  - lib/ec2ssh/cli.rb
@@ -88,6 +88,7 @@ files:
88
88
  - lib/ec2ssh/migrator.rb
89
89
  - lib/ec2ssh/ssh_config.rb
90
90
  - lib/ec2ssh/version.rb
91
+ - spec/aws_sdk_compatibility_spec.rb
91
92
  - spec/lib/ec2ssh/builder_spec.rb
92
93
  - spec/lib/ec2ssh/command/init_spec.rb
93
94
  - spec/lib/ec2ssh/command/migrate_spec.rb
@@ -110,7 +111,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
111
  requirements:
111
112
  - - ">="
112
113
  - !ruby/object:Gem::Version
113
- version: 2.0.0
114
+ version: 2.2.0
114
115
  required_rubygems_version: !ruby/object:Gem::Requirement
115
116
  requirements:
116
117
  - - ">="
@@ -118,11 +119,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
119
  version: '0'
119
120
  requirements: []
120
121
  rubyforge_project: ec2ssh
121
- rubygems_version: 2.5.1
122
+ rubygems_version: 2.7.3
122
123
  signing_key:
123
124
  specification_version: 4
124
125
  summary: A ssh_config manager for AWS EC2
125
126
  test_files:
127
+ - spec/aws_sdk_compatibility_spec.rb
126
128
  - spec/lib/ec2ssh/builder_spec.rb
127
129
  - spec/lib/ec2ssh/command/init_spec.rb
128
130
  - spec/lib/ec2ssh/command/migrate_spec.rb
@@ -1 +0,0 @@
1
- strategy: 'bundler'