opzworks 0.11.1 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +7 -7
- data/lib/opzworks/commands/berks.rb +28 -3
- data/lib/opzworks/meta.rb +1 -1
- data/opzworks.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f740b238f93e2c1ddfec5ef71c0686656569b4d6
|
4
|
+
data.tar.gz: dc99860d8e4cd003523845d78a7c3552c6c6fd84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a2f20a5c0938a6c0289cdd919fba88e040f4bcc9a9c81faa79911ca8e5b2f0029ce0a86bec0255f6c7f8813b2a83b1c77d4c14eb2ba4f6d3ddb93bc7cdbe0dc
|
7
|
+
data.tar.gz: 8f6bd7aef86c74bb4d03367dee0ccf61db4b1cbc230ee310cf9d9faffd1843e2932488e271487be54dff8fe4443589f4d7f2962ff99b4d8cc797cd7511c41071
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
opzworks (0.11.
|
5
|
-
aws-sdk (~> 2.2.
|
4
|
+
opzworks (0.11.1)
|
5
|
+
aws-sdk (~> 2.2.37)
|
6
6
|
diffy (~> 3.1.0)
|
7
7
|
faraday (~> 0.9.2)
|
8
8
|
inifile (~> 3.0.0)
|
@@ -16,12 +16,12 @@ GEM
|
|
16
16
|
specs:
|
17
17
|
ast (2.2.0)
|
18
18
|
awesome_print (1.6.1)
|
19
|
-
aws-sdk (2.2.
|
20
|
-
aws-sdk-resources (= 2.2.
|
21
|
-
aws-sdk-core (2.2.
|
19
|
+
aws-sdk (2.2.37)
|
20
|
+
aws-sdk-resources (= 2.2.37)
|
21
|
+
aws-sdk-core (2.2.37)
|
22
22
|
jmespath (~> 1.0)
|
23
|
-
aws-sdk-resources (2.2.
|
24
|
-
aws-sdk-core (= 2.2.
|
23
|
+
aws-sdk-resources (2.2.37)
|
24
|
+
aws-sdk-core (= 2.2.37)
|
25
25
|
diffy (3.1.0)
|
26
26
|
faraday (0.9.2)
|
27
27
|
multipart-post (>= 1.2, < 3)
|
@@ -37,6 +37,7 @@ module OpzWorks
|
|
37
37
|
|
38
38
|
aws_credentials_provider = Aws::SharedCredentials.new(profile_name: config.aws_profile)
|
39
39
|
s3 = Aws::S3::Resource.new(region: config.aws_region, credentials: aws_credentials_provider)
|
40
|
+
s3_client = Aws::S3::Client.new(region: config.aws_region, credentials: aws_credentials_provider)
|
40
41
|
|
41
42
|
opsworks = Aws::OpsWorks::Client.new(region: config.aws_region, profile: config.aws_profile)
|
42
43
|
response = opsworks.describe_stacks
|
@@ -64,6 +65,7 @@ module OpzWorks
|
|
64
65
|
next if var == false
|
65
66
|
next if options[:clone] == true
|
66
67
|
|
68
|
+
time = Time.new.utc.strftime("%FT%TZ")
|
67
69
|
berks_cook_path = config.berks_base_path || '/tmp'
|
68
70
|
cook_path = "#{berks_cook_path}/#{@project}-#{@branch}"
|
69
71
|
cookbook_tarball = config.berks_tarball_name || 'cookbooks.tgz'
|
@@ -110,14 +112,37 @@ module OpzWorks
|
|
110
112
|
puts "\nCommitting changes and pushing".foreground(:blue)
|
111
113
|
system "cd #{@target_path} && git commit -am 'berks update'; git push origin #{@branch}"
|
112
114
|
|
113
|
-
#
|
115
|
+
# backup previous if it exists
|
114
116
|
#
|
115
|
-
|
117
|
+
begin
|
118
|
+
s3_client.head_object(
|
119
|
+
bucket: s3_bucket,
|
120
|
+
key: "#{@s3_path}/#{cookbook_tarball}"
|
121
|
+
)
|
122
|
+
rescue Aws::S3::Errors::ServiceError => e
|
123
|
+
puts "No existing #{cookbook_tarball} in #{s3_bucket} to backup, continuing...".foreground(:yellow)
|
124
|
+
else
|
125
|
+
puts "Backing up #{cookbook_tarball} to #{@s3_path}/#{cookbook_tarball}-#{time}".foreground(:green)
|
126
|
+
begin
|
127
|
+
s3_client.copy_object(
|
128
|
+
key: "#{@s3_path}/#{cookbook_tarball}-#{time}",
|
129
|
+
bucket: s3_bucket,
|
130
|
+
copy_source: "#{s3_bucket}/#{@s3_path}/#{cookbook_tarball}"
|
131
|
+
)
|
132
|
+
rescue Aws::S3::Errors::ServiceError => e
|
133
|
+
puts "Caught exception trying to backup existing #{cookbook_tarball} in #{s3_bucket}:".foreground(:red)
|
134
|
+
puts "\t#{e}"
|
135
|
+
abort
|
136
|
+
end
|
137
|
+
end
|
116
138
|
|
139
|
+
# upload
|
117
140
|
begin
|
141
|
+
puts "\nUploading to S3".foreground(:blue)
|
142
|
+
|
118
143
|
obj = s3.bucket(s3_bucket).object("#{@s3_path}/#{cookbook_tarball}")
|
119
144
|
obj.upload_file(cookbook_upload)
|
120
|
-
rescue
|
145
|
+
rescue Aws::S3::Errors::ServiceError => e
|
121
146
|
puts "Caught exception while uploading to S3 bucket #{s3_bucket}:".foreground(:red)
|
122
147
|
puts "\t#{e}"
|
123
148
|
puts "\nCleaning up before exiting".foreground(:blue)
|
data/lib/opzworks/meta.rb
CHANGED
data/opzworks.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
26
26
|
spec.require_paths = ['lib']
|
27
27
|
|
28
|
-
spec.add_dependency 'aws-sdk', '~> 2.2.
|
28
|
+
spec.add_dependency 'aws-sdk', '~> 2.2.37'
|
29
29
|
spec.add_dependency 'trollop', '~> 2.0'
|
30
30
|
spec.add_dependency 'inifile', '~> 3.0.0'
|
31
31
|
spec.add_dependency 'diffy', '~> 3.1.0'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opzworks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grant Heffernan
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-04-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 2.2.
|
20
|
+
version: 2.2.37
|
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
|
-
version: 2.2.
|
27
|
+
version: 2.2.37
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: trollop
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|