chef-boneyard / tar

Deprecated: Chef cookbook for tar packages
Apache License 2.0
31 stars 63 forks source link

Allow directory name inside archive to be different #61

Open cregkly opened 5 years ago

cregkly commented 5 years ago

Cookbook version

2.2.0

Chef-client version

14.8.12

Platform Details

AWS Amazon Linux 2

Scenario:

Install duo_unix

Steps to Reproduce:

tar_package 'https://dl.duosecurity.com/duo_unix-latest.tar.gz' do
  configure_flags [ '--with-pam' ]
  prefix          '/usr'
  creates         '/lib64/security/pam_duo.so'
end

Expected Result:

duo_unix is installed

Actual Result:

The path can't be found

The reason is that the archive is called duo_unix-latest.tar.gz, but the folder inside it the version 'duo_unix-1.11.1'

There is currently no way to specify a different folder name in the module.

I fixed this in my local copy by adding a new variable: dir_name

property :dir_name,              String

action :install do
  r = new_resource
  basename = r.archive_name || ::File.basename(r.name)
  dirname = r.dir_name || basename.chomp('.tar.gz') # Assuming .tar.gz
  src_dir = r.source_directory

Then called:

tar_package 'https://dl.duosecurity.com/duo_unix-latest.tar.gz' do
  configure_flags [ '--with-pam' ]
  prefix          '/usr'
  creates         '/lib64/security/pam_duo.so'
  dir_name        'duo_unix-1.11.1'
end
welcomebot commented 5 years ago

Hey There It looks like this is the first issue you've filed against the chef-cookbooks project. I'm here to offer you a bit of extra help to make sure we can quickly get back to you. Make sure you've filled out all the fields in our issue template. Make sure you've provided us with the version of chef-client you're running, your operating system and the version of the cookbook. If you're not using the most up to date version of the cookbook then please make sure to update first. Lots of things change between versions even if you're issue isn't listed in the changelog. Finally please give us a detailed description of the issue you're having. The more we know about what you're trying to do, what actually happens, and how you can reproduce the problem, the better.

If you're looking for more immediate troubleshooting help make sure to check out #general on the Chef Community Slack. There's plenty of folks there willing to lend a helping hand. Thanks for the first issue. We hope we can get back to you soon with a solution.