opsicle 0.8.1 → 0.8.2
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.
- checksums.yaml +4 -4
- data/bin/opsicle +1 -0
- data/lib/opsicle/commands/ssh.rb +3 -2
- data/lib/opsicle/monitor/app.rb +11 -3
- data/lib/opsicle/version.rb +1 -1
- data/spec/opsicle/commands/ssh_spec.rb +2 -2
- data/spec/opsicle/monitor/app_spec.rb +11 -5
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b201eac6aa239dec9378f67aa1c34a03898eac11
|
4
|
+
data.tar.gz: be6e9ece12c51bd6d7c47b8bed9bac8fc8510ca2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d1136716ed8666abb86979193ae285c5fd3d50534ca111a960d2f8ba1cb2334f96f46f5b23ee51c8c378dfdb2f9156a297f38347ed58006cda4e78a0e884ebe
|
7
|
+
data.tar.gz: 2ca94d4ba02f75230c06b1e1e15f549c106f6f26e6ddb60e613d23b13a42de10a4e063e8ee0eee42071c84d4e6a56d74a1d6d1cefbf869ae6b293f9d7521e755
|
data/bin/opsicle
CHANGED
data/lib/opsicle/commands/ssh.rb
CHANGED
@@ -28,8 +28,9 @@ module Opsicle
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def instances
|
31
|
-
client.api_call(:describe_instances, { stack_id: client.config.opsworks_config[:stack_id] })
|
32
|
-
|
31
|
+
@instances ||= client.api_call(:describe_instances, { stack_id: client.config.opsworks_config[:stack_id] })
|
32
|
+
.data[:instances]
|
33
|
+
.select { |instance| instance[:status].to_s == 'online'}
|
33
34
|
end
|
34
35
|
|
35
36
|
def ssh_username
|
data/lib/opsicle/monitor/app.rb
CHANGED
@@ -62,13 +62,15 @@ module Opsicle
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
def stop(
|
65
|
+
def stop(options={})
|
66
|
+
options = { error: nil, message: "" }.merge(options)
|
67
|
+
|
66
68
|
@running = false
|
67
69
|
wakey_wakey
|
68
70
|
@screen.close
|
69
71
|
@screen = nil # Ruby curses lib doesn't have closed?(), so we set to nil, just in case
|
70
72
|
|
71
|
-
raise
|
73
|
+
options[:error] ? raise(options[:error]) : raise(QuitMonitor, options[:message])
|
72
74
|
end
|
73
75
|
|
74
76
|
def restart
|
@@ -167,7 +169,13 @@ module Opsicle
|
|
167
169
|
|
168
170
|
def check_deploy_status
|
169
171
|
unless deploy.running?
|
170
|
-
deploy.failed?
|
172
|
+
if deploy.failed?
|
173
|
+
stop(error: Opsicle::Errors::DeployFailed.new(deploy.command))
|
174
|
+
elsif deploy.successful?
|
175
|
+
stop(message: "Deploy completed successfully")
|
176
|
+
else
|
177
|
+
stop
|
178
|
+
end
|
171
179
|
end
|
172
180
|
end
|
173
181
|
|
data/lib/opsicle/version.rb
CHANGED
@@ -81,8 +81,8 @@ module Opsicle
|
|
81
81
|
it "makes a describe_instances API call" do
|
82
82
|
expect(client).to receive(:api_call).with(:describe_instances, {stack_id: "1234"})
|
83
83
|
.and_return(api_call)
|
84
|
-
expect(api_call).to receive(:data).and_return(instances: {:foo => :bar})
|
85
|
-
expect(subject.instances).to eq({:
|
84
|
+
expect(api_call).to receive(:data).and_return(instances: [{:name => :foo, :status => "online"},{:name => :bar, :status => "stopped"}])
|
85
|
+
expect(subject.instances).to eq([{:name => :foo, :status=>"online"}])
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
@@ -70,15 +70,21 @@ describe Opsicle::Monitor::App do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
context "when called normally" do
|
73
|
-
it "raises QuitMonitor and exits safely" do
|
74
|
-
expect { @app.stop }.to raise_error(Opsicle::Monitor::QuitMonitor)
|
73
|
+
it "raises QuitMonitor and exits safely without a message" do
|
74
|
+
expect { @app.stop }.to raise_error(Opsicle::Monitor::QuitMonitor, "")
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
context "when a message is passed in" do
|
79
|
+
it "raises QuitMonitor and exists with message" do
|
80
|
+
expect { @app.stop(message: "Hey!") }.to raise_error(Opsicle::Monitor::QuitMonitor, "Hey!")
|
75
81
|
end
|
76
82
|
end
|
77
83
|
|
78
84
|
context "when a custom error is passed in" do
|
79
85
|
it "raises the custom error" do
|
80
86
|
MyAwesomeCustomError = Class.new(StandardError)
|
81
|
-
expect { @app.stop(MyAwesomeCustomError) }.to raise_error(MyAwesomeCustomError)
|
87
|
+
expect { @app.stop(error: MyAwesomeCustomError) }.to raise_error(MyAwesomeCustomError)
|
82
88
|
end
|
83
89
|
end
|
84
90
|
end
|
@@ -125,7 +131,7 @@ describe Opsicle::Monitor::App do
|
|
125
131
|
let(:deployment) { double("deployment", :[] => 'successful') }
|
126
132
|
|
127
133
|
it "stops the monitor normally" do
|
128
|
-
expect(@app).to receive(:stop).with(
|
134
|
+
expect(@app).to receive(:stop).with(message: "Deploy completed successfully")
|
129
135
|
@app.send :check_deploy_status
|
130
136
|
end
|
131
137
|
end
|
@@ -134,7 +140,7 @@ describe Opsicle::Monitor::App do
|
|
134
140
|
let(:deployment) { double("deployment", :[] => 'failed') }
|
135
141
|
|
136
142
|
it "stops the monitor with an DeployFailed error" do
|
137
|
-
expect(@app).to receive(:stop).with(Opsicle::Errors::DeployFailed)
|
143
|
+
expect(@app).to receive(:stop).with(error: Opsicle::Errors::DeployFailed)
|
138
144
|
@app.send :check_deploy_status
|
139
145
|
end
|
140
146
|
end
|
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.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Fleener
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-12-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
248
248
|
version: '0'
|
249
249
|
requirements: []
|
250
250
|
rubyforge_project:
|
251
|
-
rubygems_version: 2.
|
251
|
+
rubygems_version: 2.2.2
|
252
252
|
signing_key:
|
253
253
|
specification_version: 4
|
254
254
|
summary: An opsworks specific abstraction on top of the aws sdk
|
@@ -272,3 +272,4 @@ test_files:
|
|
272
272
|
- spec/opsicle/monitor/subpanel_spec.rb
|
273
273
|
- spec/opsicle/s3_bucket_spec.rb
|
274
274
|
- spec/spec_helper.rb
|
275
|
+
has_rdoc:
|