Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validate checksum_url attribute #472

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -461,15 +461,16 @@ archive { '/tmp/staging/master.zip':
* `ensure`: whether archive file should be present/absent (default: present)
* `path`: namevar, archive file fully qualified file path.
* `filename`: archive file name (derived from path).
* `source`: archive file source, supports http|https|ftp|file|s3|gs uri.
* `source`: archive file source, supports puppet|http|https|ftp|file|s3|gs uri.
* `username`: username to download source file.
* `password`: password to download source file.
* `allow_insecure`: Ignore HTTPS certificate errors (true|false). (default: false)
* `cookie`: archive file download cookie.
* `checksum_type`: archive file checksum type (none|md5|sha1|sha2|sha256|sha384|
sha512). (default: none)
* `checksum`: archive file checksum (match checksum_type)
* `checksum_url`: archive file checksum source (instead of specify checksum)
* `checksum_url`: archive file checksum source (instead of specify checksum),
supports http|https uri.
* `checksum_verify`: whether checksum will be verified (true|false). (default: true)
* `extract`: whether archive will be extracted after download (true|false).
(default: false)
Expand Down
7 changes: 4 additions & 3 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,8 @@ Default value: `none`

##### <a name="checksum_url"></a>`checksum_url`

archive file checksum source (instead of specifying checksum)
archive file checksum source (instead of specifying checksum),
supports http|https

##### <a name="checksum_verify"></a>`checksum_verify`

Expand Down Expand Up @@ -1095,7 +1096,7 @@ proxy type (none|ftp|http|https)

##### <a name="source"></a>`source`

archive file source, supports puppet|http|https|ftp|file|s3|gs uri.
archive file source, supports puppet|http|https|ftp|file|s3|gs|abspath uri.

##### <a name="target"></a>`target`

Expand All @@ -1108,7 +1109,7 @@ used.

##### <a name="url"></a>`url`

archive file source, supports http|https|ftp|file uri.
archive file source, supports puppet|http|https|ftp|file|s3|gs|abspath uri.
(for camptocamp/archive compatibility)

##### <a name="user"></a>`user`
Expand Down
14 changes: 10 additions & 4 deletions lib/puppet/type/archive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def should_to_s(value)
end

newparam(:source) do
desc 'archive file source, supports puppet|http|https|ftp|file|s3|gs uri.'
desc 'archive file source, supports puppet|http|https|ftp|file|s3|gs|abspath uri.'
validate do |value|
unless value =~ URI.regexp(%w[puppet http https ftp file s3 gs]) || Puppet::Util.absolute_path?(value)
raise ArgumentError, "invalid source url: #{value}"
Expand All @@ -131,10 +131,10 @@ def should_to_s(value)
end

newparam(:url) do
desc 'archive file source, supports http|https|ftp|file uri.
desc 'archive file source, supports puppet|http|https|ftp|file|s3|gs|abspath uri.
(for camptocamp/archive compatibility)'
validate do |value|
unless value =~ URI.regexp(%w[http https file ftp])
unless value =~ URI.regexp(%w[puppet http https ftp file s3 gs]) || Puppet::Util.absolute_path?(value)
raise ArgumentError, "invalid source url: #{value}"
end
end
Expand Down Expand Up @@ -174,7 +174,13 @@ def should_to_s(value)
end

newparam(:checksum_url) do
desc 'archive file checksum source (instead of specifying checksum)'
desc 'archive file checksum source (instead of specifying checksum),
supports http|https'
validate do |value|
unless value =~ URI.regexp(%w[http https])
raise ArgumentError, "invalid checksum url: #{value}"
end
end
end
newparam(:digest_url) do
desc 'archive file checksum source (instead of specifying checksum)
Expand Down