puppet-masterless 0.2.3 → 0.2.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c92e1a6b43a5b98773af8b769d752ec38ab36b6703df0fcb3f5021729b9dbd38
4
- data.tar.gz: ec90a19bb036bd8166a54cdfba7137370560d313e54748926e92c3408125432f
3
+ metadata.gz: 6b3bb17823c02cbfbce76665f5165016bca937dd3eb2f164429a52b3df056a76
4
+ data.tar.gz: fae05d595c946b852bcfd810dbb1218447b0ea67305170e65a2de226f54a1bc1
5
5
  SHA512:
6
- metadata.gz: 371ad6220621c70420885ea853a6cc541489b31257faee85f38d02cab607d6f748c561b0f920232027dc60fde345346f8fad80c5986a6517f2c6eb16a061b58d
7
- data.tar.gz: 752186acfd8d467161ed42845036b14d22bf54690e31d9fa48939783025fdbacdf76738a78a8271224c3aa4893b056776df070cb34cfc8e966477daf86bd772d
6
+ metadata.gz: 07e946316edfbc816f6896384a80fe89b462eed8d797a05227b854c0449945b90eeeafbd35df33596ac7c6e4e180b783ce5be2d19407eef074b59ddaa05bd302
7
+ data.tar.gz: 5670581453e9a6718c76a8274cccb0fe65e99757d8c9fa9d82e412e31f61af3ae9040bab0a3f9abae657b954342c5ccc7d4c9a3cd962d035867236931cbcd35a
@@ -56,18 +56,18 @@ module PuppetMasterless
56
56
  DEFAULT_SUDO = 'sudo'
57
57
  REMOTE_USER = 'root'
58
58
  REMOTE_WORKDIR = '/tmp'
59
- VERSION = %{0.2.3}
59
+ VERSION = %{0.2.4}
60
60
 
61
61
  class Main
62
62
  def initialize
63
63
  @files = []
64
64
  @args = []
65
- @path = ARCHIVE_NAME
65
+ @path = "#{ARCHIVE_NAME}-#{SecureRandom.hex(4)}"
66
+ @output = "#{ARCHIVE_NAME}-#{SecureRandom.hex(4)}"
66
67
  @puppet = DEFAULT_PUPPET
67
68
  @sudo = DEFAULT_SUDO
68
69
  @user = REMOTE_USER
69
70
  @workdir = REMOTE_WORKDIR
70
- @output = "#{ARCHIVE_NAME}-#{SecureRandom.hex(4)}"
71
71
  end
72
72
 
73
73
  def usage(n = 1)
@@ -185,7 +185,8 @@ module PuppetMasterless
185
185
  end
186
186
 
187
187
  def remote_apply_command
188
- "#{@sudo} -u #{@user.shellescape} #{@workdir.shellescape}/#{@output.shellescape}"
188
+ command = "trap 'rm -f #{@workdir.shellescape}/#{@output.shellescape}' EXIT"
189
+ command << "; #{@sudo} -u #{@user.shellescape} #{@workdir.shellescape}/#{@output.shellescape}"
189
190
  end
190
191
 
191
192
  def apply_local
@@ -197,14 +198,15 @@ module PuppetMasterless
197
198
  STDERR.puts("Notice: Creating distribution")
198
199
  create_distribution
199
200
 
200
- STDERR.puts('Notice: Copying to ' << @hostname)
201
- fail 'Copy command failed' unless system("scp -q #{@output.shellescape} #{@hostname.shellescape}:#{@workdir.shellescape}")
201
+ begin
202
+ STDERR.puts('Notice: Copying to ' << @hostname)
203
+ fail 'Copy command failed' unless system("scp -q #{@output.shellescape} #{@hostname.shellescape}:#{@workdir.shellescape}")
204
+ ensure
205
+ FileUtils.rm_f(@output)
206
+ end
202
207
 
203
208
  STDERR.puts('Notice: Applying to ' << @hostname)
204
209
  fail 'Apply command failed' unless system("ssh -q -t #{@hostname.shellescape} #{remote_apply_command.shellescape}")
205
- ensure
206
- FileUtils.rm_f(@output)
207
- system("ssh -q -t #{@hostname.shellescape} rm -f #{@workdir.shellescape}/#{@output.shellescape}")
208
210
  end
209
211
 
210
212
  def create_distribution
@@ -340,8 +342,9 @@ end
340
342
  #1 Defaults to
341
343
  #1 .Dq puppet .
342
344
  #1 .It Cm output file Aq filename
343
- #1 Set the output filename. If not given, a randomly-generated filename in
344
- #1 the current directory is used.
345
+ #1 Set the output filename. If not given, a randomly-generated filename of the form
346
+ #1 .Dq puppet-package-XXXXXXXX
347
+ #1 is used.
345
348
  #1 .Pp
346
349
  #1 Applies only to the
347
350
  #1 .Cm package
@@ -450,7 +453,8 @@ end
450
453
  #1 file location and data directory:
451
454
  #1 .Bd -literal -offset indent
452
455
  #1 puppet-masterless package confdir test \\
453
- #1 with file hiera and hiera_config hiera/test.yaml
456
+ #1 with file hiera and hiera_config hiera/test.yaml \\
457
+ #1 output file puppet.sh
454
458
  #1 .Ed
455
459
  #1 .Pp
456
460
  #1 .Sh CAVEATS
@@ -84,8 +84,9 @@ installed in a directory that is not on the active user's
84
84
  Defaults to
85
85
  .Dq puppet .
86
86
  .It Cm output file Aq filename
87
- Set the output filename. If not given, a randomly-generated filename in
88
- the current directory is used.
87
+ Set the output filename. If not given, a randomly-generated filename of the form
88
+ .Dq puppet-package-XXXXXXXX
89
+ is used.
89
90
  .Pp
90
91
  Applies only to the
91
92
  .Cm package
@@ -194,7 +195,8 @@ project as a shell script, including a non-standard Hiera configuration
194
195
  file location and data directory:
195
196
  .Bd -literal -offset indent
196
197
  puppet-masterless package confdir test \\
197
- with file hiera and hiera_config hiera/test.yaml
198
+ with file hiera and hiera_config hiera/test.yaml \\
199
+ output file puppet.sh
198
200
  .Ed
199
201
  .Pp
200
202
  .Sh CAVEATS
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-masterless
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Hanson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-28 00:00:00.000000000 Z
11
+ date: 2019-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake