opsicle 0.16.0 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 93b0ea1f860c25fc05de3ba8bb1b88ea62e3a96f
4
- data.tar.gz: 2c8d8ad2a5aa2c9433b11e456612c6128505f5dc
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZjQ5NzAzZWVmZTUxMTVjMDcxMjU0ZTQ3ZWIwMDNlZGMwMjZiMThlNQ==
5
+ data.tar.gz: !binary |-
6
+ YjhjMDRmNTI0MjMyNGI0ZTc0MDUzOTYyOWEzNDgyZGVjOWFjZDFkYw==
5
7
  SHA512:
6
- metadata.gz: 5febed7681d8adb153cf3c09242526a0f070ca5e577d12499d4bb52503eb61ba618511db499bf254502c7c8766bf88031a85c6ab34360b70d780ca86c6dcda64
7
- data.tar.gz: 13e4c19365c7200c822124ef5958e4ba5973f2d14877614e07e0cab523b23534093c024223945e9c2709365272dd8da475ec69e150028a9885247cdff5fbe445
8
+ metadata.gz: !binary |-
9
+ YmI5ZWJmNDgyMjM0NGQ3YTY0YmVhMzliMDY5NzVjYmE4MmQzYTUxMjA0MTIw
10
+ MjdiOGIxZDM0MzAxYTIzMzE0NWRlZjI4ZWVmMmJhMmIzYjY2Mzc5MmE4NDFk
11
+ MTMxNDkxOTU5ZGFlNTIwMTZiOGZkYjg2NDE3NmEzM2Q0NGU4OWU=
12
+ data.tar.gz: !binary |-
13
+ Njg5YTc4YjE5MzYyYTAyYzBlZmI5MGMyZmFmNGE1OTFhYzU3MWM2NDcxODRl
14
+ OGI2MGNlZDNjYzE0MGU5NmRkMjI5NGQ3MjI3NGQyOTViNmE0N2I0MmNjMjFj
15
+ MWVlODViZWVjOTNlZjY2ZjJhZDZjNjNiYWViNTdlOGEwMDRjODU=
@@ -43,10 +43,19 @@ module Opsicle
43
43
  @user_profile.ssh_username
44
44
  end
45
45
 
46
+ def ssh_ip(instance)
47
+ if client.config.opsworks_config[:internal_ssh_only]
48
+ Output.say "This stack requires a private connection, only using internal IPs."
49
+ instance[:private_ip]
50
+ else
51
+ instance[:elastic_ip] || instance[:public_ip]
52
+ end
53
+ end
54
+
46
55
  def ssh_command(instance, options={})
47
56
  ssh_command = " \"#{options[:"ssh-cmd"].gsub(/'/){ %q(\') }}\"" if options[:"ssh-cmd"] #escape single quotes
48
57
  ssh_options = options[:"ssh-opts"] ? "#{options[:"ssh-opts"]} " : ""
49
- if instance_ip = instance[:elastic_ip] || instance[:public_ip]
58
+ if instance_ip = ssh_ip(instance)
50
59
  ssh_string = "#{ssh_username}@#{instance_ip}"
51
60
  else
52
61
  ssh_string = "#{ssh_username}@#{public_ips.sample} ssh #{instance[:private_ip]}"
@@ -1,3 +1,3 @@
1
1
  module Opsicle
2
- VERSION = "0.16.0"
2
+ VERSION = "0.18.0"
3
3
  end
@@ -72,7 +72,7 @@ module Opsicle
72
72
  subject.execute({ :"ssh-opts" => '-p 234', :"ssh-cmd" => 'cd /srv/www'})
73
73
  end
74
74
 
