From 6202c3134b6f8f44ee3b9cf0dde086e037807dee Mon Sep 17 00:00:00 2001 From: Kenyon Ralph Date: Thu, 30 Nov 2023 15:55:54 -0800 Subject: [PATCH] plugin/discovery: use refreshonly on the untar exec Previously, if you change the image_name (such as for updating the Foreman Discovery Image version), the new tar file would be downloaded but not untarred because the content of the previous tar file would be there and pass the `creates` check. If we use `refreshonly` instead of `creates`, the untar exec will be executed when the tar file is updated, as expected. See also: https://github.com/theforeman/puppet-foreman_proxy/pull/774#issuecomment-1834709446 --- manifests/plugin/discovery.pp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/plugin/discovery.pp b/manifests/plugin/discovery.pp index b27826fa..e395c598 100644 --- a/manifests/plugin/discovery.pp +++ b/manifests/plugin/discovery.pp @@ -42,10 +42,10 @@ remote_location => "${source_url}${image_name}", mode => '0644', } ~> exec { "untar ${image_name}": - command => "tar xf ${image_name}", - path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - cwd => "${tftp_root_clean}/boot", - creates => "${tftp_root_clean}/boot/fdi-image/initrd0.img", + command => "tar xf ${image_name}", + path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + cwd => "${tftp_root_clean}/boot", + refreshonly => true, } } }