puppet-masterless 0.2.1 → 0.2.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/puppet-masterless +15 -9
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39398dee7f56a25f35d4c3c738c79ee5ae0ccc677d784be4255bdb1bc4aa783c
4
- data.tar.gz: 1569328b4006d0a2bf458c7fb3d70327dae3bb1c3efe6f440777ae45444f3033
3
+ metadata.gz: efe72dcfd1e767ad585ab7877714c2d5ce25560f524a4a754575c5cb484078d1
4
+ data.tar.gz: f7db589d57432b964c237e7b9f913e0d7fb3a361eb5064fc47ea5b992b1e9dcc
5
5
  SHA512:
6
- metadata.gz: 702448913db08532668dde202ce225f321372852dcb6d7bd23928946ba2f182a367294dc64894317313bf5d04aaab0aff562015b44d708912c52406c31e0595d
7
- data.tar.gz: 3b9accb018d6b468a5ae11335719c042382eb3bc9d2e56bd1c0942a965766ab02a2a0a28a7f1ad383e71024b7bb69fe54e22038f6375ee8f0f6be710743ee4c4
6
+ metadata.gz: 0a2985ea7c98b601e58476caaf773974a99e1e346c2fa07e51cd5fa4be0f26957b544af9f85a4a3afc56adf1f08374e4c0876c19bffa04e13ea5c942c7f0b4ae
7
+ data.tar.gz: c79f6b79db153787060c2fbdd46dc5913341ccd64c947ddd8bcef4179f7391aae59703944571875a5d7ea8eddddbb53addaa99ccfe305dad92d1abe6f606e7a2
@@ -78,15 +78,15 @@ module PuppetMasterless
78
78
  while word = args.shift
79
79
  case word
80
80
  when 'with', 'and'
81
- when 'confdir' then @confdir = args.shift
82
- when 'manifest' then @manifest = args.shift
83
- when 'modulepath' then @modulepath = args.shift
84
- when 'hiera_config' then @hiera_config = args.shift
81
+ when 'confdir' then @confdir = collect_file(args)
82
+ when 'manifest' then @manifest = collect_file(args)
83
+ when 'modulepath' then @modulepath = collect_file(args)
84
+ when 'hiera_config' then @hiera_config = collect_file(args)
85
85
  when 'puppet' then @puppet = args.shift
86
86
  when 'sudo' then @sudo = args.shift
87
87
  when 'to' then @hostname = args.shift
88
88
  when 'as' then @user = args.shift
89
- when 'file' then @files << args.shift
89
+ when 'file' then @files << collect_file(args)
90
90
  when '--', nil then @args = args.slice!(0..-1)
91
91
  when 'output' then collect_output(args)
92
92
  else fail 'Invalid argument: ' << word
@@ -117,10 +117,6 @@ module PuppetMasterless
117
117
 
118
118
  @modulepath = nil unless File.directory?(@modulepath)
119
119
  @hiera_config = nil unless File.file?(@hiera_config)
120
-
121
- absolute_paths = [@confdir, @manifest, @modulepath, @hiera_config, *@files].grep(/^\//)
122
-
123
- fail 'File paths must be relative: ' << absolute_paths.first if absolute_paths.any?
124
120
  end
125
121
 
126
122
  def package
@@ -155,6 +151,16 @@ module PuppetMasterless
155
151
  @output = args.shift
156
152
  end
157
153
 
154
+ def collect_file(args)
155
+ path = File.expand_path(file = args.shift)
156
+
157
+ unless path.start_with?(Dir.pwd << '/')
158
+ fail 'All files must be within the current directory: ' << file
159
+ end
160
+
161
+ path.sub(/#{Dir.pwd}\/*/, '')
162
+ end
163
+
158
164
  def archive_command
159
165
  command = "tar -cf- #{ARCHIVE_OPTIONS} --transform 's|^|#{@path.gsub("'", "'\''")}/|'"
160
166
  command << ' ' << @files.shelljoin
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-masterless
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Hanson