puppet-masterless 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/puppet-masterless +15 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efe72dcfd1e767ad585ab7877714c2d5ce25560f524a4a754575c5cb484078d1
|
4
|
+
data.tar.gz: f7db589d57432b964c237e7b9f913e0d7fb3a361eb5064fc47ea5b992b1e9dcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a2985ea7c98b601e58476caaf773974a99e1e346c2fa07e51cd5fa4be0f26957b544af9f85a4a3afc56adf1f08374e4c0876c19bffa04e13ea5c942c7f0b4ae
|
7
|
+
data.tar.gz: c79f6b79db153787060c2fbdd46dc5913341ccd64c947ddd8bcef4179f7391aae59703944571875a5d7ea8eddddbb53addaa99ccfe305dad92d1abe6f606e7a2
|
data/bin/puppet-masterless
CHANGED
@@ -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
|
82
|
-
when 'manifest' then @manifest = args
|
83
|
-
when 'modulepath' then @modulepath = args
|
84
|
-
when 'hiera_config' then @hiera_config = args
|
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
|
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
|