raiseArgumentError,"archive path must be absolute: #{value}"
end
end
end
newparam(:filename)do
desc'archive file name (derived from path).'
end
newparam(:extract)do
desc'whether archive will be extracted after download (true|false).'
newvalues(:true,:false)
defaultto(:false)
end
newparam(:extract_path)do
desc'target folder path to extract archive.'
validatedo|value|
unlessPuppet::Util.absolute_path?value
raiseArgumentError,"archive extract_path must be absolute: #{value}"
end
end
end
newparam(:extract_command)do
desc"custom extraction command ('tar xvf example.tar.gz'), also support sprintf format ('tar xvf %s') which will be processed with the filename: sprintf('tar xvf %s', filename)"
end
newparam(:extract_flags)do
desc"custom extraction options, this replaces the default flags. A string such as 'xvf' for a tar file would replace the default xf flag. A hash is useful when custom flags are needed for different platforms. {'tar' => 'xzf', '7z' => 'x -aot'}."
defaultto(:undef)
end
newproperty(:creates)do
desc'if file/directory exists, will not download/extract archive.'
defshould_to_s(value)
"extracting in #{resource[:extract_path]} to create #{value}"
end
end
newparam(:cleanup)do
desc'whether archive file will be removed after extraction (true|false).'