ops_preflight 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ops_preflight/ops_works/base.rb +5 -3
- data/lib/ops_preflight/ops_works/deploy.rb +5 -5
- data/lib/ops_preflight/ops_works/fetch_environment.rb +3 -3
- data/lib/ops_preflight/server.rb +2 -2
- data/lib/ops_preflight/version.rb +1 -1
- data/ops_preflight.gemspec +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9386bd69b37c9fa2b79cf1db841bc627285c7e5
|
4
|
+
data.tar.gz: 12b980694ffade614c00bc8012b893f9641055aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53b48c27c9f8fc1fc31ef850d015baef914640b43bd59487187316053d60f7e49c1e945852151bff28a9080d569dd8fe8d66622f9f87d617b977f0f633bd39fd
|
7
|
+
data.tar.gz: e558ad62af7c9bf6503dda9855c831b4da9d028ffdf024c6968b865c25f011d127fe8bb583755284c5d988eb4987ba4ea8f502a1e1ffea821f704860188b04f9
|
@@ -1,22 +1,24 @@
|
|
1
1
|
module OpsPreflight
|
2
2
|
module OpsWorks
|
3
3
|
class Base
|
4
|
+
attr_accessor :region
|
4
5
|
attr_accessor :stack_name
|
5
6
|
|
6
|
-
def initialize(stack_name)
|
7
|
+
def initialize(region, stack_name)
|
7
8
|
require 'aws-sdk'
|
8
9
|
|
10
|
+
@region = region
|
9
11
|
@stack_name = stack_name
|
10
12
|
end
|
11
13
|
|
12
14
|
protected
|
13
15
|
def opsworks
|
14
|
-
@opsworks ||=
|
16
|
+
@opsworks ||= Aws::OpsWorks::Client.new(region: @region)
|
15
17
|
end
|
16
18
|
|
17
19
|
def stack_id
|
18
20
|
@stack_id ||= begin
|
19
|
-
resp = opsworks.
|
21
|
+
resp = opsworks.describe_stacks
|
20
22
|
stack = resp[:stacks].find {|stack| stack[:name] == stack_name }
|
21
23
|
|
22
24
|
raise "OpsWorks stack not found!" if stack.nil?
|
@@ -5,8 +5,8 @@ module OpsPreflight
|
|
5
5
|
class Deploy < Base
|
6
6
|
attr_accessor :app_name
|
7
7
|
|
8
|
-
def initialize(stack_name, app_name)
|
9
|
-
super stack_name
|
8
|
+
def initialize(region, stack_name, app_name)
|
9
|
+
super region, stack_name
|
10
10
|
|
11
11
|
@app_name = app_name
|
12
12
|
end
|
@@ -15,7 +15,7 @@ module OpsPreflight
|
|
15
15
|
instances = instance_ids
|
16
16
|
puts "Triggering deploy of v#{release_num} to #{instances.size} instance#{'s' if instances.size != 1}"
|
17
17
|
|
18
|
-
resp = opsworks.
|
18
|
+
resp = opsworks.create_deployment({
|
19
19
|
:stack_id => stack_id,
|
20
20
|
:app_id => app_id,
|
21
21
|
:instance_ids => instances,
|
@@ -29,7 +29,7 @@ module OpsPreflight
|
|
29
29
|
protected
|
30
30
|
def app_id
|
31
31
|
@app_id ||= begin
|
32
|
-
resp = opsworks.
|
32
|
+
resp = opsworks.describe_apps(:stack_id => stack_id)
|
33
33
|
app = resp[:apps].find {|app| app[:name] == app_name}
|
34
34
|
|
35
35
|
raise "OpsWorks app not found!" if app.nil?
|
@@ -39,7 +39,7 @@ module OpsPreflight
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def instance_ids
|
42
|
-
resp = opsworks.
|
42
|
+
resp = opsworks.describe_instances(:stack_id => stack_id)
|
43
43
|
ids = []
|
44
44
|
resp[:instances].each {|instance| ids << instance[:instance_id] if instance[:status] == 'online' }
|
45
45
|
|
@@ -8,15 +8,15 @@ module OpsPreflight
|
|
8
8
|
attr_accessor :app_name
|
9
9
|
attr_accessor :environment
|
10
10
|
|
11
|
-
def initialize(environment, stack_name, app_name)
|
12
|
-
super stack_name
|
11
|
+
def initialize(environment, region, stack_name, app_name)
|
12
|
+
super region, stack_name
|
13
13
|
|
14
14
|
@environment = environment
|
15
15
|
@app_name = app_name
|
16
16
|
end
|
17
17
|
|
18
18
|
def call
|
19
|
-
resp = opsworks.
|
19
|
+
resp = opsworks.describe_stacks(:stack_ids => [stack_id])
|
20
20
|
|
21
21
|
require 'multi_json'
|
22
22
|
|
data/lib/ops_preflight/server.rb
CHANGED
@@ -27,14 +27,14 @@ module OpsPreflight
|
|
27
27
|
def deploy(stack_name, app_name)
|
28
28
|
require 'ops_preflight/ops_works/deploy.rb'
|
29
29
|
|
30
|
-
OpsWorks::Deploy.new(stack_name, app_name).call(options[:release])
|
30
|
+
OpsWorks::Deploy.new('us-east-1', stack_name, app_name).call(options[:release])
|
31
31
|
end
|
32
32
|
|
33
33
|
desc "fetch_environment <environment> <stack_name> <app_name>", 'Fetches environment variables from opsworks'
|
34
34
|
def fetch_environment(environment, stack_name, app_name)
|
35
35
|
require 'ops_preflight/ops_works/fetch_environment.rb'
|
36
36
|
|
37
|
-
OpsWorks::FetchEnvironment.new(environment, stack_name, app_name).call
|
37
|
+
OpsWorks::FetchEnvironment.new(environment, 'us-east-1', stack_name, app_name).call
|
38
38
|
end
|
39
39
|
|
40
40
|
# Fixes thor's banners when used with :default namespace
|
data/ops_preflight.gemspec
CHANGED
@@ -17,9 +17,9 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
20
|
-
gem.add_runtime_dependency('thor', '~> 0.
|
20
|
+
gem.add_runtime_dependency('thor', '~> 0.19.1')
|
21
21
|
gem.add_runtime_dependency('fog', '~> 1.10')
|
22
22
|
gem.add_runtime_dependency('mina', '~> 0.3.0')
|
23
|
-
gem.add_runtime_dependency('aws-sdk', '~>
|
23
|
+
gem.add_runtime_dependency('aws-sdk', '~> 2')
|
24
24
|
gem.add_runtime_dependency('multi_json', '~> 1.0')
|
25
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ops_preflight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Schlesinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.19.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.19.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: fog
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '2'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: multi_json
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
129
|
version: '0'
|
130
130
|
requirements: []
|
131
131
|
rubyforge_project:
|
132
|
-
rubygems_version: 2.
|
132
|
+
rubygems_version: 2.4.3
|
133
133
|
signing_key:
|
134
134
|
specification_version: 4
|
135
135
|
summary: Preflight by packaging the bundle, precompiled assets, or anything else needed
|