Skip to content

Commit

Permalink
(PA-5266) Change checksum algorithm to default
Browse files Browse the repository at this point in the history
Prior to this commit, the puppet_agent::prepare::package class used the
sha256lite algorithm in the file resource for local installation
packages.

In certain circumstances (e.g. when a download is interrupted), this
checksum, which only checks the first N bytes, does not provide
sufficient information to determine if the file is actually there.

This commit removes the checksum attribute altogether, which causes the
file resource to use its default algorithm, sha256. This algorithm
should handle circumstances like those outlined above.
  • Loading branch information
mhashizume committed Sep 25, 2023
1 parent ffc0575 commit c8c47cb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
13 changes: 6 additions & 7 deletions manifests/prepare/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@
}

file { $local_package_file_path:
ensure => file,
owner => $puppet_agent::params::user,
group => $puppet_agent::params::group,
mode => $mode,
source => $source,
require => File[$puppet_agent::params::local_packages_dir],
checksum => sha256lite,
ensure => file,
owner => $puppet_agent::params::user,
group => $puppet_agent::params::group,
mode => $mode,
source => $source,
require => File[$puppet_agent::params::local_packages_dir],
}
}
13 changes: 6 additions & 7 deletions spec/classes/puppet_agent_osfamily_redhat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,13 @@

it {
is_expected.to contain_file('/opt/puppetlabs/packages/puppet-agent-6.12.0.rpm')
.with('path' => '/opt/puppetlabs/packages/puppet-agent-6.12.0.rpm')
.with('ensure' => 'file')
.with('owner' => '0')
.with('group' => '0')
.with('mode' => '0644')
.with('source' => 'http://just-some-download/url:90/puppet-agent-6.12.0.rpm')
.with('path' => '/opt/puppetlabs/packages/puppet-agent-6.12.0.rpm')
.with('ensure' => 'file')
.with('owner' => '0')
.with('group' => '0')
.with('mode' => '0644')
.with('source' => 'http://just-some-download/url:90/puppet-agent-6.12.0.rpm')
.that_requires('File[/opt/puppetlabs/packages]')
.with('checksum' => 'sha256lite')
}

it {
Expand Down

0 comments on commit c8c47cb

Please sign in to comment.