Skip to content

Commit

Permalink
plugin/discovery: use refreshonly on the untar exec
Browse files Browse the repository at this point in the history
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: #774 (comment)
  • Loading branch information
kenyon committed Nov 30, 2023
1 parent 69c038e commit 6202c31
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions manifests/plugin/discovery.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
}

0 comments on commit 6202c31

Please sign in to comment.