75
- it "executes sshs through an instance with a public_ip to get to one with a private_ip" do
75
+ it "executes ssh through an instance with a public_ip to get to one with a private_ip" do
76
76
  allow(subject).to receive(:instances) {[
77
77
  { hostname: "host1", elastic_ip: "123.123.123.123" },
78
78
  { hostname: "host2", private_ip: "789.789.789.789" }
@@ -80,6 +80,18 @@ module Opsicle
80
80
  expect(subject).to receive(:system).with("ssh -A -t mrderpyman2014@123.123.123.123 ssh 789.789.789.789")
81
81
  subject.execute
82
82
  end
83
+
84
+ context "when internal_ssh_only is enabled" do
85
+ let(:client) { double(config: double(opsworks_config: {stack_id: "1234", internal_ssh_only: true})) }
86
+ it "ssh to a private_ip " do
87
+ allow(subject).to receive(:instances) {[
88
+ { hostname: "host1", elastic_ip: "123.123.123.123", private_ip: "10.10.10.10"}
89
+ ]}
90
+ expect(subject).to receive(:system).with("ssh mrderpyman2014@10.10.10.10")
91
+ expect(Output).to receive(:say).with("This stack requires a private connection, only using internal IPs.")
92
+ subject.execute
93
+ end
94
+ end
83
95
  end
84
96
 
85
97
  context "#client" do
@@ -111,6 +123,26 @@ module Opsicle
111
123
  end
112
124
  end
113
125
 
126
+ context "#ssh_ip" do
127
+ let(:instance) { { hostname: "host1", elastic_ip: "123.123.123.123", public_ip: "123.345.567.789", private_ip: "10.10.10.10" } }
128
+ context "when internal_ssh_only is enabled" do
129
+ let(:client) { double(config: double(opsworks_config: {stack_id: "1234", internal_ssh_only: true})) }
130
+ it "returns an internal IP" do
131
+ expect(Output).to receive(:say).with("This stack requires a private connection, only using internal IPs.")
132
+ expect(subject.ssh_ip(instance)).to eq("10.10.10.10")
133
+ end
134
+ end
135
+ context "when internal_ssh_only is not enabled" do
136
+ it "returns elastic IP if it is present" do
137
+ expect(subject.ssh_ip(instance)).to eq("123.123.123.123")
138
+ end
139
+ it "returns a public IP if there is no elastic ip" do
140
+ instance.delete(:elastic_ip)
141
+ expect(subject.ssh_ip(instance)).to eq("123.345.567.789")
142
+ end
143
+ end
144
+ end
145
+
114
146
  context "#public_ips" do
115
147
  it "selects all EIPs and then public_ip on the stack" do
116
148
  allow(subject).to receive(:instances) {[
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opsicle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Fleener
@@ -9,174 +9,174 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-05-19 00:00:00.000000000 Z
12
+ date: 2015-12-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ~>
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.30'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ~>
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1.30'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: gli
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ~>
33
33
  - !ruby/object:Gem::Version
34
34
  version: '2.9'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ~>
40
40
  - !ruby/object:Gem::Version
41
41
  version: '2.9'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: highline
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ~>
47
47
  - !ruby/object:Gem::Version
48
48
  version: '1.6'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ~>
54
54
  - !ruby/object:Gem::Version
55
55
  version: '1.6'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: terminal-table
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - "~>"
60
+ - - ~>
61
61
  - !ruby/object:Gem::Version
62
62
  version: '1.4'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "~>"
67
+ - - ~>
68
68
  - !ruby/object:Gem::Version
69
69
  version: '1.4'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: minitar
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - "~>"
74
+ - - ~>
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0.5'
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - "~>"
81
+ - - ~>
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0.5'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: hashdiff
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - "~>"
88
+ - - ~>
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0.2'
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - "~>"
95
+ - - ~>
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0.2'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: curses
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - "~>"
102
+ - - ~>
103
103
  - !ruby/object:Gem::Version
104
104
  version: '1.0'
105
105
  type: :runtime
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - "~>"
109
+ - - ~>
110
110
  - !ruby/object:Gem::Version
111
111
  version: '1.0'
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: bundler
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - "~>"
116
+ - - ~>
117
117
  - !ruby/object:Gem::Version
118
118
  version: '1.3'
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - "~>"
123
+ - - ~>
124
124
  - !ruby/object:Gem::Version
125
125
  version: '1.3'
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: rake
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - "~>"
130
+ - - ~>
131
131
  - !ruby/object:Gem::Version
132
132
  version: '10.1'
133
133
  type: :development
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
- - - "~>"
137
+ - - ~>
138
138
  - !ruby/object:Gem::Version
139
139
  version: '10.1'
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: rspec
142
142
  requirement: !ruby/object:Gem::Requirement
143
143
  requirements:
144
- - - "~>"
144
+ - - ~>
145
145
  - !ruby/object:Gem::Version
146
146
  version: 3.0.0.beta2
147
147
  type: :development
148
148
  prerelease: false
149
149
  version_requirements: !ruby/object:Gem::Requirement
150
150
  requirements:
151
- - - "~>"
151
+ - - ~>
152
152
  - !ruby/object:Gem::Version
153
153
  version: 3.0.0.beta2
154
154
  - !ruby/object:Gem::Dependency
155
155
  name: guard
156
156
  requirement: !ruby/object:Gem::Requirement
157
157
  requirements:
158
- - - "~>"
158
+ - - ~>
159
159
  - !ruby/object:Gem::Version
160
160
  version: '2.5'
161
161
  type: :development
162
162
  prerelease: false
163
163
  version_requirements: !ruby/object:Gem::Requirement
164
164
  requirements:
165
- - - "~>"
165
+ - - ~>
166
166
  - !ruby/object:Gem::Version
167
167
  version: '2.5'
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: guard-rspec
170
170
  requirement: !ruby/object:Gem::Requirement
171
171
  requirements:
172
- - - "~>"
172
+ - - ~>
173
173
  - !ruby/object:Gem::Version
174
174
  version: '4.2'
175
175
  type: :development
176
176
  prerelease: false
177
177
  version_requirements: !ruby/object:Gem::Requirement
178
178
  requirements:
179
- - - "~>"
179
+ - - ~>
180
180
  - !ruby/object:Gem::Version
181
181
  version: '4.2'
182
182
  description: CLI for the opsworks platform
@@ -260,17 +260,17 @@ require_paths:
260
260
  - lib
261
261
  required_ruby_version: !ruby/object:Gem::Requirement
262
262
  requirements:
263
- - - ">="
263
+ - - ! '>='
264
264
  - !ruby/object:Gem::Version
265
265
  version: '0'
266
266
  required_rubygems_version: !ruby/object:Gem::Requirement
267
267
  requirements:
268
- - - ">="
268
+ - - ! '>='
269
269
  - !ruby/object:Gem::Version
270
270
  version: '0'
271
271
  requirements: []
272
272
  rubyforge_project:
273
- rubygems_version: 2.4.2
273
+ rubygems_version: 2.4.6
274
274
  signing_key:
275
275
  specification_version: 4
276
276
  summary: An opsworks specific abstraction on top of the aws sdk