pupistry 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/pupistry/agent.rb +1 -0
- data/lib/pupistry/artifact.rb +13 -2
- data/lib/pupistry/storage_aws.rb +24 -0
- data/lib/pupistry/version.rb +1 -1
- data/resources/aws/README_AWS.md +1 -1
- data/resources/aws/cfn_pupistry_bucket_and_iam.template +5 -7
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 191ed356e73fb20bf75c7cf3b42a6d39dec77a9e
|
4
|
+
data.tar.gz: 2379cc4af18613e37b14cf9569347c914b7f34e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f941399858b331deb102914b56bbb854a52d97bd7c835dcf82253813c6581b00d50ec31caf72c7f69c2adefe983360f0fbb56a5e49ac4fe1ca40e6bd32192ecb
|
7
|
+
data.tar.gz: 9e66e9dc688d9e8b2b2de57ea04cb48953841a369ebba025f2ad257f505d117e3635ee4703d4634c3017e406418367279d9cdbe84caaefcea49118744c1718ae
|
data/README.md
CHANGED
@@ -387,7 +387,7 @@ Note that the node initialisation process is still susceptable to weaknesses
|
|
387
387
|
such as a bug in a new version of Puppet or Pupistry, or changes to the OS
|
388
388
|
packages. If this is a concern/issue for you and you want complete reliability,
|
389
389
|
then use the user data to build a host pre-loaded with Puppet and Pupistry and
|
390
|
-
then create an image of it using a tool like [Packer](www.packer.io). Doing
|
390
|
+
then create an image of it using a tool like [Packer](http://www.packer.io/). Doing
|
391
391
|
this, you can make it possible to build all the way to Puppet execution with no
|
392
392
|
dependencies on any third parties other than your VM provider and AWS S3.
|
393
393
|
|
data/lib/pupistry/agent.rb
CHANGED
@@ -136,6 +136,7 @@ module Pupistry
|
|
136
136
|
puppet_cmd = 'puppet apply'
|
137
137
|
|
138
138
|
puppet_cmd += ' --noop' if options[:noop]
|
139
|
+
puppet_cmd += ' --show_diff' if options[:verbose]
|
139
140
|
|
140
141
|
puppet_cmd += " --environment #{environment}"
|
141
142
|
puppet_cmd += " --confdir #{$config['agent']['puppetcode']}"
|
data/lib/pupistry/artifact.rb
CHANGED
@@ -6,6 +6,7 @@ require 'time'
|
|
6
6
|
require 'digest'
|
7
7
|
require 'fileutils'
|
8
8
|
require 'base64'
|
9
|
+
require 'whichr'
|
9
10
|
|
10
11
|
module Pupistry
|
11
12
|
# Pupistry::Artifact
|
@@ -279,10 +280,15 @@ module Pupistry
|
|
279
280
|
# Make sure there is a directory to write artifacts into
|
280
281
|
FileUtils.mkdir_p('artifacts')
|
281
282
|
|
283
|
+
# Try to use GNU tar if present to work around weird issues with some
|
284
|
+
# versions of BSD tar when using the tar files with GNU tar subsequently.
|
285
|
+
tar = RubyWhich.new.which('gtar').first || RubyWhich.new.which('gnutar').first || 'tar'
|
286
|
+
$logger.debug "Using tar at #{tar}"
|
287
|
+
|
282
288
|
# Build the tar file - we delibertly don't compress in a single step
|
283
289
|
# so that we can grab the checksum, since checksum will always differ
|
284
290
|
# post-compression.
|
285
|
-
unless system "tar -c --exclude '.git' -f artifacts/artifact.temp.tar puppetcode/*"
|
291
|
+
unless system "#{tar} -c --exclude '.git' -f artifacts/artifact.temp.tar puppetcode/*"
|
286
292
|
$logger.error 'Unable to create tarball'
|
287
293
|
fail 'An unexpected error occured when executing tar'
|
288
294
|
end
|
@@ -380,7 +386,12 @@ module Pupistry
|
|
380
386
|
# Unpack the archive file
|
381
387
|
FileUtils.mkdir_p($config['general']['app_cache'] + "/artifacts/unpacked.#{@checksum}")
|
382
388
|
Dir.chdir($config['general']['app_cache'] + "/artifacts/unpacked.#{@checksum}") do
|
383
|
-
|
389
|
+
# Try to use GNU tar if present to work around weird issues with some
|
390
|
+
# versions of BSD tar when using the tar files with GNU tar subsequently.
|
391
|
+
tar = RubyWhich.new.which('gtar').first || RubyWhich.new.which('gnutar').first || 'tar'
|
392
|
+
$logger.debug "Using tar at #{tar}"
|
393
|
+
|
394
|
+
if system "#{tar} -xf ../artifact.#{@checksum}.tar.gz"
|
384
395
|
$logger.debug "Successfully unpacked artifact #{@checksum}"
|
385
396
|
else
|
386
397
|
$logger.error "Unable to unpack artifact files to #{Dir.pwd}"
|
data/lib/pupistry/storage_aws.rb
CHANGED
@@ -119,6 +119,30 @@ module Pupistry
|
|
119
119
|
$logger.fatal "Access to S3 bucket #{$config['general']['s3_bucket']} denied"
|
120
120
|
exit 0
|
121
121
|
|
122
|
+
rescue AWS::S3::Errors::InvalidObjectState
|
123
|
+
$logger.warn "Unable to download \"#{src}\", it has been archived off into Glacier and would need to be recovered first."
|
124
|
+
|
125
|
+
# Do we need to restore it?
|
126
|
+
begin
|
127
|
+
if s3_obj.restore_in_progress?
|
128
|
+
$logger.warn "A restore of this file is currently in progress, but can take up to 4 hours - please re-try later."
|
129
|
+
else
|
130
|
+
# Not being restored currently, let's file a request. This allows
|
131
|
+
# us to cater for situations where a bunch of servers need to get
|
132
|
+
# an old manifest/file, however the fastest solution is to simply
|
133
|
+
# do a new `pupistry push` from a workstation to upload a new
|
134
|
+
# manifest file.
|
135
|
+
if s3_obj.restore(:days => 30)
|
136
|
+
$logger.warn "Recover request has been issued, this could take up to 4 hours to complete."
|
137
|
+
$logger.warn "Note that doing a `pupistry push` from the workstation would solve this faster."
|
138
|
+
end
|
139
|
+
end
|
140
|
+
rescue StandardError => e
|
141
|
+
$logger.error "Glacier restore request for #{src} failed. (#{e.class}), best option is to push the latest manifest from a workstation with `pupistry push`."
|
142
|
+
end
|
143
|
+
|
144
|
+
return false
|
145
|
+
|
122
146
|
rescue AWS::S3::Errors::PermanentRedirect => e
|
123
147
|
$logger.error "The wrong endpoint has been specified (or autodetected) for #{$config['general']['s3_bucket']}."
|
124
148
|
raise e
|
data/lib/pupistry/version.rb
CHANGED
data/resources/aws/README_AWS.md
CHANGED
@@ -34,7 +34,7 @@ Building the stack and setting specific parameter values
|
|
34
34
|
--parameters \
|
35
35
|
ParameterKey=S3BucketName,ParameterValue=pupistry-example-bucket \
|
36
36
|
ParameterKey=S3BucketArchive,ParameterValue=30 \
|
37
|
-
ParameterKey=S3BucketPurge,ParameterValue=
|
37
|
+
ParameterKey=S3BucketPurge,ParameterValue=365
|
38
38
|
|
39
39
|
|
40
40
|
|
@@ -58,11 +58,7 @@
|
|
58
58
|
{
|
59
59
|
"Status": "Enabled",
|
60
60
|
"Prefix": "manifest.",
|
61
|
-
"ExpirationInDays": { "Ref" : "S3BucketPurge" }
|
62
|
-
"Transition": {
|
63
|
-
"StorageClass": "Glacier",
|
64
|
-
"TransitionInDays": { "Ref" : "S3BucketArchive" }
|
65
|
-
}
|
61
|
+
"ExpirationInDays": { "Ref" : "S3BucketPurge" }
|
66
62
|
}]
|
67
63
|
}
|
68
64
|
},
|
@@ -94,7 +90,8 @@
|
|
94
90
|
{
|
95
91
|
"Effect":"Allow",
|
96
92
|
"Action":[
|
97
|
-
"s3:GetObject"
|
93
|
+
"s3:GetObject",
|
94
|
+
"s3:RestoreObject"
|
98
95
|
],
|
99
96
|
"Resource": [{ "Fn::Join" : ["", [ "arn:aws:s3:::", { "Ref" : "S3Bucket" } , "/*" ] ] }]
|
100
97
|
}
|
@@ -137,7 +134,8 @@
|
|
137
134
|
"Effect":"Allow",
|
138
135
|
"Action":[
|
139
136
|
"s3:PutObject",
|
140
|
-
"s3:GetObject"
|
137
|
+
"s3:GetObject",
|
138
|
+
"s3:RestoreObject"
|
141
139
|
],
|
142
140
|
"Resource": [{ "Fn::Join" : ["", [ "arn:aws:s3:::", { "Ref" : "S3Bucket" } , "/*" ] ] }]
|
143
141
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pupistry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jethro Carr
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: whichr
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: erubis
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|