archive extraction fails
twojstaryzdomu opened this issue · comments
Affected Puppet, Ruby, OS and module versions/distributions
- Puppet: 8.5.1
- Ruby: 3.0.4
- Distribution: RHEL 9.3
- Module version :v7.1.0
How to reproduce (e.g Puppet code you use)
$dir = '/dev/shm/test'
$arch = '/dev/shm/test.tar.gz'
file { $dir:
ensure => directory,
}
archive { $arch:
ensure => present,
source => $arch,
extract => true,
extract_path => $dir,
require => File[$dir],
}
What are you seeing
Fails to extract an archive.
What behaviour did you expect instead
Properly extracting the archive, resulting in the following:
# ls -la /dev/shm/test
total 4
drwxr-xr-x 2 root root 60 Mar 21 15:29 .
drwxrwxrwt 3 root root 160 Mar 21 15:29 ..
-rw-r--r-- 1 user user 61 Mar 21 15:28 uptime
Output log
# uptime > uptime && tar -C . -czvf /dev/shm/test.tar.gz uptime && tar -tvf /dev/shm/test.tar.gz && sudo rm -rf /dev/shm/test
uptime
-rw-r--r-- user/user 61 2024-03-21 15:27 uptime
# sudo /opt/puppetlabs/bin/puppet apply --modulepath ./modules archive.pp
Notice: Compiled catalog for hostname in environment production in 0.03 seconds
Notice: /Stage[main]/Main/File[/dev/shm/test]/ensure: created
Notice: Applied catalog in 0.05 seconds
# ls -la /dev/shm/test
total 0
drwxr-xr-x 2 root root 40 Mar 21 15:27 .
drwxrwxrwt 3 root root 160 Mar 21 15:27 ..
Any additional information you'd like to impart
'creates' works but it is not really an option when knowing the archive contents upfront is not possible.
# uptime > uptime && tar -C . -czvf /dev/shm/test.tar.gz uptime && tar -tvf /dev/shm/test.tar.gz && sudo rm -rf /dev/shm/test
uptime
-rw-r--r-- user/user 61 2024-03-21 15:28 uptime
# sudo /opt/puppetlabs/bin/puppet apply --modulepath ./modules archive.pp
Notice: Compiled catalog for hostname in environment production in 0.03 seconds
Notice: /Stage[main]/Main/File[/dev/shm/test]/ensure: created
Notice: /Stage[main]/Main/Archive[/dev/shm/test.tar.gz]/creates: creates changed 'archive not extracted' to extracting in /dev/shm/test to create /dev/shm/test/uptime
Notice: Applied catalog in 0.06 seconds
# ls -la /dev/shm/test
total 4
drwxr-xr-x 2 root root 60 Mar 21 15:29 .
drwxrwxrwt 3 root root 160 Mar 21 15:29 ..
-rw-r--r-- 1 user user 61 Mar 21 15:28 uptime
# cat archive.pp
$dir = '/dev/shm/test'
$arch = '/dev/shm/test.tar.gz'
file { $dir:
ensure => directory,
}
archive { $arch:
ensure => present,
source => $arch,
extract => true,
extract_path => $dir,
creates => "${dir}/uptime",
require => File[$dir],
}