diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 1fb6f7558..72dd33ed3 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -182,12 +182,12 @@ $checksum_type = undef } - exec { "force ${plugin}-${version}": - command => "/bin/rm -rf ${jenkins::plugin_dir}/${plugin}", + exec { "force staged ${plugin}-${version}": + command => "/bin/rm -rf ${jenkins::plugin_dir}/${plugin}.staged", } -> archive { $plugin: source => $download_url, - path => "${jenkins::plugin_dir}/${plugin}", + path => "${jenkins::plugin_dir}/${plugin}.staged", checksum_verify => $checksum_verify, checksum => $checksum, checksum_type => $checksum_type, @@ -197,6 +197,12 @@ require => $plugindir, notify => $notify, } + -> exec { "force ${plugin}-${version}": + command => "/bin/rm -rf ${jenkins::plugin_dir}/${plugin}", + } + -> exec { "stage ${plugin}-${version}": + command => "/bin/mv -f ${jenkins::plugin_dir}/${plugin}.staged ${jenkins::plugin_dir}/${plugin}", + } $archive_require = Archive[$plugin] } else { $archive_require = undef diff --git a/spec/defines/jenkins_plugin_spec.rb b/spec/defines/jenkins_plugin_spec.rb index 862aae0c2..e16622aba 100644 --- a/spec/defines/jenkins_plugin_spec.rb +++ b/spec/defines/jenkins_plugin_spec.rb @@ -15,7 +15,7 @@ it do is_expected.to contain_archive("#{title}.hpi").with( source: "#{plugin_host}/latest/myplug.hpi", - path: "#{pdir}/#{title}.hpi", + path: "#{pdir}/#{title}.hpi.staged", cleanup: false, extract: false ).that_requires("File[#{pdir}]").