ops_worker 0.0.5 → 0.0.6

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.
data/bin/ops_worker CHANGED
@@ -5,6 +5,7 @@ require 'ops_worker/cli'
5
5
 
6
6
  begin
7
7
  OpsWorker::CLI.start()
8
- rescue
8
+ rescue => e
9
+ OpsWorker.logger.error { "Caught error running command: #{e.inspect()}" }
9
10
  exit(1)
10
11
  end
@@ -43,6 +43,10 @@ module OpsWorker
43
43
  def deploy(revision = nil)
44
44
  OpsWorker.logger.info {"Deploying app #{@name} from #{revision || @revision}"}
45
45
 
46
+ if deploying?
47
+ raise StandardError.new("#{@name} is already deploying")
48
+ end
49
+
46
50
  existing_revision = @revision.dup()
47
51
  changing_revisions = revision && revision != existing_revision
48
52
 
@@ -108,6 +112,21 @@ module OpsWorker
108
112
  DeploymentStatus.new(result[:deployment_id], @opsworks_client)
109
113
  end
110
114
 
115
+ # This is a best-efforts way to check if the current system is deploying by seeing if there is a deployment in
116
+ # progress that is running
117
+ def deploying?
118
+ deployments = @opsworks_client.describe_deployments(:app_id => @id)[:deployments]
119
+ if deployments.length > 0
120
+ latest_deployment = deployments.first
121
+
122
+ if latest_deployment[:status] == "running"
123
+ return true
124
+ end
125
+ end
126
+
127
+ false
128
+ end
129
+
111
130
  def app_server_instances
112
131
  online_instances().select do |i|
113
132
  i.layers.any? {|l| l.type == "rails-app" || l.type == "custom"}
@@ -1,3 +1,3 @@
1
1
  module OpsWorker
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ops_worker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: